agent-log-viewer 0.11.4 → 0.11.6
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/dist/standalone/.next/BUILD_ID +1 -1
- package/dist/standalone/.next/app-path-routes-manifest.json +10 -10
- package/dist/standalone/.next/build-manifest.json +2 -2
- package/dist/standalone/.next/prerender-manifest.json +3 -3
- package/dist/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/dist/standalone/.next/server/app/_global-error.html +1 -1
- package/dist/standalone/.next/server/app/_global-error.rsc +1 -1
- package/dist/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/dist/standalone/.next/server/app/_not-found.html +1 -1
- package/dist/standalone/.next/server/app/_not-found.rsc +1 -1
- package/dist/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/index.html +1 -1
- package/dist/standalone/.next/server/app/index.rsc +2 -2
- package/dist/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/dist/standalone/.next/server/app/index.segments/_full.segment.rsc +2 -2
- package/dist/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/page.js +2 -2
- package/dist/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/dist/standalone/.next/server/app-paths-manifest.json +10 -10
- package/dist/standalone/.next/server/chunks/747.js +2 -2
- package/dist/standalone/.next/server/middleware-build-manifest.js +1 -1
- package/dist/standalone/.next/server/pages/404.html +1 -1
- package/dist/standalone/.next/server/pages/500.html +1 -1
- package/dist/standalone/.next/server/server-reference-manifest.json +1 -1
- package/dist/standalone/.next/static/chunks/app/page-366d38b70e7c65be.js +2 -0
- package/dist/standalone/package.json +1 -1
- package/package.json +1 -1
- package/dist/standalone/.next/static/chunks/app/page-512e817b98392d9b.js +0 -2
- /package/dist/standalone/.next/static/{CzkCiRF6QqyxONEjepeCl → 1zBZBxWRgFSxgBSMGbD40}/_buildManifest.js +0 -0
- /package/dist/standalone/.next/static/{CzkCiRF6QqyxONEjepeCl → 1zBZBxWRgFSxgBSMGbD40}/_ssgManifest.js +0 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
(()=>{var a={};a.id=974,a.ids=[974],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},4494:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>f});var d=c(5735),e=c(27074);function f(){return(0,d.jsx)(e.Viewer,{})}},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},12412:a=>{"use strict";a.exports=require("assert")},17891:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/get-segment-param")},19022:()=>{},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},26713:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/is-bot")},27074:(a,b,c)=>{"use strict";c.d(b,{Viewer:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call Viewer() from the server but Viewer is 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/runner/work/live-log-viewer-next/live-log-viewer-next/src/components/Viewer.tsx","Viewer")},27910:a=>{"use strict";a.exports=require("stream")},28354:a=>{"use strict";a.exports=require("util")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},32076:(a,b,c)=>{"use strict";c.r(b),c.d(b,{__next_app__:()=>O,handler:()=>Q,routeModule:()=>P});var d=c(7553),e=c(84006),f=c(67798),g=c(34775),h=c(99373),i=c(73461),j=c(1020),k=c(26349),l=c(54365),m=c(16023),n=c(14965),o=c(63747),p=c(24235),q=c(23938),r=c(261),s=c(66758),t=c(77243),u=c(26713),v=c(37527),w=c(22820),x=c(88216),y=c(47929),z=c(79551),A=c(71797),B=c(89125),C=c(86439),D=c(77068),E=c(27269),F=c(37525),G=c(61287),H=c(81494),I=c(70722),J=c(70753),K=c(43954),L=c(17891),M={};for(let a in G)0>["default","__next_app__","routeModule","handler"].indexOf(a)&&(M[a]=()=>G[a]);c.d(b,M);let N={children:["",{children:["__PAGE__",{},{page:[()=>Promise.resolve().then(c.bind(c,4494)),"/home/runner/work/live-log-viewer-next/live-log-viewer-next/src/app/page.tsx"],metadata:{icon:[async a=>(await Promise.resolve().then(c.bind(c,70440))).default(a)],apple:[],openGraph:[],twitter:[],manifest:void 0}}]},{layout:[()=>Promise.resolve().then(c.bind(c,76537)),"/home/runner/work/live-log-viewer-next/live-log-viewer-next/src/app/layout.tsx"],"global-error":[()=>Promise.resolve().then(c.t.bind(c,95547,23)),"next/dist/client/components/builtin/global-error.js"],"not-found":[()=>Promise.resolve().then(c.t.bind(c,55091,23)),"next/dist/client/components/builtin/not-found.js"],forbidden:[()=>Promise.resolve().then(c.t.bind(c,45270,23)),"next/dist/client/components/builtin/forbidden.js"],unauthorized:[()=>Promise.resolve().then(c.t.bind(c,28193,23)),"next/dist/client/components/builtin/unauthorized.js"],metadata:{icon:[async a=>(await Promise.resolve().then(c.bind(c,70440))).default(a)],apple:[],openGraph:[],twitter:[],manifest:void 0}},[]]}.children,O={require:c,loadChunk:()=>Promise.resolve()},P=new d.AppPageRouteModule({definition:{kind:e.RouteKind.APP_PAGE,page:"/page",pathname:"/",bundlePath:"",filename:"",appPaths:[]},userland:{loaderTree:N},distDir:".next",relativeProjectDir:""});async function Q(a,b,d){var M,R,S,T,U;d.requestMeta&&(0,h.setRequestMeta)(a,d.requestMeta),P.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let V=!!(0,h.getRequestMeta)(a,"minimalMode"),W="/page";"/index"===W&&(W="/");let X=await P.prepare(a,b,{srcPage:W,multiZoneDraftMode:!1});if(!X)return b.statusCode=400,b.end("Bad Request"),null==d.waitUntil||d.waitUntil.call(d,Promise.resolve()),null;let{buildId:Y,query:Z,params:$,pageIsDynamic:_,buildManifest:aa,nextFontManifest:ab,reactLoadableManifest:ac,serverActionsManifest:ad,clientReferenceManifest:ae,subresourceIntegrityManifest:af,prerenderManifest:ag,isDraftMode:ah,resolvedPathname:ai,revalidateOnlyGenerated:aj,routerServerContext:ak,nextConfig:al,parsedUrl:am,interceptionRoutePatterns:an,deploymentId:ao,clientAssetToken:ap}=X,aq=(0,r.normalizeAppPath)(W),{isOnDemandRevalidate:ar}=X,as=al.experimental.ppr&&!al.cacheComponents&&(0,K.isInterceptionRouteAppPath)(ai)?null:P.match(ai,ag),at=(null==as?void 0:as.route)??null,au=!!ag.routes[ai],av=a.headers["user-agent"]||"",aw=(0,u.getBotType)(av),ax=(0,q.isHtmlBotRequest)(a),ay=(0,h.getRequestMeta)(a,"isPrefetchRSCRequest")??"1"===a.headers[t.NEXT_ROUTER_PREFETCH_HEADER],az=(0,h.getRequestMeta)(a,"isRSCRequest")??(0,n.f)(a.headers[t.RSC_HEADER]),aA=(0,s.getIsPossibleServerAction)(a),aB=(0,m.checkIsAppPPREnabled)(al.experimental.ppr),aC=a.headers[y.NEXT_RESUME_STATE_LENGTH_HEADER];if(!(0,h.getRequestMeta)(a,"postponed")&&V&&aB&&aA&&aC&&"string"==typeof aC){let e=parseInt(aC,10),{maxPostponedStateSize:f,maxPostponedStateSizeBytes:g}=(0,E.getMaxPostponedStateSize)(al.experimental.maxPostponedStateSize);if(!isNaN(e)&&e>0){if(e>g)return b.statusCode=413,b.end((0,E.getPostponedStateExceededErrorMessage)(f)),null==d.waitUntil||d.waitUntil.call(d,Promise.resolve()),null;let i="1 MB",j=(null==(U=al.experimental.serverActions)?void 0:U.bodySizeLimit)??i,k=e+(j!==i?c(95726).parse(j):1048576),l=await (0,E.readBodyWithSizeLimit)(a,k);if(null===l)return b.statusCode=413,b.end("Request body exceeded limit. To configure the body size limit for Server Actions, see: https://nextjs.org/docs/app/api-reference/next-config-js/serverActions#bodysizelimit"),null==d.waitUntil||d.waitUntil.call(d,Promise.resolve()),null;if(l.length>=e){let b=l.subarray(0,e).toString("utf8");(0,h.addRequestMeta)(a,"postponed",b);let c=l.subarray(e);(0,h.addRequestMeta)(a,"actionBody",c)}else throw Object.defineProperty(Error(`invariant: expected ${e} bytes of postponed state but only received ${l.length} bytes`),"__NEXT_ERROR_CODE",{value:"E979",enumerable:!1,configurable:!0})}}if(!(0,h.getRequestMeta)(a,"postponed")&&aB&&"1"===a.headers[y.NEXT_RESUME_HEADER]&&"POST"===a.method){let{maxPostponedStateSize:c,maxPostponedStateSizeBytes:e}=(0,E.getMaxPostponedStateSize)(al.experimental.maxPostponedStateSize),f=await (0,E.readBodyWithSizeLimit)(a,e);if(null===f)return b.statusCode=413,b.end((0,E.getPostponedStateExceededErrorMessage)(c)),null==d.waitUntil||d.waitUntil.call(d,Promise.resolve()),null;let g=f.toString("utf8");(0,h.addRequestMeta)(a,"postponed",g)}let aD=!0===P.isDev||!0===al.experimental.exposeTestingApiInProductionBuild,aE=aD&&("1"===a.headers[t.NEXT_INSTANT_PREFETCH_HEADER]||!(0,n.f)(a.headers[t.RSC_HEADER])&&"string"==typeof a.headers.cookie&&a.headers.cookie.includes(t.NEXT_INSTANT_TEST_COOKIE+"=")),aF=(aB||aE)&&((null==(M=ag.routes[aq]??ag.dynamicRoutes[aq])?void 0:M.renderingMode)==="PARTIALLY_STATIC"||aE&&(aD||(null==ak?void 0:ak.experimentalTestProxy)===!0)),aG=aE&&aF,aH=aG&&!0===P.isDev,aI=!1,aJ=aF?(0,h.getRequestMeta)(a,"postponed"):void 0,aK=null==(R=ag.routes[ai])?void 0:R.prefetchDataRoute,aL=aF&&az&&!ay&&!aK;V&&(aL=aL&&!!aJ);let aM=(0,h.getRequestMeta)(a,"segmentPrefetchRSCRequest"),aN=(!aw||!aF)&&(!av||(0,q.shouldServeStreamingMetadata)(av,al.htmlLimitedBots)),aO=!!((at||au||ag.routes[aq])&&!(aw&&aF)),aP=aF&&!0===al.cacheComponents,aQ=!0===P.isDev||!aO||"string"==typeof aJ||(aP&&(0,h.getRequestMeta)(a,"onCacheEntryV2")?aL&&!V:aL),aR=!!aw&&aF,aS=(null==at?void 0:at.remainingPrerenderableParams)??[],aT=(null==at?void 0:at.fallback)===null&&((null==(S=at.fallbackRootParams)?void 0:S.length)??0)>0,aU=null;if(!ah&&aO&&!aQ&&!aA&&!aJ&&!aL){let a=as?"string"==typeof(null==at?void 0:at.fallback)?at.fallback:as.source:null;if(!0===al.experimental.partialFallbacks&&a&&(null==at?void 0:at.fallbackRouteParams)&&!aT){if(aS.length>0){let b,c=(b=new Map(aS.map(a=>[a.paramName,a])),a.split("/").map(a=>{let c=(0,L.getSegmentParam)(a);if(!c)return a;let d=b.get(c.paramName);if(!d)return a;let e=null==$?void 0:$[d.paramName];if(!e)return a;let f=Array.isArray(e)?e.map(a=>encodeURIComponent(a)).join("/"):encodeURIComponent(e);return a.replace((0,o.buildDynamicSegmentPlaceholder)(d),f)}).join("/")||"/");aU=c!==a?c:null}}else aU=ai}let aV=aU;!aV&&(P.isDev||aO&&_&&(null==at?void 0:at.fallbackRouteParams)&&!aA)&&(aV=ai),P.isDev||ah||!aO||!az||aL||(0,k.d)(a.headers);let aW={...G,tree:N,handler:Q,routeModule:P,__next_app__:O};ad&&ae&&(0,p.setManifestsSingleton)({page:W,clientReferenceManifest:ae,serverActionsManifest:ad});let aX=a.method||"GET",aY=(0,g.getTracer)(),aZ=aY.getActiveScopeSpan(),a$=!!(null==ak?void 0:ak.isWrappedByNextServer),a_=!0===al.experimental.partialFallbacks&&aS.length>0?(null==at||null==(T=at.fallbackRouteParams)?void 0:T.filter(a=>!aS.some(b=>b.paramName===a.paramName)))??[]:[],a0=async()=>((null==ak?void 0:ak.render404)?await ak.render404(a,b,am,!1):b.end("This page could not be found"),null);try{let k,m=P.getVaryHeader(ai,an);b.setHeader("Vary",m);let n=async(c,d)=>{let e=new l.NodeNextRequest(a),f=new l.NodeNextResponse(b);return P.render(e,f,d).finally(()=>{if(!c)return;c.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let a=aY.getRootSpanAttributes();if(!a)return;if(a.get("next.span_type")!==i.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${a.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let d=a.get("next.route");if(d){let a=`${aX} ${d}`;c.setAttributes({"next.route":d,"http.route":d,"next.span_name":a}),c.updateName(a),k&&k!==c&&(k.setAttribute("http.route",d),k.updateName(a))}else c.updateName(`${aX} ${W}`)})},p=(0,h.getRequestMeta)(a,"incrementalCache")||await P.getIncrementalCache(a,al,ag,V);null==p||p.resetRequestCache(),globalThis.__incrementalCache=p;let q=async({span:e,postponed:f,fallbackRouteParams:g,forceStaticRender:i})=>{let k={query:Z,params:$,page:aq,sharedContext:{buildId:Y,deploymentId:ao,clientAssetToken:ap},serverComponentsHmrCache:(0,h.getRequestMeta)(a,"serverComponentsHmrCache"),fallbackRouteParams:g,renderOpts:{App:()=>null,Document:()=>null,pageConfig:{},ComponentMod:aW,Component:(0,j.T)(aW),params:$,routeModule:P,page:W,postponed:f,shouldWaitOnAllReady:aR,serveStreamingMetadata:aN,supportsDynamicResponse:"string"==typeof f||aQ,buildManifest:aa,nextFontManifest:ab,reactLoadableManifest:ac,subresourceIntegrityManifest:af,setCacheStatus:null==ak?void 0:ak.setCacheStatus,setIsrStatus:null==ak?void 0:ak.setIsrStatus,setReactDebugChannel:null==ak?void 0:ak.setReactDebugChannel,sendErrorsToBrowser:null==ak?void 0:ak.sendErrorsToBrowser,dir:c(33873).join(process.cwd(),P.relativeProjectDir),isDraftMode:ah,botType:aw,isOnDemandRevalidate:ar,isPossibleServerAction:aA,assetPrefix:al.assetPrefix,nextConfigOutput:al.output,crossOrigin:al.crossOrigin,trailingSlash:al.trailingSlash,images:al.images,previewProps:ag.preview,enableTainting:al.experimental.taint,htmlLimitedBots:al.htmlLimitedBots,reactMaxHeadersLength:al.reactMaxHeadersLength,multiZoneDraftMode:!1,incrementalCache:p,cacheLifeProfiles:al.cacheLife,basePath:al.basePath,serverActions:al.experimental.serverActions,logServerFunctions:"object"==typeof al.logging&&!!al.logging.serverFunctions,...aG||aH||aI?{isBuildTimePrerendering:!0,supportsDynamicResponse:!1,isStaticGeneration:!0,isDebugDynamicAccesses:aH}:{},cacheComponents:!!al.cacheComponents,experimental:{isRoutePPREnabled:aF,expireTime:al.expireTime,staleTimes:al.experimental.staleTimes,dynamicOnHover:!!al.experimental.dynamicOnHover,optimisticRouting:!!al.experimental.optimisticRouting,inlineCss:!!al.experimental.inlineCss,prefetchInlining:al.experimental.prefetchInlining??!1,authInterrupts:!!al.experimental.authInterrupts,cachedNavigations:!!al.experimental.cachedNavigations,clientTraceMetadata:al.experimental.clientTraceMetadata||[],clientParamParsingOrigins:al.experimental.clientParamParsingOrigins,maxPostponedStateSizeBytes:(0,D.parseMaxPostponedStateSize)(al.experimental.maxPostponedStateSize)},waitUntil:d.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:()=>{},onInstrumentationRequestError:(b,c,d,e)=>P.onRequestError(a,b,d,e,ak),err:(0,h.getRequestMeta)(a,"invokeError")}};i&&(k.renderOpts.supportsDynamicResponse=!1);let l=await n(e,k),{metadata:m}=l,{cacheControl:o,headers:q={},fetchTags:r,fetchMetrics:s}=m;if(r&&(q[y.NEXT_CACHE_TAGS_HEADER]=r),a.fetchMetrics=s,aO&&(null==o?void 0:o.revalidate)===0&&!P.isDev&&!aF){let a=m.staticBailoutInfo,b=Object.defineProperty(Error(`Page changed from static to dynamic at runtime ${ai}${(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:v.CachedRouteKind.APP_PAGE,html:l,headers:q,rscData:m.flightData,postponed:m.postponed,status:m.statusCode,segmentData:m.segmentData},cacheControl:o}},r=async({hasResolved:c,previousCacheEntry:g,isRevalidating:i,span:j,forceStaticRender:k=!1})=>{let l=!1===P.isDev,m=c||b.writableEnded;try{var n;let f;if(ar&&aj&&!g&&!V)return(null==ak?void 0:ak.render404)?await ak.render404(a,b):(b.statusCode=404,b.end("This page could not be found")),null;if(at&&(f=(0,w.parseFallbackField)(at.fallback)),!0===al.experimental.partialFallbacks&&(null==at?void 0:at.fallback)===null&&!aT&&aS.length>0&&(f=w.FallbackMode.PRERENDER),f===w.FallbackMode.PRERENDER&&(0,u.isBot)(av)&&(!aF||ax)&&(f=w.FallbackMode.BLOCKING_STATIC_RENDER),(null==g?void 0:g.isStale)===-1&&(ar=!0),ar&&(f!==w.FallbackMode.NOT_FOUND||g)&&(f=w.FallbackMode.BLOCKING_STATIC_RENDER),!V&&f!==w.FallbackMode.BLOCKING_STATIC_RENDER&&aV&&!m&&!ah&&_&&(l||!au)){if((l||at)&&f===w.FallbackMode.NOT_FOUND){if(al.adapterPath)return await a0();throw new C.NoFallbackError}if(aF&&(al.cacheComponents?!aL:!az)){let b=l&&"string"==typeof(null==at?void 0:at.fallback)?at.fallback:aq,f=(l||aG)&&(null==at?void 0:at.fallbackRouteParams)?(0,o.createOpaqueFallbackRouteParams)(at.fallbackRouteParams):aI?(0,o.getFallbackRouteParams)(aq,P):null;aG&&f&&(0,h.addRequestMeta)(a,"fallbackParams",f);let g=await P.handleResponse({cacheKey:b,req:a,nextConfig:al,routeKind:e.RouteKind.APP_PAGE,isFallback:!0,prerenderManifest:ag,isRoutePPREnabled:aF,responseGenerator:async()=>q({span:j,postponed:void 0,fallbackRouteParams:f,forceStaticRender:!0}),waitUntil:d.waitUntil,isMinimalMode:V});if(null===g)return null;if(g)return V||!aF||!(aS.length>0)||!0!==al.experimental.partialFallbacks||!aU||!p||ar||aI||aD||aE||ay||(0,J.scheduleOnNextTick)(async()=>{let b=P.getResponseCache(a);try{await b.revalidate(aU,p,aF,!1,a=>q({span:a.span,postponed:void 0,fallbackRouteParams:a_.length>0?(0,o.createOpaqueFallbackRouteParams)(a_):null,forceStaticRender:!0}),null,c,d.waitUntil)}catch(a){console.error("Error revalidating the page in the background",a)}}),delete g.cacheControl,g}}let s=ar||i||!aJ?void 0:aJ;if(aP&&!V&&p&&(aL||aA)&&!k){let b=await p.get(ai,{kind:v.IncrementalCacheKind.APP_PAGE,isRoutePPREnabled:!0,isFallback:!1});b&&b.value&&b.value.kind===v.CachedRouteKind.APP_PAGE&&(s=b.value.postponed,b&&(-1===b.isStale||!0===b.isStale)&&(0,J.scheduleOnNextTick)(async()=>{let b=P.getResponseCache(a);try{await b.revalidate(ai,p,aF,!1,a=>r({...a,forceStaticRender:!0}),null,c,d.waitUntil)}catch(a){console.error("Error revalidating the page in the background",a)}}))}if((aG||aH)&&void 0!==s)return{cacheControl:{revalidate:1,expire:void 0},value:{kind:v.CachedRouteKind.PAGES,html:x.default.EMPTY,pageData:{},headers:void 0,status:void 0}};let t=!P.isDev&&_&&(null==at?void 0:at.fallbackRouteParams)?(0,o.getPlaceholderFallbackRouteParams)($,at.fallbackRouteParams):null,y=t&&t.length>0?t:null==at?void 0:at.fallbackRouteParams,z=null!=t&&t.length>0,A=null;if(al.cacheComponents&&(null==at?void 0:at.fallbackRouteParams)){let b=(0,h.getRequestMeta)(a,"resolvedRouteParamKeys");b&&b.size>0&&(A=at.fallbackRouteParams.filter(a=>!b.has(a.paramName)))}let B=(l&&(0,h.getRequestMeta)(a,"renderFallbackShell")||z||aG&&!au)&&y?(0,o.createOpaqueFallbackRouteParams)(y):A&&A.length>0&&A.length<((null==at||null==(n=at.fallbackRouteParams)?void 0:n.length)??0)?(0,o.createOpaqueFallbackRouteParams)(A):aI?(0,o.getFallbackRouteParams)(aq,P):null;if((l||aG)&&al.cacheComponents&&!au&&(null==at?void 0:at.fallbackRouteParams)){let b=(0,o.createOpaqueFallbackRouteParams)(y??at.fallbackRouteParams);b&&(0,h.addRequestMeta)(a,"fallbackParams",b)}return q({span:j,postponed:s,fallbackRouteParams:B,forceStaticRender:k})}catch(b){throw(null==g?void 0:g.isStale)&&await P.onRequestError(a,b,{routerKind:"App Router",routePath:W,routeType:"render",revalidateReason:(0,f.c)({isStaticGeneration:aO,isOnDemandRevalidate:ar})},!1,ak),b}},s=async c=>{var f,g,i,j,k,l;let m,n=await P.handleResponse({cacheKey:aU,responseGenerator:a=>r({span:c,...a}),routeKind:e.RouteKind.APP_PAGE,isOnDemandRevalidate:ar,isRoutePPREnabled:aF,req:a,nextConfig:al,prerenderManifest:ag,waitUntil:d.waitUntil,isMinimalMode:V});if(ah&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate"),P.isDev&&b.setHeader("Cache-Control","no-cache, must-revalidate"),!n){if(aU)throw Object.defineProperty(Error("invariant: cache entry required but not generated"),"__NEXT_ERROR_CODE",{value:"E62",enumerable:!1,configurable:!0});return null}if((null==(f=n.value)?void 0:f.kind)!==v.CachedRouteKind.APP_PAGE)throw Object.defineProperty(Error(`Invariant app-page handler received invalid cache entry ${null==(i=n.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E707",enumerable:!1,configurable:!0});let o="string"==typeof n.value.postponed;az&&!aA&&ao&&b.setHeader(y.NEXT_NAV_DEPLOYMENT_ID_HEADER,ao),aO&&!aL&&(!o||ay)&&(V||b.setHeader("x-nextjs-cache",ar?"REVALIDATED":n.isMiss?"MISS":n.isStale?"STALE":"HIT"),b.setHeader(t.NEXT_IS_PRERENDER_HEADER,"1"));let{value:p}=n;if(aJ)m={revalidate:0,expire:void 0};else if(aL)m={revalidate:0,expire:void 0};else if(!P.isDev)if(ah)m={revalidate:0,expire:void 0};else if(aO){if(n.cacheControl)if("number"==typeof n.cacheControl.revalidate){if(n.cacheControl.revalidate<1)throw Object.defineProperty(Error(`Invalid revalidate configuration provided: ${n.cacheControl.revalidate} < 1`),"__NEXT_ERROR_CODE",{value:"E22",enumerable:!1,configurable:!0});m={revalidate:n.cacheControl.revalidate,expire:(null==(j=n.cacheControl)?void 0:j.expire)??al.expireTime}}else m={revalidate:y.CACHE_ONE_YEAR_SECONDS,expire:void 0}}else b.getHeader("Cache-Control")||(m={revalidate:0,expire:void 0});if(n.cacheControl=m,"string"==typeof aM&&(null==p?void 0:p.kind)===v.CachedRouteKind.APP_PAGE&&p.segmentData){b.setHeader(t.NEXT_DID_POSTPONE_HEADER,"2");let c=null==(k=p.headers)?void 0:k[y.NEXT_CACHE_TAGS_HEADER];V&&aO&&c&&"string"==typeof c&&b.setHeader(y.NEXT_CACHE_TAGS_HEADER,c);let d=p.segmentData.get(aM);return void 0!==d?(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:x.default.fromStatic(d,t.RSC_CONTENT_TYPE_HEADER),cacheControl:n.cacheControl}):(b.statusCode=204,(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:x.default.EMPTY,cacheControl:n.cacheControl}))}let s=aP?(0,h.getRequestMeta)(a,"onCacheEntryV2")??(0,h.getRequestMeta)(a,"onCacheEntry"):(0,h.getRequestMeta)(a,"onCacheEntry");if(s){let b=(0,h.getRequestMeta)(a,"initURL")??a.url,c=b?(null==(l=(0,F.parseUrl)(b))?void 0:l.pathname)??b:void 0;if(await s(n,{url:c}))return null}if(p.headers){let a={...p.headers};for(let[c,d]of(V&&aO||delete a[y.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 u=null==(g=p.headers)?void 0:g[y.NEXT_CACHE_TAGS_HEADER];if(V&&aO&&u&&"string"==typeof u&&b.setHeader(y.NEXT_CACHE_TAGS_HEADER,u),!p.status||az&&aF||(b.statusCode=p.status),!V&&p.status&&H.RedirectStatusCode[p.status]&&az&&(b.statusCode=200),o&&!aL&&b.setHeader(t.NEXT_DID_POSTPONE_HEADER,"1"),az&&!ah){if(void 0===p.rscData){if(p.html.contentType!==t.RSC_CONTENT_TYPE_HEADER)if(al.cacheComponents)return b.statusCode=404,(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:x.default.EMPTY,cacheControl:n.cacheControl});else throw Object.defineProperty(new I.InvariantError(`Expected RSC response, got ${p.html.contentType}`),"__NEXT_ERROR_CODE",{value:"E789",enumerable:!1,configurable:!0});return(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:p.html,cacheControl:n.cacheControl})}return(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:x.default.fromStatic(p.rscData,t.RSC_CONTENT_TYPE_HEADER),cacheControl:n.cacheControl})}let w=p.html;if(aE&&aG){let c=!0===P.isDev?crypto.randomUUID():null;return w.pipeThrough(await (0,A.createInstantTestScriptInsertionTransformStream)(c)),(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:w,cacheControl:{revalidate:0,expire:void 0}})}if(!o||V||az)return(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:w,cacheControl:n.cacheControl});if(aG||aH)return w.push(new ReadableStream({start(a){a.enqueue(z.ENCODED_TAGS.CLOSED.BODY_AND_HTML),a.close()}})),(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:w,cacheControl:{revalidate:0,expire:void 0}});let C=new TransformStream;return w.push(C.readable),q({span:c,postponed:p.postponed,fallbackRouteParams:null,forceStaticRender:!1}).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)!==v.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(C.writable)}).catch(a=>{C.writable.abort(a).catch(a=>{console.error("couldn't abort transformer",a)})}),(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:w,cacheControl:{revalidate:0,expire:void 0}})};if(!a$||!aZ)return k=aY.getActiveScopeSpan(),await aY.withPropagatedContext(a.headers,()=>aY.trace(i.BaseServerSpan.handleRequest,{spanName:`${aX} ${W}`,kind:g.SpanKind.SERVER,attributes:{"http.method":aX,"http.target":a.url}},s),void 0,!a$);await s(aZ)}catch(b){throw b instanceof C.NoFallbackError||await P.onRequestError(a,b,{routerKind:"App Router",routePath:W,routeType:"render",revalidateReason:(0,f.c)({isStaticGeneration:aO,isOnDemandRevalidate:ar})},!1,ak),b}}},33873:a=>{"use strict";a.exports=require("path")},40132:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,95547,23)),Promise.resolve().then(c.t.bind(c,15098,23)),Promise.resolve().then(c.t.bind(c,47644,23)),Promise.resolve().then(c.t.bind(c,33859,23)),Promise.resolve().then(c.t.bind(c,98099,23)),Promise.resolve().then(c.t.bind(c,16237,23)),Promise.resolve().then(c.t.bind(c,98562,23)),Promise.resolve().then(c.t.bind(c,36675,23))},41025:a=>{"use strict";a.exports=require("next/dist/server/app-render/dynamic-access-async-storage.external.js")},43954:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/interception-routes")},58774:()=>{},61106:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,81921,23))},61135:()=>{},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},64100:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,81921,23)),Promise.resolve().then(c.t.bind(c,60440,23)),Promise.resolve().then(c.t.bind(c,84342,23)),Promise.resolve().then(c.t.bind(c,82265,23)),Promise.resolve().then(c.t.bind(c,35421,23)),Promise.resolve().then(c.t.bind(c,61335,23)),Promise.resolve().then(c.t.bind(c,70664,23)),Promise.resolve().then(c.bind(c,74661))},65223:(a,b,c)=>{Promise.resolve().then(c.bind(c,27074))},70440:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>e});var d=c(88868);let e=async a=>[{type:"image/x-icon",sizes:"16x16",url:(0,d.fillMetadataSegment)(".",await a.params,"favicon.ico",!0)+"?603d046c9a6fdfbb"}]},70722:a=>{"use strict";a.exports=require("next/dist/shared/lib/invariant-error")},74075:a=>{"use strict";a.exports=require("zlib")},76537:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>g,metadata:()=>e,viewport:()=>f});var d=c(5735);c(61135);let e={title:"Live logs",description:"Live viewer for Codex/Claude agent logs"},f={width:"device-width",initialScale:1,viewportFit:"cover",interactiveWidget:"resizes-content"};function g({children:a}){return(0,d.jsx)("html",{lang:"en",className:"h-full antialiased",children:(0,d.jsx)("body",{className:"h-dvh overflow-hidden font-sans text-[15px]",children:a})})}},77068:a=>{"use strict";a.exports=require("next/dist/shared/lib/size-limit")},77845:(a,b,c)=>{"use strict";c.d(b,{Viewer:()=>fw});var d=c(48249),e=c(67484);let f=(...a)=>a.filter((a,b,c)=>!!a&&""!==a.trim()&&c.indexOf(a)===b).join(" ").trim(),g=a=>{let b=a.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,b,c)=>c?c.toUpperCase():b.toLowerCase());return b.charAt(0).toUpperCase()+b.slice(1)};var h={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let i=(0,e.createContext)({}),j=(0,e.forwardRef)(({color:a,size:b,strokeWidth:c,absoluteStrokeWidth:d,className:g="",children:j,iconNode:k,...l},m)=>{let{size:n=24,strokeWidth:o=2,absoluteStrokeWidth:p=!1,color:q="currentColor",className:r=""}=(0,e.useContext)(i)??{},s=d??p?24*Number(c??o)/Number(b??n):c??o;return(0,e.createElement)("svg",{ref:m,...h,width:b??n??h.width,height:b??n??h.height,stroke:a??q,strokeWidth:s,className:f("lucide",r,g),...!j&&!(a=>{for(let b in a)if(b.startsWith("aria-")||"role"===b||"title"===b)return!0;return!1})(l)&&{"aria-hidden":"true"},...l},[...k.map(([a,b])=>(0,e.createElement)(a,b)),...Array.isArray(j)?j:[j]])}),k=(a,b)=>{let c=(0,e.forwardRef)(({className:c,...d},h)=>(0,e.createElement)(j,{ref:h,iconNode:b,className:f(`lucide-${g(a).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${a}`,c),...d}));return c.displayName=g(a),c},l=k("triangle-alert",[["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"}]]),m=k("funnel",[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]]),n=k("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),o={en:{"common.serverUnavailable":"server unavailable","common.loading":"loading…","common.loadingCap":"Loading…","common.cancel":"Cancel","common.show":"show","common.showAll":"show all","common.collapse":"collapse","common.copy":"Copy","common.copied":"copied","common.clickToCopy":"click to copy","common.yes":"Yes","common.no":"No","common.send":"Send","common.sending":"sending…","common.sent":"sent","common.close":"Close","common.failedSend":"couldn't send","common.failedDelete":"couldn't delete","common.nothingFound":"Nothing found","common.nothingRunning":"nothing is running right now","common.kb":"kB","common.chars":"{n} chars","lang.aria":"Interface language","util.effortTitle":"Reasoning effort: {effort}","time.agoSec":"{n}s ago","time.agoMin":"{n}m ago","time.agoHour":"{n}h ago","time.agoDay":"{n}d ago","kind.session":"session","kind.subagent":"subagent","kind.job":"job","kind.background":"background","kind.handoff":"handoff","rail.title":"Agent logs","rail.filter":"Filter projects…","rail.projects":"Projects","rail.overview":"Overview","rail.archive":"Archive","dash.branchesLive":{one:"{count} branch running",other:"{count} branches running"},"dash.trees":{one:"{count} tree",other:"{count} trees"},"dash.recentConvos":{one:"{count} recent conversation",other:"{count} recent conversations"},"dash.quietTrees":{one:"{count} quiet tree",other:"{count} quiet trees"},"dash.openProjects":"Open project list","dash.unarchive":"Restore from archive","dash.newConvo":"New conversation with an agent","dash.agent":"Agent","dash.newWorkflow":"New workflow: stages → review → PR","dash.workflow":"Workflow","dash.emptyTitle":"The scheme is empty for now","dash.emptyHint":"Open the switchboard in the bottom-right corner and click a conversation — it will appear here","dash.viewScheme":"scheme","dash.viewList":"list","trash.title":"The scheme is empty, but the project has records","trash.hint":"Clicking a row opens the conversation as a node; the trash icon deletes its file from disk permanently.","trash.deletedFromDisk":"\xb7 deleted from disk","trash.open":"Open {title}","trash.activeSubtree":"active branches","trash.toArchive":"Archive","trash.notDeleted":"{failed} of {total} not deleted","trash.confirmDelete":{one:"Delete {count} project file from disk?",other:"Delete {count} project files from disk?"},"trash.deleting":"deleting…","trash.confirmYes":"Yes, delete","trash.deleteProject":"Delete project from disk","switch.aria":"Agent switchboard","switch.title":"Switchboard","switch.search":"Search by name or project","switch.updating":"updating…","switch.close":"Close switchboard","switch.waiting":"Waiting for you","switch.working":"Working","switch.recent":"Recent","switch.older":"Older","switch.hidden":"Hidden ({count})","switch.hide":"hide","switch.restore":"restore","switchCard.openColumn":"Open {title} as a column","switchCard.remove":"Remove from switchboard","composer.imagesCount":{one:"{count} image",other:"{count} images"},"composer.spawned":"launched agent in tmux {target}","composer.sentPaths":"sent {count} path(s)","composer.failedInterrupt":"couldn't interrupt","composer.escapeSent":"sent Escape — agent interrupted","composer.spawnAria":"Launch an agent with a prompt in tmux","composer.sendAria":"Send a message to the agent in tmux {target}","composer.queueAria":"Queue of sent messages","composer.removeFromQueue":"Remove from queue","composer.placeholderRelay":"type — I'll relay through the root session…","composer.placeholderSpawn":"prompt — the agent will start in tmux…","composer.placeholderSend":"message the agent…","composer.textAria":"Text for the agent","composer.titleRelay":"relayed through the branch's root session","composer.titleSpawnResumed":"new tmux window with the resumed agent","composer.root":"root","composer.interruptAria":"Interrupt the agent (Escape)","composer.interruptTitle":"send Escape to the agent pane","composer.compactAria":"Compact the agent's context (/compact)","composer.compactTitle":"send /compact — the agent condenses its context; a band appears in the feed when done","composer.compactConfirm":"Compact?","composer.compactConfirmTitle":"Click again to send /compact","composer.compactSent":"compaction started — the band will appear in the feed once it's done","composer.failedCompact":"couldn't start compaction","composer.addImages":"Add images","composer.moreTools":"More actions","composer.stopAndSend":"Stop recording and send","composer.launchAgent":"Launch the agent","composer.sendToAgent":"Send to the agent","composer.stopAndSendTitle":"stop recording and send","composer.sendMenuTitle":"Send options","composer.quickAck":"Yes, continue","composer.quickAckLabel":"Continue","composer.quickAckAria":"Send a quick “Yes, continue” to the agent","composer.quickAckTitle":"Quick reply — yes, continue","draft.readPrompt":"Read the agent conversation in file {src} and continue from there: ","draft.needDir":"specify a working directory","draft.launchFailed":"couldn't launch","draft.paneAria":"Draft of a new agent conversation","draft.notStarted":"agent not started yet","draft.engineAria":"Agent engine","draft.handoffLabel":"handoff: {title}","draft.newConvo":"new conversation","draft.conversation":"conversation","draft.dismiss":"Dismiss the draft conversation","draft.directory":"directory","draft.dirAria":"Agent working directory","draft.reasoning":"reasoning","draft.reasoningAria":"Reasoning effort level","draft.effortDefault":"effort: default","draft.speedAria":"Codex speed mode","draft.speedTitle":"fast = priority tier (1.5x speed, higher usage)","draft.speedDefault":"speed: default","draft.imagesOnly":"(images)","draft.launched":"agent launched in tmux {target} — waiting for the conversation to appear here…","draft.slow":"Taking a while. Check tmux window {target} — the panel will pick up the transcript as soon as it appears.","draft.hintRelay":"The new agent will first read the parent conversation's transcript and pick up from there. Add to the prompt what to do next — the branch will appear on the scheme alongside.","draft.hintNew":"Choose an engine and a directory, write the first prompt — the agent will start in tmux, and the conversation will continue in this same panel.","draft.promptAria":"First prompt for the new agent","draft.placeholder":"first prompt — the agent will start in tmux…","draft.promptTextAria":"First prompt text","draft.newWindowTitle":"new tmux window with a fresh agent","draft.newAgent":"new agent","draft.addImages":"Add images to the prompt","draft.stopAndLaunch":"Stop recording and launch the agent","link.handoffContext":"You've been handed another agent's context — the conversation \xab{title}\xbb. Its transcript: {path} — read that file first for full context, then carry out the request below.\n\n{ask}","link.dropped":"context is in the composer of \xab{title}\xbb — type the ask and send","handoff.aria":"Hand the conversation to a new agent — a draft appears below","handoff.title":"click — draft a new agent with this context \xb7 drag — link to an existing one","handoff.label":"hand off to agent","qr.showAria":"Show a QR code for phone login","qr.failed":"couldn't get the link","qr.startHint":"Start the viewer with Tailscale access: ","qr.alt":"QR code for phone login","qr.generating":"generating QR…","qr.linkAria":"Phone login link","qr.copy":"Copy link","qr.scanHint":"scan from a phone on the same tailnet","push.enabled":"Push notifications enabled","push.enable":"Enable push notifications","push.disable":"Disable push notifications","push.needsHttps":"Push requires HTTPS","sound.on":"Sound notifications on","sound.off":"Sound notifications off","sound.mute":"Mute sound notifications","sound.unmute":"Enable sound notifications","mic.stopRecognize":"Stop recording and transcribe","mic.cancel":"Cancel recording","mic.recognizing":"Transcribing…","mic.dictate":"Dictate","mic.dictateHint":"dictate (up to 2 min) \xb7 right-click: transcription method","mic.connecting":"Connecting the microphone — a moment…","mic.menuTitle":"Transcription method","mic.menuLoading":"checking what's available…","mic.menuLocked":"Locked by the LLV_TRANSCRIBE_BACKEND environment variable","mic.noKey":"not set up","mic.saveFailed":"couldn't save the choice","mic.keyTitle":"{name} is not set up","mic.copy":"copy","mic.copyPath":"Copy path","mic.copied":"copied","mic.back":"Back","stt.local.name":"Faster Whisper","stt.local.desc":"Free, fully local — audio never leaves this machine.","stt.local.fix":"Run scripts/setup-whisper.sh in the app folder once; it installs the local engine at:","stt.chatgpt.name":"ChatGPT Voice","stt.chatgpt.desc":"Covered by your ChatGPT subscription, via the Codex login.","stt.chatgpt.fix":"Log in to Codex (run `codex login`) — the token will appear at:","stt.elevenlabs.name":"ElevenLabs Scribe","stt.elevenlabs.desc":"Paid ElevenLabs API — the most accurate option.","stt.elevenlabs.fix":"Put your ElevenLabs API key (a single line) into this file:","delFile.confirm":"Delete from disk?","delFile.aria":"Delete the conversation from disk","img.readFailed":"couldn't read the image","img.readAborted":"image reading aborted","img.unsupported":"unsupported image format: {name}","img.unknownFile":"unknown file","img.tooLarge":"{name}: too large (10 MB limit)","img.image":"image","img.error":"image error","img.previewAlt":"image preview {n}","img.removeAria":"Remove image {n}","img.toFilePaths":"as file paths","question.sec":"{n} s","question.min":"{n} min","question.hour":"{n} h","question.waiting":"waiting for a reply","question.sentToPane":"Sent to the pane: {text}","question.keysHint":"keys into the pane \xb7 or the composer below","question.pane":"Pane {target}","question.alreadyAnswered":"answer already recorded","question.openFailed":"couldn't open the session","question.opened":"opened {target}","question.answered":"Answered: {text}","question.answeredElsewhere":"Answered elsewhere: {text}","question.noPane":"tmux pane unavailable","question.openSession":"open session","question.rejectComment":"Rejection comment…","question.approved":"approved","question.rejected":"rejected","question.approve":"Approve","question.reject":"Reject","question.ownAnswer":"Your own answer…","inbox.deleted":"deleted from disk","inbox.fileGone":"the file is no longer on disk","inbox.confirmDelete":"Delete the file from disk?","inbox.deleteAria":"Delete {name} from disk","inbox.deleteFromDisk":"delete from disk","inbox.attachedAlt":"attached image {name}","lightbox.zoomOut":"Zoom out","lightbox.resetZoom":"Reset zoom","lightbox.zoomIn":"Zoom in","feed.agentEnded":"agent finished","feed.copyCode":"Copy code","feed.copyMd":"Copy message (Markdown)","feed.running":"running {tool}…","feed.tool":"tool","feed.thinking":"thinking…","feed.working":"working…","feed.liveTail":"live tail","feed.backToLive":"Back to the live tail","feed.newCount":"{count} new","feed.down":"down","feed.pickLog":"Pick a log on the left — the feed updates itself","feed.showEarlier":"show earlier","feed.showEarlierHidden":"show earlier (hidden {count})","feed.loadEarlier":"load earlier from the file","feed.startOfConvo":"start of the conversation","feed.finishedTurn":"finished the turn — waiting for a reply","feed.returnedResult":"returned with a result","feed.noOutput":"No output yet — the file is empty for now","feed.onlyService":"Only service records are present ({count}).","feed.empty":"Empty (no rows to show)","render.system":"system","render.executing":"executing…","render.error":"error","render.teammate":"teammate","render.left":"{peer}: left{at}","render.codexSessionCreated":"Codex session created","render.taskStarted":"Task started","render.taskComplete":"Task completed","render.compacted":"context compacted","render.compactAuto":"auto","render.compactManual":"manual","render.compactPre":"{n}k tokens before","render.compactSummary":"conversation summary","render.patch":"patch","render.stdinSession":"stdin → session {id}","render.record":"record","render.protocol":"protocol","render.jobLogNote":"(this is a job log: it has no command stdout; the full output is in the Codex rollout session in the left list)","render.image":"image","render.dataKb":"{n} kB of data","render.commands":{one:"{count} command",other:"{count} commands"},"render.noFindings":"no findings","render.moreFindings":"{count} more findings in raw","render.memoryCitations":"memory citations ({count})","render.noCitations":"no citation entries","render.moreEntries":"{count} more entries in raw","render.truncated":"truncated","render.shutdownRequest":"shutdown request","render.shutdownResponse":"shutdown response","render.planRequest":"plan approval request","render.planVerdict":"plan verdict","render.approved":"approved","render.rejected":"rejected","render.from":"from {from}","render.structured":"structured message","render.showJson":"show JSON","render.noOutputInLog":"(output is absent from this log file — the full output is in the Codex rollout session)","render.filesChanged":"files changed","render.toDir":"to","render.fromDir":"from","render.delivered":"delivered","render.notDelivered":"not delivered","render.reasoning":"agent reasoning","flowDialog.engine":"Engine: {label}","flowDialog.modelPlaceholder":"model (default)","flowDialog.model":"Model: {label}","flowDialog.effortDefault":"effort: default","flowDialog.createFailed":"couldn't create the flow ({status})","flowDialog.title":"Start a flow","flowDialog.subtitle":"implement → review \xb7 this conversation becomes the implementer","flowDialog.preset":"preset","flowDialog.rolesManualOpen":"▾ roles manually","flowDialog.rolesManual":"▸ roles manually (model / effort)","flowDialog.implementer":"implementer","flowDialog.reviewer":"reviewer","flowDialog.diffBase":"diff base","flowDialog.fromHead":"from current HEAD","flowDialog.fromMergeBase":"from merge-base with main","flowDialog.headless":"headless (no pane)","flowDialog.tmuxPane":"tmux pane","flowDialog.transitions":"transitions","flowDialog.auto":"auto","flowDialog.manual":"manual (gate every step)","flowDialog.roundLimit":"round limit","flowDialog.creating":"creating…","flowDialog.start":"▶ Start","flowStrip.startReview":"Start review","flowStrip.spawnReviewer":"Spawn reviewer","flowStrip.relayNotes":"Relay notes","flowStrip.retryRound":"Retry round","flowStrip.anotherRound":"Another round","flowStrip.flow":"FLOW","flowStrip.roundsAria":"Review rounds","flowStrip.roundError":"Round {n}: {error}","flowStrip.roundVerdict":"Round {n}: {verdict}","flowStrip.roundInProgress":"Round {n}: in progress","flowStrip.addRoundsTitle":"Add more rounds to the limit","flowStrip.plus2":"+2 rounds","flowStrip.limitTitle":"Round limit: reviews before the loop parks (∞ — unlimited)","flowStrip.limitAria":"Set the round limit to {count}","flowStrip.limitUnlimitedAria":"Unlimited rounds","flowStrip.stopReviewer":"Stop","flowStrip.stopReviewerTitle":"Stop the running reviewer; the round lands in “needs decision”","flowStrip.notePlaceholder":"note for the reviewer…","flowStrip.noteTitle":"Sent to the next reviewer as the round's ready note","flowStrip.autoTitle":"Auto: transitions run themselves. Click — manual.","flowStrip.manualTitle":"Manual: every transition waits for a click. Click — auto.","flowStrip.manualShort":"manual","flowStrip.resume":"Resume flow","flowStrip.pause":"Pause","flowStrip.close":"Close flow","roundDeck.roundAborted":"Round {n} \xb7 aborted","roundDeck.roundVerdict":"Round {n} \xb7 {verdict}","roundDeck.roundInProgress":"Round {n} \xb7 in progress","roundDeck.aborted":"aborted","roundDeck.reviewInProgress":"review in progress","roundDeck.waitingFirst":"waiting for the first review round…","roundDeck.spawningReviewer":"launching the reviewer — the transcript will appear shortly…","roundDeck.moreRounds":"{count} more round(s) — click the chips on the flow strip","roundDeck.findings":{one:"{count} finding",other:"{count} findings"},"flowState.waiting_ready":"waiting for READY","flowState.spawn_pending":"ready to spawn the reviewer","flowState.spawning":"spawning the reviewer","flowState.reviewing":"reviewing","flowState.relay_pending":"verdict ready — relay?","flowState.relaying":"relaying notes","flowState.fixing":"fixing","flowState.approved":"approved","flowState.done_comment":"done with comments","flowState.needs_decision":"needs a decision","flowState.paused":"paused","flowState.closed":"closed","flowModel.failed":"failed ({status})","wfState.provisioning":"provisioning the worktree","wfState.implementing":"stages running","wfState.reviewing":"reviewing","wfState.finishing":"finishing","wfState.approved":"approved","wfState.needs_decision":"needs a decision","wfState.paused":"paused","wfState.closed":"closed","wfModel.failed":"failed ({status})","wfStrip.workflow":"WORKFLOW","wfStrip.stagesAria":"Workflow stages","wfStrip.reviewStage":"review","wfStrip.advance":"Advance","wfStrip.retryStage":"Retry stage","wfStrip.skipStage":"Skip","wfStrip.resume":"Resume workflow","wfStrip.pause":"Pause","wfStrip.close":"Close workflow","wfDraft.paneAria":"Draft of a new workflow","wfDraft.notStarted":"the workflow is not launched yet","wfDraft.newWorkflow":"new workflow","wfDraft.dismiss":"Dismiss the workflow draft","wfDraft.template":"template","wfDraft.templateAria":"Workflow template","wfDraft.repo":"repository","wfDraft.repoAria":"Repository directory","wfDraft.manualMode":"manual: a gate at every stage boundary","wfDraft.hint":"Pick a template and a repository, describe the task — the workflow creates a worktree, runs the stages and the review, then opens a PR.","wfDraft.taskPlaceholder":"the task for the workflow — the brief goes to every stage…","wfDraft.taskAria":"Workflow task brief","wfDraft.footerHint":"worktree \xb7 stages \xb7 review \xb7 PR","wfDraft.finishMerge":"local merge","wfDraft.needDir":"set the repository directory","wfDraft.needTask":"describe the task","wfDraft.launchFailed":"launch failed","wfDraft.launch":"▶ Launch workflow","wfDraft.launching":"launching…","scheme.flowTitle":"Run the implement → review cycle for this conversation","scheme.flow":"Flow","scheme.collapsedTitle":"Collapsed branches and tasks of this conversation","scheme.underneath":"underneath","scheme.handTool":"Hand — drag the canvas (H, or hold Space)","scheme.selectTool":"Select — click and work with conversations (V)","scheme.zoomOut":"Zoom out (−)","scheme.zoom100":"Zoom 100% (1)","scheme.zoomIn":"Zoom in (+)","scheme.fit":"Fit all (0, or double-click the background)","scheme.roleImplementer":"Implementer","scheme.roleReviewer":"Reviewer","scheme.roleWorking":"working","scheme.roleWaiting":"waiting","scheme.lassoTool":"Multi-select — draw a box around agents, click cards to toggle","bulk.selectedCount":{one:"{count} selected",other:"{count} selected"},"bulk.placeholder":"one message to every selected agent…","bulk.textAria":"Broadcast text for the selected agents","bulk.sendAll":"Send to {count} agents","bulk.interrupt":"Interrupt","bulk.stop":"Stop","bulk.stopConfirm":"Stop {count} agents?","bulk.remove":"Clear from board","bulk.removeConfirm":"Close {count} cards?","bulk.flow":"Flow","bulk.fit":"Show selection","bulk.exit":"Exit selection (Esc)","bulk.retryFailed":"Retry failed ({count})","bulk.nodeGone":"node left the board","bulk.flowTitle":"Start a review flow on {count} agents","bulk.flowStart":"Start {count} flows","minimap.title":"Minimap — click or drag to navigate","plan.agentPlan":"Agent plan:","plan.stepsAria":"Plan: {done} of {total} steps","plan.nowSuffix":", now: {current}","plan.goal":"goal","plan.goalDone":"goal ✓","plan.goalBlocked":"goal ✖","plan.noObjective":"(objective not recorded in the transcript tail)","plan.tokens":"tokens: {n}","plan.time":"time: {n} min","plan.ctxTitle":"Context window: {pct}% used\n{used} of {window} tokens","plan.ctxAria":"Context: {pct} percent of the window used","plan.goalAria":"Session goal: {status}","limits.now":"now","limits.inMin":"in {n}m","limits.inHour":"in {n}h","limits.inDay":"in {n}d","limits.asOf":"as of {time}","limits.left":"left","limits.reset":"reset {eta} \xb7 {at}","limits.stale":"data is stale: {stale}","limits.5h":"5h","limits.week":"Week","resources.ram":"RAM","resources.swap":"Swap","resources.free":"{amount} free","resources.used":"{amount} used","resources.stale":"resource data is stale: {stale}","resources.openAria":"Agent sessions and memory","resources.title":"Agent sessions","resources.total":"Σ {amount}","resources.empty":"no agent sessions in tmux","resources.orphan":"orphan pane","resources.procs":{one:"{count} process",other:"{count} processes"},"resources.swapShare":"+ {amount} swap","resources.kill":"Kill","resources.confirm":"Sure?","resources.killLiveHint":"the agent is working right now — click to unlock, then confirm","resources.killHint":"kill the tmux pane with its whole process tree","resources.bulkLabel":"idle longer than","resources.bulkKill":"Kill idle","resources.bulkNone":"nothing has been idle that long","resources.hoursN":"{n} h","resources.killAll":"Kill all agents","resources.killAllConfirm":"Confirm — kill {n}?","resources.killAllHint":"force-kill every agent pane, live ones included — a clean slate so the next spawn/message routes cleanly. Your shells and the viewer are left alone.","resources.killAllNone":"no agent sessions to kill","resources.close":"Close","status.awaitingPlan":"awaiting plan approval","status.awaitingAnswer":"awaiting an answer to a question","status.awaitingTerminal":"awaiting a reply in the terminal","status.working":"working…","status.returnedResult":"returned with a result","status.stalled":"interrupted or awaiting permission","status.finishedTurn":"finished the turn — waiting for a reply","status.flow":"flow: {label}","dictation.failed":"couldn't transcribe","dictation.silence":"silence — nothing recognized","dictation.unsupported":"recording is not supported in this browser","dictation.liveError":"live transcription error","dictation.connectionLost":"transcription connection dropped","dictation.noMic":"no microphone access","overview.branchesLiveIn":{one:"{count} branch running in {projects}",other:"{count} branches running in {projects}"},"overview.projects":{one:"{count} project",other:"{count} projects"},"overview.archived":"\xb7 {count} archived","overview.moreLive":"{count} more live","overview.quiet":"quiet \xb7 last activity {age}","overview.empty":"No logs yet","branch.live":"working","branch.waiting":"finished the turn — waiting for a reply","branch.returned":"returned with a result","branch.stalled":"interrupted or awaiting permission","branch.done":"done — safe to remove","branch.worktree":"Worktree {name}","branch.lastActivity":"Last activity: {age}","branch.lastActivityQuiet":"Marked active, but the transcript is quiet: last activity {age}","branch.handoffTitle":"agent spawned by this conversation's handoff","branch.branchTitle":"branch of this conversation","branch.removeColumn":"Remove column {title}","branch.toggleBackground":"{action} background task {title}","branch.collapse":"Collapse","branch.expand":"Expand","branch.expandFull":"Expand conversation {title} to the full window","branch.collapseFull":"Back to the canvas (Esc)","tree.quiet":"Quiet conversations and tasks","corner.waitingCount":"\xb7 {count} waiting","corner.openSwitchboard":"Open the agent switchboard","task.working":", working","task.interrupted":", interrupted","task.finished":", finished","task.interruptedBadge":"interrupted","task.finishedBadge":"finished","task.stopFailed":"couldn't stop","task.signalSent":"sent {signal} to PID {pid}","task.confirmKill":"Really kill PID {pid}?","task.killPid":"Kill {pid}","task.confirmKillYes":"Yes, kill","task.stopAria":"Stop process PID {pid}","task.kill":"Kill","task.backgroundCommand":"Background command","task.commandNotFound":"The command that started this background task wasn't found in the session transcripts","viewer.closeProjects":"Close the project list","viewer.agentWaiting":"Agent is waiting for a reply","viewer.closeNotification":"Close the notification","attention.badge":{one:"{count} waiting",other:"{count} waiting"},"attention.openQueue":"Attention queue — who is blocked on you (N — next)","attention.popoverTitle":"Waiting on you","attention.filterOn":"Show only those waiting on you (F)","attention.filterOff":"Show all nodes (F)","mobile.noConvos":"No conversations yet","mobile.map":"Map","mobile.closeMap":"Close the map","mobile.tapNode":"Tap a node — the conversation opens full-screen","mobile.agent":"agent","mobile.openMap":"Open the project map","tasks.failed":"failed ({status})","tasks.tool":"Task — the next click drops a card on the canvas (T)","tasks.untitled":"untitled","tasks.newPlaceholder":"task text… (the first line is the title)","tasks.editAria":"Task text","tasks.spawning":"starting…","tasks.deadChip":"the conversation is gone from the list","tasks.source":"source","tasks.sourceTitle":"Captured from","tasks.retry":"retry delivery","tasks.chipFailedTitle":"not delivered: {error}","tasks.handoffChip":"routed into this agent's prompt — not sent yet","tasks.detach":"detach","tasks.detachAria":"Detach {title} from this task","tasks.send":"send","tasks.sendTitle":"Pull the arrow onto an agent's pane to drop the task into its prompt (nothing is sent); click to seed a fresh draft conversation","tasks.linkHanded":"routed into “{title}” — review and send it there","tasks.linkSent":"task sent → “{title}”","tasks.spawn":"agent","tasks.spawnTitle":"Spawn a fresh agent with this task as the brief","tasks.spawnGo":"Launch","tasks.statusTitle":"Status: {label} — click cycles (inbox → assigned → blocked → done)","tasks.statusPrefix":"status","tasks.status.inbox":"inbox","tasks.status.assigned":"assigned","tasks.status.blocked":"blocked","tasks.status.done":"done","tasks.delete":"delete","tasks.deleteConfirm":"sure?","tasks.deleteAria":"Delete task {title}","tasks.pickerTitle":"Send to","tasks.pickerAllChildren":"⤷ all children","tasks.pickerEmpty":"no conversations in the project","tasks.pickerSend":"Send ({count})","tasks.sendOk":"Delivered {delivered} of {total}","tasks.sendFailPart":"✗ “{title}”: {error}","tasks.spawnOk":"agent started in tmux {target}","tasks.composerToggle":"create a task","tasks.composerToggleTitle":"On — the text becomes a tracked task card assigned to the selection; off — a plain broadcast with no trace","tasks.composerNeedsText":"a task needs text","tasks.panelTitle":"Tasks","tasks.panelToggleAria":"Toggle the task panel","tasks.panelThisProject":"this project","tasks.panelAll":"all","tasks.panelEmpty":"no tasks yet — drop one with the board's task tool (T)","tasks.panelClose":"Close the task panel","tasks.sheetNew":"new task","tasks.sheetCreate":"Create the task","tasks.sheetBack":"Back to the task list","tasks.sheetTargets":{one:"{count} target",other:"{count} targets"},"tasks.sheetAssignments":"assignments","tasks.sheetEmpty":"no tasks yet","tasks.sheetGone":"the task is gone","tasks.textNotSaved":"the text didn't save — delivery aborted, try again","tasks.emptyTextBlocked":"empty text isn't saved — restore the task text before sending"},uk:{"common.serverUnavailable":"сервер недоступний","common.loading":"завантаження…","common.loadingCap":"Завантаження…","common.cancel":"Скасувати","common.show":"показати","common.showAll":"показати все","common.collapse":"згорнути","common.copy":"Копіювати","common.copied":"скопійовано","common.clickToCopy":"клік — скопіювати","common.yes":"Так","common.no":"Ні","common.send":"Надіслати","common.sending":"надсилаю…","common.sent":"надіслано","common.close":"Закрити","common.failedSend":"не вдалося надіслати","common.failedDelete":"не вдалося видалити","common.nothingFound":"Нічого не знайдено","common.nothingRunning":"зараз нічого не працює","common.kb":"кБ","common.chars":"{n} симв.","lang.aria":"Мова інтерфейсу","util.effortTitle":"Зусилля міркування: {effort}","time.agoSec":"{n} с тому","time.agoMin":"{n} хв тому","time.agoHour":"{n} год тому","time.agoDay":"{n} д тому","kind.session":"сесія","kind.subagent":"субагент","kind.job":"джоба","kind.background":"фон","kind.handoff":"хендофф","rail.title":"Логи агентів","rail.filter":"Фільтр проєктів…","rail.projects":"Проєкти","rail.overview":"Огляд","rail.archive":"Архів","dash.branchesLive":{one:"{count} гілка працює",few:"{count} гілки працюють",many:"{count} гілок працюють",other:"{count} гілок працюють"},"dash.trees":{one:"{count} дерево",few:"{count} дерева",many:"{count} дерев",other:"{count} дерев"},"dash.recentConvos":{one:"{count} нещодавня розмова",few:"{count} нещодавні розмови",many:"{count} нещодавніх розмов",other:"{count} нещодавніх розмов"},"dash.quietTrees":{one:"{count} тихе дерево",few:"{count} тихі дерева",many:"{count} тихих дерев",other:"{count} тихих дерев"},"dash.openProjects":"Відкрити список проєктів","dash.unarchive":"Повернути з архіву","dash.newConvo":"Нова розмова з агентом","dash.agent":"Агент","dash.newWorkflow":"Новий воркфлоу: етапи → ревью → PR","dash.workflow":"Воркфлоу","dash.emptyTitle":"На схемі поки порожньо","dash.emptyHint":"Відкрий пульт у правому нижньому куті і клікни розмову — вона з'явиться тут","dash.viewScheme":"схема","dash.viewList":"список","trash.title":"На схемі порожньо, але в проєкті є записи","trash.hint":"Клік по рядку відкриває розмову нодою; смітник видаляє її файл з диска назавжди.","trash.deletedFromDisk":"\xb7 видалено з диска","trash.open":"Відкрити {title}","trash.activeSubtree":"має активні гілки","trash.toArchive":"В архів","trash.notDeleted":"не видалено {failed} з {total}","trash.confirmDelete":{one:"Видалити з диска {count} файл проєкту?",few:"Видалити з диска {count} файли проєкту?",many:"Видалити з диска {count} файлів проєкту?",other:"Видалити з диска {count} файлів проєкту?"},"trash.deleting":"видаляю…","trash.confirmYes":"Так, видалити","trash.deleteProject":"Видалити проєкт з диска","switch.aria":"Пульт агентів","switch.title":"Пульт","switch.search":"Пошук за назвою або проєктом","switch.updating":"оновлення…","switch.close":"Закрити пульт","switch.waiting":"Чекає тебе","switch.working":"Працюють","switch.recent":"Нещодавні","switch.older":"Старіше","switch.hidden":"Приховані ({count})","switch.hide":"сховати","switch.restore":"повернути","switchCard.openColumn":"Відкрити колонкою {title}","switchCard.remove":"Прибрати з пульта","composer.imagesCount":{one:"{count} картинка",few:"{count} картинки",many:"{count} картинок",other:"{count} картинок"},"composer.spawned":"запущено агента в tmux {target}","composer.sentPaths":"надіслано {count} шлях(и)","composer.failedInterrupt":"не вдалося перервати","composer.escapeSent":"надіслано Escape — агент перервано","composer.spawnAria":"Запустити агента з промптом у tmux","composer.sendAria":"Надіслати повідомлення агенту в tmux {target}","composer.queueAria":"Черга надісланих повідомлень","composer.removeFromQueue":"Прибрати з черги","composer.placeholderRelay":"написати — передам через кореневу сесію…","composer.placeholderSpawn":"промпт — агент запуститься в tmux…","composer.placeholderSend":"написати агенту…","composer.textAria":"Текст для агента","composer.titleRelay":"передасться через кореневу сесію гілки","composer.titleSpawnResumed":"нове tmux-вікно з відновленим агентом","composer.root":"корінь","composer.interruptAria":"Перервати агента (Escape)","composer.interruptTitle":"надіслати Escape у пейн агента","composer.compactAria":"Стиснути контекст агента (/compact)","composer.compactTitle":"надіслати /compact — агент стисне контекст; після завершення у стрічці з'явиться позначка","composer.compactConfirm":"Точно?","composer.compactConfirmTitle":"Натисни ще раз, щоб надіслати /compact","composer.compactSent":"стискання почалось — позначка з'явиться у стрічці, щойно завершиться","composer.failedCompact":"не вдалося запустити стискання","composer.addImages":"Додати картинки","composer.moreTools":"Додаткові дії","composer.stopAndSend":"Зупинити запис і надіслати","composer.launchAgent":"Запустити агента","composer.sendToAgent":"Надіслати агенту","composer.stopAndSendTitle":"зупинити запис і надіслати","composer.sendMenuTitle":"Дії відправки","composer.quickAck":"Так, продовжуй","composer.quickAckLabel":"Продовжити","composer.quickAckAria":"Надіслати агенту швидке \xabТак, продовжуй\xbb","composer.quickAckTitle":"Швидка відповідь — так, продовжуй","draft.readPrompt":"Прочитай розмову агента у файлі {src} і продовж роботу звідти: ","draft.needDir":"вкажи робочу директорію","draft.launchFailed":"не вдалося запустити","draft.paneAria":"Чернетка нової розмови з агентом","draft.notStarted":"агент ще не запущений","draft.engineAria":"Двигун агента","draft.handoffLabel":"хендофф: {title}","draft.newConvo":"нова розмова","draft.conversation":"розмова","draft.dismiss":"Прибрати чернетку розмови","draft.directory":"директорія","draft.dirAria":"Робоча директорія агента","draft.reasoning":"reasoning","draft.reasoningAria":"Рівень reasoning-зусилля","draft.effortDefault":"effort: дефолт","draft.speedAria":"Режим швидкості Codex","draft.speedTitle":"fast = priority tier (1.5x швидкість, більша витрата лімітів)","draft.speedDefault":"швидкість: дефолт","draft.imagesOnly":"(картинки)","draft.launched":"агент запущений у tmux {target} — чекаю, поки розмова з'явиться тут…","draft.slow":"Щось довго. Перевір вікно tmux {target} — щойно транскрипт з'явиться, панель підхопить його сама.","draft.hintRelay":"Новий агент спершу прочитає транскрипт батьківської розмови і продовжить з того місця. Допиши в промпт, що зробити далі, — гілка з'явиться на схемі поруч.","draft.hintNew":"Обери двигун і директорію, напиши перший промпт — агент запуститься в tmux, і розмова продовжиться в цій самій панелі.","draft.promptAria":"Перший промпт для нового агента","draft.placeholder":"перший промпт — агент запуститься в tmux…","draft.promptTextAria":"Текст першого промпта","draft.newWindowTitle":"нове tmux-вікно зі свіжим агентом","draft.newAgent":"новий агент","draft.addImages":"Додати картинки до промпта","draft.stopAndLaunch":"Зупинити запис і запустити агента","link.handoffContext":"Тобі передали контекст іншого агента — розмову \xab{title}\xbb. Її транскрипт: {path} — спочатку прочитай цей файл, щоб мати повний контекст, а тоді виконай прохання нижче.\n\n{ask}","link.dropped":"контекст у промпті \xab{title}\xbb — допиши прохання і надішли","handoff.aria":"Перекинути розмову новому агентові — чернетка з'явиться нижче","handoff.title":"клік — чернетка нового агента з цим контекстом \xb7 потягни — звʼязати з наявним","handoff.label":"перекинути агенту","qr.showAria":"Показати QR для входу з телефона","qr.failed":"не вдалося отримати посилання","qr.startHint":"Запустіть viewer з доступом через Tailscale: ","qr.alt":"QR код для входу з телефона","qr.generating":"генерую QR…","qr.linkAria":"Посилання для входу з телефона","qr.copy":"Копіювати посилання","qr.scanHint":"скануй з телефона в тому ж tailnet","push.enabled":"Push-сповіщення увімкнено","push.enable":"Увімкнути push-сповіщення","push.disable":"Вимкнути push-сповіщення","push.needsHttps":"Push потребує HTTPS","sound.on":"Звукові сповіщення увімкнено","sound.off":"Звукові сповіщення вимкнено","sound.mute":"Вимкнути звукові сповіщення","sound.unmute":"Увімкнути звукові сповіщення","mic.stopRecognize":"Зупинити запис і розпізнати","mic.cancel":"Скасувати запис","mic.recognizing":"Розпізнаю…","mic.dictate":"Надиктувати","mic.dictateHint":"надиктувати (до 2 хв) \xb7 правий клік: спосіб розпізнавання","mic.connecting":"Під'єдную мікрофон — секунду…","mic.menuTitle":"Спосіб розпізнавання","mic.menuLoading":"перевіряю, що доступно…","mic.menuLocked":"Заблоковано змінною середовища LLV_TRANSCRIBE_BACKEND","mic.noKey":"не налаштовано","mic.saveFailed":"не вдалося зберегти вибір","mic.keyTitle":"{name} не налаштовано","mic.copy":"копіювати","mic.copyPath":"Скопіювати шлях","mic.copied":"скопійовано","mic.back":"Назад","stt.local.name":"Faster Whisper","stt.local.desc":"Безкоштовно, повністю локально — аудіо не покидає цю машину.","stt.local.fix":"Запусти scripts/setup-whisper.sh у теці застосунку один раз; він встановить локальний рушій у:","stt.chatgpt.name":"ChatGPT Voice","stt.chatgpt.desc":"У межах підписки ChatGPT, через логін Codex.","stt.chatgpt.fix":"Залогінься в Codex (команда `codex login`) — токен з'явиться у:","stt.elevenlabs.name":"ElevenLabs Scribe","stt.elevenlabs.desc":"Платний API ElevenLabs — найточніший варіант.","stt.elevenlabs.fix":"Поклади свій API-ключ ElevenLabs (одним рядком) у цей файл:","delFile.confirm":"Видалити з диска?","delFile.aria":"Видалити розмову з диска","img.readFailed":"не вдалося прочитати картинку","img.readAborted":"читання картинки перервано","img.unsupported":"непідтримуваний формат картинки: {name}","img.unknownFile":"невідомий файл","img.tooLarge":"{name}: завелика (ліміт 10 МБ)","img.image":"картинка","img.error":"помилка картинки","img.previewAlt":"прев'ю картинки {n}","img.removeAria":"Прибрати картинку {n}","img.toFilePaths":"шляхами до файлів","question.sec":"{n} с","question.min":"{n} хв","question.hour":"{n} год","question.waiting":"чекає на відповідь","question.sentToPane":"Надіслано в пейн: {text}","question.keysHint":"клавіші в пейн \xb7 або композер нижче","question.pane":"Пейн {target}","question.alreadyAnswered":"відповідь уже записана","question.openFailed":"не вдалося відкрити сесію","question.opened":"відкрито {target}","question.answered":"Відповідено: {text}","question.answeredElsewhere":"Відповідено в іншому місці: {text}","question.noPane":"tmux-пейн недоступний","question.openSession":"відкрити сесію","question.rejectComment":"Коментар до відхилення…","question.approved":"затверджено","question.rejected":"відхилено","question.approve":"Затвердити","question.reject":"Відхилити","question.ownAnswer":"Своя відповідь…","inbox.deleted":"видалено з диска","inbox.fileGone":"файла вже немає на диску","inbox.confirmDelete":"Видалити файл з диска?","inbox.deleteAria":"Видалити {name} з диска","inbox.deleteFromDisk":"видалити з диска","inbox.attachedAlt":"вкладена картинка {name}","lightbox.zoomOut":"Зменшити","lightbox.resetZoom":"Скинути масштаб","lightbox.zoomIn":"Збільшити","feed.agentEnded":"агент завершився","feed.copyCode":"Скопіювати код","feed.copyMd":"Скопіювати повідомлення (Markdown)","feed.running":"виконує {tool}…","feed.tool":"інструмент","feed.thinking":"думає…","feed.working":"працює…","feed.liveTail":"живий хвіст","feed.backToLive":"Повернутись до живого хвоста","feed.newCount":"{count} нових","feed.down":"вниз","feed.pickLog":"Вибери лог зліва — стрічка оновлюється сама","feed.showEarlier":"показати раніше","feed.showEarlierHidden":"показати раніше (сховано {count})","feed.loadEarlier":"завантажити раніше з файлу","feed.startOfConvo":"початок розмови","feed.finishedTurn":"закінчив хід — чекає відповіді","feed.returnedResult":"повернувся з результатом","feed.noOutput":"Ще без виводу — файл поки порожній","feed.onlyService":"Є лише службові записи ({count}).","feed.empty":"Порожньо (немає рядків для показу)","render.system":"системне","render.executing":"виконується…","render.error":"помилка","render.teammate":"тімейт","render.left":"{peer}: звільнився{at}","render.codexSessionCreated":"Сесія Codex створена","render.taskStarted":"Задача стартувала","render.taskComplete":"Задачу завершено","render.compacted":"контекст стиснуто","render.compactAuto":"авто","render.compactManual":"вручну","render.compactPre":"{n}k токенів до","render.compactSummary":"підсумок розмови","render.patch":"патч","render.stdinSession":"stdin → сесія {id}","render.record":"запис","render.protocol":"протокол","render.jobLogNote":"(це джоб-лог: він не містить stdout команд; повний вивід — у rollout-сесії Codex у списку зліва)","render.image":"зображення","render.dataKb":"даних {n} КБ","render.commands":{one:"{count} команда",few:"{count} команди",many:"{count} команд",other:"{count} команд"},"render.noFindings":"без findings","render.moreFindings":"ще {count} findings у raw","render.memoryCitations":"цитати пам'яті ({count})","render.noCitations":"без citation entries","render.moreEntries":"ще {count} entries у raw","render.truncated":"обрізано","render.shutdownRequest":"запит на завершення","render.shutdownResponse":"відповідь на завершення","render.planRequest":"запит на затвердження плану","render.planVerdict":"вердикт по плану","render.approved":"схвалено","render.rejected":"відхилено","render.from":"від {from}","render.structured":"структуроване повідомлення","render.showJson":"показати JSON","render.noOutputInLog":"(вивід у цьому лог-файлі відсутній — повний є в rollout-сесії Codex)","render.filesChanged":"файли змінені","render.toDir":"до","render.fromDir":"від","render.delivered":"доставлено","render.notDelivered":"не доставлено","render.reasoning":"міркування агента","flowDialog.engine":"Двигун: {label}","flowDialog.modelPlaceholder":"модель (дефолт)","flowDialog.model":"Модель: {label}","flowDialog.effortDefault":"effort: дефолт","flowDialog.createFailed":"не вдалося створити флоу ({status})","flowDialog.title":"Запустити флоу","flowDialog.subtitle":"implement → review \xb7 ця розмова стає виконавцем","flowDialog.preset":"пресет","flowDialog.rolesManualOpen":"▾ ролі вручну","flowDialog.rolesManual":"▸ ролі вручну (модель / effort)","flowDialog.implementer":"виконавець","flowDialog.reviewer":"ревʼюер","flowDialog.diffBase":"база діфу","flowDialog.fromHead":"від поточного HEAD","flowDialog.fromMergeBase":"від merge-base з main","flowDialog.headless":"headless (без панелі)","flowDialog.tmuxPane":"tmux-панель","flowDialog.transitions":"переходи","flowDialog.auto":"авто","flowDialog.manual":"вручну (гейт на кожен крок)","flowDialog.roundLimit":"ліміт раундів","flowDialog.creating":"створюю…","flowDialog.start":"▶ Запустити","flowStrip.startReview":"Почати ревью","flowStrip.spawnReviewer":"Заспавнити ревʼюера","flowStrip.relayNotes":"Передати зауваження","flowStrip.retryRound":"Повторити раунд","flowStrip.anotherRound":"Ще коло","flowStrip.flow":"ФЛОУ","flowStrip.roundsAria":"Раунди ревью","flowStrip.roundError":"Раунд {n}: {error}","flowStrip.roundVerdict":"Раунд {n}: {verdict}","flowStrip.roundInProgress":"Раунд {n}: триває","flowStrip.addRoundsTitle":"Додати ще раунди до ліміту","flowStrip.plus2":"+2 раунди","flowStrip.limitTitle":"Ліміт раундів: скільки ревью до зупинки (∞ — без ліміту)","flowStrip.limitAria":"Встановити ліміт раундів: {count}","flowStrip.limitUnlimitedAria":"Без ліміту раундів","flowStrip.stopReviewer":"Стоп","flowStrip.stopReviewerTitle":"Зупинити поточного ревʼюера; раунд перейде в \xabпотрібне рішення\xbb","flowStrip.notePlaceholder":"нотатка ревʼюеру…","flowStrip.noteTitle":"Піде наступному ревʼюеру як ready-нотатка раунду","flowStrip.autoTitle":"Авто: переходи самі. Клік — вручну.","flowStrip.manualTitle":"Вручну: кожен перехід чекає кліку. Клік — авто.","flowStrip.manualShort":"вручну","flowStrip.resume":"Продовжити флоу","flowStrip.pause":"Пауза","flowStrip.close":"Закрити флоу","roundDeck.roundAborted":"Раунд {n} \xb7 перервано","roundDeck.roundVerdict":"Раунд {n} \xb7 {verdict}","roundDeck.roundInProgress":"Раунд {n} \xb7 триває","roundDeck.aborted":"перервано","roundDeck.reviewInProgress":"ревью триває","roundDeck.waitingFirst":"чекаю на перший раунд ревью…","roundDeck.spawningReviewer":"запускаю ревʼюера — транскрипт зʼявиться за мить…","roundDeck.moreRounds":"ще {count} раунд(и) — клікни чипи на стрічці флоу","roundDeck.findings":{one:"{count} знахідка",few:"{count} знахідки",many:"{count} знахідок",other:"{count} знахідок"},"flowState.waiting_ready":"чекає READY","flowState.spawn_pending":"готовий спавнити ревʼюера","flowState.spawning":"запускаю ревʼюера","flowState.reviewing":"ревью","flowState.relay_pending":"вердикт є — передати?","flowState.relaying":"передаю зауваження","flowState.fixing":"фікси","flowState.approved":"затверджено","flowState.done_comment":"готово із зауваженнями","flowState.needs_decision":"потребує рішення","flowState.paused":"пауза","flowState.closed":"закрито","flowModel.failed":"не вдалося ({status})","wfState.provisioning":"готую worktree","wfState.implementing":"етапи виконуються","wfState.reviewing":"ревью","wfState.finishing":"завершення","wfState.approved":"approved","wfState.needs_decision":"потребує рішення","wfState.paused":"пауза","wfState.closed":"закрито","wfModel.failed":"не вдалося ({status})","wfStrip.workflow":"ВОРКФЛОУ","wfStrip.stagesAria":"Етапи воркфлоу","wfStrip.reviewStage":"ревью","wfStrip.advance":"Далі","wfStrip.retryStage":"Повторити етап","wfStrip.skipStage":"Пропустити","wfStrip.resume":"Продовжити воркфлоу","wfStrip.pause":"Пауза","wfStrip.close":"Закрити воркфлоу","wfDraft.paneAria":"Чернетка нового воркфлоу","wfDraft.notStarted":"воркфлоу ще не запущений","wfDraft.newWorkflow":"новий воркфлоу","wfDraft.dismiss":"Прибрати чернетку воркфлоу","wfDraft.template":"шаблон","wfDraft.templateAria":"Шаблон воркфлоу","wfDraft.repo":"репозиторій","wfDraft.repoAria":"Директорія репозиторію","wfDraft.manualMode":"вручну: гейт на межі кожного етапу","wfDraft.hint":"Обери шаблон і репозиторій, опиши задачу — воркфлоу створить worktree, прожене етапи, ревью і відкриє PR.","wfDraft.taskPlaceholder":"задача для воркфлоу — бриф піде кожному етапу…","wfDraft.taskAria":"Бриф задачі воркфлоу","wfDraft.footerHint":"worktree \xb7 етапи \xb7 ревью \xb7 PR","wfDraft.finishMerge":"merge локально","wfDraft.needDir":"вкажи директорію репозиторію","wfDraft.needTask":"опиши задачу","wfDraft.launchFailed":"не вдалося запустити","wfDraft.launch":"▶ Запустити воркфлоу","wfDraft.launching":"запускаю…","scheme.flowTitle":"Запустити цикл implement → review для цієї розмови","scheme.flow":"Флоу","scheme.collapsedTitle":"Згорнуті гілки й задачі цієї розмови","scheme.underneath":"під сподом","scheme.handTool":"Рука — тягнути полотно (H, або тримай Space)","scheme.selectTool":"Виділення — клік і робота з розмовами (V)","scheme.zoomOut":"Віддалити (−)","scheme.zoom100":"Масштаб 100% (1)","scheme.zoomIn":"Наблизити (+)","scheme.fit":"Вписати все (0, або подвійний клік по фону)","scheme.roleImplementer":"Імплементер","scheme.roleReviewer":"Ревʼюер","scheme.roleWorking":"працює","scheme.roleWaiting":"чекає","scheme.lassoTool":"Вибірка — обведи агентів рамкою, кліком додавай чи знімай","bulk.selectedCount":{one:"Вибрано {count}",few:"Вибрано {count}",many:"Вибрано {count}",other:"Вибрано {count}"},"bulk.placeholder":"одне повідомлення кожному вибраному агенту…","bulk.textAria":"Текст розсилки вибраним агентам","bulk.sendAll":"Надіслати {count} агентам","bulk.interrupt":"Перервати","bulk.stop":"Зупинити","bulk.stopConfirm":"Точно зупинити {count}?","bulk.remove":"Прибрати зі схеми","bulk.removeConfirm":"Закрити {count} карток?","bulk.flow":"Флоу","bulk.fit":"Показати вибірку","bulk.exit":"Вийти з вибірки (Esc)","bulk.retryFailed":"Повторити невдалі ({count})","bulk.nodeGone":"вузол зник зі схеми","bulk.flowTitle":"Запустити ревʼю-флоу для {count} агентів","bulk.flowStart":"Запустити {count} флоу","minimap.title":"Мінімапа — клікни або тягни, щоб перейти","plan.agentPlan":"План агента:","plan.stepsAria":"План: {done} з {total} кроків","plan.nowSuffix":", зараз: {current}","plan.goal":"ціль","plan.goalDone":"ціль ✓","plan.goalBlocked":"ціль ✖","plan.noObjective":"(objective не записаний у хвості транскрипта)","plan.tokens":"токенів: {n}","plan.time":"часу: {n} хв","plan.ctxTitle":"Контекстне вікно: використано {pct}%\n{used} з {window} токенів","plan.ctxAria":"Контекст: використано {pct} відсотків вікна","plan.goalAria":"Ціль сесії: {status}","limits.now":"зараз","limits.inMin":"через {n} хв","limits.inHour":"через {n} год","limits.inDay":"через {n} д","limits.asOf":"станом на {time}","limits.left":"лишилось","limits.reset":"скид {eta} \xb7 {at}","limits.stale":"дані застарілі: {stale}","limits.5h":"5 год","limits.week":"Тиждень","resources.ram":"RAM","resources.swap":"Swap","resources.free":"{amount} вільно","resources.used":"{amount} зайнято","resources.stale":"дані про ресурси застарілі: {stale}","resources.openAria":"Сесії агентів і пам'ять","resources.title":"Сесії агентів","resources.total":"Σ {amount}","resources.empty":"у tmux немає сесій агентів","resources.orphan":"осиротілий пейн","resources.procs":{one:"{count} процес",few:"{count} процеси",many:"{count} процесів",other:"{count} процесу"},"resources.swapShare":"+ {amount} swap","resources.kill":"Убити","resources.confirm":"Точно?","resources.killLiveHint":"агент зараз працює — натисни, щоб розблокувати, і підтверди","resources.killHint":"закрити tmux-пейн разом з усім деревом процесів","resources.bulkLabel":"неактивні довше ніж","resources.bulkKill":"Убити неактивні","resources.bulkNone":"немає сесій, неактивних так довго","resources.hoursN":"{n} год","resources.killAll":"Убити всіх агентів","resources.killAllConfirm":"Підтвердити — убити {n}?","resources.killAllHint":"примусово закрити кожен пейн агента, разом із активними — чистий старт, щоб наступний spawn/повідомлення пішли правильно. Твої шели і в'ювер не чіпає.","resources.killAllNone":"немає сесій агентів для закриття","resources.close":"Закрити","status.awaitingPlan":"чекає затвердження плану","status.awaitingAnswer":"чекає відповіді на питання","status.awaitingTerminal":"чекає на відповідь у терміналі","status.working":"працює…","status.returnedResult":"повернувся з результатом","status.stalled":"перервано або чекає дозволу","status.finishedTurn":"закінчив хід — чекає відповіді","status.flow":"флоу: {label}","dictation.failed":"не вдалося розпізнати","dictation.silence":"тиша — нічого не розпізналось","dictation.unsupported":"запис не підтримується в цьому браузері","dictation.liveError":"помилка live-транскрипції","dictation.connectionLost":"зʼєднання з транскрипцією обірвалось","dictation.noMic":"немає доступу до мікрофона","overview.branchesLiveIn":{one:"{count} гілка працює у {projects}",few:"{count} гілки працюють у {projects}",many:"{count} гілок працюють у {projects}",other:"{count} гілок працюють у {projects}"},"overview.projects":{one:"{count} проєкті",few:"{count} проєктах",many:"{count} проєктах",other:"{count} проєктах"},"overview.archived":"\xb7 {count} в архіві","overview.moreLive":"ще {count} live","overview.quiet":"тихо \xb7 остання активність {age}","overview.empty":"Логів поки нема","branch.live":"працює","branch.waiting":"закінчив хід — чекає відповіді","branch.returned":"повернувся з результатом","branch.stalled":"перервано або чекає дозволу","branch.done":"завершено — можна прибрати","branch.worktree":"Ворк-дерево {name}","branch.lastActivity":"Остання активність: {age}","branch.lastActivityQuiet":"Позначений активним, але транскрипт мовчить: остання активність {age}","branch.handoffTitle":"агент, породжений хендоффом цієї розмови","branch.branchTitle":"гілка цієї розмови","branch.removeColumn":"Прибрати колонку {title}","branch.toggleBackground":"{action} фонову задачу {title}","branch.collapse":"Згорнути","branch.expand":"Розгорнути","branch.expandFull":"Розгорнути розмову {title} на все вікно","branch.collapseFull":"Повернутися до полотна (Esc)","tree.quiet":"Тихі розмови й задачі","corner.waitingCount":"\xb7 {count} чекають","corner.openSwitchboard":"Відкрити пульт агентів","task.working":", працює","task.interrupted":", перервано","task.finished":", закінчив","task.interruptedBadge":"перервано","task.finishedBadge":"завершено","task.stopFailed":"помилка зупинки","task.signalSent":"надіслано {signal} PID {pid}","task.confirmKill":"Точно вбити PID {pid}?","task.killPid":"Вбити {pid}","task.confirmKillYes":"Так, вбити","task.stopAria":"Зупинити процес PID {pid}","task.kill":"Вбити","task.backgroundCommand":"Фонова команда","task.commandNotFound":"Команду, що запустила цю фонову задачу, не знайдено у транскриптах сесії","viewer.closeProjects":"Закрити список проєктів","viewer.agentWaiting":"Агент чекає відповіді","viewer.closeNotification":"Закрити сповіщення","attention.badge":{one:"{count} чекає",few:"{count} чекають",many:"{count} чекають",other:"{count} чекають"},"attention.openQueue":"Черга уваги — хто заблокований на тобі (N — наступний)","attention.popoverTitle":"Чекають на тебе","attention.filterOn":"Показати лише тих, хто чекає на тебе (F)","attention.filterOff":"Показати всі вузли (F)","mobile.noConvos":"Розмов поки нема","mobile.map":"Карта","mobile.closeMap":"Закрити карту","mobile.tapNode":"Тапни вузол — розмова відкриється на весь екран","mobile.agent":"агент","mobile.openMap":"Відкрити карту проєкту","tasks.failed":"не вдалося ({status})","tasks.tool":"Задача — наступний клік кладе картку на полотно (T)","tasks.untitled":"без назви","tasks.newPlaceholder":"текст задачі… (перший рядок — назва)","tasks.editAria":"Текст задачі","tasks.spawning":"запускається…","tasks.deadChip":"розмови вже немає у списку","tasks.source":"джерело","tasks.sourceTitle":"Взято з","tasks.retry":"повторити доставку","tasks.chipFailedTitle":"не доставлено: {error}","tasks.handoffChip":"закинуто в промпт цього агента — ще не надіслано","tasks.detach":"відв'язати","tasks.detachAria":"Відв'язати {title} від задачі","tasks.send":"надіслати","tasks.sendTitle":"Потягни стрілку на панель агента — задача ляже в його промпт (нічого не надсилається); клік — створить чернетку нової розмови","tasks.linkHanded":"закинуто в \xab{title}\xbb — перевір і надішли там","tasks.linkSent":"задачу надіслано → \xab{title}\xbb","tasks.spawn":"агент","tasks.spawnTitle":"Запустити нового агента з цією задачею як брифом","tasks.spawnGo":"Запустити","tasks.statusTitle":"Статус: {label} — клік перемикає (інбокс → призначено → заблоковано → готово)","tasks.statusPrefix":"статус","tasks.status.inbox":"інбокс","tasks.status.assigned":"призначено","tasks.status.blocked":"заблоковано","tasks.status.done":"готово","tasks.delete":"видалити","tasks.deleteConfirm":"точно?","tasks.deleteAria":"Видалити задачу {title}","tasks.pickerTitle":"Кому надіслати","tasks.pickerAllChildren":"⤷ всім дітям","tasks.pickerEmpty":"у проєкті немає розмов","tasks.pickerSend":"Надіслати ({count})","tasks.sendOk":"Доставлено {delivered} з {total}","tasks.sendFailPart":"✗ „{title}“: {error}","tasks.spawnOk":"агента запущено в tmux {target}","tasks.composerToggle":"створити задачу","tasks.composerToggleTitle":"Увімкнено — текст стає задачею-карткою з призначеннями на вибір; вимкнено — проста розсилка без сліду","tasks.composerNeedsText":"для задачі потрібен текст","tasks.panelTitle":"Задачі","tasks.panelToggleAria":"Показати або сховати панель задач","tasks.panelThisProject":"цей проєкт","tasks.panelAll":"всі","tasks.panelEmpty":"задач поки нема — кинь картку інструментом \xabзадача\xbb (T)","tasks.panelClose":"Закрити панель задач","tasks.sheetNew":"нова задача","tasks.sheetCreate":"Створити задачу","tasks.sheetBack":"Назад до списку задач","tasks.sheetTargets":{one:"{count} адресат",few:"{count} адресати",many:"{count} адресатів",other:"{count} адресатів"},"tasks.sheetAssignments":"призначення","tasks.sheetEmpty":"задач поки нема","tasks.sheetGone":"задачі вже немає","tasks.textNotSaved":"текст не зберігся — надсилання скасовано, спробуй ще раз","tasks.emptyTextBlocked":"порожній текст не зберігається — віднови текст задачі перед надсиланням"}},p="en",q=new Set;function r(){return p}function s(a){if(a!==p){p=a;try{window.localStorage.setItem("llv_lang",a)}catch{}for(let b of("u">typeof document&&(document.documentElement.lang=a),q))b()}}function t(a){return q.add(a),()=>q.delete(a)}function u(a,b,c){var d;let e,f=o[a][b]??o.en[b]??b;if("string"==typeof f)e=f;else{let b="number"==typeof c?.count?c.count:0;e=f[new Intl.PluralRules("uk"===a?"uk-UA":"en-US").select(b)]??f.other??f.one??""}return d=e,c?d.replace(/\{(\w+)\}/g,(a,b)=>b in c?String(c[b]):a):d}function v(){let a=(0,e.useSyncExternalStore)(t,r,()=>"en");return{locale:a,t:(b,c)=>u(a,b,c),setLocale:s}}function w(a,b=160){let c=a.replace(/\[([^\]]+)\]\(([^)]+)\)/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/[*_~#>]+/g,"").replace(/\s+/g," ").trim().replace(/(?:\/[^\s)]+){3,}/g,a=>{if(a.length<=40)return a;let b=a.split("/").filter(Boolean);return b.length>=2?".../"+b.slice(-2).join("/"):a}).replace(/\s+/g," ").trim();return c.length>b?c.slice(0,b-1).trimEnd()+"…":c}let x="__overview__",y=a=>Math.floor(a/300);function z(a){return"live"===a.activity?0:"recent"===a.activity?1:"stalled"===a.activity?2:3}function A(a){return"claude-projects"===a.root?"session"===a.kind&&!a.parent:"codex-sessions"===a.root&&!a.parent}function B(a){return"claude-projects"===a.root&&"subagent"===a.kind}function C(a){return!!B(a)||!!a.handoff&&!!a.parent||"codex-sessions"===a.root&&!!a.parent}function D(a){return"shell"===a.engine}function E(a){return a.project||"other"}let F=new Set(["provisioning","implementing","reviewing","finishing"]);function G(a,b=Date.now()/1e3,c=[]){let d=new Map,e=a=>{let b=d.get(a);return b||(b={project:a,liveCount:0,attentionCount:0,conversations:0,smt:0},d.set(a,b)),b};for(let c of a){let a=e(E(c));"live"===c.activity&&(a.liveCount+=1),null!==N(c,b)&&(a.attentionCount+=1),A(c)&&(a.conversations+=1),a.smt=Math.max(a.smt,c.mtime)}for(let a of c){if("closed"===a.state||!a.project)continue;let b=e(a.project);F.has(a.state)&&(b.liveCount+=1),("needs_decision"===a.state||"paused"===a.state)&&(b.attentionCount+=1),b.smt=Math.max(b.smt,(Date.parse(a.createdAt)||0)/1e3)}return[...d.values()].sort((a,b)=>{let c=a.attentionCount>0;return c!==b.attentionCount>0?c?-1:1:a.liveCount!==b.liveCount?b.liveCount-a.liveCount:y(b.smt)-y(a.smt)||a.project.localeCompare(b.project)})}function H(a,b){let c=new Set,d=a;for(;d.parent&&!c.has(d.path);){c.add(d.path);let a=b.get(d.parent);if(!a)break;d=a}return d}function I(a){let b=new Map;for(let c of a){if(!c.parent)continue;let a=b.get(c.parent);a?a.push(c):b.set(c.parent,[c])}return b}function J(a,b){let c=[],d=[...b.get(a.path)??[]],e=new Set([a.path]);for(;d.length;){let a=d.pop();e.has(a.path)||(e.add(a.path),c.push(a),d.push(...b.get(a.path)??[]))}return c}function K(a){return!D(a)&&("live"===a.activity||"running"===a.proc||"recent"===a.activity&&C(a))}function L(a){return K(a)||D(a)&&("live"===a.activity||"running"===a.proc)}function M(a,b){let c=new Map(a.map(a=>[a.path,a])),d=I(a),e=new Map,f=new Map;for(let d of a)if(E(d)===b){if("live"===d.activity||"running"===d.proc||"recent"===d.activity&&C(d)){let a=H(d,c);D(a)?f.set(a.path,a):e.set(a.path,a);continue}"recent"===d.activity&&A(d)&&e.set(d.path,d)}let g=[...e.values()].map(a=>(function(a,b,c){let d=J(a,b),e=d.filter(K).sort((a,b)=>("live"!==a.activity)-("live"!==b.activity)||y(b.mtime)-y(a.mtime)||a.path.localeCompare(b.path)),f=d.filter(a=>D(a)&&"live"===a.activity).sort((a,b)=>y(b.mtime)-y(a.mtime)||a.path.localeCompare(b.path)),g=[a,...e].map(a=>({file:a,tasks:[]})),h=new Map(g.map(a=>[a.file.path,a]));for(let a of f)(a.parent&&h.get(a.parent)||g[0]).tasks.push(a);let i=new Set([...h.keys(),...f.map(a=>a.path)]),j=d.filter(a=>!i.has(a.path)).sort((a,b)=>b.mtime-a.mtime),k=j.filter(a=>C(a)&&function(a,b){let c=new Set([a.path]),d=a;for(;d.parent&&!c.has(d.parent);){let a=b.get(d.parent);if(!a)break;if(c.add(a.path),"session"===a.kind)return"live"===a.activity||"recent"===a.activity;d=a}return!1}(a,c)),l=new Set(k.map(a=>a.path)),m=j.filter(a=>!l.has(a.path)),n=Math.max(...g.map(a=>a.file.mtime),...f.map(a=>a.mtime));return{key:a.path,columns:g,returnable:k,finished:m,smt:n,orphanTask:!1}})(a,d,c));for(let a of f.values())g.push({key:a.path,columns:[{file:a,tasks:[]}],returnable:[],finished:[],smt:a.mtime,orphanTask:!0});return g.sort((a,b)=>a.orphanTask!==b.orphanTask?a.orphanTask?1:-1:y(b.smt)-y(a.smt)||a.key.localeCompare(b.key))}function N(a,b=Date.now()/1e3){return a.pendingQuestion?a.pendingQuestion.toolUseId:a.waitingInput?`${a.path}:waiting:${Math.floor(a.waitingInput.since)}`:"stalled"===a.activity&&"running"===a.proc&&b-a.mtime<=7200?`${a.path}:stalled:${Math.floor(a.mtime)}`:null}let O=new Set,P=O,Q=new Set;function R(a){return Q.add(a),()=>Q.delete(a)}let S=new Set;function T(a){let b=new Map;for(let c of a){if("closed"===c.state)continue;let a=b.get(c.implementerPath);(!a||c.createdAt>a.createdAt)&&b.set(c.implementerPath,c)}return b}function U(a){let b=new Set;for(let c of a)for(let a of c.rounds)a.reviewerPath&&b.add(a.reviewerPath);return b}function V(a,b){return!b.has(a.path)&&("claude"===a.engine||"codex"===a.engine)&&A(a)}function W(a,b){return a(`flowState.${b}`)}let X=new Set(["spawn_pending","relay_pending","needs_decision","paused","approved"]),Y=new Set(["spawning","reviewing","relaying","fixing"]);function Z(a){return"spawning"===a.state||"reviewing"===a.state?"reviewer":"waiting_ready"===a.state||"relaying"===a.state||"fixing"===a.state?"implementer":null}let $={APPROVE:"✓",REQUEST_CHANGES:"✖",COMMENT:"◆"};function _(a){return"APPROVE"===a?{color:"#1a8a3e",soft:"#e7f4ea"}:"REQUEST_CHANGES"===a?{color:"#c62828",soft:"#fbeaea"}:"COMMENT"===a?{color:"#b07d1f",soft:"#fdf3dd"}:{color:"#8b8b95",soft:"#efeff3"}}async function aa(a,b){try{let c=await fetch(`/api/flows/${encodeURIComponent(a)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(b)});if(c.ok)return"close"===b.action&&function(a){if(!O.has(a))for(let b of(O.add(a),P=new Set(O),Q))b()}(a),window.dispatchEvent(new Event("llv:flows-changed")),null;let d=await c.json().catch(()=>null);return d?.error??u(r(),"flowModel.failed",{status:c.status})}catch{return u(r(),"common.serverUnavailable")}}function ab(a){let b=r(),c=Date.now()/1e3-a;return c<90?u(b,"time.agoSec",{n:Math.round(c)}):c<5400?u(b,"time.agoMin",{n:Math.round(c/60)}):c<129600?u(b,"time.agoHour",{n:Math.round(c/3600)}):u(b,"time.agoDay",{n:Math.round(c/86400)})}function ac(a){if("string"!=typeof a&&"number"!=typeof a)return"";let b=new Date(a),c="uk"===r()?"uk-UA":"en-US";return Number.isNaN(b.getTime())?"":b.toLocaleTimeString(c,{hour12:!1})}function ad(a){return"live"===a?"animate-pulse bg-ok":"recent"===a?"bg-[#d29a2f]":"stalled"===a?"bg-err":"bg-[#c9c9d1]"}let ae={codex:{color:"#2f6fd0",soft:"#e8f0fb"},claude:{color:"#d97757",soft:"#faeee9"}},af={color:"#9a9aa4",soft:"#ececf1"},ag=[[/fable|mythos/,{color:"#c2410c",soft:"#fbeade"}],[/opus/,{color:"#8a5ad6",soft:"#f1ebfb"}],[/sonnet/,{color:"#e0913f",soft:"#fbf1e4"}],[/haiku/,{color:"#d9a58c",soft:"#f9f1ec"}]],ah=[[/spark/,{color:"#5ea3e4",soft:"#ecf4fd"}],[/mini|nano/,{color:"#7fb1e8",soft:"#eff6fd"}],[/codex/,{color:"#1d55ab",soft:"#e4edfa"}]];function ai(a){let b=ae[a.engine];if(!b)return af;let c=(a.model??"").toLowerCase();for(let[b,d]of"codex"===a.engine?ah:ag)if(b.test(c))return d;return b}let aj={minimal:{dl:20,ds:-32},low:{dl:12,ds:-20},medium:{dl:0,ds:0},high:{dl:-8,ds:12},xhigh:{dl:-14,ds:22},max:{dl:-19,ds:30}};function ak(a,b,c){let[d,e,f]=function(a){let b=parseInt(a.slice(1),16),c=(b>>16&255)/255,d=(b>>8&255)/255,e=(255&b)/255,f=Math.max(c,d,e),g=Math.min(c,d,e),h=(f+g)/2,i=f-g;if(0===i)return[0,0,100*h];let j=i/(1-Math.abs(2*h-1));return[60*(f===c?((d-e)/i+6)%6:f===d?(e-c)/i+2:(c-d)/i+4),100*j,100*h]}(a),g=a=>Math.min(100,Math.max(0,a));return`hsl(${Math.round(d)} ${Math.round(g(e+c))}% ${Math.round(g(f+b))}%)`}function al(a){let b=ai(a),c=aj[a.effort??""];return c?{color:ak(b.color,c.dl,c.ds),soft:ak(b.soft,Math.round(c.dl/3),Math.round(c.ds/2))}:b}function am(a){return a.effort?u(r(),"util.effortTitle",{effort:a.effort}):void 0}let an={minimal:1,low:2,medium:3,high:4,xhigh:5,max:6};function ao(a){return ai(a).color}function ap(a){return{backgroundColor:ai(a).color}}function aq(a){let b=ae[a]??af;return{label:({codex:"Codex",claude:"Claude",shell:"Bash"})[a]??a,style:{backgroundColor:b.soft,color:b.color}}}function ar(a){return aq(a.engine)}function as(a,b){return Math.floor(b.smt/300)-Math.floor(a.smt/300)||a.file.path.localeCompare(b.file.path)}function at(a,b=Date.now()/1e3){return!!a.pendingQuestion||!!a.waitingInput||("stalled"===a.activity?null!==N(a,b):"recent"===a.activity&&("claude"===a.engine||"codex"===a.engine)&&A(a)&&!B(a))}function au(a,b,c,d,f=av,g=aw){let{locale:h}=v();return(0,e.useMemo)(()=>{let e=(a,b)=>u(h,a,b),i=function(a){let b=I(a),c=new Map;for(let d of a)c.set(d.path,J(d,b).length);return c}(a),j=new Map;for(let a of b){let b=j.get(a.file);(!b||a.ts>b.ts)&&j.set(a.file,a)}let k=T(g),l=U(g),m=c.trim().toLowerCase(),n=a.filter(a=>!f.has(a.path)&&!l.has(a.path)&&(A(a)||"live"===a.activity||"stalled"===a.activity||"recent"===a.activity&&!D(a))).map(a=>{let b=E(a),c=w(a.title),f=d-a.mtime,g=k.get(a.path),h=a.pendingQuestion||a.waitingInput?"waiting":"live"===a.activity?"working":at(a,d)?"waiting":f<=86400?"recent":"older",l=function(a,b,c){var d;if(b.pendingQuestion)return a("plan"===b.pendingQuestion.kind?"status.awaitingPlan":"status.awaitingAnswer");if(b.waitingInput)return a("status.awaitingTerminal");if("live"===b.activity&&b.plan?.current)return`${b.plan.done}/${b.plan.total} \xb7 ${b.plan.current}`;let e=c.get(b.path);return e?`${e.label} \xb7 ${ab(e.ts)}`:"live"===b.activity?a("status.working"):B(d=b)&&"running"!==d.proc?a("status.returnedResult"):"stalled"===b.activity?a("status.stalled"):at(b)?a("status.finishedTurn"):""}(e,a,j);return g&&(X.has(g.state)?h="waiting":("reviewing"===g.state||"relaying"===g.state||"spawning"===g.state)&&(h="working"),l=`${e("status.flow",{label:W(e,g.state)})}${g.stateDetail?` — ${g.stateDetail}`:""}`),{file:a,project:b,title:c,descendants:i.get(a.path)??0,smt:a.mtime,kind:h,statusLine:l}}).filter(a=>!m||`${a.title} ${a.project}`.toLowerCase().includes(m)),o=(a,b)=>b.smt-a.smt||a.file.path.localeCompare(b.file.path),p=n.filter(a=>"waiting"===a.kind).sort(o),q=n.filter(a=>"working"===a.kind).sort(o);return{waiting:p,working:q,recent:n.filter(a=>"recent"===a.kind).sort(as),older:n.filter(a=>"older"===a.kind).sort(as),livePreview:q.slice(0,3)}},[a,b,c,d,f,g,h])}let av=new Set,aw=[];function ax(a,b=Date.now()/1e3){return a.pendingQuestion||a.waitingInput?"waiting":"live"===a.activity?"live":"recent"===a.activity&&C(a)&&"running"!==a.proc?"returned":at(a,b)?"stalled"===a.activity?"stalled":"waiting":"done"}let ay="llvSound";function az(a){try{window.localStorage.setItem("llvArchivedProjects",JSON.stringify([...a]))}catch{}}function aA(){window.dispatchEvent(new Event("llv:tasks-changed"))}async function aB(a,b,c){try{let d=await fetch(a,{method:b,...void 0===c?{}:{headers:{"content-type":"application/json"},body:JSON.stringify(c)}}),e=await d.json().catch(()=>null);if(!d.ok||!e)return{ok:!1,status:d.status,error:e?.error??u(r(),"tasks.failed",{status:d.status})};return aA(),{ok:!0,data:e}}catch{return{ok:!1,status:0,error:u(r(),"common.serverUnavailable")}}}async function aC(a){let b=await aB("/api/tasks","POST",a);return b.ok?{task:b.data.task}:{error:b.error}}let aD=new Map;async function aE(a){let b=aD.get(a);return b&&await b!==null?u(r(),"tasks.textNotSaved"):null}function aF(a,b){let c=void 0!==b.text?aD.get(a):void 0,d=(async()=>{c&&await c;let d=await aB(`/api/tasks/${encodeURIComponent(a)}`,"PATCH",b);return d.ok||404!==d.status?d.ok?null:d.error:(aA(),null)})();return void 0!==b.text&&(aD.set(a,d),d.finally(()=>{aD.get(a)===d&&aD.delete(a)})),d}async function aG(a){let b=await aB(`/api/tasks/${encodeURIComponent(a)}`,"DELETE");return b.ok||404!==b.status?b.ok?null:b.error:(aA(),null)}async function aH(a,b){let c=await aE(a);if(c)return{error:c};let d=await aB(`/api/tasks/${encodeURIComponent(a)}/assignment`,"POST",{path:b});return d.ok?{task:d.data.task}:{error:d.error}}async function aI(a,b){let c=await aB(`/api/tasks/${encodeURIComponent(a)}/assignment`,"DELETE",{path:b});return c.ok||404!==c.status?c.ok?null:c.error:(aA(),null)}async function aJ(a,b){let c=await aE(a);if(c)return{error:c};let d=await aB(`/api/tasks/${encodeURIComponent(a)}/send`,"POST",{paths:b});return d.ok?d.data:{error:d.error}}let aK="llv:workflows-changed";function aL(a){return a.startsWith("wf-")}let aM=new Set(["needs_decision","paused","approved"]),aN=new Set(["provisioning","implementing","reviewing","finishing"]);async function aO(a,b){try{let c=await fetch(`/api/workflows/${encodeURIComponent(a)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(b)});if(c.ok)return window.dispatchEvent(new Event(aK)),null;let d=await c.json().catch(()=>null);return d?.error??u(r(),"wfModel.failed",{status:c.status})}catch{return u(r(),"common.serverUnavailable")}}let aP={files:[],flows:[],workflows:[],tasks:[],loaded:!1},aQ="(max-width: 767px)";function aR(a){let b=window.matchMedia(aQ);return b.addEventListener("change",a),()=>b.removeEventListener("change",a)}function aS(){return(0,e.useSyncExternalStore)(aR,()=>window.matchMedia(aQ).matches,()=>!1)}let aT=k("menu",[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]]);function aU({files:a,workflows:b,archivedProjects:c,now:f,onSelectProject:g,onSelectFile:h,onMenu:i,attention:j}){let{t:k}=v(),l=function(){let[a,b]=(0,e.useState)(3);return a}(),m=(0,e.useMemo)(()=>G(a,f,b),[a,f,b]),n=(0,e.useMemo)(()=>m.filter(a=>!c.has(a.project)),[m,c]),o=m.length-n.length,p=(0,e.useMemo)(()=>n.reduce((a,b)=>a+b.liveCount,0),[n]),q=n.filter(a=>a.liveCount>0).length,r=(0,e.useMemo)(()=>n.map(b=>{let c=M(a,b.project).flatMap(a=>a.columns.flatMap(a=>[a.file,...a.tasks])).filter(a=>"live"===a.activity),d=c.slice(0,4),e=a.filter(a=>E(a)===b.project).sort((a,b)=>b.mtime-a.mtime)[0];return{summary:b,liveBranches:d,moreLive:c.length-d.length,latest:e}}),[a,n]);return(0,d.jsxs)("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[(0,d.jsxs)("div",{className:"flex h-10 shrink-0 items-center gap-2.5 border-b border-line bg-panel px-4",children:[i?(0,d.jsx)("button",{type:"button",className:"-ml-1.5 flex h-7 w-7 shrink-0 items-center justify-center rounded-[8px] border border-line bg-bg text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":k("dash.openProjects"),onClick:i,children:(0,d.jsx)(aT,{className:"h-4 w-4","aria-hidden":!0})}):null,(0,d.jsx)("h1",{className:"text-[13.5px] font-bold",children:k("rail.overview")}),(0,d.jsxs)("span",{className:"text-[11.5px] text-dim",children:[p?k("overview.branchesLiveIn",{count:p,projects:k("overview.projects",{count:q})}):k("common.nothingRunning"),o?` ${k("overview.archived",{count:o})}`:""]}),j?(0,d.jsx)("span",{className:"ml-auto flex shrink-0 items-center",children:j}):null]}),(0,d.jsxs)("div",{className:"grid flex-1 auto-rows-min gap-2.5 overflow-y-auto p-3",style:{gridTemplateColumns:`repeat(${l}, minmax(0, 1fr))`},children:[r.map(({summary:a,liveBranches:b,moreLive:c,latest:e})=>(0,d.jsxs)("button",{className:"flex flex-col gap-1.5 rounded-[10px] border border-line bg-panel p-3 text-left shadow-card hover:border-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>g(a.project),children:[(0,d.jsxs)("span",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${a.liveCount?"animate-pulse bg-ok":"bg-[#d6d6dd]"}`}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[13px] font-bold",children:a.project}),a.liveCount?(0,d.jsx)("span",{className:"shrink-0 rounded-full bg-[#e5f6ea] px-1.5 py-0.5 text-[10.5px] font-bold text-ok",children:a.liveCount}):null,(0,d.jsx)("span",{className:"shrink-0 text-[11px] font-semibold text-dim",children:a.conversations})]}),b.length?(0,d.jsxs)("span",{className:"flex flex-col gap-1",children:[b.map(a=>{let b=ar(a);return(0,d.jsxs)("span",{className:"flex cursor-pointer items-center gap-1.5 rounded-[8px] px-1 py-0.5 text-[11.5px] hover:bg-bg",role:"link",tabIndex:0,title:w(a.title),onClick:b=>{b.stopPropagation(),h(a)},onKeyDown:b=>{"Enter"===b.key&&(b.stopPropagation(),h(a))},children:[(0,d.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${ad(a.activity)}`}),(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:b.style,children:b.label}),(0,d.jsx)("span",{className:"truncate font-semibold",children:w(a.title,70)})]},a.path)}),c>0?(0,d.jsx)("span",{className:"px-1 text-[10.5px] font-semibold text-dim",children:k("overview.moreLive",{count:c})}):null]}):(0,d.jsx)("span",{className:"text-[11px] text-dim",children:k("overview.quiet",{age:e?ab(e.mtime):"—"})})]},a.project)),n.length?null:(0,d.jsx)("div",{className:"col-span-full mt-[20vh] text-center text-dim",children:k("overview.empty")})]})]})}let aV=k("list-todo",[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]]),aW=k("network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]),aX=k("list",[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]),aY=k("minimize-2",[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]]),aZ=k("maximize-2",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]),a$=k("git-branch",[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]]),a_=k("corner-down-right",[["path",{d:"m15 10 5 5-5 5",key:"qqa56n"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]),a0=k("archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]),a1=k("archive-restore",[["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"}]]),a2=k("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]),a3=k("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),a4=k("arrow-up-to-line",[["path",{d:"M5 3h14",key:"7usisc"}],["path",{d:"m18 13-6-6-6 6",key:"1kf1n9"}],["path",{d:"M12 7v14",key:"1akyts"}]]),a5=k("ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}]]),a6=k("brain",[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]]),a7=k("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),a8=k("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),a9=k("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),ba=k("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),bb=k("command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]),bc=k("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]),bd=k("fold-vertical",[["path",{d:"M12 22v-6",key:"6o8u61"}],["path",{d:"M12 8V2",key:"1wkif3"}],["path",{d:"M4 12H2",key:"rhcxmi"}],["path",{d:"M10 12H8",key:"s88cx1"}],["path",{d:"M16 12h-2",key:"10asgb"}],["path",{d:"M22 12h-2",key:"14jgyd"}],["path",{d:"m15 19-3-3-3 3",key:"e37ymu"}],["path",{d:"m15 5-3 3-3-3",key:"19d6lf"}]]),be=k("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]),bf=k("link-2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]),bg=k("mail",[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]]),bh=k("message-circle",[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]]),bi=k("mic",[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3",key:"s6n7sd"}]]),bj=k("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]),bk=k("sparkle",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}]]),bl=k("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]),bm=k("square-terminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]),bn=k("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]),bo=k("wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]]),bp=k("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]),bq=k("binary",[["rect",{x:"14",y:"14",width:"4",height:"6",rx:"2",key:"p02svl"}],["rect",{x:"6",y:"4",width:"4",height:"6",rx:"2",key:"xm4xkj"}],["path",{d:"M6 20h4",key:"1i6q5t"}],["path",{d:"M14 10h4",key:"ru81e7"}],["path",{d:"M6 14h2v6",key:"16z9wg"}],["path",{d:"M14 4h2v6",key:"1idq9u"}]]),br=k("pencil-line",[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]),bs=k("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]),bt=k("power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]),bu=k("clipboard-list",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]),bv=k("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),bw={shell:a8,tool:bo,"cmd-group":bp,codex:bb,claude:bk,image:be,blob:bq,note:br,citation:bs,message:bg,shutdown:bt,plan:bu,compact:bd};function bx({name:a,className:b}){let c=bw[a];return(0,d.jsx)(c,{className:b??"h-3.5 w-3.5","aria-hidden":!0})}var by=c(74429);let bz=k("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);function bA({label:a,side:b="top",align:c="center",children:e}){return(0,d.jsxs)("span",{className:"group/hint relative inline-flex",children:[e,(0,d.jsx)("span",{role:"tooltip",className:`pointer-events-none absolute z-[60] whitespace-nowrap rounded-[7px] bg-ink px-2 py-1 text-[10.5px] font-semibold text-white opacity-0 shadow-card transition-opacity delay-150 duration-100 group-focus-within/hint:opacity-100 group-hover/hint:opacity-100 ${"right"===c?"right-0":"left"===c?"left-0":"left-1/2 -translate-x-1/2"} ${"top"===b?"bottom-full mb-1.5":"top-full mt-1.5"}`,children:a})]})}let bB={"image/png":"png","image/jpeg":"jpg","image/jpg":"jpg","image/gif":"gif","image/webp":"webp"};function bC(a){return new Promise((b,c)=>{let d=new FileReader;d.onload=()=>{let e=String(d.result),f=e.indexOf(",");f<0?c(Error(u(r(),"img.readFailed"))):b({base64:e.slice(f+1),mime:a.type||"image/png",preview:e})},d.onerror=()=>c(d.error??Error(u(r(),"img.readFailed"))),d.onabort=()=>c(Error(u(r(),"img.readAborted"))),d.readAsDataURL(a)})}function bD({images:a,onRemove:b}){let{t:c}=v();return a.length?(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[a.map((a,e)=>(0,d.jsxs)("div",{className:"group/img relative",children:[(0,d.jsx)("img",{src:a.preview,alt:c("img.previewAlt",{n:e+1}),className:"h-10 w-10 rounded border border-line object-cover"}),(0,d.jsx)("button",{type:"button",onClick:()=>b(e),"aria-label":c("img.removeAria",{n:e+1}),className:"absolute -right-1 -top-1 hidden h-4 w-4 items-center justify-center rounded-full border border-line bg-panel text-dim shadow-card hover:text-err group-hover/img:flex focus-visible:flex focus-visible:outline-none",children:(0,d.jsx)(n,{className:"h-2.5 w-2.5","aria-hidden":!0})})]},e)),(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 text-[10.5px] font-semibold text-dim",children:[c("composer.imagesCount",{count:a.length})," ",(0,d.jsx)(a3,{className:"h-3 w-3","aria-hidden":!0})," ",c("img.toFilePaths")]})]}):null}function bE({onFiles:a,ariaLabel:b,className:c}){let f=(0,e.useRef)(null);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("input",{ref:f,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:b=>{a(Array.from(b.target.files??[])),b.target.value=""}}),(0,d.jsx)("button",{type:"button","aria-label":b,onClick:()=>f.current?.click(),className:c,children:(0,d.jsx)(be,{className:"h-4 w-4","aria-hidden":!0})})]})}let bF=null,bG=null,bH=async()=>{try{let a=await fetch("/api/transcribe/token",{method:"POST"});if(!a.ok)return null;let b=await a.json();return"string"==typeof b.token&&b.token?b.token:null}catch{return null}};function bI(){bG||bF&&bF.expiresAt>Date.now()||(bG=bH().then(a=>(bG=null,bF={token:a,expiresAt:Date.now()+(a?45e3:15e3)},a)))}let bJ=async()=>{let a=bG;if(a){let b=await a;return b&&(bF=null),b}let b=bF;return b&&b.expiresAt>Date.now()?(b.token&&(bF=null),b.token):(bF=null,bH())};function bK({onError:a,onUnclaimedText:b,onLiveCommit:c}){let{t:d}=v(),[f,g]=(0,e.useState)("idle"),[h,i]=(0,e.useState)(0),[j,k]=(0,e.useState)(""),l=(0,e.useRef)(null),m=(0,e.useRef)([]),n=(0,e.useRef)(null),o=(0,e.useRef)(!1),p=(0,e.useRef)(null),q=(0,e.useRef)(null),r=(0,e.useRef)(null),s=(0,e.useRef)(null),t=(0,e.useRef)(!1),u=(0,e.useRef)(!0),w=()=>{null!==p.current&&(clearInterval(p.current),p.current=null)},x=()=>{let a=r.current;r.current=null,a&&(cancelAnimationFrame(a.raf),a.ctx.close().catch(()=>void 0))},y=a=>{w(),x();let c=n.current;if(n.current=null,c){try{c.processor.disconnect()}catch{}try{c.ws.close()}catch{}c.stream.getTracks().forEach(a=>a.stop()),c.ctx.close().catch(()=>void 0)}k(""),g("idle");let d=s.current;if(s.current=null,o.current)return void d?.(null);let e=a.partial.trim();d?d(e):e&&b(e)},z=async()=>{w(),x();let c=l.current;l.current=null,c?.stream.getTracks().forEach(a=>a.stop());let e=new Blob(m.current,{type:"audio/webm"});m.current=[];let f=s.current;if(s.current=null,o.current||e.size<2e3){g("idle"),f?.(null);return}g("busy");try{let c=new FormData;c.append("file",e,"dictation.webm");let g=await fetch("/api/transcribe",{method:"POST",body:c}),h=await g.json();if(!g.ok||"string"!=typeof h.text){a(h.error??d("dictation.failed")),f?.(null);return}let i=h.text.trim();i?f?f(i):b(i):(a(d("dictation.silence")),f?.(null))}catch{a(d("common.serverUnavailable")),f?.(null)}finally{g("idle")}},A=async()=>{if(t.current||l.current||n.current)return;t.current=!0,g("starting"),o.current=!1;let b=null,e=!0;try{let[f,h]=await Promise.all([navigator.mediaDevices.getUserMedia({audio:{channelCount:1}}),bJ()]);if(b=f,!u.current||o.current)return;if(k(""),!(null!==h&&((b,e)=>{let f;try{f=new AudioContext({sampleRate:16e3})}catch{return!1}let g=new URLSearchParams({model_id:"scribe_v2_realtime",token:e,audio_format:"pcm_16000",commit_strategy:"vad",vad_silence_threshold_secs:"1.2"}),h=new WebSocket(`wss://api.elevenlabs.io/v1/speech-to-text/realtime?${g.toString()}`),i=f.createScriptProcessor(4096,1,1),j={ws:h,ctx:f,processor:i,stream:b,preOpenQueue:[],partial:""};n.current=j;let l=f.createMediaStreamSource(b);return i.onaudioprocess=a=>{if(n.current!==j)return;let b=function(a){let b=new Int16Array(a.length);for(let c=0;c<a.length;c+=1){let d=Math.max(-1,Math.min(1,a[c]??0));b[c]=d<0?32768*d:32767*d}let c=new Uint8Array(b.buffer),d="";for(let a=0;a<c.length;a+=1)d+=String.fromCharCode(c[a]??0);return btoa(d)}(a.inputBuffer.getChannelData(0));h.readyState===WebSocket.OPEN?h.send(JSON.stringify({message_type:"input_audio_chunk",audio_base_64:b})):h.readyState===WebSocket.CONNECTING&&j.preOpenQueue.push(b)},l.connect(i),i.connect(f.destination),h.addEventListener("open",()=>{if(n.current===j){for(let a of j.preOpenQueue)h.send(JSON.stringify({message_type:"input_audio_chunk",audio_base_64:a}));j.preOpenQueue=[]}}),h.addEventListener("message",b=>{if(n.current===j)try{let e=JSON.parse(b.data);if("partial_transcript"===e.message_type)j.partial=e.text??"";else if(("committed_transcript"===e.message_type||"committed_transcript_with_timestamps"===e.message_type)&&e.text)j.partial="",c(e.text);else if("auth_error"===e.message_type||"error"===e.message_type||"invalid_request"===e.message_type||"quota_exceeded"===e.message_type){a(e.error||d("dictation.liveError")),y(j);return}k(j.partial)}catch{}}),h.addEventListener("close",()=>{n.current!==j||s.current||(a(d("dictation.connectionLost")),y(j))}),!0})(b,h))){let a=MediaRecorder.isTypeSupported("audio/webm;codecs=opus")?"audio/webm;codecs=opus":MediaRecorder.isTypeSupported("audio/webm")?"audio/webm":"",c=a?new MediaRecorder(b,{mimeType:a}):new MediaRecorder(b);m.current=[],c.ondataavailable=a=>{a.data.size&&m.current.push(a.data)},c.onstop=()=>{z()},c.start(250),l.current=c}e=!1,(a=>{let b;try{b=new AudioContext}catch{return}let c=b.createAnalyser();c.fftSize=128,c.smoothingTimeConstant=.7,b.createMediaStreamSource(a).connect(c);let d=new Uint8Array(c.frequencyBinCount),e=()=>{if(!r.current)return;r.current.raf=requestAnimationFrame(e),c.getByteFrequencyData(d);let a=q.current;a&&function(a,b){let c=window.devicePixelRatio||1;(a.width!==56*c||a.height!==16*c)&&(a.width=56*c,a.height=16*c);let d=a.getContext("2d");if(!d)return;d.setTransform(c,0,0,c,0,0),d.clearRect(0,0,56,16);let e=Math.max(13,Math.floor(.65*b.length))/13;for(let a=0;a<13;a+=1){let c=Math.floor(a*e),f=Math.max(c+1,Math.floor((a+1)*e)),g=0;for(let a=c;a<f;a+=1)g+=b[a]??0;let h=g/(f-c)/255,i=Math.max(1.5,16*h);d.fillStyle=`rgba(198, 40, 40, ${(.35+.65*h).toFixed(3)})`,d.fillRect(4.3076923076923075*a+1,(16-i)/2,2.3076923076923075,i)}}(a,d)};r.current={ctx:b,raf:requestAnimationFrame(e)}})(b),i(0),g("rec"),p.current=window.setInterval(()=>{i(a=>{let b=a+1;return b>=120&&(l.current?.state==="recording"?l.current.stop():n.current&&y(n.current)),b})},1e3)}catch{u.current&&a(b?d("dictation.unsupported"):d("dictation.noMic"))}finally{var f;e&&(f=b,f?.getTracks().forEach(a=>a.stop())),t.current=!1,u.current&&g(a=>"starting"===a?"idle":a)}};return{phase:f,elapsed:h,liveText:j,canvasRef:q,start:A,stop:()=>new Promise(a=>{let b=n.current;if(b){s.current=a,y(b);return}let c=l.current;c&&"recording"===c.state?(s.current=a,c.stop()):a(null)}),discard:()=>{o.current=!0,l.current?.state==="recording"?l.current.stop():n.current&&y(n.current)}}}function bL({initialText:a,persistText:b,submit:c,disabled:d=!1}){let[f,g]=(0,e.useState)(a),h=(0,e.useRef)(f),i=a=>{let c="function"==typeof a?a(h.current):a;h.current=c,g(c),b(c)},[j,k]=(0,e.useState)(!1),[l,m]=(0,e.useState)(!1),[n,o]=(0,e.useState)(null),p=(0,e.useRef)(null),q=function(a){let[b,c]=(0,e.useState)([]),d=b=>{if(!b.length)return;let d=[];for(let c of b){if(null===(bB[c.type]??null)){a.onError(u(r(),"img.unsupported",{name:c.name||c.type||u(r(),"img.unknownFile")}));continue}if(c.size>0xa00000){a.onError(u(r(),"img.tooLarge",{name:c.name||u(r(),"img.image")}));continue}d.push(c)}if(!d.length)return;let e=d.length<b.length;Promise.all(d.map(bC)).then(b=>{c(a=>[...a,...b]),e||a.onAdded?.()}).catch(b=>{a.onError(b instanceof Error?b.message:u(r(),"img.error"))})};return{images:b,addFiles:d,handlePaste:a=>{let b=Array.from(a.clipboardData.items).filter(a=>a.type.startsWith("image/")).map(a=>a.getAsFile()).filter(a=>null!==a);b.length&&(a.preventDefault(),d(b))},removeAt:a=>c(b=>b.filter((b,c)=>c!==a)),clear:()=>c([])}}({onError:a=>o({kind:"err",text:a}),onAdded:()=>o(null)}),s=a=>{i(b=>b?b.trimEnd()+" "+a:a),o(null),p.current?.focus()},t=bK({onError:a=>o({kind:"err",text:a}),onUnclaimedText:s,onLiveCommit:s}),v=t.liveText?(f?f.trimEnd()+" ":"")+t.liveText:f,w=async()=>{if(!j&&!l){m(!0);try{let a=await t.stop();if(null===a)return;let b=a?h.current?h.current.trimEnd()+" "+a:a:h.current;i(b),await c(b)}finally{m(!1)}}},x="rec"===t.phase,y="busy"===t.phase,z=j||l||d,A=!z&&!y&&(x||!!f.trim()||q.images.length>0);return{text:f,textRef:h,setText:i,setTextState:g,displayText:v,inputRef:p,status:n,setStatus:o,busy:j,setBusy:k,voiceSending:l,dictation:t,attachments:q,insertSpoken:s,stopAndSend:w,submit:c,dictationRecording:x,dictationBusy:y,fieldsDisabled:z,canSend:A}}function bM({onClose:a}){let{locale:b,t:c}=v(),[f,g]=(0,e.useState)(null),[h,i]=(0,e.useState)(null),[j,k]=(0,e.useState)(null),[l,m]=(0,e.useState)(!1),[n,o]=(0,e.useState)(null),p=(0,e.useRef)(null),q=async(b,d)=>{if(f&&!f.lockedByEnv&&!n){if(!d){k(b),m(!1);return}o(b),i(null);try{let d=await fetch("/api/transcribe/backend",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({backend:b})}),e=await d.json();if(!d.ok)return void i(e.error??c("mic.saveFailed"));g(e),a()}catch{i(c("common.serverUnavailable"))}finally{o(null)}}},r=j&&f?f.options.find(a=>a.id===j):null;return(0,d.jsx)("div",{ref:p,role:"menu","aria-label":c("mic.menuTitle"),className:"absolute bottom-[calc(100%+6px)] right-0 z-40 w-[300px] rounded-[12px] border border-line bg-panel p-1.5 shadow-[0_10px_36px_rgb(20_20_30/0.18)]",children:r?(0,d.jsxs)("div",{className:"flex flex-col gap-2 p-2",children:[(0,d.jsx)("span",{className:"text-[12px] font-bold text-err",children:c("mic.keyTitle",{name:c(`stt.${r.id}.name`)})}),(0,d.jsx)("span",{className:"text-[11.5px] leading-snug text-ink",children:c(`stt.${r.id}.fix`)}),(0,d.jsxs)("span",{className:"flex items-center gap-1 rounded-[8px] border border-line bg-bg px-2 py-1.5",children:[(0,d.jsx)("code",{className:"min-w-0 flex-1 break-all font-mono text-[10.5px] text-ink",children:r.keyPath}),(0,d.jsxs)("button",{type:"button","aria-label":c("mic.copyPath"),title:c("mic.copyPath"),className:"inline-flex shrink-0 items-center gap-1 rounded-[6px] border border-line bg-panel px-1.5 py-1 text-[10px] font-semibold text-dim hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>{navigator.clipboard.writeText(r.keyPath).then(()=>m(!0))},children:[l?(0,d.jsx)(a7,{className:"h-3 w-3 text-ok","aria-hidden":!0}):(0,d.jsx)(bc,{className:"h-3 w-3","aria-hidden":!0}),l?c("mic.copied"):c("mic.copy")]})]}),(0,d.jsxs)("button",{type:"button",className:"self-start rounded-[8px] px-2 py-1 text-[11px] font-semibold text-dim hover:bg-bg hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>k(null),children:["← ",c("mic.back")]})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"px-2 pb-1 pt-1.5 text-[10.5px] font-bold uppercase tracking-wide text-dim",children:c("mic.menuTitle")}),f?.lockedByEnv?(0,d.jsx)("div",{className:"px-2 pb-1 text-[10.5px] text-err",children:c("mic.menuLocked")}):null,f||h?null:(0,d.jsxs)("div",{className:"flex items-center gap-2 px-2 py-2 text-[11.5px] text-dim",children:[(0,d.jsx)(bv,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0})," ",c("mic.menuLoading")]}),(f?.options??[]).map(a=>{let b=f?.backend===a.id;return(0,d.jsxs)("button",{type:"button",role:"menuitemradio","aria-checked":b,disabled:!!f?.lockedByEnv||null!==n,onClick:()=>void q(a.id,a.available),className:`flex w-full items-start gap-2 rounded-[9px] px-2 py-1.5 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60 ${b?"bg-accent/10":"hover:bg-bg"}`,children:[(0,d.jsx)("span",{className:"mt-[3px] flex h-3.5 w-3.5 shrink-0 items-center justify-center",children:n===a.id?(0,d.jsx)(bv,{className:"h-3.5 w-3.5 animate-spin text-dim","aria-hidden":!0}):b?(0,d.jsx)(a7,{className:"h-3.5 w-3.5 text-accent","aria-hidden":!0}):(0,d.jsx)("span",{"aria-hidden":!0,className:"h-2 w-2 rounded-full",style:{backgroundColor:a.available?"#1a8a3e":"#e0ae45"}})}),(0,d.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("span",{className:"flex items-center gap-1.5 text-[12px] font-semibold text-ink",children:[c(`stt.${a.id}.name`),a.available?null:(0,d.jsx)("span",{className:"rounded-full bg-[#fdf3dd] px-1.5 py-px text-[9.5px] font-bold text-[#b07d1f]",children:c("mic.noKey")})]}),(0,d.jsx)("span",{className:"block text-[10.5px] leading-snug text-dim",children:c(`stt.${a.id}.desc`)})]})]},a.id)}),h?(0,d.jsx)("div",{className:"px-2 py-1 text-[10.5px] font-semibold text-err",children:h}):null]})})}function bN({phase:a,elapsed:b,canvasRef:c,start:f,stop:g,discard:h,onText:i,busy:j=!1}){let{t:k}=v(),[l,m]=(0,e.useState)(!1),o=()=>{j||("idle"===a?f():"rec"===a&&g().then(a=>{a&&i(a)}))};if("rec"===a)return(0,d.jsxs)("span",{className:"flex shrink-0 items-center gap-1",children:[(0,d.jsxs)("button",{type:"button","aria-label":k("mic.stopRecognize"),onClick:o,className:"flex items-center gap-1.5 rounded-[8px] border border-err/50 bg-[#fff2f2] px-2 py-2 text-[11px] font-bold text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-err/40",children:[(0,d.jsx)("canvas",{ref:c,width:56,height:16,className:"h-4 w-14","aria-hidden":!0}),`${Math.floor(b/60)}:${String(b%60).padStart(2,"0")}`]}),(0,d.jsx)("button",{type:"button","aria-label":k("mic.cancel"),onClick:h,className:"inline-flex items-center justify-center rounded-[8px] border border-line bg-panel p-2 text-dim hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:(0,d.jsx)(n,{className:"h-3.5 w-3.5","aria-hidden":!0})})]});return(0,d.jsxs)("span",{className:"relative inline-flex shrink-0",children:[(0,d.jsx)("button",{type:"button","aria-label":k("busy"===a?"mic.recognizing":"starting"===a?"mic.connecting":"mic.dictate"),title:k("busy"===a?"mic.recognizing":"starting"===a?"mic.connecting":"mic.dictateHint"),disabled:"idle"!==a||j,onClick:o,onPointerEnter:bI,onFocus:bI,onContextMenu:a=>{a.preventDefault(),m(a=>!a)},className:`inline-flex shrink-0 items-center justify-center rounded-[8px] border p-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60 ${"starting"===a?"border-accent/40 bg-accent/10 text-accent":"border-line bg-panel text-dim hover:text-accent"}`,children:"busy"===a?(0,d.jsx)(bv,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):"starting"===a?(0,d.jsx)(bi,{className:"h-4 w-4 animate-pulse","aria-hidden":!0}):(0,d.jsx)(bi,{className:"h-4 w-4","aria-hidden":!0})}),l?(0,d.jsx)(bM,{onClose:()=>m(!1)}):null]})}function bO({label:a,actions:b,onClose:c}){let f=(0,e.useRef)(null);return(0,d.jsxs)("div",{ref:f,role:"menu","aria-label":a,className:"absolute bottom-[calc(100%+6px)] right-0 z-40 w-[220px] rounded-[12px] border border-line bg-panel p-1.5 shadow-[0_10px_36px_rgb(20_20_30/0.18)]",children:[(0,d.jsx)("div",{className:"px-2 pb-1 pt-1.5 text-[10.5px] font-bold uppercase tracking-wide text-dim",children:a}),b.map(a=>(0,d.jsxs)("button",{type:"button",role:"menuitem",disabled:a.disabled,onClick:()=>{a.onSelect(),c()},className:`flex w-full items-start gap-2 rounded-[9px] px-2 py-1.5 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-50 ${"ok"===a.tone?"hover:bg-ok/10":"hover:bg-bg"}`,children:[(0,d.jsx)(bj,{className:`mt-[2px] h-3.5 w-3.5 shrink-0 ${"ok"===a.tone?"text-ok":"text-dim"}`,"aria-hidden":!0}),(0,d.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,d.jsx)("span",{className:"block text-[12px] font-semibold text-ink",children:a.label}),a.description?(0,d.jsx)("span",{className:"block text-[10.5px] leading-snug text-dim",children:a.description}):null]})]},a.id))]})}function bP({composer:a,placeholder:b,textareaAriaLabel:c,imageAriaLabel:f,leftSlot:g,sendLabelIdle:h,sendLabelRecording:i,sendTitleRecording:j,sendIdleClassName:k,sendIdleStyle:l,sendMenuLabel:m,sendMenuActions:n=[],showImage:o=!0}){let{displayText:p,inputRef:q,dictation:r,setText:s,attachments:t,voiceSending:u,insertSpoken:v,stopAndSend:w,submit:x,fieldsDisabled:y,canSend:z,dictationRecording:A,busy:B,status:C}=a,[D,E]=(0,e.useState)(!1),F=n.length>0;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("textarea",{ref:q,value:p,rows:1,readOnly:!!r.liveText,onChange:a=>s(a.target.value),onFocus:bI,onPaste:t.handlePaste,onKeyDown:a=>{"Enter"!==a.key||a.shiftKey||a.nativeEvent.isComposing||(a.preventDefault(),"rec"===r.phase?w():x())},placeholder:b,"aria-label":c,disabled:y,className:"w-full resize-none overflow-y-auto rounded-[10px] border border-line bg-panel px-2.5 py-1.5 text-[12.5px] leading-[18px] text-[#222] placeholder:text-dim focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60"}),(0,d.jsxs)("div",{className:"flex items-center justify-between gap-1.5",children:[g,(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5",children:[(0,d.jsx)(bN,{...r,busy:u,onText:v}),o?(0,d.jsx)(bA,{label:f,children:(0,d.jsx)(bE,{ariaLabel:f,className:"inline-flex shrink-0 items-center justify-center rounded-[8px] border border-line bg-panel p-2 text-dim hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onFiles:t.addFiles})}):null,(0,d.jsxs)("span",{className:"relative inline-flex shrink-0",onContextMenu:a=>{F&&!A&&(a.preventDefault(),E(a=>!a))},children:[(0,d.jsx)(bA,{label:A?j??i:h,align:"right",children:(0,d.jsx)("button",{type:A?"button":"submit",onClick:A?()=>void w():a=>{z||(a.preventDefault(),a.stopPropagation())},disabled:!z&&!F,"aria-disabled":!z,"aria-label":A?i:h,style:A?void 0:l,className:`inline-flex shrink-0 items-center justify-center rounded-[8px] border p-2 text-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40 aria-disabled:opacity-40 ${A?"border-err bg-err hover:opacity-90":k}`,children:B||u?(0,d.jsx)(bv,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):(0,d.jsx)(bj,{className:"h-4 w-4","aria-hidden":!0})})}),D&&F&&m?(0,d.jsx)(bO,{label:m,actions:n,onClose:()=>E(!1)}):null]})]})]}),(0,d.jsx)(bD,{images:t.images,onRemove:t.removeAt}),C?(0,d.jsx)("span",{className:`truncate text-[10.5px] font-semibold ${"ok"===C.kind?"text-ok":"text-err"}`,children:C.text}):null]})}function bQ(a){return"claude-projects"===a.root?"session"===a.kind||"subagent"===a.kind:"codex-sessions"===a.root}function bR(a,b){let c="llvDraft:"+a,d=sessionStorage.getItem(c)??"";sessionStorage.setItem(c,d.trim()?d.replace(/\s*$/,"")+"\n\n"+b:b),window.dispatchEvent(new CustomEvent("llv-compose-draft",{detail:{path:a}}))}function bS({file:a,pollPaused:b=!1}){let{t:c}=v(),f=function(a,b,c=!0){let[d,f]=(0,e.useState)(null);return null!==a||b?d:null}(a.pid,bQ(a)?a.path:void 0,!b),g=bL({initialText:()=>"",persistText:b=>{b?sessionStorage.setItem("llvDraft:"+a.path,b):sessionStorage.removeItem("llvDraft:"+a.path)},submit:a=>J(a)}),{text:h,textRef:i,setText:j,setTextState:k,inputRef:l,setStatus:m,busy:o,setBusy:p,voiceSending:q,attachments:s}=g,t=aS(),[u,w]=(0,e.useState)(!1),[x,y]=(0,e.useState)(!1),[z,A]=(0,e.useState)(!1),[B,C]=(0,e.useState)(!1),[D,E]=(0,e.useState)([]),F=bQ(a);if(null===f&&!F)return null;let G=null===f,H=G&&"claude-projects"===a.root&&"subagent"===a.kind,I=b=>{E(b),sessionStorage.setItem("llvSent:"+a.path,JSON.stringify(b))},J=async b=>{let d=b??h;if(!o&&!q&&(d.trim()||s.images.length)){p(!0),m(null);try{let b=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({pid:a.pid??void 0,path:a.path,text:d,images:s.images.map(a=>({base64:a.base64,mime:a.mime}))})}),e=await b.json();if(!b.ok||!e.ok)return void m({kind:"err",text:e.error??c("common.failedSend")});let f=s.images.length,g={id:Date.now(),text:d.trim()||(f?c("composer.imagesCount",{count:f}):""),at:Date.now(),via:e.spawned?"spawn":"pane"};I([...D,g].slice(-8)),j(""),s.clear(),m({kind:"ok",text:e.spawned?c("composer.spawned",{target:e.target??""}):e.imagePaths?.length?c("composer.sentPaths",{count:e.imagePaths.length}):c("common.sent")}),l.current?.focus()}catch{m({kind:"err",text:c("common.serverUnavailable")})}finally{p(!1)}}},K=async()=>{if(!x){y(!0),m(null);try{let b=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"interrupt",path:a.path})}),d=await b.json();if(!b.ok||!d.ok)return void m({kind:"err",text:d.error??c("composer.failedInterrupt")});m({kind:"ok",text:c("composer.escapeSent")})}catch{m({kind:"err",text:c("common.serverUnavailable")})}finally{y(!1)}}},L=async()=>{if(!z){A(!0),m(null);try{let b=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"compact",path:a.path})}),d=await b.json();if(!b.ok||!d.ok)return void m({kind:"err",text:d.error??c("composer.failedCompact")});m({kind:"ok",text:c("composer.compactSent")})}catch{m({kind:"err",text:c("common.serverUnavailable")})}finally{A(!1)}}},M=(0,d.jsx)("span",{className:"inline-flex min-w-0 items-center gap-1 rounded-full bg-chip px-1.5 py-1 font-mono text-[9.5px] font-semibold text-[#555]",title:H?c("composer.titleRelay"):G?c("composer.titleSpawnResumed"):`tmux ${f}`,children:H?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(a4,{className:"h-3 w-3 shrink-0","aria-hidden":!0})," ",c("composer.root")]}):G?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(bj,{className:"h-3 w-3 shrink-0","aria-hidden":!0})," resume"]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(bm,{className:"h-3 w-3 shrink-0","aria-hidden":!0})," ",(0,d.jsx)("span",{className:"truncate",children:f})]})}),N=G?null:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(bA,{label:c("composer.interruptTitle"),children:(0,d.jsx)("button",{type:"button","aria-label":c("composer.interruptAria"),disabled:x,onClick:()=>void K(),className:"inline-flex shrink-0 items-center justify-center rounded-[8px] border border-line bg-panel p-2 text-dim hover:border-err/40 hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-50",children:x?(0,d.jsx)(bv,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):(0,d.jsx)(bl,{className:"h-4 w-4",fill:"currentColor","aria-hidden":!0})})}),(0,d.jsx)(bA,{label:B?c("composer.compactConfirmTitle"):c("composer.compactTitle"),children:(0,d.jsx)("button",{type:"button","aria-label":B?c("composer.compactConfirmTitle"):c("composer.compactAria"),disabled:z,onClick:()=>{B?(C(!1),L()):C(!0)},className:`inline-flex shrink-0 items-center justify-center gap-1 rounded-[8px] border p-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-50 ${B?"border-[#0d9488] bg-[#e3f4f0] text-[#0b7c72]":"border-line bg-panel text-dim hover:border-[#0d9488]/50 hover:text-[#0b7c72]"}`,children:z?(0,d.jsx)(bv,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):B?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(a7,{className:"h-4 w-4","aria-hidden":!0}),(0,d.jsx)("span",{className:"text-[10.5px] font-bold",children:c("composer.compactConfirm")})]}):(0,d.jsx)(bd,{className:"h-4 w-4","aria-hidden":!0})})})]}),O=o||q||s.images.length>0;return(0,d.jsxs)("form",{onSubmit:a=>{a.preventDefault(),J()},className:"flex shrink-0 flex-col gap-1.5 border-t border-line bg-[#fbfbfd] px-2.5 py-2","aria-label":G?c("composer.spawnAria"):c("composer.sendAria",{target:f??""}),children:[D.length?(0,d.jsx)("div",{className:"flex flex-col gap-0.5","aria-label":c("composer.queueAria"),children:D.map(a=>(0,d.jsxs)("div",{className:"flex items-center justify-end gap-1.5",children:[(0,d.jsx)("span",{className:"min-w-0 max-w-[85%] truncate rounded-[10px] rounded-br-[3px] bg-[#ecebfb] px-2 py-0.5 text-[11px] text-[#333]",title:a.text,children:a.text}),(0,d.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-0.5 text-[9.5px] text-dim",children:["spawn"===a.via?(0,d.jsx)(bj,{className:"h-2.5 w-2.5","aria-hidden":!0}):(0,d.jsx)(a3,{className:"h-2.5 w-2.5","aria-hidden":!0}),new Date(a.at).toLocaleTimeString("uk"===r()?"uk-UA":"en-US",{hour12:!1,hour:"2-digit",minute:"2-digit"})]}),(0,d.jsx)("button",{type:"button","aria-label":c("composer.removeFromQueue"),className:"inline-flex shrink-0 items-center rounded px-0.5 text-dim hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>I(D.filter(b=>b.id!==a.id)),children:(0,d.jsx)(n,{className:"h-3 w-3","aria-hidden":!0})})]},a.id))}):null,(0,d.jsx)(bP,{composer:g,placeholder:H?c("composer.placeholderRelay"):G?c("composer.placeholderSpawn"):c("composer.placeholderSend"),textareaAriaLabel:c("composer.textAria"),imageAriaLabel:c("composer.addImages"),sendLabelIdle:G?c("composer.launchAgent"):c("composer.sendToAgent"),sendLabelRecording:c("composer.stopAndSend"),sendTitleRecording:c("composer.stopAndSendTitle"),sendIdleClassName:"border-accent bg-accent hover:opacity-90",sendMenuLabel:c("composer.sendMenuTitle"),sendMenuActions:!G||H?[{id:"quick-ack",label:c("composer.quickAckLabel"),description:c("composer.quickAck"),disabled:O,tone:"ok",onSelect:()=>void J(c("composer.quickAck"))}]:[],showImage:!t,leftSlot:t?(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5",children:[(0,d.jsx)("button",{type:"button","aria-expanded":u,"aria-label":c("composer.moreTools"),title:c("composer.moreTools"),onClick:()=>w(a=>!a),className:"inline-flex shrink-0 items-center justify-center rounded-[8px] border border-line bg-panel p-2 text-dim hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:(0,d.jsx)(bz,{className:`h-4 w-4 transition-transform ${u?"rotate-45":""}`,"aria-hidden":!0})}),u?(0,d.jsxs)(d.Fragment,{children:[M,N,(0,d.jsx)(bE,{ariaLabel:c("composer.addImages"),className:"inline-flex shrink-0 items-center justify-center rounded-[8px] border border-line bg-panel p-2 text-dim hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onFiles:s.addFiles})]}):null]}):(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5",children:[M,N]})})]})}let bT="#0d9488",bU=new Map;function bV(){for(let a of document.querySelectorAll("[data-link-hover]"))a.removeAttribute("data-link-hover")}function bW(a,b,c,d){let e=Math.max(48,.45*Math.abs(c-a));return`M ${a} ${b} C ${a+e} ${b}, ${c-e} ${d}, ${c} ${d}`}function bX(a){let[b,c]=(0,e.useState)(!1),f=(0,e.useRef)(a),[g,h]=(0,e.useState)(null),[i,j]=(0,e.useState)(null),k=(0,e.useRef)(null),l=(0,e.useRef)(!1),m=(0,e.useRef)(!1),n=(0,e.useRef)(null),o="link-arrow-"+(0,e.useId)().replace(/[^a-zA-Z0-9-]/g,"");return{onPillPointerDown:a=>{if("mouse"===a.pointerType&&0!==a.button||k.current)return;let b=a.currentTarget.getBoundingClientRect(),d=a=>{let b=k.current;if(!b)return;if(b.lastX=a.clientX,b.lastY=a.clientY,!b.active){if(7>Math.hypot(a.clientX-b.startX,a.clientY-b.startY))return;b.active=!0,l.current=!0,m.current=!0,document.body.style.cursor="crosshair",bV(),j(null),h({x:b.anchorX,y:b.anchorY}),c(!0),f.current.onDragStart?.()}n.current?.setAttribute("d",bW(b.anchorX,b.anchorY,a.clientX,a.clientY));let d=function(a,b,c){let d=document.elementFromPoint(a,b)?.closest("[data-link-path]"),e=d?.getAttribute("data-link-path");if(!d||!e||e===c)return null;let f=bU.get(e);return f&&f.el===d?f:null}(a.clientX,a.clientY,f.current.exclude??null);d?.el!==b.hover?.el&&(b.hover?.el.removeAttribute("data-link-hover"),d?.el.setAttribute("data-link-hover","1"),b.hover=d)},e=a=>{let b=k.current;if(k.current=null,b?.detach(),l.current=!1,document.body.style.cursor="",b?.active)if(c(!1),b.hover){let c=f.current.onDrop(b.hover,{x:a.clientX,y:a.clientY});null!==c?j({label:c,from:{x:b.anchorX,y:b.anchorY},to:{x:a.clientX,y:a.clientY}}):bV()}else bV(),f.current.onMiss?.({x:a.clientX,y:a.clientY})};k.current={startX:a.clientX,startY:a.clientY,anchorX:b.right,anchorY:b.top+b.height/2,lastX:a.clientX,lastY:a.clientY,active:!1,hover:null,detach:()=>{window.removeEventListener("pointermove",d),window.removeEventListener("pointerup",e),window.removeEventListener("pointercancel",e)}},window.addEventListener("pointermove",d),window.addEventListener("pointerup",e),window.addEventListener("pointercancel",e)},consumeClick:()=>{let a=m.current;return m.current=!1,a},draggingRef:l,overlay:b||i?(0,by.createPortal)((0,d.jsxs)("div",{className:"pointer-events-none fixed inset-0 z-[95]",children:[(0,d.jsxs)("svg",{className:"block h-full w-full",children:[(0,d.jsx)("defs",{children:(0,d.jsx)("marker",{id:o,markerWidth:"9",markerHeight:"9",refX:"7",refY:"4.5",orient:"auto",children:(0,d.jsx)("path",{d:"M0,0 L8,4.5 L0,9 Z",fill:bT})})}),(0,d.jsx)("path",{ref:a=>{n.current=a;let b=k.current;a&&b?.active&&a.setAttribute("d",bW(b.anchorX,b.anchorY,b.lastX,b.lastY))},d:i?bW(i.from.x,i.from.y,i.to.x,i.to.y):void 0,fill:"none",stroke:bT,strokeWidth:2.5,strokeLinecap:"round",markerEnd:`url(#${o})`}),(0,d.jsx)("circle",{cx:i?i.from.x:g?.x??0,cy:i?i.from.y:g?.y??0,r:4,fill:bT})]}),i?(0,d.jsx)(bY,{drop:i}):null]}),document.body):null}}function bY({drop:a}){let b=Math.max(8,Math.min(a.to.x+14,window.innerWidth-288)),c=Math.max(8,Math.min(a.to.y+12,window.innerHeight-44));return(0,d.jsxs)("div",{className:"fixed flex max-w-[280px] items-center gap-1.5 rounded-full px-3 py-1.5 text-[11.5px] font-semibold text-white shadow-card",style:{left:b,top:c,backgroundColor:bT},children:[(0,d.jsx)(bf,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),(0,d.jsx)("span",{className:"truncate",children:a.label})]})}function bZ({file:a,onDeleted:b}){let{t:c}=v(),[f,g]=(0,e.useState)(!1),[h,i]=(0,e.useState)(!1),[j,k]=(0,e.useState)("");if("running"===a.proc)return null;let l=async()=>{i(!0),k("");try{let d=await fetch(`/api/log?path=${encodeURIComponent(a.path)}`,{method:"DELETE"}),e=await d.json();if(!d.ok||!e.ok)return void k(e.error??c("common.failedDelete"));g(!1),b?.()}catch{k(c("common.serverUnavailable"))}finally{i(!1)}};return f?(0,d.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-[10px] border border-err/30 bg-[#fff5f5] px-1.5 py-0.5 text-[11px]",children:[(0,d.jsx)("span",{className:"px-0.5 font-semibold text-err",children:c("delFile.confirm")}),(0,d.jsx)("button",{type:"button",className:"rounded-lg bg-err px-2 py-0.5 font-bold text-white disabled:opacity-60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-err/50",disabled:h,onClick:l,children:h?"…":c("common.yes")}),(0,d.jsx)("button",{type:"button",className:"rounded-lg border border-line bg-panel px-2 py-0.5 font-semibold text-dim focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>g(!1),children:c("common.no")})]}):(0,d.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1",children:[(0,d.jsx)("button",{type:"button",className:"inline-flex items-center rounded-[8px] border border-line bg-bg px-1.5 py-0.5 text-dim hover:border-err/40 hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":c("delFile.aria"),title:c("delFile.aria"),onClick:()=>g(!0),children:(0,d.jsx)(bn,{className:"h-3 w-3","aria-hidden":!0})}),j?(0,d.jsx)("span",{className:"max-w-[160px] truncate text-[10.5px] font-semibold text-err",title:j,children:j}):null]})}function b$({file:a}){let b=an[a.effort??""]??0;if(!b)return null;let{color:c}=al(a),e=am(a);return(0,d.jsx)("span",{className:"inline-flex h-[12px] shrink-0 items-end gap-px",role:"img","aria-label":e,title:e,style:{transform:"scale(clamp(1, var(--inv-z, 1), 5))",transformOrigin:"left bottom"},children:Array.from({length:6},(a,e)=>(0,d.jsx)("span",{"aria-hidden":!0,className:"shrink-0 rounded-full",style:{width:"3px",height:`${7+e}px`,backgroundColor:e<b?c:"var(--color-line, #e6e6ea)"}},e))})}function b_({className:a,style:b,enter:c="scale",children:f}){let g=(0,e.useRef)(null);return!function(a="scale"){(0,e.useRef)(new Map),(0,e.useRef)(new WeakMap),(0,e.useRef)(!0)}(c),(0,d.jsx)("div",{ref:g,className:a,style:b,children:f})}let b0=k("arrow-down-to-line",[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]]),b1=/^\s*(?:VERDICT:\s*)?(REQUEST_CHANGES|APPROVE|COMMENT)\b/m,b2=/^\s*(\d+)[.)]\s+(.*)$/,b3=/(?:\[(P[0-3])\]|\b(Critical|High|Medium|Low|Info|P[0-3])\b)/i,b4=/((?:\.{1,2}\/|\/|~\/)?[\w@.+-][\w@.+\-/]*\.(?:tsx?|jsx?|mjs|cjs|mts|cts|py|go|rs|md|json|ya?ml|toml|css|scss|html|sql|sh|env|ftl|txt))(?::(\d+))?/i,b5=/\[([^\]]+)\]\(([^)\s]+)\)/,b6=/([\w.-]*(?:api[_-]?key|access[_-]?token|refresh[_-]?token|authorization|bearer|secret|password|passwd|pwd|token))\b(\s*[:=]\s*)(["']?)[^\s"',}]+/gi;function b7(a){return a.replace(b6,(a,b,c,d)=>`${b}${c}${d}[redacted]`)}function b8(a){let b=b7(a);return{raw:b.slice(0,24e3),truncated:b.length>24e3}}function b9(a){let b=a.match(/^(.*?):(\d+(?:-\d+)?)$/);return b?{target:b[1]??a,line:b[2]}:{target:a}}function ca(a,b){let c=a.match(b1)?.[1];if(!c)return null;let d=[],e=[],f=null,g=()=>{let a,b,c,e=f?.trim();e&&d.push((a=function(a){let b=a.toUpperCase();if("P0"===b||"P1"===b||"P2"===b||"P3"===b)return b;let c=a.toLowerCase();return"critical"===c?"Critical":"high"===c?"High":"medium"===c?"Medium":"low"===c?"Low":"Info"}(e.match(b3)?.[1]??e.match(b3)?.[2]??"Info"),b=function(a){let b=a.match(b5);if(b){let a=b9((b[2]??"").replace(/^file:\/\//,"")),c=a.line?Number(a.line.split("-",1)[0]):void 0;return{file:a.target||b[1],line:Number.isFinite(c)?c:void 0}}let c=a.match(b4);if(!c)return{};let d=c[2]?Number(c[2]):void 0;return{file:c[1],line:Number.isFinite(d)?d:void 0}}(e),c=function(a){let b=a,c=b.match(b3);if(c&&void 0!==c.index){let a=b.slice(c.index+c[0].length).replace(/^[\s.:–—-]+/,"");a&&(b=a)}return b.replace(b5,"$1").replace(/`([^`]*)`/g,"$1").replace(/\s+/g," ").trim().slice(0,200)}(e)||e.slice(0,200)||"Finding",{severity:a,file:b.file,line:b.line,title:c,body:b8(e).raw})),f=null};for(let b of a.split("\n")){let a=b.trimEnd(),c=a.match(b2);if(c){g(),f=c[2]??"";continue}let h=a.trim();if(null!==f){h?f=`${f}
|
|
3
|
-
${h}`:g();continue}!(!h||b1.test(a)||/^(findings?|summary|open questions?|tests?|residual risk)\s*:?\s*$/i.test(h))&&0===d.length&&e.length<3&&h.length<=240&&e.push(h)}g();let h=d.filter(a=>b3.test(a.body)).length;return c||/^findings?\s*:?$/im.test(a)||h>=2||h>=1&&/\b(review|request_changes|approve|comment)\b/i.test(a)?{kind:"review",ts:b,verdict:c,findings:d,summary:e,raw:b8(a).raw}:null}let cb=(a,b)=>u(r(),a,b),cc=/<oai-mem-citation>\s*<citation_entries>([\s\S]*?)<\/citation_entries>\s*<rollout_ids>([\s\S]*?)<\/rollout_ids>\s*<\/oai-mem-citation>/g;function cd(a){return"number"==typeof a&&Number.isFinite(a)?a:void 0}let ce=/<(teammate-message|agent-message)\b([^>]*)>([\s\S]*?)<\/\1>/g,cf=/\S*\/(?:agent-log-viewer\/inbox|\.claude\/viewer-inbox)\/([A-Za-z0-9._-]+\.(?:png|jpe?g|gif|webp))/gi;function cg(a){if(!a.includes("/.claude/viewer-inbox/")&&!a.includes("/agent-log-viewer/inbox/"))return{cleaned:a,images:[]};let b=[],c=new Set,d=[];for(let e of a.split("\n"))e.replace(cf,(a,d)=>(c.has(a)||(c.add(a),b.push({name:d,path:a})),"")).trim()&&d.push(e);return{cleaned:d.join("\n").trim(),images:b}}let ch=/^\s*(?:<[a-zA-Z][\w:-]*|Caveat: The messages below|\[Request interrupted|This came from another Claude session|# AGENTS\.md instructions)/;function ci(a,b){let c=a.match(/^\s*<([a-zA-Z][\w:-]*)/)?.[1];return c||(/^\s*# AGENTS\.md/.test(a)?"AGENTS.md":/^\s*Caveat:/.test(a)?"caveat":b||cb("render.system"))}function cj(a,b){return a.match(RegExp(`${b}="([^"]*)"`))?.[1]??""}function ck(a){return"string"==typeof a?a:""}function cl(a){return a&&"object"==typeof a&&!Array.isArray(a)?a:{}}function cm(a){return Array.isArray(a)?a.filter(a=>a&&"object"==typeof a&&!Array.isArray(a)):[]}function cn(a,b,c){let d=b.split("\n").map(a=>a.trim()).filter(Boolean).map(a=>{let b=a.match(/\|note=\[(.*)\]$/)?.[1],c=b9(a.replace(/\|note=\[.*\]$/,""));return{target:c.target,line:c.line,note:b,raw:a}}),e=c.split(/\s+/).map(a=>a.trim()).filter(a=>/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(a)),f=b8(a);return{kind:"mem-citation",entries:d,rolloutIds:e,raw:f.raw,truncated:f.truncated}}async function co(a){try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(a),!0}catch{}try{let b=document.createElement("textarea");b.value=a,b.style.position="fixed",b.style.opacity="0",document.body.appendChild(b),b.select();let c=document.execCommand("copy");return b.remove(),c}catch{return!1}}function cp({text:a,label:b,className:c=""}){let[f,g]=(0,e.useState)(!1),h=(0,e.useRef)(null),i=f?cb("common.copied"):b??cb("common.copy");return(0,d.jsx)("button",{type:"button","aria-label":i,title:i,onClick:b=>{b.preventDefault(),b.stopPropagation(),co(a).then(a=>{a&&(g(!0),null!==h.current&&window.clearTimeout(h.current),h.current=window.setTimeout(()=>g(!1),1400))})},className:`inline-flex shrink-0 items-center justify-center rounded-[6px] border border-line bg-panel p-1 text-dim shadow-card hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${c}`,children:f?(0,d.jsx)(a7,{className:"h-3 w-3 text-ok","aria-hidden":!0}):(0,d.jsx)(bc,{className:"h-3 w-3","aria-hidden":!0})})}let cq=k("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);function cr({src:a,alt:b,caption:c,onClose:f}){let{t:g}=v(),[h,i]=(0,e.useState)(1),[j,k]=(0,e.useState)(0),[l,m]=(0,e.useState)(0),[o,p]=(0,e.useState)(!1),q=(0,e.useRef)(null),r=(a,b=0,c=0)=>{let d=Math.min(8,Math.max(.25,h*a)),e=d/h;i(d),k(b-(b-j)*e),m(c-(c-l)*e)},s=()=>{i(1),k(0),m(0)};return(0,by.createPortal)((0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex flex-col bg-black/85 backdrop-blur-sm",role:"dialog","aria-modal":"true","aria-label":b,onClick:f,children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 px-4 py-2.5",onClick:a=>a.stopPropagation(),children:[(0,d.jsx)("span",{className:"min-w-0 truncate text-[12.5px] font-semibold text-white/85",children:c??b}),(0,d.jsxs)("span",{className:"ml-auto flex items-center gap-1.5",children:[(0,d.jsx)("button",{className:"inline-flex items-center rounded-lg border border-white/25 bg-white/10 px-2.5 py-1 text-white hover:bg-white/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/60","aria-label":g("lightbox.zoomOut"),onClick:()=>r(1/1.4),children:(0,d.jsx)(cq,{className:"h-4 w-4","aria-hidden":!0})}),(0,d.jsxs)("button",{className:"rounded-lg border border-white/25 bg-white/10 px-2 py-1 text-[11.5px] font-semibold text-white hover:bg-white/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/60","aria-label":g("lightbox.resetZoom"),onClick:s,children:[Math.round(100*h),"%"]}),(0,d.jsx)("button",{className:"inline-flex items-center rounded-lg border border-white/25 bg-white/10 px-2.5 py-1 text-white hover:bg-white/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/60","aria-label":g("lightbox.zoomIn"),onClick:()=>r(1.4),children:(0,d.jsx)(bz,{className:"h-4 w-4","aria-hidden":!0})}),(0,d.jsx)("button",{className:"ml-1 inline-flex items-center rounded-lg border border-white/25 bg-white/10 px-2.5 py-1 text-white hover:bg-white/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/60","aria-label":g("common.close"),onClick:f,children:(0,d.jsx)(n,{className:"h-4 w-4","aria-hidden":!0})})]})]}),(0,d.jsx)("div",{className:"min-h-0 flex-1 touch-none overflow-hidden",onClick:a=>a.stopPropagation(),onWheel:a=>{let b=a.currentTarget.getBoundingClientRect(),c=a.clientX-b.left-b.width/2,d=a.clientY-b.top-b.height/2;r(a.deltaY<0?1.18:1/1.18,c,d)},onPointerDown:a=>{a.currentTarget.setPointerCapture(a.pointerId),q.current={x:a.clientX,y:a.clientY,tx:j,ty:l},p(!0)},onPointerMove:a=>{q.current&&(k(q.current.tx+(a.clientX-q.current.x)),m(q.current.ty+(a.clientY-q.current.y)))},onPointerUp:()=>{q.current=null,p(!1)},onPointerCancel:()=>{q.current=null,p(!1)},onDoubleClick:()=>1===h?r(2):s(),children:(0,d.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,d.jsx)("img",{src:a,alt:b,draggable:!1,className:`max-h-full max-w-full select-none ${o?"":"transition-transform duration-75"} ${h>1?"cursor-grab active:cursor-grabbing":"cursor-zoom-in"}`,style:{transform:`translate(${j}px, ${l}px) scale(${h})`}})})})]}),document.body)}function cs({name:a,path:b}){let{t:c}=v(),[f,g]=(0,e.useState)("thumb"),[h,i]=(0,e.useState)(null),[j,k]=(0,e.useState)(!1),[l,m]=(0,e.useState)(!1),[n,o]=(0,e.useState)(""),p=`/api/inbox?name=${encodeURIComponent(a)}`,q=async()=>{m(!0),o("");try{let a=await fetch(p,{method:"DELETE"}),b=await a.json();if(!a.ok||!b.ok)return void o(b.error??c("common.failedDelete"));i("deleted")}catch{o(c("common.serverUnavailable"))}finally{m(!1),k(!1)}};return h?(0,d.jsx)("div",{className:"my-2 flex justify-end",children:(0,d.jsxs)("span",{className:"inline-flex max-w-[75%] items-center gap-1.5 rounded-full border border-line bg-chip px-2.5 py-1 text-[11.5px] font-semibold text-dim",title:b,children:[(0,d.jsx)(bx,{name:"image",className:"h-3.5 w-3.5"}),(0,d.jsx)("span",{className:"truncate",children:a}),(0,d.jsxs)("span",{className:"shrink-0",children:["\xb7 ","deleted"===h?c("inbox.deleted"):c("inbox.fileGone")]})]})}):"chip"===f?(0,d.jsx)("div",{className:"my-2 flex justify-end",children:(0,d.jsxs)("button",{type:"button",onClick:()=>g("thumb"),className:"inline-flex max-w-[75%] items-center gap-2 rounded-[14px] border border-line bg-panel px-3.5 py-2 text-[13px] shadow-card",title:b,children:[(0,d.jsx)("span",{className:"flex h-6.5 w-6.5 shrink-0 items-center justify-center rounded-lg bg-chip",children:(0,d.jsx)(bx,{name:"image",className:"h-4 w-4"})}),(0,d.jsx)("span",{className:"truncate font-mono text-[12px]",children:a}),(0,d.jsx)("span",{className:"shrink-0 text-[12px] font-semibold text-accent",children:c("common.show")})]})}):(0,d.jsxs)("div",{className:"my-2 flex justify-end",children:[(0,d.jsxs)("div",{className:"max-w-[75%]",children:[(0,d.jsx)("img",{src:p,alt:c("inbox.attachedAlt",{name:a}),onClick:()=>g("full"),onError:()=>i("missing"),className:"ml-auto block max-h-[240px] cursor-zoom-in rounded-[14px] border border-line"}),(0,d.jsxs)("div",{className:"mt-1 flex flex-wrap items-center justify-end gap-1.5 text-[11px]",children:[(0,d.jsx)("span",{className:"min-w-0 truncate font-mono text-dim",title:b,children:a}),(0,d.jsx)("button",{type:"button",onClick:()=>g("chip"),className:"shrink-0 text-dim hover:text-ink",children:c("common.collapse")}),j?(0,d.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-[10px] border border-err/30 bg-[#fff5f5] px-1.5 py-0.5",children:[(0,d.jsx)("span",{className:"px-1 font-semibold text-err",children:c("inbox.confirmDelete")}),(0,d.jsx)("button",{type:"button",className:"rounded-lg bg-err px-2 py-0.5 font-bold text-white disabled:opacity-60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-err/50",disabled:l,onClick:q,children:l?c("trash.deleting"):c("trash.confirmYes")}),(0,d.jsx)("button",{type:"button",className:"rounded-lg border border-line bg-panel px-2 py-0.5 font-semibold text-dim focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>k(!1),children:c("common.cancel")})]}):(0,d.jsxs)("button",{type:"button",onClick:()=>k(!0),"aria-label":c("inbox.deleteAria",{name:a}),className:"inline-flex shrink-0 items-center gap-1 rounded-full border border-line bg-panel px-2 py-0.5 font-semibold text-dim hover:border-err/40 hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[(0,d.jsx)(bn,{className:"h-3 w-3","aria-hidden":!0})," ",c("inbox.deleteFromDisk")]}),n?(0,d.jsx)("span",{className:"shrink-0 font-semibold text-err",children:n}):null]})]}),"full"===f?(0,d.jsx)(cr,{src:p,alt:c("inbox.attachedAlt",{name:a}),caption:b,onClose:()=>g("thumb")}):null]})}let ct=/(!\[[^\]]*\]\([^)\s]+\)|`[^`]+`|\*\*[^*]+\*\*|\[[^\]]+\]\([^)\s]+\)|https?:\/\/[^\s<>"')\]]+)/g,cu=/^\s*!\[([^\]]*)\]\(([^)\s]+)\)\s*$/;function cv({text:a}){let[b,c]=(0,e.useState)(!1),f=(0,e.useRef)(null);return(0,d.jsx)("span",{title:b?cb("common.copied"):cb("common.clickToCopy"),onClick:b=>{b.preventDefault(),b.stopPropagation(),co(a).then(a=>{a&&(c(!0),null!==f.current&&window.clearTimeout(f.current),f.current=window.setTimeout(()=>c(!1),1400))})},className:`cursor-copy rounded-md px-1.5 py-0.5 font-mono ${b?"bg-ok/15 text-ok":"bg-chip"}`,children:a})}function cw({code:a}){return(0,d.jsxs)("div",{className:"group/code relative my-1.5 max-w-full",children:[(0,d.jsx)("pre",{className:"max-w-full overflow-x-auto rounded-[10px] border border-line bg-bg px-3 py-2 font-mono text-[11.5px]",children:a}),(0,d.jsx)(cp,{text:a,label:cb("feed.copyCode"),className:"absolute right-1.5 top-1.5 opacity-0 transition-opacity focus-visible:opacity-100 group-hover/code:opacity-100 [@media(hover:none)]:opacity-60"})]})}function cx(a){let b=a.replace(/\\([()])/g,"$1"),c=b.replace(/^file:\/\//,"");return/^(?:\/|~\/)/.test(c)?`#f=${encodeURIComponent(c.replace(/:\d+$/,""))}`:b}function cy({href:a,label:b}){let c=/^https?:\/\//.test(a);return(0,d.jsx)("a",{href:a,target:c?"_blank":void 0,rel:c?"noreferrer":void 0,title:a,className:"break-all text-accent underline decoration-accent/40 underline-offset-2 hover:decoration-accent",children:b})}function cz({alt:a,src:b}){let[c,f]=(0,e.useState)(!1),[g,h]=(0,e.useState)(!1),i=function(a){let b=a.replace(/\\([()])/g,"$1");if(/^(?:https?:)?\/\//.test(b)||b.startsWith("data:"))return b;let c=b.replace(/^file:\/\//,"");return`/api/image?path=${encodeURIComponent(c)}`}(b);return g?(0,d.jsx)(cy,{href:cx(b),label:a||b}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("img",{src:i,alt:a,title:a||void 0,loading:"lazy",onClick:()=>f(!0),onError:()=>h(!0),className:"my-1 max-h-[240px] max-w-full cursor-zoom-in rounded-[10px] border border-line align-top"}),c?(0,d.jsx)(cr,{src:i,alt:a,caption:a||void 0,onClose:()=>f(!1)}):null]})}function cA({images:a}){return(0,d.jsx)("div",{className:"my-1.5 flex flex-wrap items-start gap-2",children:a.map((a,b)=>(0,d.jsx)(cz,{alt:a.alt,src:a.src},b))})}function cB(a){return a.split(ct).map((a,b)=>{if(!a)return null;if(a.startsWith("`")&&a.endsWith("`"))return(0,d.jsx)(cv,{text:a.slice(1,-1)},b);if(a.startsWith("**")&&a.endsWith("**"))return(0,d.jsx)("b",{children:a.slice(2,-2)},b);let c=a.match(/^!\[([^\]]*)\]\(([^)\s]+)\)$/);if(c)return(0,d.jsx)(cz,{alt:c[1],src:c[2]},b);let e=a.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);if(e)return(0,d.jsx)(cy,{href:cx(e[2]),label:e[1]},b);if(/^https?:\/\//.test(a)){let c=a.replace(/[.,;:!?…»)]+$/,""),e=a.slice(c.length),f=c.length>72?c.slice(0,69)+"…":c;return(0,d.jsxs)("span",{children:[(0,d.jsx)(cy,{href:c,label:f}),e]},b)}return a})}let cC=/^\s*\|.*\|\s*$/,cD=/^:?-{1,}:?$/;function cE({rows:a}){let b=a.map(a=>a.trim().replace(/^\|/,"").replace(/\|$/,"").split("|").map(a=>a.trim())),c=b.length>1&&b[1].every(a=>cD.test(a)),e=c?b[0]:null,f=c?b.slice(2):b;return(0,d.jsx)("div",{className:"my-1.5 max-w-full overflow-x-auto",children:(0,d.jsxs)("table",{className:"border-collapse text-[12.5px]",children:[e?(0,d.jsx)("thead",{children:(0,d.jsx)("tr",{children:e.map((a,b)=>(0,d.jsx)("th",{className:"border border-line bg-chip px-2.5 py-1 text-left font-semibold",children:cB(a)},b))})}):null,(0,d.jsx)("tbody",{children:f.map((a,b)=>(0,d.jsx)("tr",{children:a.map((a,b)=>(0,d.jsx)("td",{className:"border border-line px-2.5 py-1 align-top",children:cB(a)},b))},b))})]})})}function cF(a){let b=a.split("\n"),c=[],f=0;for(;f<b.length;){if(/^\s*```/.test(b[f])){let a=f;for(f++;f<b.length&&!/^\s*```\s*$/.test(b[f]);)f++;let e=b.slice(a+1,f).join("\n");f<b.length&&f++,"\n"===c[c.length-1]&&c.pop(),c.push((0,d.jsx)(cw,{code:e},`c${a}`));continue}if(cC.test(b[f])){let a=f;for(;f<b.length&&cC.test(b[f]);)f++;"\n"===c[c.length-1]&&c.pop(),c.push((0,d.jsx)(cE,{rows:b.slice(a,f)},`t${a}`));continue}if(cu.test(b[f])){let a=f,e=[];for(;f<b.length;){let a=b[f].match(cu);if(!a)break;e.push({alt:a[1],src:a[2]}),f++}"\n"===c[c.length-1]&&c.pop(),c.push((0,d.jsx)(cA,{images:e},`i${a}`));continue}let a=b[f],g=a.match(/^#{1,6}\s+(.*)$/),h=a.match(/^>\s?(.*)$/);g?c.push((0,d.jsx)("span",{className:"text-[14px] font-bold",children:cB(g[1])},f)):h?c.push((0,d.jsx)("span",{className:"border-l-2 border-line pl-2 text-dim",children:cB(h[1])},f)):c.push((0,d.jsx)(e.Fragment,{children:cB(a)},f)),++f<b.length&&c.push("\n")}return c}function cG({bytes:a,text:b}){let[c,f]=(0,e.useState)(!1),g=Math.round(a/1024);return c?(0,d.jsxs)("div",{className:"my-2 ml-9 overflow-hidden rounded-[14px] border border-line bg-panel shadow-card",children:[(0,d.jsx)("pre",{className:"max-h-[340px] overflow-auto whitespace-pre-wrap break-all bg-[#fafafc] px-3.5 py-2.5 font-mono text-[11.5px]",children:b}),(0,d.jsx)("button",{type:"button",onClick:()=>f(!1),className:"block w-full border-t border-line px-3.5 py-1.5 text-[12px] text-dim",children:cb("common.collapse")})]}):(0,d.jsxs)("button",{type:"button",onClick:()=>f(!0),className:"my-2 ml-9 flex items-center gap-2 rounded-[14px] border border-line bg-panel px-3.5 py-2 text-[13px] shadow-card",children:[(0,d.jsx)("span",{className:"flex h-6.5 w-6.5 items-center justify-center rounded-lg bg-chip",children:(0,d.jsx)(bx,{name:"blob",className:"h-4 w-4"})}),(0,d.jsx)("span",{className:"font-semibold",children:cb("render.dataKb",{n:g})}),(0,d.jsx)("span",{className:"ml-1 text-[12px] font-semibold text-accent",children:cb("common.show")})]})}let cH=/(?:\/\.codex\/sessions\/|\/\.claude\/projects\/|\/\.claude\/plugins\/data\/codex-openai-codex\/state\/|^\/tmp\/claude-\d+\/)/;function cI({status:a,className:b}){let c=b??"h-3.5 w-3.5";return"ok"===a?(0,d.jsx)(a7,{className:c,"aria-hidden":!0}):"err"===a?(0,d.jsx)(n,{className:c,"aria-hidden":!0}):(0,d.jsx)(bv,{className:`${c} animate-spin`,"aria-hidden":!0})}function cJ({file:a,line:b}){let c=b?`${a}:${b}`:a,e="inline-block min-w-0 max-w-full truncate rounded-md bg-chip px-1.5 py-0.5 align-bottom font-mono text-[11.5px]";return cH.test(a)?(0,d.jsx)("a",{href:`#f=${encodeURIComponent(a)}`,className:`${e} text-accent underline decoration-dotted`,title:c,children:c}):(0,d.jsx)("code",{className:e,title:c,children:c})}function cK({item:a}){let b=Object.entries(a.byTool).map(([a,b])=>`${a} \xd7${b}`).join(" \xb7 "),c=ac(a.t0),e=ac(a.t1),f=c&&e&&c!==e?`${c}–${e}`:c||e;return(0,d.jsxs)("details",{className:`my-2.5 ml-9 overflow-hidden rounded-[14px] border shadow-card ${a.hasErr?"border-err/35 bg-[#fff4f4]":"border-line bg-panel"}`,open:a.hasErr,children:[(0,d.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-2.5 px-3.5 py-2",children:[(0,d.jsx)("span",{className:"flex h-6.5 w-6.5 shrink-0 items-center justify-center rounded-lg bg-chip",children:(0,d.jsx)(bx,{name:"cmd-group",className:"h-4 w-4"})}),(0,d.jsxs)("span",{className:"flex min-w-0 flex-1 items-center gap-1 truncate text-[12.5px]",children:[cb("render.commands",{count:a.calls.length}),b?" \xb7 "+b:""," \xb7",(0,d.jsxs)("span",{className:"inline-flex items-center gap-0.5 text-ok",children:[(0,d.jsx)(a7,{className:"h-3.5 w-3.5","aria-hidden":!0}),a.okCount]}),a.errCount?(0,d.jsxs)("span",{className:"inline-flex items-center gap-0.5 text-err",children:[(0,d.jsx)(n,{className:"h-3.5 w-3.5","aria-hidden":!0}),a.errCount]}):null]}),f?(0,d.jsx)("span",{className:"ml-auto shrink-0 text-[11px] text-dim",children:f}):null]}),(0,d.jsx)("div",{className:"space-y-1 border-t border-line bg-[#fafafc] px-2 py-1.5",children:a.calls.map((b,c)=>{let e="ok"===b.status?"text-ok":"err"===b.status?"text-err":"text-dim";return(0,d.jsxs)("details",{className:"overflow-hidden rounded-[10px] border border-line bg-panel",open:b.open,children:[(0,d.jsxs)("summary",{className:"flex h-6 cursor-pointer list-none items-center gap-2 px-2.5 text-[11.5px]",children:[(0,d.jsx)("span",{className:"flex h-4.5 w-4.5 shrink-0 items-center justify-center rounded-md bg-chip",children:(0,d.jsx)(bx,{name:b.icon,className:"h-3 w-3"})}),(0,d.jsx)("code",{className:"min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap rounded-md bg-chip px-1.5 py-0.5 font-mono text-[11px]",children:b.display}),(0,d.jsxs)("span",{className:`ml-auto inline-flex shrink-0 items-center gap-1 text-[10.5px] font-semibold ${e}`,children:[(0,d.jsx)(cI,{status:b.status,className:"h-3 w-3"}),b.label]})]}),(0,d.jsx)("pre",{className:"max-h-[280px] overflow-auto whitespace-pre-wrap border-t border-line bg-[#fafafc] px-3 py-2 font-mono text-[11.5px]",children:"$ "+b.cmd+(b.output?"\n"+b.output:"")})]},`${a.ids[c]}:${c}`)})})]})}function cL({item:a}){let b=[a.trigger?cb("auto"===a.trigger?"render.compactAuto":"render.compactManual"):"",a.preTokens?cb("render.compactPre",{n:Math.round(a.preTokens/1e3)}):"",ac(a.ts)||""].filter(Boolean).join(" \xb7 ");return(0,d.jsxs)("div",{className:"my-3.5",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,d.jsx)("span",{className:"h-px flex-1 bg-[#0d9488]/30","aria-hidden":!0}),(0,d.jsxs)("span",{className:"inline-flex items-center gap-1.5 rounded-full border border-[#0d9488]/30 bg-[#e7f6f4] px-2.5 py-1 text-[11px] font-bold text-[#0b7c72]",children:[(0,d.jsx)(bx,{name:"compact",className:"h-3.5 w-3.5"}),cb("render.compacted"),b?(0,d.jsx)("span",{className:"font-semibold opacity-75",children:b}):null]}),(0,d.jsx)("span",{className:"h-px flex-1 bg-[#0d9488]/30","aria-hidden":!0})]}),a.summary?(0,d.jsxs)("details",{className:"group/cmp mt-1.5 text-center",children:[(0,d.jsxs)("summary",{className:"cursor-pointer list-none text-[11px] font-semibold text-[#0b7c72] [&::-webkit-details-marker]:hidden",children:[(0,d.jsxs)("span",{className:"group-open/cmp:hidden",children:[cb("render.compactSummary")," \xb7 ",cb("common.show")]}),(0,d.jsx)("span",{className:"hidden group-open/cmp:inline",children:cb("common.collapse")})]}),(0,d.jsx)("pre",{className:"mt-1 max-h-[320px] overflow-auto whitespace-pre-wrap break-words rounded-[10px] border border-line bg-bg px-3 py-2 text-left font-mono text-[11px] text-[#555]",children:a.summary})]}):null]})}function cM({media:a,data:b,w:c,h:f,bytes:g}){let[h,i]=(0,e.useState)("thumb"),j=Math.round((g??3*b.length/4)/1024),k=c&&f?`${c}\xd7${f}`:cb("render.image");if("chip"===h)return(0,d.jsxs)("button",{type:"button",onClick:()=>i("thumb"),className:"my-2 ml-9 flex items-center gap-2 rounded-[14px] border border-line bg-panel px-3.5 py-2 text-[13px] shadow-card",children:[(0,d.jsx)("span",{className:"flex h-6.5 w-6.5 items-center justify-center rounded-lg bg-chip",children:(0,d.jsx)(bx,{name:"image",className:"h-4 w-4"})}),(0,d.jsx)("span",{className:"font-semibold",children:k}),(0,d.jsxs)("span",{className:"text-dim",children:["\xb7 ",j," ",cb("common.kb")]}),(0,d.jsx)("span",{className:"ml-1 text-[12px] font-semibold text-accent",children:cb("common.show")})]});let l=`data:${a};base64,${b}`;return(0,d.jsxs)("div",{className:"my-2 ml-9",children:[(0,d.jsx)("img",{src:l,alt:`${cb("render.image")} ${k}`,onClick:()=>i("full"),className:"max-h-[240px] cursor-zoom-in rounded-[14px] border border-line"}),(0,d.jsx)("button",{type:"button",onClick:()=>i("chip"),className:"mt-1 block text-[12px] text-dim",children:cb("common.collapse")}),"full"===h?(0,d.jsx)(cr,{src:l,alt:`${cb("render.image")} ${k}`,caption:`${k} \xb7 ${j} ${cb("common.kb")}`,onClose:()=>i("thumb")}):null]})}function cN({item:a}){let b=a.entries.slice(0,8),c=a.rolloutIds.slice(0,6);return(0,d.jsxs)("details",{className:"group my-2 ml-9 overflow-hidden rounded-[14px] border border-line bg-panel text-[12px] shadow-card",children:[(0,d.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-2 px-3.5 py-2",children:[(0,d.jsx)("span",{className:"flex h-6.5 w-6.5 shrink-0 items-center justify-center rounded-lg bg-chip",children:(0,d.jsx)(bx,{name:"citation",className:"h-4 w-4"})}),(0,d.jsx)("span",{className:"text-[13px] font-semibold",children:cb("render.memoryCitations",{count:a.entries.length})}),(0,d.jsx)("span",{className:"ml-auto text-[11px] font-semibold text-accent group-open:hidden",children:cb("common.show")}),(0,d.jsx)("span",{className:"ml-auto hidden text-[11px] font-semibold text-accent group-open:inline",children:cb("common.collapse")})]}),(0,d.jsxs)("div",{className:"border-t border-line px-3.5 py-2.5",children:[b.length?(0,d.jsx)("div",{className:"space-y-1.5",children:b.map((a,b)=>(0,d.jsxs)("div",{className:"min-w-0 rounded-[9px] bg-[#fbfbfd] px-2.5 py-1.5",children:[(0,d.jsx)(cJ,{file:a.target,line:a.line?Number(a.line.split("-",1)[0]):void 0}),a.note?(0,d.jsx)("div",{className:"mt-1 whitespace-pre-wrap break-words text-[12px] text-[#555]",children:a.note}):null]},b))}):(0,d.jsx)("div",{className:"text-[12px] text-dim",children:cb("render.noCitations")}),a.entries.length>b.length?(0,d.jsx)("div",{className:"mt-1.5 text-[12px] text-dim",children:cb("render.moreEntries",{count:a.entries.length-b.length})}):null,c.length?(0,d.jsxs)("div",{className:"mt-2 flex flex-wrap items-center gap-1.5",children:[(0,d.jsx)("span",{className:"text-[11px] text-dim",children:"rollout:"}),c.map(a=>(0,d.jsx)("code",{className:"rounded-full bg-chip px-2 py-0.5 font-mono text-[10.5px] text-dim",title:a,children:a.slice(0,8)},a)),a.rolloutIds.length>c.length?(0,d.jsxs)("span",{className:"text-[11px] text-dim",children:["+",a.rolloutIds.length-c.length]}):null]}):null,(0,d.jsxs)("details",{className:"mt-2 rounded-[10px] border border-line bg-[#fafafc] text-[12px]",children:[(0,d.jsxs)("summary",{className:"cursor-pointer list-none px-3 py-1.5 font-semibold text-dim",children:["raw citation block",a.truncated?" \xb7 "+cb("render.truncated"):""]}),(0,d.jsx)("pre",{className:"max-h-[260px] overflow-auto whitespace-pre-wrap border-t border-line px-3 py-2 font-mono text-[11.5px] text-[#555]",children:a.raw})]})]})]})}let cO={shutdown_request:{icon:"shutdown",labelKey:"render.shutdownRequest",tone:"amber"},shutdown_response:{icon:"shutdown",labelKey:"render.shutdownResponse",tone:"amber"},plan_approval_request:{icon:"plan",labelKey:"render.planRequest",tone:"accent"},plan_approval_response:{icon:"plan",labelKey:"render.planVerdict",tone:"accent"}};function cP(a){return"string"==typeof a&&a.length?a:void 0}function cQ({approve:a}){return(0,d.jsx)("span",{className:`rounded-full border px-2 py-0.5 text-[10.5px] font-extrabold ${a?"border-ok/25 bg-[#eefaf1] text-ok":"border-err/25 bg-[#fff0f0] text-err"}`,children:a?cb("render.approved"):cb("render.rejected")})}function cR({payload:a}){let b=cP(a.from),c=cP(a.requestId),e=ac(a.timestamp);return b||c||e?(0,d.jsxs)("div",{className:"mt-1.5 flex flex-wrap items-center gap-x-2.5 gap-y-1 text-[11px] text-dim",children:[b?(0,d.jsx)("span",{children:cb("render.from",{from:b})}):null,c?(0,d.jsx)("span",{className:"truncate font-mono",title:c,children:c.length>40?c.slice(0,40)+"…":c}):null,e?(0,d.jsx)("span",{children:e}):null]}):null}function cS({payload:a}){let b=cP(a.type),c=b?cO[b]:void 0;if(!c)return(0,d.jsxs)("div",{className:"text-[13px]",children:[(0,d.jsx)("div",{className:"text-dim",children:cb("render.structured")}),(0,d.jsxs)("details",{className:"mt-1 text-[12px]",children:[(0,d.jsx)("summary",{className:"cursor-pointer list-none font-semibold text-accent",children:cb("render.showJson")}),(0,d.jsx)("pre",{className:"mt-1 max-h-[280px] overflow-auto whitespace-pre-wrap rounded-md bg-chip px-2.5 py-2 font-mono text-[11.5px]",children:JSON.stringify(a,null,2)})]})]});let e="boolean"==typeof a.approve?a.approve:void 0,f=cP(a.reason)??cP(a.feedback);return(0,d.jsxs)("div",{className:"text-[13px]",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsxs)("span",{className:`inline-flex items-center gap-1 rounded-full border px-2.5 py-0.5 text-[11.5px] font-bold ${"amber"===c.tone?"border-[#d89b21]/35 bg-[#fff9ea] text-[#9a6500]":"border-accent/25 bg-accent/10 text-accent"}`,children:[(0,d.jsx)(bx,{name:c.icon,className:"h-3.5 w-3.5"}),cb(c.labelKey)]}),void 0!==e?(0,d.jsx)(cQ,{approve:e}):null]}),f?(0,d.jsx)("div",{className:"mt-1.5 whitespace-pre-wrap break-words",children:cF(f)}):null,(0,d.jsx)(cR,{payload:a})]})}function cT({verdict:a}){return(0,d.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,d.jsx)("REQUEST_CHANGES"===a?a5:"APPROVE"===a?ba:bh,{className:"h-3.5 w-3.5","aria-hidden":!0}),"REQUEST_CHANGES"===a?"REQUEST_CHANGES":"APPROVE"===a?"APPROVE":"COMMENT"]})}function cU({item:a}){var b;let c=a.findings.length,e=a.findings.slice(0,12);return(0,d.jsxs)("div",{className:"my-3.5 ml-9 overflow-hidden rounded-[14px] border border-codex/20 bg-panel shadow-card",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2 border-b border-line px-3.5 py-2.5",children:[(0,d.jsx)("span",{className:"flex h-6.5 w-6.5 shrink-0 items-center justify-center rounded-lg bg-codex-soft text-codex",children:(0,d.jsx)(bb,{className:"h-4 w-4","aria-hidden":!0})}),(0,d.jsx)("span",{className:"text-[13.5px] font-bold",children:"Codex review"}),a.verdict?(0,d.jsx)("span",{className:`rounded-full border px-2.5 py-0.5 text-[11.5px] font-extrabold ${"REQUEST_CHANGES"===(b=a.verdict)?"bg-[#fff0f0] text-err border-err/25":"APPROVE"===b?"bg-[#eefaf1] text-ok border-ok/25":"bg-chip text-[#555] border-line"}`,children:(0,d.jsx)(cT,{verdict:a.verdict})}):null,(0,d.jsx)("span",{className:"text-[11px] text-dim",children:c?`${c} finding${1===c?"":"s"}`:cb("render.noFindings")}),ac(a.ts)?(0,d.jsx)("span",{className:"ml-auto text-[11px] text-dim",children:ac(a.ts)}):null]}),(0,d.jsxs)("div",{className:"px-3.5 py-2.5",children:[a.summary.length?(0,d.jsx)("div",{className:"mb-2 whitespace-pre-wrap break-words text-[13px] text-[#444]",children:cF(a.summary.join("\n"))}):null,e.length?(0,d.jsx)("div",{className:"space-y-2",children:e.map((a,b)=>{var c;return(0,d.jsxs)("div",{className:"rounded-[10px] border border-line bg-[#fbfbfd] px-3 py-2",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsx)("span",{className:`rounded-full border px-2 py-0.5 text-[10.5px] font-extrabold ${"Critical"===(c=a.severity)||"High"===c||"P0"===c||"P1"===c?"border-err/30 bg-[#fff4f4] text-err":"Medium"===c||"P2"===c?"border-[#d89b21]/35 bg-[#fff9ea] text-[#9a6500]":"Low"===c||"P3"===c?"border-line bg-chip text-[#555]":"border-line bg-panel text-dim"}`,children:a.severity}),a.file?(0,d.jsx)(cJ,{file:a.file,line:a.line}):null]}),(0,d.jsx)("div",{className:"mt-1.5 whitespace-pre-wrap break-words text-[13px]",children:cB(a.title)}),a.body&&a.body!==a.title?(0,d.jsxs)("details",{className:"mt-1 text-[12px] text-dim",children:[(0,d.jsx)("summary",{className:"cursor-pointer list-none font-semibold text-accent",children:"details"}),(0,d.jsx)("div",{className:"mt-1 whitespace-pre-wrap break-words",children:cF(a.body)})]}):null]},b)})}):null,a.findings.length>e.length?(0,d.jsx)("div",{className:"mt-2 text-[12px] text-dim",children:cb("render.moreFindings",{count:a.findings.length-e.length})}):null,(0,d.jsxs)("details",{className:"mt-2 rounded-[10px] border border-line bg-[#fafafc] text-[12px]",children:[(0,d.jsx)("summary",{className:"cursor-pointer list-none px-3 py-1.5 font-semibold text-dim",children:"raw review text"}),(0,d.jsx)("pre",{className:"max-h-[320px] overflow-auto whitespace-pre-wrap border-t border-line px-3 py-2 font-mono text-[11.5px] text-[#555]",children:a.raw})]})]})]})}function cV({label:a,text:b}){let c=b.length>=2048?`${(b.length/1024).toFixed(1)} ${cb("common.kb")}`:cb("common.chars",{n:b.length});return(0,d.jsxs)("details",{className:"group my-1.5 ml-9",children:[(0,d.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-1.5 text-[11px] font-semibold text-dim hover:text-ink [&::-webkit-details-marker]:hidden",children:[(0,d.jsx)("span",{className:"flex h-4.5 w-4.5 items-center justify-center rounded-md bg-chip",children:(0,d.jsx)(bx,{name:"cmd-group",className:"h-3 w-3"})}),(0,d.jsx)("span",{className:"rounded-full bg-chip px-1.5 py-0.5 font-mono text-[9.5px]",children:a}),(0,d.jsxs)("span",{children:[cb("render.system")," \xb7 ",c]}),(0,d.jsx)("span",{className:"text-accent group-open:hidden",children:cb("common.show")}),(0,d.jsx)("span",{className:"hidden text-dim group-open:inline",children:cb("common.collapse")})]}),(0,d.jsx)("pre",{className:"mt-1 max-h-[320px] overflow-auto whitespace-pre-wrap break-words rounded-[10px] border border-line bg-bg px-3 py-2 font-mono text-[11px] text-[#555]",children:b})]})}let cW=(0,e.memo)(function({item:a}){if("image"===a.kind)return(0,d.jsx)(cM,{media:a.media,data:a.data,w:a.w,h:a.h,bytes:a.bytes});if("inbox-image"===a.kind)return(0,d.jsx)(cs,{name:a.name,path:a.path});if("blob"===a.kind)return(0,d.jsx)(cG,{bytes:a.bytes,text:a.text});if("sysmsg"===a.kind)return(0,d.jsx)(cV,{label:a.label,text:a.text});if("compact"===a.kind)return(0,d.jsx)(cL,{item:a});if("review"===a.kind)return(0,d.jsx)(cU,{item:a});if("mem-citation"===a.kind)return(0,d.jsx)(cN,{item:a});if("prose"===a.kind){let b="codex"===a.engine?"bg-codex":"bg-claude",c="codex"===a.engine?bb:bk;return(0,d.jsxs)("div",{className:"group/msg my-3.5 flex gap-2.5",children:[(0,d.jsx)("div",{className:`mt-1 flex h-6.5 w-6.5 shrink-0 items-center justify-center rounded-full text-white ${b}`,children:(0,d.jsx)(c,{className:"h-3.5 w-3.5","aria-hidden":!0})}),(0,d.jsxs)("div",{className:"relative min-w-0 flex-1 whitespace-pre-wrap break-words",children:[ac(a.ts)?(0,d.jsx)("div",{className:"mb-0.5 text-[11px] text-dim",children:ac(a.ts)}):null,(0,d.jsx)(cp,{text:a.text,label:cb("feed.copyMd"),className:"absolute right-0 top-0 opacity-0 transition-opacity focus-visible:opacity-100 group-hover/msg:opacity-100 [@media(hover:none)]:opacity-60"}),cF(a.text)]})]})}if("user"===a.kind){let b=a.text.length>500;return(0,d.jsxs)("div",{className:"group/msg my-3.5 flex items-start justify-end gap-1.5",children:[(0,d.jsx)(cp,{text:a.text,label:cb("feed.copyMd"),className:"mt-2 opacity-0 transition-opacity focus-visible:opacity-100 group-hover/msg:opacity-100 [@media(hover:none)]:opacity-60"}),(0,d.jsx)("div",{className:"max-w-[75%] whitespace-pre-wrap break-words rounded-2xl bg-user px-4 py-2.5",children:b?(0,d.jsxs)("details",{className:"group/usr",children:[(0,d.jsxs)("summary",{className:"cursor-pointer list-none [&::-webkit-details-marker]:hidden",children:[(0,d.jsxs)("span",{className:"group-open/usr:hidden",children:[a.text.slice(0,180),"… ",(0,d.jsxs)("span",{className:"font-semibold text-accent",children:["(",cb("common.chars",{n:a.text.length}),")"]})]}),(0,d.jsxs)("span",{className:"hidden items-center gap-1 text-[11px] font-semibold text-dim group-open/usr:inline-flex",children:[cb("common.collapse")," ",(0,d.jsx)(a9,{className:"h-3 w-3","aria-hidden":!0})]})]}),cF(a.text)]}):cF(a.text)})]})}if("cmd"===a.kind){let b="ok"===a.call.status?"text-ok":"err"===a.call.status?"text-err":"text-dim";return(0,d.jsxs)("details",{className:"my-2.5 ml-9 overflow-hidden rounded-[14px] border border-line bg-panel shadow-card",open:a.call.open,children:[(0,d.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-2.5 px-3.5 py-2",children:[(0,d.jsx)("span",{className:"flex h-6.5 w-6.5 shrink-0 items-center justify-center rounded-lg bg-chip",children:(0,d.jsx)(bx,{name:a.call.icon,className:"h-4 w-4"})}),(0,d.jsx)("code",{className:"max-w-[70%] overflow-hidden text-ellipsis whitespace-nowrap rounded-md bg-chip px-2 py-0.5 font-mono text-[12.5px]",children:a.call.display}),(0,d.jsxs)("span",{className:`ml-auto inline-flex shrink-0 items-center gap-1 text-xs font-semibold ${b}`,children:[(0,d.jsx)(cI,{status:a.call.status}),a.call.label]})]}),(0,d.jsx)("pre",{className:"max-h-[340px] overflow-auto whitespace-pre-wrap border-t border-line bg-[#fafafc] px-3.5 py-2.5 font-mono text-[12.5px]",children:"$ "+a.call.cmd+(a.call.output?"\n"+a.call.output:"\n"+cb("render.noOutputInLog"))})]})}if("cmd-group"===a.kind)return(0,d.jsx)(cK,{item:a});if("edit"===a.kind)return(0,d.jsxs)("div",{className:"my-2.5 ml-9 flex items-center gap-3 rounded-[14px] border border-line bg-panel px-3.5 py-2.5 shadow-card",children:[(0,d.jsx)("span",{className:"flex h-7.5 w-7.5 items-center justify-center rounded-lg bg-chip",children:(0,d.jsx)(bx,{name:"note",className:"h-4 w-4"})}),(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"text-[13.5px] font-semibold",children:a.files}),(0,d.jsx)("div",{className:"text-xs text-dim",children:cb("render.filesChanged")})]})]});if("tmsg"===a.kind){let b=function(a){let b=a.trim();if((b.startsWith('"')&&b.endsWith('"')||b.startsWith("'")&&b.endsWith("'"))&&(b=b.slice(1,-1).trim()),!b.startsWith("{"))return null;try{let a=JSON.parse(b);if(null!==a&&"object"==typeof a&&!Array.isArray(a))return a}catch{}return null}(a.text),c=a.text.length>420||a.text.split("\n").length>6;return(0,d.jsxs)("div",{className:"my-2.5 ml-9 overflow-hidden rounded-[14px] border border-accent/25 bg-[#f8f8fd] shadow-card",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 px-3.5 pt-2",children:[(0,d.jsx)("span",{className:"flex h-6.5 w-6.5 shrink-0 items-center justify-center rounded-lg bg-[#ecebfb] text-accent",children:(0,d.jsx)(bg,{className:"h-3.5 w-3.5","aria-hidden":!0})}),(0,d.jsx)("span",{className:"text-[11px] font-semibold text-dim",children:"out"===a.dir?cb("render.toDir"):cb("render.fromDir")}),(0,d.jsx)("span",{className:"rounded-full bg-accent/10 px-2 py-0.5 text-[11px] font-bold text-accent",children:a.peer}),a.delivery?(0,d.jsxs)("span",{className:`inline-flex shrink-0 items-center gap-1 text-[10.5px] font-semibold ${"ok"===a.delivery?"text-ok":"text-err"}`,title:a.msgId?`msg_id: ${a.msgId}`:void 0,children:["ok"===a.delivery?(0,d.jsx)(a7,{className:"h-3 w-3","aria-hidden":!0}):(0,d.jsx)(n,{className:"h-3 w-3","aria-hidden":!0}),"ok"===a.delivery?cb("render.delivered"):cb("render.notDelivered")]}):null,ac(a.ts)?(0,d.jsx)("span",{className:"ml-auto shrink-0 text-[11px] text-dim",children:ac(a.ts)}):null]}),(0,d.jsx)("div",{className:"px-3.5 pb-2.5 pt-1",children:b?(0,d.jsx)(cS,{payload:b}):(0,d.jsxs)(d.Fragment,{children:[a.summary?(0,d.jsx)("div",{className:"text-[13px] font-bold",children:cB(a.summary)}):null,c?(0,d.jsxs)("details",{className:"group/tmsg mt-0.5 whitespace-pre-wrap break-words text-[13px]",children:[(0,d.jsxs)("summary",{className:"cursor-pointer list-none text-[12.5px] text-[#555] [&::-webkit-details-marker]:hidden",children:[(0,d.jsxs)("span",{className:"group-open/tmsg:hidden",children:[a.text.slice(0,260).trimEnd(),"… ",(0,d.jsx)("span",{className:"font-semibold text-accent",children:cb("common.showAll")})]}),(0,d.jsxs)("span",{className:"hidden items-center gap-1 text-[11px] font-semibold text-dim group-open/tmsg:inline-flex",children:[cb("common.collapse")," ",(0,d.jsx)(a9,{className:"h-3 w-3","aria-hidden":!0})]})]}),cF(a.text)]}):(0,d.jsx)("div",{className:"mt-0.5 whitespace-pre-wrap break-words text-[13px]",children:cF(a.text)})]})})]})}if("tnote"===a.kind)return(0,d.jsxs)("div",{className:"my-1 ml-9 flex items-center gap-1.5 text-[11.5px] text-dim",children:[(0,d.jsx)(bg,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),a.text]});if("think"===a.kind){let b=a.text.length>150;return(0,d.jsxs)("details",{className:"my-1 ml-9 text-[11.5px] italic text-dim",children:[(0,d.jsxs)("summary",{className:`flex list-none items-center gap-1.5 truncate ${b?"cursor-pointer":""}`,title:cb("render.reasoning"),children:[(0,d.jsx)(a6,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),(0,d.jsxs)("span",{className:"truncate",children:[a.text.slice(0,150),b?"…":""]})]}),b?(0,d.jsx)("div",{className:"whitespace-pre-wrap break-words pt-1 not-italic",children:cF(a.text)}):null]})}return"svc"===a.kind?(0,d.jsx)("div",{className:"my-1 break-words text-[11.5px] text-dim",children:a.text}):"note"===a.kind?(0,d.jsx)("div",{className:"my-2 break-words text-[12.5px] text-dim",children:cB(a.text)}):(0,d.jsx)("div",{className:`my-0.5 break-words text-[12.5px] ${a.err?"text-err":"text-[#555]"}`,children:a.text})}),cX=k("pause",[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]]),cY=k("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"}]]);function cZ({file:a}){let{t:b}=v(),c=a.pendingQuestion,[f,g]=(0,e.useState)("pending"),[h,i]=(0,e.useState)(""),[j,k]=(0,e.useState)({}),[l,m]=(0,e.useState)(""),[o,p]=(0,e.useState)(""),[q,r]=(0,e.useState)(!1),s=c?null!==c.paneTarget:null!==a.pid&&"running"===a.proc,t=(0,e.useMemo)(()=>c?.questions?c.questions.map((a,b)=>(j[b]??[]).map(b=>a.options[b]?.label??String(b+1)).join(", ")).filter(Boolean).join(" \xb7 "):"",[j,c]);if(!c){if(!a.waitingInput)return null;let c=a.waitingInput.menu,e="delivering"===f,j=async(d,e)=>{g("delivering"),i("");try{let f=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"dialog-key",path:a.path,key:d,...c?{question:c.question}:{},.../^[1-9]$/.test(d)?{label:e}:{}})}),h=await f.json();if(!f.ok||!h.ok){g("failed"),i(h.error??b("common.failedSend"));return}g("answered"),i(e)}catch{g("failed"),i(b("common.serverUnavailable"))}};return"answered"===f?(0,d.jsx)("div",{id:"question",className:"my-4 rounded-[8px] border border-ok/25 bg-[#eefaf1] px-4 py-3 text-[13px] font-semibold text-ok",children:b("question.sentToPane",{text:h})}):(0,d.jsxs)("div",{id:"question",className:"my-4 rounded-[8px] border border-[#e0ae45]/45 bg-[#fff9ed] p-4 shadow-card",children:[(0,d.jsxs)("div",{className:"mb-2 inline-flex items-center gap-1.5 rounded-full bg-[#f5dfae] px-2 py-0.5 text-[11px] font-bold text-[#8a5a00]",children:[(0,d.jsx)(cX,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",b("question.waiting")]}),(0,d.jsxs)("div",{className:"text-[13px] font-semibold text-ink",children:[b("question.pane",{target:a.waitingInput.target})," \xb7 ",function(a,b){let c=Math.max(0,Math.floor(Date.now()/1e3-b));if(c<60)return a("question.sec",{n:c});let d=Math.floor(c/60);return d<60?a("question.min",{n:d}):a("question.hour",{n:Math.floor(d/60)})}(b,a.waitingInput.since)]}),c?(0,d.jsxs)(d.Fragment,{children:[c.tabs.length?(0,d.jsx)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:c.tabs.map((a,b)=>(0,d.jsxs)("span",{className:`rounded-full px-2 py-0.5 text-[11px] font-bold ${a.done?"bg-ok/15 text-ok":"bg-bg text-dim"}`,children:[a.done?"✓ ":"",a.label]},b))}):null,(0,d.jsx)("div",{className:"mt-2 text-[14px] font-bold text-ink",children:c.question}),(0,d.jsx)("div",{className:"mt-2 space-y-1.5",children:c.options.map(a=>(0,d.jsxs)("button",{className:`flex w-full items-start gap-2 rounded-[8px] border px-3 py-2 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/35 disabled:opacity-60 ${a.recommended?"border-[#e0ae45]/45 bg-[#fff5dc]":"border-line bg-bg"}`,disabled:e||a.value>9,onClick:()=>void j(String(a.value),a.label),children:[(0,d.jsx)("span",{className:"mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded border border-line bg-panel text-[10px] font-bold",children:a.value}),(0,d.jsxs)("span",{className:"min-w-0",children:[(0,d.jsx)("span",{className:"block text-[13px] font-bold",children:a.label}),a.description?(0,d.jsx)("span",{className:"block text-[12px] text-dim",children:a.description}):null]})]},a.value))})]}):(0,d.jsx)("pre",{className:"mt-2 max-h-[240px] overflow-auto whitespace-pre-wrap break-words rounded-[8px] border border-line bg-bg px-3 py-2 text-[12px] text-dim",children:a.waitingInput.screenTail}),(0,d.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[["Tab","Enter","Escape"].map(a=>(0,d.jsx)("button",{className:"rounded-[8px] border border-line bg-bg px-2.5 py-1 text-[12px] font-semibold text-dim disabled:opacity-60",disabled:e,onClick:()=>void j(a,"Escape"===a?"Esc":a),children:"Escape"===a?"Esc":a},a)),(0,d.jsx)("span",{className:"text-[12px] text-dim",children:b("question.keysHint")})]}),"delivering"===f?(0,d.jsxs)("div",{className:"mt-2 inline-flex items-center gap-1.5 text-[12px] font-semibold text-dim",children:[(0,d.jsx)(bv,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0})," ",b("common.sending")]}):null,"failed"===f?(0,d.jsx)("div",{className:"mt-2 text-[12px] font-semibold text-err",children:h}):null]})}let u=async(a,d)=>{g("delivering"),i("");try{let e=await fetch("/api/answer",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({transcriptPath:c.transcriptPath,toolUseId:c.toolUseId,kind:c.kind,...a})}),f=await e.json();if(!e.ok||!f.ok){if(409===e.status&&(f.superseded||f.answer)){g("superseded"),i(f.answer??f.error??b("question.alreadyAnswered"));return}g("failed"),i(f.error??b("common.failedSend"));return}g("answered"),i(f.answer??d)}catch{g("failed"),i(b("common.serverUnavailable"))}},w=(a=j)=>c.questions?.map((b,c)=>a[c]??[])??[],x=c.questions?.length??0,y=x>1||(c.questions?.some(a=>a.multiSelect)??!1),z=c.questions?.every((a,b)=>(j[b]??[]).length>0)??!1,A=async()=>{r(!0),i("");try{let c=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"resume",path:a.path})}),d=await c.json();if(!c.ok||!d.ok)return void i(d.error??b("question.openFailed"));i(b("question.opened",{target:d.target??"tmux"}))}catch{i(b("common.serverUnavailable"))}finally{r(!1)}},B="delivering"===f||!s;return"answered"===f?(0,d.jsx)("div",{id:"question",className:"my-4 rounded-[8px] border border-ok/25 bg-[#eefaf1] px-4 py-3 text-[13px] font-semibold text-ok",children:b("question.answered",{text:h||t})}):"superseded"===f?(0,d.jsx)("div",{id:"question",className:"my-4 rounded-[8px] border border-line bg-chip px-4 py-3 text-[13px] font-semibold text-dim",children:b("question.answeredElsewhere",{text:h})}):c&&!s?(0,d.jsxs)("div",{id:"question",className:"my-4 rounded-[8px] border border-[#e0ae45]/45 bg-[#fff9ed] p-4 shadow-card",children:[(0,d.jsxs)("div",{className:"mb-2 inline-flex items-center gap-1.5 rounded-full bg-[#f5dfae] px-2 py-0.5 text-[11px] font-bold text-[#8a5a00]",children:[(0,d.jsx)(cX,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",b("question.waiting")]}),(0,d.jsx)("div",{className:"text-[13px] font-semibold text-err",children:b("question.noPane")}),"plan"===c.kind?(0,d.jsx)("pre",{className:"mt-2 max-h-[320px] overflow-auto whitespace-pre-wrap break-words rounded-[8px] border border-line bg-bg px-3 py-2 text-[13px]",children:c.plan}):c.questions?.map((a,b)=>(0,d.jsxs)("div",{className:"mt-2",children:[(0,d.jsx)("div",{className:"text-[12px] font-bold text-dim",children:a.header}),(0,d.jsx)("div",{className:"text-[13px] font-semibold text-ink",children:a.question})]},b)),(0,d.jsx)("button",{className:"mt-3 rounded-[8px] bg-accent px-3 py-1.5 text-[13px] font-bold text-white disabled:opacity-60",disabled:q,onClick:A,children:b("question.openSession")}),h?(0,d.jsx)("div",{className:"mt-2 text-[12px] font-semibold text-dim",children:h}):null]}):(0,d.jsxs)("div",{id:"question",className:"my-4 rounded-[8px] border border-[#e0ae45]/45 bg-[#fff9ed] p-4 shadow-card",children:[(0,d.jsxs)("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[(0,d.jsxs)("span",{className:"inline-flex items-center gap-1.5 rounded-full bg-[#f5dfae] px-2 py-0.5 text-[11px] font-bold text-[#8a5a00]",children:[(0,d.jsx)(cX,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",b("question.waiting")]}),s?null:(0,d.jsx)("span",{className:"text-[12px] font-semibold text-err",children:b("question.noPane")})]}),"plan"===c.kind?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("pre",{className:"max-h-[420px] overflow-auto whitespace-pre-wrap break-words rounded-[8px] border border-line bg-bg px-3 py-2 text-[13px]",children:c.plan}),(0,d.jsx)("textarea",{className:"mt-3 min-h-20 w-full resize-y rounded-[8px] border border-line bg-bg px-3 py-2 text-[13px] outline-none focus-visible:ring-2 focus-visible:ring-accent/35",placeholder:b("question.rejectComment"),value:o,onChange:a=>p(a.target.value)}),(0,d.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2",children:[(0,d.jsxs)("button",{className:"inline-flex items-center gap-1.5 rounded-[8px] bg-ok px-3 py-1.5 text-[13px] font-bold text-white disabled:opacity-60",disabled:B,onClick:()=>u({approve:!0},b("question.approved")),children:[(0,d.jsx)(a7,{className:"h-4 w-4","aria-hidden":!0})," ",b("question.approve")]}),(0,d.jsxs)("button",{className:"inline-flex items-center gap-1.5 rounded-[8px] bg-err px-3 py-1.5 text-[13px] font-bold text-white disabled:opacity-60",disabled:B,onClick:()=>u({approve:!1,text:o},b("question.rejected")),children:[(0,d.jsx)(n,{className:"h-4 w-4","aria-hidden":!0})," ",b("question.reject")]})]})]}):(0,d.jsxs)(d.Fragment,{children:[c.questions?.map((a,b)=>(0,d.jsxs)("section",{className:"mt-3 first:mt-0",children:[(0,d.jsx)("div",{className:"mb-1 inline-flex rounded-full bg-bg px-2 py-0.5 text-[11px] font-bold text-dim",children:a.header}),(0,d.jsx)("div",{className:"mb-2 text-[14px] font-bold text-ink",children:a.question}),(0,d.jsx)("div",{className:"space-y-1.5",children:a.options.map((c,e)=>{let f=(j[b]??[]).includes(e);return(0,d.jsxs)("button",{className:`flex w-full items-start gap-2 rounded-[8px] border px-3 py-2 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/35 ${f?"border-accent/45 bg-accent/10":c.recommended?"border-[#e0ae45]/45 bg-[#fff5dc]":"border-line bg-bg"}`,disabled:B,onClick:()=>{var d;let f={...j,[b]:[e]};d=a.multiSelect,k(a=>{let c=a[b]??[],f=d?c.includes(e)?c.filter(a=>a!==e):[...c,e]:[e];return{...a,[b]:f}}),a.multiSelect||1!==x||u({answers:w(f)},c.label)},children:[(0,d.jsx)("span",{className:"mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded border border-line bg-panel text-[10px] font-bold",children:f?"✓":e+1}),(0,d.jsxs)("span",{className:"min-w-0",children:[(0,d.jsx)("span",{className:"block text-[13px] font-bold",children:c.label}),c.description?(0,d.jsx)("span",{className:"block text-[12px] text-dim",children:c.description}):null]})]},e)})})]},b)),x<=1?(0,d.jsxs)("div",{className:"mt-3 flex gap-2",children:[(0,d.jsx)("input",{className:"min-w-0 flex-1 rounded-[8px] border border-line bg-bg px-3 py-1.5 text-[13px] outline-none focus-visible:ring-2 focus-visible:ring-accent/35",placeholder:b("question.ownAnswer"),value:l,onChange:a=>m(a.target.value)}),(0,d.jsxs)("button",{className:"inline-flex items-center gap-1.5 rounded-[8px] bg-accent px-3 py-1.5 text-[13px] font-bold text-white disabled:opacity-60",disabled:B||!l.trim(),onClick:()=>u({text:l},l),children:[(0,d.jsx)(cY,{className:"h-4 w-4","aria-hidden":!0})," ",b("common.send")]})]}):null,y?(0,d.jsxs)("button",{className:"mt-3 inline-flex items-center gap-1.5 rounded-[8px] bg-accent px-3 py-1.5 text-[13px] font-bold text-white disabled:opacity-60",disabled:B||!z,onClick:()=>u({answers:w()},t),children:[(0,d.jsx)(cY,{className:"h-4 w-4","aria-hidden":!0})," ",b("common.send")]}):null]}),"delivering"===f?(0,d.jsxs)("div",{className:"mt-3 inline-flex items-center gap-1.5 text-[12px] font-semibold text-dim",children:[(0,d.jsx)(bv,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0})," ",b("common.sending")]}):null,"failed"===f?(0,d.jsx)("div",{className:"mt-3 text-[12px] font-semibold text-err",children:h}):null]})}function c$({file:a}){let{t:b}=v();return"running"===a.proc?(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 whitespace-nowrap rounded-full bg-[#e5f6ea] px-2 py-0.5 text-[11px] font-bold tabular-nums text-ok",children:[(0,d.jsx)(bj,{className:"h-3 w-3","aria-hidden":!0})," PID ",a.pid]}):"killed"===a.proc||"stalled"===a.activity?(0,d.jsx)("span",{className:"inline-flex items-center gap-1 rounded-full bg-[#f7e8e8] px-2 py-0.5 text-[11px] font-bold text-err",children:b("task.interruptedBadge")}):"done"===a.proc?(0,d.jsx)("span",{className:"inline-flex items-center gap-1 rounded-full bg-chip px-2 py-0.5 text-[11px] font-bold text-dim",children:b("task.finishedBadge")}):null}function c_({file:a,compact:b=!1,hideChip:c=!1}){let{t:f}=v(),[g,h]=(0,e.useState)(!1),[i,j]=(0,e.useState)(!1),[k,l]=(0,e.useState)(""),[m,n]=(0,e.useState)(!1),o=(0,d.jsx)(c$,{file:a}),p=async()=>{j(!0),l("");try{let b=await fetch("/api/proc",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:a.path,force:m})}),c=await b.json();if(!b.ok||!c.ok){l(c.error??f("task.stopFailed")),n(!0);return}l(f("task.signalSent",{signal:m?"SIGKILL":"SIGTERM",pid:c.pid??""})),h(!1)}catch{l(f("common.serverUnavailable")),n(!0)}finally{j(!1)}};return(0,d.jsxs)("span",{className:`inline-flex min-w-0 flex-wrap items-center gap-1.5 ${b?"text-[10.5px]":"text-xs"}`,children:[c?null:o,"running"===a.proc?g?(0,d.jsxs)("span",{className:"inline-flex max-w-full items-center gap-1 rounded-[10px] border border-err/30 bg-[#fff5f5] px-1.5 py-0.5",children:[b?null:(0,d.jsx)("span",{className:"truncate px-1 text-[11px] font-semibold text-err",children:f("task.confirmKill",{pid:a.pid??""})}),(0,d.jsx)("button",{className:"whitespace-nowrap rounded-lg bg-err px-2 py-0.5 text-[11px] font-bold tabular-nums text-white disabled:opacity-60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-err/50",disabled:i,onClick:p,children:m?"SIGKILL":b?f("task.killPid",{pid:a.pid??""}):f("task.confirmKillYes")}),(0,d.jsx)("button",{className:"whitespace-nowrap rounded-lg border border-line bg-panel px-2 py-0.5 text-[11px] font-semibold text-dim focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>h(!1),children:b?f("common.no"):f("common.cancel")})]}):(0,d.jsx)("button",{className:"whitespace-nowrap rounded-full border border-line bg-panel px-2 py-0.5 text-[11px] font-semibold text-dim hover:border-err/40 hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":f("task.stopAria",{pid:a.pid??""}),onClick:()=>h(!0),children:f("task.kill")}):null,k?(0,d.jsx)("span",{className:"max-w-[220px] truncate text-[11px] font-semibold text-dim",children:k}):null]})}function c0({file:a}){let{t:b}=v();return"claude-tasks"!==a.root?null:(0,d.jsxs)("div",{className:"mb-4 mt-1 rounded-[14px] border border-line bg-panel px-4 py-3 shadow-card",children:[(0,d.jsx)("div",{className:"mb-2 flex flex-wrap items-center gap-2",children:(0,d.jsx)(c$,{file:a})}),a.cmd?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"mb-1 text-[13.5px] font-semibold",children:a.cmdDesc||b("task.backgroundCommand")}),(0,d.jsxs)("code",{className:"block whitespace-pre-wrap break-words rounded-lg border border-line bg-[#fafafc] px-2.5 py-2 font-mono text-[12.5px]",children:["$ ",a.cmd]})]}):(0,d.jsx)("div",{className:"text-[13.5px] text-dim",children:b("task.commandNotFound")})]})}let c1={items:[],hiddenServiceCount:0},c2=new Map;function c3(a,b,c){c2.size>300&&!c2.has(a)&&c2.clear(),c2.set(a,{magnet:b,fromBottom:c})}function c4({icon:a,label:b}){return(0,d.jsxs)("div",{className:"mt-2 flex items-center gap-2 text-[12px] font-semibold text-ok",children:[(0,d.jsxs)("span",{className:"flex items-center gap-0.5","aria-hidden":!0,children:[(0,d.jsx)("span",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-ok"}),(0,d.jsx)("span",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-ok [animation-delay:150ms]"}),(0,d.jsx)("span",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-ok [animation-delay:300ms]"})]}),(0,d.jsx)(a,{className:"h-3.5 w-3.5","aria-hidden":!0}),b]})}function c5({file:a,showSvc:b,lineFilter:c,onStatus:f,paused:g,follow:h,setFollow:i,compact:j=!1}){let{locale:k,t:l}=v(),[m,n]=(0,e.useState)(()=>a?c2.get(a.path)?.magnet??h:h),o=function(a,b=!1,c=2500){(0,e.useRef)(c);let[d,f]=(0,e.useState)({lines:[],start:0}),[g,h]=(0,e.useState)(0),[i,j]=(0,e.useState)(!1),[k,l]=(0,e.useState)(null),[m,n]=(0,e.useState)(null),[o,p]=(0,e.useState)(!1),[q,r]=(0,e.useState)(!1),[s,t]=(0,e.useState)(!1),[u,v]=(0,e.useState)(0),w=(0,e.useRef)(0),x=(0,e.useRef)(0),y=(0,e.useRef)(""),z=(0,e.useRef)(!0),A=(0,e.useRef)(0),B=(0,e.useRef)(!1),C=(0,e.useCallback)(()=>{f({lines:[],start:0}),w.current=0,x.current=0,y.current="",z.current=!0,r(!1)},[]),D=(0,e.useCallback)(async()=>{if(!a||B.current||x.current<=0)return 0;B.current=!0,t(!0);let b=A.current;try{let c="",d=x.current;for(let e=0;e<4;e+=1){let e=await fetch(`/api/log?path=${encodeURIComponent(a.path)}&before=${d}`),f=await e.json();if(b!==A.current||"error"in f&&f.error)return 0;if(c=f.data+c,d=f.start,0===d||c.slice(0,-1).includes("\n"))break}let e=d;if(d>0){let a,b=c.indexOf("\n");if(b<0||b===c.length-1)return 0;e=d+(a=c.slice(0,b+1),new TextEncoder().encode(a).length),c=c.slice(b+1)}let g=c.split("\n");""===g.at(-1)&&g.pop();let h=g.map(a=>a.trim()).filter(Boolean);return x.current=e,r(e>0),h.length&&(f(a=>({lines:h.concat(a.lines),start:a.start-h.length})),v(a=>a+1)),h.length}catch{return 0}finally{B.current=!1,t(!1)}},[a?.path]);return{lines:d.lines,linesStart:d.start,size:g,loading:i,error:k,tickTime:m,paused:o,setPaused:p,clear:C,hasMore:q,loadingOlder:s,loadOlder:D,prependGen:u}}(a,g,m?j?2500:6e3:0),p=(0,e.useRef)(null),q=(0,e.useRef)(null),r=(0,e.useRef)(null),s=j?500:1500,[t,u]=(0,e.useState)(j?300:1500),[w,x]=(0,e.useState)(0),[y,z]=(0,e.useState)(!1),[A,C]=(0,e.useState)(null);(0,e.useRef)(!1);let D=(0,e.useRef)(m);(0,e.useRef)(0),(0,e.useRef)(0);let E=(0,e.useRef)(null),F=(0,e.useRef)(0);(0,e.useRef)(null);let G=(b,c=!1)=>{D.current=b,n(b),i(b),b&&x(0),a&&c3(a.path,b,c2.get(a.path)?.fromBottom??0),c&&(z(!0),E.current&&window.clearTimeout(E.current),E.current=window.setTimeout(()=>z(!1),450))},H=()=>{let a=p.current;a&&(F.current=Date.now(),a.scrollTop=a.scrollHeight)},I=c.toLowerCase(),J=(0,e.useMemo)(()=>a?function(a){let{showSvc:b,lineFilter:c}=a,d="claude"===a.fmt||"codex"===a.fmt,e=[],f=new Map,g=new Map,h=new Map,i=new Map,j=0,k=0,l=0,m=null,n=-1/0,o=null,p=null,q=null,r=null,s=null,t=new Map,u=null,v=null,w=a=>e.length?a-e[0].seq:-1,x=a=>(e.push({seq:k,src:l,item:a}),u=null,k++),y=a=>!!(!(a.length<=2e4)&&(a.match(/\s/g)?.length??0)/a.length<.02)&&(x({kind:"blob",bytes:a.length,text:b7(a).slice(0,2e5)}),!0),z=(a,b)=>{let c=cl(a.source),d=ck(c.data)||ck(b.base64);if(!d)return;let e=ck(c.media_type)||ck(b.type),f=e.startsWith("image/")?e:"image/png",g=cl(b.dimensions);x({kind:"image",media:f,data:d,w:cd(g.originalWidth),h:cd(g.originalHeight),bytes:cd(b.originalSize)})},A=(a,b,c,d=x)=>{cc.lastIndex=0;let e=cc.test(b);if(cc.lastIndex=0,!e){let c=ca(b.trim(),a);return!!c&&(d(c),!0)}let f=!1,g=0,h=b=>{let e=b.trim();if(!e)return;let g=ca(e,a);g?(d(g),f=!0):c(e)};for(let a of b.matchAll(cc)){let c=a[0],e=a.index??0;h(b.slice(g,e)),d(cn(c,a[1]??"",a[2]??"")),f=!0,g=e+c.length}return h(b.slice(g)),f},B=a=>{let b=[];return cc.lastIndex=0,{cleaned:a.replace(cc,(a,c,d)=>(b.push(cn(a,c,d)),"")).trim(),cites:b}},C=(b,c)=>{if(!c.trim()||c===o?.text||(o={text:c,src:l},y(c)))return;let d="codex"===a.engine?"codex":"claude";A(b,c,a=>x({kind:"prose",ts:b,text:a,engine:d}))||x({kind:"prose",ts:b,text:c,engine:d})},D=(a,b,c,d)=>{let e=c||"plain-"+k+"-"+String(a??""),g=function(a,b="shell"){let c=b7(a);return{cmd:c,display:function(a){let b,c=a.match(/^([A-Za-z][\w.]*): /),d=c?c[0]:"",e=d?a.slice(d.length):a;do b=e,e=(e=(e=(e=e.replace(/^export PATH=[^;]+;\s*/,"")).replace(/^cd\s+\S+\s*&&\s*/,"")).replace(/^\/usr\/bin\/zsh -lc\s+/,"")).replace(/^(["'])([\s\S]*)\1$/,(a,b,c)=>RegExp(`(?<!\\\\)${b}`).test(c)?a:c);while(e!==b);let f=e.match(/^([\w./-]+(?:\s+-)?)\s*<<\s*['"]?(\w+)['"]?/);return f&&(e=`${f[1].trim()} \xabheredoc\xbb`),(d+(e=e.replace(/\s+/g," ").trim())).slice(0,160)}(c),icon:b,output:"",status:"run",label:cb("render.executing"),open:!1}}(b,d),h=x({kind:"cmd",id:e,call:g,ts:a}),i={call:g,seq:h};return f.set(e,i),s=i,g},E=(a,b,c)=>{if(!a)return null;let d=b.match(/exited with code (\d+)/)?.[1],f=b.replace(/^Chunk ID:[^\n]*\n/,"").replace(/Wall time:[^\n]*\n/,"").replace(/Original token count:[^\n]*\n?/,"").trim(),g=!0===c||void 0!==d&&"0"!==d,h={...a.call};h.status=g?"err":"ok",h.label=g?d&&"0"!==d?"exit "+d:cb("render.error"):"ok",h.open||=g,f&&(h.output=(h.output+"\n"+b7(f)).trim().slice(-(g?6e4:12e3))),a.call=h;let i=w(a.seq);if(i>=0&&i<e.length){let a=e[i].item;"cmd"===a.kind&&(e[i]={...e[i],item:{...a,call:h}},u=null)}return h},F=(a,c,d)=>{if(!a)return;let h=g.get(a);if(void 0!==h){let a=w(h);if(a>=0&&a<e.length){let b=e[a].item;if("tmsg"===b.kind){let f=d||/"success"\s*:\s*false/.test(c)?"err":"ok",g=c.match(/"msg_id"\s*:\s*"([^"]+)"/)?.[1];e[a]={...e[a],item:{...b,delivery:f,msgId:g}},u=null}}return}!E(f.get(a),c,d)&&c&&b&&x({kind:"svc",text:"output: "+b7(c).slice(0,200)})},G=a=>{b?x({kind:"svc",text:a.slice(0,300)}):(j+=1,i.set(l,(i.get(l)??0)+1),u=null)},H=a=>{x({kind:"note",text:a})},I=(a,b)=>{let c=b.replace(ce,(b,c,d,e)=>{let f=cj(d,"teammate_id")||cj(d,"from")||cb("render.teammate"),g=cj(d,"summary"),h=e.trim();if(h.startsWith("{"))try{let a=JSON.parse(h);if("idle_notification"===a.type){let b=ac(a.timestamp);return x({kind:"tnote",text:cb("render.left",{peer:f,at:b?" \xb7 "+b:""})}),""}}catch{}let{cleaned:i,cites:j}=B(h),k=b1.test(i)?ca(i,a):null;for(let b of(x({kind:"tmsg",ts:a,dir:"in",peer:f,summary:g,text:k?"":i}),k&&x(k),j))x(b);return""}).replace(/Another Claude session sent a message:\s*/g,"").trim();if(!c||y(c))return;if(ch.test(c))return void x({kind:"sysmsg",label:ci(c),text:c});let{cleaned:d,images:e}=cg(c);for(let b of(d&&!A(a,d,b=>x({kind:"user",ts:a,text:b}))&&x({kind:"user",ts:a,text:d}),e))x({kind:"inbox-image",name:b.name,path:b.path})},J=(a,b)=>{if(p&&p.text===b&&p.at===k)return;let{cleaned:c,images:d}=cg(b);for(let b of(c&&x({kind:"user",ts:a,text:c}),d))x({kind:"inbox-image",name:b.name,path:b.path});p={text:b,at:k,src:l}},K=(a,b)=>{p&&p.text===a&&p.at===k||(x({kind:"sysmsg",label:ci(a,b),text:a}),p={text:a,at:k,src:l})},L=(a,b)=>{x({kind:"compact",ts:a,trigger:b?.trigger,preTokens:b?.preTokens})},M=a=>b=>{for(let c of b.split("\n"))c.trim()&&a({kind:"raw",text:b7(c),err:/error|failed|traceback|exception/i.test(c)})},N=a=>{let b=a.replace(/\x1b\][^\x07]*(\x07|\x1b\\)/g,"").replace(/\x1b\[[0-9;?]*[A-Za-z]/g,"");if(r)if(/^\[codex\]/.test(b))(()=>{if(!r)return;let a=r.lines.join("\n").trim();if(r=null,!a)return;let b=M(x);A(null,a,b)||b(a)})();else{r.lines.push(b),u=null;return}if(/Assistant message$/.test(b))return;let c=b.match(/^\[([^\]]+)\]\s*(.*)$/),d=c?.[1]??null,e=c?.[2]??b;if(!(!e||/^Assistant message captured/.test(e))){if(!c&&(b1.test(b)||b.startsWith("<oai-mem-citation>"))){r={lines:[b],src:l},u=null;return}if(/^Running command: /.test(e))return void D(d,e.replace(/^Running command: /,"").replace(/^\/usr\/bin\/zsh -lc /,""));if(/^Command (completed|failed)/.test(e)){s&&E(s,/^Command failed/.test(e)?e+"\n"+cb("render.jobLogNote"):e,/^Command failed/.test(e));return}return/^Applying \d+ file/.test(e)?void x({kind:"edit",files:e}):c&&!/^(Running|Command|Applying)/.test(e)?C(d,e):void(!y(b)&&x({kind:"raw",text:b7(b),err:/error|failed|traceback|exception/i.test(b)}))}},O=b=>{if(!c||b.toLowerCase().includes(c))if(d)try{let c=JSON.parse(b);c&&"object"==typeof c&&!Array.isArray(c)&&("claude"===a.fmt?(a=>{let b=a.timestamp;if("user"===a.type&&a.message){let c=cl(a.message).content,d=cl(cl(a.toolUseResult).file);if(!0===a.isCompactSummary){let a="string"==typeof c?c:cm(c).filter(a=>"text"===a.type).map(a=>ck(a.text)).join(" ");a.trim()&&((a,b)=>{for(let a=e.length-1;a>=0;a-=1){let c=e[a].item;if("compact"===c.kind){e[a]={...e[a],item:{...c,summary:b}},u=null;return}if("svc"!==c.kind&&"note"!==c.kind)break}x({kind:"compact",ts:a,summary:b})})(b,a.trim());return}if("string"==typeof c)I(b,c);else for(let a of cm(c))if("text"===a.type)I(b,ck(a.text));else if("image"===a.type)z(a,d);else if("tool_result"===a.type){let b=cm(a.content);for(let a of b)"image"===a.type&&z(a,d);let c="string"==typeof a.content?a.content:b.filter(a=>"image"!==a.type).map(a=>ck(a.text)).join(" ");F(ck(a.tool_use_id),c,!0===a.is_error)}return}if("assistant"===a.type&&a.message){for(let c of cm(cl(a.message).content))if("text"===c.type&&ck(c.text).trim())C(b,ck(c.text));else if("thinking"===c.type&&ck(c.thinking).trim())x({kind:"think",text:ck(c.thinking).replace(/\s+/g," ").trim()});else if("tool_use"===c.type&&"SendMessage"===ck(c.name)){let a=cl(c.input),d=a.message;if("string"==typeof d){let{cleaned:e,cites:f}=B(d),i=b1.test(e)?ca(e,b):null,j=x({kind:"tmsg",ts:b,dir:"out",peer:String(a.to??""),summary:String(a.summary??""),text:i?"":e});for(let a of(i&&x(i),f))x(a);let k=ck(c.id);k&&(g.set(k,j),h.set(j,k))}else G(`SendMessage → ${String(a.to??"")} \xb7 ${ck(cl(d).type)||cb("render.protocol")}`)}else if("tool_use"===c.type){let a=cl(c.input),d=String(a.command??a.file_path??a.prompt??JSON.stringify(a));D(b,ck(c.name)+": "+d.slice(0,160),ck(c.id),"tool")}return}if("system"===a.type&&"compact_boundary"===a.subtype){let c=cl(a.compactMetadata);return L(b,{trigger:ck(c.trigger)||void 0,preTokens:cd(c.preTokens)})}G(ck(a.type)||cb("render.record"))})(c):(a=>{let b=cl(a.payload),c=a.timestamp;if("session_meta"===a.type)return H(`${cb("render.codexSessionCreated")} \xb7 ${ck(b.model)} \xb7 ${ck(b.cwd)}`);if("event_msg"===a.type){if("agent_message"===b.type&&b.message)return C(c,ck(b.message));if("user_message"===b.type&&b.message){let a=ck(b.message);return ch.test(a)?K(a):J(c,a)}return"task_started"===b.type?H(cb("render.taskStarted")+(c?" \xb7 "+ac(c):"")):"task_complete"===b.type?H(cb("render.taskComplete")+(c?" \xb7 "+ac(c):"")):"context_compacted"===b.type?q?q=null:L(c):G(ck(b.type)||"event")}if("response_item"===a.type){if("message"===b.type){let a=cm(b.content).map(a=>ck(a.text)||ck(a.input_text)).join(" ").trim();return a?"assistant"===b.role?C(c,a):"user"!==b.role||ch.test(a)?K(a,ck(b.role)):J(c,a):G("message "+ck(b.role))}if("function_call"===b.type){let a={};try{a=JSON.parse(ck(b.arguments)||"{}")}catch{a={}}let d=ck(b.name);if("exec_command"===d||"shell"===d)return D(c,String(a.cmd??a.command??"").replace(/^\/usr\/bin\/zsh -lc /,""),ck(b.call_id));if("apply_patch"===d){let b=String(a.input??"").match(/(Add|Update|Delete) File: [^\n]+/g);x({kind:"edit",files:b?b.join(", ").replace(/(Add|Update|Delete) File: /g,""):cb("render.patch")});return}return"write_stdin"===d?G(cb("render.stdinSession",{id:String(a.session_id??"")})):D(c,d+" "+JSON.stringify(a).slice(0,120),ck(b.call_id),"tool")}if("function_call_output"===b.type)return F(ck(b.call_id),"string"==typeof b.output?b.output:JSON.stringify(b.output??""));if("custom_tool_call"===b.type&&"apply_patch"===ck(b.name)){let a=ck(b.input).match(/(Add|Update|Delete) File: [^\n]+/g);x({kind:"edit",files:a?a.join(", ").replace(/(Add|Update|Delete) File: /g,""):cb("render.patch")});return}return"custom_tool_call_output"===b.type?F(ck(b.call_id),"string"==typeof b.output?b.output:JSON.stringify(b.output??"")):"reasoning"===b.type?G("reasoning"):G(ck(b.type)||"item")}if("compacted"===a.type)return q={src:l},L(c);G(ck(a.type)||cb("render.record"))})(c))}catch{N(b)}else N(b)},P=()=>{e.length=0,f.clear(),g.clear(),h.clear(),i.clear(),j=0,o=null,p=null,q=null,r=null,s=null,t=new Map,u=null};return{feed:(a,b,c)=>{let d=b+a.length;(null===m||d<m||b>m||b<n)&&(P(),m=b),n=b,(a=>{for(;e.length&&e[0].src<a;){let a=e.shift();if(u=null,"cmd"===a.item.kind){let b=f.get(a.item.id);b&&b.seq===a.seq&&f.delete(a.item.id)}let b=h.get(a.seq);void 0!==b&&(h.delete(a.seq),g.get(b)===a.seq&&g.delete(b))}for(let[b,c]of i){if(b>=a)break;j-=c,i.delete(b),u=null}return o&&o.src<a&&(o=null),p&&p.src<a&&(p=null),q&&q.src<a&&(q=null),s&&0>w(s.seq)&&(s=null),null!==r&&r.src<a})(b)&&(P(),m=b);for(let c=m-b;c<a.length;c+=1)l=b+c,O(a[c]);return m=d,u&&v===c||(u=(a=>{let b=[],c=new Map,d=0;for(;d<e.length;){let g=e[d];if("cmd"!==g.item.kind){b.push({key:String(g.seq),item:g.item}),d+=1;continue}let h=d,i=[];for(;h<e.length;){let a=e[h];if("cmd"===a.item.kind)i.push({seq:a.seq,item:a.item});else if("think"!==a.item.kind)break;h+=1}let j=h===e.length;if(i.length>=4&&!(a&&j)){let a,e=i[0].seq,g=t.get(e);if(g&&g.calls.length===i.length&&i.every((a,b)=>g.calls[b]===a.item.call))a=g;else{let b={},c=0,d=0;for(let a of i){var f;let e=(f=a.item.call.cmd,f.match(/^([A-Za-z][\w.]*): /)?.[1]??"cmd");b[e]=(b[e]??0)+1,"ok"===a.item.call.status?c+=1:"err"===a.item.call.status&&(d+=1)}a={kind:"cmd-group",ids:i.map(a=>a.item.id),calls:i.map(a=>a.item.call),t0:i[0]?.item.ts,t1:i.at(-1)?.item.ts,byTool:b,okCount:c,errCount:d,hasErr:d>0}}c.set(e,a),b.push({key:"g"+e,item:a}),d=h}else b.push({key:String(g.seq),item:g.item}),d+=1}return t=c,(()=>{if(!r)return[];let a=r.lines.join("\n").trim();if(!a)return[];let b=[],c=a=>b.push(a),d=M(c);return A(null,a,d,c)||d(a),b})().forEach((a,c)=>b.push({key:"pb"+c,item:a})),{items:b,hiddenServiceCount:j}})(c),v=c),u}}}({engine:a.engine,fmt:a.fmt,showSvc:b,lineFilter:I}):null,[a?.path,a?.engine,a?.fmt,b,I,k]),K=(0,e.useMemo)(()=>a&&J?J.feed(o.lines,o.linesStart,"live"===a.activity):c1,[J,a?.activity,o.lines,o.linesStart]),L=Math.max(0,K.items.length-t),M=L?K.items.slice(-t):K.items,N=()=>{let a=p.current;a&&(r.current={top:a.scrollTop,height:a.scrollHeight}),L?u(a=>a+s):o.hasMore&&o.loadOlder().then(()=>u(a=>a+s))},O=L>0||o.hasMore,P=K.items.at(-1)?.item,Q=P?.kind==="cmd"&&"run"===P.call.status?{icon:bo,label:l("feed.running",{tool:P.call.cmd.split(/[\s:]/,1)[0]||l("feed.tool")})}:P?.kind==="think"?{icon:bk,label:l("feed.thinking")}:{icon:bk,label:l("feed.working")},R=j?"left-1/2 -translate-x-1/2":"right-3";return(0,d.jsxs)("div",{className:"relative flex min-h-0 flex-1 flex-col",children:[a&&K.items.length?m?"live"===a.activity?(0,d.jsxs)("div",{className:`pointer-events-none absolute bottom-2 ${R} z-10 inline-flex items-center gap-1 rounded-full bg-ok px-2 py-0.5 text-[10px] font-bold text-white shadow-card transition-transform duration-200 ${y?"scale-125":"scale-100"}`,children:[(0,d.jsx)(b0,{className:"h-3 w-3","aria-hidden":!0})," ",l("feed.liveTail")]}):null:(0,d.jsxs)("button",{className:`absolute bottom-2 ${R} z-10 inline-flex items-center gap-1 whitespace-nowrap rounded-full border border-line bg-panel px-2.5 py-1 text-[11px] font-semibold text-ink shadow-card hover:border-accent/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":l("feed.backToLive"),onClick:()=>{H(),G(!0,!0)},children:[(0,d.jsx)(a2,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",w?l("feed.newCount",{count:w}):l("feed.down")]}):null,(0,d.jsx)("div",{ref:p,className:j?"min-h-0 flex-1 overflow-y-auto py-3":"min-h-0 flex-1 overflow-y-auto py-6",onScroll:b=>{let c=b.currentTarget,d=c.scrollTop+c.clientHeight>=c.scrollHeight-50,e=Date.now()-F.current<300;d&&!D.current?G(!0,!0):!d&&D.current&&(e?H():G(!1)),a&&!e&&c3(a.path,D.current,Math.max(0,c.scrollHeight-c.clientHeight-c.scrollTop)),c.scrollTop<120&&O&&!o.loadingOlder&&!o.loading&&N()},children:(0,d.jsx)("div",{ref:q,className:j?"px-3 pb-4 text-[13px]":"mx-auto w-full max-w-[1060px] px-6 pb-16",children:a?(0,d.jsxs)(d.Fragment,{children:[j&&O?(0,d.jsx)("button",{className:"mb-2 flex w-full items-center justify-center gap-1.5 rounded-[8px] border border-dashed border-line bg-bg px-2 py-1 text-[11px] font-semibold text-dim hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",disabled:o.loadingOlder,onClick:N,children:o.loadingOlder?l("common.loading"):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(a9,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",l("feed.showEarlier")]})}):null,!j&&O&&K.items.length?(0,d.jsx)("button",{className:"mb-3 flex w-full items-center justify-center gap-1.5 rounded-[10px] border border-dashed border-line bg-panel px-3 py-1.5 text-[12px] font-semibold text-dim hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",disabled:o.loadingOlder,onClick:N,children:o.loadingOlder?l("common.loading"):L?l("feed.showEarlierHidden",{count:L}):l("feed.loadEarlier")}):null,j||O||!K.items.length?null:(0,d.jsx)("div",{className:"mb-3 text-center text-[11px] text-dim",children:l("feed.startOfConvo")}),j?null:(0,d.jsx)(c0,{file:a}),K.items.length?(0,d.jsxs)(d.Fragment,{children:[M.map(({key:a,item:b})=>j?(0,d.jsx)("div",{className:"feed-cv",children:(0,d.jsx)(cW,{item:b})},a):(0,d.jsx)(cW,{item:b},a)),a.pendingQuestion||a.waitingInput?(0,d.jsx)(cZ,{file:a},a.pendingQuestion?.toolUseId??"waiting"):null,a.pendingQuestion||a.waitingInput||!A?null:(0,d.jsx)("div",{className:"my-4 rounded-[8px] border border-line bg-chip px-4 py-3 text-[13px] font-semibold text-dim",children:A}),"live"===a.activity?(0,d.jsx)(c4,{icon:Q.icon,label:Q.label}):null,"recent"===a.activity&&at(a)?(0,d.jsxs)("div",{className:"mt-2 flex items-center gap-1.5 text-[11.5px] font-semibold text-[#b8860b]",children:[(0,d.jsx)("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-[#d29a2f]","aria-hidden":!0})," ",l("feed.finishedTurn")]}):"recent"===a.activity&&B(a)&&"running"!==a.proc?(0,d.jsxs)("div",{className:"mt-2 flex items-center gap-1 text-[11.5px] font-semibold text-accent",children:[(0,d.jsx)(a_,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",l("feed.returnedResult")]}):null]}):(0,d.jsxs)("div",{className:"mt-[14vh] text-center text-dim",children:[o.loading?l("common.loadingCap"):0===o.size?l("feed.noOutput"):K.hiddenServiceCount?l("feed.onlyService",{count:K.hiddenServiceCount}):l("feed.empty"),!o.loading&&(a.cmdDesc||a.cmd)?(0,d.jsxs)("div",{className:"mx-auto mt-3 max-w-[560px]",children:[a.cmdDesc?(0,d.jsx)("div",{className:"text-[12.5px] font-semibold text-ink",children:a.cmdDesc}):null,a.cmd?(0,d.jsx)("pre",{className:"mt-1.5 overflow-x-auto whitespace-pre-wrap break-words rounded-[10px] border border-line bg-bg px-3 py-2 text-left font-mono text-[11.5px] text-ink",children:a.cmd}):null]}):null]}),K.items.length?null:a.pendingQuestion||a.waitingInput?(0,d.jsx)(cZ,{file:a},a.pendingQuestion?.toolUseId??"waiting"):null]}):(0,d.jsx)("div",{className:"mt-[20vh] text-center text-dim",children:l("feed.pickLog")})})})]})}let c6=()=>"uk"===r()?"uk-UA":"en-US",c7={completed:"✓",in_progress:"▸",pending:"○"};function c8({plan:a}){let b,{t:c}=v(),e=a.total?Math.round(a.done/a.total*100):0;return(0,d.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-full bg-[#f1f0fc] px-1.5 py-0.5 font-mono text-[9.5px] font-semibold text-accent",title:(b=a.steps.map(a=>`${c7[a.status]} ${a.text}`),[u(r(),"plan.agentPlan"),...b].join("\n")),"aria-label":c("plan.stepsAria",{done:a.done,total:a.total})+(a.current?c("plan.nowSuffix",{current:a.current}):""),children:[a.done,"/",a.total,(0,d.jsx)("span",{className:"h-1 w-6 overflow-hidden rounded-full bg-accent/20","aria-hidden":!0,children:(0,d.jsx)("span",{className:"block h-full rounded-full bg-accent",style:{width:`${e}%`}})})]})}let c9={active:{labelKey:"plan.goal",className:"bg-[#f1f0fc] text-accent"},complete:{labelKey:"plan.goalDone",className:"bg-[#e7f4ea] text-ok"},blocked:{labelKey:"plan.goalBlocked",className:"bg-[#fbeaea] text-err"}};function da({ctx:a}){var b;let{t:c}=v();return(0,d.jsxs)("span",{className:`inline-flex shrink-0 items-center rounded-full px-1.5 py-0.5 font-mono text-[9.5px] font-semibold ${(b=a.pct)>=90?"bg-[#fbeaea] text-err":b>=70?"bg-[#fff7e6] text-[#b07d18]":"bg-chip text-dim"}`,title:c("plan.ctxTitle",{pct:a.pct,used:a.usedTokens.toLocaleString(c6()),window:a.windowTokens.toLocaleString(c6())}),"aria-label":c("plan.ctxAria",{pct:a.pct}),children:["ctx ",a.pct,"%"]})}function db({goal:a}){let b,c,{t:e}=v(),f=c9[a.status];return(0,d.jsx)("span",{className:`inline-flex shrink-0 items-center rounded-full px-1.5 py-0.5 text-[9.5px] font-semibold ${f.className}`,title:(b=r(),c=[a.objective??u(b,"plan.noObjective")],null!==a.tokensUsed&&c.push(u(b,"plan.tokens",{n:a.tokensUsed.toLocaleString(c6())})),null!==a.timeUsedSeconds&&c.push(u(b,"plan.time",{n:Math.round(a.timeUsedSeconds/60)})),c.join("\n")),"aria-label":e("plan.goalAria",{status:e(f.labelKey)})+(a.objective?` — ${a.objective.slice(0,120)}`:""),children:e(f.labelKey)})}let dc=()=>void 0,dd={live:{section:"border-ok/60 shadow-[0_0_0_3px_rgba(47,158,68,0.16)]",header:"bg-[#eef8f0]"},waiting:{section:"border-[#e0ae45]/60 shadow-[0_0_0_3px_rgba(224,174,69,0.2)]",header:"bg-[#fff7e6]",glow:"#e0ae45"},returned:{section:"border-accent/50 shadow-[0_0_0_3px_rgba(90,81,224,0.15)]",header:"bg-[#f1f0fc]",glow:"#7a6ff0"},stalled:{section:"border-err/50 shadow-[0_0_0_3px_rgba(198,40,40,0.13)]",header:"bg-[#fdf0f0]",glow:"#d76a6a"},done:{section:"border-line",header:"bg-[#f4f4f6] text-dim opacity-80 saturate-50"}};function de(a,b){return"session"===b?a("kind.session"):"subagent"===b?a("kind.subagent"):"job"===b?a("kind.job"):"background"===b?a("kind.background"):b}function df({file:a}){let{t:b}=v(),[c,f]=(0,e.useState)(()=>Date.now()),g=c/1e3-a.mtime,h=("live"===a.activity||"recent"===a.activity)&&g>180;return(0,d.jsx)("span",{className:`shrink-0 font-mono text-[9.5px] tabular-nums ${h?"font-semibold text-[#b3831d]":"text-dim"}`,title:b(h?"branch.lastActivityQuiet":"branch.lastActivity",{age:ab(a.mtime)}),children:ab(a.mtime)})}function dg({file:a,tasks:b,isRoot:c,onClose:f,dragHandle:g,noComposer:h,banner:i,onToggleExpand:j,expanded:k,dormant:l}){let{t:m}=v(),o=aS(),p=(0,e.useRef)(null),q=ar(a),r=ax(a),s=dd[r],[t,u]=(0,e.useState)(()=>"u">typeof IntersectionObserver),x=!!l||t;return(0,d.jsx)("div",{className:`relative flex min-h-0 min-w-0 flex-1 ${s.glow?"pane-attention":""}`,style:s.glow?{"--pane-glow":s.glow}:void 0,children:(0,d.jsxs)("section",{ref:p,"data-pan-ignore":!0,"data-link-path":a.path,className:`relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden rounded-[10px] border bg-panel shadow-card ${s.section}`,children:[(0,d.jsx)("span",{"aria-hidden":!0,className:`w-full shrink-0 ${c?"h-1":"h-0.5"}`,style:"done"===r?{backgroundColor:"#c9c9d1"}:ap(a)}),(0,d.jsxs)("header",{className:`flex shrink-0 flex-col gap-y-1 border-b border-line px-2.5 py-1.5 ${s.header} ${g?"cursor-grab active:cursor-grabbing":""}`,...g,children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5",children:[(0,d.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${ad(a.activity)}`,title:m(`branch.${r}`)}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12px] font-semibold",title:w(a.title),children:w(a.title,90)}),(0,d.jsx)(c_,{file:a,compact:!0,hideChip:o}),j?(0,d.jsx)("button",{className:"inline-flex shrink-0 items-center rounded-[8px] border border-line bg-bg px-1.5 py-0.5 text-dim hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":k?m("branch.collapseFull"):m("branch.expandFull",{title:w(a.title,60)}),title:k?m("branch.collapseFull"):m("branch.expandFull",{title:w(a.title,60)}),onClick:j,children:k?(0,d.jsx)(aY,{className:"h-3 w-3","aria-hidden":!0}):(0,d.jsx)(aZ,{className:"h-3 w-3","aria-hidden":!0})}):null,(0,d.jsx)(bZ,{file:a,onDeleted:f}),f?(0,d.jsx)("button",{className:"inline-flex shrink-0 items-center rounded-[8px] border border-line bg-bg px-1.5 py-0.5 text-dim hover:border-err/40 hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":m("branch.removeColumn",{title:w(a.title,60)}),onClick:f,children:(0,d.jsx)(n,{className:"h-3 w-3","aria-hidden":!0})}):null]}),(0,d.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-1",children:[(0,d.jsx)(df,{file:a}),a.model?(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 font-mono text-[9.5px] font-semibold",style:{backgroundColor:al(a).soft,color:al(a).color},title:[q.label,am(a)].filter(Boolean).join(" \xb7 "),children:a.model}):(0,d.jsx)("span",{className:"inline-flex shrink-0 items-center rounded-full px-2 py-0.5 text-[10px] font-bold",style:q.style,children:q.label}),(0,d.jsx)(b$,{file:a}),a.ctx&&(!o||a.ctx.pct>=70)?(0,d.jsx)(da,{ctx:a.ctx}):null,a.worktree&&!o?(0,d.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-0.5 rounded-full border border-line/80 px-1.5 py-0.5 font-mono text-[9.5px] text-dim",title:m("branch.worktree",{name:a.worktree}),children:[(0,d.jsx)(a$,{className:"h-2.5 w-2.5","aria-hidden":!0})," ",a.worktree]}):null,a.plan?(0,d.jsx)(c8,{plan:a.plan}):null,a.goal?(0,d.jsx)(db,{goal:a.goal}):null,c||o?null:(0,d.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-0.5 text-[10px] text-dim",title:m(a.handoff?"branch.handoffTitle":"branch.branchTitle"),children:[(0,d.jsx)(a_,{className:"h-3 w-3","aria-hidden":!0})," ",a.handoff?m("kind.handoff"):de(m,a.kind)]})]})]}),i??null,b.length?(0,d.jsx)(b_,{className:"shrink-0 border-b border-line bg-[#fbfbfd]",enter:"fade",children:b.map(a=>(0,d.jsx)("div",{"data-flip-key":a.path,children:(0,d.jsx)(dh,{file:a,paused:x})},a.path))}):null,(0,d.jsx)(c5,{file:a,showSvc:!1,lineFilter:"",onStatus:dc,paused:x,follow:!0,setFollow:dc,compact:!0}),h?null:(0,d.jsx)(bS,{file:a,pollPaused:x})]})})}function dh({file:a,paused:b=!1}){let{t:c}=v(),[f,g]=(0,e.useState)(!1),h=w(a.cmdDesc||a.title,80);return(0,d.jsxs)("div",{className:"border-t border-line first:border-t-0",children:[(0,d.jsxs)("div",{className:"flex min-h-7 flex-wrap items-center gap-1.5 pl-2 pr-2.5",children:[(0,d.jsxs)("button",{className:"flex min-h-7 min-w-0 flex-1 items-center gap-1.5 rounded-[6px] text-left hover:bg-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-expanded":f,"aria-label":c("branch.toggleBackground",{action:c(f?"branch.collapse":"branch.expand"),title:h}),onClick:()=>g(a=>!a),children:[(0,d.jsx)(a8,{className:`h-3.5 w-3.5 shrink-0 text-dim transition-transform ${f?"rotate-90":""}`,"aria-hidden":!0}),(0,d.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${ad(a.activity)}`}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-semibold",title:w(a.title),children:h})]}),(0,d.jsx)(c_,{file:a,compact:!0})]}),f?(0,d.jsx)("div",{className:"flex h-[220px] flex-col border-t border-dashed border-line bg-bg/60",children:(0,d.jsx)(c5,{file:a,showSvc:!1,lineFilter:"",onStatus:dc,paused:b,follow:!0,setFollow:dc,compact:!0})}):null]})}let di={claude:["low","medium","high","xhigh","max"],codex:["low","medium","high","xhigh"]};function dj({engine:a,effort:b,speed:c,disabled:e,onEffort:f,onSpeed:g}){let{t:h}=v(),i="h-7 min-w-0 rounded-[8px] border border-line bg-panel px-1.5 text-[11px] text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60";return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("select",{value:b,disabled:e,"aria-label":h("draft.reasoningAria"),title:h("draft.reasoningAria"),className:i,onChange:a=>f(a.target.value),children:[(0,d.jsx)("option",{value:"",children:h("draft.effortDefault")}),di[a].map(a=>(0,d.jsx)("option",{value:a,children:a},a))]}),"codex"===a?(0,d.jsxs)("select",{value:c,disabled:e,"aria-label":h("draft.speedAria"),title:h("draft.speedTitle"),className:i,onChange:a=>g(a.target.value),children:[(0,d.jsx)("option",{value:"",children:h("draft.speedDefault")}),(0,d.jsx)("option",{value:"fast",children:"fast"}),(0,d.jsx)("option",{value:"standard",children:"standard"})]}):null]})}let dk=[{key:"claude",label:"Claude"},{key:"codex",label:"Codex"}],dl=(a,b)=>`llvDraftPane:${a}:${b}`;function dm(a,b,c){c?sessionStorage.setItem(dl(a,b),c):sessionStorage.removeItem(dl(a,b))}function dn({draftId:a,project:b,files:c,onClose:f,onSpawned:g}){let{t:h}=v(),[i]=(0,e.useState)(()=>""),j=i?c.find(a=>a.path===i)??null:null,[k,l]=(0,e.useState)(()=>j?.engine==="codex"?"codex":"claude"),[m,o]=(0,e.useState)(()=>""),[p,q]=(0,e.useState)(()=>""),[r,s]=(0,e.useState)(()=>""),[t,u]=(0,e.useState)([]),[x,y]=(0,e.useState)(()=>(function(){try{let a=JSON.parse("null");return a&&"number"==typeof a.at&&"string"==typeof a.prompt?a:null}catch{return null}})()),[z,A]=(0,e.useState)(!1),B=(0,e.useRef)(null),C=b=>{q(b),dm(a,"effort",b)},D=bL({initialText:()=>i?h("draft.readPrompt",{src:i}):"",persistText:b=>dm(a,"text",b),submit:a=>L(a),disabled:!!x}),{text:E,setText:F,setStatus:G,busy:H,setBusy:I,voiceSending:J,attachments:K}=D,L=async b=>{let d=b??E;if(!H&&!J&&!x){if(!m.trim())return void G({kind:"err",text:h("draft.needDir")});if(d.trim()||K.images.length){I(!0),G(null);try{var e;let b=await fetch("/api/spawn",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({engine:k,cwd:m.trim(),...p?{effort:p}:{},..."codex"===k&&r?{fast:"fast"===r}:{},prompt:d,images:K.images.map(a=>({base64:a.base64,mime:a.mime})),...i?{src:i}:{}})}),f=await b.json();if(!b.ok||!f.ok)return void G({kind:"err",text:f.error??h("draft.launchFailed")});B.current=new Set(c.map(a=>a.path)),e={at:Date.now(),target:f.target??"",path:f.path??null,prompt:d.trim()},y(e),dm(a,"boot",e?JSON.stringify(e):""),F(""),K.clear()}catch{G({kind:"err",text:h("common.serverUnavailable")})}finally{I(!1)}}}},M=ae[k]??af,N=D.fieldsDisabled,O="draft-dirs-"+a;return(0,d.jsxs)("section",{"data-pan-ignore":!0,className:"relative flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-hidden rounded-[10px] border border-line bg-panel shadow-card","aria-label":h("draft.paneAria"),children:[(0,d.jsx)("span",{"aria-hidden":!0,className:"h-1 w-full shrink-0",style:{backgroundColor:M.color}}),(0,d.jsxs)("header",{className:"flex h-10 shrink-0 items-center gap-1.5 border-b border-line px-2.5",style:{backgroundColor:M.soft},children:[(0,d.jsx)("span",{className:"h-2 w-2 shrink-0 rounded-full bg-[#c9c9d1]",title:h("draft.notStarted")}),(0,d.jsx)("div",{className:"flex shrink-0 items-center gap-1",role:"radiogroup","aria-label":h("draft.engineAria"),children:dk.map(({key:b,label:c})=>{let e=k===b,f=ae[b]??af;return(0,d.jsx)("button",{type:"button",role:"radio","aria-checked":e,disabled:N,onClick:()=>{l(b),dm(a,"engine",b),p&&!di[b].includes(p)&&C("")},style:e?{backgroundColor:"#fff",color:f.color,borderColor:f.color}:void 0,className:`rounded-full border px-2 py-0.5 text-[10.5px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60 ${e?"":"border-transparent bg-transparent text-dim hover:text-ink"}`,children:c},b)})}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12px] font-semibold text-dim",title:j?w(j.title):void 0,children:i?h("draft.handoffLabel",{title:j?w(j.title,60):h("draft.conversation")}):h("draft.newConvo")}),(0,d.jsx)("button",{className:"inline-flex shrink-0 items-center rounded-[8px] border border-line bg-bg px-1.5 py-0.5 text-dim hover:border-err/40 hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":h("draft.dismiss"),onClick:f,children:(0,d.jsx)(n,{className:"h-3 w-3","aria-hidden":!0})})]}),(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5 border-b border-line bg-[#fbfbfd] px-2.5 py-1.5",children:[(0,d.jsx)("span",{className:"shrink-0 text-[10px] font-semibold text-dim",children:h("draft.directory")}),(0,d.jsx)("input",{value:m,disabled:N,onChange:b=>{var c;o(c=b.target.value),dm(a,"cwd",c)},list:O,placeholder:"/home/…/Projects/…","aria-label":h("draft.dirAria"),className:"min-w-0 flex-1 rounded-[6px] border border-line bg-panel px-2 py-1 font-mono text-[11px] text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60"}),(0,d.jsx)("datalist",{id:O,children:t.map(a=>(0,d.jsx)("option",{value:a},a))})]}),(0,d.jsxs)("div",{className:"flex shrink-0 flex-wrap items-center gap-1.5 border-b border-line bg-[#fbfbfd] px-2.5 py-1.5",children:[(0,d.jsx)("span",{className:"shrink-0 text-[10px] font-semibold text-dim",children:h("draft.reasoning")}),(0,d.jsx)(dj,{engine:k,effort:p,speed:r,disabled:N,onEffort:C,onSpeed:b=>{s(b),dm(a,"speed",b)}})]}),(0,d.jsx)("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto px-4 py-4",children:x?(0,d.jsxs)("div",{className:"flex flex-1 flex-col justify-end gap-3",children:[(0,d.jsx)("div",{className:"flex justify-end",children:(0,d.jsx)("span",{className:"min-w-0 max-w-[85%] whitespace-pre-wrap rounded-[10px] rounded-br-[3px] bg-[#ecebfb] px-2.5 py-1.5 text-[12px] text-[#333]",children:x.prompt||h("draft.imagesOnly")})}),(0,d.jsxs)("div",{className:"flex items-center gap-2 text-[11.5px] font-semibold text-dim",children:[(0,d.jsx)(bv,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}),(0,d.jsx)("span",{children:h("draft.launched",{target:x.target})})]}),z?(0,d.jsx)("div",{className:"text-[11px] text-dim",children:h("draft.slow",{target:x.target})}):null]}):(0,d.jsxs)("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 text-center",children:[(0,d.jsx)("span",{className:"rounded-full px-3 py-1 text-[13px] font-bold",style:{backgroundColor:M.soft,color:M.color},children:"claude"===k?"Claude":"Codex"}),(0,d.jsx)("div",{className:"max-w-[360px] text-[12px] text-dim",children:i?h("draft.hintRelay"):h("draft.hintNew")}),i?(0,d.jsx)("div",{className:"max-w-[420px] truncate font-mono text-[10px] text-dim",title:i,children:i}):null]})}),(0,d.jsx)("form",{onSubmit:a=>{a.preventDefault(),L()},className:"flex shrink-0 flex-col gap-1.5 border-t border-line bg-[#fbfbfd] px-2.5 py-2","aria-label":h("draft.promptAria"),children:(0,d.jsx)(bP,{composer:D,placeholder:h("draft.placeholder"),textareaAriaLabel:h("draft.promptTextAria"),imageAriaLabel:h("draft.addImages"),sendLabelIdle:h("composer.launchAgent"),sendLabelRecording:h("draft.stopAndLaunch"),sendIdleClassName:"hover:opacity-90",sendIdleStyle:{backgroundColor:M.color,borderColor:M.color},leftSlot:(0,d.jsxs)("span",{className:"inline-flex min-w-0 items-center gap-1 rounded-full bg-chip px-1.5 py-1 font-mono text-[9.5px] font-semibold text-[#555]",title:h("draft.newWindowTitle"),children:[(0,d.jsx)(bj,{className:"h-3 w-3 shrink-0","aria-hidden":!0})," ",h("draft.newAgent")]})})})]})}let dp=(a,b)=>`llvWfDraft:${a}:${b}`;function dq(a,b,c){c?sessionStorage.setItem(dp(a,b),c):sessionStorage.removeItem(dp(a,b))}function dr({draftId:a,project:b,onClose:c,onLaunched:f}){let{t:g}=v(),[h,i]=(0,e.useState)([]),[j,k]=(0,e.useState)(()=>""),[l,m]=(0,e.useState)(()=>""),[o,p]=(0,e.useState)(()=>""),[q,r]=(0,e.useState)(()=>!1),[s,t]=(0,e.useState)([]),[u,w]=(0,e.useState)(!1),[x,y]=(0,e.useState)(null),z=h.find(a=>a.name===j)??null,A=async()=>{if(!u){if(!l.trim())return void y(g("wfDraft.needDir"));if(!o.trim())return void y(g("wfDraft.needTask"));w(!0),y(null);try{let a=await fetch("/api/workflows",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({template:j,task:o.trim(),repoDir:l.trim(),mode:q?"manual":"auto"})}),b=await a.json();if(!a.ok||!b.ok)return void y(b.error??g("wfDraft.launchFailed"));window.dispatchEvent(new Event(aK)),f()}catch{y(g("common.serverUnavailable"))}finally{w(!1)}}},B="wf-draft-dirs-"+a;return(0,d.jsxs)("section",{"data-pan-ignore":!0,className:"relative flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-hidden rounded-[10px] border border-line bg-panel shadow-card","aria-label":g("wfDraft.paneAria"),children:[(0,d.jsx)("span",{"aria-hidden":!0,className:"h-1 w-full shrink-0 bg-accent"}),(0,d.jsxs)("header",{className:"flex h-10 shrink-0 items-center gap-2 border-b border-line bg-[#ecebfb] px-2.5",children:[(0,d.jsx)("span",{className:"h-2 w-2 shrink-0 rounded-full bg-[#c9c9d1]",title:g("wfDraft.notStarted")}),(0,d.jsx)("span",{className:"shrink-0 text-[10.5px] font-bold tracking-[0.08em] text-accent",children:g("wfStrip.workflow")}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12px] font-semibold text-dim",children:g("wfDraft.newWorkflow")}),(0,d.jsx)("button",{className:"inline-flex shrink-0 items-center rounded-[8px] border border-line bg-bg px-1.5 py-0.5 text-dim hover:border-err/40 hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":g("wfDraft.dismiss"),onClick:c,children:(0,d.jsx)(n,{className:"h-3 w-3","aria-hidden":!0})})]}),(0,d.jsxs)("div",{className:"flex shrink-0 flex-col gap-1.5 border-b border-line bg-[#fbfbfd] px-2.5 py-2",children:[(0,d.jsxs)("label",{className:"flex items-center gap-1.5",children:[(0,d.jsx)("span",{className:"w-[72px] shrink-0 text-[10px] font-semibold text-dim",children:g("wfDraft.template")}),(0,d.jsx)("select",{value:j,disabled:u,onChange:b=>{var c;k(c=b.target.value),dq(a,"template",c)},"aria-label":g("wfDraft.templateAria"),className:"min-w-0 flex-1 rounded-[6px] border border-line bg-panel px-2 py-1 text-[11.5px] text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60",children:h.map(a=>(0,d.jsx)("option",{value:a.name,children:a.name},a.name))})]}),(0,d.jsxs)("label",{className:"flex items-center gap-1.5",children:[(0,d.jsx)("span",{className:"w-[72px] shrink-0 text-[10px] font-semibold text-dim",children:g("wfDraft.repo")}),(0,d.jsx)("input",{value:l,disabled:u,onChange:b=>{var c;m(c=b.target.value),dq(a,"dir",c)},list:B,placeholder:"/home/…/Projects/…","aria-label":g("wfDraft.repoAria"),className:"min-w-0 flex-1 rounded-[6px] border border-line bg-panel px-2 py-1 font-mono text-[11px] text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60"}),(0,d.jsx)("datalist",{id:B,children:s.map(a=>(0,d.jsx)("option",{value:a},a))})]}),(0,d.jsxs)("label",{className:"flex items-center gap-1.5 text-[10.5px] font-semibold text-dim",children:[(0,d.jsx)("input",{type:"checkbox",checked:q,disabled:u,onChange:b=>{var c;r(c=b.target.checked),dq(a,"mode",c?"manual":"")},className:"accent-[#5a51e0]"}),g("wfDraft.manualMode")]})]}),(0,d.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto px-4 py-3",children:[z?(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5","aria-label":g("wfStrip.stagesAria"),children:[z.stages.map((a,b)=>(0,d.jsxs)("span",{className:"flex items-center gap-1.5",children:[b>0?(0,d.jsx)("span",{className:"text-[10px] font-bold text-[#c9c9d1]","aria-hidden":!0,children:"→"}):null,(0,d.jsx)("span",{className:"inline-flex h-6 max-w-[200px] items-center truncate rounded-full bg-chip px-2 text-[10.5px] font-bold text-[#555]",children:"review-loop"===a.kind?`${g("wfStrip.reviewStage")} \xb7 ${a.reviewer.engine}${a.reviewer.effort?" "+a.reviewer.effort:""}`:`${a.scope.split(/[.:\n]/)[0]} \xb7 ${a.agent.engine}${a.agent.model?" "+a.agent.model:""}${a.agent.effort?" "+a.agent.effort:""}`})]},b)),(0,d.jsxs)("span",{className:"inline-flex h-6 items-center rounded-full bg-chip px-2 text-[10.5px] font-bold text-[#555]",children:["→ ","merge"===z.finish?g("wfDraft.finishMerge"):"PR"]})]}):(0,d.jsx)("div",{className:"text-[12px] text-dim",children:g("wfDraft.hint")}),(0,d.jsx)("textarea",{value:o,disabled:u,onChange:b=>{var c;p(c=b.target.value),dq(a,"task",c)},placeholder:g("wfDraft.taskPlaceholder"),"aria-label":g("wfDraft.taskAria"),className:"min-h-[160px] flex-1 resize-none rounded-[8px] border border-line bg-panel px-2.5 py-2 text-[12.5px] leading-snug text-ink placeholder:text-dim/70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60"})]}),(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-2 border-t border-line bg-[#fbfbfd] px-2.5 py-2",children:[x?(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11px] font-semibold text-err",title:x,children:x}):(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[10.5px] text-dim",children:g("wfDraft.footerHint")}),(0,d.jsxs)("button",{className:"inline-flex shrink-0 items-center gap-1.5 rounded-full border border-accent bg-accent px-3.5 py-1.5 text-[11.5px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",disabled:u,onClick:()=>void A(),children:[u?(0,d.jsx)(bv,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):null,u?g("wfDraft.launching"):g("wfDraft.launch")]})]})]})}let ds=k("refresh-cw",[["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"}]]),dt=k("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);function du({wf:a}){var b;let{t:c}=v(),[f,g]=(0,e.useState)(!1),[h,i]=(0,e.useState)(null),j=async b=>{if(f)return;g(!0),i(null);let c=await aO(a.id,{action:b});c&&i(c),g(!1)},k=aM.has(a.state),l="closed"===a.state||"approved"===a.state,m=("implementing"===a.state||"reviewing"===a.state)&&!!a.stageRuns[a.stageIndex]?.doneAt,o=b=>{let d=a.template.stages[b];return d?"review-loop"===d.kind?c("wfStrip.reviewStage"):d.scope.split(/[.:\n]/)[0]?.trim()||`S${b+1}`:`S${b+1}`};return(0,d.jsxs)("div",{"data-scheme-ui":!0,className:`pointer-events-auto flex min-h-11 w-full items-center gap-3 rounded-[14px] border bg-panel/95 px-4 py-1 shadow-[0_2px_10px_rgb(20_20_30/0.08)] ${k?"border-[#e0ae45]/70":"border-line"}`,children:[(0,d.jsxs)("span",{className:"flex min-w-0 max-w-[46%] shrink-0 items-center gap-2",children:[(0,d.jsx)("span",{className:`h-2.5 w-2.5 shrink-0 rounded-full ${"approved"===a.state?"bg-ok":"needs_decision"===a.state?"bg-err":"paused"===a.state?"bg-[#e0ae45]":aN.has(a.state)?"bg-ok animate-pulse":"bg-[#9a9aa4]"}`,"aria-hidden":!0}),(0,d.jsx)("span",{className:"shrink-0 text-[10.5px] font-bold tracking-[0.08em] text-dim",children:c("wfStrip.workflow")}),(0,d.jsx)("span",{className:"shrink-0 text-[12px] font-bold",children:a.name}),(0,d.jsx)("span",{className:"shrink-0 text-[11.5px] font-semibold text-dim",children:(b=a.state,c(`wfState.${b}`))}),a.stateDetail?(0,d.jsx)("span",{className:"min-w-0 truncate text-[11.5px] font-semibold text-err",title:a.stateDetail,children:a.stateDetail}):null]}),(0,d.jsx)("span",{className:"no-scrollbar flex min-w-0 flex-1 items-center justify-center gap-1.5 overflow-x-auto","aria-label":c("wfStrip.stagesAria"),children:a.template.stages.map((b,c)=>{let e,f=(e=a.stageRuns[c],e?.doneAt?{color:"#1a8a3e",soft:"#e7f4ea",pulse:!1}:c===a.stageIndex&&aN.has(a.state)&&"provisioning"!==a.state?{color:"#5a51e0",soft:"#ecebfb",pulse:!0}:{color:"#8b8b95",soft:"#efeff3",pulse:!1}),g=a.stageRuns[c];return(0,d.jsxs)("span",{className:"flex shrink-0 items-center gap-1.5",children:[c>0?(0,d.jsx)("span",{className:"text-[10px] font-bold text-[#c9c9d1]","aria-hidden":!0,children:"→"}):null,(0,d.jsxs)("span",{className:`inline-flex h-6 max-w-[180px] items-center gap-1 truncate rounded-full px-2 text-[10.5px] font-bold ${f.pulse?"animate-pulse":""}`,style:{backgroundColor:f.soft,color:f.color},title:g?.doneNote??o(c),children:[g?.doneAt?"✓ ":"",o(c)]})]},c)})}),(0,d.jsxs)("span",{className:"flex shrink-0 items-center gap-1.5",children:[h?(0,d.jsx)("span",{className:"max-w-[220px] truncate text-[10.5px] font-semibold text-err",title:h,children:h}):null,f?(0,d.jsx)(ds,{className:"h-3.5 w-3.5 shrink-0 animate-spin text-dim","aria-hidden":!0}):null,a.prUrl?(0,d.jsxs)("a",{className:"inline-flex h-6 shrink-0 items-center gap-1 rounded-full border border-ok/40 bg-[#eef8f0] px-2.5 text-[10.5px] font-bold text-ok hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",href:a.prUrl,target:"_blank",rel:"noreferrer",children:[(0,d.jsx)(dt,{className:"h-3 w-3","aria-hidden":!0})," PR"]}):null,m?(0,d.jsx)("button",{className:"shrink-0 rounded-full border border-accent bg-accent px-3 py-1 text-[11px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",disabled:f,onClick:()=>void j("advance"),children:c("wfStrip.advance")}):null,"needs_decision"===a.state?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("button",{className:"shrink-0 rounded-full border border-accent bg-accent px-3 py-1 text-[11px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",disabled:f,onClick:()=>void j("retry-stage"),children:c("wfStrip.retryStage")}),(0,d.jsx)("button",{className:"shrink-0 rounded-full border border-line bg-bg px-2.5 py-1 text-[10.5px] font-bold text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:f,onClick:()=>void j("advance"),children:c("wfStrip.skipStage")})]}):null,l?null:"paused"===a.state?(0,d.jsx)(bA,{label:c("wfStrip.resume"),children:(0,d.jsx)("button",{className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-ok hover:bg-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:f,"aria-label":c("wfStrip.resume"),onClick:()=>void j("resume"),children:(0,d.jsx)(bj,{className:"h-3.5 w-3.5","aria-hidden":!0})})}):(0,d.jsx)(bA,{label:c("wfStrip.pause"),children:(0,d.jsx)("button",{className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-dim hover:bg-bg hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:f,"aria-label":c("wfStrip.pause"),onClick:()=>void j("pause"),children:(0,d.jsx)(cX,{className:"h-3.5 w-3.5","aria-hidden":!0})})}),(0,d.jsx)(bA,{label:c("wfStrip.close"),children:(0,d.jsx)("button",{className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-dim hover:bg-bg hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:f,"aria-label":c("wfStrip.close"),onClick:()=>void j("close"),children:(0,d.jsx)(n,{className:"h-3.5 w-3.5","aria-hidden":!0})})})]})]})}let dv={inbox:{color:"#e0ae45",soft:"#fdf3dd"},assigned:{color:"#5a51e0",soft:"#efeefc"},blocked:{color:"#d97757",soft:"#faeee9"},done:{color:"#1a8a3e",soft:"#e7f4ea"}},dw=["inbox","assigned","blocked","done"];function dx(a){return a.split(/\r?\n/,1)[0]?.trim()??""}function dy(a,b){return("done"===a.status)-("done"===b.status)||b.updatedAt.localeCompare(a.updatedAt)}function dz({tasks:a,project:b,onOpenTask:c,onClose:f}){let{t:g}=v(),[h,i]=(0,e.useState)("project"),j=(0,e.useMemo)(()=>("project"===h?a.filter(a=>a.project===b):[...a]).sort(dy),[a,b,h]);return(0,d.jsxs)("aside",{className:"flex w-[280px] shrink-0 flex-col border-l border-line bg-panel","aria-label":g("tasks.panelTitle"),children:[(0,d.jsxs)("div",{className:"flex h-9 shrink-0 items-center gap-1.5 border-b border-line px-2.5",children:[(0,d.jsx)("span",{className:"text-[12px] font-bold",children:g("tasks.panelTitle")}),(0,d.jsx)("div",{className:"ml-1 flex items-center rounded-full border border-line p-0.5",children:["project","all"].map(a=>(0,d.jsx)("button",{type:"button","aria-pressed":h===a,className:`rounded-full px-2 py-0.5 text-[10px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${h===a?"bg-accent/10 text-accent":"text-dim hover:text-ink"}`,onClick:()=>i(a),children:"project"===a?g("tasks.panelThisProject"):g("tasks.panelAll")},a))}),(0,d.jsx)("button",{type:"button",className:"ml-auto inline-flex shrink-0 items-center rounded-[8px] border border-line bg-bg px-1.5 py-0.5 text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":g("tasks.panelClose"),onClick:f,children:(0,d.jsx)(n,{className:"h-3 w-3","aria-hidden":!0})})]}),(0,d.jsx)("div",{className:"flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto p-1.5",children:j.length?j.map(a=>{let b=dv[a.status];return(0,d.jsxs)("button",{type:"button",className:`flex w-full min-w-0 flex-col gap-0.5 rounded-[8px] border border-line bg-panel px-2 py-1.5 text-left shadow-card hover:border-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${"done"===a.status?"opacity-60":""}`,title:a.text,onClick:()=>c(a),children:[(0,d.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 text-[9px] font-bold",style:{backgroundColor:b.soft,color:b.color},children:g(`tasks.status.${a.status}`)}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-semibold",children:dx(a.text)||g("tasks.untitled")})]}),(0,d.jsxs)("span",{className:"flex items-center gap-2 pl-0.5 text-[10px] text-dim",children:["all"===h?(0,d.jsx)("span",{className:"min-w-0 max-w-[110px] truncate",children:a.project}):null,a.source?(0,d.jsxs)("span",{className:"inline-flex items-center gap-0.5 text-[#0d6f5f]",title:`${g("tasks.sourceTitle")}: ${a.source.text}`,children:[(0,d.jsx)(bf,{className:"h-2.5 w-2.5","aria-hidden":!0}),g("tasks.source")]}):null,a.assignments.length?(0,d.jsxs)("span",{children:["⤷ ",a.assignments.length]}):null,(0,d.jsx)("span",{children:ab(new Date(a.updatedAt).getTime()/1e3)})]})]},a.id)}):(0,d.jsx)("div",{className:"px-2 py-3 text-center text-[11px] text-dim",children:g("tasks.panelEmpty")})})]})}let dA=0,dB=new Set;function dC(a,b){let c={id:++dA,kind:a,text:b};for(let a of dB)a(c)}function dD(a,b){let c=r(),d=a.results.length,e=u(c,"tasks.sendOk",{delivered:a.delivered,total:d});if(!a.failed)return{kind:"ok",text:e};let f=new Map(b.map(a=>[a.path,a])),g=a.results.filter(a=>!a.ok).map(a=>{let b=f.get(a.path);return u(c,"tasks.sendFailPart",{title:b?w(b.title,40):a.path.split("/").pop()??a.path,error:a.error??""})});return{kind:"err",text:`${e}; ${g.join("; ")}`}}function dE(){let[a,b]=(0,e.useState)([]);return a.length?(0,d.jsx)("div",{className:"pointer-events-none absolute inset-x-0 bottom-14 z-50 flex flex-col items-center gap-1.5 px-3",children:a.map(a=>(0,d.jsxs)("div",{className:`pointer-events-auto flex max-w-[560px] items-start gap-2 rounded-[10px] border px-3 py-2 text-[11.5px] font-semibold shadow-[0_10px_36px_rgb(20_20_30/0.18)] ${"ok"===a.kind?"border-ok/40 bg-[#eef8f0] text-[#1c6b30]":"border-err/40 bg-[#fdf0f0] text-[#8f2525]"}`,children:[(0,d.jsx)("span",{className:"min-w-0 break-words",children:a.text}),(0,d.jsx)("button",{type:"button",className:"mt-0.5 shrink-0 rounded p-0.5 opacity-60 hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":u(r(),"viewer.closeNotification"),onClick:()=>b(b=>b.filter(b=>b.id!==a.id)),children:(0,d.jsx)(n,{className:"h-3 w-3","aria-hidden":!0})})]},a.id))}):null}let dF=k("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);async function dG(a,b,c){try{let d=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({pid:a.pid??void 0,path:a.path,text:b,images:c})}),e=await d.json().catch(()=>null);if(!d.ok||!e?.ok)return e?.error??u(r(),"common.failedSend");return null}catch{return u(r(),"common.serverUnavailable")}}function dH({files:a,project:b,checked:c,onChange:f,maxHeight:g=240}){let{t:h}=v(),i=(0,e.useMemo)(()=>a.filter(a=>E(a)===b&&(A(a)||C(a))).sort((a,b)=>b.mtime-a.mtime),[a,b]),j=(0,e.useMemo)(()=>I(a),[a]),k=(0,e.useMemo)(()=>new Set(i.map(a=>a.path)),[i]);return i.length?(0,d.jsx)("div",{className:"flex flex-col gap-0.5 overflow-y-auto",style:{maxHeight:g},children:i.map(a=>{let b=ar(a),e=J(a,j).filter(a=>k.has(a.path)).length;return(0,d.jsxs)("div",{className:"flex items-center gap-1",children:[(0,d.jsxs)("label",{className:"flex h-7 min-w-0 flex-1 cursor-pointer items-center gap-1.5 rounded-[6px] px-1.5 hover:bg-bg",children:[(0,d.jsx)("input",{type:"checkbox",checked:c.has(a.path),onChange:()=>{var b;let d;return b=a.path,void((d=new Set(c)).has(b)?d.delete(b):d.add(b),f(d))},className:"accent-accent"}),(0,d.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${ad(a.activity)}`}),(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:b.style,children:b.label}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11px] font-semibold",title:w(a.title),children:w(a.title,46)})]}),e?(0,d.jsxs)("button",{type:"button",className:"inline-flex h-6 shrink-0 items-center gap-0.5 rounded-[6px] px-1 text-[10px] font-semibold text-dim hover:bg-bg hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:h("tasks.pickerAllChildren"),onClick:()=>(a=>{let b=new Set(c);for(let c of(b.add(a.path),J(a,j)))k.has(c.path)&&b.add(c.path);f(b)})(a),children:[(0,d.jsx)(a_,{className:"h-3 w-3","aria-hidden":!0})," ",e]}):null]},a.path)})}):(0,d.jsx)("div",{className:"px-1.5 py-2 text-[11px] text-dim",children:h("tasks.pickerEmpty")})}function dI({value:a,onPick:b}){let{t:c}=v();return(0,d.jsx)("div",{className:"flex flex-wrap items-center gap-1",children:dw.map(e=>{let f=dv[e],g=e===a;return(0,d.jsx)("button",{type:"button","aria-pressed":g,className:"rounded-full border px-2 py-0.5 text-[10.5px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",style:g?{backgroundColor:f.soft,color:f.color,borderColor:f.color}:{borderColor:"transparent",color:"#8b8b95"},onClick:()=>b(e),children:c(`tasks.status.${e}`)},e)})})}function dJ({project:a,files:b,onCreated:c}){let{t:f}=v(),[g,h]=(0,e.useState)(()=>new Set),i=bL({initialText:()=>"",persistText:b=>{b?sessionStorage.setItem("llvTaskSheetDraft:"+a,b):sessionStorage.removeItem("llvTaskSheetDraft:"+a)},submit:a=>q(a)}),{text:j,setText:k,setStatus:l,busy:m,setBusy:n,voiceSending:o,attachments:p}=i,q=async d=>{let e=d??j;if(!m&&!o){if(!e.trim())return void l({kind:"err",text:f("tasks.composerNeedsText")});n(!0),l(null);try{let d=await aC({project:a,text:e,pos:{x:120,y:120}});if("error"in d)return void l({kind:"err",text:d.error});let f=[...g];if(f.length){let a=await aJ(d.task.id,f);if("error"in a)dC("err",a.error);else{let c=dD(a,b);dC(c.kind,c.text);let d=p.images.map(a=>({base64:a.base64,mime:a.mime}));if(d.length){let c=new Map(b.map(a=>[a.path,a])),e=a.results.filter(a=>a.ok).map(a=>{var b;let d,e,f;return c.get(a.path)??(d=(b=a.path).includes("/.claude/projects/")?"claude-projects":/\/tmp\/claude-\d+\//.test(b)?"claude-tasks":"codex-sessions",e=b.endsWith(".jsonl")?"claude-projects"===d?"claude":"codex":"plain",f=d.startsWith("codex")?"codex":"claude-tasks"===d?"shell":"claude",{path:b,root:d,fmt:e,engine:f,kind:"",title:w(b.split("/").pop()||b,120),project:"",worktree:void 0,mtime:Date.now()/1e3,size:0,activity:"idle",proc:null,pid:null,model:null,pendingQuestion:null,waitingInput:null,parent:null,name:b})}),f=[];for(let a of e)f.push(await dG(a,"",d));if(f.some(a=>null!==a)){let a=function(a,b){let c=r(),d=b.filter(a=>null===a).length,e=u(c,"tasks.sendOk",{delivered:d,total:a.length});if(d===a.length)return{kind:"ok",text:e};let f=a.map((a,c)=>({file:a,error:b[c]})).filter(a=>a.error).map(a=>u(c,"tasks.sendFailPart",{title:w(a.file.title,40),error:a.error??""}));return{kind:"err",text:`${e}; ${f.join("; ")}`}}(e,f);dC(a.kind,a.text)}}}}k(""),p.clear(),c(d.task)}finally{n(!1)}}};return(0,d.jsxs)("form",{onSubmit:a=>{a.preventDefault(),q()},className:"flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto p-3",children:[(0,d.jsx)("div",{className:"flex flex-col gap-1.5",children:(0,d.jsx)(bP,{composer:i,placeholder:f("tasks.newPlaceholder"),textareaAriaLabel:f("tasks.editAria"),imageAriaLabel:f("composer.addImages"),sendLabelIdle:f("tasks.sheetCreate"),sendLabelRecording:f("composer.stopAndSend"),sendIdleClassName:"border-accent bg-accent hover:opacity-90",leftSlot:(0,d.jsx)("span",{className:"inline-flex min-w-0 items-center gap-1 rounded-full bg-chip px-1.5 py-1 text-[9.5px] font-semibold text-[#555]",children:f("tasks.sheetTargets",{count:g.size})})})}),(0,d.jsxs)("div",{className:"flex flex-col gap-1 rounded-[10px] border border-line bg-panel p-1.5",children:[(0,d.jsx)("div",{className:"px-1 text-[10.5px] font-bold text-dim",children:f("tasks.pickerTitle")}),(0,d.jsx)(dH,{files:b,project:a,checked:g,onChange:h,maxHeight:9999})]})]})}function dK({task:a,files:b,onDeleted:c}){let{t:f}=v(),[g,h]=(0,e.useState)(a.text),[i,j]=(0,e.useState)(()=>new Set),[k,l]=(0,e.useState)(!1),[m,n]=(0,e.useState)(!1),o=bK({onError:a=>dC("err",a),onUnclaimedText:a=>h(b=>b?b.trimEnd()+" "+a:a),onLiveCommit:a=>h(b=>b?b.trimEnd()+" "+a:a)}),p=async()=>{if(g===a.text)return null;if(!g.trim())return f("tasks.emptyTextBlocked");let b=await aF(a.id,{text:g});return b&&dC("err",b),b},q=async()=>{let c=[...i];if(c.length&&!k){if(!g.trim())return void dC("err",f("tasks.emptyTextBlocked"));l(!0);try{if(await p()!==null)return;let d=await aJ(a.id,c);if("error"in d)dC("err",d.error);else{let a=dD(d,b);dC(a.kind,a.text),j(new Set)}}finally{l(!1)}}},r=new Map(b.map(a=>[a.path,a]));return(0,d.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto p-3",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-1.5 rounded-[10px] border border-line bg-panel p-2",children:[(0,d.jsx)("textarea",{value:o.liveText?(g?g.trimEnd()+" ":"")+o.liveText:g,readOnly:!!o.liveText,onChange:a=>h(a.target.value),onBlur:()=>void p(),rows:Math.min(14,Math.max(4,g.split("\n").length+1)),"aria-label":f("tasks.editAria"),maxLength:6e3,className:"w-full resize-none rounded-[8px] border border-line bg-panel px-2.5 py-1.5 text-[12.5px] leading-[18px] text-[#222] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40"}),(0,d.jsxs)("div",{className:"flex items-center justify-between gap-1.5",children:[(0,d.jsx)(dI,{value:a.status,onPick:b=>{b!==a.status&&aF(a.id,{status:b}).then(a=>{a&&dC("err",a)})}}),(0,d.jsx)(bN,{...o,onText:a=>h(b=>b?b.trimEnd()+" "+a:a)})]})]}),a.assignments.length?(0,d.jsxs)("div",{className:"flex flex-col gap-1 rounded-[10px] border border-line bg-panel p-2",children:[(0,d.jsx)("div",{className:"text-[10.5px] font-bold text-dim",children:f("tasks.sheetAssignments")}),a.assignments.map((c,e)=>{let h=c.path?r.get(c.path)??null:null,i="failed"===c.state,j=h?ar(h):null,k=c.path?h?w(h.title,44):c.path.split("/").pop()??c.path:f("tasks.spawning");return(0,d.jsxs)("div",{className:`flex h-7 items-center gap-1.5 rounded-[6px] px-1.5 ${i?"bg-[#faeee9] text-[#a04a2e]":h?"bg-bg":"bg-bg opacity-60"}`,title:i?f("tasks.chipFailedTitle",{error:c.error??""}):void 0,children:[h?(0,d.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${ad(h.activity)}`}):null,j?(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:j.style,children:j.label}):null,(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11px] font-semibold",children:k}),i?(0,d.jsx)("span",{"aria-hidden":!0,children:"⚠"}):null,c.path&&(i||!h)?(0,d.jsx)("button",{type:"button",className:"shrink-0 rounded px-1 text-[10px] font-bold text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>{(async()=>{if(!g.trim())return dC("err",f("tasks.emptyTextBlocked"));if(await p()!==null)return;let d=await aJ(a.id,[c.path]);if("error"in d)dC("err",d.error);else{let a=dD(d,b);dC(a.kind,a.text)}})()},children:f("tasks.retry")}):null]},(c.path??"spawning")+e)})]}):null,(0,d.jsxs)("div",{className:"flex flex-col gap-1 rounded-[10px] border border-line bg-panel p-1.5",children:[(0,d.jsx)("div",{className:"px-1 text-[10.5px] font-bold text-dim",children:f("tasks.pickerTitle")}),(0,d.jsx)(dH,{files:b,project:a.project,checked:i,onChange:j,maxHeight:9999}),(0,d.jsxs)("button",{type:"button",disabled:!i.size||k,className:"mt-1 inline-flex h-8 items-center justify-center gap-1.5 rounded-[8px] border border-accent bg-accent text-[11.5px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",onClick:()=>void q(),children:[k?(0,d.jsx)(bv,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):(0,d.jsx)(cY,{className:"h-3.5 w-3.5","aria-hidden":!0}),f("tasks.pickerSend",{count:i.size})]})]}),(0,d.jsxs)("button",{type:"button",className:`inline-flex h-8 items-center justify-center gap-1.5 rounded-[8px] border text-[11.5px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${m?"border-err bg-err text-white":"border-line bg-panel text-dim hover:border-err/40 hover:text-err"}`,onClick:()=>{m?aG(a.id).then(a=>{a?dC("err",a):c()}):n(!0)},children:[(0,d.jsx)(bn,{className:"h-3.5 w-3.5","aria-hidden":!0}),m?f("tasks.deleteConfirm"):f("tasks.delete")]})]})}function dL({project:a,tasks:b,files:c,initialView:f,onClose:g}){let{t:h}=v(),[i,j]=(0,e.useState)(f),k=(0,e.useMemo)(()=>[...b].sort((a,b)=>("done"===a.status)-("done"===b.status)||b.updatedAt.localeCompare(a.updatedAt)),[b]),l="object"==typeof i?b.find(a=>a.id===i.taskId)??null:null;return(0,d.jsxs)("div",{className:"fixed inset-0 z-[60] flex flex-col bg-bg pb-[env(safe-area-inset-bottom)]",children:[(0,d.jsxs)("div",{className:"flex h-10 shrink-0 items-center gap-2 border-b border-line bg-panel px-3",children:["list"!==i?(0,d.jsx)("button",{type:"button",className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-[8px] border border-line bg-bg text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":h("tasks.sheetBack"),onClick:()=>j("list"),children:(0,d.jsx)(dF,{className:"h-4 w-4","aria-hidden":!0})}):null,(0,d.jsx)("span",{className:"shrink-0 text-[13px] font-bold",children:"new"===i?h("tasks.sheetNew"):l?dx(l.text)||h("tasks.untitled"):h("tasks.panelTitle")}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] text-dim",children:a}),(0,d.jsx)("button",{type:"button",className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-[8px] border border-line bg-bg text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":h("common.close"),onClick:g,children:(0,d.jsx)(n,{className:"h-4 w-4","aria-hidden":!0})})]}),"list"===i?(0,d.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-1 overflow-y-auto p-2",children:[(0,d.jsxs)("button",{type:"button",className:"flex h-9 shrink-0 items-center justify-center gap-1 rounded-[10px] border border-dashed border-accent/50 text-[12px] font-bold text-accent hover:bg-accent/5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>j("new"),children:["+ ",h("tasks.sheetNew")]}),k.map(a=>{let b=dv[a.status];return(0,d.jsxs)("button",{type:"button",className:`flex w-full min-w-0 flex-col gap-0.5 rounded-[10px] border border-line bg-panel px-2.5 py-2 text-left shadow-card focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${"done"===a.status?"opacity-60":""}`,onClick:()=>j({taskId:a.id}),children:[(0,d.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 text-[9px] font-bold",style:{backgroundColor:b.soft,color:b.color},children:h(`tasks.status.${a.status}`)}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12.5px] font-semibold",children:dx(a.text)||h("tasks.untitled")})]}),(0,d.jsxs)("span",{className:"flex items-center gap-2 pl-0.5 text-[10.5px] text-dim",children:[a.assignments.length?(0,d.jsxs)("span",{children:["⤷ ",a.assignments.length]}):null,(0,d.jsx)("span",{children:ab(new Date(a.updatedAt).getTime()/1e3)})]})]},a.id)}),k.length?null:(0,d.jsx)("div",{className:"px-2 py-4 text-center text-[11.5px] text-dim",children:h("tasks.sheetEmpty")})]}):"new"===i?(0,d.jsx)(dJ,{project:a,files:c,onCreated:a=>j({taskId:a.id})}):l?(0,d.jsx)(dK,{task:l,files:c,onDeleted:()=>j("list")},l.id):(0,d.jsx)("div",{className:"flex flex-1 items-center justify-center text-[12px] text-dim",children:h("tasks.sheetGone")})]})}let dM=k("diamond",[["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0Z",key:"1f1r0c"}]]),dN=k("hourglass",[["path",{d:"M5 22h14",key:"ehvnwv"}],["path",{d:"M5 2h14",key:"pdyrp9"}],["path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22",key:"1d314k"}],["path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2",key:"1vvvr6"}]]);function dO({verdict:a,error:b,className:c="h-3 w-3"}){return"APPROVE"===a?(0,d.jsx)(a7,{className:c,strokeWidth:3,"aria-hidden":!0}):"REQUEST_CHANGES"===a?(0,d.jsx)(n,{className:c,strokeWidth:3,"aria-hidden":!0}):"COMMENT"===a?(0,d.jsx)(dM,{className:c,strokeWidth:2.5,"aria-hidden":!0}):b?(0,d.jsx)(l,{className:c,"aria-hidden":!0}):(0,d.jsx)(dN,{className:c,"aria-hidden":!0})}function dP(a,b){return b.error?a("roundDeck.roundAborted",{n:b.n}):b.verdict?a("roundDeck.roundVerdict",{n:b.n,verdict:`${$[b.verdict]} ${b.verdict}`}):a("roundDeck.roundInProgress",{n:b.n})}function dQ({round:a,depth:b,pulse:c,onPull:e}){let{t:f}=v(),g=_(a.verdict);return(0,d.jsxs)("button",{className:`deck-tab absolute inset-x-0 flex items-center gap-1.5 rounded-[9px] border bg-panel px-2.5 text-left shadow-card focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${c?"deck-tab-live border-ok/50":"border-line hover:border-accent/45"}`,style:{height:36,bottom:-(30*b)-10,zIndex:10-b,transform:`scale(${1-.035*b}) translateZ(${-(34*b)}px)`},title:a.error?`${dP(f,a)}: ${a.error}`:dP(f,a),onClick:e,children:[(0,d.jsxs)("span",{className:"inline-flex h-4 shrink-0 items-center gap-1 rounded-full px-1.5 text-[9.5px] font-bold",style:{backgroundColor:g.soft,color:g.color},children:["R",a.n," ",(0,d.jsx)(dO,{verdict:a.verdict,error:!!a.error,className:"h-2.5 w-2.5"})]}),(0,d.jsxs)("span",{className:"min-w-0 flex-1 truncate text-[10.5px] font-semibold text-dim",children:[a.error?f("roundDeck.aborted"):a.verdict?a.verdict:f("roundDeck.reviewInProgress"),null!=a.findingsCount&&a.findingsCount>0?` \xb7 ${f("roundDeck.findings",{count:a.findingsCount})}`:""]}),c?(0,d.jsx)("span",{className:"h-1.5 w-1.5 shrink-0 animate-pulse rounded-full bg-ok","aria-hidden":!0}):null]})}function dR({flow:a,rounds:b,focusRound:c,dormant:f=!1}){let{t:g}=v(),h=b.length?b[b.length-1]:null,[i,j]=(0,e.useState)(null),[k,l]=(0,e.useState)(null);null!=c&&c!==k&&(l(c),j(Math.round(c)));let[m,n]=(0,e.useState)(null);h&&h.round.n!==m&&(n(h.round.n),null!=i&&h.round.n>i&&null===h.round.verdict&&j(null));let o=(0,e.useMemo)(()=>b.find(a=>a.round.n===i)??h,[b,i,h]);if(!o)return(0,d.jsx)("div",{className:"flex h-full items-center justify-center rounded-[10px] border border-dashed border-[#c9c9d1] bg-panel/60",children:(0,d.jsx)("span",{className:"text-[12px] font-semibold text-dim",children:g("roundDeck.waitingFirst")})});let p=b.filter(a=>a.round.n!==o.round.n).reverse(),q=p.slice(0,5),r=p.length-q.length,s=_(o.round.verdict),t=null!==o.round.verdict||!!o.round.error,u=h&&o.round.n!==h.round.n&&null===h.round.verdict&&!h.round.error?h:null;return(0,d.jsxs)("div",{className:"deck-3d relative h-full",style:{paddingBottom:30*Math.min(p.length,5+ +!!r)},children:[(0,d.jsx)("div",{className:"scheme-enter relative z-[11] flex h-full flex-col",children:o.file?(0,d.jsx)(dg,{file:o.file,tasks:[],isRoot:!1,dormant:f,noComposer:"headless"===a.reviewerMode||t,banner:(0,d.jsxs)("div",{className:"flex h-6 shrink-0 items-center gap-1.5 border-b border-line px-2.5 text-[10.5px] font-bold",style:{backgroundColor:s.soft,color:s.color},children:[dP(g,o.round),null!=o.round.findingsCount&&o.round.findingsCount>0?(0,d.jsxs)("span",{className:"font-semibold opacity-80",children:["\xb7 ",g("roundDeck.findings",{count:o.round.findingsCount})]}):null,o.round.readyNote?(0,d.jsxs)("span",{className:"min-w-0 flex-1 truncate font-semibold opacity-70",title:o.round.readyNote,children:["\xb7 ",o.round.readyNote]}):null]})}):(0,d.jsxs)("div",{className:"flex h-full flex-col items-center justify-center gap-1 rounded-[10px] border border-line bg-panel shadow-card",children:[(0,d.jsx)("span",{className:"text-[12px] font-semibold text-dim",children:dP(g,o.round)}),(0,d.jsx)("span",{className:"text-[11px] text-dim",children:o.round.error?o.round.error:g("roundDeck.spawningReviewer")})]})},o.round.n),q.map((a,b)=>(0,d.jsx)(dQ,{round:a.round,depth:b,pulse:u?.round.n===a.round.n,onPull:()=>j(a.round.n)},a.round.n)),r>0?(0,d.jsx)("div",{className:"pointer-events-none absolute inset-x-6 flex items-center justify-center rounded-[9px] border border-line bg-panel/70 text-[10px] font-semibold text-dim shadow-card",style:{height:26,bottom:-(30*q.length)-8,zIndex:10-q.length},"aria-hidden":!0,children:g("roundDeck.moreRounds",{count:r})}):null]})}let dS=k("arrow-right-left",[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]);function dT(a){return("claude-projects"===a.root||"codex-sessions"===a.root)&&a.path.endsWith(".jsonl")}function dU({file:a,onHandoff:b}){let{t:c}=v(),e=function(a){let{t:b}=v();return bX({exclude:a.path,onDragStart:void 0,onDrop:c=>(bR(c.file.path,b("link.handoffContext",{title:w(a.title,80),path:a.path,ask:""}).trimEnd()+"\n\n"),b("link.dropped",{title:w(c.file.title,48)}))})}(a);return(0,d.jsxs)("div",{"data-scheme-ui":!0,className:"group absolute -bottom-11 left-2 z-[2]",children:[(0,d.jsxs)("button",{type:"button","aria-label":c("handoff.aria"),title:c("handoff.title"),onPointerDown:e.onPillPointerDown,onClick:()=>{e.consumeClick()||b()},className:"flex h-7 touch-none items-center gap-1.5 rounded-full border border-line bg-panel px-2 text-dim shadow-card transition-[border-color,color] duration-150 hover:border-accent/50 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[(0,d.jsx)(dS,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),(0,d.jsx)("span",{className:"max-w-[0px] overflow-hidden whitespace-nowrap text-[11px] font-semibold transition-[max-width] duration-200 group-hover:max-w-[180px] group-focus-within:max-w-[180px]",children:c("handoff.label")}),(0,d.jsx)(a2,{className:"hidden h-3.5 w-3.5 shrink-0 group-hover:block group-focus-within:block","aria-hidden":!0})]}),e.overlay]})}function dV(a,b,c,d=[],e=[]){let f=new Map(c.map(a=>[a.path,a])),g=I(c),h=[],i=[],j=[],k=[],l=[],m=T(d),n=U(d),o=100,p=[],q=new Map;for(let a of e){let b="";if(!b)continue;let c=q.get(b);c?c.push(a):q.set(b,[a])}let r=new Set,s=a=>({file:a,branches:g.get(a.path)?.length??0}),t=(a,b,c,d,e)=>{let g=(a,o,t,u)=>{let v=0===u?780:680;h.push({file:a.file,tasks:a.tasks,under:d.get(a.file.path)??[],x:o,y:t,w:600,h:v,isRoot:a.file.path===e});let w=m.get(a.file.path),x=v;if(w){var y;let a,b,c=(y=o+600+170,a=w.rounds.map(a=>({round:a,file:a.reviewerPath?f.get(a.reviewerPath)??null:null})),b={key:"deck::"+w.id,flow:w,rounds:a,x:y,y:t,w:600,h:v+30*Math.min(Math.max(w.rounds.length-1,0),6)},k.push(b),b);l.push({key:"loop::"+w.id,flow:w,x1:o+600,x2:c.x,y:t}),x=Math.max(x,c.h)}let z=t+x+130,A=b.get(a.file.path)??[],B=o+64;for(let a of A)i.push({to:a.file.path,x1:o+40,y1:t+v,x2:B+300,y2:z,color:ao(a.file),live:"live"===a.file.activity}),B+=g(a,B,z,u+1)+48;let C=c.get(a.file.path)?.filter(a=>!n.has(a.path));for(let b of(C?.length&&(j.push({key:a.file.path+"::stack",parent:a.file.path,items:C.map(s),x:B,y:z,w:360,h:16+58*Math.min(C.length,8)-6}),i.push({to:a.file.path+"::stack",x1:o+40,y1:t+v,x2:B+180,y2:z,color:"#9a9aa4",live:!1,dashed:!0}),B+=408),q.get(a.file.path)??[]))r.add(b),p.push({key:"draft::"+b,id:b,src:a.file.path,x:B,y:z,w:600,h:680}),i.push({to:"draft::"+b,x1:o+40,y1:t+v,x2:B+300,y2:z,color:"#5a51e0",live:!1,dashed:!0}),B+=648;let D=B-48-(o+64);return Math.max(D>0?Math.max(600,64+D):600,w?1370:600)};return g(a,o,100,0)};for(let b of a){let a=b.columns;if(!a.length)continue;let c=a[0].file.path,d=new Set(a.map(a=>a.file.path)),e=a=>{let b=a.parent,e=new Set([a.path]);for(;b&&!e.has(b)&&!d.has(b);)e.add(b),b=f.get(b)?.parent??null;return b&&d.has(b)&&b!==a.path?b:c},g=new Map;for(let b of a){if(b.file.path===c)continue;let a=e(b.file),d=g.get(a);d?d.push(b):g.set(a,[b])}let h=new Map,i=[];for(let a of[...b.returnable,...b.finished])if(!n.has(a.path))if(C(a)){let b=e(a),c=h.get(b);c?c.push(a):h.set(b,[a])}else i.push(a);let j=new Map([[c,i]]);o+=t(a[0],g,h,j,b.key)+150}for(let a of b){let b=(function(a,b){if(!a)return[];let c=I(b),d=[],e=new Set([a.path]),f=(a,b)=>{for(let g of(c.get(a.path)??[]).filter(a=>!e.has(a.path)).sort((a,b)=>z(a)-z(b)||b.mtime-a.mtime))e.add(g.path),d.push({file:g,depth:b}),f(g,b+1)};return f(a,1),d})(a,c).map(a=>a.file).filter(a=>!n.has(a.path)),d=b.filter(a=>C(a)),e=b.filter(a=>!C(a));o+=t({file:a,tasks:[]},new Map,new Map(d.length?[[a.path,d]]:[]),new Map([[a.path,e]]),a.parent?"":a.path)+150}for(let a of e)r.has(a)||(p.push({key:"draft::"+a,id:a,x:o,y:100,w:600,h:780}),o+=750);let u=0;for(let a of h)u=Math.max(u,a.y+a.h);for(let a of j)u=Math.max(u,a.y+a.h);for(let a of k)u=Math.max(u,a.y+a.h);for(let a of p)u=Math.max(u,a.y+a.h);return{nodes:h,edges:i,stacks:j,decks:k,loops:l,drafts:p,byPath:new Map([...h.map(a=>[a.file.path,a]),...p.map(a=>[a.key,a]),...j.map(a=>[a.key,a]),...k.map(a=>[a.key,a])]),width:Math.max(o-150+100,800),height:u+100+140}}let dW=k("hand",[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1fvzgz"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"1kc0my"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",key:"10h0bg"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]]),dX=k("mouse-pointer-2",[["path",{d:"M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z",key:"edeuup"}]]),dY=k("square-dashed",[["path",{d:"M5 3a2 2 0 0 0-2 2",key:"y57alp"}],["path",{d:"M19 3a2 2 0 0 1 2 2",key:"18rm91"}],["path",{d:"M21 19a2 2 0 0 1-2 2",key:"1j7049"}],["path",{d:"M5 21a2 2 0 0 1-2-2",key:"sbafld"}],["path",{d:"M9 3h1",key:"1yesri"}],["path",{d:"M9 21h1",key:"15o7lz"}],["path",{d:"M14 3h1",key:"1ec4yj"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"M3 9v1",key:"1r0deq"}],["path",{d:"M21 9v1",key:"mxsmne"}],["path",{d:"M3 14v1",key:"vnatye"}],["path",{d:"M21 14v1",key:"169vum"}]]),dZ=k("sticky-note",[["path",{d:"M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z",key:"1dfntj"}],["path",{d:"M15 3v5a1 1 0 0 0 1 1h5",key:"6s6qgf"}]]),d$=k("octagon-minus",[["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}],["path",{d:"M8 12h8",key:"1wcyev"}]]),d_=k("repeat-2",[["path",{d:"m2 9 3-3 3 3",key:"1ltn5i"}],["path",{d:"M13 18H7a2 2 0 0 1-2-2V6",key:"1r6tfw"}],["path",{d:"m22 15-3 3-3-3",key:"4rnwn2"}],["path",{d:"M11 6h6a2 2 0 0 1 2 2v10",key:"2f72bc"}]]),d0=k("focus",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}]]),d1=k("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]),d2=k("rotate-ccw",[["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"}]]);async function d3(a,b,c){let d=[];for(let e of a){try{let a=await b(e);d.push(a.ok?{path:e,ok:!0}:{path:e,ok:!1,error:a.error})}catch(a){d.push({path:e,ok:!1,error:a instanceof Error?a.message:String(a)})}c?.(d,a[d.length]??null)}return d}function d4(a){return null!==a.file.pid}function d5(a){return a.isRoot}function d6(a){let b=0;for(let c of a.text.split(/\r?\n/))b+=Math.max(1,Math.ceil(c.length/34));return Math.max(64,6+(Math.min(17*b,340)+20)+((a.assignments.length+ +!!a.source)*26+(a.assignments.length||a.source?6:0)))}function d7(a){return{x:a.pos.x,y:a.pos.y,w:260,h:d6(a)}}function d8(a){return{x:a.x+a.w/2,y:a.y+a.h/2}}function d9(a,b){let{x:c,y:d}=d8(a),e=b.x-c,f=b.y-d;if(!e&&!f)return{x:c,y:d};let g=Math.min(e?a.w/2/Math.abs(e):1/0,f?a.h/2/Math.abs(f):1/0,1);return{x:c+e*g,y:d+f*g}}let ea={implementer:{engine:"claude",model:null,effort:null},reviewer:{engine:"codex",model:null,effort:"xhigh"}};async function eb(a,b){let c=await fetch(a,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(b)});if(c.ok)return{ok:!0};let d=await c.json().catch(()=>null);return{ok:!1,error:d?.error??`HTTP ${c.status}`}}function ec({icon:a,label:b,disabled:c,confirming:e,confirmLabel:f,onClick:g}){return(0,d.jsxs)("button",{className:`inline-flex h-7 items-center gap-1 whitespace-nowrap rounded-full border px-2.5 text-[11px] font-semibold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40 ${e?"border-err bg-err text-white":"border-line bg-bg text-dim hover:border-accent/45 hover:text-accent"}`,disabled:c,onClick:g,children:[a,e?f:b]})}let ed=(0,e.memo)(function({project:a,nodes:b,flowsByImpl:c,onRemove:f,onFit:g,onExit:h}){let{t:i}=v(),[j,k]=(0,e.useState)(null),[l,m]=(0,e.useState)(!0),[o,p]=(0,e.useState)(null),[q,r]=(0,e.useState)(null),[s,t]=(0,e.useState)(!1),u=(0,e.useRef)(null),x=(0,e.useRef)(b);(0,e.useLayoutEffect)(()=>{x.current=b},[b]),(0,e.useEffect)(()=>{if(!q)return;let a=window.setTimeout(()=>r(null),4e3);return()=>window.clearTimeout(a)},[q]);let y=async(a,c,d)=>{var e,f;if(j||!c.length)return[];k(a),r(null);let g=new Map(o?.titles??[]);for(let a of b)g.set(a.file.path,w(a.file.title,60));let h=(e=()=>new Set(x.current.map(a=>a.file.path)),f=i("bulk.nodeGone"),a=>e().has(a)?d(a):Promise.resolve({ok:!1,error:f}));u.current={action:a,runner:h},p({action:a,items:[],current:c[0]??null,titles:g});try{return await d3(c,h,(b,c)=>p({action:a,items:[...b],current:c,titles:g}))}finally{k(null)}},z=bL({initialText:()=>"",persistText:()=>{},submit:async c=>{let d=(c??z.textRef.current).trim(),e=z.attachments.images.map(a=>({base64:a.base64,mime:a.mime}));if((d||e.length)&&!j){z.setBusy(!0);try{let c=new Map(b.map(a=>[a.file.path,a]));if(l){if(!d)return void z.setStatus({kind:"err",text:i("tasks.composerNeedsText")});let b=await aC({project:a,text:d,pos:(()=>{let a=x.current;if(!a.length)return{x:120,y:120};let b=0,c=0;for(let d of a)b+=d.x+d.w/2,c+=d.y+d.h/2;return{x:Math.round(b/a.length-130),y:Math.round(c/a.length-60)}})()});if("error"in b)return void z.setStatus({kind:"err",text:b.error});let f=b.task.id,g=await y("message",[...c.keys()],async a=>{let b=await aJ(f,[a]);if("error"in b)return{ok:!1,error:b.error};let d=b.results[0];if(!d?.ok)return{ok:!1,error:d?.error??i("common.failedSend")};if(e.length){let b=c.get(a);return eb("/api/tmux",{pid:b?.file.pid??void 0,path:a,text:"",images:e})}return{ok:!0}});(!c.size||g.length&&g.every(a=>a.ok))&&(z.setText(""),z.attachments.clear());return}let f=await y("message",[...c.keys()],a=>{let b=c.get(a);return eb("/api/tmux",{pid:b?.file.pid??void 0,path:a,text:d,images:e})});f.length&&f.every(a=>a.ok)&&(z.setText(""),z.attachments.clear())}finally{z.setBusy(!1)}}},disabled:null!==j}),A=b.filter(d4),B=b.filter(d5),C=b.filter(a=>V(a.file,c)),D=o?.items.filter(a=>!a.ok).length??0;return(0,d.jsxs)("div",{"data-scheme-ui":!0,className:"absolute bottom-3 left-1/2 z-40 flex w-[640px] max-w-[94%] -translate-x-1/2 flex-col gap-1.5 rounded-[12px] border border-line bg-panel/95 p-2.5 shadow-[0_10px_36px_rgb(20_20_30/0.18)]",children:[s?(0,d.jsx)(ee,{count:C.length,disabled:null!==j,onStart:a=>{t(!1),y("flow",C.map(a=>a.file.path),b=>eb("/api/flows",{implementerPath:b,...a}))},onClose:()=>t(!1)}):null,(0,d.jsx)("form",{onSubmit:a=>{a.preventDefault(),z.submit()},className:"flex flex-col gap-1.5",children:(0,d.jsx)(bP,{composer:z,placeholder:i("bulk.placeholder"),textareaAriaLabel:i("bulk.textAria"),imageAriaLabel:i("composer.addImages"),sendLabelIdle:i("bulk.sendAll",{count:b.length}),sendLabelRecording:i("composer.stopAndSend"),sendTitleRecording:i("composer.stopAndSendTitle"),sendIdleClassName:"border-accent bg-accent hover:opacity-90",leftSlot:(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5",children:[(0,d.jsx)("span",{className:"inline-flex min-w-0 items-center gap-1 rounded-full bg-chip px-2 py-1 text-[10px] font-bold text-[#555]",children:i("bulk.selectedCount",{count:b.length})}),(0,d.jsxs)("button",{type:"button",role:"switch","aria-checked":l,title:i("tasks.composerToggleTitle"),onClick:()=>m(a=>!a),className:`inline-flex h-6 shrink-0 items-center gap-1 rounded-full border px-2 text-[10px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${l?"border-accent bg-accent/10 text-accent":"border-line bg-panel text-dim hover:text-ink"}`,children:[(0,d.jsx)("span",{className:`h-1.5 w-1.5 rounded-full ${l?"bg-accent":"bg-[#c9c9d1]"}`,"aria-hidden":!0}),i("tasks.composerToggle")]})]})})}),(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,d.jsx)(ec,{icon:(0,d.jsx)(d$,{className:"h-3.5 w-3.5","aria-hidden":!0}),label:`${i("bulk.interrupt")} ${A.length}/${b.length}`,disabled:null!==j||!A.length,onClick:()=>void y("interrupt",A.map(a=>a.file.path),a=>eb("/api/tmux",{action:"interrupt",path:a}))}),(0,d.jsx)(ec,{icon:(0,d.jsx)(bl,{className:"h-3.5 w-3.5","aria-hidden":!0}),label:`${i("bulk.stop")} ${B.length}/${b.length}`,confirming:"kill"===q,confirmLabel:i("bulk.stopConfirm",{count:B.length}),disabled:null!==j||!B.length,onClick:()=>{"kill"!==q?r("kill"):y("kill",B.map(a=>a.file.path),a=>eb("/api/tmux",{action:"kill",path:a}))}}),(0,d.jsx)(ec,{icon:(0,d.jsx)(bn,{className:"h-3.5 w-3.5","aria-hidden":!0}),label:`${i("bulk.remove")} ${b.length}`,confirming:"remove"===q,confirmLabel:i("bulk.removeConfirm",{count:b.length}),disabled:null!==j||!b.length,onClick:()=>{if("remove"!==q)return void r("remove");for(let a of b)f(a.file.path);r(null)}}),(0,d.jsx)(ec,{icon:(0,d.jsx)(d_,{className:"h-3.5 w-3.5","aria-hidden":!0}),label:`${i("bulk.flow")} ${C.length}/${b.length}`,disabled:null!==j||!C.length,onClick:()=>t(a=>!a)}),(0,d.jsx)(ec,{icon:(0,d.jsx)(d0,{className:"h-3.5 w-3.5","aria-hidden":!0}),label:i("bulk.fit"),disabled:!b.length,onClick:g}),(0,d.jsx)("button",{className:"ml-auto inline-flex h-7 w-7 items-center justify-center rounded-full text-dim hover:bg-bg hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":i("bulk.exit"),title:i("bulk.exit"),onClick:h,children:(0,d.jsx)(n,{className:"h-4 w-4","aria-hidden":!0})})]}),o?(0,d.jsxs)("div",{className:"flex max-h-[140px] flex-col gap-0.5 overflow-y-auto rounded-[8px] border border-line bg-bg/60 p-1.5",children:[o.items.map(a=>(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5 text-[11px]",children:[a.ok?(0,d.jsx)(ba,{className:"h-3.5 w-3.5 shrink-0 text-ok","aria-hidden":!0}):(0,d.jsx)(d1,{className:"h-3.5 w-3.5 shrink-0 text-err","aria-hidden":!0}),(0,d.jsx)("span",{className:"min-w-0 shrink-0 truncate font-semibold",style:{maxWidth:"40%"},children:o.titles.get(a.path)??a.path}),a.error?(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-err",children:a.error}):null]},a.path)),o.current?(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5 text-[11px] text-dim",children:[(0,d.jsx)(bv,{className:"h-3.5 w-3.5 shrink-0 animate-spin","aria-hidden":!0}),(0,d.jsx)("span",{className:"min-w-0 truncate font-semibold",children:o.titles.get(o.current)??o.current})]}):null,!j&&D?(0,d.jsxs)("button",{className:"mt-1 inline-flex h-6 items-center gap-1 self-start rounded-full border border-line bg-panel px-2 text-[10.5px] font-semibold text-dim hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>{let a=o?.items.filter(a=>!a.ok).map(a=>a.path)??[],b=u.current;a.length&&b&&y(b.action,a,b.runner)},children:[(0,d.jsx)(d2,{className:"h-3 w-3","aria-hidden":!0}),i("bulk.retryFailed",{count:D})]}):null]}):null]})});function ee({count:a,disabled:b,onStart:c,onClose:f}){let{t:g}=v(),[h,i]=(0,e.useState)([]),[j,k]=(0,e.useState)(null),[l,m]=(0,e.useState)("auto"),[n,o]=(0,e.useState)(5);return(0,d.jsxs)("div",{className:"absolute bottom-[calc(100%+8px)] left-1/2 flex w-[420px] max-w-[94%] -translate-x-1/2 flex-col gap-2 rounded-[12px] border border-line bg-panel p-2.5 shadow-[0_10px_36px_rgb(20_20_30/0.18)]",onKeyDown:a=>{"Escape"===a.key&&f()},children:[(0,d.jsx)("span",{className:"text-[12px] font-bold",children:g("bulk.flowTitle",{count:a})}),(0,d.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[(0,d.jsxs)("label",{className:"col-span-3 flex flex-col gap-1 text-[10.5px] font-semibold text-dim",children:[g("flowDialog.preset"),(0,d.jsx)("select",{value:j??"",className:"h-8 rounded-[8px] border border-line bg-bg px-2 text-[12px] font-normal text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:a=>k(a.target.value||null),children:h.length?h.map(a=>(0,d.jsx)("option",{value:a.name,children:a.name},a.name)):(0,d.jsx)("option",{value:"",children:g("flowDialog.effortDefault")})})]}),(0,d.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-dim",children:[g("flowDialog.transitions"),(0,d.jsxs)("select",{value:l,className:"h-8 rounded-[8px] border border-line bg-bg px-2 text-[11.5px] font-normal text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:a=>m(a.target.value),children:[(0,d.jsx)("option",{value:"auto",children:g("flowDialog.auto")}),(0,d.jsx)("option",{value:"manual",children:g("flowDialog.manual")})]})]}),(0,d.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-dim",children:[g("flowDialog.roundLimit"),(0,d.jsx)("input",{type:"number",min:1,max:20,value:n,className:"h-8 rounded-[8px] border border-line bg-bg px-2 text-[11.5px] font-normal text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:a=>o(Math.max(1,Math.min(20,Number(a.target.value)||5)))})]}),(0,d.jsxs)("div",{className:"flex items-end justify-end gap-1.5",children:[(0,d.jsx)("button",{className:"h-8 rounded-[8px] border border-line bg-bg px-2 text-[11px] font-semibold text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:f,children:g("common.cancel")}),(0,d.jsx)("button",{className:"h-8 rounded-[8px] border border-accent bg-accent px-2.5 text-[11.5px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",disabled:b||!a,onClick:()=>c({...j?{preset:j}:{roles:ea},baseMode:"head",mode:l,reviewerMode:"headless",roundLimit:n}),children:g("bulk.flowStart",{count:a})})]})]})]})}function ef({layout:a,tasks:b=[],cam:c,vp:f,onJump:g}){let{t:h}=v(),i=(0,e.useRef)(null),j=(0,e.useRef)(!1),k=Math.min(216/a.width,148/a.height),l=(216-a.width*k)/2,m=(148-a.height*k)/2,n=a=>{let b=i.current?.getBoundingClientRect();b&&g((a.clientX-b.left-l)/k,(a.clientY-b.top-m)/k)};return(0,d.jsx)("div",{ref:i,"data-scheme-ui":!0,className:"absolute bottom-3 right-3 z-40 cursor-pointer overflow-hidden rounded-[10px] border border-line bg-panel/95 shadow-card",style:{width:216,height:148},title:h("minimap.title"),onPointerDown:a=>{a.stopPropagation(),j.current=!0,n(a);try{a.currentTarget.setPointerCapture(a.pointerId)}catch{}},onPointerMove:a=>{j.current&&n(a)},onPointerUp:a=>{j.current=!1;try{a.currentTarget.releasePointerCapture(a.pointerId)}catch{}},onPointerCancel:()=>{j.current=!1},children:(0,d.jsx)("svg",{width:216,height:148,"aria-hidden":!0,children:(0,d.jsxs)("g",{transform:`translate(${l} ${m}) scale(${k})`,children:[a.stacks.map(a=>(0,d.jsx)("rect",{x:a.x,y:a.y,width:a.w,height:a.h,rx:18,fill:"#c9c9d1",opacity:.45},a.key)),a.drafts.map(a=>(0,d.jsx)("rect",{x:a.x,y:a.y,width:a.w,height:a.h,rx:18,fill:"#9a9aa4",opacity:.3},a.key)),a.decks.map(a=>(0,d.jsx)("rect",{x:a.x,y:a.y,width:a.w,height:a.h,rx:18,fill:"#5a51e0",opacity:.3},a.key)),a.nodes.map(a=>(0,d.jsx)("rect",{x:a.x,y:a.y,width:a.w,height:a.h,rx:18,fill:ao(a.file),opacity:"live"===a.file.activity?.85:.35},a.file.path)),b.map(a=>(0,d.jsx)("circle",{cx:a.pos.x+130,cy:a.pos.y+d6(a)/2,r:3/k,fill:dv[a.status].color,opacity:"done"===a.status?.5:.95},a.id)),(0,d.jsx)("rect",{x:-c.x/c.z,y:-c.y/c.z,width:f.w/c.z,height:f.h/c.z,fill:"rgba(90,81,224,0.08)",stroke:"#5a51e0",strokeWidth:2.5/k})]})})})}let eg=k("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"}]]),eh={implementer:{engine:"claude",model:null,effort:null},reviewer:{engine:"codex",model:null,effort:"xhigh"}};function ei({label:a,role:b,onChange:c}){let{t:e}=v();return(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsx)("span",{className:"w-[86px] shrink-0 text-[10.5px] font-semibold text-dim",children:a}),(0,d.jsxs)("select",{value:b.engine,"aria-label":e("flowDialog.engine",{label:a}),className:"h-7 rounded-[8px] border border-line bg-bg px-1.5 text-[11.5px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:a=>c({...b,engine:a.target.value,effort:null}),children:[(0,d.jsx)("option",{value:"claude",children:"Claude"}),(0,d.jsx)("option",{value:"codex",children:"Codex"})]}),(0,d.jsx)("input",{value:b.model??"",placeholder:e("flowDialog.modelPlaceholder"),"aria-label":e("flowDialog.model",{label:a}),className:"h-7 w-0 min-w-0 flex-1 rounded-[8px] border border-line bg-bg px-1.5 font-mono text-[11px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:a=>c({...b,model:a.target.value.trim()||null})}),(0,d.jsxs)("select",{value:b.effort??"","aria-label":`Reasoning effort: ${a}`,className:"h-7 rounded-[8px] border border-line bg-bg px-1.5 text-[11.5px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:a=>c({...b,effort:a.target.value||null}),children:[(0,d.jsx)("option",{value:"",children:e("flowDialog.effortDefault")}),di[b.engine].map(a=>(0,d.jsx)("option",{value:a,children:a},a))]})]})}function ej({file:a,onClose:b}){let{t:c}=v(),[f,g]=(0,e.useState)([]),[h,i]=(0,e.useState)(null),[j,k]=(0,e.useState)(eh),[l,m]=(0,e.useState)(!1),[n,o]=(0,e.useState)("head"),[p,q]=(0,e.useState)("auto"),[r,s]=(0,e.useState)("headless"),[t,u]=(0,e.useState)(5),[w,x]=(0,e.useState)(!1),[y,z]=(0,e.useState)(null),A=async()=>{if(!w){x(!0),z(null);try{let d=await fetch("/api/flows",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({implementerPath:a.path,...l||!h?{roles:j}:{preset:h},baseMode:n,mode:p,reviewerMode:r,roundLimit:t})});if(!d.ok){let a=await d.json().catch(()=>null);z(a?.error??c("flowDialog.createFailed",{status:d.status}));return}b()}catch{z(c("common.serverUnavailable"))}finally{x(!1)}}};return(0,d.jsxs)("div",{"data-scheme-ui":!0,className:"flex w-[420px] flex-col gap-2.5 rounded-[12px] border border-line bg-panel p-3 shadow-[0_10px_36px_rgb(20_20_30/0.18)]",onKeyDown:a=>{"Escape"===a.key&&b()},children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"text-[12.5px] font-bold",children:c("flowDialog.title")}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[10.5px] text-dim",children:c("flowDialog.subtitle")})]}),f.length?(0,d.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-dim",children:[c("flowDialog.preset"),(0,d.jsx)("select",{value:h??"",className:"h-8 rounded-[8px] border border-line bg-bg px-2 text-[12px] font-normal text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:a=>{var b;let c;return i(b=a.target.value),void((c=f.find(a=>a.name===b))&&k({implementer:c.implementer,reviewer:c.reviewer}))},children:f.map(a=>(0,d.jsx)("option",{value:a.name,children:a.name},a.name))})]}):null,(0,d.jsx)("button",{className:"self-start text-[10.5px] font-semibold text-dim hover:text-accent focus-visible:outline-none","aria-expanded":l,onClick:()=>m(a=>!a),children:l?c("flowDialog.rolesManualOpen"):c("flowDialog.rolesManual")}),l?(0,d.jsxs)("div",{className:"flex flex-col gap-1.5 rounded-[10px] border border-dashed border-line bg-bg/50 p-2",children:[(0,d.jsx)(ei,{label:c("flowDialog.implementer"),role:j.implementer,onChange:a=>k(b=>({...b,implementer:a}))}),(0,d.jsx)(ei,{label:c("flowDialog.reviewer"),role:j.reviewer,onChange:a=>k(b=>({...b,reviewer:a}))})]}):null,(0,d.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,d.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-dim",children:[c("flowDialog.diffBase"),(0,d.jsxs)("select",{value:n,className:"h-8 rounded-[8px] border border-line bg-bg px-2 text-[11.5px] font-normal text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:a=>o(a.target.value),children:[(0,d.jsx)("option",{value:"head",children:c("flowDialog.fromHead")}),(0,d.jsx)("option",{value:"merge-base",children:c("flowDialog.fromMergeBase")})]})]}),(0,d.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-dim",children:[c("flowDialog.reviewer"),(0,d.jsxs)("select",{value:r,className:"h-8 rounded-[8px] border border-line bg-bg px-2 text-[11.5px] font-normal text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:a=>s(a.target.value),children:[(0,d.jsx)("option",{value:"headless",children:c("flowDialog.headless")}),(0,d.jsx)("option",{value:"pane",children:c("flowDialog.tmuxPane")})]})]}),(0,d.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-dim",children:[c("flowDialog.transitions"),(0,d.jsxs)("select",{value:p,className:"h-8 rounded-[8px] border border-line bg-bg px-2 text-[11.5px] font-normal text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:a=>q(a.target.value),children:[(0,d.jsx)("option",{value:"auto",children:c("flowDialog.auto")}),(0,d.jsx)("option",{value:"manual",children:c("flowDialog.manual")})]})]}),(0,d.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-dim",children:[c("flowDialog.roundLimit"),(0,d.jsx)("input",{type:"number",min:1,max:20,value:t,className:"h-8 rounded-[8px] border border-line bg-bg px-2 text-[11.5px] font-normal text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:a=>u(Math.max(1,Math.min(20,Number(a.target.value)||5)))})]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[y?(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[10.5px] font-semibold text-err",children:y}):(0,d.jsx)("span",{className:"flex-1"}),(0,d.jsx)("button",{className:"rounded-[8px] border border-line bg-bg px-2.5 py-1.5 text-[11.5px] font-semibold text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:b,children:c("common.cancel")}),(0,d.jsx)("button",{className:"rounded-[8px] border border-accent bg-accent px-3 py-1.5 text-[12px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",disabled:w,onClick:()=>void A(),children:w?c("flowDialog.creating"):c("flowDialog.start")})]})]})}let ek=k("infinity",[["path",{d:"M6 16c5 0 7-8 12-8a4 4 0 0 1 0 8c-5 0-7-8-12-8a4 4 0 1 0 0 8",key:"18ogeb"}]]),el={waiting_ready:{labelKey:"flowStrip.startReview",action:"advance"},spawn_pending:{labelKey:"flowStrip.spawnReviewer",action:"advance"},relay_pending:{labelKey:"flowStrip.relayNotes",action:"advance"},needs_decision:{labelKey:"flowStrip.retryRound",action:"retry-round"},done_comment:{labelKey:"flowStrip.anotherRound",action:"another-round"}},em=new Set(["spawning","reviewing","relaying","fixing"]),en=[1,2,3,4,5,0];function eo({flow:a,onFocusRound:b}){let{t:c}=v(),[f,g]=(0,e.useState)(!1),[h,i]=(0,e.useState)(null),[j,k]=(0,e.useState)(""),l=async(b,c)=>{if(f)return;g(!0),i(null);let d=await aa(a.id,{action:b,...c});d?i(d):c?.note!==void 0&&k(""),g(!1)},m=el[a.state],o=X.has(a.state),p="closed"===a.state||"approved"===a.state,q="waiting_ready"===a.state||"needs_decision"===a.state;return(0,d.jsxs)("div",{"data-scheme-ui":!0,className:`pointer-events-auto flex h-11 w-full items-center gap-3 rounded-[14px] border bg-panel/95 px-4 shadow-[0_2px_10px_rgb(20_20_30/0.08)] ${o?"border-[#e0ae45]/70":"border-line"}`,children:[(0,d.jsxs)("span",{className:"flex min-w-0 max-w-[38%] shrink-0 items-center gap-2",children:[(0,d.jsx)("span",{className:`h-2.5 w-2.5 shrink-0 rounded-full ${"approved"===a.state?"bg-ok":"needs_decision"===a.state?"bg-err":"paused"===a.state?"bg-[#e0ae45]":em.has(a.state)?"bg-ok animate-pulse":"bg-[#9a9aa4]"}`,"aria-hidden":!0}),(0,d.jsx)("span",{className:"shrink-0 text-[10.5px] font-bold tracking-[0.08em] text-dim",children:c("flowStrip.flow")}),(0,d.jsx)("span",{className:"shrink-0 text-[12px] font-bold",children:W(c,a.state)}),a.stateDetail?(0,d.jsx)("span",{className:"min-w-0 truncate text-[11.5px] font-semibold text-dim",title:a.stateDetail,children:a.stateDetail}):null]}),(0,d.jsx)("span",{className:"no-scrollbar flex min-w-0 flex-1 items-center justify-center gap-1.5 overflow-x-auto","aria-label":c("flowStrip.roundsAria"),children:a.rounds.map((a,e)=>{let f=_(a.verdict),g=null===a.verdict&&!a.error;return(0,d.jsxs)("span",{className:"flex shrink-0 items-center gap-1.5",children:[e>0?(0,d.jsx)("span",{className:"text-[10px] font-bold text-[#c9c9d1]","aria-hidden":!0,children:"→"}):null,(0,d.jsxs)("button",{className:`inline-flex h-6 items-center gap-1 rounded-full px-2 text-[10.5px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${g?"animate-pulse":""}`,style:{backgroundColor:f.soft,color:f.color},title:a.error?c("flowStrip.roundError",{n:a.n,error:a.error}):a.verdict?c("flowStrip.roundVerdict",{n:a.n,verdict:a.verdict})+(null!=a.findingsCount?` \xb7 ${c("roundDeck.findings",{count:a.findingsCount})}`:""):c("flowStrip.roundInProgress",{n:a.n}),onClick:()=>b?.(a.n),children:["R",a.n,(0,d.jsx)(dO,{verdict:a.verdict,error:!!a.error}),null!=a.findingsCount&&a.findingsCount>0?(0,d.jsx)("span",{children:a.findingsCount}):null]})]},a.n)})}),(0,d.jsxs)("span",{className:"flex shrink-0 items-center gap-1.5",children:[h?(0,d.jsx)("span",{className:"max-w-[220px] truncate text-[10.5px] font-semibold text-err",title:h,children:h}):null,f?(0,d.jsx)(ds,{className:"h-3.5 w-3.5 shrink-0 animate-spin text-dim","aria-hidden":!0}):null,q?(0,d.jsx)(bA,{label:c("flowStrip.noteTitle"),children:(0,d.jsx)("input",{className:"w-40 shrink-0 rounded-full border border-line bg-bg px-2.5 py-1 text-[10.5px] font-medium text-ink placeholder:text-dim/70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",value:j,placeholder:c("flowStrip.notePlaceholder"),onChange:a=>k(a.target.value),onKeyDown:a=>{"Enter"===a.key&&m&&l(m.action,{note:j})}})}):null,"reviewing"===a.state?(0,d.jsx)(bA,{label:c("flowStrip.stopReviewerTitle"),children:(0,d.jsxs)("button",{className:"inline-flex h-6 shrink-0 items-center gap-1 rounded-full border border-err/40 bg-[#fbeaea] px-2.5 text-[10.5px] font-bold text-err hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:f,onClick:()=>void l("cancel-round"),children:[(0,d.jsx)(bl,{className:"h-3 w-3","aria-hidden":!0})," ",c("flowStrip.stopReviewer")]})}):null,m?(0,d.jsx)("button",{className:"shrink-0 rounded-full border border-accent bg-accent px-3 py-1 text-[11px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",disabled:f,onClick:()=>void l(m.action,q?{note:j}:void 0),children:c(m.labelKey)}):null,p?null:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(bA,{label:c("flowStrip.limitTitle"),children:(0,d.jsxs)("span",{className:"flex shrink-0 items-center gap-0.5 rounded-full border border-line bg-bg p-0.5",children:[en.map(b=>{let e=a.roundLimit===b,g=0!==b&&b<a.rounds.length;return(0,d.jsx)("button",{className:`inline-flex h-5 min-w-5 items-center justify-center rounded-full px-1 text-[10px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-30 ${e?"bg-accent text-white":"text-dim hover:bg-panel hover:text-ink"}`,disabled:f||g,"aria-label":0===b?c("flowStrip.limitUnlimitedAria"):c("flowStrip.limitAria",{count:b}),"aria-pressed":e,onClick:()=>void l("set-round-limit",{rounds:b}),children:0===b?(0,d.jsx)(ek,{className:"h-3 w-3","aria-hidden":!0}):b},b)}),en.includes(a.roundLimit)?null:(0,d.jsx)("span",{className:"inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-accent px-1 text-[10px] font-bold text-white",children:a.roundLimit})]})}),(0,d.jsx)(bA,{label:"auto"===a.mode?c("flowStrip.autoTitle"):c("flowStrip.manualTitle"),children:(0,d.jsx)("button",{className:`shrink-0 rounded-full border px-2.5 py-1 text-[10px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40 ${"auto"===a.mode?"border-ok/40 bg-[#eef8f0] text-ok":"border-line bg-bg text-dim hover:text-ink"}`,disabled:f,onClick:()=>void l("set-mode",{mode:"auto"===a.mode?"manual":"auto"}),children:"auto"===a.mode?c("flowDialog.auto"):c("flowStrip.manualShort")})}),"paused"===a.state?(0,d.jsx)(bA,{label:c("flowStrip.resume"),children:(0,d.jsx)("button",{className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-ok hover:bg-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:f,"aria-label":c("flowStrip.resume"),onClick:()=>void l("resume"),children:(0,d.jsx)(bj,{className:"h-3.5 w-3.5","aria-hidden":!0})})}):(0,d.jsx)(bA,{label:c("flowStrip.pause"),children:(0,d.jsx)("button",{className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-dim hover:bg-bg hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:f,"aria-label":c("flowStrip.pause"),onClick:()=>void l("pause"),children:(0,d.jsx)(cX,{className:"h-3.5 w-3.5","aria-hidden":!0})})})]}),(0,d.jsx)(bA,{label:c("flowStrip.close"),children:(0,d.jsx)("button",{className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-dim hover:bg-bg hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:f,"aria-label":c("flowStrip.close"),onClick:()=>void l("close"),children:(0,d.jsx)(n,{className:"h-3.5 w-3.5","aria-hidden":!0})})})]})]})}function ep({role:a,active:b}){let{t:c}=v();return(0,d.jsxs)("div",{className:`pointer-events-none absolute -top-3 left-4 z-[12] flex h-6 items-center gap-1.5 rounded-full border px-2.5 shadow-card ${b?"border-ok/50 bg-[#eef8f0]":"border-line bg-panel"}`,children:[(0,d.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${b?"animate-pulse bg-ok":"bg-[#c2c2cb]"}`,"aria-hidden":!0}),(0,d.jsx)("span",{className:`text-[10px] font-bold tracking-[0.06em] ${b?"text-ok":"text-ink"}`,children:c("implementer"===a?"scheme.roleImplementer":"scheme.roleReviewer")}),(0,d.jsx)("span",{className:`text-[10px] font-semibold ${b?"text-ok":"text-dim"}`,children:c(b?"scheme.roleWorking":"scheme.roleWaiting")})]})}let eq="cubic-bezier(.22,.8,.36,1)",er=`transform 380ms ${eq}`,es=(0,e.memo)(function({edges:a,width:b,height:c}){return(0,d.jsx)("svg",{width:b,height:c,className:"absolute left-0 top-0","aria-hidden":!0,children:a.map(a=>{let b=Math.max(36,(a.y2-a.y1)*.5),c=`M ${a.x1} ${a.y1} C ${a.x1} ${a.y1+b}, ${a.x2} ${a.y2-b}, ${a.x2} ${a.y2-7}`,e=`M ${a.x2-5} ${a.y2-9} L ${a.x2+5} ${a.y2-9} L ${a.x2} ${a.y2-1} Z`;return(0,d.jsxs)("g",{opacity:a.live?.9:.5,children:[(0,d.jsx)("path",{d:c,style:{d:`path("${c}")`,transition:`d 380ms ${eq}`},fill:"none",stroke:a.color,strokeWidth:2.5,strokeLinecap:"round",strokeDasharray:a.dashed?"5 7":void 0}),(0,d.jsx)("circle",{cx:a.x1,cy:a.y1,r:3.5,fill:a.color,style:{cx:`${a.x1}px`,cy:`${a.y1}px`,transition:`cx 380ms ${eq}, cy 380ms ${eq}`}}),(0,d.jsx)("path",{d:e,style:{d:`path("${e}")`,transition:`d 380ms ${eq}`},fill:a.color})]},a.to)})})}),et=(0,e.memo)(function({loops:a,width:b,height:c}){return a.length?(0,d.jsx)("svg",{width:b,height:c,className:"absolute left-0 top-0","aria-hidden":!0,children:a.map(a=>{var b,c;let e="spawn_pending"===(b=a.flow).state||"spawning"===b.state||"reviewing"===b.state?"forward":"relay_pending"===b.state||"relaying"===b.state||"fixing"===b.state||"waiting_ready"===b.state&&b.rounds.length?"back":null,f="approved"===(c=a.flow).state?"#1a8a3e":Y.has(c.state)?"#5a51e0":X.has(c.state)?"#e0ae45":"#9a9aa4",g=a.y+150,h=a.y+330,i=(a.x1+a.x2)/2,j=(g+h)/2,k=`M ${a.x1} ${g} C ${a.x1+52} ${g-56}, ${a.x2-52} ${g-56}, ${a.x2-7} ${g}`,l=`M ${a.x2} ${h} C ${a.x2-52} ${h+56}, ${a.x1+52} ${h+56}, ${a.x1+7} ${h}`,m=`M ${a.x2-9} ${g-5} L ${a.x2-9} ${g+5} L ${a.x2-1} ${g} Z`,n=`M ${a.x1+9} ${h-5} L ${a.x1+9} ${h+5} L ${a.x1+1} ${h} Z`,o=(a,b)=>({d:a,fill:"none",stroke:b?"#5a51e0":"#c9c9d1",strokeWidth:b?3:2.5,strokeLinecap:"round",className:b?"loop-arc-live":void 0,style:{d:`path("${a}")`,transition:`d 380ms ${eq}`}}),p=a=>({d:`path("${a}")`,transition:`d 380ms ${eq}`});return(0,d.jsxs)("g",{children:[(0,d.jsx)("path",{...o(k,"forward"===e)}),(0,d.jsx)("path",{d:m,style:p(m),fill:"forward"===e?"#5a51e0":"#c9c9d1"}),(0,d.jsx)("path",{...o(l,"back"===e)}),(0,d.jsx)("path",{d:n,style:p(n),fill:"back"===e?"#5a51e0":"#c9c9d1"}),(0,d.jsx)("circle",{cx:i,cy:j,r:17,fill:"#ffffff",stroke:f,strokeWidth:2,style:{cx:`${i}px`,cy:`${j}px`,transition:`cx 380ms ${eq}, cy 380ms ${eq}`}}),(0,d.jsx)("text",{x:i,y:j+6,textAnchor:"middle",fontSize:17,fontWeight:700,fill:f,style:{x:`${i}px`,y:`${j+6}px`,transition:`x 380ms ${eq}, y 380ms ${eq}`},children:"⟳"})]},a.key)})}):null});function eu({file:a,onSelect:b}){let c=ar(a);return(0,d.jsxs)("button",{className:"flex h-8 w-full min-w-0 items-center gap-1.5 rounded-[8px] px-2 text-left hover:bg-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:w(a.title),onClick:()=>b(a),children:[(0,d.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${ad(a.activity)}`}),(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:c.style,children:c.label}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-semibold",children:w(a.cmdDesc||a.title,80)}),(0,d.jsx)("span",{className:"shrink-0 text-[10.5px] text-dim",children:ab(a.mtime)})]})}function ev({file:a}){let b=ar(a);return(0,d.jsx)("div",{className:"pointer-events-none absolute inset-0 z-[3] flex items-center justify-center",style:{opacity:"var(--label-o, 0)",transition:"opacity .25s"},"aria-hidden":!0,children:(0,d.jsxs)("div",{className:"flex max-w-[94%] items-center gap-[0.5em] rounded-[0.55em] border border-line bg-panel/95 px-[0.75em] py-[0.45em] shadow-[0_2px_14px_rgb(20_20_30/0.14)]",style:{fontSize:"calc(13px * min(var(--inv-z, 1), 2.6))"},children:[(0,d.jsx)("span",{className:`h-[0.6em] w-[0.6em] shrink-0 rounded-full ${ad(a.activity)}`}),(0,d.jsx)("span",{className:"shrink-0 rounded-full px-[0.45em] font-bold",style:{...b.style,fontSize:"0.72em"},children:b.label}),(0,d.jsx)("span",{className:"line-clamp-2 min-w-0 font-bold",children:w(a.title,70)})]})})}let ew=()=>void 0,ex=a=>a?" opacity-35":"";function ey({node:a,ringed:b,dimmed:c,flow:e}){let{t:f}=v(),g=ar(a.file);return(0,d.jsxs)("div",{"data-scheme-node":a.file.path,className:`scheme-enter absolute${ex(c)}`,style:{transform:`translate(${a.x}px, ${a.y}px)`,width:a.w,height:a.h,transition:er},children:[e?(0,d.jsx)("div",{className:"absolute -top-[60px] left-0 z-[4]",style:{width:1370},children:(0,d.jsx)(eo,{flow:e,onFocusRound:ew})}):null,a.under.length?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"absolute inset-x-4 -bottom-4 h-5 rounded-[10px] border border-line bg-panel/70 shadow-card","aria-hidden":!0}),(0,d.jsx)("div",{className:"absolute inset-x-2 -bottom-2 h-5 rounded-[10px] border border-line bg-panel/90 shadow-card","aria-hidden":!0})]}):null,(0,d.jsxs)("div",{className:`relative z-[1] flex h-full min-w-0 flex-col overflow-hidden rounded-[10px] border border-line bg-panel shadow-card ${b?"ring-2 ring-accent/60 ring-offset-2 ring-offset-bg":""}`,children:[(0,d.jsx)("span",{"aria-hidden":!0,className:"h-1 w-full shrink-0",style:ap(a.file)}),(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-2 border-b border-line px-3 py-2.5",children:[(0,d.jsx)("span",{className:`h-2.5 w-2.5 shrink-0 rounded-full ${ad(a.file.activity)}`}),(0,d.jsx)("span",{className:"shrink-0 rounded-full px-2 py-0.5 text-[11px] font-bold",style:g.style,children:g.label}),a.file.model?(0,d.jsx)("span",{className:"min-w-0 truncate font-mono text-[11px] text-dim",children:a.file.model}):null,(0,d.jsx)("span",{className:"ml-auto shrink-0 text-[11px] text-dim",children:ab(a.file.mtime)})]}),(0,d.jsx)("div",{className:"min-w-0 flex-1 px-3 py-2.5 text-[14px] font-semibold leading-snug",children:(0,d.jsx)("span",{className:"line-clamp-5",children:w(a.file.title,180)})}),a.under.length?(0,d.jsxs)("div",{className:"shrink-0 px-3 pb-2.5 text-[11px] font-semibold text-dim",children:[a.under.length," ",f("scheme.underneath")]}):null]}),e?(0,d.jsx)(ep,{role:"implementer",active:"implementer"===Z(e)}):null,(0,d.jsx)(ev,{file:a.file})]})}function ez({draft:a,ringed:b,dimmed:c}){let{t:e}=v();return(0,d.jsx)("div",{"data-scheme-node":a.key,className:`scheme-enter absolute${ex(c)}`,style:{transform:`translate(${a.x}px, ${a.y}px)`,width:a.w,height:a.h,transition:er},children:(0,d.jsx)("div",{className:`flex h-full items-center justify-center rounded-[10px] border border-dashed border-line bg-panel/70 ${b?"ring-2 ring-accent/60 ring-offset-2 ring-offset-bg":""}`,children:(0,d.jsxs)("span",{className:"flex items-center gap-1.5 text-[13px] font-semibold text-dim",children:[(0,d.jsx)("span",{className:"text-[15px] leading-none text-accent",children:"+"})," ",e("mobile.agent")]})})})}function eA({deck:a,dimmed:b}){let{t:c}=v(),e=a.rounds.at(-1)??null,f=e?.round??null,g=_(f?.verdict??null);return(0,d.jsxs)("div",{"data-scheme-node":a.key,className:`scheme-enter absolute${ex(b)}`,style:{transform:`translate(${a.x}px, ${a.y}px)`,width:a.w,height:a.h,transition:er},children:[(0,d.jsx)("div",{className:"flex h-full flex-col overflow-hidden rounded-[10px] border border-line bg-panel shadow-card",children:f?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5 border-b border-line px-3 py-2.5",style:{backgroundColor:g.soft,color:g.color},children:[(0,d.jsxs)("span",{className:"flex shrink-0 items-center gap-1 text-[12px] font-bold",children:["R",f.n," ",(0,d.jsx)(dO,{verdict:f.verdict,error:!!f.error,className:"h-3.5 w-3.5"})]}),(0,d.jsx)("span",{className:"min-w-0 truncate text-[11px] font-semibold",children:f.error?c("roundDeck.aborted"):f.verdict??c("roundDeck.reviewInProgress")})]}),(0,d.jsx)("div",{className:"min-w-0 flex-1 px-3 py-2.5 text-[13px] font-semibold leading-snug",children:(0,d.jsx)("span",{className:"line-clamp-4",children:e?.file?w(e.file.title,140):c("roundDeck.spawningReviewer")})}),a.rounds.length>1?(0,d.jsx)("div",{className:"shrink-0 px-3 pb-2.5 text-[11px] font-semibold text-dim",children:c("roundDeck.moreRounds",{count:a.rounds.length-1})}):null]}):(0,d.jsx)("div",{className:"flex flex-1 items-center justify-center text-[12px] font-semibold text-dim",children:c("roundDeck.waitingFirst")})}),(0,d.jsx)(ep,{role:"reviewer",active:"reviewer"===Z(a.flow)})]})}function eB({stack:a,dimmed:b,onSelect:c}){let{t:e}=v();return(0,d.jsx)("div",{"data-scheme-node":a.key,className:`scheme-enter absolute${ex(b)}`,style:{transform:`translate(${a.x}px, ${a.y}px)`,width:a.w,height:a.h,transition:er},children:(0,d.jsx)("div",{className:"flex h-full flex-col gap-1.5 overflow-y-auto rounded-[10px] border border-dashed border-[#c9c9d1] bg-panel/60 p-2",children:a.items.map(({file:a,branches:b})=>{let f=ar(a);return(0,d.jsxs)("button",{className:"flex min-h-[52px] w-full min-w-0 flex-col justify-center gap-0.5 rounded-[8px] border border-line bg-panel px-2 py-1 text-left shadow-card hover:border-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:w(a.title),onClick:()=>c(a),children:[(0,d.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,d.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${ad(a.activity)}`}),(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:f.style,children:f.label}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-semibold",children:w(a.title,70)})]}),(0,d.jsxs)("span",{className:"flex items-center gap-2 pl-3 text-[10.5px] text-dim",children:[(0,d.jsx)("span",{children:de(e,a.kind)}),(0,d.jsx)("span",{children:ab(a.mtime)}),b?(0,d.jsxs)("span",{children:["⤷ ",b]}):null]})]},a.path)})})})}function eC({node:a,ringed:b,marked:c,dimmed:f,dormant:g,flow:h,canFlow:i,onSelect:j,onClose:k,onFocusRound:l,onHandoff:m,onExpand:n}){let{t:o}=v(),[p,q]=(0,e.useState)(!1),[r,s]=(0,e.useState)(!1);return(0,d.jsxs)("div",{"data-scheme-node":a.file.path,"data-lasso-selected":c?"true":void 0,className:`scheme-enter absolute ${p||r?"z-20":""}${ex(f)}`,style:{transform:`translate(${a.x}px, ${a.y}px)`,width:a.w,height:a.h,transition:er},children:[c?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"absolute -right-2.5 -top-2.5 z-[5] flex h-6 w-6 items-center justify-center rounded-full border-2 border-bg bg-accent text-white shadow-card",children:(0,d.jsx)(a7,{className:"h-3.5 w-3.5","aria-hidden":!0})}),(0,d.jsx)("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 z-[4] rounded-[10px] bg-accent/[0.06]"})]}):null,h?(0,d.jsx)("div",{className:"absolute -top-[60px] left-0 z-[4]",style:{width:1370},children:(0,d.jsx)(eo,{flow:h,onFocusRound:a=>l(h.id,a)})}):i?(0,d.jsx)("div",{className:"absolute -top-11 left-0 z-[4]",children:(0,d.jsxs)("button",{"data-scheme-ui":!0,className:"inline-flex h-7 items-center gap-1 rounded-full border border-line bg-panel px-2.5 text-[11px] font-semibold text-dim shadow-card hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-expanded":r,title:o("scheme.flowTitle"),onClick:()=>s(a=>!a),children:[(0,d.jsx)("span",{className:"text-[13px] leading-none text-accent",children:"⟳"})," ",o("scheme.flow")]})}):null,r?(0,d.jsx)("div",{className:"absolute left-0 top-[-8px] z-40 -translate-y-full",children:(0,d.jsx)(ej,{file:a.file,onClose:()=>s(!1)})}):null,a.under.length?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"absolute inset-x-4 -bottom-4 h-5 rounded-[10px] border border-line bg-panel/70 shadow-card","aria-hidden":!0}),(0,d.jsx)("div",{className:"absolute inset-x-2 -bottom-2 h-5 rounded-[10px] border border-line bg-panel/90 shadow-card","aria-hidden":!0})]}):null,(0,d.jsx)("div",{className:`relative z-[1] flex h-full ${b?"rounded-[10px] ring-2 ring-accent/60 ring-offset-2 ring-offset-bg":""}`,children:(0,d.jsx)(dg,{file:a.file,tasks:a.tasks,isRoot:a.isRoot,dormant:g,onClose:()=>k(a.file.path),onToggleExpand:()=>n(a.file.path)})}),h?(0,d.jsx)(ep,{role:"implementer",active:"implementer"===Z(h)}):null,(0,d.jsx)(ev,{file:a.file}),m&&dT(a.file)?(0,d.jsx)(dU,{file:a.file,onHandoff:()=>m(a.file)}):null,a.under.length?(0,d.jsxs)("button",{className:"absolute -bottom-11 left-1/2 z-[2] inline-flex h-7 -translate-x-1/2 items-center gap-1.5 whitespace-nowrap rounded-full border border-line bg-panel px-2.5 text-[11px] font-semibold text-dim shadow-card hover:border-accent/40 hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-expanded":p,title:o("scheme.collapsedTitle"),onClick:()=>q(a=>!a),children:[(0,d.jsx)(eg,{className:"h-3.5 w-3.5","aria-hidden":!0}),a.under.length," ",o("scheme.underneath"),(0,d.jsx)(a8,{className:`h-3 w-3 transition-transform ${p?"rotate-90":""}`,"aria-hidden":!0})]}):null,p?(0,d.jsx)("div",{className:"absolute left-0 top-[calc(100%+52px)] z-30 max-h-[280px] w-full overflow-y-auto rounded-[10px] border border-line bg-panel p-1.5 shadow-[0_10px_36px_rgb(20_20_30/0.18)]",children:a.under.map(a=>(0,d.jsx)(eu,{file:a,onSelect:j},a.path))}):null]})}function eD({draft:a,project:b,files:c,ringed:e,dimmed:f,onDraftClose:g,onDraftSpawned:h}){return(0,d.jsx)("div",{"data-scheme-node":a.key,className:`scheme-enter absolute${ex(f)}`,style:{transform:`translate(${a.x}px, ${a.y}px)`,width:a.w,height:a.h,transition:er},children:(0,d.jsx)("div",{className:`flex h-full ${e?"rounded-[10px] ring-2 ring-accent/60 ring-offset-2 ring-offset-bg":""}`,children:aL(a.id)?(0,d.jsx)(dr,{draftId:a.id,project:b,onClose:()=>g(a.id),onLaunched:()=>g(a.id)}):(0,d.jsx)(dn,{draftId:a.id,project:b,files:c,onClose:()=>g(a.id),onSpawned:b=>h(a.id,b)})})})}function eE({deck:a,focus:b,dimmed:c,dormant:e}){let f=b&&b.flowId===a.flow.id?b.round+b.nonce/1e3:null;return(0,d.jsxs)("div",{"data-scheme-node":a.key,className:`scheme-enter absolute${ex(c)}`,style:{transform:`translate(${a.x}px, ${a.y}px)`,width:a.w,height:a.h,transition:er},children:[(0,d.jsx)(dR,{flow:a.flow,rounds:a.rounds,focusRound:f,dormant:e}),(0,d.jsx)(ep,{role:"reviewer",active:"reviewer"===Z(a.flow)})]})}let eF=(0,e.memo)(function({layout:a,project:b,files:c,interactive:e,lite:f,dormant:g,selected:h,multi:i,session:j,focus:k,attentionPaths:l,flowsByImpl:m,deckFocus:n,onSelect:o,onClose:p,onFocusRound:q,onDraftClose:r,onDraftSpawned:s,onHandoff:t,onExpand:u}){let v=a=>null!==l&&!a.rounds.some(a=>a.file&&l.has(a.file.path));return(0,d.jsxs)("div",{className:`${e?"":"pointer-events-none select-none"} ${j?"scheme-session":""}`.trim()||void 0,children:[a.stacks.map(a=>(0,d.jsx)(eB,{stack:a,dimmed:null!==l&&!a.items.some(a=>l.has(a.file.path)),onSelect:o},a.key)),a.decks.map(a=>f?(0,d.jsx)(eA,{deck:a,dimmed:v(a)},a.key):(0,d.jsx)(eE,{deck:a,focus:n,dimmed:v(a),dormant:g},a.key)),a.drafts.map(a=>f?(0,d.jsx)(ez,{draft:a,ringed:h===a.key||k===a.key,dimmed:null!==l},a.key):(0,d.jsx)(eD,{draft:a,project:b,files:c,ringed:h===a.key||k===a.key,dimmed:null!==l,onDraftClose:r,onDraftSpawned:s},a.key)),a.nodes.map(a=>f?(0,d.jsx)(ey,{node:a,ringed:h===a.file.path||k===a.file.path,dimmed:null!==l&&!l.has(a.file.path),flow:m.get(a.file.path)??null},a.file.path):(0,d.jsx)(eC,{node:a,ringed:j?i.has(a.file.path):h===a.file.path||k===a.file.path,marked:j&&i.has(a.file.path),dimmed:null!==l&&!l.has(a.file.path),dormant:g,flow:m.get(a.file.path)??null,canFlow:V(a.file,m),onSelect:o,onClose:p,onFocusRound:q,onHandoff:t,onExpand:u},a.file.path))]})}),eG="#d97757",eH=(0,e.memo)(function({edges:a,width:b,height:c,onRetry:e}){return a.length?(0,d.jsx)("svg",{width:b,height:c,className:"pointer-events-none absolute left-0 top-0 z-[2]",children:a.map(a=>{let b="source"===a.relation,c=a.failed?eG:b?"#0d8a72":dv[a.status].color,f=a.failed?.95:b?.4:.65,g=(a.x1+a.x2)/2,h=`M ${a.x1} ${a.y1} C ${g} ${a.y1}, ${g} ${a.y2}, ${a.x2} ${a.y2}`,i=(a.x1+a.x2)/2,j=(a.y1+a.y2)/2;return(0,d.jsxs)("g",{opacity:f,children:[(0,d.jsx)("path",{d:h,style:{d:`path("${h}")`,transition:`d 380ms ${eq}`},fill:"none",stroke:c,strokeWidth:b?1.75:2.5,strokeLinecap:"round",strokeDasharray:b?"2 6":"5 7"}),(0,d.jsx)("circle",{cx:a.x2,cy:a.y2,r:b?3:4,fill:c,style:{cx:`${a.x2}px`,cy:`${a.y2}px`,transition:`cx 380ms ${eq}, cy 380ms ${eq}`}}),a.failed&&"assignment"===a.relation?(0,d.jsxs)("g",{className:"pointer-events-auto cursor-pointer",role:"button","aria-label":`retry ${a.path}`,onClick:()=>e(a.taskId,a.path),children:[(0,d.jsx)("title",{children:a.error??""}),(0,d.jsx)("path",{d:h,fill:"none",stroke:"transparent",strokeWidth:22,style:{pointerEvents:"stroke"}}),(0,d.jsx)("circle",{cx:i,cy:j,r:11,fill:"#fff",stroke:eG,strokeWidth:2,style:{cx:`${i}px`,cy:`${j}px`,transition:`cx 380ms ${eq}, cy 380ms ${eq}`}}),(0,d.jsx)("text",{x:i,y:j+4.5,textAnchor:"middle",fontSize:13,fontWeight:700,fill:eG,style:{x:`${i}px`,y:`${j+4.5}px`,transition:`x 380ms ${eq}, y 380ms ${eq}`},children:"⚠"})]}):null]},a.key)})}):null});function eI(a,b){document.hasFocus()?b():window.addEventListener("focus",()=>a?.focus(),{once:!0})}function eJ({task:a,assignment:b,file:c,onDetach:e}){let{t:f}=v();if(!b.path)return(0,d.jsxs)("span",{className:"flex h-6 items-center gap-1.5 rounded-[6px] bg-white/55 px-1.5 text-[10.5px] font-semibold text-dim",children:[(0,d.jsx)(bv,{className:"h-3 w-3 shrink-0 animate-spin","aria-hidden":!0}),f("tasks.spawning")]});let g=!c,h="failed"===b.state,i="handoff"===b.state,j=c?ar(c):null,k=c?w(c.title,40):b.path.split("/").pop()??b.path,l=h?f("tasks.chipFailedTitle",{error:b.error??""}):g?f("tasks.deadChip"):i?f("tasks.handoffChip"):c?w(c.title):void 0;return(0,d.jsxs)("span",{className:`flex h-6 w-full min-w-0 items-center gap-1.5 rounded-[6px] px-1.5 ${h?"bg-[#faeee9] text-[#a04a2e]":g?"bg-white/45 text-dim opacity-70":"bg-white/55"}`,title:l,children:[i?(0,d.jsx)(bf,{className:"h-3 w-3 shrink-0 text-[#0d9488]","aria-hidden":!0}):null,c?(0,d.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${ad(c.activity)}`}):null,j?(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:j.style,children:j.label}):null,(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[10.5px] font-semibold",children:k}),h?(0,d.jsx)("span",{"aria-hidden":!0,children:"⚠"}):null,(0,d.jsx)("button",{type:"button",className:"flex h-4 w-4 shrink-0 items-center justify-center rounded-full text-dim hover:bg-black/5 hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":f("tasks.detachAria",{title:k}),title:f("tasks.detach"),onClick:()=>e(a,b.path),children:(0,d.jsx)(n,{className:"h-3 w-3","aria-hidden":!0})})]})}function eK({task:a,file:b}){let{t:c}=v(),e=a.source;if(!e)return null;let f=b?w(b.title,40):e.path.split("/").pop()??e.path,g=aq(e.engine);return(0,d.jsxs)("span",{className:"flex h-6 w-full min-w-0 items-center gap-1.5 rounded-[6px] bg-white/55 px-1.5 text-[#0d6f5f]",title:`${c("tasks.sourceTitle")}: ${e.text}`,children:[(0,d.jsx)(bf,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:g.style,children:g.label}),(0,d.jsx)("span",{className:"shrink-0 text-[10.5px] font-bold",children:c("tasks.source")}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[10.5px] font-semibold",children:f})]})}let eL=(0,e.memo)(function({task:a,files:b,camRef:c,handlers:f}){let{t:g}=v(),[h,i]=(0,e.useState)(null),j=(0,e.useRef)(null),[k,l]=(0,e.useState)(null),[m,n]=(0,e.useState)(!1),[o,p]=(0,e.useState)(""),[q,r]=(0,e.useState)(!1),[s,t]=(0,e.useState)(!1),u=(0,e.useRef)(null);(0,e.useEffect)(()=>{if(!s)return;let a=window.setTimeout(()=>t(!1),4e3);return()=>window.clearTimeout(a)},[s]),(0,e.useEffect)(()=>{if(!m)return;let b=window.setTimeout(()=>{o.trim()&&o!==a.text&&f.patch(a.id,{text:o})},900);return()=>window.clearTimeout(b)},[m,o,a.id,a.text,f]);let x=()=>{if(n(!1),!o.trim()){o!==a.text&&(r(!0),dC("err",g("tasks.emptyTextBlocked")));return}r(!1),o!==a.text&&f.patch(a.id,{text:o})},y=()=>(m?!o.trim():!!q)&&(dC("err",g("tasks.emptyTextBlocked")),!0),z=h??(k&&k.seen===a.updatedAt?k:a.pos),A=dv[a.status],B=dx(a.text)||g("tasks.untitled"),C=a.text.includes("\n")?a.text.slice(a.text.indexOf("\n")+1):"",D=new Map(b.map(a=>[a.path,a])),E=m||null!==h,F=bX({onDrop:b=>y()?null:(f.handoff(a,b.file),g("tasks.linkHanded",{title:w(b.file.title,48)})),onMiss:()=>{y()||f.draft(a)}});return(0,d.jsxs)("div",{"data-scheme-task":a.id,className:`group absolute pb-9 ${E?"z-30":"z-[4]"}`,style:{transform:`translate(${z.x}px, ${z.y}px)`,width:260,transition:h?void 0:`transform 380ms ${eq}`},onPointerDown:a=>{if(0===a.button&&!m&&!a.target.closest("button, a, input, textarea, select, [data-task-pop]")){j.current={sx:a.clientX,sy:a.clientY,ox:z.x,oy:z.y,moved:!1};try{a.currentTarget.setPointerCapture(a.pointerId)}catch{}}},onPointerMove:a=>{let b=j.current;if(!b)return;let d=a.clientX-b.sx,e=a.clientY-b.sy;if(!b.moved&&4>Math.hypot(d,e))return;b.moved=!0;let f=c.current?.z??1;i({x:b.ox+d/f,y:b.oy+e/f})},onPointerUp:b=>{let d=j.current;if(j.current=null,d){if(d.moved){let e=c.current?.z??1,g={x:Math.round(d.ox+(b.clientX-d.sx)/e),y:Math.round(d.oy+(b.clientY-d.sy)/e)};i(null),l({...g,seen:a.updatedAt}),f.patch(a.id,{pos:g}).then(a=>{a&&l(null)});return}m||((c.current?.z??1)<.55&&f.center(d7(a)),p(a.text),n(!0),requestAnimationFrame(()=>{let a=u.current;a&&(a.focus(),a.setSelectionRange(a.value.length,a.value.length))}))}},children:[(0,d.jsxs)("div",{className:`flex flex-col overflow-hidden rounded-[8px] border border-line shadow-card ${"done"===a.status?"opacity-60 saturate-50":""} ${m?"ring-2 ring-accent/50":""}`,style:{backgroundColor:A.soft},children:[(0,d.jsx)("div",{"aria-hidden":!0,className:"h-1 w-full shrink-0",style:{backgroundColor:A.color}}),m?(0,d.jsx)("textarea",{ref:u,value:o,onChange:a=>p(a.target.value),onBlur:()=>eI(u.current,x),onKeyDown:a=>{"Escape"===a.key&&(a.preventDefault(),x())},"aria-label":g("tasks.editAria"),rows:Math.min(16,Math.max(3,o.split("\n").length+1)),className:"w-full resize-none bg-transparent px-3 py-2 text-[12.5px] leading-[17px] text-[#26262c] placeholder:text-dim focus-visible:outline-none",maxLength:6e3}):(0,d.jsxs)("div",{"data-task-body":!0,className:"cursor-text overflow-y-auto px-3 py-2",style:{maxHeight:340},children:[(0,d.jsx)("div",{className:"whitespace-pre-wrap break-words text-[12.5px] font-bold leading-[17px] text-[#26262c]",children:B}),C.trim()?(0,d.jsx)("div",{className:"whitespace-pre-wrap break-words text-[12.5px] leading-[17px] text-[#3a3a42]",children:C}):null]}),a.source||a.assignments.length?(0,d.jsxs)("div",{className:"flex flex-col gap-1 px-2 pb-2",children:[(0,d.jsx)(eK,{task:a,file:a.source?D.get(a.source.path)??null:null}),a.assignments.map((b,c)=>(0,d.jsx)(eJ,{task:a,assignment:b,file:b.path?D.get(b.path)??null:null,onDetach:(a,b)=>f.unassign(a,b)},(b.path??"spawning")+"::"+c))]}):null]}),(0,d.jsxs)("div",{className:`absolute left-0 top-full flex -translate-y-8 items-center gap-1 ${E?"":"pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100"} transition-opacity`,children:[(0,d.jsxs)("button",{type:"button",className:"inline-flex h-7 touch-none items-center gap-1 rounded-full border border-line bg-panel px-2 text-[10.5px] font-semibold text-dim shadow-card hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:g("tasks.sendTitle"),onPointerDown:F.onPillPointerDown,onClick:()=>{F.consumeClick()||y()||f.draft(a)},children:[(0,d.jsx)(cY,{className:"h-3 w-3","aria-hidden":!0})," ",g("tasks.send")]}),(0,d.jsxs)("button",{type:"button",className:"inline-flex h-7 items-center rounded-full border px-2 text-[10.5px] font-bold shadow-card focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",style:{backgroundColor:"#fff",color:A.color,borderColor:A.color},title:g("tasks.statusTitle",{label:g(`tasks.status.${a.status}`)}),onClick:()=>{var b;let c;f.patch(a.id,{status:(b=a.status,c=dw.indexOf(b),dw[(c+1)%dw.length])})},children:[g("tasks.statusPrefix"),": ",g(`tasks.status.${a.status}`)]}),(0,d.jsxs)("button",{type:"button",className:`inline-flex h-7 items-center gap-1 rounded-full border px-2 text-[10.5px] font-semibold shadow-card focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${s?"border-err bg-err text-white":"border-line bg-panel text-dim hover:border-err/40 hover:text-err"}`,"aria-label":g("tasks.deleteAria",{title:B}),title:s?g("tasks.deleteConfirm"):g("tasks.delete"),onClick:()=>{s?(t(!1),f.remove(a.id)):t(!0)},children:[(0,d.jsx)(bn,{className:"h-3 w-3","aria-hidden":!0}),s?g("tasks.deleteConfirm"):null]})]}),F.overlay]})});function eM({pos:a,onCommit:b,onCancel:c}){let{t:f}=v(),[g,h]=(0,e.useState)(""),i=(0,e.useRef)(null),j=()=>{g.trim()?b(g):c()};return(0,d.jsx)("div",{"data-scheme-task":"new",className:"absolute z-30",style:{transform:`translate(${a.x}px, ${a.y}px)`,width:260},children:(0,d.jsxs)("div",{className:"flex flex-col overflow-hidden rounded-[8px] border border-line shadow-card ring-2 ring-accent/50",style:{backgroundColor:dv.inbox.soft},children:[(0,d.jsx)("div",{"aria-hidden":!0,className:"h-1 w-full shrink-0",style:{backgroundColor:dv.inbox.color}}),(0,d.jsx)("textarea",{ref:i,value:g,onChange:a=>h(a.target.value),onBlur:()=>eI(i.current,j),onKeyDown:a=>{"Escape"===a.key&&(a.preventDefault(),j())},placeholder:f("tasks.newPlaceholder"),"aria-label":f("tasks.editAria"),rows:4,className:"w-full resize-none bg-transparent px-3 py-2 text-[12.5px] leading-[17px] text-[#26262c] placeholder:text-dim focus-visible:outline-none",maxLength:6e3})]})})}function eN({task:a}){let{t:b}=v(),c=dv[a.status];return(0,d.jsxs)("div",{"data-scheme-task":a.id,className:`absolute overflow-hidden rounded-[8px] border border-line shadow-card ${"done"===a.status?"opacity-60 saturate-50":""}`,style:{transform:`translate(${a.pos.x}px, ${a.pos.y}px)`,width:260,height:d6(a),backgroundColor:c.soft},children:[(0,d.jsx)("div",{"aria-hidden":!0,className:"h-1 w-full",style:{backgroundColor:c.color}}),(0,d.jsx)("div",{className:"px-3 py-2 text-[12.5px] font-bold leading-[17px] text-[#26262c]",children:(0,d.jsx)("span",{className:"line-clamp-4 whitespace-pre-wrap break-words",children:dx(a.text)||b("tasks.untitled")})})]})}let eO=(0,e.memo)(function({tasks:a,files:b,interactive:c,lite:e,camRef:f,handlers:g,pending:h,onCreate:i,onCreateCancel:j}){return(0,d.jsxs)("div",{className:c?void 0:"pointer-events-none select-none",children:[a.map(a=>e?(0,d.jsx)(eN,{task:a},a.id):(0,d.jsx)(eL,{task:a,files:b,camRef:f,handlers:g},a.id)),h&&!e?(0,d.jsx)(eM,{pos:h,onCommit:i,onCancel:j}):null]})}),eP=(a,b)=>Math.hypot(a.x-b.x,a.y-b.y),eQ=new Set;function eR({active:a,title:b,onClick:c,children:e}){return(0,d.jsx)("button",{className:`inline-flex h-7 w-7 items-center justify-center rounded-[8px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${a?"bg-accent/10 text-accent":"text-dim hover:bg-bg hover:text-ink"}`,title:b,"aria-label":b,"aria-pressed":a,onClick:c,children:e})}function eS({project:a,groups:b,manual:c,files:f,flows:g,tasks:h,drafts:i,focus:j,ring:k,attentionPaths:l,onSelect:m,onNodePick:n,onClose:o,onDraftClose:p,onDraftSpawned:q,onHandoff:r,onTaskDraft:s}){let{t}=v(),u=!!n,[x,y]=(0,e.useState)(null),[z,A]=(0,e.useState)(eQ),[B,C]=(0,e.useState)(!1),D=(0,e.useMemo)(()=>dV(b,c,f,g,i),[b,c,f,g,i]),E=!u&&(B||z.size>0),F=(0,e.useCallback)(()=>{A(eQ),C(!1)},[]),G=(0,e.useCallback)(a=>{A(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[]),H=(0,e.useRef)(x),I=(0,e.useCallback)((a,b)=>{if(null===a){y(null),F();return}if(b&&D.byPath.has(a)&&D.nodes.some(b=>b.file.path===a)){y(null),A(b=>{let c=new Set(b),d=H.current;return d&&d!==a&&D.nodes.some(a=>a.file.path===d)&&c.add(d),c.has(a)?c.delete(a):c.add(a),c});return}y(a)},[D,F]),J=(0,e.useMemo)(()=>T(g),[g]),[K,L]=(0,e.useState)(null),M=K?D.nodes.find(a=>a.file.path===K)??null:null,[N,O]=(0,e.useState)(null),P=(0,e.useCallback)((a,b)=>{O(c=>({flowId:a,round:b,nonce:(c?.nonce??0)+1}))},[]),Q=k??j,R=(0,e.useRef)(m),S=(0,e.useRef)(n),U=(0,e.useRef)(o),V=(0,e.useRef)(p),W=(0,e.useRef)(q),X=(0,e.useRef)(r),Y=(0,e.useRef)(s),Z=(0,e.useCallback)(a=>{let b=S.current;b?b(a.path):R.current(a)},[]),$=(0,e.useCallback)(a=>U.current(a),[]),_=(0,e.useCallback)(a=>V.current(a),[]),aa=(0,e.useCallback)((a,b)=>W.current(a,b),[]),ab=(0,e.useCallback)(a=>X.current?.(a),[]),ac=(0,e.useCallback)(a=>L(a),[]),ad=(0,e.useRef)(E),ae=(0,e.useRef)(!1),af=(0,e.useCallback)((a,b)=>{var c,d;if(ae.current)return ae.current=!1,!0;if(!ad.current)return y(null),!0;let e=(c=D.nodes,d={x:a,y:b,w:0,h:0},c.filter(a=>a.x<=d.x+d.w&&a.x+a.w>=d.x&&a.y<=d.y+d.h&&a.y+a.h>=d.y).map(a=>a.file.path));return e.length?G(e[0]):F(),!0},[D,G,F]),ag=(0,e.useRef)(()=>!1),[ah,ai]=(0,e.useState)([]),[aj,ak]=(0,e.useState)(null),al=(0,e.useMemo)(()=>{let b=new Set(h.map(a=>a.id)),c=ah.filter(c=>!b.has(c.id)&&c.project===a);return c.length?[...h,...c]:h},[h,ah,a]),am=(0,e.useMemo)(()=>new Map(al.map(a=>["task::"+a.id,d7(a)])),[al]),an=(0,e.useMemo)(()=>(function(a,b){let c=[];for(let d of a){let a=d7(d),e=d8(a);if(d.source){let f=b.get(d.source.path);if(f){let b=d9(a,d8(f)),g=d9(f,e);c.push({key:d.id+"::source::"+d.source.path,taskId:d.id,relation:"source",path:d.source.path,x1:b.x,y1:b.y,x2:g.x,y2:g.y,status:d.status,failed:!1,error:null})}}for(let f of d.assignments){if(!f.path)continue;let g=b.get(f.path);if(!g)continue;let h=d9(a,d8(g)),i=d9(g,e);c.push({key:d.id+"::"+f.path,taskId:d.id,relation:"assignment",path:f.path,x1:h.x,y1:h.y,x2:i.x,y2:i.y,status:d.status,failed:"failed"===f.state,error:f.error})}}return c})(al,function(a){let b=new Map,c=({x:a,y:b,w:c,h:d})=>({x:a,y:b,w:c,h:d});for(let d of a.stacks)for(let a of d.items)b.set(a.file.path,c(d));for(let d of a.decks)for(let a of d.rounds){let e=a.file?.path??a.round.reviewerPath;e&&b.set(e,c(d))}for(let d of a.nodes)for(let a of d.under)b.set(a.path,c(d));for(let d of a.nodes)b.set(d.file.path,c(d));return b}(D)),[al,D]),ao=(0,e.useCallback)((a,b)=>{ak({x:Math.round(a-130),y:Math.round(b-14)})},[]),{cam:ap,vp:aq,viewportRef:ar,handLike:as,taskTool:at,setTaskTool:au,centerOn:av,panning:aw,glide:ax,setMode:ay,onPointerDown:az,onPointerMove:aA,onDoubleClick:aB,onClick:aD,zoomCenter:aE,zoomTo:aJ,fit:aK,fitRect:aL,jump:aM}=function({project:a,layout:b,mapMode:c,focus:d,onNodePick:f,setSelected:g,onBackgroundDown:h,onWorldTap:i,taskRects:j,onPlaceTask:k}){let l=(0,e.useRef)(null),m=(0,e.useRef)(null),[n,o]=(0,e.useState)({x:0,y:0,z:.5}),[p,q]=(0,e.useState)("select"),[r,s]=(0,e.useState)(!1),[t,u]=(0,e.useState)(!1),[v,w]=(0,e.useState)(!1),[x,y]=(0,e.useState)(!1),[z,A]=(0,e.useState)({w:1,h:1}),B=(0,e.useRef)(null),C=(0,e.useRef)(new Map),D=(0,e.useRef)(null);(0,e.useRef)(p),(0,e.useRef)(t),(0,e.useRef)(r);let E=(0,e.useRef)(k),F=(0,e.useRef)(null);(0,e.useRef)(null);let G=(0,e.useCallback)(a=>{s(!1),q(a),localStorage.setItem("llvSchemeMode",a)},[]),H=(0,e.useCallback)(a=>{let c=Math.min(Math.max(a.x,120-b.width*a.z),z.w-120),d=Math.min(Math.max(a.y,120-b.height*a.z),z.h-120);return c===a.x&&d===a.y?a:{...a,x:c,y:d}},[b.width,b.height,z]),I=(0,e.useRef)([]),J=(0,e.useRef)(null),K=(0,e.useCallback)(a=>{I.current.push(a),null==J.current&&(J.current=requestAnimationFrame(()=>{J.current=null;let a=I.current;I.current=[],o(b=>a.reduce((a,b)=>b(a),b))}))},[]),L=(0,e.useCallback)((a,b,c)=>{K(d=>{let e=Math.min(1.6,Math.max(.12,d.z*c));if(e===d.z)return d;let f=e/d.z;return H({z:e,x:a-(a-d.x)*f,y:b-(b-d.y)*f})})},[H,K]),M=(0,e.useCallback)(a=>{let b=l.current?.getBoundingClientRect();b&&L(b.width/2,b.height/2,a)},[L]),N=(0,e.useCallback)(a=>{let b=l.current?.getBoundingClientRect();b&&o(c=>{let d=Math.min(1.6,Math.max(.12,a));if(d===c.z)return c;let e=d/c.z,f=b.width/2,g=b.height/2;return H({z:d,x:f-(f-c.x)*e,y:g-(g-c.y)*e})})},[H]),O=(0,e.useCallback)(()=>{let a=l.current?.getBoundingClientRect();if(!a||!b.nodes.length&&!b.drafts.length)return null;let c=Math.min(1.6,Math.max(.12,Math.min((a.width-48)/b.width,(a.height-48)/b.height,1)));return{z:c,x:(a.width-b.width*c)/2,y:(a.height-b.height*c)/2}},[b]),P=(0,e.useCallback)(a=>{y(!0),o(a),F.current&&window.clearTimeout(F.current),F.current=window.setTimeout(()=>y(!1),500)},[]),Q=(0,e.useCallback)(()=>{let a=O();a&&P(a)},[O,P]),R=(0,e.useCallback)(a=>{let b=l.current?.getBoundingClientRect();if(!b||a.w<=0||a.h<=0)return;let c=Math.min(1.6,Math.max(.12,Math.min((b.width-48)/a.w,(b.height-48)/a.h,1)));P(H({z:c,x:(b.width-a.w*c)/2-a.x*c,y:(b.height-a.h*c)/2-a.y*c}))},[P,H]),S=(0,e.useCallback)((a,b)=>{let c=l.current?.getBoundingClientRect();c&&P(d=>{let e=Math.min(1.6,Math.max(d.z,b));return{z:e,x:c.width/2-(a.x+a.w/2)*e,y:Math.min(c.height/2-a.y*e,.08*c.height-(a.y-40)*e)}})},[P]);(0,e.useRef)(null);let T=a=>{let b=l.current?.getBoundingClientRect();return b?{x:a.clientX-b.left,y:a.clientY-b.top}:{x:a.clientX,y:a.clientY}},U=a=>{B.current={sx:a.clientX,sy:a.clientY,cx:n.x,cy:n.y},w(!0);try{l.current?.setPointerCapture(a.pointerId)}catch{}},V=c||"hand"===p||t,W=(0,e.useCallback)((a,b)=>o(c=>H({...c,x:z.w/2-a*c.z,y:z.h/2-b*c.z})),[z,H]);return{cam:n,vp:z,viewportRef:l,mode:p,setMode:G,handLike:V,taskTool:r,setTaskTool:s,centerOn:S,panning:v,glide:x,onPointerDown:a=>{let b=a.target;if(!b.closest("[data-scheme-ui]")){if(c&&a.isPrimary&&(m.current={x:a.clientX,y:a.clientY}),"touch"===a.pointerType&&(C.current.set(a.pointerId,T(a)),2===C.current.size)){let[a,b]=[...C.current.values()];D.current={d:eP(a,b),cx:(a.x+b.x)/2,cy:(a.y+b.y)/2},B.current=null,w(!1);return}if(1===a.button){a.preventDefault(),U(a);return}if(0===a.button){if(r&&!c&&E.current){let b=l.current?.getBoundingClientRect();if(b){a.preventDefault(),E.current((a.clientX-b.left-n.x)/n.z,(a.clientY-b.top-n.y)/n.z),s(!1),G("select");return}}if(!(c||"hand"===p||t)){if(b.closest("[data-scheme-task]"))return;let c=b.closest("[data-scheme-node]");if(c)return void g(c.getAttribute("data-scheme-node"),a.shiftKey||a.ctrlKey||a.metaKey);i&&a.isPrimary&&(m.current={x:a.clientX,y:a.clientY});let d=h?.(a)??!1;if(d&&"touch"!==a.pointerType||!d&&(g(null),b.closest("button, a, input, textarea, select")))return}U(a)}}},onPointerMove:a=>{if("touch"===a.pointerType&&C.current.has(a.pointerId)){C.current.set(a.pointerId,T(a));let b=D.current;if(b&&C.current.size>=2){let[a,c]=[...C.current.values()],d=eP(a,c),e=(a.x+c.x)/2,f=(a.y+c.y)/2,g=b.d>0?d/b.d:1;K(a=>{let c=Math.min(1.6,Math.max(.12,a.z*g)),d=c/a.z;return H({z:c,x:e-(b.cx-a.x)*d,y:f-(b.cy-a.y)*d})}),D.current={d,cx:e,cy:f};return}}let b=B.current;if(!b)return;let c=a.clientX-b.sx,d=a.clientY-b.sy;K(a=>H({...a,x:b.cx+c,y:b.cy+d}))},onDoubleClick:a=>{let c=a.target;if(c.closest("[data-scheme-ui]"))return;let d=c.closest("[data-scheme-node]");if(!d)return void Q();if("hand"!==p&&!t)return;let e=b.byPath.get(d.getAttribute("data-scheme-node")??"");e&&S(e,.9)},onClick:a=>{if(!f&&!i)return;let c=m.current;if(m.current=null,!c||Math.hypot(a.clientX-c.x,a.clientY-c.y)>9||a.target.closest("[data-scheme-ui]"))return;let d=l.current?.getBoundingClientRect();if(!d)return;let e=(a.clientX-d.left-n.x)/n.z,g=(a.clientY-d.top-n.y)/n.z;if(i?.(e,g)||!f)return;let h=((a,c)=>{let d=b=>a>=b.x&&a<=b.x+b.w&&c>=b.y&&c<=b.y+b.h;if(j){for(let[a,b]of j)if(d(b))return a}for(let a of b.nodes)if(d(a))return a.file.path;for(let a of b.drafts)if(d(a))return a.key;for(let a of b.stacks)if(d(a))return function(a,b){let c=Math.floor((b-a.y-8)/58);return a.items[Math.max(0,Math.min(c,a.items.length-1))]?.file??null}(a,c)?.path??null;for(let a of b.decks)if(d(a))return a.key;return null})(e,g);h&&f(h)},zoomCenter:M,zoomTo:N,fit:Q,fitRect:R,jump:W}}({project:a,layout:D,mapMode:u,focus:j,onNodePick:n,setSelected:I,onBackgroundDown:u?void 0:a=>(ae.current=!1,ag.current(a)),onWorldTap:u?void 0:af,taskRects:am,onPlaceTask:u?void 0:ao}),{marquee:aN,onBackgroundDown:aO}=function({viewportRef:a,cam:b,layout:c,enabled:d,session:f,onCommit:g}){let[h,i]=(0,e.useState)(null),j=(0,e.useRef)(null);(0,e.useRef)(b),(0,e.useRef)(c),(0,e.useRef)(g);let k=(0,e.useCallback)(b=>{let c=a.current?.getBoundingClientRect();return c?{x:b.clientX-c.left,y:b.clientY-c.top}:{x:b.clientX,y:b.clientY}},[a]);return{marquee:h,onBackgroundDown:(0,e.useCallback)(a=>{if(!d)return!1;if("touch"===a.pointerType)return f;if(!a.isPrimary||0!==a.button)return!1;let b=k(a);return j.current={sx:b.x,sy:b.y,additive:a.shiftKey,active:!1},!0},[d,f,k])}}({viewportRef:ar,cam:ap,layout:D,enabled:!u,session:E,onCommit:(0,e.useCallback)((a,b)=>{ae.current=!0,y(null),A(c=>{if(!b)return a.length?new Set(a):eQ;if(!a.length)return c;let d=new Set(c);for(let b of a)d.add(b);return d})},[])}),aP=(0,e.useMemo)(()=>D.nodes.filter(a=>z.has(a.file.path)),[D,z]),aQ=(0,e.useMemo)(()=>(function(a,b){let c=1/0,d=1/0,e=-1/0,f=-1/0,g=!1;for(let h of a)b.has(h.file.path)&&(g=!0,c=Math.min(c,h.x),d=Math.min(d,h.y),e=Math.max(e,h.x+h.w),f=Math.max(f,h.y+h.h));return g?{x:c,y:d,w:e-c,h:f-d}:null})(D.nodes,z),[D,z]),aR=(0,e.useRef)(aQ),aS=(0,e.useCallback)(()=>{aR.current&&aL(aR.current)},[aL]),aT=(0,e.useRef)(ap),aU=(0,e.useCallback)((a,b)=>void aI(a,b),[]),aV=(0,e.useMemo)(()=>({patch:async(a,b)=>{let c=await aF(a,b);return c&&dC("err",c),c},remove:a=>{ai(b=>b.some(b=>b.id===a)?b.filter(b=>b.id!==a):b),aG(a).then(a=>{a&&dC("err",a)})},handoff:async(a,b)=>{var c,d;let e=await aH(a.id,b.path);return"error"in e?(dC("err",e.error),e.error):(bR(b.path,(c=e.task.id,d=e.task.text,`Task #${c.slice(0,8)}: ${d}`)),null)},draft:a=>Y.current?.(a),unassign:async(a,b)=>{let c=await aI(a.id,b);c&&dC("err",c)},center:a=>av(a,.75)}),[av]),aW=(0,e.useCallback)(b=>{aj&&aC({project:a,text:b,pos:aj}).then(a=>{"error"in a?dC("err",a.error):(ai(b=>[...b,a.task]),ak(null))})},[a,aj]),aX=(0,e.useCallback)(()=>ak(null),[]),[aY,a$]=(0,e.useState)(!1),a_=24*ap.z;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{ref:ar,className:`relative min-h-0 flex-1 overflow-hidden ${aw?"cursor-grabbing select-none":at?"cursor-crosshair":as?"cursor-grab":""} ${as?"touch-none":""}`,onPointerDown:az,onPointerMove:aA,onDoubleClick:aB,onClick:aD,children:[(0,d.jsx)("div",{"aria-hidden":!0,className:"pointer-events-none absolute",style:{inset:-a_,backgroundImage:"radial-gradient(rgba(28,28,34,0.09) 1px, transparent 1px)",backgroundSize:`${a_}px ${a_}px`,transform:`translate(${(ap.x%a_+a_)%a_}px, ${(ap.y%a_+a_)%a_}px)`,willChange:"transform"}}),(0,d.jsxs)("div",{className:`absolute left-0 top-0 ${aw?"scheme-panning":""}`,style:{width:D.width,height:D.height,transform:`translate(${ap.x}px, ${ap.y}px) scale(${ap.z})`,transformOrigin:"0 0",transition:ax?`transform .45s ${eq}`:void 0,willChange:"transform","--inv-z":String(1/ap.z),"--label-o":ap.z<.45?"1":"0"},children:[(0,d.jsx)(es,{edges:D.edges,width:D.width,height:D.height}),(0,d.jsx)(et,{loops:D.loops,width:D.width,height:D.height}),(0,d.jsx)(eF,{layout:D,project:a,files:f,interactive:!as&&!E,lite:u,dormant:aY,selected:x,multi:z,session:E,focus:Q,attentionPaths:l??null,flowsByImpl:J,deckFocus:N,onSelect:Z,onClose:$,onFocusRound:P,onDraftClose:_,onDraftSpawned:aa,onHandoff:r?ab:void 0,onExpand:ac}),(0,d.jsx)(eH,{edges:an,width:D.width,height:D.height,onRetry:aU}),(0,d.jsx)(eO,{tasks:al,files:f,interactive:!as&&!E,lite:u,camRef:aT,handlers:aV,pending:aj,onCreate:aW,onCreateCancel:aX}),E&&aQ?(0,d.jsx)("div",{"aria-hidden":!0,className:"pointer-events-none absolute z-[6] rounded-[14px] border-2 border-dashed border-accent/60",style:{left:aQ.x-14,top:aQ.y-14,width:aQ.w+28,height:aQ.h+28},children:(0,d.jsx)("span",{className:"absolute -top-3 left-4 rounded-full border border-accent/50 bg-panel px-2 py-0.5 font-bold text-accent",style:{fontSize:"calc(11px * min(var(--inv-z, 1), 2.6))"},children:t("bulk.selectedCount",{count:z.size})})}):null]},a),aN?(0,d.jsxs)("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 z-30",children:[(0,d.jsx)("div",{className:"absolute rounded-[4px] border border-accent/70 bg-accent/10",style:{left:aN.rect.x,top:aN.rect.y,width:aN.rect.w,height:aN.rect.h}}),aN.candidates.map(a=>{let b=D.byPath.get(a);return b?(0,d.jsx)("div",{className:"absolute rounded-[10px] border-2 border-accent/70",style:{left:b.x*ap.z+ap.x,top:b.y*ap.z+ap.y,width:b.w*ap.z,height:b.h*ap.z}},a):null})]}):null,(0,d.jsxs)("div",{"data-scheme-ui":!0,className:"absolute left-3 top-3 z-40 flex items-center gap-1 rounded-[10px] border border-line bg-panel/95 p-1 shadow-card",children:[u?null:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(eR,{active:as&&!at,title:t("scheme.handTool"),onClick:()=>ay("hand"),children:(0,d.jsx)(dW,{className:"h-4 w-4","aria-hidden":!0})}),(0,d.jsx)(eR,{active:!as&&!E&&!at,title:t("scheme.selectTool"),onClick:()=>ay("select"),children:(0,d.jsx)(dX,{className:"h-4 w-4","aria-hidden":!0})}),(0,d.jsx)(eR,{active:E,title:t("scheme.lassoTool"),onClick:()=>{E?F():(ay("select"),C(!0))},children:(0,d.jsx)(dY,{className:"h-4 w-4","aria-hidden":!0})}),(0,d.jsx)(eR,{active:at,title:t("tasks.tool"),onClick:()=>au(!at),children:(0,d.jsx)(dZ,{className:"h-4 w-4","aria-hidden":!0})}),(0,d.jsx)("div",{className:"mx-0.5 h-5 w-px bg-line","aria-hidden":!0})]}),(0,d.jsx)(eR,{title:t("scheme.zoomOut"),onClick:()=>aE(.8),children:(0,d.jsx)(cq,{className:"h-4 w-4","aria-hidden":!0})}),(0,d.jsxs)("button",{className:"min-w-[46px] rounded-[8px] px-1 text-center text-[11px] font-semibold text-dim hover:bg-bg hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:t("scheme.zoom100"),onClick:()=>aJ(1),children:[Math.round(100*ap.z),"%"]}),(0,d.jsx)(eR,{title:t("scheme.zoomIn"),onClick:()=>aE(1.25),children:(0,d.jsx)(bz,{className:"h-4 w-4","aria-hidden":!0})}),(0,d.jsx)(eR,{title:t("scheme.fit"),onClick:aK,children:(0,d.jsx)(aZ,{className:"h-4 w-4","aria-hidden":!0})})]}),E?(0,d.jsx)(ed,{project:a,nodes:aP,flowsByImpl:J,onRemove:$,onFit:aS,onExit:F}):null,(0,d.jsx)(ef,{layout:D,tasks:al,cam:ap,vp:aq,onJump:aM})]}),M?(0,d.jsx)("div",{className:"fixed inset-0 z-40 flex flex-col bg-bg p-3",role:"dialog","aria-modal":"true","aria-label":w(M.file.title,90),children:(0,d.jsx)(dg,{file:M.file,tasks:M.tasks,isRoot:M.isRoot,expanded:!0,onToggleExpand:()=>L(null)})}):null]})}let eT={waiting:5,stalled:4,live:3,returned:2,done:1};function eU({project:a,groups:b,manual:c,files:f,flows:g,tasks:h,drafts:i,loaded:j,focus:k,onSelect:l,onClose:m,onDraftClose:o,onDraftSpawned:p,onHandoff:q}){let{t:r}=v(),[s,t]=(0,e.useState)(null),[u,w]=(0,e.useState)(!1),[x,y]=(0,e.useState)(null),z=(0,e.useRef)(null),A=(0,e.useRef)(null),B=(0,e.useMemo)(()=>dV(b,c,f,g,i),[b,c,f,g,i]),C=(0,e.useMemo)(()=>[...B.nodes.map(a=>({key:a.file.path,file:a.file,isRoot:a.isRoot,kind:"node"})),...B.decks.map(a=>({key:a.key,file:null,isRoot:!1,kind:"deck"})),...B.drafts.map(a=>({key:a.key,file:null,isRoot:!0,kind:"draft"}))],[B]),D=(0,e.useMemo)(()=>new Map(C.map(a=>[a.key,a])),[C]),E=(0,e.useMemo)(()=>{if(s&&D.has(s))return s;let a=null,b=-1;for(let c of C){if(!c.file)continue;let d=1e12*eT[ax(c.file)]+c.file.mtime;d>b&&(b=d,a=c)}return(a??C[0])?.key??null},[s,D,C]),F=(0,e.useMemo)(()=>B.nodes.find(a=>a.file.path===E)??null,[B,E]),G=(0,e.useMemo)(()=>B.decks.find(a=>a.key===E)??null,[B,E]),H=(0,e.useMemo)(()=>B.drafts.find(a=>a.key===E)??null,[B,E]),I=(0,e.useCallback)(a=>{if(!C.length)return;let b=C.findIndex(a=>a.key===E),c=C[Math.min(C.length-1,Math.max(0,(-1===b?0:b)+a))];c&&c.key!==E&&t(c.key)},[C,E]),J=(0,e.useCallback)(a=>{if(w(!1),a.startsWith("task::"))return void y({taskId:a.slice(6)});if(D.has(a))return void t(a);let b=f.find(b=>b.path===a);b&&l(b)},[D,f,l]);return(0,d.jsxs)("div",{className:"relative flex min-h-0 min-w-0 flex-1 flex-col",children:[C.length>1?(0,d.jsx)("div",{className:"flex shrink-0 items-center gap-1.5 overflow-x-auto border-b border-line bg-panel px-2 py-1.5",children:C.map(a=>(0,d.jsx)(eV,{entry:a,active:a.key===E,chipRef:a.key===E?A:void 0,onClick:()=>t(a.key)},a.key))}):null,(0,d.jsxs)("div",{className:"relative flex min-h-0 flex-1 flex-col p-1.5 pb-[max(0.375rem,env(safe-area-inset-bottom))]",children:[F?(0,d.jsxs)("div",{className:"relative flex min-h-0 flex-1",children:[(0,d.jsx)(dg,{file:F.file,tasks:F.tasks,isRoot:F.isRoot,onClose:()=>m(F.file.path),dragHandle:{onTouchStart:a=>{let b=a.touches[0];b&&(z.current={x:b.clientX,y:b.clientY})},onTouchEnd:a=>{let b=z.current;z.current=null;let c=a.changedTouches[0];if(!b||!c)return;let d=c.clientX-b.x,e=c.clientY-b.y;56>Math.abs(d)||Math.abs(d)<2*Math.abs(e)||I(d<0?1:-1)}}}),q&&dT(F.file)?(0,d.jsx)(dU,{file:F.file,onHandoff:()=>q(F.file)}):null]},F.file.path):G?(0,d.jsx)("div",{className:"relative min-h-0 flex-1",children:(0,d.jsx)(dR,{flow:G.flow,rounds:G.rounds,focusRound:null})},G.key):H?aL(H.id)?(0,d.jsx)(dr,{draftId:H.id,project:a,onClose:()=>o(H.id),onLaunched:()=>o(H.id)},H.key):(0,d.jsx)(dn,{draftId:H.id,project:a,files:f,onClose:()=>o(H.id),onSpawned:a=>p(H.id,a)},H.key):j?(0,d.jsx)("div",{className:"flex flex-1 items-center justify-center text-center text-[13px] text-dim",children:r("mobile.noConvos")}):(0,d.jsxs)("div",{className:"flex flex-1 items-center justify-center gap-2 text-center text-[13px] text-dim",children:[(0,d.jsx)(bv,{className:"h-4 w-4 animate-spin","aria-hidden":!0}),r("common.loading")]}),(0,d.jsx)(eW,{layout:B,tasks:h,current:E,onOpen:()=>w(!0)}),(0,d.jsxs)("button",{type:"button",className:"absolute bottom-[168px] right-4 z-30 inline-flex h-9 items-center gap-1 rounded-full border border-line bg-panel/95 px-2.5 text-[11px] font-bold text-ink shadow-card focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":r("tasks.panelToggleAria"),onClick:()=>y("list"),children:[(0,d.jsx)(aV,{className:"h-4 w-4 text-accent","aria-hidden":!0}),h.filter(a=>"done"!==a.status).length||null]})]}),u?(0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex flex-col bg-bg pb-[env(safe-area-inset-bottom)]",children:[(0,d.jsxs)("div",{className:"flex h-10 shrink-0 items-center gap-2 border-b border-line bg-panel px-3",children:[(0,d.jsx)("span",{className:"shrink-0 text-[13px] font-bold",children:r("mobile.map")}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] text-dim",children:a}),(0,d.jsx)("button",{type:"button",className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-[8px] border border-line bg-bg text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":r("mobile.closeMap"),onClick:()=>w(!1),children:(0,d.jsx)(n,{className:"h-4 w-4","aria-hidden":!0})})]}),(0,d.jsx)(eS,{project:a,groups:b,manual:c,files:f,flows:g,tasks:h,drafts:i,focus:null,ring:E,onSelect:l,onClose:m,onDraftClose:o,onDraftSpawned:p,onNodePick:J}),(0,d.jsx)("div",{className:"shrink-0 border-t border-line bg-panel px-3 py-1.5 text-center text-[11px] text-dim",children:r("mobile.tapNode")})]}):null,x?(0,d.jsx)(dL,{project:a,tasks:h,files:f,initialView:x,onClose:()=>y(null)}):null]})}function eV({entry:a,active:b,chipRef:c,onClick:e}){let{t:f}=v();if(!a.file){let g="deck"===a.kind;return(0,d.jsxs)("button",{ref:c,type:"button",className:`flex h-7 shrink-0 items-center gap-1 rounded-full border px-2.5 text-[11px] font-semibold ${b?"border-accent/60 bg-accent/10 text-ink":"border-dashed border-line bg-bg text-dim"}`,onClick:e,children:[(0,d.jsx)("span",{className:"text-[13px] leading-none text-accent",children:g?"R":"+"})," ",f(g?"scheme.flow":"mobile.agent")]})}let g=a.file,h=ax(g),i="waiting"===h||"stalled"===h,j=ar(g),k=w(g.title,60);return(0,d.jsxs)("button",{ref:c,type:"button",className:`flex h-7 shrink-0 items-center gap-1.5 rounded-full border px-2.5 text-[11px] font-semibold ${b?"border-accent/60 bg-accent/10 text-ink":i?"border-[#e0ae45]/60 bg-[#fff7e6] text-[#8a5a00]":"border-line bg-bg text-dim"}`,title:k,onClick:e,children:[(0,d.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${ad(g.activity)}`}),a.isRoot?null:(0,d.jsx)("span",{"aria-hidden":!0,children:"⤷"}),b?(0,d.jsx)("span",{className:"max-w-[52vw] truncate",children:k}):(0,d.jsxs)("span",{children:[i?"⏸ ":"",j.label]})]})}function eW({layout:a,tasks:b,current:c,onOpen:e}){let{t:f}=v(),g=Math.min(96/a.width,64/a.height),h=(96-a.width*g)/2,i=(64-a.height*g)/2;return(0,d.jsx)("button",{type:"button",className:"absolute bottom-[92px] right-4 z-30 overflow-hidden rounded-[10px] border border-line bg-panel/95 shadow-card focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",style:{width:96,height:64},"aria-label":f("mobile.openMap"),onClick:e,children:(0,d.jsx)("svg",{width:96,height:64,"aria-hidden":!0,children:(0,d.jsxs)("g",{transform:`translate(${h} ${i}) scale(${g})`,children:[a.stacks.map(a=>(0,d.jsx)("rect",{x:a.x,y:a.y,width:a.w,height:a.h,rx:24,fill:"#c9c9d1",opacity:.45},a.key)),a.drafts.map(a=>(0,d.jsx)("rect",{x:a.x,y:a.y,width:a.w,height:a.h,rx:24,fill:"#9a9aa4",opacity:.3,stroke:a.key===c?"#5a51e0":void 0,strokeWidth:a.key===c?5/g:void 0},a.key)),a.decks.map(a=>(0,d.jsx)("rect",{x:a.x,y:a.y,width:a.w,height:a.h,rx:24,fill:"#5a51e0",opacity:.35,stroke:a.key===c?"#5a51e0":void 0,strokeWidth:a.key===c?5/g:void 0},a.key)),a.nodes.map(a=>(0,d.jsx)("rect",{x:a.x,y:a.y,width:a.w,height:a.h,rx:24,fill:ao(a.file),opacity:"live"===a.file.activity?.85:.35,stroke:a.file.path===c?"#5a51e0":void 0,strokeWidth:a.file.path===c?5/g:void 0},a.file.path)),b.map(a=>(0,d.jsx)("circle",{cx:a.pos.x+130,cy:a.pos.y+d6(a)/2,r:3/g,fill:dv[a.status].color,opacity:"done"===a.status?.5:.95},a.id))]})})})}function eX(a){try{window.localStorage.setItem("llvArchived",JSON.stringify([...a]))}catch{}}function eY({data:a,onOpen:b}){let{t:c}=v(),f=a.waiting.length;(0,e.useRef)(f);let[g,h]=(0,e.useState)(!1);return(0,d.jsxs)("div",{className:"group absolute bottom-3 right-3 z-20",children:[a.livePreview.length?(0,d.jsx)("div",{className:"pointer-events-none mb-1.5 hidden w-[300px] rounded-[8px] border border-line bg-panel/95 px-3 py-2 shadow-card backdrop-blur group-focus-within:block group-hover:block",children:a.livePreview.map(a=>(0,d.jsxs)("div",{className:"flex min-w-0 gap-1.5 py-0.5 text-[10.5px]",children:[(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate font-semibold",children:a.title}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-dim",children:a.statusLine||c("status.working")})]},a.file.path))}):null,(0,d.jsxs)("button",{className:`ml-auto flex items-center gap-1.5 rounded-full border border-line bg-panel/95 px-2.5 py-1 text-[11.5px] font-bold shadow-card backdrop-blur transition-transform hover:border-accent/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 ${g?"scale-110 border-[#e0ae45]/70":""} motion-reduce:transition-none`,"aria-label":c("corner.openSwitchboard"),onClick:b,children:[(0,d.jsx)("span",{className:`h-2 w-2 rounded-full ${a.working.length?"animate-pulse bg-ok":"bg-dim"}`}),(0,d.jsx)("span",{children:a.working.length}),(0,d.jsx)("span",{className:f?"text-[#b8860b]":"text-dim",children:c("corner.waitingCount",{count:f})})]})]})}function eZ({file:a,title:b,project:c,currentProject:e,descendants:f,statusLine:g,size:h,tone:i,onOpen:j,onArchive:k}){let{t:l}=v(),m=ar(a),o="large"===h;return(0,d.jsxs)("article",{className:`group relative flex ${o?"h-[150px] w-[300px]":"h-[108px] w-[220px]"} shrink-0 flex-col rounded-[8px] border p-3 shadow-card transition-colors hover:border-accent/45 ${"working"===i?"border-ok/40 bg-[#f3fbf5] shadow-[0_0_0_3px_rgba(26,138,62,0.12)]":"stalled"===i?"border-err/35 bg-[#fff5f5]":"waiting"===i?"border-[#e0ae45]/45 bg-[#fff9ed]":"border-line bg-panel"}`,role:"button",tabIndex:0,"aria-label":l("switchCard.openColumn",{title:w(b,80)}),onClick:()=>j(a),onKeyDown:b=>{"Enter"===b.key&&j(a)},children:["live"===a.activity?null:(0,d.jsx)("button",{type:"button",className:"absolute right-1.5 top-1.5 z-10 hidden h-5 w-5 items-center justify-center rounded-full border border-line bg-bg text-dim hover:border-err/50 hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 group-hover:flex group-focus-within:flex","aria-label":l("switchCard.remove"),onClick:b=>{b.stopPropagation(),k(a)},onKeyDown:a=>a.stopPropagation(),children:(0,d.jsx)(n,{className:"h-3 w-3","aria-hidden":!0})}),(0,d.jsxs)("div",{className:"relative flex min-w-0 items-center gap-1.5",children:[(0,d.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${ad(a.activity)}`}),a.model?(0,d.jsx)("span",{className:"min-w-0 truncate rounded-full px-1.5 py-0.5 font-mono text-[9px] font-semibold",style:{backgroundColor:al(a).soft,color:al(a).color},title:[m.label,am(a)].filter(Boolean).join(" \xb7 "),children:a.model}):(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 text-[9.5px] font-bold",style:m.style,children:m.label}),(0,d.jsx)(b$,{file:a}),(0,d.jsx)("span",{className:`ml-auto min-w-0 truncate rounded-full border border-line bg-bg px-1.5 py-0.5 text-[9.5px] font-semibold ${c===e?"text-dim":"text-ink"}`,title:c,children:c})]}),(0,d.jsx)("div",{className:`relative mt-2 min-w-0 ${o?"text-[14px]":"text-[12.5px]"} font-bold leading-snug`,title:b,children:(0,d.jsx)("span",{className:"line-clamp-2",children:b})}),(0,d.jsxs)("div",{className:"relative mt-auto flex min-w-0 items-center gap-2 text-[10.5px] font-semibold text-dim",children:[(0,d.jsx)("span",{className:"shrink-0",children:ab(a.mtime)}),a.ctx?(0,d.jsx)(da,{ctx:a.ctx}):null,f?(0,d.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-0.5",children:[(0,d.jsx)(a_,{className:"h-3 w-3","aria-hidden":!0})," ",f]}):null]}),g?(0,d.jsx)("div",{className:`relative mt-1 min-w-0 truncate ${o?"text-[11.5px]":"text-[10.5px]"} font-semibold text-ink/75`,children:g}):null,a.pid&&"running"===a.proc?(0,d.jsx)("div",{className:"relative mt-2",onClick:a=>a.stopPropagation(),onKeyDown:a=>a.stopPropagation(),children:(0,d.jsx)(c_,{file:a,compact:!0})}):null]})}function e$({title:a,items:b,size:c,currentProject:e,onOpenFile:f,onArchive:g}){return b.length?(0,d.jsxs)("section",{className:"shrink-0",children:[(0,d.jsxs)("div",{className:"mb-2 flex items-baseline gap-2",children:[(0,d.jsx)("h2",{className:"text-[13px] font-bold",children:a}),(0,d.jsx)("span",{className:"text-[11px] font-semibold text-dim",children:b.length})]}),(0,d.jsx)(b_,{className:"flex flex-wrap gap-2.5",enter:"fade",children:b.map(a=>(0,d.jsx)("div",{"data-flip-key":a.file.path,children:(0,d.jsx)(eZ,{file:a.file,title:a.title,project:a.project,currentProject:e,descendants:a.descendants,statusLine:a.statusLine,size:c,tone:"working"===a.kind?"working":"waiting"===a.kind&&"stalled"===a.file.activity?"stalled":"waiting"===a.kind?"waiting":"quiet",onOpen:f,onArchive:g})},a.file.path))})]}):null}function e_({files:a,flows:b,project:c,loaded:f,onOpenFile:g}){let{t:h}=v(),[i,j]=(0,e.useState)(!1),[k,l]=(0,e.useState)(""),[m,o]=(0,e.useState)(!1),[p,q]=(0,e.useState)(!1),[r,s]=(0,e.useState)(0),t=(0,e.useRef)(null),u=function(){let[a,b]=(0,e.useState)([]),[c,d]=(0,e.useState)(!1);return{events:a,loading:c}}(),{archivedPaths:x,archive:y,unarchive:z}=function(){let[a,b]=(0,e.useState)(()=>new Set),c=(0,e.useRef)(a);return{archivedPaths:a,archive:(0,e.useCallback)(a=>{b(b=>{if(b.has(a))return b;let d=new Set(b);return d.add(a),c.current=d,eX(d),d})},[]),unarchive:(0,e.useCallback)(a=>{b(b=>{if(!b.has(a))return b;let d=new Set(b);return d.delete(a),c.current=d,eX(d),d})},[])}}(),A=au(a,u.events,k,r,x,b),B=au(a,[],"",r,x,b),C=(0,e.useMemo)(()=>a.filter(a=>x.has(a.path)).map(a=>({file:a,title:w(a.title),project:E(a)})).sort((a,b)=>b.file.mtime-a.file.mtime),[a,x]),D=a=>{g(a),j(!1)},F=a=>y(a.path);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(eY,{data:B,onOpen:()=>j(!0)}),i?(0,d.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-ink/28 p-[2.5vh]",onMouseDown:()=>j(!1),children:(0,d.jsxs)("div",{className:"flex h-[95vh] w-[95vw] flex-col overflow-hidden rounded-[8px] border border-line bg-bg shadow-[0_18px_70px_rgb(20_20_30/0.28)]",role:"dialog","aria-modal":"true","aria-label":h("switch.aria"),onMouseDown:a=>a.stopPropagation(),children:[(0,d.jsxs)("header",{className:"flex h-14 shrink-0 items-center gap-3 border-b border-line bg-panel px-4",children:[(0,d.jsx)("div",{className:"text-[15px] font-bold",children:h("switch.title")}),(0,d.jsx)("input",{ref:t,value:k,onChange:a=>l(a.target.value),placeholder:h("switch.search"),className:"h-9 min-w-0 flex-1 rounded-[8px] border border-line bg-bg px-3 text-[13px] outline-none focus-visible:ring-2 focus-visible:ring-accent/40"}),u.loading?(0,d.jsx)("span",{className:"text-[11px] font-semibold text-dim",children:h("switch.updating")}):null,(0,d.jsx)("button",{className:"inline-flex h-8 w-8 items-center justify-center rounded-[8px] border border-line bg-bg text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":h("switch.close"),onClick:()=>j(!1),children:(0,d.jsx)(n,{className:"h-4 w-4","aria-hidden":!0})})]}),(0,d.jsxs)("div",{className:"min-h-0 flex-1 space-y-5 overflow-y-auto px-4 py-4",children:[(0,d.jsx)(e$,{title:h("switch.waiting"),items:A.waiting,size:"large",currentProject:c,onOpenFile:D,onArchive:F}),(0,d.jsx)(e$,{title:h("switch.working"),items:A.working,size:"large",currentProject:c,onOpenFile:D,onArchive:F}),(0,d.jsx)(e$,{title:h("switch.recent"),items:A.recent,size:"small",currentProject:c,onOpenFile:D,onArchive:F}),(0,d.jsxs)("section",{className:"shrink-0",children:[(0,d.jsxs)("button",{className:"flex h-10 w-full items-center justify-between rounded-[8px] border border-line bg-panel px-3 text-left text-[12.5px] font-bold hover:border-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-expanded":m,onClick:()=>o(a=>!a),children:[(0,d.jsx)("span",{children:h("switch.older")}),(0,d.jsx)("span",{className:"text-dim",children:A.older.length})]}),m?(0,d.jsx)("div",{className:"mt-2",children:(0,d.jsx)(e$,{title:"",items:A.older,size:"small",currentProject:c,onOpenFile:D,onArchive:F})}):null]}),A.waiting.length||A.working.length||A.recent.length||A.older.length?null:f?(0,d.jsx)("div",{className:"pt-[18vh] text-center text-[13px] font-semibold text-dim",children:h("common.nothingFound")}):(0,d.jsxs)("div",{className:"flex items-center justify-center gap-2 pt-[18vh] text-[13px] font-semibold text-dim",children:[(0,d.jsx)(bv,{className:"h-4 w-4 animate-spin","aria-hidden":!0}),h("common.loading")]}),C.length?(0,d.jsxs)("section",{className:"shrink-0",children:[(0,d.jsxs)("button",{className:"flex h-9 w-full items-center justify-between rounded-[8px] border border-line bg-panel px-3 text-left text-[12px] font-bold text-dim hover:border-accent/40 hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-expanded":p,onClick:()=>q(a=>!a),children:[(0,d.jsx)("span",{children:h("switch.hidden",{count:C.length})}),(0,d.jsx)("span",{children:p?h("switch.hide"):h("common.show")})]}),p?(0,d.jsx)("div",{className:"mt-2 space-y-1",children:C.map(a=>(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-2 rounded-[8px] border border-line bg-panel/60 px-3 py-1.5 text-[11.5px] text-dim",children:[(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate",children:a.title}),(0,d.jsx)("span",{className:"shrink-0 truncate text-[10.5px]",children:a.project}),(0,d.jsx)("button",{className:"shrink-0 rounded-full border border-line bg-bg px-2 py-0.5 text-[10.5px] font-semibold text-ink hover:border-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>z(a.file.path),children:h("switch.restore")})]},a.file.path))}):null]}):null]})]})}):null]})}function e0(){location.hash="#p="+encodeURIComponent(x)}function e1({files:a,activeRootPaths:b,onOpen:c}){let{t:e}=v();return(0,d.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto px-4 py-5",children:(0,d.jsxs)("div",{className:"mx-auto w-full max-w-[760px]",children:[(0,d.jsx)("div",{className:"text-[13.5px] font-semibold text-dim",children:e("trash.title")}),(0,d.jsx)("div",{className:"mb-3 mt-0.5 text-[12px] text-dim",children:e("trash.hint")}),(0,d.jsx)("div",{className:"space-y-1.5",children:a.map(a=>(0,d.jsx)(e2,{file:a,activeSubtree:b?.has(a.path)??!1,onOpen:c},a.path))})]})})}function e2({file:a,activeSubtree:b,onOpen:c}){let{t:f}=v(),[g,h]=(0,e.useState)(!1),i=ar(a);return g?(0,d.jsxs)("div",{className:"flex items-center gap-2 rounded-[8px] border border-line bg-chip/60 px-3 py-1.5 text-[11.5px] font-semibold text-dim",children:[(0,d.jsx)(bn,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),(0,d.jsx)("span",{className:"min-w-0 truncate",children:w(a.title,80)}),(0,d.jsx)("span",{className:"shrink-0",children:f("trash.deletedFromDisk")})]}):(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-2 rounded-[8px] border border-line bg-panel px-3 py-1.5 shadow-card",children:[(0,d.jsxs)("button",{type:"button",className:"flex h-full min-w-0 flex-1 items-center gap-2 rounded-[6px] text-left hover:bg-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":f("trash.open",{title:w(a.title,60)}),onClick:()=>c(a),children:[(0,d.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${ad(a.activity)}`}),(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 text-[9.5px] font-bold",style:i.style,children:i.label}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12.5px] font-semibold",title:a.path,children:w(a.title,90)}),b?(0,d.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-full border border-accent/25 bg-accent/10 px-1.5 py-0.5 text-[10px] font-bold text-accent",title:f("trash.activeSubtree"),children:[(0,d.jsx)(a$,{className:"h-3 w-3","aria-hidden":!0}),f("trash.activeSubtree")]}):null,(0,d.jsx)("span",{className:"shrink-0 text-[10.5px] font-semibold text-dim",children:ab(a.mtime)}),(0,d.jsxs)("span",{className:"shrink-0 text-[10.5px] text-dim",children:[(a.size/1024).toFixed(0)," ",f("common.kb")]})]}),(0,d.jsx)(bZ,{file:a,onDeleted:()=>h(!0)})]})}function e3({files:a,onArchive:b,compact:c=!1}){let{t:e}=v();return!a.length||a.some(a=>"running"===a.proc||"live"===a.activity)?null:(0,d.jsxs)("button",{type:"button",className:`inline-flex shrink-0 items-center gap-1 rounded-full border border-line bg-bg text-[11px] font-semibold text-dim hover:border-accent/40 hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${c?"p-1":"px-2 py-0.5"}`,"aria-label":e("trash.toArchive"),title:e("trash.toArchive"),onClick:()=>{b(),e0()},children:[(0,d.jsx)(a0,{className:"h-3 w-3","aria-hidden":!0})," ",c?null:e("trash.toArchive")]})}function e4({files:a}){let{t:b}=v(),[c,f]=(0,e.useState)(!1),[g,h]=(0,e.useState)(!1),[i,j]=(0,e.useState)("");if(!a.length||a.some(a=>"running"===a.proc||"live"===a.activity))return null;let k=async()=>{h(!0),j("");let c=0;for(let b of a)try{let a=await fetch(`/api/log?path=${encodeURIComponent(b.path)}`,{method:"DELETE"}),d=await a.json();a.ok&&d.ok||(c+=1)}catch{c+=1}(h(!1),f(!1),c)?j(b("trash.notDeleted",{failed:c,total:a.length})):e0()};return c?(0,d.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-[10px] border border-err/30 bg-[#fff5f5] px-1.5 py-0.5 text-[11px]",children:[(0,d.jsx)("span",{className:"px-0.5 font-semibold text-err",children:b("trash.confirmDelete",{count:a.length})}),(0,d.jsx)("button",{type:"button",className:"rounded-lg bg-err px-2 py-0.5 font-bold text-white disabled:opacity-60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-err/50",disabled:g,onClick:k,children:g?b("trash.deleting"):b("trash.confirmYes")}),(0,d.jsx)("button",{type:"button",className:"rounded-lg border border-line bg-panel px-2 py-0.5 font-semibold text-dim focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>f(!1),children:b("common.cancel")})]}):(0,d.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1.5",children:[(0,d.jsx)("button",{type:"button",className:"inline-flex items-center rounded-full border border-line bg-bg p-1 text-dim hover:border-err/40 hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":b("trash.deleteProject"),title:b("trash.deleteProject"),onClick:()=>f(!0),children:(0,d.jsx)(bn,{className:"h-3 w-3","aria-hidden":!0})}),i?(0,d.jsx)("span",{className:"max-w-[180px] truncate text-[10.5px] font-semibold text-err",children:i}):null]})}let e5=k("volume-2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]),e6=k("volume-x",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]]);function e7(){let{t:a}=v(),[b,c]=(0,e.useState)(!0);return(0,d.jsx)("button",{className:"ml-auto inline-flex h-[26px] w-[26px] shrink-0 items-center justify-center rounded-full border border-line bg-panel text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:a(b?"sound.on":"sound.off"),"aria-label":a(b?"sound.mute":"sound.unmute"),"aria-pressed":b,onClick:()=>{let a=!b;c(a);try{localStorage.setItem(ay,a?"on":"off")}catch{}a&&function(a=0){(function(){try{localStorage.getItem(ay)}catch{return!0}})()}()},children:b?(0,d.jsx)(e5,{className:"h-3.5 w-3.5","aria-hidden":!0}):(0,d.jsx)(e6,{className:"h-3.5 w-3.5","aria-hidden":!0})})}function e8({items:a,activeRootPaths:b,onSelect:c}){let{t:f}=v(),[g,h]=(0,e.useState)(!1);return(0,d.jsxs)("div",{className:"shrink-0 border-t border-line bg-panel",children:[(0,d.jsxs)("button",{className:"flex h-8 items-center gap-2 px-4 text-[10px] font-bold uppercase tracking-[.6px] text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-expanded":g,onClick:()=>h(a=>!a),children:[(0,d.jsx)(a8,{className:`h-3.5 w-3.5 transition-transform ${g?"rotate-90":""}`,"aria-hidden":!0}),f("tree.quiet"),(0,d.jsx)("span",{className:"font-semibold normal-case tracking-normal",children:a.length})]}),g?(0,d.jsx)(b_,{className:"flex max-h-44 flex-wrap items-start gap-1.5 overflow-y-auto px-3 pb-2.5",children:a.map(a=>{let e=ar(a),g=w(a.cmdDesc||a.title,70),h=b?.has(a.path)??!1;return(0,d.jsxs)("button",{"data-flip-key":a.path,className:"inline-flex h-7 max-w-[360px] items-center gap-1.5 rounded-full border border-line bg-bg px-2 text-[11px] font-semibold text-ink hover:border-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:w(a.title),onClick:()=>c(a),children:[(0,d.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${ad(a.activity)}`}),(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px]",style:e.style,children:e.label}),(0,d.jsx)("span",{className:"truncate",children:g}),h?(0,d.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-full bg-accent/10 px-1.5 text-[9px] font-bold text-accent",title:f("trash.activeSubtree"),children:[(0,d.jsx)(a$,{className:"h-2.5 w-2.5","aria-hidden":!0}),f("trash.activeSubtree")]}):null,(0,d.jsx)("span",{className:"shrink-0 font-normal text-dim",children:ab(a.mtime)})]},a.path)})}):null]})}let e9=a=>`llvCols:${a}`;function fa(a,b){let c=function(a){try{let b=JSON.parse(localStorage.getItem(e9(a))??"{}");return{manual:b.manual??[],hidden:b.hidden??[]}}catch{return{manual:[],hidden:[]}}}(a);c.manual.includes(b)||c.manual.push(b),c.hidden=c.hidden.filter(a=>a!==b),localStorage.setItem(e9(a),JSON.stringify(c))}function fb(a){location.hash="#p="+encodeURIComponent(a)}function fc({files:a,flows:b,workflows:c,tasks:f,project:g,loaded:h,openNonce:i,focusRequest:j,attentionPaths:k,archived:l,onArchive:m,onUnarchive:n,onMenu:o,attention:p}){let{t:q}=v(),r=aS(),s=(0,e.useRef)(null),t=(0,e.useRef)(null),[u,w]=(0,e.useState)({manual:[],hidden:[]}),[x,B]=(0,e.useState)([]),[F,G]=(0,e.useState)("scheme"),[K,N]=(0,e.useState)(null),[O,P]=(0,e.useState)(!1),[Q,R]=(0,e.useState)([]),S=(0,e.useRef)(u),T=()=>{P(a=>(localStorage.setItem("llvTaskPanel",a?"0":"1"),!a))},V=a=>{S.current=a,w(a),localStorage.setItem(e9(g),JSON.stringify(a))},W=(0,e.useMemo)(()=>{let c=U(b);return c.size?a.filter(a=>!c.has(a.path)):a},[a,b]),X=(0,e.useMemo)(()=>{let b;return b=new Set(a.filter(a=>a.project===g).map(a=>a.path)),c.filter(a=>"closed"!==a.state&&(!!(a.project===g||a.stageRuns.some(a=>a.agentPath&&b.has(a.agentPath)))||!!(a.fixerPath&&b.has(a.fixerPath))))},[c,g,a]),Y=(0,e.useMemo)(()=>M(W,g),[W,g]),Z=(0,e.useMemo)(()=>new Set(Y.map(a=>a.key)),[Y]),$=(0,e.useMemo)(()=>(function(a,b,c){let d=I(a),e=[];for(let f of a){if(E(f)!==b||!A(f)||c.has(f.path))continue;let a=J(f,d);if(!a.length)continue;let g=f.mtime,h=z(f);for(let b of a)g=Math.max(g,b.mtime),h=Math.min(h,z(b));e.push({root:f,branchCount:a.length,smt:g,band:h})}return e.sort((a,b)=>a.band-b.band||b.smt-a.smt)})(W,g,Z),[W,g,Z]),_=(0,e.useMemo)(()=>(function(a,b,c){let d=I(a),e=new Set;for(let f of a)E(f)===b&&A(f)&&c.has(f.path)&&"idle"===f.activity&&J(f,d).some(L)&&e.add(f.path);return e})(W,g,Z),[W,g,Z]),aa=(0,e.useMemo)(()=>(function(a,b,c,d=new Set){let e=I(a);return a.filter(a=>E(a)===b&&!a.parent&&(!!d.has(a.path)||!(c.has(a.path)||e.get(a.path)?.length)&&"live"!==a.activity)).sort((a,b)=>z(a)-z(b)||b.mtime-a.mtime)})(W,g,Z,_),[W,g,Z,_]),ab=(0,e.useMemo)(()=>new Set(Y.flatMap(a=>a.columns.map(a=>a.file.path))),[Y]),ac=(0,e.useMemo)(()=>new Set(u.hidden),[u.hidden]),ad=(0,e.useMemo)(()=>f.filter(a=>a.project===g),[f,g]),ae=(0,e.useMemo)(()=>{let a=new Map(W.map(a=>[a.path,a]));return u.manual.map(b=>a.get(b)).filter(a=>void 0!==a&&E(a)===g&&!ab.has(a.path)&&!ac.has(a.path))},[u.manual,W,g,ab,ac]),af=(0,e.useMemo)(()=>{let a=new Map(W.map(a=>[a.path,a])),b=new Set(ae.map(a=>a.path)),c=Q.map(b=>a.get(b)).filter(a=>void 0!==a&&E(a)===g&&!b.has(a.path)&&(!ab.has(a.path)||ac.has(a.path)));return c.length?[...ae,...c]:ae},[Q,W,g,ab,ac,ae]),ag=(0,e.useMemo)(()=>Y.reduce((a,b)=>a+b.columns.reduce((a,b)=>a+ +("live"===b.file.activity)+b.tasks.filter(a=>"live"===a.activity).length,0),0),[Y]),ah=Y.filter(a=>!a.orphanTask).length,ai=a=>{N(a),s.current&&window.clearTimeout(s.current),s.current=window.setTimeout(()=>N(null),1800)},aj=a=>{B(a),sessionStorage.setItem(`llvDrafts:${g}`,JSON.stringify(a))},ak=()=>"function"==typeof crypto.randomUUID?crypto.randomUUID():Date.now().toString(36)+Math.random().toString(36).slice(2,10),al=()=>{let a=ak();aj([...x,a]),t.current="draft::"+a},am=a=>{let b=x.find(b=>""===a.path);if(b)return void ai("draft::"+b);let c=ak();dm(c,"src",a.path),aj([...x,c]),t.current="draft::"+c},an=a=>{if(aL(a))for(let b of["template","dir","task","mode"])sessionStorage.removeItem(dp(a,b));else for(let b of["engine","cwd","text","boot","src","effort","speed"])sessionStorage.removeItem(dl(a,b));aj(x.filter(b=>b!==a))},ao=(a,b)=>{an(a),aq(b)},ap=a=>{fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"kill",path:a})}).catch(()=>{}),V({manual:u.manual.filter(b=>b!==a),hidden:ab.has(a)?[...new Set([...u.hidden,a])]:u.hidden}),R(b=>b.includes(a)?b.filter(b=>b!==a):b)},aq=a=>{let b=E(a);if(b!==g){fa(b,a.path),fb(b);return}if(ab.has(a.path)&&!ac.has(a.path)||ae.some(b=>b.path===a.path))return void ai(a.path);let c=u.hidden.filter(b=>b!==a.path);V({manual:ab.has(a.path)?u.manual:[...new Set([...u.manual,a.path])],hidden:c}),t.current=a.path},ar=[];ag?ar.push(`${q("dash.branchesLive",{count:ag})} \xb7 ${q("dash.trees",{count:ah})}`):ah&&ar.push(q("dash.recentConvos",{count:ah})),$.length&&ar.push(q("dash.quietTrees",{count:$.length}));let as=Y.map(a=>({...a,columns:a.columns.filter(a=>!ac.has(a.file.path))})).filter(a=>a.columns.length),at=as.filter(a=>a.orphanTask).map(a=>a.columns[0].file),au=as.filter(a=>!a.orphanTask),av=au.length>0||af.length>0||x.length>0||ad.length>0,aw=(0,e.useMemo)(()=>a.filter(a=>E(a)===g).sort((a,b)=>b.mtime-a.mtime),[a,g]),ax=(0,e.useMemo)(()=>av?[]:function(a,b,c=100){let d=new Map(a.map(a=>[a.path,a])),e=I(a),f=new Set(a.filter(a=>E(a)===b).sort((a,b)=>b.mtime-a.mtime||a.path.localeCompare(b.path)).slice(0,c).map(a=>a.path)),g=new Set;for(let a of f){let c=d.get(a)??null,e=new Set;for(;c&&E(c)===b&&!e.has(c.path);)e.add(c.path),g.add(c.path),c=c.parent?d.get(c.parent)??null:null}let h=new Map,i=new Map;for(let a of g){let c=d.get(a);if(!c)continue;let e=H(c,d);E(e)===b&&(D(e)?i.set(e.path,e):h.set(e.path,e))}let j=[];for(let a of h.values()){let c=J(a,e).filter(a=>g.has(a.path)&&E(a)===b).sort((a,b)=>z(a)-z(b)||b.mtime-a.mtime||a.path.localeCompare(b.path)),d=c.filter(a=>!D(a)&&C(a)),f=new Set([a.path,...d.map(a=>a.path)]),h=[a,...d].map(a=>({file:a,tasks:[]})),i=c.filter(a=>!f.has(a.path)),k=Math.max(a.mtime,...c.map(a=>a.mtime));j.push({key:a.path,columns:h,returnable:[],finished:i,smt:k,orphanTask:!1})}for(let a of i.values())j.push({key:a.path,columns:[{file:a,tasks:[]}],returnable:[],finished:[],smt:a.mtime,orphanTask:!0});return j.sort((a,b)=>y(b.smt)-y(a.smt)||a.key.localeCompare(b.key))}(W.filter(a=>!ac.has(a.path)),g,100),[av,W,ac,g]),ay=ax.length>0,az=!av&&ay&&aw.length>0,aA=av||ay&&(!az||"scheme"===F);return(0,d.jsxs)("div",{className:"relative flex min-h-0 min-w-0 flex-1 flex-col",children:[(0,d.jsxs)("div",{className:"flex h-10 shrink-0 items-center gap-2.5 border-b border-line bg-panel px-4",children:[o?(0,d.jsx)("button",{type:"button",className:"-ml-1.5 flex h-7 w-7 shrink-0 items-center justify-center rounded-[8px] border border-line bg-bg text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":q("dash.openProjects"),onClick:o,children:(0,d.jsx)(aT,{className:"h-4 w-4","aria-hidden":!0})}):null,(0,d.jsx)("h1",{className:"truncate text-[13.5px] font-bold",children:g}),r?null:(0,d.jsx)("span",{className:"truncate text-[11.5px] text-dim",children:ar.length?ar.join(" \xb7 "):q("common.nothingRunning")}),(0,d.jsx)(e7,{}),l?(0,d.jsxs)("button",{type:"button",className:"inline-flex shrink-0 items-center gap-1 rounded-full border border-line bg-bg px-2 py-0.5 text-[11px] font-semibold text-dim hover:border-accent/40 hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>n(g),children:[(0,d.jsx)(a1,{className:"h-3 w-3","aria-hidden":!0})," ",q("dash.unarchive")]}):(0,d.jsx)(e3,{files:aw,onArchive:()=>m(g),compact:r}),(0,d.jsx)(e4,{files:aw}),r?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"ml-auto","aria-hidden":!0}),p,(0,d.jsxs)("button",{type:"button",onClick:al,"aria-label":q("dash.newConvo"),className:"flex shrink-0 items-center gap-1 rounded-[8px] border border-line bg-panel px-2.5 py-1 text-[11.5px] font-bold text-ink shadow-card hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[(0,d.jsx)("span",{className:"text-[13px] leading-none text-accent",children:"+"})," ",q("dash.agent")]})]}):(0,d.jsxs)("button",{type:"button",onClick:T,"aria-pressed":O,"aria-label":q("tasks.panelToggleAria"),className:`ml-auto flex shrink-0 items-center gap-1 rounded-[8px] border px-2.5 py-1 text-[11.5px] font-bold shadow-card focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${O?"border-accent/45 bg-accent/10 text-accent":"border-line bg-panel text-ink hover:border-accent/45 hover:text-accent"}`,children:[(0,d.jsx)(aV,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",q("tasks.panelTitle"),ad.filter(a=>"done"!==a.status).length?(0,d.jsx)("span",{className:"rounded-full bg-accent/10 px-1.5 text-[10px] font-bold text-accent",children:ad.filter(a=>"done"!==a.status).length}):null]}),(0,d.jsxs)("button",{type:"button",onClick:()=>{let a="wf-"+ak();aj([...x,a]),t.current="draft::"+a},"aria-label":q("dash.newWorkflow"),className:"flex shrink-0 items-center gap-1 rounded-[8px] border border-line bg-panel px-2.5 py-1 text-[11.5px] font-bold text-ink shadow-card hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[(0,d.jsx)("span",{className:"text-[13px] leading-none text-accent",children:"+"})," ",q("dash.workflow")]})]}),X.length?(0,d.jsx)("div",{className:"flex shrink-0 flex-col gap-1.5 border-b border-line bg-[#fbfbfd] px-3 py-1.5",children:X.map(a=>(0,d.jsx)(du,{wf:a},a.id))}):null,at.length?(0,d.jsx)("div",{className:"shrink-0 border-b border-line bg-[#fbfbfd]",children:at.map(a=>(0,d.jsx)("div",{className:`border-l-4 ${"live"===a.activity?"border-l-ok bg-[#f2faf4]":"border-l-[#9a9aa4]"}`,children:(0,d.jsx)(dh,{file:a})},a.path))}):null,r?av||ay?(0,d.jsx)(eU,{project:g,groups:av?au:ax,manual:av?af:[],files:a,flows:b,tasks:av?ad:[],drafts:av?x:[],loaded:h,focus:K,onSelect:aq,onClose:ap,onDraftClose:an,onDraftSpawned:ao,onHandoff:am}):aw.length?(0,d.jsx)(e1,{files:aw,activeRootPaths:_,onOpen:aq}):(0,d.jsx)("div",{className:"flex flex-1 items-center justify-center px-4 py-5 text-center",children:(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"text-[13.5px] font-semibold text-dim",children:q("dash.emptyTitle")}),(0,d.jsx)("div",{className:"mt-0.5 text-[12px] text-dim",children:q("dash.emptyHint")})]})}):(0,d.jsxs)("div",{className:"flex min-h-0 min-w-0 flex-1",children:[(0,d.jsxs)("div",{className:"relative flex min-h-0 min-w-0 flex-1 flex-col",children:[aA?(0,d.jsx)(eS,{project:g,groups:av?au:ax,manual:av?af:[],files:a,flows:b,tasks:av?ad:[],drafts:av?x:[],focus:K,attentionPaths:k,onSelect:aq,onClose:ap,onDraftClose:an,onDraftSpawned:ao,onHandoff:am,onTaskDraft:a=>{let b=ak();dm(b,"text",a.text),aj([...x,b]),t.current="draft::"+b}}):aw.length?(0,d.jsx)(e1,{files:aw,activeRootPaths:_,onOpen:aq}):(0,d.jsx)("div",{className:"flex flex-1 items-center justify-center px-4 py-5 text-center",children:(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"text-[13.5px] font-semibold text-dim",children:q("dash.emptyTitle")}),(0,d.jsx)("div",{className:"mt-0.5 text-[12px] text-dim",children:q("dash.emptyHint")})]})}),az?(0,d.jsx)("div",{className:"absolute left-3 top-3 z-30 inline-flex items-center gap-0.5 rounded-full border border-line bg-panel p-0.5 shadow-card",children:["scheme","list"].map(a=>(0,d.jsxs)("button",{type:"button","aria-pressed":F===a,onClick:()=>(G(a),void localStorage.setItem(`llvEmptyView:${g}`,a)),className:`inline-flex items-center gap-1 rounded-full px-2 py-1 text-[11px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${F===a?"bg-accent/10 text-accent":"text-dim hover:text-ink"}`,children:["scheme"===a?(0,d.jsx)(aW,{className:"h-3 w-3","aria-hidden":!0}):(0,d.jsx)(aX,{className:"h-3 w-3","aria-hidden":!0}),q("scheme"===a?"dash.viewScheme":"dash.viewList")]},a))}):null,(0,d.jsx)("div",{className:"pointer-events-none absolute bottom-4 left-4 z-30 flex items-center gap-2",children:(0,d.jsxs)("button",{type:"button",onClick:al,"aria-label":q("dash.newConvo"),className:"pointer-events-auto flex shrink-0 items-center gap-1 rounded-[8px] border border-line bg-panel px-3 py-1.5 text-[11.5px] font-bold text-ink shadow-card hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[(0,d.jsx)("span",{className:"text-[13px] leading-none text-accent",children:"+"})," ",q("dash.agent")]})})]}),O?(0,d.jsx)(dz,{tasks:f,project:g,onOpenTask:a=>{if(a.project!==g){sessionStorage.setItem("llvTaskFocus",a.id),fb(a.project);return}ai("task::"+a.id)},onClose:T}):null]}),r?null:(0,d.jsx)(e_,{files:a,flows:b,project:g,loaded:h,onOpenFile:aq}),!ay&&aa.length?(0,d.jsx)(e8,{items:aa,activeRootPaths:_,onSelect:aq}):null,(0,d.jsx)(dE,{})]})}let fd=k("qr-code",[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]]);function fe(){let{t:a}=v(),[b,c]=(0,e.useState)(!1),[f,g]=(0,e.useState)({status:"idle"}),[h,i]=(0,e.useState)(null),[j,k]=(0,e.useState)(!1),l=(0,e.useRef)(null),m="ready"===f.status&&h&&h.url===f.url?h.dataUrl:null,n=(0,e.useCallback)(()=>{"ready"===f.status&&navigator.clipboard.writeText(f.url).then(()=>{k(!0),window.setTimeout(()=>k(!1),2e3)}).catch(()=>{})},[f]);return(0,d.jsxs)("div",{ref:l,className:"relative ml-auto shrink-0",children:[(0,d.jsx)("button",{type:"button","aria-expanded":b,"aria-label":a("qr.showAria"),onClick:()=>{b||g({status:"idle"}),c(!b)},className:"flex items-center justify-center rounded-[8px] border border-line bg-panel p-1.5 text-dim hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:(0,d.jsx)(fd,{className:"h-4 w-4","aria-hidden":!0})}),b?(0,d.jsx)("div",{className:"fixed left-1/2 top-12 z-50 flex w-[260px] -translate-x-1/2 flex-col gap-2.5 rounded-[12px] border border-line bg-panel p-3 shadow-[0_8px_28px_rgba(20,20,30,0.14)] sm:absolute sm:left-0 sm:right-auto sm:top-full sm:mt-1.5 sm:translate-x-0",children:"idle"===f.status?(0,d.jsx)("span",{className:"text-[12px] text-ink",children:a("common.loading")}):"error"===f.status?(0,d.jsx)("span",{className:"text-[12px] font-semibold text-err",children:a("qr.failed")}):"unavailable"===f.status?(0,d.jsxs)("span",{className:"text-[12px] leading-relaxed text-ink",children:[a("qr.startHint"),(0,d.jsx)("code",{className:"break-all rounded bg-chip px-1 py-0.5 font-mono text-[11px]",children:"bunx agent-log-viewer --tailscale"})]}):(0,d.jsxs)(d.Fragment,{children:[m?(0,d.jsx)("img",{src:m,alt:a("qr.alt"),className:"mx-auto h-[220px] w-[220px]"}):(0,d.jsx)("span",{className:"text-[12px] text-ink",children:a("qr.generating")}),(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsx)("input",{readOnly:!0,value:f.url,"aria-label":a("qr.linkAria"),onFocus:a=>a.currentTarget.select(),className:"min-w-0 flex-1 truncate rounded-[8px] border border-line bg-bg px-2 py-1.5 font-mono text-[10.5px] text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40"}),(0,d.jsx)("button",{type:"button","aria-label":a("qr.copy"),onClick:n,className:"flex shrink-0 items-center gap-1 rounded-[8px] border border-line bg-panel px-2 py-1.5 text-[11px] font-semibold text-dim hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:j?(0,d.jsx)(a7,{className:"h-3.5 w-3.5","aria-hidden":!0}):(0,d.jsx)(bc,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),(0,d.jsx)("span",{className:"text-[10.5px] text-dim",children:a("qr.scanHint")})]})}):null]})}function ff(){let{locale:a,t:b,setLocale:c}=v(),e="en"===a?"uk":"en";return(0,d.jsx)("button",{className:"inline-flex h-[26px] shrink-0 items-center justify-center rounded-full border border-line bg-panel px-2 text-[10.5px] font-bold text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:b("lang.aria"),"aria-label":b("lang.aria"),onClick:()=>c(e),children:a.toUpperCase()})}let fg=(a=r())=>"uk"===a?"uk-UA":"en-US";function fh({label:a,window:b,engineColor:c,now:e}){var f,g;let h,i,j,k,{t:l}=v();if(!b)return null;let m=Math.max(0,Math.min(100,100-b.usedPercent)),n=m<=10?"#c62828":m<=30?"#d29a2f":c;return(0,d.jsxs)("div",{className:"mt-1.5",children:[(0,d.jsxs)("div",{className:"flex items-baseline justify-between",children:[(0,d.jsx)("span",{className:"text-[11px] font-semibold text-ink",children:a}),(0,d.jsxs)("span",{className:"text-[11px] text-dim",children:[l("limits.left")," ",(0,d.jsxs)("span",{className:`font-bold tabular-nums ${m<=30?"":"text-ink"}`,style:m<=30?{color:n}:void 0,children:[Math.round(m),"%"]})]})]}),(0,d.jsx)("div",{className:"mt-1 h-[4px] overflow-hidden rounded-full bg-chip",children:(0,d.jsx)("div",{className:"h-full rounded-full transition-[width] duration-700 ease-out",style:{width:Math.max(m,1.5)+"%",backgroundColor:n}})}),b.resetsAt?(0,d.jsx)("div",{className:"mt-[3px] text-[10px] leading-none text-dim",children:l("limits.reset",{eta:(f=b.resetsAt,h=r(),(i=f-e)<=60?u(h,"limits.now"):i<5400?u(h,"limits.inMin",{n:Math.round(i/60)}):i<129600?u(h,"limits.inHour",{n:Math.round(i/3600)}):u(h,"limits.inDay",{n:Math.round(i/86400)})),at:(g=b.resetsAt,k=(j=new Date(1e3*g)).toLocaleTimeString(fg(),{hour:"2-digit",minute:"2-digit",hour12:!1}),g-e<86400?k:j.toLocaleDateString(fg(),{day:"numeric",month:"short"})+" "+k)})}):null]})}function fi({label:a,engine:b,limits:c,now:e,staleHint:f}){let{t:g}=v();if(!c||!c.session&&!c.weekly)return null;let h=ae[b]??af,i=c.capturedAt&&e-c.capturedAt>1200?ab(c.capturedAt):null;return(0,d.jsxs)("div",{className:`mt-2.5 first:mt-0 ${f?"opacity-60":""}`,children:[(0,d.jsxs)("div",{className:"flex items-baseline gap-1.5",children:[(0,d.jsx)("span",{className:"text-[11.5px] font-bold",style:{color:h.color},children:a}),c.plan?(0,d.jsx)("span",{className:"truncate text-[10px] text-dim",children:c.plan}):null,f?(0,d.jsx)("span",{className:"truncate text-[10px] text-dim",children:f}):null,i?(0,d.jsx)("span",{className:"h-1.5 w-1.5 shrink-0 self-center rounded-full bg-[#d29a2f]",title:g("limits.stale",{stale:i})}):null]}),(0,d.jsx)(fh,{label:g("limits.5h"),window:c.session,engineColor:h.color,now:e}),(0,d.jsx)(fh,{label:g("limits.week"),window:c.weekly,engineColor:h.color,now:e})]})}function fj(){let{locale:a}=v(),[b,c]=(0,e.useState)(null);if(!b||!b.data.claude&&!b.data.codex)return null;let f=function(a,b){if(!a)return null;let c=new Date(a);return Number.isNaN(c.getTime())?null:u(b,"limits.asOf",{time:c.toLocaleTimeString(fg(b),{hour:"2-digit",minute:"2-digit",hour12:!1})})}(b.data.staleSince,a);return(0,d.jsxs)("div",{className:"shrink-0 border-t border-line px-3.5 pb-3 pt-2.5",children:[(0,d.jsx)(fi,{label:"Claude",engine:"claude",limits:b.data.claude,now:b.at,staleHint:f}),(0,d.jsx)(fi,{label:"Codex",engine:"codex",limits:b.data.codex,now:b.at,staleHint:f})]})}let fk=k("bell",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]),fl=k("bell-off",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]]);function fm(){let{t:a}=v(),[b,c]=(0,e.useState)(!1),[f,g]=(0,e.useState)(!1),h=async()=>{if(!f||"default"===Notification.permission&&"granted"!==await Notification.requestPermission()||"granted"!==Notification.permission)return;let a=await navigator.serviceWorker.register("/question-push-sw.js"),b=await a.pushManager.getSubscription();if(b){await b.unsubscribe(),c(!1);return}let d=await (await fetch("/api/push")).json(),e=await a.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:function(a){let b=atob((a+"=".repeat((4-a.length%4)%4)).replace(/-/g,"+").replace(/_/g,"/")),c=new Uint8Array(b.length);for(let a=0;a<b.length;a+=1)c[a]=b.charCodeAt(a);return c.buffer.slice(0)}(d.publicKey)});await fetch("/api/push",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)}),c(!0)};return(0,d.jsx)("button",{className:"inline-flex h-[26px] w-[26px] shrink-0 items-center justify-center rounded-full border border-line bg-panel text-dim hover:text-ink disabled:opacity-45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:a(f?b?"push.enabled":"push.enable":"push.needsHttps"),"aria-label":a(f?b?"push.disable":"push.enable":"push.needsHttps"),"aria-pressed":b,disabled:!f,onClick:h,children:b?(0,d.jsx)(fk,{className:"h-3.5 w-3.5","aria-hidden":!0}):(0,d.jsx)(fl,{className:"h-3.5 w-3.5","aria-hidden":!0})})}let fn=[2,6,12];function fo(a){return a>=0x280000000?Math.round(a/0x40000000)+" GiB":a>=0x40000000?(a/0x40000000).toFixed(1)+" GiB":Math.max(0,Math.round(a/1048576))+" MiB"}function fp({label:a,usedPercent:b,color:c,note:e}){let f=Math.max(1.5,Math.min(100,b));return(0,d.jsxs)("div",{className:"mt-1.5 first:mt-0",children:[(0,d.jsxs)("div",{className:"flex items-baseline justify-between",children:[(0,d.jsx)("span",{className:"text-[11px] font-semibold text-ink",children:a}),(0,d.jsx)("span",{className:"text-[11px] tabular-nums text-dim",children:e})]}),(0,d.jsx)("div",{className:"mt-1 h-[4px] overflow-hidden rounded-full bg-chip",children:(0,d.jsx)("div",{className:"h-full rounded-full transition-[width] duration-700 ease-out",style:{width:f+"%",backgroundColor:c}})})]})}function fq(){let{t:a}=v(),[b,c]=(0,e.useState)(null),[f,g]=(0,e.useState)(!1),h=(0,e.useRef)(null),i=(0,e.useRef)(async()=>{}),j=b?.data.system??null,k=b?.data.sessions??[];if(!b||!j&&0===k.length)return null;let l=j?100*(j.ramTotal-j.ramAvailable)/j.ramTotal:0,m=j?100*j.ramAvailable/j.ramTotal:100,n=j&&j.swapTotal>0?100*j.swapUsed/j.swapTotal:0;return(0,d.jsxs)("div",{ref:h,className:"relative shrink-0 border-t border-line",children:[(0,d.jsxs)("button",{type:"button","aria-expanded":f,"aria-label":a("resources.openAria"),onClick:()=>g(a=>!a),className:"block w-full px-3.5 pb-2.5 pt-2 text-left hover:bg-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[b.staleSince?(0,d.jsx)("span",{className:"absolute right-2 top-2 h-1.5 w-1.5 rounded-full bg-[#d29a2f]",title:a("resources.stale",{stale:ab(b.staleSince)})}):null,j?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(fp,{label:a("resources.ram"),usedPercent:l,color:m<10?"#c62828":m<30?"#d29a2f":"#9a9aa4",note:a("resources.free",{amount:fo(j.ramAvailable)})}),j.swapTotal>0?(0,d.jsx)(fp,{label:a("resources.swap"),usedPercent:n,color:n>85?"#c62828":n>60?"#d29a2f":"#9a9aa4",note:a("resources.used",{amount:fo(j.swapUsed)})}):null]}):(0,d.jsx)("span",{className:"text-[11px] font-semibold text-ink",children:a("resources.title")})]}),f?(0,d.jsx)(fs,{sessions:k,now:b.at,onRefresh:()=>i.current(!0),onClose:()=>g(!1)}):null]})}async function fr(a){let b=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"kill-target",target:a.target})});return b.ok?null:(await b.json().catch(()=>({}))).error??String(b.status)}function fs({sessions:a,now:b,onRefresh:c,onClose:f}){let{t:g}=v(),[h,i]=(0,e.useState)(new Set),[j,k]=(0,e.useState)(null),[l,m]=(0,e.useState)(null),[o,p]=(0,e.useState)(2),[q,r]=(0,e.useState)(!1),[s,t]=(0,e.useState)(!1),[u,w]=(0,e.useState)(!1),x=(a,b)=>i(c=>{let d=new Set(c);return b?d.add(a):d.delete(a),d}),y=async a=>{m(null),t(!1),x(a.target,!0);try{let b=await fr(a);b&&m(b),await c()}finally{x(a.target,!1),k(null)}},z=c=>{let d=(b-3600*c)*1e3;return a.filter(a=>"live"!==a.activity&&null!==a.lastActiveAt&&Date.parse(a.lastActiveAt)<d)},A=async()=>{let a=z(o);if(0!==a.length&&!q){m(null),t(!1),r(!0);try{for(let b of a){x(b.target,!0);let a=await fr(b);a&&m(a)}await c()}finally{i(new Set),r(!1)}}},B=async()=>{if(0!==a.length&&!u){m(null),w(!0);try{for(let b of a){x(b.target,!0);let a=await fr(b);a&&m(a)}await c()}finally{i(new Set),w(!1),t(!1)}}},C=a.reduce((a,b)=>a+b.rssBytes+b.swapBytes,0),D=z(o).length;return(0,d.jsxs)("div",{className:"fixed bottom-3 left-1/2 z-50 flex w-[min(430px,calc(100vw-16px))] -translate-x-1/2 flex-col rounded-[12px] border border-line bg-panel shadow-[0_8px_28px_rgba(20,20,30,0.14)] sm:absolute sm:bottom-1 sm:left-full sm:ml-2 sm:translate-x-0",children:[(0,d.jsxs)("header",{className:"flex items-center gap-2 border-b border-line px-3 py-2",children:[(0,d.jsx)("span",{className:"text-[12.5px] font-bold",children:g("resources.title")}),a.length?(0,d.jsx)("span",{className:"text-[11px] tabular-nums text-dim",children:g("resources.total",{amount:fo(C)})}):null,(0,d.jsx)("button",{type:"button","aria-label":g("resources.close"),onClick:f,className:"ml-auto rounded-[6px] p-1 text-dim hover:bg-bg hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:(0,d.jsx)(n,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),(0,d.jsx)("div",{className:"max-h-[min(420px,60vh)] overflow-y-auto py-1",children:0===a.length?(0,d.jsx)("div",{className:"px-3 py-4 text-center text-[12px] text-dim",children:g("resources.empty")}):a.map(a=>(0,d.jsx)(ft,{session:a,busy:h.has(a.target),armed:j===a.target,onArm:()=>k(a.target),onKill:()=>void y(a)},a.target))}),(0,d.jsxs)("footer",{className:"flex items-center gap-2 border-t border-line px-3 py-2",children:[(0,d.jsx)("span",{className:"text-[11px] text-dim",children:g("resources.bulkLabel")}),(0,d.jsx)("select",{value:o,onChange:a=>p(Number(a.target.value)),className:"rounded-[8px] border border-line bg-bg px-1.5 py-1 text-[11px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:fn.map(a=>(0,d.jsx)("option",{value:a,children:g("resources.hoursN",{n:a})},a))}),(0,d.jsxs)("button",{type:"button",disabled:q||0===D,title:0===D?g("resources.bulkNone"):void 0,onClick:()=>void A(),className:"ml-auto rounded-[8px] border border-err/40 px-2.5 py-1 text-[11px] font-semibold text-err hover:bg-err/10 disabled:cursor-not-allowed disabled:opacity-45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-err/40",children:[g("resources.bulkKill"),D?` (${D})`:""]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2 border-t border-line px-3 py-2",children:[(0,d.jsx)("span",{className:"text-[13px] leading-none text-err","aria-hidden":!0,children:"⚠"}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[10.5px] text-dim",title:g("resources.killAllHint"),children:g("resources.killAllHint")}),(0,d.jsx)("button",{type:"button",disabled:u||0===a.length,title:0===a.length?g("resources.killAllNone"):g("resources.killAllHint"),onClick:()=>s?void B():t(!0),className:["shrink-0 rounded-[8px] border px-2.5 py-1 text-[11px] font-semibold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-err/40 disabled:cursor-not-allowed disabled:opacity-45",s?"border-err bg-err text-white":"border-err/40 text-err hover:bg-err/10"].join(" "),children:s?g("resources.killAllConfirm",{n:a.length}):g("resources.killAll")+(a.length?` (${a.length})`:"")})]}),l?(0,d.jsx)("div",{className:"border-t border-line px-3 py-1.5 text-[11px] font-semibold text-err",children:l}):null]})}function ft({session:a,busy:b,armed:c,onArm:e,onKill:f}){var g;let{t:h}=v(),i=ae[a.engine??""]??af,j="live"===a.activity,k=null!==a.lastActiveAt?Date.parse(a.lastActiveAt)/1e3:null,l=j&&!c;return(0,d.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 hover:bg-bg",children:[(0,d.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${ad(a.activity??"idle")}`}),(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 text-[10px] font-bold",style:{backgroundColor:i.soft,color:i.color},children:"codex"===a.engine?"Codex":"claude"===a.engine?"Claude":"?"}),(0,d.jsxs)("span",{className:"min-w-0 flex-1",title:[a.cwd,a.target,h("resources.procs",{count:a.procCount})].filter(Boolean).join(" \xb7 "),children:[(0,d.jsx)("span",{className:"block truncate text-[12px] font-semibold",children:a.title??(a.cwd?(g=a.cwd).split("/").filter(Boolean).slice(-2).join("/")||g:h("resources.orphan"))}),(0,d.jsxs)("span",{className:"block truncate text-[10.5px] text-dim",children:[null===a.title?h("resources.orphan")+" \xb7 ":a.project?a.project+" \xb7 ":"",null!==k?ab(k):a.target]})]}),(0,d.jsxs)("span",{className:"shrink-0 text-right",children:[(0,d.jsx)("span",{className:"block text-[11.5px] font-bold tabular-nums",children:fo(a.rssBytes)}),a.swapBytes>0?(0,d.jsx)("span",{className:"block text-[10px] tabular-nums text-dim",children:h("resources.swapShare",{amount:fo(a.swapBytes)})}):null]}),(0,d.jsx)("button",{type:"button",disabled:b,"aria-disabled":l||b,title:h(j?"resources.killLiveHint":"resources.killHint"),onClick:()=>l?e():f(),className:["shrink-0 rounded-[8px] border px-2 py-1 text-[11px] font-semibold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-err/40",b?"cursor-wait opacity-50":"",c?"border-err bg-err text-white":l?"border-line text-dim opacity-60 hover:opacity-90":"border-err/40 text-err hover:bg-err/10"].join(" "),children:h(c?"resources.confirm":"resources.kill")})]})}function fu({files:a,workflows:b,archivedProjects:c,selected:f,loaded:g,now:h,onSelect:i}){let{t:j}=v(),[k,l]=(0,e.useState)(""),[m,n]=(0,e.useState)(!1),o=(0,e.useMemo)(()=>G(a,h,b),[a,h,b]),p=(0,e.useMemo)(()=>{let a=k.trim().toLowerCase();return a?o.filter(b=>b.project.toLowerCase().includes(a)):o},[o,k]),q=(0,e.useMemo)(()=>p.filter(a=>!c.has(a.project)),[p,c]),r=(0,e.useMemo)(()=>p.filter(a=>c.has(a.project)),[p,c]),s=(0,e.useMemo)(()=>o.reduce((a,b)=>a+b.liveCount,0),[o]),t=(0,e.useMemo)(()=>o.reduce((a,b)=>a+b.attentionCount,0),[o]);return(0,d.jsxs)("aside",{className:"flex w-[248px] shrink-0 flex-col border-r border-line bg-panel",children:[(0,d.jsxs)("header",{className:"flex h-10 shrink-0 items-center gap-2 border-b border-line px-4 text-[13.5px] font-bold",children:[j("rail.title"),s?(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-[#e5f6ea] px-2 py-0.5 text-[10.5px] font-bold text-ok",children:[(0,d.jsx)("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-ok"}),s]}):null,t?(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-[#fff1ca] px-2 py-0.5 text-[10.5px] font-bold text-[#8a5a00]",children:["⏸ ",t]}):null,(0,d.jsx)(ff,{}),(0,d.jsx)(fe,{}),(0,d.jsx)(fm,{})]}),(0,d.jsx)("div",{className:"px-2.5 pb-1 pt-2.5",children:(0,d.jsx)("input",{className:"w-full rounded-[9px] border border-line bg-bg px-2.5 py-1.5 text-[12px] outline-none focus-visible:ring-2 focus-visible:ring-accent/40",placeholder:j("rail.filter"),value:k,onChange:a=>l(a.target.value)})}),(0,d.jsxs)("nav",{className:"flex-1 overflow-y-auto px-2 pb-3 pt-1","aria-label":j("rail.projects"),children:[(0,d.jsx)(fv,{label:j("rail.overview"),live:0,attention:0,total:null,age:"",active:f===x,hasLive:!1,onClick:()=>i(x)}),(0,d.jsx)("div",{className:"mx-2.5 my-1.5 border-t border-line"}),(0,d.jsx)(b_,{children:q.map(a=>(0,d.jsx)("div",{"data-flip-key":a.project,children:(0,d.jsx)(fv,{label:a.project,live:a.liveCount,attention:a.attentionCount,total:a.conversations,age:ab(a.smt),active:f===a.project,hasLive:a.liveCount>0,onClick:()=>i(a.project)})},a.project))}),r.length?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"mx-2.5 my-1.5 border-t border-line"}),(0,d.jsxs)("button",{type:"button",className:"mb-0.5 flex w-full items-center gap-1.5 rounded-[10px] px-2.5 py-1.5 text-left text-[11.5px] font-bold text-dim hover:bg-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-expanded":m,onClick:()=>n(a=>!a),children:[(0,d.jsx)(a8,{className:`h-3 w-3 shrink-0 transition-transform ${m?"rotate-90":""}`,"aria-hidden":!0}),(0,d.jsx)(a0,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),j("rail.archive"),(0,d.jsx)("span",{className:"font-semibold",children:r.length})]}),m?r.map(a=>(0,d.jsx)(fv,{label:a.project,live:a.liveCount,attention:a.attentionCount,total:a.conversations,age:ab(a.smt),active:f===a.project,hasLive:a.liveCount>0,onClick:()=>i(a.project)},a.project)):null]}):null,q.length||r.length?null:g?(0,d.jsx)("div",{className:"px-3 py-4 text-center text-[12px] text-dim",children:j("common.nothingFound")}):(0,d.jsxs)("div",{className:"flex items-center justify-center gap-2 px-3 py-4 text-[12px] text-dim",children:[(0,d.jsx)(bv,{className:"h-4 w-4 animate-spin","aria-hidden":!0}),j("common.loading")]})]}),(0,d.jsx)(fq,{}),(0,d.jsx)(fj,{})]})}function fv({label:a,live:b,attention:c,total:e,age:f,active:g,hasLive:h,onClick:i}){return(0,d.jsxs)("button",{className:["mb-0.5 flex w-full items-center gap-2 rounded-[10px] border px-2.5 py-2 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",g?"border-line bg-bg shadow-card":"border-transparent hover:bg-bg"].join(" "),"aria-current":g?"page":void 0,onClick:i,children:[(0,d.jsx)("span",{className:["h-2 w-2 shrink-0 rounded-full",h?"animate-pulse bg-ok":"bg-[#d6d6dd]"].join(" ")}),(0,d.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,d.jsx)("span",{className:`block truncate text-[13px] ${g?"font-bold":"font-semibold"}`,children:a}),f?(0,d.jsx)("span",{className:"block text-[10.5px] text-dim",children:f}):null]}),b>0?(0,d.jsx)("span",{className:"shrink-0 rounded-full bg-[#e5f6ea] px-1.5 py-0.5 text-[10.5px] font-bold text-ok",children:b}):null,c>0?(0,d.jsxs)("span",{className:"shrink-0 rounded-full bg-[#fff1ca] px-1.5 py-0.5 text-[10.5px] font-bold text-[#8a5a00]",children:["⏸ ",c]}):null,null!==e?(0,d.jsx)("span",{className:"shrink-0 text-[11px] font-semibold text-dim",children:e}):null]})}function fw(){let a,{t:b}=v(),{files:c,flows:f,workflows:g,tasks:h,loaded:i}=function(){let[a,b]=(0,e.useState)(aP);return a}(),j=(a=(0,e.useSyncExternalStore)(R,()=>P,()=>S),(0,e.useMemo)(()=>f.some(b=>a.has(b.id)&&"closed"!==b.state)?f.map(b=>a.has(b.id)&&"closed"!==b.state?{...b,state:"closed",closedAt:b.closedAt??new Date().toISOString()}:b):f,[f,a]));(0,e.useRef)(null),(0,e.useRef)(new Set);let{archivedProjects:k,archiveProject:o,unarchiveProject:p}=function(){let[a,b]=(0,e.useState)(()=>new Set),c=(0,e.useRef)(a);return{archivedProjects:a,archiveProject:(0,e.useCallback)(a=>{b(b=>{if(b.has(a))return b;let d=new Set(b);return d.add(a),c.current=d,az(d),d})},[]),unarchiveProject:(0,e.useCallback)(a=>{b(b=>{if(!b.has(a))return b;let d=new Set(b);return d.delete(a),c.current=d,az(d),d})},[])}}(),q=aS(),[r,s]=(0,e.useState)(!1),[t,u]=(0,e.useState)(x),[y,z]=(0,e.useState)(null),[A,B]=(0,e.useState)(null);(0,e.useRef)(null);let[C,D]=(0,e.useState)(0),F=(0,e.useCallback)(a=>{u(a),localStorage.setItem("llvProject",a),a!==x?history.replaceState(null,"","#p="+encodeURIComponent(a)):history.replaceState(null,"",location.pathname),s(!1)},[]),G=(0,e.useCallback)(a=>{let b=E(a);fa(b,a.path),F(b),D(a=>a+1)},[F]),[H,I]=(0,e.useState)(()=>Date.now()/1e3),J=(0,e.useMemo)(()=>(function(a,b=Date.now()/1e3){let c=[];for(let d of a){let a=N(d,b);if(null===a)continue;let e=d.pendingQuestion||d.waitingInput?"blocked":"stalled",f=d.pendingQuestion?function(a){let b=Date.parse(a);return Number.isFinite(b)?b/1e3:null}(d.pendingQuestion.askedAt)??d.mtime:d.waitingInput?d.waitingInput.since:d.mtime;c.push({id:a,file:d,project:E(d),tier:e,since:f})}return c.sort((a,b)=>(a.tier===b.tier?0:"blocked"===a.tier?-1:1)||a.since-b.since||a.id.localeCompare(b.id))})(c,H),[c,H]),[K,L]=(0,e.useState)(!1),M=(0,e.useRef)(null),[O,Q]=(0,e.useState)(!1),[T,U]=(0,e.useState)(null),V=(0,e.useCallback)(a=>{U(b=>({path:a,nonce:(b?.nonce??0)+1}))},[]),W=(0,e.useRef)(null),X=(0,e.useMemo)(()=>J.map(a=>a.file.path).sort().join("\n"),[J]),Y=(0,e.useMemo)(()=>O?new Set(X.split("\n").filter(Boolean)):null,[O,X]);(0,e.useMemo)(()=>t===x?[]:J.filter(a=>a.project===t),[J,t]);let Z=(0,e.useCallback)(a=>{L(!1),a.project!==t&&F(a.project),W.current=a.id,V(a.file.path)},[t,F,V]),$=A?c.find(a=>a.path===A):null,_=J.length?(0,d.jsxs)("div",{ref:M,className:"pointer-events-auto relative",children:[(0,d.jsxs)("div",{className:"flex items-center overflow-hidden rounded-full border border-[#e0ae45]/45 bg-[#fff9ed] shadow-card",children:[(0,d.jsx)("button",{type:"button",className:"px-3 py-1 text-[12px] font-bold text-[#8a5a00] hover:bg-[#e0ae45]/15 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent/40","aria-expanded":K,"aria-label":b("attention.badge",{count:J.length}),title:b("attention.openQueue"),onClick:()=>L(a=>!a),children:q?(0,d.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,d.jsx)(l,{className:"h-3 w-3","aria-hidden":!0})," ",J.length]}):b("attention.badge",{count:J.length})}),q?null:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"h-4 w-px shrink-0 bg-[#e0ae45]/45","aria-hidden":!0}),(0,d.jsx)("button",{type:"button",className:`px-2 py-1.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent/40 ${O?"bg-[#e0ae45]/30 text-[#8a5a00]":"text-[#b8860b]/70 hover:bg-[#e0ae45]/15 hover:text-[#8a5a00]"}`,"aria-pressed":O,title:O?b("attention.filterOff"):b("attention.filterOn"),"aria-label":O?b("attention.filterOff"):b("attention.filterOn"),onClick:()=>Q(a=>!a),children:(0,d.jsx)(m,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})]}),K?(0,d.jsxs)("div",{className:`${q?"fixed inset-x-3 top-12":"absolute right-0 top-[calc(100%+6px)] w-[340px] max-w-[calc(100vw-2rem)]"} z-50 max-h-[60vh] overflow-y-auto rounded-[10px] border border-line bg-panel p-1.5 shadow-card`,children:[(0,d.jsx)("div",{className:"px-2.5 pb-1 pt-1.5 text-[10.5px] font-bold uppercase tracking-wide text-dim",children:b("attention.popoverTitle")}),J.map(a=>(0,d.jsxs)("button",{type:"button",className:"flex w-full min-w-0 flex-col gap-0.5 rounded-[8px] px-2.5 py-2 text-left hover:bg-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>Z(a),children:[(0,d.jsxs)("span",{className:"flex w-full min-w-0 items-center gap-1.5",children:[(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12px] font-semibold text-ink",children:w(a.file.title,90)}),(0,d.jsx)("span",{className:"shrink-0 rounded-full border border-line bg-bg px-1.5 text-[10px] font-semibold text-dim",children:a.project}),(0,d.jsx)("span",{className:"shrink-0 text-[10.5px] text-dim",children:ab(a.since)})]}),(0,d.jsx)("span",{className:`w-full truncate text-[11px] ${"stalled"===a.tier?"text-[#b8860b]":"text-dim"}`,children:function(a,b){let c=b.file.pendingQuestion;if(c){if("plan"===c.kind)return a("status.awaitingPlan");let b=c.questions?.[0];return b?.header||b?.question.split("\n")[0]||a("status.awaitingAnswer")}let d=b.file.waitingInput;return d?d.menu?.question.split("\n")[0]||d.screenTail||a("status.awaitingTerminal"):a("status.stalled")}(b,a)})]},a.id))]}):null]}):null;return(0,d.jsxs)("div",{className:"flex h-full",children:[q?null:(0,d.jsx)(fu,{files:c,workflows:g,archivedProjects:k,selected:t,now:H,loaded:i,onSelect:F}),q&&r?(0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex",children:[(0,d.jsx)(fu,{files:c,workflows:g,archivedProjects:k,selected:t,now:H,loaded:i,onSelect:F}),(0,d.jsx)("button",{type:"button",className:"min-w-0 flex-1 bg-ink/35","aria-label":b("viewer.closeProjects"),onClick:()=>s(!1)})]}):null,(0,d.jsxs)("main",{className:"flex min-w-0 flex-1 flex-col",children:[(0,d.jsxs)("div",{className:"pointer-events-none fixed right-4 top-4 z-50 flex flex-col items-end gap-2",children:[q?null:_,$?(0,d.jsxs)("div",{className:"pointer-events-auto flex max-w-[360px] gap-2 rounded-[8px] border border-[#e0ae45]/45 bg-[#fff9ed] px-4 py-3 text-[13px] font-semibold text-ink shadow-card",children:[(0,d.jsxs)("button",{className:"min-w-0 flex-1 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>{G($),B(null)},children:[(0,d.jsx)("span",{className:"block text-[11px] font-bold text-[#8a5a00]",children:b("viewer.agentWaiting")}),(0,d.jsx)("span",{className:"line-clamp-2",children:$.title})]}),(0,d.jsx)("button",{className:"mt-0.5 flex h-6 w-6 shrink-0 items-center justify-center rounded-full border border-line bg-bg text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":b("viewer.closeNotification"),onClick:()=>B(null),children:(0,d.jsx)(n,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}):null]}),t===x?(0,d.jsx)(aU,{files:c,workflows:g,archivedProjects:k,now:H,onSelectProject:F,onSelectFile:G,onMenu:q?()=>s(!0):void 0,attention:q?_:void 0}):(0,d.jsx)(fc,{files:c,flows:j,workflows:g,tasks:h,project:t,loaded:i,openNonce:C,focusRequest:T,attentionPaths:Y,archived:k.has(t),onArchive:o,onUnarchive:p,onMenu:q?()=>s(!0):void 0,attention:q?_:void 0})]})]})}},78335:()=>{},79428:a=>{"use strict";a.exports=require("buffer")},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},95487:(a,b,c)=>{Promise.resolve().then(c.bind(c,77845))},96487:()=>{},98058:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,95547,23))}};var b=require("../webpack-runtime.js");b.C(a);var c=b.X(0,[741,319,918],()=>b(b.s=32076));module.exports=c})();
|
|
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:v.CachedRouteKind.APP_PAGE,html:l,headers:q,rscData:m.flightData,postponed:m.postponed,status:m.statusCode,segmentData:m.segmentData},cacheControl:o}},r=async({hasResolved:c,previousCacheEntry:g,isRevalidating:i,span:j,forceStaticRender:k=!1})=>{let l=!1===P.isDev,m=c||b.writableEnded;try{var n;let f;if(ar&&aj&&!g&&!V)return(null==ak?void 0:ak.render404)?await ak.render404(a,b):(b.statusCode=404,b.end("This page could not be found")),null;if(at&&(f=(0,w.parseFallbackField)(at.fallback)),!0===al.experimental.partialFallbacks&&(null==at?void 0:at.fallback)===null&&!aT&&aS.length>0&&(f=w.FallbackMode.PRERENDER),f===w.FallbackMode.PRERENDER&&(0,u.isBot)(av)&&(!aF||ax)&&(f=w.FallbackMode.BLOCKING_STATIC_RENDER),(null==g?void 0:g.isStale)===-1&&(ar=!0),ar&&(f!==w.FallbackMode.NOT_FOUND||g)&&(f=w.FallbackMode.BLOCKING_STATIC_RENDER),!V&&f!==w.FallbackMode.BLOCKING_STATIC_RENDER&&aV&&!m&&!ah&&_&&(l||!au)){if((l||at)&&f===w.FallbackMode.NOT_FOUND){if(al.adapterPath)return await a0();throw new C.NoFallbackError}if(aF&&(al.cacheComponents?!aL:!az)){let b=l&&"string"==typeof(null==at?void 0:at.fallback)?at.fallback:aq,f=(l||aG)&&(null==at?void 0:at.fallbackRouteParams)?(0,o.createOpaqueFallbackRouteParams)(at.fallbackRouteParams):aI?(0,o.getFallbackRouteParams)(aq,P):null;aG&&f&&(0,h.addRequestMeta)(a,"fallbackParams",f);let g=await P.handleResponse({cacheKey:b,req:a,nextConfig:al,routeKind:e.RouteKind.APP_PAGE,isFallback:!0,prerenderManifest:ag,isRoutePPREnabled:aF,responseGenerator:async()=>q({span:j,postponed:void 0,fallbackRouteParams:f,forceStaticRender:!0}),waitUntil:d.waitUntil,isMinimalMode:V});if(null===g)return null;if(g)return V||!aF||!(aS.length>0)||!0!==al.experimental.partialFallbacks||!aU||!p||ar||aI||aD||aE||ay||(0,J.scheduleOnNextTick)(async()=>{let b=P.getResponseCache(a);try{await b.revalidate(aU,p,aF,!1,a=>q({span:a.span,postponed:void 0,fallbackRouteParams:a_.length>0?(0,o.createOpaqueFallbackRouteParams)(a_):null,forceStaticRender:!0}),null,c,d.waitUntil)}catch(a){console.error("Error revalidating the page in the background",a)}}),delete g.cacheControl,g}}let s=ar||i||!aJ?void 0:aJ;if(aP&&!V&&p&&(aL||aA)&&!k){let b=await p.get(ai,{kind:v.IncrementalCacheKind.APP_PAGE,isRoutePPREnabled:!0,isFallback:!1});b&&b.value&&b.value.kind===v.CachedRouteKind.APP_PAGE&&(s=b.value.postponed,b&&(-1===b.isStale||!0===b.isStale)&&(0,J.scheduleOnNextTick)(async()=>{let b=P.getResponseCache(a);try{await b.revalidate(ai,p,aF,!1,a=>r({...a,forceStaticRender:!0}),null,c,d.waitUntil)}catch(a){console.error("Error revalidating the page in the background",a)}}))}if((aG||aH)&&void 0!==s)return{cacheControl:{revalidate:1,expire:void 0},value:{kind:v.CachedRouteKind.PAGES,html:x.default.EMPTY,pageData:{},headers:void 0,status:void 0}};let t=!P.isDev&&_&&(null==at?void 0:at.fallbackRouteParams)?(0,o.getPlaceholderFallbackRouteParams)($,at.fallbackRouteParams):null,y=t&&t.length>0?t:null==at?void 0:at.fallbackRouteParams,z=null!=t&&t.length>0,A=null;if(al.cacheComponents&&(null==at?void 0:at.fallbackRouteParams)){let b=(0,h.getRequestMeta)(a,"resolvedRouteParamKeys");b&&b.size>0&&(A=at.fallbackRouteParams.filter(a=>!b.has(a.paramName)))}let B=(l&&(0,h.getRequestMeta)(a,"renderFallbackShell")||z||aG&&!au)&&y?(0,o.createOpaqueFallbackRouteParams)(y):A&&A.length>0&&A.length<((null==at||null==(n=at.fallbackRouteParams)?void 0:n.length)??0)?(0,o.createOpaqueFallbackRouteParams)(A):aI?(0,o.getFallbackRouteParams)(aq,P):null;if((l||aG)&&al.cacheComponents&&!au&&(null==at?void 0:at.fallbackRouteParams)){let b=(0,o.createOpaqueFallbackRouteParams)(y??at.fallbackRouteParams);b&&(0,h.addRequestMeta)(a,"fallbackParams",b)}return q({span:j,postponed:s,fallbackRouteParams:B,forceStaticRender:k})}catch(b){throw(null==g?void 0:g.isStale)&&await P.onRequestError(a,b,{routerKind:"App Router",routePath:W,routeType:"render",revalidateReason:(0,f.c)({isStaticGeneration:aO,isOnDemandRevalidate:ar})},!1,ak),b}},s=async c=>{var f,g,i,j,k,l;let m,n=await P.handleResponse({cacheKey:aU,responseGenerator:a=>r({span:c,...a}),routeKind:e.RouteKind.APP_PAGE,isOnDemandRevalidate:ar,isRoutePPREnabled:aF,req:a,nextConfig:al,prerenderManifest:ag,waitUntil:d.waitUntil,isMinimalMode:V});if(ah&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate"),P.isDev&&b.setHeader("Cache-Control","no-cache, must-revalidate"),!n){if(aU)throw Object.defineProperty(Error("invariant: cache entry required but not generated"),"__NEXT_ERROR_CODE",{value:"E62",enumerable:!1,configurable:!0});return null}if((null==(f=n.value)?void 0:f.kind)!==v.CachedRouteKind.APP_PAGE)throw Object.defineProperty(Error(`Invariant app-page handler received invalid cache entry ${null==(i=n.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E707",enumerable:!1,configurable:!0});let o="string"==typeof n.value.postponed;az&&!aA&&ao&&b.setHeader(y.NEXT_NAV_DEPLOYMENT_ID_HEADER,ao),aO&&!aL&&(!o||ay)&&(V||b.setHeader("x-nextjs-cache",ar?"REVALIDATED":n.isMiss?"MISS":n.isStale?"STALE":"HIT"),b.setHeader(t.NEXT_IS_PRERENDER_HEADER,"1"));let{value:p}=n;if(aJ)m={revalidate:0,expire:void 0};else if(aL)m={revalidate:0,expire:void 0};else if(!P.isDev)if(ah)m={revalidate:0,expire:void 0};else if(aO){if(n.cacheControl)if("number"==typeof n.cacheControl.revalidate){if(n.cacheControl.revalidate<1)throw Object.defineProperty(Error(`Invalid revalidate configuration provided: ${n.cacheControl.revalidate} < 1`),"__NEXT_ERROR_CODE",{value:"E22",enumerable:!1,configurable:!0});m={revalidate:n.cacheControl.revalidate,expire:(null==(j=n.cacheControl)?void 0:j.expire)??al.expireTime}}else m={revalidate:y.CACHE_ONE_YEAR_SECONDS,expire:void 0}}else b.getHeader("Cache-Control")||(m={revalidate:0,expire:void 0});if(n.cacheControl=m,"string"==typeof aM&&(null==p?void 0:p.kind)===v.CachedRouteKind.APP_PAGE&&p.segmentData){b.setHeader(t.NEXT_DID_POSTPONE_HEADER,"2");let c=null==(k=p.headers)?void 0:k[y.NEXT_CACHE_TAGS_HEADER];V&&aO&&c&&"string"==typeof c&&b.setHeader(y.NEXT_CACHE_TAGS_HEADER,c);let d=p.segmentData.get(aM);return void 0!==d?(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:x.default.fromStatic(d,t.RSC_CONTENT_TYPE_HEADER),cacheControl:n.cacheControl}):(b.statusCode=204,(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:x.default.EMPTY,cacheControl:n.cacheControl}))}let s=aP?(0,h.getRequestMeta)(a,"onCacheEntryV2")??(0,h.getRequestMeta)(a,"onCacheEntry"):(0,h.getRequestMeta)(a,"onCacheEntry");if(s){let b=(0,h.getRequestMeta)(a,"initURL")??a.url,c=b?(null==(l=(0,F.parseUrl)(b))?void 0:l.pathname)??b:void 0;if(await s(n,{url:c}))return null}if(p.headers){let a={...p.headers};for(let[c,d]of(V&&aO||delete a[y.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 u=null==(g=p.headers)?void 0:g[y.NEXT_CACHE_TAGS_HEADER];if(V&&aO&&u&&"string"==typeof u&&b.setHeader(y.NEXT_CACHE_TAGS_HEADER,u),!p.status||az&&aF||(b.statusCode=p.status),!V&&p.status&&H.RedirectStatusCode[p.status]&&az&&(b.statusCode=200),o&&!aL&&b.setHeader(t.NEXT_DID_POSTPONE_HEADER,"1"),az&&!ah){if(void 0===p.rscData){if(p.html.contentType!==t.RSC_CONTENT_TYPE_HEADER)if(al.cacheComponents)return b.statusCode=404,(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:x.default.EMPTY,cacheControl:n.cacheControl});else throw Object.defineProperty(new I.InvariantError(`Expected RSC response, got ${p.html.contentType}`),"__NEXT_ERROR_CODE",{value:"E789",enumerable:!1,configurable:!0});return(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:p.html,cacheControl:n.cacheControl})}return(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:x.default.fromStatic(p.rscData,t.RSC_CONTENT_TYPE_HEADER),cacheControl:n.cacheControl})}let w=p.html;if(aE&&aG){let c=!0===P.isDev?crypto.randomUUID():null;return w.pipeThrough(await (0,A.createInstantTestScriptInsertionTransformStream)(c)),(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:w,cacheControl:{revalidate:0,expire:void 0}})}if(!o||V||az)return(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:w,cacheControl:n.cacheControl});if(aG||aH)return w.push(new ReadableStream({start(a){a.enqueue(z.ENCODED_TAGS.CLOSED.BODY_AND_HTML),a.close()}})),(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:w,cacheControl:{revalidate:0,expire:void 0}});let C=new TransformStream;return w.push(C.readable),q({span:c,postponed:p.postponed,fallbackRouteParams:null,forceStaticRender:!1}).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)!==v.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(C.writable)}).catch(a=>{C.writable.abort(a).catch(a=>{console.error("couldn't abort transformer",a)})}),(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:w,cacheControl:{revalidate:0,expire:void 0}})};if(!a$||!aZ)return k=aY.getActiveScopeSpan(),await aY.withPropagatedContext(a.headers,()=>aY.trace(i.BaseServerSpan.handleRequest,{spanName:`${aX} ${W}`,kind:g.SpanKind.SERVER,attributes:{"http.method":aX,"http.target":a.url}},s),void 0,!a$);await s(aZ)}catch(b){throw b instanceof C.NoFallbackError||await P.onRequestError(a,b,{routerKind:"App Router",routePath:W,routeType:"render",revalidateReason:(0,f.c)({isStaticGeneration:aO,isOnDemandRevalidate:ar})},!1,ak),b}}},33873:a=>{"use strict";a.exports=require("path")},40132:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,95547,23)),Promise.resolve().then(c.t.bind(c,15098,23)),Promise.resolve().then(c.t.bind(c,47644,23)),Promise.resolve().then(c.t.bind(c,33859,23)),Promise.resolve().then(c.t.bind(c,98099,23)),Promise.resolve().then(c.t.bind(c,16237,23)),Promise.resolve().then(c.t.bind(c,98562,23)),Promise.resolve().then(c.t.bind(c,36675,23))},41025:a=>{"use strict";a.exports=require("next/dist/server/app-render/dynamic-access-async-storage.external.js")},43954:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/interception-routes")},58774:()=>{},61106:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,81921,23))},61135:()=>{},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},64100:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,81921,23)),Promise.resolve().then(c.t.bind(c,60440,23)),Promise.resolve().then(c.t.bind(c,84342,23)),Promise.resolve().then(c.t.bind(c,82265,23)),Promise.resolve().then(c.t.bind(c,35421,23)),Promise.resolve().then(c.t.bind(c,61335,23)),Promise.resolve().then(c.t.bind(c,70664,23)),Promise.resolve().then(c.bind(c,74661))},65223:(a,b,c)=>{Promise.resolve().then(c.bind(c,27074))},70440:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>e});var d=c(88868);let e=async a=>[{type:"image/x-icon",sizes:"16x16",url:(0,d.fillMetadataSegment)(".",await a.params,"favicon.ico",!0)+"?603d046c9a6fdfbb"}]},70722:a=>{"use strict";a.exports=require("next/dist/shared/lib/invariant-error")},74075:a=>{"use strict";a.exports=require("zlib")},76537:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>g,metadata:()=>e,viewport:()=>f});var d=c(5735);c(61135);let e={title:"Live logs",description:"Live viewer for Codex/Claude agent logs"},f={width:"device-width",initialScale:1,viewportFit:"cover",interactiveWidget:"resizes-content"};function g({children:a}){return(0,d.jsx)("html",{lang:"en",className:"h-full antialiased",children:(0,d.jsx)("body",{className:"h-dvh overflow-hidden font-sans text-[15px]",children:a})})}},77068:a=>{"use strict";a.exports=require("next/dist/shared/lib/size-limit")},77845:(a,b,c)=>{"use strict";c.d(b,{Viewer:()=>fB});var d=c(48249),e=c(67484);let f=(...a)=>a.filter((a,b,c)=>!!a&&""!==a.trim()&&c.indexOf(a)===b).join(" ").trim(),g=a=>{let b=a.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,b,c)=>c?c.toUpperCase():b.toLowerCase());return b.charAt(0).toUpperCase()+b.slice(1)};var h={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let i=(0,e.createContext)({}),j=(0,e.forwardRef)(({color:a,size:b,strokeWidth:c,absoluteStrokeWidth:d,className:g="",children:j,iconNode:k,...l},m)=>{let{size:n=24,strokeWidth:o=2,absoluteStrokeWidth:p=!1,color:q="currentColor",className:r=""}=(0,e.useContext)(i)??{},s=d??p?24*Number(c??o)/Number(b??n):c??o;return(0,e.createElement)("svg",{ref:m,...h,width:b??n??h.width,height:b??n??h.height,stroke:a??q,strokeWidth:s,className:f("lucide",r,g),...!j&&!(a=>{for(let b in a)if(b.startsWith("aria-")||"role"===b||"title"===b)return!0;return!1})(l)&&{"aria-hidden":"true"},...l},[...k.map(([a,b])=>(0,e.createElement)(a,b)),...Array.isArray(j)?j:[j]])}),k=(a,b)=>{let c=(0,e.forwardRef)(({className:c,...d},h)=>(0,e.createElement)(j,{ref:h,iconNode:b,className:f(`lucide-${g(a).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${a}`,c),...d}));return c.displayName=g(a),c},l=k("triangle-alert",[["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"}]]),m=k("funnel",[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]]),n=k("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),o={en:{"common.serverUnavailable":"server unavailable","common.loading":"loading…","common.loadingCap":"Loading…","common.cancel":"Cancel","common.show":"show","common.showAll":"show all","common.collapse":"collapse","common.copy":"Copy","common.copied":"copied","common.clickToCopy":"click to copy","common.yes":"Yes","common.no":"No","common.send":"Send","common.sending":"sending…","common.sent":"sent","common.close":"Close","common.failedSend":"couldn't send","common.failedDelete":"couldn't delete","common.nothingFound":"Nothing found","common.nothingRunning":"nothing is running right now","common.kb":"kB","common.chars":"{n} chars","lang.aria":"Interface language","util.effortTitle":"Reasoning effort: {effort}","time.agoSec":"{n}s ago","time.agoMin":"{n}m ago","time.agoHour":"{n}h ago","time.agoDay":"{n}d ago","kind.session":"session","kind.subagent":"subagent","kind.job":"job","kind.background":"background","kind.handoff":"handoff","rail.title":"Agent logs","rail.filter":"Filter projects…","rail.projects":"Projects","rail.overview":"Overview","rail.archive":"Archive","dash.branchesLive":{one:"{count} branch running",other:"{count} branches running"},"dash.trees":{one:"{count} tree",other:"{count} trees"},"dash.recentConvos":{one:"{count} recent conversation",other:"{count} recent conversations"},"dash.quietTrees":{one:"{count} quiet tree",other:"{count} quiet trees"},"dash.openProjects":"Open project list","dash.unarchive":"Restore from archive","dash.newConvo":"New conversation with an agent","dash.agent":"Agent","dash.newWorkflow":"New workflow: stages → review → PR","dash.workflow":"Workflow","dash.emptyTitle":"The scheme is empty for now","dash.emptyHint":"Open the switchboard in the bottom-right corner and click a conversation — it will appear here","dash.viewScheme":"scheme","dash.viewList":"list","trash.title":"The scheme is empty, but the project has records","trash.hint":"Clicking a row opens the conversation as a node; the trash icon deletes its file from disk permanently.","trash.deletedFromDisk":"\xb7 deleted from disk","trash.open":"Open {title}","trash.activeSubtree":"active branches","trash.toArchive":"Archive","trash.notDeleted":"{failed} of {total} not deleted","trash.confirmDelete":{one:"Delete {count} project file from disk?",other:"Delete {count} project files from disk?"},"trash.deleting":"deleting…","trash.confirmYes":"Yes, delete","trash.deleteProject":"Delete project from disk","switch.aria":"Agent switchboard","switch.title":"Switchboard","switch.search":"Search by name or project","switch.updating":"updating…","switch.close":"Close switchboard","switch.waiting":"Waiting for you","switch.working":"Working","switch.recent":"Recent","switch.older":"Older","switch.hidden":"Hidden ({count})","switch.hide":"hide","switch.restore":"restore","switchCard.openColumn":"Open {title} as a column","switchCard.remove":"Remove from switchboard","composer.imagesCount":{one:"{count} image",other:"{count} images"},"composer.spawned":"launched agent in tmux {target}","composer.sentPaths":"sent {count} path(s)","composer.failedInterrupt":"couldn't interrupt","composer.escapeSent":"sent Escape — agent interrupted","composer.spawnAria":"Launch an agent with a prompt in tmux","composer.sendAria":"Send a message to the agent in tmux {target}","composer.queueAria":"Queue of sent messages","composer.removeFromQueue":"Remove from queue","composer.placeholderRelay":"type — I'll relay through the root session…","composer.placeholderSpawn":"prompt — the agent will start in tmux…","composer.placeholderSend":"message the agent…","composer.textAria":"Text for the agent","composer.titleRelay":"relayed through the branch's root session","composer.titleSpawnResumed":"new tmux window with the resumed agent","composer.root":"root","composer.interruptAria":"Interrupt the agent (Escape)","composer.interruptTitle":"send Escape to the agent pane","composer.compactAria":"Compact the agent's context (/compact)","composer.compactTitle":"send /compact — the agent condenses its context; a band appears in the feed when done","composer.compactConfirm":"Compact?","composer.compactConfirmTitle":"Click again to send /compact","composer.compactSent":"compaction started — the band will appear in the feed once it's done","composer.failedCompact":"couldn't start compaction","composer.addImages":"Add images","composer.moreTools":"More actions","composer.stopAndSend":"Stop recording and send","composer.launchAgent":"Launch the agent","composer.sendToAgent":"Send to the agent","composer.stopAndSendTitle":"stop recording and send","composer.sendMenuTitle":"Send options","composer.quickAck":"Yes, continue","composer.quickAckLabel":"Continue","composer.quickAckAria":"Send a quick “Yes, continue” to the agent","composer.quickAckTitle":"Quick reply — yes, continue","draft.readPrompt":"Read the agent conversation in file {src} and continue from there: ","draft.needDir":"specify a working directory","draft.launchFailed":"couldn't launch","draft.paneAria":"Draft of a new agent conversation","draft.notStarted":"agent not started yet","draft.engineAria":"Agent engine","draft.handoffLabel":"handoff: {title}","draft.newConvo":"new conversation","draft.conversation":"conversation","draft.dismiss":"Dismiss the draft conversation","draft.directory":"directory","draft.dirAria":"Agent working directory","draft.reasoning":"reasoning","draft.reasoningAria":"Reasoning effort level","draft.effortDefault":"effort: default","draft.speedAria":"Codex speed mode","draft.speedTitle":"fast = priority tier (1.5x speed, higher usage)","draft.speedDefault":"speed: default","draft.imagesOnly":"(images)","draft.launched":"agent launched in tmux {target} — waiting for the conversation to appear here…","draft.slow":"Taking a while. Check tmux window {target} — the panel will pick up the transcript as soon as it appears.","draft.hintRelay":"The new agent will first read the parent conversation's transcript and pick up from there. Add to the prompt what to do next — the branch will appear on the scheme alongside.","draft.hintNew":"Choose an engine and a directory, write the first prompt — the agent will start in tmux, and the conversation will continue in this same panel.","draft.promptAria":"First prompt for the new agent","draft.placeholder":"first prompt — the agent will start in tmux…","draft.promptTextAria":"First prompt text","draft.newWindowTitle":"new tmux window with a fresh agent","draft.newAgent":"new agent","draft.addImages":"Add images to the prompt","draft.stopAndLaunch":"Stop recording and launch the agent","link.handoffContext":"You've been handed another agent's context — the conversation \xab{title}\xbb. Its transcript: {path} — read that file first for full context, then carry out the request below.\n\n{ask}","link.dropped":"context is in the composer of \xab{title}\xbb — type the ask and send","handoff.aria":"Hand the conversation to a new agent — a draft appears below","handoff.title":"click — draft a new agent with this context \xb7 drag — link to an existing one","handoff.label":"hand off to agent","qr.showAria":"Show a QR code for phone login","qr.failed":"couldn't get the link","qr.startHint":"Start the viewer with Tailscale access: ","qr.alt":"QR code for phone login","qr.generating":"generating QR…","qr.linkAria":"Phone login link","qr.copy":"Copy link","qr.scanHint":"scan from a phone on the same tailnet","push.enabled":"Push notifications enabled","push.enable":"Enable push notifications","push.disable":"Disable push notifications","push.needsHttps":"Push requires HTTPS","sound.on":"Sound notifications on","sound.off":"Sound notifications off","sound.mute":"Mute sound notifications","sound.unmute":"Enable sound notifications","mic.stopRecognize":"Stop recording and transcribe","mic.cancel":"Cancel recording","mic.recognizing":"Transcribing…","mic.dictate":"Dictate","mic.dictateHint":"dictate (up to 2 min) \xb7 right-click: transcription method","mic.connecting":"Connecting the microphone — a moment…","mic.menuTitle":"Transcription method","mic.menuLoading":"checking what's available…","mic.menuLocked":"Locked by the LLV_TRANSCRIBE_BACKEND environment variable","mic.noKey":"not set up","mic.saveFailed":"couldn't save the choice","mic.keyTitle":"{name} is not set up","mic.copy":"copy","mic.copyPath":"Copy path","mic.copied":"copied","mic.back":"Back","stt.local.name":"Faster Whisper","stt.local.desc":"Free, fully local — audio never leaves this machine.","stt.local.fix":"Run scripts/setup-whisper.sh in the app folder once; it installs the local engine at:","stt.chatgpt.name":"ChatGPT Voice","stt.chatgpt.desc":"Covered by your ChatGPT subscription, via the Codex login.","stt.chatgpt.fix":"Log in to Codex (run `codex login`) — the token will appear at:","stt.elevenlabs.name":"ElevenLabs Scribe","stt.elevenlabs.desc":"Paid ElevenLabs API — the most accurate option.","stt.elevenlabs.fix":"Put your ElevenLabs API key (a single line) into this file:","delFile.confirm":"Delete from disk?","delFile.aria":"Delete the conversation from disk","img.readFailed":"couldn't read the image","img.readAborted":"image reading aborted","img.unsupported":"unsupported image format: {name}","img.unknownFile":"unknown file","img.tooLarge":"{name}: too large (10 MB limit)","img.image":"image","img.error":"image error","img.previewAlt":"image preview {n}","img.removeAria":"Remove image {n}","img.toFilePaths":"as file paths","question.sec":"{n} s","question.min":"{n} min","question.hour":"{n} h","question.waiting":"waiting for a reply","question.sentToPane":"Sent to the pane: {text}","question.keysHint":"keys into the pane \xb7 or the composer below","question.pane":"Pane {target}","question.alreadyAnswered":"answer already recorded","question.openFailed":"couldn't open the session","question.opened":"opened {target}","question.answered":"Answered: {text}","question.answeredElsewhere":"Answered elsewhere: {text}","question.noPane":"tmux pane unavailable","question.openSession":"open session","question.rejectComment":"Rejection comment…","question.approved":"approved","question.rejected":"rejected","question.approve":"Approve","question.reject":"Reject","question.ownAnswer":"Your own answer…","inbox.deleted":"deleted from disk","inbox.fileGone":"the file is no longer on disk","inbox.confirmDelete":"Delete the file from disk?","inbox.deleteAria":"Delete {name} from disk","inbox.deleteFromDisk":"delete from disk","inbox.attachedAlt":"attached image {name}","lightbox.zoomOut":"Zoom out","lightbox.resetZoom":"Reset zoom","lightbox.zoomIn":"Zoom in","feed.agentEnded":"agent finished","feed.copyCode":"Copy code","feed.copyMd":"Copy message (Markdown)","feed.running":"running {tool}…","feed.tool":"tool","feed.thinking":"thinking…","feed.working":"working…","feed.liveTail":"live tail","feed.backToLive":"Back to the live tail","feed.newCount":"{count} new","feed.down":"down","feed.pickLog":"Pick a log on the left — the feed updates itself","feed.showEarlier":"show earlier","feed.showEarlierHidden":"show earlier (hidden {count})","feed.loadEarlier":"load earlier from the file","feed.startOfConvo":"start of the conversation","feed.finishedTurn":"finished the turn — waiting for a reply","feed.returnedResult":"returned with a result","feed.noOutput":"No output yet — the file is empty for now","feed.onlyService":"Only service records are present ({count}).","feed.empty":"Empty (no rows to show)","render.system":"system","render.executing":"executing…","render.error":"error","render.teammate":"teammate","render.left":"{peer}: left{at}","render.codexSessionCreated":"Codex session created","render.taskStarted":"Task started","render.taskComplete":"Task completed","render.compacted":"context compacted","render.compactAuto":"auto","render.compactManual":"manual","render.compactPre":"{n}k tokens before","render.compactSummary":"conversation summary","render.patch":"patch","render.stdinSession":"stdin → session {id}","render.record":"record","render.protocol":"protocol","render.jobLogNote":"(this is a job log: it has no command stdout; the full output is in the Codex rollout session in the left list)","render.image":"image","render.dataKb":"{n} kB of data","render.commands":{one:"{count} command",other:"{count} commands"},"render.noFindings":"no findings","render.moreFindings":"{count} more findings in raw","render.memoryCitations":"memory citations ({count})","render.noCitations":"no citation entries","render.moreEntries":"{count} more entries in raw","render.truncated":"truncated","render.shutdownRequest":"shutdown request","render.shutdownResponse":"shutdown response","render.planRequest":"plan approval request","render.planVerdict":"plan verdict","render.approved":"approved","render.rejected":"rejected","render.from":"from {from}","render.structured":"structured message","render.showJson":"show JSON","render.noOutputInLog":"(output is absent from this log file — the full output is in the Codex rollout session)","render.filesChanged":"files changed","render.toDir":"to","render.fromDir":"from","render.delivered":"delivered","render.notDelivered":"not delivered","render.reasoning":"agent reasoning","flowDialog.engine":"Engine: {label}","flowDialog.modelPlaceholder":"model (default)","flowDialog.model":"Model: {label}","flowDialog.effortDefault":"effort: default","flowDialog.createFailed":"couldn't create the flow ({status})","flowDialog.title":"Start a flow","flowDialog.subtitle":"implement → review \xb7 this conversation becomes the implementer","flowDialog.preset":"preset","flowDialog.rolesManualOpen":"▾ roles manually","flowDialog.rolesManual":"▸ roles manually (model / effort)","flowDialog.implementer":"implementer","flowDialog.reviewer":"reviewer","flowDialog.diffBase":"diff base","flowDialog.fromHead":"from current HEAD","flowDialog.fromMergeBase":"from merge-base with main","flowDialog.headless":"headless (no pane)","flowDialog.tmuxPane":"tmux pane","flowDialog.transitions":"transitions","flowDialog.auto":"auto","flowDialog.manual":"manual (gate every step)","flowDialog.roundLimit":"round limit","flowDialog.creating":"creating…","flowDialog.start":"▶ Start","flowStrip.startReview":"Start review","flowStrip.spawnReviewer":"Spawn reviewer","flowStrip.relayNotes":"Relay notes","flowStrip.retryRound":"Retry round","flowStrip.anotherRound":"Another round","flowStrip.flow":"FLOW","flowStrip.roundsAria":"Review rounds","flowStrip.roundError":"Round {n}: {error}","flowStrip.roundVerdict":"Round {n}: {verdict}","flowStrip.roundInProgress":"Round {n}: in progress","flowStrip.addRoundsTitle":"Add more rounds to the limit","flowStrip.plus2":"+2 rounds","flowStrip.limitTitle":"Round limit: reviews before the loop parks (∞ — unlimited)","flowStrip.limitAria":"Set the round limit to {count}","flowStrip.limitUnlimitedAria":"Unlimited rounds","flowStrip.stopReviewer":"Stop","flowStrip.stopReviewerTitle":"Stop the running reviewer; the round lands in “needs decision”","flowStrip.notePlaceholder":"note for the reviewer…","flowStrip.noteTitle":"Sent to the next reviewer as the round's ready note","flowStrip.autoTitle":"Auto: transitions run themselves. Click — manual.","flowStrip.manualTitle":"Manual: every transition waits for a click. Click — auto.","flowStrip.manualShort":"manual","flowStrip.resume":"Resume flow","flowStrip.pause":"Pause","flowStrip.close":"Close flow","roundDeck.roundAborted":"Round {n} \xb7 aborted","roundDeck.roundVerdict":"Round {n} \xb7 {verdict}","roundDeck.roundInProgress":"Round {n} \xb7 in progress","roundDeck.aborted":"aborted","roundDeck.reviewInProgress":"review in progress","roundDeck.waitingFirst":"waiting for the first review round…","roundDeck.spawningReviewer":"launching the reviewer — the transcript will appear shortly…","roundDeck.moreRounds":"{count} more round(s) — click the chips on the flow strip","roundDeck.findings":{one:"{count} finding",other:"{count} findings"},"flowState.waiting_ready":"waiting for READY","flowState.spawn_pending":"ready to spawn the reviewer","flowState.spawning":"spawning the reviewer","flowState.reviewing":"reviewing","flowState.relay_pending":"verdict ready — relay?","flowState.relaying":"relaying notes","flowState.fixing":"fixing","flowState.approved":"approved","flowState.done_comment":"done with comments","flowState.needs_decision":"needs a decision","flowState.paused":"paused","flowState.closed":"closed","flowModel.failed":"failed ({status})","wfState.provisioning":"provisioning the worktree","wfState.implementing":"stages running","wfState.reviewing":"reviewing","wfState.finishing":"finishing","wfState.approved":"approved","wfState.needs_decision":"needs a decision","wfState.paused":"paused","wfState.closed":"closed","wfModel.failed":"failed ({status})","wfStrip.workflow":"WORKFLOW","wfStrip.stagesAria":"Workflow stages","wfStrip.reviewStage":"review","wfStrip.advance":"Advance","wfStrip.retryStage":"Retry stage","wfStrip.skipStage":"Skip","wfStrip.resume":"Resume workflow","wfStrip.pause":"Pause","wfStrip.close":"Close workflow","wfDraft.paneAria":"Draft of a new workflow","wfDraft.notStarted":"the workflow is not launched yet","wfDraft.newWorkflow":"new workflow","wfDraft.dismiss":"Dismiss the workflow draft","wfDraft.template":"template","wfDraft.templateAria":"Workflow template","wfDraft.repo":"repository","wfDraft.repoAria":"Repository directory","wfDraft.manualMode":"manual: a gate at every stage boundary","wfDraft.hint":"Pick a template and a repository, describe the task — the workflow creates a worktree, runs the stages and the review, then opens a PR.","wfDraft.taskPlaceholder":"the task for the workflow — the brief goes to every stage…","wfDraft.taskAria":"Workflow task brief","wfDraft.footerHint":"worktree \xb7 stages \xb7 review \xb7 PR","wfDraft.finishMerge":"local merge","wfDraft.needDir":"set the repository directory","wfDraft.needTask":"describe the task","wfDraft.launchFailed":"launch failed","wfDraft.launch":"▶ Launch workflow","wfDraft.launching":"launching…","scheme.flowTitle":"Run the implement → review cycle for this conversation","scheme.flow":"Flow","scheme.collapsedTitle":"Collapsed branches and tasks of this conversation","scheme.underneath":"underneath","scheme.handTool":"Hand — drag the canvas (H, or hold Space)","scheme.selectTool":"Select — click and work with conversations (V)","scheme.zoomOut":"Zoom out (−)","scheme.zoom100":"Zoom 100% (1)","scheme.zoomIn":"Zoom in (+)","scheme.fit":"Fit all (0, or double-click the background)","scheme.roleImplementer":"Implementer","scheme.roleReviewer":"Reviewer","scheme.roleWorking":"working","scheme.roleWaiting":"waiting","scheme.lassoTool":"Multi-select — draw a box around agents, click cards to toggle","bulk.selectedCount":{one:"{count} selected",other:"{count} selected"},"bulk.placeholder":"one message to every selected agent…","bulk.textAria":"Broadcast text for the selected agents","bulk.sendAll":"Send to {count} agents","bulk.interrupt":"Interrupt","bulk.stop":"Stop","bulk.stopConfirm":"Stop {count} agents?","bulk.remove":"Clear from board","bulk.removeConfirm":"Close {count} cards?","bulk.flow":"Flow","bulk.fit":"Show selection","bulk.exit":"Exit selection (Esc)","bulk.retryFailed":"Retry failed ({count})","bulk.nodeGone":"node left the board","bulk.flowTitle":"Start a review flow on {count} agents","bulk.flowStart":"Start {count} flows","minimap.title":"Minimap — click or drag to navigate","plan.agentPlan":"Agent plan:","plan.stepsAria":"Plan: {done} of {total} steps","plan.nowSuffix":", now: {current}","plan.goal":"goal","plan.goalDone":"goal ✓","plan.goalBlocked":"goal ✖","plan.noObjective":"(objective not recorded in the transcript tail)","plan.tokens":"tokens: {n}","plan.time":"time: {n} min","plan.ctxTitle":"Context window: {pct}% used\n{used} of {window} tokens","plan.ctxAria":"Context: {pct} percent of the window used","plan.goalAria":"Session goal: {status}","limits.now":"now","limits.inMin":"in {n}m","limits.inHour":"in {n}h","limits.inDay":"in {n}d","limits.asOf":"as of {time}","limits.left":"left","limits.reset":"reset {eta} \xb7 {at}","limits.stale":"data is stale: {stale}","limits.5h":"5h","limits.week":"Week","resources.ram":"RAM","resources.swap":"Swap","resources.free":"{amount} free","resources.used":"{amount} used","resources.stale":"resource data is stale: {stale}","resources.openAria":"Agent sessions and memory","resources.title":"Agent sessions","resources.total":"Σ {amount}","resources.empty":"no agent sessions in tmux","resources.orphan":"orphan pane","resources.procs":{one:"{count} process",other:"{count} processes"},"resources.swapShare":"+ {amount} swap","resources.kill":"Kill","resources.confirm":"Sure?","resources.killLiveHint":"the agent is working right now — click to unlock, then confirm","resources.killHint":"kill the tmux pane with its whole process tree","resources.bulkLabel":"idle longer than","resources.bulkKill":"Kill idle","resources.bulkNone":"nothing has been idle that long","resources.hoursN":"{n} h","resources.killAll":"Kill all agents","resources.killAllConfirm":"Confirm — kill {n}?","resources.killAllHint":"force-kill every agent pane, live ones included — a clean slate so the next spawn/message routes cleanly. Your shells and the viewer are left alone.","resources.killAllNone":"no agent sessions to kill","resources.close":"Close","status.awaitingPlan":"awaiting plan approval","status.awaitingAnswer":"awaiting an answer to a question","status.awaitingTerminal":"awaiting a reply in the terminal","status.working":"working…","status.returnedResult":"returned with a result","status.stalled":"interrupted or awaiting permission","status.finishedTurn":"finished the turn — waiting for a reply","status.flow":"flow: {label}","dictation.failed":"couldn't transcribe","dictation.silence":"silence — nothing recognized","dictation.unsupported":"recording is not supported in this browser","dictation.liveError":"live transcription error","dictation.connectionLost":"transcription connection dropped","dictation.noMic":"no microphone access","overview.branchesLiveIn":{one:"{count} branch running in {projects}",other:"{count} branches running in {projects}"},"overview.projects":{one:"{count} project",other:"{count} projects"},"overview.archived":"\xb7 {count} archived","overview.moreLive":"{count} more live","overview.quiet":"quiet \xb7 last activity {age}","overview.empty":"No logs yet","branch.live":"working","branch.waiting":"finished the turn — waiting for a reply","branch.returned":"returned with a result","branch.stalled":"interrupted or awaiting permission","branch.done":"done — safe to remove","branch.worktree":"Worktree {name}","branch.lastActivity":"Last activity: {age}","branch.lastActivityQuiet":"Marked active, but the transcript is quiet: last activity {age}","branch.handoffTitle":"agent spawned by this conversation's handoff","branch.branchTitle":"branch of this conversation","branch.removeColumn":"Remove column {title}","branch.toggleBackground":"{action} background task {title}","branch.collapse":"Collapse","branch.expand":"Expand","branch.expandFull":"Expand conversation {title} to the full window","branch.collapseFull":"Back to the canvas (Esc)","tree.quiet":"Quiet conversations and tasks","corner.waitingCount":"\xb7 {count} waiting","corner.openSwitchboard":"Open the agent switchboard","task.working":", working","task.interrupted":", interrupted","task.finished":", finished","task.interruptedBadge":"interrupted","task.finishedBadge":"finished","task.stopFailed":"couldn't stop","task.signalSent":"sent {signal} to PID {pid}","task.confirmKill":"Really kill PID {pid}?","task.killPid":"Kill {pid}","task.confirmKillYes":"Yes, kill","task.stopAria":"Stop process PID {pid}","task.kill":"Kill","task.backgroundCommand":"Background command","task.commandNotFound":"The command that started this background task wasn't found in the session transcripts","viewer.closeProjects":"Close the project list","viewer.agentWaiting":"Agent is waiting for a reply","viewer.closeNotification":"Close the notification","attention.badge":{one:"{count} waiting",other:"{count} waiting"},"attention.openQueue":"Attention queue — who is blocked on you (N — next)","attention.popoverTitle":"Waiting on you","attention.filterOn":"Show only those waiting on you (F)","attention.filterOff":"Show all nodes (F)","mobile.noConvos":"No conversations yet","mobile.map":"Map","mobile.closeMap":"Close the map","mobile.tapNode":"Tap a node — the conversation opens full-screen","mobile.agent":"agent","mobile.openMap":"Open the project map","tasks.failed":"failed ({status})","tasks.tool":"Task — the next click drops a card on the canvas (T)","tasks.untitled":"untitled","tasks.newPlaceholder":"task text… (the first line is the title)","tasks.editAria":"Task text","tasks.spawning":"starting…","tasks.deadChip":"the conversation is gone from the list","tasks.source":"source","tasks.sourceTitle":"Captured from","tasks.retry":"retry delivery","tasks.chipFailedTitle":"not delivered: {error}","tasks.handoffChip":"routed into this agent's prompt — not sent yet","tasks.detach":"detach","tasks.detachAria":"Detach {title} from this task","tasks.send":"send","tasks.sendTitle":"Pull the arrow onto an agent's pane to drop the task into its prompt (nothing is sent); click to seed a fresh draft conversation","tasks.linkHanded":"routed into “{title}” — review and send it there","tasks.linkSent":"task sent → “{title}”","tasks.spawn":"agent","tasks.spawnTitle":"Spawn a fresh agent with this task as the brief","tasks.spawnGo":"Launch","tasks.statusTitle":"Status: {label} — click cycles (inbox → assigned → blocked → done)","tasks.statusPrefix":"status","tasks.status.inbox":"inbox","tasks.status.assigned":"assigned","tasks.status.blocked":"blocked","tasks.status.done":"done","tasks.delete":"delete","tasks.deleteConfirm":"sure?","tasks.deleteAria":"Delete task {title}","tasks.pickerTitle":"Send to","tasks.pickerAllChildren":"⤷ all children","tasks.pickerEmpty":"no conversations in the project","tasks.pickerSend":"Send ({count})","tasks.sendOk":"Delivered {delivered} of {total}","tasks.sendFailPart":"✗ “{title}”: {error}","tasks.spawnOk":"agent started in tmux {target}","tasks.composerToggle":"create a task","tasks.composerToggleTitle":"On — the text becomes a tracked task card assigned to the selection; off — a plain broadcast with no trace","tasks.composerNeedsText":"a task needs text","tasks.panelTitle":"Tasks","tasks.panelToggleAria":"Toggle the task panel","tasks.panelThisProject":"this project","tasks.panelAll":"all","tasks.panelEmpty":"no tasks yet — drop one with the board's task tool (T)","tasks.panelClose":"Close the task panel","tasks.sheetNew":"new task","tasks.sheetCreate":"Create the task","tasks.sheetBack":"Back to the task list","tasks.sheetTargets":{one:"{count} target",other:"{count} targets"},"tasks.sheetAssignments":"assignments","tasks.sheetEmpty":"no tasks yet","tasks.sheetGone":"the task is gone","tasks.textNotSaved":"the text didn't save — delivery aborted, try again","tasks.emptyTextBlocked":"empty text isn't saved — restore the task text before sending"},uk:{"common.serverUnavailable":"сервер недоступний","common.loading":"завантаження…","common.loadingCap":"Завантаження…","common.cancel":"Скасувати","common.show":"показати","common.showAll":"показати все","common.collapse":"згорнути","common.copy":"Копіювати","common.copied":"скопійовано","common.clickToCopy":"клік — скопіювати","common.yes":"Так","common.no":"Ні","common.send":"Надіслати","common.sending":"надсилаю…","common.sent":"надіслано","common.close":"Закрити","common.failedSend":"не вдалося надіслати","common.failedDelete":"не вдалося видалити","common.nothingFound":"Нічого не знайдено","common.nothingRunning":"зараз нічого не працює","common.kb":"кБ","common.chars":"{n} симв.","lang.aria":"Мова інтерфейсу","util.effortTitle":"Зусилля міркування: {effort}","time.agoSec":"{n} с тому","time.agoMin":"{n} хв тому","time.agoHour":"{n} год тому","time.agoDay":"{n} д тому","kind.session":"сесія","kind.subagent":"субагент","kind.job":"джоба","kind.background":"фон","kind.handoff":"хендофф","rail.title":"Логи агентів","rail.filter":"Фільтр проєктів…","rail.projects":"Проєкти","rail.overview":"Огляд","rail.archive":"Архів","dash.branchesLive":{one:"{count} гілка працює",few:"{count} гілки працюють",many:"{count} гілок працюють",other:"{count} гілок працюють"},"dash.trees":{one:"{count} дерево",few:"{count} дерева",many:"{count} дерев",other:"{count} дерев"},"dash.recentConvos":{one:"{count} нещодавня розмова",few:"{count} нещодавні розмови",many:"{count} нещодавніх розмов",other:"{count} нещодавніх розмов"},"dash.quietTrees":{one:"{count} тихе дерево",few:"{count} тихі дерева",many:"{count} тихих дерев",other:"{count} тихих дерев"},"dash.openProjects":"Відкрити список проєктів","dash.unarchive":"Повернути з архіву","dash.newConvo":"Нова розмова з агентом","dash.agent":"Агент","dash.newWorkflow":"Новий воркфлоу: етапи → ревью → PR","dash.workflow":"Воркфлоу","dash.emptyTitle":"На схемі поки порожньо","dash.emptyHint":"Відкрий пульт у правому нижньому куті і клікни розмову — вона з'явиться тут","dash.viewScheme":"схема","dash.viewList":"список","trash.title":"На схемі порожньо, але в проєкті є записи","trash.hint":"Клік по рядку відкриває розмову нодою; смітник видаляє її файл з диска назавжди.","trash.deletedFromDisk":"\xb7 видалено з диска","trash.open":"Відкрити {title}","trash.activeSubtree":"має активні гілки","trash.toArchive":"В архів","trash.notDeleted":"не видалено {failed} з {total}","trash.confirmDelete":{one:"Видалити з диска {count} файл проєкту?",few:"Видалити з диска {count} файли проєкту?",many:"Видалити з диска {count} файлів проєкту?",other:"Видалити з диска {count} файлів проєкту?"},"trash.deleting":"видаляю…","trash.confirmYes":"Так, видалити","trash.deleteProject":"Видалити проєкт з диска","switch.aria":"Пульт агентів","switch.title":"Пульт","switch.search":"Пошук за назвою або проєктом","switch.updating":"оновлення…","switch.close":"Закрити пульт","switch.waiting":"Чекає тебе","switch.working":"Працюють","switch.recent":"Нещодавні","switch.older":"Старіше","switch.hidden":"Приховані ({count})","switch.hide":"сховати","switch.restore":"повернути","switchCard.openColumn":"Відкрити колонкою {title}","switchCard.remove":"Прибрати з пульта","composer.imagesCount":{one:"{count} картинка",few:"{count} картинки",many:"{count} картинок",other:"{count} картинок"},"composer.spawned":"запущено агента в tmux {target}","composer.sentPaths":"надіслано {count} шлях(и)","composer.failedInterrupt":"не вдалося перервати","composer.escapeSent":"надіслано Escape — агент перервано","composer.spawnAria":"Запустити агента з промптом у tmux","composer.sendAria":"Надіслати повідомлення агенту в tmux {target}","composer.queueAria":"Черга надісланих повідомлень","composer.removeFromQueue":"Прибрати з черги","composer.placeholderRelay":"написати — передам через кореневу сесію…","composer.placeholderSpawn":"промпт — агент запуститься в tmux…","composer.placeholderSend":"написати агенту…","composer.textAria":"Текст для агента","composer.titleRelay":"передасться через кореневу сесію гілки","composer.titleSpawnResumed":"нове tmux-вікно з відновленим агентом","composer.root":"корінь","composer.interruptAria":"Перервати агента (Escape)","composer.interruptTitle":"надіслати Escape у пейн агента","composer.compactAria":"Стиснути контекст агента (/compact)","composer.compactTitle":"надіслати /compact — агент стисне контекст; після завершення у стрічці з'явиться позначка","composer.compactConfirm":"Точно?","composer.compactConfirmTitle":"Натисни ще раз, щоб надіслати /compact","composer.compactSent":"стискання почалось — позначка з'явиться у стрічці, щойно завершиться","composer.failedCompact":"не вдалося запустити стискання","composer.addImages":"Додати картинки","composer.moreTools":"Додаткові дії","composer.stopAndSend":"Зупинити запис і надіслати","composer.launchAgent":"Запустити агента","composer.sendToAgent":"Надіслати агенту","composer.stopAndSendTitle":"зупинити запис і надіслати","composer.sendMenuTitle":"Дії відправки","composer.quickAck":"Так, продовжуй","composer.quickAckLabel":"Продовжити","composer.quickAckAria":"Надіслати агенту швидке \xabТак, продовжуй\xbb","composer.quickAckTitle":"Швидка відповідь — так, продовжуй","draft.readPrompt":"Прочитай розмову агента у файлі {src} і продовж роботу звідти: ","draft.needDir":"вкажи робочу директорію","draft.launchFailed":"не вдалося запустити","draft.paneAria":"Чернетка нової розмови з агентом","draft.notStarted":"агент ще не запущений","draft.engineAria":"Двигун агента","draft.handoffLabel":"хендофф: {title}","draft.newConvo":"нова розмова","draft.conversation":"розмова","draft.dismiss":"Прибрати чернетку розмови","draft.directory":"директорія","draft.dirAria":"Робоча директорія агента","draft.reasoning":"reasoning","draft.reasoningAria":"Рівень reasoning-зусилля","draft.effortDefault":"effort: дефолт","draft.speedAria":"Режим швидкості Codex","draft.speedTitle":"fast = priority tier (1.5x швидкість, більша витрата лімітів)","draft.speedDefault":"швидкість: дефолт","draft.imagesOnly":"(картинки)","draft.launched":"агент запущений у tmux {target} — чекаю, поки розмова з'явиться тут…","draft.slow":"Щось довго. Перевір вікно tmux {target} — щойно транскрипт з'явиться, панель підхопить його сама.","draft.hintRelay":"Новий агент спершу прочитає транскрипт батьківської розмови і продовжить з того місця. Допиши в промпт, що зробити далі, — гілка з'явиться на схемі поруч.","draft.hintNew":"Обери двигун і директорію, напиши перший промпт — агент запуститься в tmux, і розмова продовжиться в цій самій панелі.","draft.promptAria":"Перший промпт для нового агента","draft.placeholder":"перший промпт — агент запуститься в tmux…","draft.promptTextAria":"Текст першого промпта","draft.newWindowTitle":"нове tmux-вікно зі свіжим агентом","draft.newAgent":"новий агент","draft.addImages":"Додати картинки до промпта","draft.stopAndLaunch":"Зупинити запис і запустити агента","link.handoffContext":"Тобі передали контекст іншого агента — розмову \xab{title}\xbb. Її транскрипт: {path} — спочатку прочитай цей файл, щоб мати повний контекст, а тоді виконай прохання нижче.\n\n{ask}","link.dropped":"контекст у промпті \xab{title}\xbb — допиши прохання і надішли","handoff.aria":"Перекинути розмову новому агентові — чернетка з'явиться нижче","handoff.title":"клік — чернетка нового агента з цим контекстом \xb7 потягни — звʼязати з наявним","handoff.label":"перекинути агенту","qr.showAria":"Показати QR для входу з телефона","qr.failed":"не вдалося отримати посилання","qr.startHint":"Запустіть viewer з доступом через Tailscale: ","qr.alt":"QR код для входу з телефона","qr.generating":"генерую QR…","qr.linkAria":"Посилання для входу з телефона","qr.copy":"Копіювати посилання","qr.scanHint":"скануй з телефона в тому ж tailnet","push.enabled":"Push-сповіщення увімкнено","push.enable":"Увімкнути push-сповіщення","push.disable":"Вимкнути push-сповіщення","push.needsHttps":"Push потребує HTTPS","sound.on":"Звукові сповіщення увімкнено","sound.off":"Звукові сповіщення вимкнено","sound.mute":"Вимкнути звукові сповіщення","sound.unmute":"Увімкнути звукові сповіщення","mic.stopRecognize":"Зупинити запис і розпізнати","mic.cancel":"Скасувати запис","mic.recognizing":"Розпізнаю…","mic.dictate":"Надиктувати","mic.dictateHint":"надиктувати (до 2 хв) \xb7 правий клік: спосіб розпізнавання","mic.connecting":"Під'єдную мікрофон — секунду…","mic.menuTitle":"Спосіб розпізнавання","mic.menuLoading":"перевіряю, що доступно…","mic.menuLocked":"Заблоковано змінною середовища LLV_TRANSCRIBE_BACKEND","mic.noKey":"не налаштовано","mic.saveFailed":"не вдалося зберегти вибір","mic.keyTitle":"{name} не налаштовано","mic.copy":"копіювати","mic.copyPath":"Скопіювати шлях","mic.copied":"скопійовано","mic.back":"Назад","stt.local.name":"Faster Whisper","stt.local.desc":"Безкоштовно, повністю локально — аудіо не покидає цю машину.","stt.local.fix":"Запусти scripts/setup-whisper.sh у теці застосунку один раз; він встановить локальний рушій у:","stt.chatgpt.name":"ChatGPT Voice","stt.chatgpt.desc":"У межах підписки ChatGPT, через логін Codex.","stt.chatgpt.fix":"Залогінься в Codex (команда `codex login`) — токен з'явиться у:","stt.elevenlabs.name":"ElevenLabs Scribe","stt.elevenlabs.desc":"Платний API ElevenLabs — найточніший варіант.","stt.elevenlabs.fix":"Поклади свій API-ключ ElevenLabs (одним рядком) у цей файл:","delFile.confirm":"Видалити з диска?","delFile.aria":"Видалити розмову з диска","img.readFailed":"не вдалося прочитати картинку","img.readAborted":"читання картинки перервано","img.unsupported":"непідтримуваний формат картинки: {name}","img.unknownFile":"невідомий файл","img.tooLarge":"{name}: завелика (ліміт 10 МБ)","img.image":"картинка","img.error":"помилка картинки","img.previewAlt":"прев'ю картинки {n}","img.removeAria":"Прибрати картинку {n}","img.toFilePaths":"шляхами до файлів","question.sec":"{n} с","question.min":"{n} хв","question.hour":"{n} год","question.waiting":"чекає на відповідь","question.sentToPane":"Надіслано в пейн: {text}","question.keysHint":"клавіші в пейн \xb7 або композер нижче","question.pane":"Пейн {target}","question.alreadyAnswered":"відповідь уже записана","question.openFailed":"не вдалося відкрити сесію","question.opened":"відкрито {target}","question.answered":"Відповідено: {text}","question.answeredElsewhere":"Відповідено в іншому місці: {text}","question.noPane":"tmux-пейн недоступний","question.openSession":"відкрити сесію","question.rejectComment":"Коментар до відхилення…","question.approved":"затверджено","question.rejected":"відхилено","question.approve":"Затвердити","question.reject":"Відхилити","question.ownAnswer":"Своя відповідь…","inbox.deleted":"видалено з диска","inbox.fileGone":"файла вже немає на диску","inbox.confirmDelete":"Видалити файл з диска?","inbox.deleteAria":"Видалити {name} з диска","inbox.deleteFromDisk":"видалити з диска","inbox.attachedAlt":"вкладена картинка {name}","lightbox.zoomOut":"Зменшити","lightbox.resetZoom":"Скинути масштаб","lightbox.zoomIn":"Збільшити","feed.agentEnded":"агент завершився","feed.copyCode":"Скопіювати код","feed.copyMd":"Скопіювати повідомлення (Markdown)","feed.running":"виконує {tool}…","feed.tool":"інструмент","feed.thinking":"думає…","feed.working":"працює…","feed.liveTail":"живий хвіст","feed.backToLive":"Повернутись до живого хвоста","feed.newCount":"{count} нових","feed.down":"вниз","feed.pickLog":"Вибери лог зліва — стрічка оновлюється сама","feed.showEarlier":"показати раніше","feed.showEarlierHidden":"показати раніше (сховано {count})","feed.loadEarlier":"завантажити раніше з файлу","feed.startOfConvo":"початок розмови","feed.finishedTurn":"закінчив хід — чекає відповіді","feed.returnedResult":"повернувся з результатом","feed.noOutput":"Ще без виводу — файл поки порожній","feed.onlyService":"Є лише службові записи ({count}).","feed.empty":"Порожньо (немає рядків для показу)","render.system":"системне","render.executing":"виконується…","render.error":"помилка","render.teammate":"тімейт","render.left":"{peer}: звільнився{at}","render.codexSessionCreated":"Сесія Codex створена","render.taskStarted":"Задача стартувала","render.taskComplete":"Задачу завершено","render.compacted":"контекст стиснуто","render.compactAuto":"авто","render.compactManual":"вручну","render.compactPre":"{n}k токенів до","render.compactSummary":"підсумок розмови","render.patch":"патч","render.stdinSession":"stdin → сесія {id}","render.record":"запис","render.protocol":"протокол","render.jobLogNote":"(це джоб-лог: він не містить stdout команд; повний вивід — у rollout-сесії Codex у списку зліва)","render.image":"зображення","render.dataKb":"даних {n} КБ","render.commands":{one:"{count} команда",few:"{count} команди",many:"{count} команд",other:"{count} команд"},"render.noFindings":"без findings","render.moreFindings":"ще {count} findings у raw","render.memoryCitations":"цитати пам'яті ({count})","render.noCitations":"без citation entries","render.moreEntries":"ще {count} entries у raw","render.truncated":"обрізано","render.shutdownRequest":"запит на завершення","render.shutdownResponse":"відповідь на завершення","render.planRequest":"запит на затвердження плану","render.planVerdict":"вердикт по плану","render.approved":"схвалено","render.rejected":"відхилено","render.from":"від {from}","render.structured":"структуроване повідомлення","render.showJson":"показати JSON","render.noOutputInLog":"(вивід у цьому лог-файлі відсутній — повний є в rollout-сесії Codex)","render.filesChanged":"файли змінені","render.toDir":"до","render.fromDir":"від","render.delivered":"доставлено","render.notDelivered":"не доставлено","render.reasoning":"міркування агента","flowDialog.engine":"Двигун: {label}","flowDialog.modelPlaceholder":"модель (дефолт)","flowDialog.model":"Модель: {label}","flowDialog.effortDefault":"effort: дефолт","flowDialog.createFailed":"не вдалося створити флоу ({status})","flowDialog.title":"Запустити флоу","flowDialog.subtitle":"implement → review \xb7 ця розмова стає виконавцем","flowDialog.preset":"пресет","flowDialog.rolesManualOpen":"▾ ролі вручну","flowDialog.rolesManual":"▸ ролі вручну (модель / effort)","flowDialog.implementer":"виконавець","flowDialog.reviewer":"ревʼюер","flowDialog.diffBase":"база діфу","flowDialog.fromHead":"від поточного HEAD","flowDialog.fromMergeBase":"від merge-base з main","flowDialog.headless":"headless (без панелі)","flowDialog.tmuxPane":"tmux-панель","flowDialog.transitions":"переходи","flowDialog.auto":"авто","flowDialog.manual":"вручну (гейт на кожен крок)","flowDialog.roundLimit":"ліміт раундів","flowDialog.creating":"створюю…","flowDialog.start":"▶ Запустити","flowStrip.startReview":"Почати ревью","flowStrip.spawnReviewer":"Заспавнити ревʼюера","flowStrip.relayNotes":"Передати зауваження","flowStrip.retryRound":"Повторити раунд","flowStrip.anotherRound":"Ще коло","flowStrip.flow":"ФЛОУ","flowStrip.roundsAria":"Раунди ревью","flowStrip.roundError":"Раунд {n}: {error}","flowStrip.roundVerdict":"Раунд {n}: {verdict}","flowStrip.roundInProgress":"Раунд {n}: триває","flowStrip.addRoundsTitle":"Додати ще раунди до ліміту","flowStrip.plus2":"+2 раунди","flowStrip.limitTitle":"Ліміт раундів: скільки ревью до зупинки (∞ — без ліміту)","flowStrip.limitAria":"Встановити ліміт раундів: {count}","flowStrip.limitUnlimitedAria":"Без ліміту раундів","flowStrip.stopReviewer":"Стоп","flowStrip.stopReviewerTitle":"Зупинити поточного ревʼюера; раунд перейде в \xabпотрібне рішення\xbb","flowStrip.notePlaceholder":"нотатка ревʼюеру…","flowStrip.noteTitle":"Піде наступному ревʼюеру як ready-нотатка раунду","flowStrip.autoTitle":"Авто: переходи самі. Клік — вручну.","flowStrip.manualTitle":"Вручну: кожен перехід чекає кліку. Клік — авто.","flowStrip.manualShort":"вручну","flowStrip.resume":"Продовжити флоу","flowStrip.pause":"Пауза","flowStrip.close":"Закрити флоу","roundDeck.roundAborted":"Раунд {n} \xb7 перервано","roundDeck.roundVerdict":"Раунд {n} \xb7 {verdict}","roundDeck.roundInProgress":"Раунд {n} \xb7 триває","roundDeck.aborted":"перервано","roundDeck.reviewInProgress":"ревью триває","roundDeck.waitingFirst":"чекаю на перший раунд ревью…","roundDeck.spawningReviewer":"запускаю ревʼюера — транскрипт зʼявиться за мить…","roundDeck.moreRounds":"ще {count} раунд(и) — клікни чипи на стрічці флоу","roundDeck.findings":{one:"{count} знахідка",few:"{count} знахідки",many:"{count} знахідок",other:"{count} знахідок"},"flowState.waiting_ready":"чекає READY","flowState.spawn_pending":"готовий спавнити ревʼюера","flowState.spawning":"запускаю ревʼюера","flowState.reviewing":"ревью","flowState.relay_pending":"вердикт є — передати?","flowState.relaying":"передаю зауваження","flowState.fixing":"фікси","flowState.approved":"затверджено","flowState.done_comment":"готово із зауваженнями","flowState.needs_decision":"потребує рішення","flowState.paused":"пауза","flowState.closed":"закрито","flowModel.failed":"не вдалося ({status})","wfState.provisioning":"готую worktree","wfState.implementing":"етапи виконуються","wfState.reviewing":"ревью","wfState.finishing":"завершення","wfState.approved":"approved","wfState.needs_decision":"потребує рішення","wfState.paused":"пауза","wfState.closed":"закрито","wfModel.failed":"не вдалося ({status})","wfStrip.workflow":"ВОРКФЛОУ","wfStrip.stagesAria":"Етапи воркфлоу","wfStrip.reviewStage":"ревью","wfStrip.advance":"Далі","wfStrip.retryStage":"Повторити етап","wfStrip.skipStage":"Пропустити","wfStrip.resume":"Продовжити воркфлоу","wfStrip.pause":"Пауза","wfStrip.close":"Закрити воркфлоу","wfDraft.paneAria":"Чернетка нового воркфлоу","wfDraft.notStarted":"воркфлоу ще не запущений","wfDraft.newWorkflow":"новий воркфлоу","wfDraft.dismiss":"Прибрати чернетку воркфлоу","wfDraft.template":"шаблон","wfDraft.templateAria":"Шаблон воркфлоу","wfDraft.repo":"репозиторій","wfDraft.repoAria":"Директорія репозиторію","wfDraft.manualMode":"вручну: гейт на межі кожного етапу","wfDraft.hint":"Обери шаблон і репозиторій, опиши задачу — воркфлоу створить worktree, прожене етапи, ревью і відкриє PR.","wfDraft.taskPlaceholder":"задача для воркфлоу — бриф піде кожному етапу…","wfDraft.taskAria":"Бриф задачі воркфлоу","wfDraft.footerHint":"worktree \xb7 етапи \xb7 ревью \xb7 PR","wfDraft.finishMerge":"merge локально","wfDraft.needDir":"вкажи директорію репозиторію","wfDraft.needTask":"опиши задачу","wfDraft.launchFailed":"не вдалося запустити","wfDraft.launch":"▶ Запустити воркфлоу","wfDraft.launching":"запускаю…","scheme.flowTitle":"Запустити цикл implement → review для цієї розмови","scheme.flow":"Флоу","scheme.collapsedTitle":"Згорнуті гілки й задачі цієї розмови","scheme.underneath":"під сподом","scheme.handTool":"Рука — тягнути полотно (H, або тримай Space)","scheme.selectTool":"Виділення — клік і робота з розмовами (V)","scheme.zoomOut":"Віддалити (−)","scheme.zoom100":"Масштаб 100% (1)","scheme.zoomIn":"Наблизити (+)","scheme.fit":"Вписати все (0, або подвійний клік по фону)","scheme.roleImplementer":"Імплементер","scheme.roleReviewer":"Ревʼюер","scheme.roleWorking":"працює","scheme.roleWaiting":"чекає","scheme.lassoTool":"Вибірка — обведи агентів рамкою, кліком додавай чи знімай","bulk.selectedCount":{one:"Вибрано {count}",few:"Вибрано {count}",many:"Вибрано {count}",other:"Вибрано {count}"},"bulk.placeholder":"одне повідомлення кожному вибраному агенту…","bulk.textAria":"Текст розсилки вибраним агентам","bulk.sendAll":"Надіслати {count} агентам","bulk.interrupt":"Перервати","bulk.stop":"Зупинити","bulk.stopConfirm":"Точно зупинити {count}?","bulk.remove":"Прибрати зі схеми","bulk.removeConfirm":"Закрити {count} карток?","bulk.flow":"Флоу","bulk.fit":"Показати вибірку","bulk.exit":"Вийти з вибірки (Esc)","bulk.retryFailed":"Повторити невдалі ({count})","bulk.nodeGone":"вузол зник зі схеми","bulk.flowTitle":"Запустити ревʼю-флоу для {count} агентів","bulk.flowStart":"Запустити {count} флоу","minimap.title":"Мінімапа — клікни або тягни, щоб перейти","plan.agentPlan":"План агента:","plan.stepsAria":"План: {done} з {total} кроків","plan.nowSuffix":", зараз: {current}","plan.goal":"ціль","plan.goalDone":"ціль ✓","plan.goalBlocked":"ціль ✖","plan.noObjective":"(objective не записаний у хвості транскрипта)","plan.tokens":"токенів: {n}","plan.time":"часу: {n} хв","plan.ctxTitle":"Контекстне вікно: використано {pct}%\n{used} з {window} токенів","plan.ctxAria":"Контекст: використано {pct} відсотків вікна","plan.goalAria":"Ціль сесії: {status}","limits.now":"зараз","limits.inMin":"через {n} хв","limits.inHour":"через {n} год","limits.inDay":"через {n} д","limits.asOf":"станом на {time}","limits.left":"лишилось","limits.reset":"скид {eta} \xb7 {at}","limits.stale":"дані застарілі: {stale}","limits.5h":"5 год","limits.week":"Тиждень","resources.ram":"RAM","resources.swap":"Swap","resources.free":"{amount} вільно","resources.used":"{amount} зайнято","resources.stale":"дані про ресурси застарілі: {stale}","resources.openAria":"Сесії агентів і пам'ять","resources.title":"Сесії агентів","resources.total":"Σ {amount}","resources.empty":"у tmux немає сесій агентів","resources.orphan":"осиротілий пейн","resources.procs":{one:"{count} процес",few:"{count} процеси",many:"{count} процесів",other:"{count} процесу"},"resources.swapShare":"+ {amount} swap","resources.kill":"Убити","resources.confirm":"Точно?","resources.killLiveHint":"агент зараз працює — натисни, щоб розблокувати, і підтверди","resources.killHint":"закрити tmux-пейн разом з усім деревом процесів","resources.bulkLabel":"неактивні довше ніж","resources.bulkKill":"Убити неактивні","resources.bulkNone":"немає сесій, неактивних так довго","resources.hoursN":"{n} год","resources.killAll":"Убити всіх агентів","resources.killAllConfirm":"Підтвердити — убити {n}?","resources.killAllHint":"примусово закрити кожен пейн агента, разом із активними — чистий старт, щоб наступний spawn/повідомлення пішли правильно. Твої шели і в'ювер не чіпає.","resources.killAllNone":"немає сесій агентів для закриття","resources.close":"Закрити","status.awaitingPlan":"чекає затвердження плану","status.awaitingAnswer":"чекає відповіді на питання","status.awaitingTerminal":"чекає на відповідь у терміналі","status.working":"працює…","status.returnedResult":"повернувся з результатом","status.stalled":"перервано або чекає дозволу","status.finishedTurn":"закінчив хід — чекає відповіді","status.flow":"флоу: {label}","dictation.failed":"не вдалося розпізнати","dictation.silence":"тиша — нічого не розпізналось","dictation.unsupported":"запис не підтримується в цьому браузері","dictation.liveError":"помилка live-транскрипції","dictation.connectionLost":"зʼєднання з транскрипцією обірвалось","dictation.noMic":"немає доступу до мікрофона","overview.branchesLiveIn":{one:"{count} гілка працює у {projects}",few:"{count} гілки працюють у {projects}",many:"{count} гілок працюють у {projects}",other:"{count} гілок працюють у {projects}"},"overview.projects":{one:"{count} проєкті",few:"{count} проєктах",many:"{count} проєктах",other:"{count} проєктах"},"overview.archived":"\xb7 {count} в архіві","overview.moreLive":"ще {count} live","overview.quiet":"тихо \xb7 остання активність {age}","overview.empty":"Логів поки нема","branch.live":"працює","branch.waiting":"закінчив хід — чекає відповіді","branch.returned":"повернувся з результатом","branch.stalled":"перервано або чекає дозволу","branch.done":"завершено — можна прибрати","branch.worktree":"Ворк-дерево {name}","branch.lastActivity":"Остання активність: {age}","branch.lastActivityQuiet":"Позначений активним, але транскрипт мовчить: остання активність {age}","branch.handoffTitle":"агент, породжений хендоффом цієї розмови","branch.branchTitle":"гілка цієї розмови","branch.removeColumn":"Прибрати колонку {title}","branch.toggleBackground":"{action} фонову задачу {title}","branch.collapse":"Згорнути","branch.expand":"Розгорнути","branch.expandFull":"Розгорнути розмову {title} на все вікно","branch.collapseFull":"Повернутися до полотна (Esc)","tree.quiet":"Тихі розмови й задачі","corner.waitingCount":"\xb7 {count} чекають","corner.openSwitchboard":"Відкрити пульт агентів","task.working":", працює","task.interrupted":", перервано","task.finished":", закінчив","task.interruptedBadge":"перервано","task.finishedBadge":"завершено","task.stopFailed":"помилка зупинки","task.signalSent":"надіслано {signal} PID {pid}","task.confirmKill":"Точно вбити PID {pid}?","task.killPid":"Вбити {pid}","task.confirmKillYes":"Так, вбити","task.stopAria":"Зупинити процес PID {pid}","task.kill":"Вбити","task.backgroundCommand":"Фонова команда","task.commandNotFound":"Команду, що запустила цю фонову задачу, не знайдено у транскриптах сесії","viewer.closeProjects":"Закрити список проєктів","viewer.agentWaiting":"Агент чекає відповіді","viewer.closeNotification":"Закрити сповіщення","attention.badge":{one:"{count} чекає",few:"{count} чекають",many:"{count} чекають",other:"{count} чекають"},"attention.openQueue":"Черга уваги — хто заблокований на тобі (N — наступний)","attention.popoverTitle":"Чекають на тебе","attention.filterOn":"Показати лише тих, хто чекає на тебе (F)","attention.filterOff":"Показати всі вузли (F)","mobile.noConvos":"Розмов поки нема","mobile.map":"Карта","mobile.closeMap":"Закрити карту","mobile.tapNode":"Тапни вузол — розмова відкриється на весь екран","mobile.agent":"агент","mobile.openMap":"Відкрити карту проєкту","tasks.failed":"не вдалося ({status})","tasks.tool":"Задача — наступний клік кладе картку на полотно (T)","tasks.untitled":"без назви","tasks.newPlaceholder":"текст задачі… (перший рядок — назва)","tasks.editAria":"Текст задачі","tasks.spawning":"запускається…","tasks.deadChip":"розмови вже немає у списку","tasks.source":"джерело","tasks.sourceTitle":"Взято з","tasks.retry":"повторити доставку","tasks.chipFailedTitle":"не доставлено: {error}","tasks.handoffChip":"закинуто в промпт цього агента — ще не надіслано","tasks.detach":"відв'язати","tasks.detachAria":"Відв'язати {title} від задачі","tasks.send":"надіслати","tasks.sendTitle":"Потягни стрілку на панель агента — задача ляже в його промпт (нічого не надсилається); клік — створить чернетку нової розмови","tasks.linkHanded":"закинуто в \xab{title}\xbb — перевір і надішли там","tasks.linkSent":"задачу надіслано → \xab{title}\xbb","tasks.spawn":"агент","tasks.spawnTitle":"Запустити нового агента з цією задачею як брифом","tasks.spawnGo":"Запустити","tasks.statusTitle":"Статус: {label} — клік перемикає (інбокс → призначено → заблоковано → готово)","tasks.statusPrefix":"статус","tasks.status.inbox":"інбокс","tasks.status.assigned":"призначено","tasks.status.blocked":"заблоковано","tasks.status.done":"готово","tasks.delete":"видалити","tasks.deleteConfirm":"точно?","tasks.deleteAria":"Видалити задачу {title}","tasks.pickerTitle":"Кому надіслати","tasks.pickerAllChildren":"⤷ всім дітям","tasks.pickerEmpty":"у проєкті немає розмов","tasks.pickerSend":"Надіслати ({count})","tasks.sendOk":"Доставлено {delivered} з {total}","tasks.sendFailPart":"✗ „{title}“: {error}","tasks.spawnOk":"агента запущено в tmux {target}","tasks.composerToggle":"створити задачу","tasks.composerToggleTitle":"Увімкнено — текст стає задачею-карткою з призначеннями на вибір; вимкнено — проста розсилка без сліду","tasks.composerNeedsText":"для задачі потрібен текст","tasks.panelTitle":"Задачі","tasks.panelToggleAria":"Показати або сховати панель задач","tasks.panelThisProject":"цей проєкт","tasks.panelAll":"всі","tasks.panelEmpty":"задач поки нема — кинь картку інструментом \xabзадача\xbb (T)","tasks.panelClose":"Закрити панель задач","tasks.sheetNew":"нова задача","tasks.sheetCreate":"Створити задачу","tasks.sheetBack":"Назад до списку задач","tasks.sheetTargets":{one:"{count} адресат",few:"{count} адресати",many:"{count} адресатів",other:"{count} адресатів"},"tasks.sheetAssignments":"призначення","tasks.sheetEmpty":"задач поки нема","tasks.sheetGone":"задачі вже немає","tasks.textNotSaved":"текст не зберігся — надсилання скасовано, спробуй ще раз","tasks.emptyTextBlocked":"порожній текст не зберігається — віднови текст задачі перед надсиланням"}},p="en",q=new Set;function r(){return p}function s(a){if(a!==p){p=a;try{window.localStorage.setItem("llv_lang",a)}catch{}for(let b of("u">typeof document&&(document.documentElement.lang=a),q))b()}}function t(a){return q.add(a),()=>q.delete(a)}function u(a,b,c){var d;let e,f=o[a][b]??o.en[b]??b;if("string"==typeof f)e=f;else{let b="number"==typeof c?.count?c.count:0;e=f[new Intl.PluralRules("uk"===a?"uk-UA":"en-US").select(b)]??f.other??f.one??""}return d=e,c?d.replace(/\{(\w+)\}/g,(a,b)=>b in c?String(c[b]):a):d}function v(){let a=(0,e.useSyncExternalStore)(t,r,()=>"en");return{locale:a,t:(b,c)=>u(a,b,c),setLocale:s}}function w(a,b=160){let c=a.replace(/\[([^\]]+)\]\(([^)]+)\)/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/[*_~#>]+/g,"").replace(/\s+/g," ").trim().replace(/(?:\/[^\s)]+){3,}/g,a=>{if(a.length<=40)return a;let b=a.split("/").filter(Boolean);return b.length>=2?".../"+b.slice(-2).join("/"):a}).replace(/\s+/g," ").trim();return c.length>b?c.slice(0,b-1).trimEnd()+"…":c}let x="__overview__",y=a=>Math.floor(a/300);function z(a){return"live"===a.activity?0:"recent"===a.activity?1:"stalled"===a.activity?2:3}function A(a){return"claude-projects"===a.root?"session"===a.kind&&!a.parent:"codex-sessions"===a.root&&!a.parent}function B(a){return"claude-projects"===a.root&&"subagent"===a.kind}function C(a){return!!B(a)||!!a.handoff&&!!a.parent||"codex-sessions"===a.root&&!!a.parent}function D(a){return"shell"===a.engine}function E(a){return a.project||"other"}let F=new Set(["provisioning","implementing","reviewing","finishing"]);function G(a,b=Date.now()/1e3,c=[]){let d=new Map,e=a=>{let b=d.get(a);return b||(b={project:a,liveCount:0,attentionCount:0,conversations:0,smt:0},d.set(a,b)),b};for(let c of a){let a=e(E(c));"live"===c.activity&&(a.liveCount+=1),null!==N(c,b)&&(a.attentionCount+=1),A(c)&&(a.conversations+=1),a.smt=Math.max(a.smt,c.mtime)}for(let a of c){if("closed"===a.state||!a.project)continue;let b=e(a.project);F.has(a.state)&&(b.liveCount+=1),("needs_decision"===a.state||"paused"===a.state)&&(b.attentionCount+=1),b.smt=Math.max(b.smt,(Date.parse(a.createdAt)||0)/1e3)}return[...d.values()].sort((a,b)=>{let c=a.attentionCount>0;return c!==b.attentionCount>0?c?-1:1:a.liveCount!==b.liveCount?b.liveCount-a.liveCount:y(b.smt)-y(a.smt)||a.project.localeCompare(b.project)})}function H(a,b){let c=new Set,d=a;for(;d.parent&&!c.has(d.path);){c.add(d.path);let a=b.get(d.parent);if(!a)break;d=a}return d}function I(a){let b=new Map;for(let c of a){if(!c.parent)continue;let a=b.get(c.parent);a?a.push(c):b.set(c.parent,[c])}return b}function J(a,b){let c=[],d=[...b.get(a.path)??[]],e=new Set([a.path]);for(;d.length;){let a=d.pop();e.has(a.path)||(e.add(a.path),c.push(a),d.push(...b.get(a.path)??[]))}return c}function K(a,b){return!D(a)&&("live"===a.activity||"running"===a.proc||"recent"===a.activity&&C(a)||C(a)&&b?.has(a.path)===!0)}function L(a){return K(a)||D(a)&&("live"===a.activity||"running"===a.proc)}function M(a,b,c={}){let d=new Map(a.map(a=>[a.path,a])),e=I(a),f=new Map,g=new Map,{expandedConversationPaths:h}=c;for(let c of a){if(E(c)!==b)continue;let a=h?.has(c.path)===!0;if("live"===c.activity||"running"===c.proc||"recent"===c.activity&&C(c)||a&&(A(c)||C(c))){let a=H(c,d);D(a)?g.set(a.path,a):f.set(a.path,a);continue}"recent"===c.activity&&A(c)&&f.set(c.path,c)}let i=[...f.values()].map(a=>(function(a,b,c){let d=J(a,b),e=d.filter(a=>C(a)||K(a,c)).sort((a,b)=>("live"!==a.activity)-("live"!==b.activity)||y(b.mtime)-y(a.mtime)||a.path.localeCompare(b.path)),f=d.filter(a=>D(a)&&"live"===a.activity).sort((a,b)=>y(b.mtime)-y(a.mtime)||a.path.localeCompare(b.path)),g=[a,...e].map(a=>({file:a,tasks:[]})),h=new Map(g.map(a=>[a.file.path,a]));for(let a of f)(a.parent&&h.get(a.parent)||g[0]).tasks.push(a);let i=new Set([...h.keys(),...f.map(a=>a.path)]),j=d.filter(a=>!i.has(a.path)).sort((a,b)=>b.mtime-a.mtime),k=Math.max(...g.map(a=>a.file.mtime),...f.map(a=>a.mtime));return{key:a.path,columns:g,returnable:[],finished:j,smt:k,orphanTask:!1}})(a,e,h));for(let a of g.values())i.push({key:a.path,columns:[{file:a,tasks:[]}],returnable:[],finished:[],smt:a.mtime,orphanTask:!0});return i.sort((a,b)=>a.orphanTask!==b.orphanTask?a.orphanTask?1:-1:y(b.smt)-y(a.smt)||a.key.localeCompare(b.key))}function N(a,b=Date.now()/1e3){return a.pendingQuestion?a.pendingQuestion.toolUseId:a.waitingInput?`${a.path}:waiting:${Math.floor(a.waitingInput.since)}`:"stalled"===a.activity&&"running"===a.proc&&b-a.mtime<=7200?`${a.path}:stalled:${Math.floor(a.mtime)}`:null}let O=new Set,P=O,Q=new Set;function R(a){return Q.add(a),()=>Q.delete(a)}let S=new Set;function T(a){return"closed"!==a.state}function U(a){let b=new Map;for(let c of a){if(!T(c))continue;let a=b.get(c.implementerPath);(!a||c.createdAt>a.createdAt)&&b.set(c.implementerPath,c)}return b}function V(a){let b=new Set;for(let c of a)for(let a of c.rounds)a.reviewerPath&&b.add(a.reviewerPath);return b}function W(a,b){return!b.has(a.path)&&("claude"===a.engine||"codex"===a.engine)&&A(a)}function X(a,b){return a(`flowState.${b}`)}let Y=new Set(["spawn_pending","relay_pending","needs_decision","paused","approved"]),Z=new Set(["spawning","reviewing","relaying","fixing"]);function $(a){return"spawning"===a.state||"reviewing"===a.state?"reviewer":"waiting_ready"===a.state||"relaying"===a.state||"fixing"===a.state?"implementer":null}let _={APPROVE:"✓",REQUEST_CHANGES:"✖",COMMENT:"◆"};function aa(a){return"APPROVE"===a?{color:"#1a8a3e",soft:"#e7f4ea"}:"REQUEST_CHANGES"===a?{color:"#c62828",soft:"#fbeaea"}:"COMMENT"===a?{color:"#b07d1f",soft:"#fdf3dd"}:{color:"#8b8b95",soft:"#efeff3"}}async function ab(a,b){try{let c=await fetch(`/api/flows/${encodeURIComponent(a)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(b)});if(c.ok)return"close"===b.action&&function(a){if(!O.has(a))for(let b of(O.add(a),P=new Set(O),Q))b()}(a),window.dispatchEvent(new Event("llv:flows-changed")),null;let d=await c.json().catch(()=>null);return d?.error??u(r(),"flowModel.failed",{status:c.status})}catch{return u(r(),"common.serverUnavailable")}}function ac(a){let b=r(),c=Date.now()/1e3-a;return c<90?u(b,"time.agoSec",{n:Math.round(c)}):c<5400?u(b,"time.agoMin",{n:Math.round(c/60)}):c<129600?u(b,"time.agoHour",{n:Math.round(c/3600)}):u(b,"time.agoDay",{n:Math.round(c/86400)})}function ad(a){if("string"!=typeof a&&"number"!=typeof a)return"";let b=new Date(a),c="uk"===r()?"uk-UA":"en-US";return Number.isNaN(b.getTime())?"":b.toLocaleTimeString(c,{hour12:!1})}function ae(a){return"live"===a?"animate-pulse bg-ok":"recent"===a?"bg-[#d29a2f]":"stalled"===a?"bg-err":"bg-[#c9c9d1]"}let af={codex:{color:"#2f6fd0",soft:"#e8f0fb"},claude:{color:"#d97757",soft:"#faeee9"}},ag={color:"#9a9aa4",soft:"#ececf1"},ah=[[/fable|mythos/,{color:"#c2410c",soft:"#fbeade"}],[/opus/,{color:"#8a5ad6",soft:"#f1ebfb"}],[/sonnet/,{color:"#e0913f",soft:"#fbf1e4"}],[/haiku/,{color:"#d9a58c",soft:"#f9f1ec"}]],ai=[[/spark/,{color:"#5ea3e4",soft:"#ecf4fd"}],[/mini|nano/,{color:"#7fb1e8",soft:"#eff6fd"}],[/codex/,{color:"#1d55ab",soft:"#e4edfa"}]];function aj(a){let b=af[a.engine];if(!b)return ag;let c=(a.model??"").toLowerCase();for(let[b,d]of"codex"===a.engine?ai:ah)if(b.test(c))return d;return b}let ak={minimal:{dl:20,ds:-32},low:{dl:12,ds:-20},medium:{dl:0,ds:0},high:{dl:-8,ds:12},xhigh:{dl:-14,ds:22},max:{dl:-19,ds:30}};function al(a,b,c){let[d,e,f]=function(a){let b=parseInt(a.slice(1),16),c=(b>>16&255)/255,d=(b>>8&255)/255,e=(255&b)/255,f=Math.max(c,d,e),g=Math.min(c,d,e),h=(f+g)/2,i=f-g;if(0===i)return[0,0,100*h];let j=i/(1-Math.abs(2*h-1));return[60*(f===c?((d-e)/i+6)%6:f===d?(e-c)/i+2:(c-d)/i+4),100*j,100*h]}(a),g=a=>Math.min(100,Math.max(0,a));return`hsl(${Math.round(d)} ${Math.round(g(e+c))}% ${Math.round(g(f+b))}%)`}function am(a){let b=aj(a),c=ak[a.effort??""];return c?{color:al(b.color,c.dl,c.ds),soft:al(b.soft,Math.round(c.dl/3),Math.round(c.ds/2))}:b}function an(a){return a.effort?u(r(),"util.effortTitle",{effort:a.effort}):void 0}let ao={minimal:1,low:2,medium:3,high:4,xhigh:5,max:6};function ap(a){return aj(a).color}function aq(a){return{backgroundColor:aj(a).color}}function ar(a){let b=af[a]??ag;return{label:({codex:"Codex",claude:"Claude",shell:"Bash"})[a]??a,style:{backgroundColor:b.soft,color:b.color}}}function as(a){return ar(a.engine)}function at(a,b){return Math.floor(b.smt/300)-Math.floor(a.smt/300)||a.file.path.localeCompare(b.file.path)}function au(a,b=Date.now()/1e3){return!!a.pendingQuestion||!!a.waitingInput||("stalled"===a.activity?null!==N(a,b):"recent"===a.activity&&("claude"===a.engine||"codex"===a.engine)&&A(a)&&!B(a))}function av(a,b,c,d,f=aw,g=ax){let{locale:h}=v();return(0,e.useMemo)(()=>{let e=(a,b)=>u(h,a,b),i=function(a){let b=I(a),c=new Map;for(let d of a)c.set(d.path,J(d,b).length);return c}(a),j=new Map;for(let a of b){let b=j.get(a.file);(!b||a.ts>b.ts)&&j.set(a.file,a)}let k=U(g),l=V(g),m=c.trim().toLowerCase(),n=a.filter(a=>!f.has(a.path)&&!l.has(a.path)&&(A(a)||"live"===a.activity||"stalled"===a.activity||"recent"===a.activity&&!D(a))).map(a=>{let b=E(a),c=w(a.title),f=d-a.mtime,g=k.get(a.path),h=a.pendingQuestion||a.waitingInput?"waiting":"live"===a.activity?"working":au(a,d)?"waiting":f<=86400?"recent":"older",l=function(a,b,c){var d;if(b.pendingQuestion)return a("plan"===b.pendingQuestion.kind?"status.awaitingPlan":"status.awaitingAnswer");if(b.waitingInput)return a("status.awaitingTerminal");if("live"===b.activity&&b.plan?.current)return`${b.plan.done}/${b.plan.total} \xb7 ${b.plan.current}`;let e=c.get(b.path);return e?`${e.label} \xb7 ${ac(e.ts)}`:"live"===b.activity?a("status.working"):B(d=b)&&"running"!==d.proc?a("status.returnedResult"):"stalled"===b.activity?a("status.stalled"):au(b)?a("status.finishedTurn"):""}(e,a,j);return g&&(Y.has(g.state)?h="waiting":("reviewing"===g.state||"relaying"===g.state||"spawning"===g.state)&&(h="working"),l=`${e("status.flow",{label:X(e,g.state)})}${g.stateDetail?` — ${g.stateDetail}`:""}`),{file:a,project:b,title:c,descendants:i.get(a.path)??0,smt:a.mtime,kind:h,statusLine:l}}).filter(a=>!m||`${a.title} ${a.project}`.toLowerCase().includes(m)),o=(a,b)=>b.smt-a.smt||a.file.path.localeCompare(b.file.path),p=n.filter(a=>"waiting"===a.kind).sort(o),q=n.filter(a=>"working"===a.kind).sort(o);return{waiting:p,working:q,recent:n.filter(a=>"recent"===a.kind).sort(at),older:n.filter(a=>"older"===a.kind).sort(at),livePreview:q.slice(0,3)}},[a,b,c,d,f,g,h])}let aw=new Set,ax=[];function ay(a,b=Date.now()/1e3){return a.pendingQuestion||a.waitingInput?"waiting":"live"===a.activity?"live":"recent"===a.activity&&C(a)&&"running"!==a.proc?"returned":au(a,b)?"stalled"===a.activity?"stalled":"waiting":"done"}let az="llvSound";function aA(a){try{window.localStorage.setItem("llvArchivedProjects",JSON.stringify([...a]))}catch{}}function aB(){window.dispatchEvent(new Event("llv:tasks-changed"))}async function aC(a,b,c){try{let d=await fetch(a,{method:b,...void 0===c?{}:{headers:{"content-type":"application/json"},body:JSON.stringify(c)}}),e=await d.json().catch(()=>null);if(!d.ok||!e)return{ok:!1,status:d.status,error:e?.error??u(r(),"tasks.failed",{status:d.status})};return aB(),{ok:!0,data:e}}catch{return{ok:!1,status:0,error:u(r(),"common.serverUnavailable")}}}async function aD(a){let b=await aC("/api/tasks","POST",a);return b.ok?{task:b.data.task}:{error:b.error}}let aE=new Map;async function aF(a){let b=aE.get(a);return b&&await b!==null?u(r(),"tasks.textNotSaved"):null}function aG(a,b){let c=void 0!==b.text?aE.get(a):void 0,d=(async()=>{c&&await c;let d=await aC(`/api/tasks/${encodeURIComponent(a)}`,"PATCH",b);return d.ok||404!==d.status?d.ok?null:d.error:(aB(),null)})();return void 0!==b.text&&(aE.set(a,d),d.finally(()=>{aE.get(a)===d&&aE.delete(a)})),d}async function aH(a){let b=await aC(`/api/tasks/${encodeURIComponent(a)}`,"DELETE");return b.ok||404!==b.status?b.ok?null:b.error:(aB(),null)}async function aI(a,b){let c=await aF(a);if(c)return{error:c};let d=await aC(`/api/tasks/${encodeURIComponent(a)}/assignment`,"POST",{path:b});return d.ok?{task:d.data.task}:{error:d.error}}async function aJ(a,b){let c=await aC(`/api/tasks/${encodeURIComponent(a)}/assignment`,"DELETE",{path:b});return c.ok||404!==c.status?c.ok?null:c.error:(aB(),null)}async function aK(a,b){let c=await aF(a);if(c)return{error:c};let d=await aC(`/api/tasks/${encodeURIComponent(a)}/send`,"POST",{paths:b});return d.ok?d.data:{error:d.error}}let aL="llv:workflows-changed";function aM(a){return a.startsWith("wf-")}let aN=new Set(["needs_decision","paused","approved"]),aO=new Set(["provisioning","implementing","reviewing","finishing"]);async function aP(a,b){try{let c=await fetch(`/api/workflows/${encodeURIComponent(a)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(b)});if(c.ok)return window.dispatchEvent(new Event(aL)),null;let d=await c.json().catch(()=>null);return d?.error??u(r(),"wfModel.failed",{status:c.status})}catch{return u(r(),"common.serverUnavailable")}}let aQ={files:[],flows:[],workflows:[],tasks:[],loaded:!1},aR="(max-width: 767px)";function aS(a){let b=window.matchMedia(aR);return b.addEventListener("change",a),()=>b.removeEventListener("change",a)}function aT(){return(0,e.useSyncExternalStore)(aS,()=>window.matchMedia(aR).matches,()=>!1)}let aU=k("menu",[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]]);function aV({files:a,workflows:b,archivedProjects:c,now:f,onSelectProject:g,onSelectFile:h,onMenu:i,attention:j}){let{t:k}=v(),l=function(){let[a,b]=(0,e.useState)(3);return a}(),m=(0,e.useMemo)(()=>G(a,f,b),[a,f,b]),n=(0,e.useMemo)(()=>m.filter(a=>!c.has(a.project)),[m,c]),o=m.length-n.length,p=(0,e.useMemo)(()=>n.reduce((a,b)=>a+b.liveCount,0),[n]),q=n.filter(a=>a.liveCount>0).length,r=(0,e.useMemo)(()=>n.map(b=>{let c=M(a,b.project).flatMap(a=>a.columns.flatMap(a=>[a.file,...a.tasks])).filter(a=>"live"===a.activity),d=c.slice(0,4),e=a.filter(a=>E(a)===b.project).sort((a,b)=>b.mtime-a.mtime)[0];return{summary:b,liveBranches:d,moreLive:c.length-d.length,latest:e}}),[a,n]);return(0,d.jsxs)("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[(0,d.jsxs)("div",{className:"flex h-10 shrink-0 items-center gap-2.5 border-b border-line bg-panel px-4",children:[i?(0,d.jsx)("button",{type:"button",className:"-ml-1.5 flex h-7 w-7 shrink-0 items-center justify-center rounded-[8px] border border-line bg-bg text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":k("dash.openProjects"),onClick:i,children:(0,d.jsx)(aU,{className:"h-4 w-4","aria-hidden":!0})}):null,(0,d.jsx)("h1",{className:"text-[13.5px] font-bold",children:k("rail.overview")}),(0,d.jsxs)("span",{className:"text-[11.5px] text-dim",children:[p?k("overview.branchesLiveIn",{count:p,projects:k("overview.projects",{count:q})}):k("common.nothingRunning"),o?` ${k("overview.archived",{count:o})}`:""]}),j?(0,d.jsx)("span",{className:"ml-auto flex shrink-0 items-center",children:j}):null]}),(0,d.jsxs)("div",{className:"grid flex-1 auto-rows-min gap-2.5 overflow-y-auto p-3",style:{gridTemplateColumns:`repeat(${l}, minmax(0, 1fr))`},children:[r.map(({summary:a,liveBranches:b,moreLive:c,latest:e})=>(0,d.jsxs)("button",{className:"flex flex-col gap-1.5 rounded-[10px] border border-line bg-panel p-3 text-left shadow-card hover:border-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>g(a.project),children:[(0,d.jsxs)("span",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${a.liveCount?"animate-pulse bg-ok":"bg-[#d6d6dd]"}`}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[13px] font-bold",children:a.project}),a.liveCount?(0,d.jsx)("span",{className:"shrink-0 rounded-full bg-[#e5f6ea] px-1.5 py-0.5 text-[10.5px] font-bold text-ok",children:a.liveCount}):null,(0,d.jsx)("span",{className:"shrink-0 text-[11px] font-semibold text-dim",children:a.conversations})]}),b.length?(0,d.jsxs)("span",{className:"flex flex-col gap-1",children:[b.map(a=>{let b=as(a);return(0,d.jsxs)("span",{className:"flex cursor-pointer items-center gap-1.5 rounded-[8px] px-1 py-0.5 text-[11.5px] hover:bg-bg",role:"link",tabIndex:0,title:w(a.title),onClick:b=>{b.stopPropagation(),h(a)},onKeyDown:b=>{"Enter"===b.key&&(b.stopPropagation(),h(a))},children:[(0,d.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${ae(a.activity)}`}),(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:b.style,children:b.label}),(0,d.jsx)("span",{className:"truncate font-semibold",children:w(a.title,70)})]},a.path)}),c>0?(0,d.jsx)("span",{className:"px-1 text-[10.5px] font-semibold text-dim",children:k("overview.moreLive",{count:c})}):null]}):(0,d.jsx)("span",{className:"text-[11px] text-dim",children:k("overview.quiet",{age:e?ac(e.mtime):"—"})})]},a.project)),n.length?null:(0,d.jsx)("div",{className:"col-span-full mt-[20vh] text-center text-dim",children:k("overview.empty")})]})]})}let aW=k("list-todo",[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]]),aX=k("network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]),aY=k("list",[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]),aZ=k("minimize-2",[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]]),a$=k("maximize-2",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]),a_=k("git-branch",[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]]),a0=k("corner-down-right",[["path",{d:"m15 10 5 5-5 5",key:"qqa56n"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]),a1=k("archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]),a2=k("archive-restore",[["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"}]]),a3=k("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]),a4=k("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),a5=k("arrow-up-to-line",[["path",{d:"M5 3h14",key:"7usisc"}],["path",{d:"m18 13-6-6-6 6",key:"1kf1n9"}],["path",{d:"M12 7v14",key:"1akyts"}]]),a6=k("ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}]]),a7=k("brain",[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]]),a8=k("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),a9=k("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),ba=k("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),bb=k("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),bc=k("command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]),bd=k("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]),be=k("fold-vertical",[["path",{d:"M12 22v-6",key:"6o8u61"}],["path",{d:"M12 8V2",key:"1wkif3"}],["path",{d:"M4 12H2",key:"rhcxmi"}],["path",{d:"M10 12H8",key:"s88cx1"}],["path",{d:"M16 12h-2",key:"10asgb"}],["path",{d:"M22 12h-2",key:"14jgyd"}],["path",{d:"m15 19-3-3-3 3",key:"e37ymu"}],["path",{d:"m15 5-3 3-3-3",key:"19d6lf"}]]),bf=k("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]),bg=k("link-2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]),bh=k("mail",[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]]),bi=k("message-circle",[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]]),bj=k("mic",[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3",key:"s6n7sd"}]]),bk=k("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]),bl=k("sparkle",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}]]),bm=k("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]),bn=k("square-terminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]),bo=k("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]),bp=k("wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]]),bq=k("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]),br=k("binary",[["rect",{x:"14",y:"14",width:"4",height:"6",rx:"2",key:"p02svl"}],["rect",{x:"6",y:"4",width:"4",height:"6",rx:"2",key:"xm4xkj"}],["path",{d:"M6 20h4",key:"1i6q5t"}],["path",{d:"M14 10h4",key:"ru81e7"}],["path",{d:"M6 14h2v6",key:"16z9wg"}],["path",{d:"M14 4h2v6",key:"1idq9u"}]]),bs=k("pencil-line",[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]),bt=k("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]),bu=k("power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]),bv=k("clipboard-list",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]),bw=k("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),bx={shell:a9,tool:bp,"cmd-group":bq,codex:bc,claude:bl,image:bf,blob:br,note:bs,citation:bt,message:bh,shutdown:bu,plan:bv,compact:be};function by({name:a,className:b}){let c=bx[a];return(0,d.jsx)(c,{className:b??"h-3.5 w-3.5","aria-hidden":!0})}var bz=c(74429);let bA=k("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);function bB({label:a,side:b="top",align:c="center",children:e}){return(0,d.jsxs)("span",{className:"group/hint relative inline-flex",children:[e,(0,d.jsx)("span",{role:"tooltip",className:`pointer-events-none absolute z-[60] whitespace-nowrap rounded-[7px] bg-ink px-2 py-1 text-[10.5px] font-semibold text-white opacity-0 shadow-card transition-opacity delay-150 duration-100 group-focus-within/hint:opacity-100 group-hover/hint:opacity-100 ${"right"===c?"right-0":"left"===c?"left-0":"left-1/2 -translate-x-1/2"} ${"top"===b?"bottom-full mb-1.5":"top-full mt-1.5"}`,children:a})]})}let bC={"image/png":"png","image/jpeg":"jpg","image/jpg":"jpg","image/gif":"gif","image/webp":"webp"};function bD(a){return new Promise((b,c)=>{let d=new FileReader;d.onload=()=>{let e=String(d.result),f=e.indexOf(",");f<0?c(Error(u(r(),"img.readFailed"))):b({base64:e.slice(f+1),mime:a.type||"image/png",preview:e})},d.onerror=()=>c(d.error??Error(u(r(),"img.readFailed"))),d.onabort=()=>c(Error(u(r(),"img.readAborted"))),d.readAsDataURL(a)})}function bE({images:a,onRemove:b}){let{t:c}=v();return a.length?(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[a.map((a,e)=>(0,d.jsxs)("div",{className:"group/img relative",children:[(0,d.jsx)("img",{src:a.preview,alt:c("img.previewAlt",{n:e+1}),className:"h-10 w-10 rounded border border-line object-cover"}),(0,d.jsx)("button",{type:"button",onClick:()=>b(e),"aria-label":c("img.removeAria",{n:e+1}),className:"absolute -right-1 -top-1 hidden h-4 w-4 items-center justify-center rounded-full border border-line bg-panel text-dim shadow-card hover:text-err group-hover/img:flex focus-visible:flex focus-visible:outline-none",children:(0,d.jsx)(n,{className:"h-2.5 w-2.5","aria-hidden":!0})})]},e)),(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 text-[10.5px] font-semibold text-dim",children:[c("composer.imagesCount",{count:a.length})," ",(0,d.jsx)(a4,{className:"h-3 w-3","aria-hidden":!0})," ",c("img.toFilePaths")]})]}):null}function bF({onFiles:a,ariaLabel:b,className:c}){let f=(0,e.useRef)(null);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("input",{ref:f,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:b=>{a(Array.from(b.target.files??[])),b.target.value=""}}),(0,d.jsx)("button",{type:"button","aria-label":b,onClick:()=>f.current?.click(),className:c,children:(0,d.jsx)(bf,{className:"h-4 w-4","aria-hidden":!0})})]})}let bG=null,bH=null,bI=async()=>{try{let a=await fetch("/api/transcribe/token",{method:"POST"});if(!a.ok)return null;let b=await a.json();return"string"==typeof b.token&&b.token?b.token:null}catch{return null}};function bJ(){bH||bG&&bG.expiresAt>Date.now()||(bH=bI().then(a=>(bH=null,bG={token:a,expiresAt:Date.now()+(a?45e3:15e3)},a)))}let bK=async()=>{let a=bH;if(a){let b=await a;return b&&(bG=null),b}let b=bG;return b&&b.expiresAt>Date.now()?(b.token&&(bG=null),b.token):(bG=null,bI())};function bL({onError:a,onUnclaimedText:b,onLiveCommit:c}){let{t:d}=v(),[f,g]=(0,e.useState)("idle"),[h,i]=(0,e.useState)(0),[j,k]=(0,e.useState)(""),l=(0,e.useRef)(null),m=(0,e.useRef)([]),n=(0,e.useRef)(null),o=(0,e.useRef)(!1),p=(0,e.useRef)(null),q=(0,e.useRef)(null),r=(0,e.useRef)(null),s=(0,e.useRef)(null),t=(0,e.useRef)(!1),u=(0,e.useRef)(!0),w=()=>{null!==p.current&&(clearInterval(p.current),p.current=null)},x=()=>{let a=r.current;r.current=null,a&&(cancelAnimationFrame(a.raf),a.ctx.close().catch(()=>void 0))},y=a=>{w(),x();let c=n.current;if(n.current=null,c){try{c.processor.disconnect()}catch{}try{c.ws.close()}catch{}c.stream.getTracks().forEach(a=>a.stop()),c.ctx.close().catch(()=>void 0)}k(""),g("idle");let d=s.current;if(s.current=null,o.current)return void d?.(null);let e=a.partial.trim();d?d(e):e&&b(e)},z=async()=>{w(),x();let c=l.current;l.current=null,c?.stream.getTracks().forEach(a=>a.stop());let e=new Blob(m.current,{type:"audio/webm"});m.current=[];let f=s.current;if(s.current=null,o.current||e.size<2e3){g("idle"),f?.(null);return}g("busy");try{let c=new FormData;c.append("file",e,"dictation.webm");let g=await fetch("/api/transcribe",{method:"POST",body:c}),h=await g.json();if(!g.ok||"string"!=typeof h.text){a(h.error??d("dictation.failed")),f?.(null);return}let i=h.text.trim();i?f?f(i):b(i):(a(d("dictation.silence")),f?.(null))}catch{a(d("common.serverUnavailable")),f?.(null)}finally{g("idle")}},A=async()=>{if(t.current||l.current||n.current)return;t.current=!0,g("starting"),o.current=!1;let b=null,e=!0;try{let[f,h]=await Promise.all([navigator.mediaDevices.getUserMedia({audio:{channelCount:1}}),bK()]);if(b=f,!u.current||o.current)return;if(k(""),!(null!==h&&((b,e)=>{let f;try{f=new AudioContext({sampleRate:16e3})}catch{return!1}let g=new URLSearchParams({model_id:"scribe_v2_realtime",token:e,audio_format:"pcm_16000",commit_strategy:"vad",vad_silence_threshold_secs:"1.2"}),h=new WebSocket(`wss://api.elevenlabs.io/v1/speech-to-text/realtime?${g.toString()}`),i=f.createScriptProcessor(4096,1,1),j={ws:h,ctx:f,processor:i,stream:b,preOpenQueue:[],partial:""};n.current=j;let l=f.createMediaStreamSource(b);return i.onaudioprocess=a=>{if(n.current!==j)return;let b=function(a){let b=new Int16Array(a.length);for(let c=0;c<a.length;c+=1){let d=Math.max(-1,Math.min(1,a[c]??0));b[c]=d<0?32768*d:32767*d}let c=new Uint8Array(b.buffer),d="";for(let a=0;a<c.length;a+=1)d+=String.fromCharCode(c[a]??0);return btoa(d)}(a.inputBuffer.getChannelData(0));h.readyState===WebSocket.OPEN?h.send(JSON.stringify({message_type:"input_audio_chunk",audio_base_64:b})):h.readyState===WebSocket.CONNECTING&&j.preOpenQueue.push(b)},l.connect(i),i.connect(f.destination),h.addEventListener("open",()=>{if(n.current===j){for(let a of j.preOpenQueue)h.send(JSON.stringify({message_type:"input_audio_chunk",audio_base_64:a}));j.preOpenQueue=[]}}),h.addEventListener("message",b=>{if(n.current===j)try{let e=JSON.parse(b.data);if("partial_transcript"===e.message_type)j.partial=e.text??"";else if(("committed_transcript"===e.message_type||"committed_transcript_with_timestamps"===e.message_type)&&e.text)j.partial="",c(e.text);else if("auth_error"===e.message_type||"error"===e.message_type||"invalid_request"===e.message_type||"quota_exceeded"===e.message_type){a(e.error||d("dictation.liveError")),y(j);return}k(j.partial)}catch{}}),h.addEventListener("close",()=>{n.current!==j||s.current||(a(d("dictation.connectionLost")),y(j))}),!0})(b,h))){let a=MediaRecorder.isTypeSupported("audio/webm;codecs=opus")?"audio/webm;codecs=opus":MediaRecorder.isTypeSupported("audio/webm")?"audio/webm":"",c=a?new MediaRecorder(b,{mimeType:a}):new MediaRecorder(b);m.current=[],c.ondataavailable=a=>{a.data.size&&m.current.push(a.data)},c.onstop=()=>{z()},c.start(250),l.current=c}e=!1,(a=>{let b;try{b=new AudioContext}catch{return}let c=b.createAnalyser();c.fftSize=128,c.smoothingTimeConstant=.7,b.createMediaStreamSource(a).connect(c);let d=new Uint8Array(c.frequencyBinCount),e=()=>{if(!r.current)return;r.current.raf=requestAnimationFrame(e),c.getByteFrequencyData(d);let a=q.current;a&&function(a,b){let c=window.devicePixelRatio||1;(a.width!==56*c||a.height!==16*c)&&(a.width=56*c,a.height=16*c);let d=a.getContext("2d");if(!d)return;d.setTransform(c,0,0,c,0,0),d.clearRect(0,0,56,16);let e=Math.max(13,Math.floor(.65*b.length))/13;for(let a=0;a<13;a+=1){let c=Math.floor(a*e),f=Math.max(c+1,Math.floor((a+1)*e)),g=0;for(let a=c;a<f;a+=1)g+=b[a]??0;let h=g/(f-c)/255,i=Math.max(1.5,16*h);d.fillStyle=`rgba(198, 40, 40, ${(.35+.65*h).toFixed(3)})`,d.fillRect(4.3076923076923075*a+1,(16-i)/2,2.3076923076923075,i)}}(a,d)};r.current={ctx:b,raf:requestAnimationFrame(e)}})(b),i(0),g("rec"),p.current=window.setInterval(()=>{i(a=>{let b=a+1;return b>=120&&(l.current?.state==="recording"?l.current.stop():n.current&&y(n.current)),b})},1e3)}catch{u.current&&a(b?d("dictation.unsupported"):d("dictation.noMic"))}finally{var f;e&&(f=b,f?.getTracks().forEach(a=>a.stop())),t.current=!1,u.current&&g(a=>"starting"===a?"idle":a)}};return{phase:f,elapsed:h,liveText:j,canvasRef:q,start:A,stop:()=>new Promise(a=>{let b=n.current;if(b){s.current=a,y(b);return}let c=l.current;c&&"recording"===c.state?(s.current=a,c.stop()):a(null)}),discard:()=>{o.current=!0,l.current?.state==="recording"?l.current.stop():n.current&&y(n.current)}}}function bM({initialText:a,persistText:b,submit:c,disabled:d=!1}){let[f,g]=(0,e.useState)(a),h=(0,e.useRef)(f),i=a=>{let c="function"==typeof a?a(h.current):a;h.current=c,g(c),b(c)},[j,k]=(0,e.useState)(!1),[l,m]=(0,e.useState)(!1),[n,o]=(0,e.useState)(null),p=(0,e.useRef)(null),q=function(a){let[b,c]=(0,e.useState)([]),d=b=>{if(!b.length)return;let d=[];for(let c of b){if(null===(bC[c.type]??null)){a.onError(u(r(),"img.unsupported",{name:c.name||c.type||u(r(),"img.unknownFile")}));continue}if(c.size>0xa00000){a.onError(u(r(),"img.tooLarge",{name:c.name||u(r(),"img.image")}));continue}d.push(c)}if(!d.length)return;let e=d.length<b.length;Promise.all(d.map(bD)).then(b=>{c(a=>[...a,...b]),e||a.onAdded?.()}).catch(b=>{a.onError(b instanceof Error?b.message:u(r(),"img.error"))})};return{images:b,addFiles:d,handlePaste:a=>{let b=Array.from(a.clipboardData.items).filter(a=>a.type.startsWith("image/")).map(a=>a.getAsFile()).filter(a=>null!==a);b.length&&(a.preventDefault(),d(b))},removeAt:a=>c(b=>b.filter((b,c)=>c!==a)),clear:()=>c([])}}({onError:a=>o({kind:"err",text:a}),onAdded:()=>o(null)}),s=a=>{i(b=>b?b.trimEnd()+" "+a:a),o(null),p.current?.focus()},t=bL({onError:a=>o({kind:"err",text:a}),onUnclaimedText:s,onLiveCommit:s}),v=t.liveText?(f?f.trimEnd()+" ":"")+t.liveText:f,w=async()=>{if(!j&&!l){m(!0);try{let a=await t.stop();if(null===a)return;let b=a?h.current?h.current.trimEnd()+" "+a:a:h.current;i(b),await c(b)}finally{m(!1)}}},x="rec"===t.phase,y="busy"===t.phase,z=j||l||d,A=!z&&!y&&(x||!!f.trim()||q.images.length>0);return{text:f,textRef:h,setText:i,setTextState:g,displayText:v,inputRef:p,status:n,setStatus:o,busy:j,setBusy:k,voiceSending:l,dictation:t,attachments:q,insertSpoken:s,stopAndSend:w,submit:c,dictationRecording:x,dictationBusy:y,fieldsDisabled:z,canSend:A}}function bN({onClose:a}){let{locale:b,t:c}=v(),[f,g]=(0,e.useState)(null),[h,i]=(0,e.useState)(null),[j,k]=(0,e.useState)(null),[l,m]=(0,e.useState)(!1),[n,o]=(0,e.useState)(null),p=(0,e.useRef)(null),q=async(b,d)=>{if(f&&!f.lockedByEnv&&!n){if(!d){k(b),m(!1);return}o(b),i(null);try{let d=await fetch("/api/transcribe/backend",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({backend:b})}),e=await d.json();if(!d.ok)return void i(e.error??c("mic.saveFailed"));g(e),a()}catch{i(c("common.serverUnavailable"))}finally{o(null)}}},r=j&&f?f.options.find(a=>a.id===j):null;return(0,d.jsx)("div",{ref:p,role:"menu","aria-label":c("mic.menuTitle"),className:"absolute bottom-[calc(100%+6px)] right-0 z-40 w-[300px] rounded-[12px] border border-line bg-panel p-1.5 shadow-[0_10px_36px_rgb(20_20_30/0.18)]",children:r?(0,d.jsxs)("div",{className:"flex flex-col gap-2 p-2",children:[(0,d.jsx)("span",{className:"text-[12px] font-bold text-err",children:c("mic.keyTitle",{name:c(`stt.${r.id}.name`)})}),(0,d.jsx)("span",{className:"text-[11.5px] leading-snug text-ink",children:c(`stt.${r.id}.fix`)}),(0,d.jsxs)("span",{className:"flex items-center gap-1 rounded-[8px] border border-line bg-bg px-2 py-1.5",children:[(0,d.jsx)("code",{className:"min-w-0 flex-1 break-all font-mono text-[10.5px] text-ink",children:r.keyPath}),(0,d.jsxs)("button",{type:"button","aria-label":c("mic.copyPath"),title:c("mic.copyPath"),className:"inline-flex shrink-0 items-center gap-1 rounded-[6px] border border-line bg-panel px-1.5 py-1 text-[10px] font-semibold text-dim hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>{navigator.clipboard.writeText(r.keyPath).then(()=>m(!0))},children:[l?(0,d.jsx)(a8,{className:"h-3 w-3 text-ok","aria-hidden":!0}):(0,d.jsx)(bd,{className:"h-3 w-3","aria-hidden":!0}),l?c("mic.copied"):c("mic.copy")]})]}),(0,d.jsxs)("button",{type:"button",className:"self-start rounded-[8px] px-2 py-1 text-[11px] font-semibold text-dim hover:bg-bg hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>k(null),children:["← ",c("mic.back")]})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"px-2 pb-1 pt-1.5 text-[10.5px] font-bold uppercase tracking-wide text-dim",children:c("mic.menuTitle")}),f?.lockedByEnv?(0,d.jsx)("div",{className:"px-2 pb-1 text-[10.5px] text-err",children:c("mic.menuLocked")}):null,f||h?null:(0,d.jsxs)("div",{className:"flex items-center gap-2 px-2 py-2 text-[11.5px] text-dim",children:[(0,d.jsx)(bw,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0})," ",c("mic.menuLoading")]}),(f?.options??[]).map(a=>{let b=f?.backend===a.id;return(0,d.jsxs)("button",{type:"button",role:"menuitemradio","aria-checked":b,disabled:!!f?.lockedByEnv||null!==n,onClick:()=>void q(a.id,a.available),className:`flex w-full items-start gap-2 rounded-[9px] px-2 py-1.5 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60 ${b?"bg-accent/10":"hover:bg-bg"}`,children:[(0,d.jsx)("span",{className:"mt-[3px] flex h-3.5 w-3.5 shrink-0 items-center justify-center",children:n===a.id?(0,d.jsx)(bw,{className:"h-3.5 w-3.5 animate-spin text-dim","aria-hidden":!0}):b?(0,d.jsx)(a8,{className:"h-3.5 w-3.5 text-accent","aria-hidden":!0}):(0,d.jsx)("span",{"aria-hidden":!0,className:"h-2 w-2 rounded-full",style:{backgroundColor:a.available?"#1a8a3e":"#e0ae45"}})}),(0,d.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("span",{className:"flex items-center gap-1.5 text-[12px] font-semibold text-ink",children:[c(`stt.${a.id}.name`),a.available?null:(0,d.jsx)("span",{className:"rounded-full bg-[#fdf3dd] px-1.5 py-px text-[9.5px] font-bold text-[#b07d1f]",children:c("mic.noKey")})]}),(0,d.jsx)("span",{className:"block text-[10.5px] leading-snug text-dim",children:c(`stt.${a.id}.desc`)})]})]},a.id)}),h?(0,d.jsx)("div",{className:"px-2 py-1 text-[10.5px] font-semibold text-err",children:h}):null]})})}function bO({phase:a,elapsed:b,canvasRef:c,start:f,stop:g,discard:h,onText:i,busy:j=!1}){let{t:k}=v(),[l,m]=(0,e.useState)(!1),o=()=>{j||("idle"===a?f():"rec"===a&&g().then(a=>{a&&i(a)}))};if("rec"===a)return(0,d.jsxs)("span",{className:"flex shrink-0 items-center gap-1",children:[(0,d.jsxs)("button",{type:"button","aria-label":k("mic.stopRecognize"),onClick:o,className:"flex items-center gap-1.5 rounded-[8px] border border-err/50 bg-[#fff2f2] px-2 py-2 text-[11px] font-bold text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-err/40",children:[(0,d.jsx)("canvas",{ref:c,width:56,height:16,className:"h-4 w-14","aria-hidden":!0}),`${Math.floor(b/60)}:${String(b%60).padStart(2,"0")}`]}),(0,d.jsx)("button",{type:"button","aria-label":k("mic.cancel"),onClick:h,className:"inline-flex items-center justify-center rounded-[8px] border border-line bg-panel p-2 text-dim hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:(0,d.jsx)(n,{className:"h-3.5 w-3.5","aria-hidden":!0})})]});return(0,d.jsxs)("span",{className:"relative inline-flex shrink-0",children:[(0,d.jsx)("button",{type:"button","aria-label":k("busy"===a?"mic.recognizing":"starting"===a?"mic.connecting":"mic.dictate"),title:k("busy"===a?"mic.recognizing":"starting"===a?"mic.connecting":"mic.dictateHint"),disabled:"idle"!==a||j,onClick:o,onPointerEnter:bJ,onFocus:bJ,onContextMenu:a=>{a.preventDefault(),m(a=>!a)},className:`inline-flex shrink-0 items-center justify-center rounded-[8px] border p-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60 ${"starting"===a?"border-accent/40 bg-accent/10 text-accent":"border-line bg-panel text-dim hover:text-accent"}`,children:"busy"===a?(0,d.jsx)(bw,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):"starting"===a?(0,d.jsx)(bj,{className:"h-4 w-4 animate-pulse","aria-hidden":!0}):(0,d.jsx)(bj,{className:"h-4 w-4","aria-hidden":!0})}),l?(0,d.jsx)(bN,{onClose:()=>m(!1)}):null]})}function bP({label:a,actions:b,onClose:c}){let f=(0,e.useRef)(null);return(0,d.jsxs)("div",{ref:f,role:"menu","aria-label":a,className:"absolute bottom-[calc(100%+6px)] right-0 z-40 w-[220px] rounded-[12px] border border-line bg-panel p-1.5 shadow-[0_10px_36px_rgb(20_20_30/0.18)]",children:[(0,d.jsx)("div",{className:"px-2 pb-1 pt-1.5 text-[10.5px] font-bold uppercase tracking-wide text-dim",children:a}),b.map(a=>(0,d.jsxs)("button",{type:"button",role:"menuitem",disabled:a.disabled,onClick:()=>{a.onSelect(),c()},className:`flex w-full items-start gap-2 rounded-[9px] px-2 py-1.5 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-50 ${"ok"===a.tone?"hover:bg-ok/10":"hover:bg-bg"}`,children:[(0,d.jsx)(bk,{className:`mt-[2px] h-3.5 w-3.5 shrink-0 ${"ok"===a.tone?"text-ok":"text-dim"}`,"aria-hidden":!0}),(0,d.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,d.jsx)("span",{className:"block text-[12px] font-semibold text-ink",children:a.label}),a.description?(0,d.jsx)("span",{className:"block text-[10.5px] leading-snug text-dim",children:a.description}):null]})]},a.id))]})}function bQ({composer:a,placeholder:b,textareaAriaLabel:c,imageAriaLabel:f,leftSlot:g,sendLabelIdle:h,sendLabelRecording:i,sendTitleRecording:j,sendIdleClassName:k,sendIdleStyle:l,sendMenuLabel:m,sendMenuActions:n=[],showImage:o=!0}){let{displayText:p,inputRef:q,dictation:r,setText:s,attachments:t,voiceSending:u,insertSpoken:v,stopAndSend:w,submit:x,fieldsDisabled:y,canSend:z,dictationRecording:A,busy:B,status:C}=a,[D,E]=(0,e.useState)(!1),F=n.length>0;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("textarea",{ref:q,value:p,rows:1,readOnly:!!r.liveText,onChange:a=>s(a.target.value),onFocus:bJ,onPaste:t.handlePaste,onKeyDown:a=>{"Enter"!==a.key||a.shiftKey||a.nativeEvent.isComposing||(a.preventDefault(),"rec"===r.phase?w():x())},placeholder:b,"aria-label":c,disabled:y,className:"w-full resize-none overflow-y-auto rounded-[10px] border border-line bg-panel px-2.5 py-1.5 text-[12.5px] leading-[18px] text-[#222] placeholder:text-dim focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60"}),(0,d.jsxs)("div",{className:"flex items-center justify-between gap-1.5",children:[g,(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5",children:[(0,d.jsx)(bO,{...r,busy:u,onText:v}),o?(0,d.jsx)(bB,{label:f,children:(0,d.jsx)(bF,{ariaLabel:f,className:"inline-flex shrink-0 items-center justify-center rounded-[8px] border border-line bg-panel p-2 text-dim hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onFiles:t.addFiles})}):null,(0,d.jsxs)("span",{className:"relative inline-flex shrink-0",onContextMenu:a=>{F&&!A&&(a.preventDefault(),E(a=>!a))},children:[(0,d.jsx)(bB,{label:A?j??i:h,align:"right",children:(0,d.jsx)("button",{type:A?"button":"submit",onClick:A?()=>void w():a=>{z||(a.preventDefault(),a.stopPropagation())},disabled:!z&&!F,"aria-disabled":!z,"aria-label":A?i:h,style:A?void 0:l,className:`inline-flex shrink-0 items-center justify-center rounded-[8px] border p-2 text-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40 aria-disabled:opacity-40 ${A?"border-err bg-err hover:opacity-90":k}`,children:B||u?(0,d.jsx)(bw,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):(0,d.jsx)(bk,{className:"h-4 w-4","aria-hidden":!0})})}),D&&F&&m?(0,d.jsx)(bP,{label:m,actions:n,onClose:()=>E(!1)}):null]})]})]}),(0,d.jsx)(bE,{images:t.images,onRemove:t.removeAt}),C?(0,d.jsx)("span",{className:`truncate text-[10.5px] font-semibold ${"ok"===C.kind?"text-ok":"text-err"}`,children:C.text}):null]})}function bR(a){return"claude-projects"===a.root?"session"===a.kind||"subagent"===a.kind:"codex-sessions"===a.root}function bS(a,b){let c="llvDraft:"+a,d=sessionStorage.getItem(c)??"";sessionStorage.setItem(c,d.trim()?d.replace(/\s*$/,"")+"\n\n"+b:b),window.dispatchEvent(new CustomEvent("llv-compose-draft",{detail:{path:a}}))}function bT({file:a,pollPaused:b=!1}){let{t:c}=v(),f=function(a,b,c=!0){let[d,f]=(0,e.useState)(null);return null!==a||b?d:null}(a.pid,bR(a)?a.path:void 0,!b),g=bM({initialText:()=>"",persistText:b=>{b?sessionStorage.setItem("llvDraft:"+a.path,b):sessionStorage.removeItem("llvDraft:"+a.path)},submit:a=>J(a)}),{text:h,textRef:i,setText:j,setTextState:k,inputRef:l,setStatus:m,busy:o,setBusy:p,voiceSending:q,attachments:s}=g,t=aT(),[u,w]=(0,e.useState)(!1),[x,y]=(0,e.useState)(!1),[z,A]=(0,e.useState)(!1),[B,C]=(0,e.useState)(!1),[D,E]=(0,e.useState)([]),F=bR(a);if(null===f&&!F)return null;let G=null===f,H=G&&"claude-projects"===a.root&&"subagent"===a.kind,I=b=>{E(b),sessionStorage.setItem("llvSent:"+a.path,JSON.stringify(b))},J=async b=>{let d=b??h;if(!o&&!q&&(d.trim()||s.images.length)){p(!0),m(null);try{let b=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({pid:a.pid??void 0,path:a.path,text:d,images:s.images.map(a=>({base64:a.base64,mime:a.mime}))})}),e=await b.json();if(!b.ok||!e.ok)return void m({kind:"err",text:e.error??c("common.failedSend")});let f=s.images.length,g={id:Date.now(),text:d.trim()||(f?c("composer.imagesCount",{count:f}):""),at:Date.now(),via:e.spawned?"spawn":"pane"};I([...D,g].slice(-8)),j(""),s.clear(),m({kind:"ok",text:e.spawned?c("composer.spawned",{target:e.target??""}):e.imagePaths?.length?c("composer.sentPaths",{count:e.imagePaths.length}):c("common.sent")}),l.current?.focus()}catch{m({kind:"err",text:c("common.serverUnavailable")})}finally{p(!1)}}},K=async()=>{if(!x){y(!0),m(null);try{let b=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"interrupt",path:a.path})}),d=await b.json();if(!b.ok||!d.ok)return void m({kind:"err",text:d.error??c("composer.failedInterrupt")});m({kind:"ok",text:c("composer.escapeSent")})}catch{m({kind:"err",text:c("common.serverUnavailable")})}finally{y(!1)}}},L=async()=>{if(!z){A(!0),m(null);try{let b=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"compact",path:a.path})}),d=await b.json();if(!b.ok||!d.ok)return void m({kind:"err",text:d.error??c("composer.failedCompact")});m({kind:"ok",text:c("composer.compactSent")})}catch{m({kind:"err",text:c("common.serverUnavailable")})}finally{A(!1)}}},M=(0,d.jsx)("span",{className:"inline-flex min-w-0 items-center gap-1 rounded-full bg-chip px-1.5 py-1 font-mono text-[9.5px] font-semibold text-[#555]",title:H?c("composer.titleRelay"):G?c("composer.titleSpawnResumed"):`tmux ${f}`,children:H?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(a5,{className:"h-3 w-3 shrink-0","aria-hidden":!0})," ",c("composer.root")]}):G?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(bk,{className:"h-3 w-3 shrink-0","aria-hidden":!0})," resume"]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(bn,{className:"h-3 w-3 shrink-0","aria-hidden":!0})," ",(0,d.jsx)("span",{className:"truncate",children:f})]})}),N=G?null:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(bB,{label:c("composer.interruptTitle"),children:(0,d.jsx)("button",{type:"button","aria-label":c("composer.interruptAria"),disabled:x,onClick:()=>void K(),className:"inline-flex shrink-0 items-center justify-center rounded-[8px] border border-line bg-panel p-2 text-dim hover:border-err/40 hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-50",children:x?(0,d.jsx)(bw,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):(0,d.jsx)(bm,{className:"h-4 w-4",fill:"currentColor","aria-hidden":!0})})}),(0,d.jsx)(bB,{label:B?c("composer.compactConfirmTitle"):c("composer.compactTitle"),children:(0,d.jsx)("button",{type:"button","aria-label":B?c("composer.compactConfirmTitle"):c("composer.compactAria"),disabled:z,onClick:()=>{B?(C(!1),L()):C(!0)},className:`inline-flex shrink-0 items-center justify-center gap-1 rounded-[8px] border p-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-50 ${B?"border-[#0d9488] bg-[#e3f4f0] text-[#0b7c72]":"border-line bg-panel text-dim hover:border-[#0d9488]/50 hover:text-[#0b7c72]"}`,children:z?(0,d.jsx)(bw,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):B?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(a8,{className:"h-4 w-4","aria-hidden":!0}),(0,d.jsx)("span",{className:"text-[10.5px] font-bold",children:c("composer.compactConfirm")})]}):(0,d.jsx)(be,{className:"h-4 w-4","aria-hidden":!0})})})]}),O=o||q||s.images.length>0;return(0,d.jsxs)("form",{onSubmit:a=>{a.preventDefault(),J()},className:"flex shrink-0 flex-col gap-1.5 border-t border-line bg-[#fbfbfd] px-2.5 py-2","aria-label":G?c("composer.spawnAria"):c("composer.sendAria",{target:f??""}),children:[D.length?(0,d.jsx)("div",{className:"flex flex-col gap-0.5","aria-label":c("composer.queueAria"),children:D.map(a=>(0,d.jsxs)("div",{className:"flex items-center justify-end gap-1.5",children:[(0,d.jsx)("span",{className:"min-w-0 max-w-[85%] truncate rounded-[10px] rounded-br-[3px] bg-[#ecebfb] px-2 py-0.5 text-[11px] text-[#333]",title:a.text,children:a.text}),(0,d.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-0.5 text-[9.5px] text-dim",children:["spawn"===a.via?(0,d.jsx)(bk,{className:"h-2.5 w-2.5","aria-hidden":!0}):(0,d.jsx)(a4,{className:"h-2.5 w-2.5","aria-hidden":!0}),new Date(a.at).toLocaleTimeString("uk"===r()?"uk-UA":"en-US",{hour12:!1,hour:"2-digit",minute:"2-digit"})]}),(0,d.jsx)("button",{type:"button","aria-label":c("composer.removeFromQueue"),className:"inline-flex shrink-0 items-center rounded px-0.5 text-dim hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>I(D.filter(b=>b.id!==a.id)),children:(0,d.jsx)(n,{className:"h-3 w-3","aria-hidden":!0})})]},a.id))}):null,(0,d.jsx)(bQ,{composer:g,placeholder:H?c("composer.placeholderRelay"):G?c("composer.placeholderSpawn"):c("composer.placeholderSend"),textareaAriaLabel:c("composer.textAria"),imageAriaLabel:c("composer.addImages"),sendLabelIdle:G?c("composer.launchAgent"):c("composer.sendToAgent"),sendLabelRecording:c("composer.stopAndSend"),sendTitleRecording:c("composer.stopAndSendTitle"),sendIdleClassName:"border-accent bg-accent hover:opacity-90",sendMenuLabel:c("composer.sendMenuTitle"),sendMenuActions:!G||H?[{id:"quick-ack",label:c("composer.quickAckLabel"),description:c("composer.quickAck"),disabled:O,tone:"ok",onSelect:()=>void J(c("composer.quickAck"))}]:[],showImage:!t,leftSlot:t?(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5",children:[(0,d.jsx)("button",{type:"button","aria-expanded":u,"aria-label":c("composer.moreTools"),title:c("composer.moreTools"),onClick:()=>w(a=>!a),className:"inline-flex shrink-0 items-center justify-center rounded-[8px] border border-line bg-panel p-2 text-dim hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:(0,d.jsx)(bA,{className:`h-4 w-4 transition-transform ${u?"rotate-45":""}`,"aria-hidden":!0})}),u?(0,d.jsxs)(d.Fragment,{children:[M,N,(0,d.jsx)(bF,{ariaLabel:c("composer.addImages"),className:"inline-flex shrink-0 items-center justify-center rounded-[8px] border border-line bg-panel p-2 text-dim hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onFiles:s.addFiles})]}):null]}):(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5",children:[M,N]})})]})}let bU="#0d9488",bV=new Map;function bW(){for(let a of document.querySelectorAll("[data-link-hover]"))a.removeAttribute("data-link-hover")}function bX(a,b,c,d){let e=Math.max(48,.45*Math.abs(c-a));return`M ${a} ${b} C ${a+e} ${b}, ${c-e} ${d}, ${c} ${d}`}function bY(a){let[b,c]=(0,e.useState)(!1),f=(0,e.useRef)(a),[g,h]=(0,e.useState)(null),[i,j]=(0,e.useState)(null),k=(0,e.useRef)(null),l=(0,e.useRef)(!1),m=(0,e.useRef)(!1),n=(0,e.useRef)(null),o="link-arrow-"+(0,e.useId)().replace(/[^a-zA-Z0-9-]/g,"");return{onPillPointerDown:a=>{if("mouse"===a.pointerType&&0!==a.button||k.current)return;let b=a.currentTarget.getBoundingClientRect(),d=a=>{let b=k.current;if(!b)return;if(b.lastX=a.clientX,b.lastY=a.clientY,!b.active){if(7>Math.hypot(a.clientX-b.startX,a.clientY-b.startY))return;b.active=!0,l.current=!0,m.current=!0,document.body.style.cursor="crosshair",bW(),j(null),h({x:b.anchorX,y:b.anchorY}),c(!0),f.current.onDragStart?.()}n.current?.setAttribute("d",bX(b.anchorX,b.anchorY,a.clientX,a.clientY));let d=function(a,b,c){let d=document.elementFromPoint(a,b)?.closest("[data-link-path]"),e=d?.getAttribute("data-link-path");if(!d||!e||e===c)return null;let f=bV.get(e);return f&&f.el===d?f:null}(a.clientX,a.clientY,f.current.exclude??null);d?.el!==b.hover?.el&&(b.hover?.el.removeAttribute("data-link-hover"),d?.el.setAttribute("data-link-hover","1"),b.hover=d)},e=a=>{let b=k.current;if(k.current=null,b?.detach(),l.current=!1,document.body.style.cursor="",b?.active)if(c(!1),b.hover){let c=f.current.onDrop(b.hover,{x:a.clientX,y:a.clientY});null!==c?j({label:c,from:{x:b.anchorX,y:b.anchorY},to:{x:a.clientX,y:a.clientY}}):bW()}else bW(),f.current.onMiss?.({x:a.clientX,y:a.clientY})};k.current={startX:a.clientX,startY:a.clientY,anchorX:b.right,anchorY:b.top+b.height/2,lastX:a.clientX,lastY:a.clientY,active:!1,hover:null,detach:()=>{window.removeEventListener("pointermove",d),window.removeEventListener("pointerup",e),window.removeEventListener("pointercancel",e)}},window.addEventListener("pointermove",d),window.addEventListener("pointerup",e),window.addEventListener("pointercancel",e)},consumeClick:()=>{let a=m.current;return m.current=!1,a},draggingRef:l,overlay:b||i?(0,bz.createPortal)((0,d.jsxs)("div",{className:"pointer-events-none fixed inset-0 z-[95]",children:[(0,d.jsxs)("svg",{className:"block h-full w-full",children:[(0,d.jsx)("defs",{children:(0,d.jsx)("marker",{id:o,markerWidth:"9",markerHeight:"9",refX:"7",refY:"4.5",orient:"auto",children:(0,d.jsx)("path",{d:"M0,0 L8,4.5 L0,9 Z",fill:bU})})}),(0,d.jsx)("path",{ref:a=>{n.current=a;let b=k.current;a&&b?.active&&a.setAttribute("d",bX(b.anchorX,b.anchorY,b.lastX,b.lastY))},d:i?bX(i.from.x,i.from.y,i.to.x,i.to.y):void 0,fill:"none",stroke:bU,strokeWidth:2.5,strokeLinecap:"round",markerEnd:`url(#${o})`}),(0,d.jsx)("circle",{cx:i?i.from.x:g?.x??0,cy:i?i.from.y:g?.y??0,r:4,fill:bU})]}),i?(0,d.jsx)(bZ,{drop:i}):null]}),document.body):null}}function bZ({drop:a}){let b=Math.max(8,Math.min(a.to.x+14,window.innerWidth-288)),c=Math.max(8,Math.min(a.to.y+12,window.innerHeight-44));return(0,d.jsxs)("div",{className:"fixed flex max-w-[280px] items-center gap-1.5 rounded-full px-3 py-1.5 text-[11.5px] font-semibold text-white shadow-card",style:{left:b,top:c,backgroundColor:bU},children:[(0,d.jsx)(bg,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),(0,d.jsx)("span",{className:"truncate",children:a.label})]})}function b$({file:a,onDeleted:b}){let{t:c}=v(),[f,g]=(0,e.useState)(!1),[h,i]=(0,e.useState)(!1),[j,k]=(0,e.useState)("");if("running"===a.proc)return null;let l=async()=>{i(!0),k("");try{let d=await fetch(`/api/log?path=${encodeURIComponent(a.path)}`,{method:"DELETE"}),e=await d.json();if(!d.ok||!e.ok)return void k(e.error??c("common.failedDelete"));g(!1),b?.()}catch{k(c("common.serverUnavailable"))}finally{i(!1)}};return f?(0,d.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-[10px] border border-err/30 bg-[#fff5f5] px-1.5 py-0.5 text-[11px]",children:[(0,d.jsx)("span",{className:"px-0.5 font-semibold text-err",children:c("delFile.confirm")}),(0,d.jsx)("button",{type:"button",className:"rounded-lg bg-err px-2 py-0.5 font-bold text-white disabled:opacity-60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-err/50",disabled:h,onClick:l,children:h?"…":c("common.yes")}),(0,d.jsx)("button",{type:"button",className:"rounded-lg border border-line bg-panel px-2 py-0.5 font-semibold text-dim focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>g(!1),children:c("common.no")})]}):(0,d.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1",children:[(0,d.jsx)("button",{type:"button",className:"inline-flex items-center rounded-[8px] border border-line bg-bg px-1.5 py-0.5 text-dim hover:border-err/40 hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":c("delFile.aria"),title:c("delFile.aria"),onClick:()=>g(!0),children:(0,d.jsx)(bo,{className:"h-3 w-3","aria-hidden":!0})}),j?(0,d.jsx)("span",{className:"max-w-[160px] truncate text-[10.5px] font-semibold text-err",title:j,children:j}):null]})}function b_({file:a}){let b=ao[a.effort??""]??0;if(!b)return null;let{color:c}=am(a),e=an(a);return(0,d.jsx)("span",{className:"inline-flex h-[12px] shrink-0 items-end gap-px",role:"img","aria-label":e,title:e,style:{transform:"scale(clamp(1, var(--inv-z, 1), 5))",transformOrigin:"left bottom"},children:Array.from({length:6},(a,e)=>(0,d.jsx)("span",{"aria-hidden":!0,className:"shrink-0 rounded-full",style:{width:"3px",height:`${7+e}px`,backgroundColor:e<b?c:"var(--color-line, #e6e6ea)"}},e))})}function b0({className:a,style:b,enter:c="scale",children:f}){let g=(0,e.useRef)(null);return!function(a="scale"){(0,e.useRef)(new Map),(0,e.useRef)(new WeakMap),(0,e.useRef)(!0)}(c),(0,d.jsx)("div",{ref:g,className:a,style:b,children:f})}let b1=k("arrow-down-to-line",[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]]),b2=/^\s*(?:VERDICT:\s*)?(REQUEST_CHANGES|APPROVE|COMMENT)\b/m,b3=/^\s*(\d+)[.)]\s+(.*)$/,b4=/(?:\[(P[0-3])\]|\b(Critical|High|Medium|Low|Info|P[0-3])\b)/i,b5=/((?:\.{1,2}\/|\/|~\/)?[\w@.+-][\w@.+\-/]*\.(?:tsx?|jsx?|mjs|cjs|mts|cts|py|go|rs|md|json|ya?ml|toml|css|scss|html|sql|sh|env|ftl|txt))(?::(\d+))?/i,b6=/\[([^\]]+)\]\(([^)\s]+)\)/,b7=/([\w.-]*(?:api[_-]?key|access[_-]?token|refresh[_-]?token|authorization|bearer|secret|password|passwd|pwd|token))\b(\s*[:=]\s*)(["']?)[^\s"',}]+/gi;function b8(a){return a.replace(b7,(a,b,c,d)=>`${b}${c}${d}[redacted]`)}function b9(a){let b=b8(a);return{raw:b.slice(0,24e3),truncated:b.length>24e3}}function ca(a){let b=a.match(/^(.*?):(\d+(?:-\d+)?)$/);return b?{target:b[1]??a,line:b[2]}:{target:a}}function cb(a,b){let c=a.match(b2)?.[1];if(!c)return null;let d=[],e=[],f=null,g=()=>{let a,b,c,e=f?.trim();e&&d.push((a=function(a){let b=a.toUpperCase();if("P0"===b||"P1"===b||"P2"===b||"P3"===b)return b;let c=a.toLowerCase();return"critical"===c?"Critical":"high"===c?"High":"medium"===c?"Medium":"low"===c?"Low":"Info"}(e.match(b4)?.[1]??e.match(b4)?.[2]??"Info"),b=function(a){let b=a.match(b6);if(b){let a=ca((b[2]??"").replace(/^file:\/\//,"")),c=a.line?Number(a.line.split("-",1)[0]):void 0;return{file:a.target||b[1],line:Number.isFinite(c)?c:void 0}}let c=a.match(b5);if(!c)return{};let d=c[2]?Number(c[2]):void 0;return{file:c[1],line:Number.isFinite(d)?d:void 0}}(e),c=function(a){let b=a,c=b.match(b4);if(c&&void 0!==c.index){let a=b.slice(c.index+c[0].length).replace(/^[\s.:–—-]+/,"");a&&(b=a)}return b.replace(b6,"$1").replace(/`([^`]*)`/g,"$1").replace(/\s+/g," ").trim().slice(0,200)}(e)||e.slice(0,200)||"Finding",{severity:a,file:b.file,line:b.line,title:c,body:b9(e).raw})),f=null};for(let b of a.split("\n")){let a=b.trimEnd(),c=a.match(b3);if(c){g(),f=c[2]??"";continue}let h=a.trim();if(null!==f){h?f=`${f}
|
|
3
|
+
${h}`:g();continue}!(!h||b2.test(a)||/^(findings?|summary|open questions?|tests?|residual risk)\s*:?\s*$/i.test(h))&&0===d.length&&e.length<3&&h.length<=240&&e.push(h)}g();let h=d.filter(a=>b4.test(a.body)).length;return c||/^findings?\s*:?$/im.test(a)||h>=2||h>=1&&/\b(review|request_changes|approve|comment)\b/i.test(a)?{kind:"review",ts:b,verdict:c,findings:d,summary:e,raw:b9(a).raw}:null}let cc=(a,b)=>u(r(),a,b),cd=/<oai-mem-citation>\s*<citation_entries>([\s\S]*?)<\/citation_entries>\s*<rollout_ids>([\s\S]*?)<\/rollout_ids>\s*<\/oai-mem-citation>/g;function ce(a){return"number"==typeof a&&Number.isFinite(a)?a:void 0}let cf=/<(teammate-message|agent-message)\b([^>]*)>([\s\S]*?)<\/\1>/g,cg=/\S*\/(?:agent-log-viewer\/inbox|\.claude\/viewer-inbox)\/([A-Za-z0-9._-]+\.(?:png|jpe?g|gif|webp))/gi;function ch(a){if(!a.includes("/.claude/viewer-inbox/")&&!a.includes("/agent-log-viewer/inbox/"))return{cleaned:a,images:[]};let b=[],c=new Set,d=[];for(let e of a.split("\n"))e.replace(cg,(a,d)=>(c.has(a)||(c.add(a),b.push({name:d,path:a})),"")).trim()&&d.push(e);return{cleaned:d.join("\n").trim(),images:b}}let ci=/^\s*(?:<[a-zA-Z][\w:-]*|Caveat: The messages below|\[Request interrupted|This came from another Claude session|# AGENTS\.md instructions)/;function cj(a,b){let c=a.match(/^\s*<([a-zA-Z][\w:-]*)/)?.[1];return c||(/^\s*# AGENTS\.md/.test(a)?"AGENTS.md":/^\s*Caveat:/.test(a)?"caveat":b||cc("render.system"))}function ck(a,b){return a.match(RegExp(`${b}="([^"]*)"`))?.[1]??""}function cl(a){return"string"==typeof a?a:""}function cm(a){return a&&"object"==typeof a&&!Array.isArray(a)?a:{}}function cn(a){return Array.isArray(a)?a.filter(a=>a&&"object"==typeof a&&!Array.isArray(a)):[]}function co(a,b,c){let d=b.split("\n").map(a=>a.trim()).filter(Boolean).map(a=>{let b=a.match(/\|note=\[(.*)\]$/)?.[1],c=ca(a.replace(/\|note=\[.*\]$/,""));return{target:c.target,line:c.line,note:b,raw:a}}),e=c.split(/\s+/).map(a=>a.trim()).filter(a=>/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(a)),f=b9(a);return{kind:"mem-citation",entries:d,rolloutIds:e,raw:f.raw,truncated:f.truncated}}async function cp(a){try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(a),!0}catch{}try{let b=document.createElement("textarea");b.value=a,b.style.position="fixed",b.style.opacity="0",document.body.appendChild(b),b.select();let c=document.execCommand("copy");return b.remove(),c}catch{return!1}}function cq({text:a,label:b,className:c=""}){let[f,g]=(0,e.useState)(!1),h=(0,e.useRef)(null),i=f?cc("common.copied"):b??cc("common.copy");return(0,d.jsx)("button",{type:"button","aria-label":i,title:i,onClick:b=>{b.preventDefault(),b.stopPropagation(),cp(a).then(a=>{a&&(g(!0),null!==h.current&&window.clearTimeout(h.current),h.current=window.setTimeout(()=>g(!1),1400))})},className:`inline-flex shrink-0 items-center justify-center rounded-[6px] border border-line bg-panel p-1 text-dim shadow-card hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${c}`,children:f?(0,d.jsx)(a8,{className:"h-3 w-3 text-ok","aria-hidden":!0}):(0,d.jsx)(bd,{className:"h-3 w-3","aria-hidden":!0})})}let cr=k("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);function cs({src:a,alt:b,caption:c,onClose:f}){let{t:g}=v(),[h,i]=(0,e.useState)(1),[j,k]=(0,e.useState)(0),[l,m]=(0,e.useState)(0),[o,p]=(0,e.useState)(!1),q=(0,e.useRef)(null),r=(a,b=0,c=0)=>{let d=Math.min(8,Math.max(.25,h*a)),e=d/h;i(d),k(b-(b-j)*e),m(c-(c-l)*e)},s=()=>{i(1),k(0),m(0)};return(0,bz.createPortal)((0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex flex-col bg-black/85 backdrop-blur-sm",role:"dialog","aria-modal":"true","aria-label":b,onClick:f,children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 px-4 py-2.5",onClick:a=>a.stopPropagation(),children:[(0,d.jsx)("span",{className:"min-w-0 truncate text-[12.5px] font-semibold text-white/85",children:c??b}),(0,d.jsxs)("span",{className:"ml-auto flex items-center gap-1.5",children:[(0,d.jsx)("button",{className:"inline-flex items-center rounded-lg border border-white/25 bg-white/10 px-2.5 py-1 text-white hover:bg-white/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/60","aria-label":g("lightbox.zoomOut"),onClick:()=>r(1/1.4),children:(0,d.jsx)(cr,{className:"h-4 w-4","aria-hidden":!0})}),(0,d.jsxs)("button",{className:"rounded-lg border border-white/25 bg-white/10 px-2 py-1 text-[11.5px] font-semibold text-white hover:bg-white/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/60","aria-label":g("lightbox.resetZoom"),onClick:s,children:[Math.round(100*h),"%"]}),(0,d.jsx)("button",{className:"inline-flex items-center rounded-lg border border-white/25 bg-white/10 px-2.5 py-1 text-white hover:bg-white/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/60","aria-label":g("lightbox.zoomIn"),onClick:()=>r(1.4),children:(0,d.jsx)(bA,{className:"h-4 w-4","aria-hidden":!0})}),(0,d.jsx)("button",{className:"ml-1 inline-flex items-center rounded-lg border border-white/25 bg-white/10 px-2.5 py-1 text-white hover:bg-white/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/60","aria-label":g("common.close"),onClick:f,children:(0,d.jsx)(n,{className:"h-4 w-4","aria-hidden":!0})})]})]}),(0,d.jsx)("div",{className:"min-h-0 flex-1 touch-none overflow-hidden",onClick:a=>a.stopPropagation(),onWheel:a=>{let b=a.currentTarget.getBoundingClientRect(),c=a.clientX-b.left-b.width/2,d=a.clientY-b.top-b.height/2;r(a.deltaY<0?1.18:1/1.18,c,d)},onPointerDown:a=>{a.currentTarget.setPointerCapture(a.pointerId),q.current={x:a.clientX,y:a.clientY,tx:j,ty:l},p(!0)},onPointerMove:a=>{q.current&&(k(q.current.tx+(a.clientX-q.current.x)),m(q.current.ty+(a.clientY-q.current.y)))},onPointerUp:()=>{q.current=null,p(!1)},onPointerCancel:()=>{q.current=null,p(!1)},onDoubleClick:()=>1===h?r(2):s(),children:(0,d.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,d.jsx)("img",{src:a,alt:b,draggable:!1,className:`max-h-full max-w-full select-none ${o?"":"transition-transform duration-75"} ${h>1?"cursor-grab active:cursor-grabbing":"cursor-zoom-in"}`,style:{transform:`translate(${j}px, ${l}px) scale(${h})`}})})})]}),document.body)}function ct({name:a,path:b}){let{t:c}=v(),[f,g]=(0,e.useState)("thumb"),[h,i]=(0,e.useState)(null),[j,k]=(0,e.useState)(!1),[l,m]=(0,e.useState)(!1),[n,o]=(0,e.useState)(""),p=`/api/inbox?name=${encodeURIComponent(a)}`,q=async()=>{m(!0),o("");try{let a=await fetch(p,{method:"DELETE"}),b=await a.json();if(!a.ok||!b.ok)return void o(b.error??c("common.failedDelete"));i("deleted")}catch{o(c("common.serverUnavailable"))}finally{m(!1),k(!1)}};return h?(0,d.jsx)("div",{className:"my-2 flex justify-end",children:(0,d.jsxs)("span",{className:"inline-flex max-w-[75%] items-center gap-1.5 rounded-full border border-line bg-chip px-2.5 py-1 text-[11.5px] font-semibold text-dim",title:b,children:[(0,d.jsx)(by,{name:"image",className:"h-3.5 w-3.5"}),(0,d.jsx)("span",{className:"truncate",children:a}),(0,d.jsxs)("span",{className:"shrink-0",children:["\xb7 ","deleted"===h?c("inbox.deleted"):c("inbox.fileGone")]})]})}):"chip"===f?(0,d.jsx)("div",{className:"my-2 flex justify-end",children:(0,d.jsxs)("button",{type:"button",onClick:()=>g("thumb"),className:"inline-flex max-w-[75%] items-center gap-2 rounded-[14px] border border-line bg-panel px-3.5 py-2 text-[13px] shadow-card",title:b,children:[(0,d.jsx)("span",{className:"flex h-6.5 w-6.5 shrink-0 items-center justify-center rounded-lg bg-chip",children:(0,d.jsx)(by,{name:"image",className:"h-4 w-4"})}),(0,d.jsx)("span",{className:"truncate font-mono text-[12px]",children:a}),(0,d.jsx)("span",{className:"shrink-0 text-[12px] font-semibold text-accent",children:c("common.show")})]})}):(0,d.jsxs)("div",{className:"my-2 flex justify-end",children:[(0,d.jsxs)("div",{className:"max-w-[75%]",children:[(0,d.jsx)("img",{src:p,alt:c("inbox.attachedAlt",{name:a}),onClick:()=>g("full"),onError:()=>i("missing"),className:"ml-auto block max-h-[240px] cursor-zoom-in rounded-[14px] border border-line"}),(0,d.jsxs)("div",{className:"mt-1 flex flex-wrap items-center justify-end gap-1.5 text-[11px]",children:[(0,d.jsx)("span",{className:"min-w-0 truncate font-mono text-dim",title:b,children:a}),(0,d.jsx)("button",{type:"button",onClick:()=>g("chip"),className:"shrink-0 text-dim hover:text-ink",children:c("common.collapse")}),j?(0,d.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-[10px] border border-err/30 bg-[#fff5f5] px-1.5 py-0.5",children:[(0,d.jsx)("span",{className:"px-1 font-semibold text-err",children:c("inbox.confirmDelete")}),(0,d.jsx)("button",{type:"button",className:"rounded-lg bg-err px-2 py-0.5 font-bold text-white disabled:opacity-60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-err/50",disabled:l,onClick:q,children:l?c("trash.deleting"):c("trash.confirmYes")}),(0,d.jsx)("button",{type:"button",className:"rounded-lg border border-line bg-panel px-2 py-0.5 font-semibold text-dim focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>k(!1),children:c("common.cancel")})]}):(0,d.jsxs)("button",{type:"button",onClick:()=>k(!0),"aria-label":c("inbox.deleteAria",{name:a}),className:"inline-flex shrink-0 items-center gap-1 rounded-full border border-line bg-panel px-2 py-0.5 font-semibold text-dim hover:border-err/40 hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[(0,d.jsx)(bo,{className:"h-3 w-3","aria-hidden":!0})," ",c("inbox.deleteFromDisk")]}),n?(0,d.jsx)("span",{className:"shrink-0 font-semibold text-err",children:n}):null]})]}),"full"===f?(0,d.jsx)(cs,{src:p,alt:c("inbox.attachedAlt",{name:a}),caption:b,onClose:()=>g("thumb")}):null]})}let cu=/(!\[[^\]]*\]\([^)\s]+\)|`[^`]+`|\*\*[^*]+\*\*|\[[^\]]+\]\([^)\s]+\)|https?:\/\/[^\s<>"')\]]+)/g,cv=/^\s*!\[([^\]]*)\]\(([^)\s]+)\)\s*$/;function cw({text:a}){let[b,c]=(0,e.useState)(!1),f=(0,e.useRef)(null);return(0,d.jsx)("span",{title:b?cc("common.copied"):cc("common.clickToCopy"),onClick:b=>{b.preventDefault(),b.stopPropagation(),cp(a).then(a=>{a&&(c(!0),null!==f.current&&window.clearTimeout(f.current),f.current=window.setTimeout(()=>c(!1),1400))})},className:`cursor-copy rounded-md px-1.5 py-0.5 font-mono ${b?"bg-ok/15 text-ok":"bg-chip"}`,children:a})}function cx({code:a}){return(0,d.jsxs)("div",{className:"group/code relative my-1.5 max-w-full",children:[(0,d.jsx)("pre",{className:"max-w-full overflow-x-auto rounded-[10px] border border-line bg-bg px-3 py-2 font-mono text-[11.5px]",children:a}),(0,d.jsx)(cq,{text:a,label:cc("feed.copyCode"),className:"absolute right-1.5 top-1.5 opacity-0 transition-opacity focus-visible:opacity-100 group-hover/code:opacity-100 [@media(hover:none)]:opacity-60"})]})}function cy(a){let b=a.replace(/\\([()])/g,"$1"),c=b.replace(/^file:\/\//,"");return/^(?:\/|~\/)/.test(c)?`#f=${encodeURIComponent(c.replace(/:\d+$/,""))}`:b}function cz({href:a,label:b}){let c=/^https?:\/\//.test(a);return(0,d.jsx)("a",{href:a,target:c?"_blank":void 0,rel:c?"noreferrer":void 0,title:a,className:"break-all text-accent underline decoration-accent/40 underline-offset-2 hover:decoration-accent",children:b})}function cA({alt:a,src:b}){let[c,f]=(0,e.useState)(!1),[g,h]=(0,e.useState)(!1),i=function(a){let b=a.replace(/\\([()])/g,"$1");if(/^(?:https?:)?\/\//.test(b)||b.startsWith("data:"))return b;let c=b.replace(/^file:\/\//,"");return`/api/image?path=${encodeURIComponent(c)}`}(b);return g?(0,d.jsx)(cz,{href:cy(b),label:a||b}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("img",{src:i,alt:a,title:a||void 0,loading:"lazy",onClick:()=>f(!0),onError:()=>h(!0),className:"my-1 max-h-[240px] max-w-full cursor-zoom-in rounded-[10px] border border-line align-top"}),c?(0,d.jsx)(cs,{src:i,alt:a,caption:a||void 0,onClose:()=>f(!1)}):null]})}function cB({images:a}){return(0,d.jsx)("div",{className:"my-1.5 flex flex-wrap items-start gap-2",children:a.map((a,b)=>(0,d.jsx)(cA,{alt:a.alt,src:a.src},b))})}function cC(a){return a.split(cu).map((a,b)=>{if(!a)return null;if(a.startsWith("`")&&a.endsWith("`"))return(0,d.jsx)(cw,{text:a.slice(1,-1)},b);if(a.startsWith("**")&&a.endsWith("**"))return(0,d.jsx)("b",{children:a.slice(2,-2)},b);let c=a.match(/^!\[([^\]]*)\]\(([^)\s]+)\)$/);if(c)return(0,d.jsx)(cA,{alt:c[1],src:c[2]},b);let e=a.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);if(e)return(0,d.jsx)(cz,{href:cy(e[2]),label:e[1]},b);if(/^https?:\/\//.test(a)){let c=a.replace(/[.,;:!?…»)]+$/,""),e=a.slice(c.length),f=c.length>72?c.slice(0,69)+"…":c;return(0,d.jsxs)("span",{children:[(0,d.jsx)(cz,{href:c,label:f}),e]},b)}return a})}let cD=/^\s*\|.*\|\s*$/,cE=/^:?-{1,}:?$/;function cF({rows:a}){let b=a.map(a=>a.trim().replace(/^\|/,"").replace(/\|$/,"").split("|").map(a=>a.trim())),c=b.length>1&&b[1].every(a=>cE.test(a)),e=c?b[0]:null,f=c?b.slice(2):b;return(0,d.jsx)("div",{className:"my-1.5 max-w-full overflow-x-auto",children:(0,d.jsxs)("table",{className:"border-collapse text-[12.5px]",children:[e?(0,d.jsx)("thead",{children:(0,d.jsx)("tr",{children:e.map((a,b)=>(0,d.jsx)("th",{className:"border border-line bg-chip px-2.5 py-1 text-left font-semibold",children:cC(a)},b))})}):null,(0,d.jsx)("tbody",{children:f.map((a,b)=>(0,d.jsx)("tr",{children:a.map((a,b)=>(0,d.jsx)("td",{className:"border border-line px-2.5 py-1 align-top",children:cC(a)},b))},b))})]})})}function cG(a){let b=a.split("\n"),c=[],f=0;for(;f<b.length;){if(/^\s*```/.test(b[f])){let a=f;for(f++;f<b.length&&!/^\s*```\s*$/.test(b[f]);)f++;let e=b.slice(a+1,f).join("\n");f<b.length&&f++,"\n"===c[c.length-1]&&c.pop(),c.push((0,d.jsx)(cx,{code:e},`c${a}`));continue}if(cD.test(b[f])){let a=f;for(;f<b.length&&cD.test(b[f]);)f++;"\n"===c[c.length-1]&&c.pop(),c.push((0,d.jsx)(cF,{rows:b.slice(a,f)},`t${a}`));continue}if(cv.test(b[f])){let a=f,e=[];for(;f<b.length;){let a=b[f].match(cv);if(!a)break;e.push({alt:a[1],src:a[2]}),f++}"\n"===c[c.length-1]&&c.pop(),c.push((0,d.jsx)(cB,{images:e},`i${a}`));continue}let a=b[f],g=a.match(/^#{1,6}\s+(.*)$/),h=a.match(/^>\s?(.*)$/);g?c.push((0,d.jsx)("span",{className:"text-[14px] font-bold",children:cC(g[1])},f)):h?c.push((0,d.jsx)("span",{className:"border-l-2 border-line pl-2 text-dim",children:cC(h[1])},f)):c.push((0,d.jsx)(e.Fragment,{children:cC(a)},f)),++f<b.length&&c.push("\n")}return c}function cH({bytes:a,text:b}){let[c,f]=(0,e.useState)(!1),g=Math.round(a/1024);return c?(0,d.jsxs)("div",{className:"my-2 ml-9 overflow-hidden rounded-[14px] border border-line bg-panel shadow-card",children:[(0,d.jsx)("pre",{className:"max-h-[340px] overflow-auto whitespace-pre-wrap break-all bg-[#fafafc] px-3.5 py-2.5 font-mono text-[11.5px]",children:b}),(0,d.jsx)("button",{type:"button",onClick:()=>f(!1),className:"block w-full border-t border-line px-3.5 py-1.5 text-[12px] text-dim",children:cc("common.collapse")})]}):(0,d.jsxs)("button",{type:"button",onClick:()=>f(!0),className:"my-2 ml-9 flex items-center gap-2 rounded-[14px] border border-line bg-panel px-3.5 py-2 text-[13px] shadow-card",children:[(0,d.jsx)("span",{className:"flex h-6.5 w-6.5 items-center justify-center rounded-lg bg-chip",children:(0,d.jsx)(by,{name:"blob",className:"h-4 w-4"})}),(0,d.jsx)("span",{className:"font-semibold",children:cc("render.dataKb",{n:g})}),(0,d.jsx)("span",{className:"ml-1 text-[12px] font-semibold text-accent",children:cc("common.show")})]})}let cI=/(?:\/\.codex\/sessions\/|\/\.claude\/projects\/|\/\.claude\/plugins\/data\/codex-openai-codex\/state\/|^\/tmp\/claude-\d+\/)/;function cJ({status:a,className:b}){let c=b??"h-3.5 w-3.5";return"ok"===a?(0,d.jsx)(a8,{className:c,"aria-hidden":!0}):"err"===a?(0,d.jsx)(n,{className:c,"aria-hidden":!0}):(0,d.jsx)(bw,{className:`${c} animate-spin`,"aria-hidden":!0})}function cK({file:a,line:b}){let c=b?`${a}:${b}`:a,e="inline-block min-w-0 max-w-full truncate rounded-md bg-chip px-1.5 py-0.5 align-bottom font-mono text-[11.5px]";return cI.test(a)?(0,d.jsx)("a",{href:`#f=${encodeURIComponent(a)}`,className:`${e} text-accent underline decoration-dotted`,title:c,children:c}):(0,d.jsx)("code",{className:e,title:c,children:c})}function cL({item:a}){let b=Object.entries(a.byTool).map(([a,b])=>`${a} \xd7${b}`).join(" \xb7 "),c=ad(a.t0),e=ad(a.t1),f=c&&e&&c!==e?`${c}–${e}`:c||e;return(0,d.jsxs)("details",{className:`my-2.5 ml-9 overflow-hidden rounded-[14px] border shadow-card ${a.hasErr?"border-err/35 bg-[#fff4f4]":"border-line bg-panel"}`,open:a.hasErr,children:[(0,d.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-2.5 px-3.5 py-2",children:[(0,d.jsx)("span",{className:"flex h-6.5 w-6.5 shrink-0 items-center justify-center rounded-lg bg-chip",children:(0,d.jsx)(by,{name:"cmd-group",className:"h-4 w-4"})}),(0,d.jsxs)("span",{className:"flex min-w-0 flex-1 items-center gap-1 truncate text-[12.5px]",children:[cc("render.commands",{count:a.calls.length}),b?" \xb7 "+b:""," \xb7",(0,d.jsxs)("span",{className:"inline-flex items-center gap-0.5 text-ok",children:[(0,d.jsx)(a8,{className:"h-3.5 w-3.5","aria-hidden":!0}),a.okCount]}),a.errCount?(0,d.jsxs)("span",{className:"inline-flex items-center gap-0.5 text-err",children:[(0,d.jsx)(n,{className:"h-3.5 w-3.5","aria-hidden":!0}),a.errCount]}):null]}),f?(0,d.jsx)("span",{className:"ml-auto shrink-0 text-[11px] text-dim",children:f}):null]}),(0,d.jsx)("div",{className:"space-y-1 border-t border-line bg-[#fafafc] px-2 py-1.5",children:a.calls.map((b,c)=>{let e="ok"===b.status?"text-ok":"err"===b.status?"text-err":"text-dim";return(0,d.jsxs)("details",{className:"overflow-hidden rounded-[10px] border border-line bg-panel",open:b.open,children:[(0,d.jsxs)("summary",{className:"flex h-6 cursor-pointer list-none items-center gap-2 px-2.5 text-[11.5px]",children:[(0,d.jsx)("span",{className:"flex h-4.5 w-4.5 shrink-0 items-center justify-center rounded-md bg-chip",children:(0,d.jsx)(by,{name:b.icon,className:"h-3 w-3"})}),(0,d.jsx)("code",{className:"min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap rounded-md bg-chip px-1.5 py-0.5 font-mono text-[11px]",children:b.display}),(0,d.jsxs)("span",{className:`ml-auto inline-flex shrink-0 items-center gap-1 text-[10.5px] font-semibold ${e}`,children:[(0,d.jsx)(cJ,{status:b.status,className:"h-3 w-3"}),b.label]})]}),(0,d.jsx)("pre",{className:"max-h-[280px] overflow-auto whitespace-pre-wrap border-t border-line bg-[#fafafc] px-3 py-2 font-mono text-[11.5px]",children:"$ "+b.cmd+(b.output?"\n"+b.output:"")})]},`${a.ids[c]}:${c}`)})})]})}function cM({item:a}){let b=[a.trigger?cc("auto"===a.trigger?"render.compactAuto":"render.compactManual"):"",a.preTokens?cc("render.compactPre",{n:Math.round(a.preTokens/1e3)}):"",ad(a.ts)||""].filter(Boolean).join(" \xb7 ");return(0,d.jsxs)("div",{className:"my-3.5",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,d.jsx)("span",{className:"h-px flex-1 bg-[#0d9488]/30","aria-hidden":!0}),(0,d.jsxs)("span",{className:"inline-flex items-center gap-1.5 rounded-full border border-[#0d9488]/30 bg-[#e7f6f4] px-2.5 py-1 text-[11px] font-bold text-[#0b7c72]",children:[(0,d.jsx)(by,{name:"compact",className:"h-3.5 w-3.5"}),cc("render.compacted"),b?(0,d.jsx)("span",{className:"font-semibold opacity-75",children:b}):null]}),(0,d.jsx)("span",{className:"h-px flex-1 bg-[#0d9488]/30","aria-hidden":!0})]}),a.summary?(0,d.jsxs)("details",{className:"group/cmp mt-1.5 text-center",children:[(0,d.jsxs)("summary",{className:"cursor-pointer list-none text-[11px] font-semibold text-[#0b7c72] [&::-webkit-details-marker]:hidden",children:[(0,d.jsxs)("span",{className:"group-open/cmp:hidden",children:[cc("render.compactSummary")," \xb7 ",cc("common.show")]}),(0,d.jsx)("span",{className:"hidden group-open/cmp:inline",children:cc("common.collapse")})]}),(0,d.jsx)("pre",{className:"mt-1 max-h-[320px] overflow-auto whitespace-pre-wrap break-words rounded-[10px] border border-line bg-bg px-3 py-2 text-left font-mono text-[11px] text-[#555]",children:a.summary})]}):null]})}function cN({media:a,data:b,w:c,h:f,bytes:g}){let[h,i]=(0,e.useState)("thumb"),j=Math.round((g??3*b.length/4)/1024),k=c&&f?`${c}\xd7${f}`:cc("render.image");if("chip"===h)return(0,d.jsxs)("button",{type:"button",onClick:()=>i("thumb"),className:"my-2 ml-9 flex items-center gap-2 rounded-[14px] border border-line bg-panel px-3.5 py-2 text-[13px] shadow-card",children:[(0,d.jsx)("span",{className:"flex h-6.5 w-6.5 items-center justify-center rounded-lg bg-chip",children:(0,d.jsx)(by,{name:"image",className:"h-4 w-4"})}),(0,d.jsx)("span",{className:"font-semibold",children:k}),(0,d.jsxs)("span",{className:"text-dim",children:["\xb7 ",j," ",cc("common.kb")]}),(0,d.jsx)("span",{className:"ml-1 text-[12px] font-semibold text-accent",children:cc("common.show")})]});let l=`data:${a};base64,${b}`;return(0,d.jsxs)("div",{className:"my-2 ml-9",children:[(0,d.jsx)("img",{src:l,alt:`${cc("render.image")} ${k}`,onClick:()=>i("full"),className:"max-h-[240px] cursor-zoom-in rounded-[14px] border border-line"}),(0,d.jsx)("button",{type:"button",onClick:()=>i("chip"),className:"mt-1 block text-[12px] text-dim",children:cc("common.collapse")}),"full"===h?(0,d.jsx)(cs,{src:l,alt:`${cc("render.image")} ${k}`,caption:`${k} \xb7 ${j} ${cc("common.kb")}`,onClose:()=>i("thumb")}):null]})}function cO({item:a}){let b=a.entries.slice(0,8),c=a.rolloutIds.slice(0,6);return(0,d.jsxs)("details",{className:"group my-2 ml-9 overflow-hidden rounded-[14px] border border-line bg-panel text-[12px] shadow-card",children:[(0,d.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-2 px-3.5 py-2",children:[(0,d.jsx)("span",{className:"flex h-6.5 w-6.5 shrink-0 items-center justify-center rounded-lg bg-chip",children:(0,d.jsx)(by,{name:"citation",className:"h-4 w-4"})}),(0,d.jsx)("span",{className:"text-[13px] font-semibold",children:cc("render.memoryCitations",{count:a.entries.length})}),(0,d.jsx)("span",{className:"ml-auto text-[11px] font-semibold text-accent group-open:hidden",children:cc("common.show")}),(0,d.jsx)("span",{className:"ml-auto hidden text-[11px] font-semibold text-accent group-open:inline",children:cc("common.collapse")})]}),(0,d.jsxs)("div",{className:"border-t border-line px-3.5 py-2.5",children:[b.length?(0,d.jsx)("div",{className:"space-y-1.5",children:b.map((a,b)=>(0,d.jsxs)("div",{className:"min-w-0 rounded-[9px] bg-[#fbfbfd] px-2.5 py-1.5",children:[(0,d.jsx)(cK,{file:a.target,line:a.line?Number(a.line.split("-",1)[0]):void 0}),a.note?(0,d.jsx)("div",{className:"mt-1 whitespace-pre-wrap break-words text-[12px] text-[#555]",children:a.note}):null]},b))}):(0,d.jsx)("div",{className:"text-[12px] text-dim",children:cc("render.noCitations")}),a.entries.length>b.length?(0,d.jsx)("div",{className:"mt-1.5 text-[12px] text-dim",children:cc("render.moreEntries",{count:a.entries.length-b.length})}):null,c.length?(0,d.jsxs)("div",{className:"mt-2 flex flex-wrap items-center gap-1.5",children:[(0,d.jsx)("span",{className:"text-[11px] text-dim",children:"rollout:"}),c.map(a=>(0,d.jsx)("code",{className:"rounded-full bg-chip px-2 py-0.5 font-mono text-[10.5px] text-dim",title:a,children:a.slice(0,8)},a)),a.rolloutIds.length>c.length?(0,d.jsxs)("span",{className:"text-[11px] text-dim",children:["+",a.rolloutIds.length-c.length]}):null]}):null,(0,d.jsxs)("details",{className:"mt-2 rounded-[10px] border border-line bg-[#fafafc] text-[12px]",children:[(0,d.jsxs)("summary",{className:"cursor-pointer list-none px-3 py-1.5 font-semibold text-dim",children:["raw citation block",a.truncated?" \xb7 "+cc("render.truncated"):""]}),(0,d.jsx)("pre",{className:"max-h-[260px] overflow-auto whitespace-pre-wrap border-t border-line px-3 py-2 font-mono text-[11.5px] text-[#555]",children:a.raw})]})]})]})}let cP={shutdown_request:{icon:"shutdown",labelKey:"render.shutdownRequest",tone:"amber"},shutdown_response:{icon:"shutdown",labelKey:"render.shutdownResponse",tone:"amber"},plan_approval_request:{icon:"plan",labelKey:"render.planRequest",tone:"accent"},plan_approval_response:{icon:"plan",labelKey:"render.planVerdict",tone:"accent"}};function cQ(a){return"string"==typeof a&&a.length?a:void 0}function cR({approve:a}){return(0,d.jsx)("span",{className:`rounded-full border px-2 py-0.5 text-[10.5px] font-extrabold ${a?"border-ok/25 bg-[#eefaf1] text-ok":"border-err/25 bg-[#fff0f0] text-err"}`,children:a?cc("render.approved"):cc("render.rejected")})}function cS({payload:a}){let b=cQ(a.from),c=cQ(a.requestId),e=ad(a.timestamp);return b||c||e?(0,d.jsxs)("div",{className:"mt-1.5 flex flex-wrap items-center gap-x-2.5 gap-y-1 text-[11px] text-dim",children:[b?(0,d.jsx)("span",{children:cc("render.from",{from:b})}):null,c?(0,d.jsx)("span",{className:"truncate font-mono",title:c,children:c.length>40?c.slice(0,40)+"…":c}):null,e?(0,d.jsx)("span",{children:e}):null]}):null}function cT({payload:a}){let b=cQ(a.type),c=b?cP[b]:void 0;if(!c)return(0,d.jsxs)("div",{className:"text-[13px]",children:[(0,d.jsx)("div",{className:"text-dim",children:cc("render.structured")}),(0,d.jsxs)("details",{className:"mt-1 text-[12px]",children:[(0,d.jsx)("summary",{className:"cursor-pointer list-none font-semibold text-accent",children:cc("render.showJson")}),(0,d.jsx)("pre",{className:"mt-1 max-h-[280px] overflow-auto whitespace-pre-wrap rounded-md bg-chip px-2.5 py-2 font-mono text-[11.5px]",children:JSON.stringify(a,null,2)})]})]});let e="boolean"==typeof a.approve?a.approve:void 0,f=cQ(a.reason)??cQ(a.feedback);return(0,d.jsxs)("div",{className:"text-[13px]",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsxs)("span",{className:`inline-flex items-center gap-1 rounded-full border px-2.5 py-0.5 text-[11.5px] font-bold ${"amber"===c.tone?"border-[#d89b21]/35 bg-[#fff9ea] text-[#9a6500]":"border-accent/25 bg-accent/10 text-accent"}`,children:[(0,d.jsx)(by,{name:c.icon,className:"h-3.5 w-3.5"}),cc(c.labelKey)]}),void 0!==e?(0,d.jsx)(cR,{approve:e}):null]}),f?(0,d.jsx)("div",{className:"mt-1.5 whitespace-pre-wrap break-words",children:cG(f)}):null,(0,d.jsx)(cS,{payload:a})]})}function cU({verdict:a}){return(0,d.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,d.jsx)("REQUEST_CHANGES"===a?a6:"APPROVE"===a?bb:bi,{className:"h-3.5 w-3.5","aria-hidden":!0}),"REQUEST_CHANGES"===a?"REQUEST_CHANGES":"APPROVE"===a?"APPROVE":"COMMENT"]})}function cV({item:a}){var b;let c=a.findings.length,e=a.findings.slice(0,12);return(0,d.jsxs)("div",{className:"my-3.5 ml-9 overflow-hidden rounded-[14px] border border-codex/20 bg-panel shadow-card",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2 border-b border-line px-3.5 py-2.5",children:[(0,d.jsx)("span",{className:"flex h-6.5 w-6.5 shrink-0 items-center justify-center rounded-lg bg-codex-soft text-codex",children:(0,d.jsx)(bc,{className:"h-4 w-4","aria-hidden":!0})}),(0,d.jsx)("span",{className:"text-[13.5px] font-bold",children:"Codex review"}),a.verdict?(0,d.jsx)("span",{className:`rounded-full border px-2.5 py-0.5 text-[11.5px] font-extrabold ${"REQUEST_CHANGES"===(b=a.verdict)?"bg-[#fff0f0] text-err border-err/25":"APPROVE"===b?"bg-[#eefaf1] text-ok border-ok/25":"bg-chip text-[#555] border-line"}`,children:(0,d.jsx)(cU,{verdict:a.verdict})}):null,(0,d.jsx)("span",{className:"text-[11px] text-dim",children:c?`${c} finding${1===c?"":"s"}`:cc("render.noFindings")}),ad(a.ts)?(0,d.jsx)("span",{className:"ml-auto text-[11px] text-dim",children:ad(a.ts)}):null]}),(0,d.jsxs)("div",{className:"px-3.5 py-2.5",children:[a.summary.length?(0,d.jsx)("div",{className:"mb-2 whitespace-pre-wrap break-words text-[13px] text-[#444]",children:cG(a.summary.join("\n"))}):null,e.length?(0,d.jsx)("div",{className:"space-y-2",children:e.map((a,b)=>{var c;return(0,d.jsxs)("div",{className:"rounded-[10px] border border-line bg-[#fbfbfd] px-3 py-2",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsx)("span",{className:`rounded-full border px-2 py-0.5 text-[10.5px] font-extrabold ${"Critical"===(c=a.severity)||"High"===c||"P0"===c||"P1"===c?"border-err/30 bg-[#fff4f4] text-err":"Medium"===c||"P2"===c?"border-[#d89b21]/35 bg-[#fff9ea] text-[#9a6500]":"Low"===c||"P3"===c?"border-line bg-chip text-[#555]":"border-line bg-panel text-dim"}`,children:a.severity}),a.file?(0,d.jsx)(cK,{file:a.file,line:a.line}):null]}),(0,d.jsx)("div",{className:"mt-1.5 whitespace-pre-wrap break-words text-[13px]",children:cC(a.title)}),a.body&&a.body!==a.title?(0,d.jsxs)("details",{className:"mt-1 text-[12px] text-dim",children:[(0,d.jsx)("summary",{className:"cursor-pointer list-none font-semibold text-accent",children:"details"}),(0,d.jsx)("div",{className:"mt-1 whitespace-pre-wrap break-words",children:cG(a.body)})]}):null]},b)})}):null,a.findings.length>e.length?(0,d.jsx)("div",{className:"mt-2 text-[12px] text-dim",children:cc("render.moreFindings",{count:a.findings.length-e.length})}):null,(0,d.jsxs)("details",{className:"mt-2 rounded-[10px] border border-line bg-[#fafafc] text-[12px]",children:[(0,d.jsx)("summary",{className:"cursor-pointer list-none px-3 py-1.5 font-semibold text-dim",children:"raw review text"}),(0,d.jsx)("pre",{className:"max-h-[320px] overflow-auto whitespace-pre-wrap border-t border-line px-3 py-2 font-mono text-[11.5px] text-[#555]",children:a.raw})]})]})]})}function cW({label:a,text:b}){let c=b.length>=2048?`${(b.length/1024).toFixed(1)} ${cc("common.kb")}`:cc("common.chars",{n:b.length});return(0,d.jsxs)("details",{className:"group my-1.5 ml-9",children:[(0,d.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-1.5 text-[11px] font-semibold text-dim hover:text-ink [&::-webkit-details-marker]:hidden",children:[(0,d.jsx)("span",{className:"flex h-4.5 w-4.5 items-center justify-center rounded-md bg-chip",children:(0,d.jsx)(by,{name:"cmd-group",className:"h-3 w-3"})}),(0,d.jsx)("span",{className:"rounded-full bg-chip px-1.5 py-0.5 font-mono text-[9.5px]",children:a}),(0,d.jsxs)("span",{children:[cc("render.system")," \xb7 ",c]}),(0,d.jsx)("span",{className:"text-accent group-open:hidden",children:cc("common.show")}),(0,d.jsx)("span",{className:"hidden text-dim group-open:inline",children:cc("common.collapse")})]}),(0,d.jsx)("pre",{className:"mt-1 max-h-[320px] overflow-auto whitespace-pre-wrap break-words rounded-[10px] border border-line bg-bg px-3 py-2 font-mono text-[11px] text-[#555]",children:b})]})}let cX=(0,e.memo)(function({item:a}){if("image"===a.kind)return(0,d.jsx)(cN,{media:a.media,data:a.data,w:a.w,h:a.h,bytes:a.bytes});if("inbox-image"===a.kind)return(0,d.jsx)(ct,{name:a.name,path:a.path});if("blob"===a.kind)return(0,d.jsx)(cH,{bytes:a.bytes,text:a.text});if("sysmsg"===a.kind)return(0,d.jsx)(cW,{label:a.label,text:a.text});if("compact"===a.kind)return(0,d.jsx)(cM,{item:a});if("review"===a.kind)return(0,d.jsx)(cV,{item:a});if("mem-citation"===a.kind)return(0,d.jsx)(cO,{item:a});if("prose"===a.kind){let b="codex"===a.engine?"bg-codex":"bg-claude",c="codex"===a.engine?bc:bl;return(0,d.jsxs)("div",{className:"group/msg my-3.5 flex gap-2.5",children:[(0,d.jsx)("div",{className:`mt-1 flex h-6.5 w-6.5 shrink-0 items-center justify-center rounded-full text-white ${b}`,children:(0,d.jsx)(c,{className:"h-3.5 w-3.5","aria-hidden":!0})}),(0,d.jsxs)("div",{className:"relative min-w-0 flex-1 whitespace-pre-wrap break-words",children:[ad(a.ts)?(0,d.jsx)("div",{className:"mb-0.5 text-[11px] text-dim",children:ad(a.ts)}):null,(0,d.jsx)(cq,{text:a.text,label:cc("feed.copyMd"),className:"absolute right-0 top-0 opacity-0 transition-opacity focus-visible:opacity-100 group-hover/msg:opacity-100 [@media(hover:none)]:opacity-60"}),cG(a.text)]})]})}if("user"===a.kind){let b=a.text.length>500;return(0,d.jsxs)("div",{className:"group/msg my-3.5 flex items-start justify-end gap-1.5",children:[(0,d.jsx)(cq,{text:a.text,label:cc("feed.copyMd"),className:"mt-2 opacity-0 transition-opacity focus-visible:opacity-100 group-hover/msg:opacity-100 [@media(hover:none)]:opacity-60"}),(0,d.jsx)("div",{className:"max-w-[75%] whitespace-pre-wrap break-words rounded-2xl bg-user px-4 py-2.5",children:b?(0,d.jsxs)("details",{className:"group/usr",children:[(0,d.jsxs)("summary",{className:"cursor-pointer list-none [&::-webkit-details-marker]:hidden",children:[(0,d.jsxs)("span",{className:"group-open/usr:hidden",children:[a.text.slice(0,180),"… ",(0,d.jsxs)("span",{className:"font-semibold text-accent",children:["(",cc("common.chars",{n:a.text.length}),")"]})]}),(0,d.jsxs)("span",{className:"hidden items-center gap-1 text-[11px] font-semibold text-dim group-open/usr:inline-flex",children:[cc("common.collapse")," ",(0,d.jsx)(ba,{className:"h-3 w-3","aria-hidden":!0})]})]}),cG(a.text)]}):cG(a.text)})]})}if("cmd"===a.kind){let b="ok"===a.call.status?"text-ok":"err"===a.call.status?"text-err":"text-dim";return(0,d.jsxs)("details",{className:"my-2.5 ml-9 overflow-hidden rounded-[14px] border border-line bg-panel shadow-card",open:a.call.open,children:[(0,d.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-2.5 px-3.5 py-2",children:[(0,d.jsx)("span",{className:"flex h-6.5 w-6.5 shrink-0 items-center justify-center rounded-lg bg-chip",children:(0,d.jsx)(by,{name:a.call.icon,className:"h-4 w-4"})}),(0,d.jsx)("code",{className:"max-w-[70%] overflow-hidden text-ellipsis whitespace-nowrap rounded-md bg-chip px-2 py-0.5 font-mono text-[12.5px]",children:a.call.display}),(0,d.jsxs)("span",{className:`ml-auto inline-flex shrink-0 items-center gap-1 text-xs font-semibold ${b}`,children:[(0,d.jsx)(cJ,{status:a.call.status}),a.call.label]})]}),(0,d.jsx)("pre",{className:"max-h-[340px] overflow-auto whitespace-pre-wrap border-t border-line bg-[#fafafc] px-3.5 py-2.5 font-mono text-[12.5px]",children:"$ "+a.call.cmd+(a.call.output?"\n"+a.call.output:"\n"+cc("render.noOutputInLog"))})]})}if("cmd-group"===a.kind)return(0,d.jsx)(cL,{item:a});if("edit"===a.kind)return(0,d.jsxs)("div",{className:"my-2.5 ml-9 flex items-center gap-3 rounded-[14px] border border-line bg-panel px-3.5 py-2.5 shadow-card",children:[(0,d.jsx)("span",{className:"flex h-7.5 w-7.5 items-center justify-center rounded-lg bg-chip",children:(0,d.jsx)(by,{name:"note",className:"h-4 w-4"})}),(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"text-[13.5px] font-semibold",children:a.files}),(0,d.jsx)("div",{className:"text-xs text-dim",children:cc("render.filesChanged")})]})]});if("tmsg"===a.kind){let b=function(a){let b=a.trim();if((b.startsWith('"')&&b.endsWith('"')||b.startsWith("'")&&b.endsWith("'"))&&(b=b.slice(1,-1).trim()),!b.startsWith("{"))return null;try{let a=JSON.parse(b);if(null!==a&&"object"==typeof a&&!Array.isArray(a))return a}catch{}return null}(a.text),c=a.text.length>420||a.text.split("\n").length>6;return(0,d.jsxs)("div",{className:"my-2.5 ml-9 overflow-hidden rounded-[14px] border border-accent/25 bg-[#f8f8fd] shadow-card",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 px-3.5 pt-2",children:[(0,d.jsx)("span",{className:"flex h-6.5 w-6.5 shrink-0 items-center justify-center rounded-lg bg-[#ecebfb] text-accent",children:(0,d.jsx)(bh,{className:"h-3.5 w-3.5","aria-hidden":!0})}),(0,d.jsx)("span",{className:"text-[11px] font-semibold text-dim",children:"out"===a.dir?cc("render.toDir"):cc("render.fromDir")}),(0,d.jsx)("span",{className:"rounded-full bg-accent/10 px-2 py-0.5 text-[11px] font-bold text-accent",children:a.peer}),a.delivery?(0,d.jsxs)("span",{className:`inline-flex shrink-0 items-center gap-1 text-[10.5px] font-semibold ${"ok"===a.delivery?"text-ok":"text-err"}`,title:a.msgId?`msg_id: ${a.msgId}`:void 0,children:["ok"===a.delivery?(0,d.jsx)(a8,{className:"h-3 w-3","aria-hidden":!0}):(0,d.jsx)(n,{className:"h-3 w-3","aria-hidden":!0}),"ok"===a.delivery?cc("render.delivered"):cc("render.notDelivered")]}):null,ad(a.ts)?(0,d.jsx)("span",{className:"ml-auto shrink-0 text-[11px] text-dim",children:ad(a.ts)}):null]}),(0,d.jsx)("div",{className:"px-3.5 pb-2.5 pt-1",children:b?(0,d.jsx)(cT,{payload:b}):(0,d.jsxs)(d.Fragment,{children:[a.summary?(0,d.jsx)("div",{className:"text-[13px] font-bold",children:cC(a.summary)}):null,c?(0,d.jsxs)("details",{className:"group/tmsg mt-0.5 whitespace-pre-wrap break-words text-[13px]",children:[(0,d.jsxs)("summary",{className:"cursor-pointer list-none text-[12.5px] text-[#555] [&::-webkit-details-marker]:hidden",children:[(0,d.jsxs)("span",{className:"group-open/tmsg:hidden",children:[a.text.slice(0,260).trimEnd(),"… ",(0,d.jsx)("span",{className:"font-semibold text-accent",children:cc("common.showAll")})]}),(0,d.jsxs)("span",{className:"hidden items-center gap-1 text-[11px] font-semibold text-dim group-open/tmsg:inline-flex",children:[cc("common.collapse")," ",(0,d.jsx)(ba,{className:"h-3 w-3","aria-hidden":!0})]})]}),cG(a.text)]}):(0,d.jsx)("div",{className:"mt-0.5 whitespace-pre-wrap break-words text-[13px]",children:cG(a.text)})]})})]})}if("tnote"===a.kind)return(0,d.jsxs)("div",{className:"my-1 ml-9 flex items-center gap-1.5 text-[11.5px] text-dim",children:[(0,d.jsx)(bh,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),a.text]});if("think"===a.kind){let b=a.text.length>150;return(0,d.jsxs)("details",{className:"my-1 ml-9 text-[11.5px] italic text-dim",children:[(0,d.jsxs)("summary",{className:`flex list-none items-center gap-1.5 truncate ${b?"cursor-pointer":""}`,title:cc("render.reasoning"),children:[(0,d.jsx)(a7,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),(0,d.jsxs)("span",{className:"truncate",children:[a.text.slice(0,150),b?"…":""]})]}),b?(0,d.jsx)("div",{className:"whitespace-pre-wrap break-words pt-1 not-italic",children:cG(a.text)}):null]})}return"svc"===a.kind?(0,d.jsx)("div",{className:"my-1 break-words text-[11.5px] text-dim",children:a.text}):"note"===a.kind?(0,d.jsx)("div",{className:"my-2 break-words text-[12.5px] text-dim",children:cC(a.text)}):(0,d.jsx)("div",{className:`my-0.5 break-words text-[12.5px] ${a.err?"text-err":"text-[#555]"}`,children:a.text})}),cY=k("pause",[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]]),cZ=k("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"}]]);function c$({file:a}){let{t:b}=v(),c=a.pendingQuestion,[f,g]=(0,e.useState)("pending"),[h,i]=(0,e.useState)(""),[j,k]=(0,e.useState)({}),[l,m]=(0,e.useState)(""),[o,p]=(0,e.useState)(""),[q,r]=(0,e.useState)(!1),s=c?null!==c.paneTarget:null!==a.pid&&"running"===a.proc,t=(0,e.useMemo)(()=>c?.questions?c.questions.map((a,b)=>(j[b]??[]).map(b=>a.options[b]?.label??String(b+1)).join(", ")).filter(Boolean).join(" \xb7 "):"",[j,c]);if(!c){if(!a.waitingInput)return null;let c=a.waitingInput.menu,e="delivering"===f,j=async(d,e)=>{g("delivering"),i("");try{let f=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"dialog-key",path:a.path,key:d,...c?{question:c.question}:{},.../^[1-9]$/.test(d)?{label:e}:{}})}),h=await f.json();if(!f.ok||!h.ok){g("failed"),i(h.error??b("common.failedSend"));return}g("answered"),i(e)}catch{g("failed"),i(b("common.serverUnavailable"))}};return"answered"===f?(0,d.jsx)("div",{id:"question",className:"my-4 rounded-[8px] border border-ok/25 bg-[#eefaf1] px-4 py-3 text-[13px] font-semibold text-ok",children:b("question.sentToPane",{text:h})}):(0,d.jsxs)("div",{id:"question",className:"my-4 rounded-[8px] border border-[#e0ae45]/45 bg-[#fff9ed] p-4 shadow-card",children:[(0,d.jsxs)("div",{className:"mb-2 inline-flex items-center gap-1.5 rounded-full bg-[#f5dfae] px-2 py-0.5 text-[11px] font-bold text-[#8a5a00]",children:[(0,d.jsx)(cY,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",b("question.waiting")]}),(0,d.jsxs)("div",{className:"text-[13px] font-semibold text-ink",children:[b("question.pane",{target:a.waitingInput.target})," \xb7 ",function(a,b){let c=Math.max(0,Math.floor(Date.now()/1e3-b));if(c<60)return a("question.sec",{n:c});let d=Math.floor(c/60);return d<60?a("question.min",{n:d}):a("question.hour",{n:Math.floor(d/60)})}(b,a.waitingInput.since)]}),c?(0,d.jsxs)(d.Fragment,{children:[c.tabs.length?(0,d.jsx)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:c.tabs.map((a,b)=>(0,d.jsxs)("span",{className:`rounded-full px-2 py-0.5 text-[11px] font-bold ${a.done?"bg-ok/15 text-ok":"bg-bg text-dim"}`,children:[a.done?"✓ ":"",a.label]},b))}):null,(0,d.jsx)("div",{className:"mt-2 text-[14px] font-bold text-ink",children:c.question}),(0,d.jsx)("div",{className:"mt-2 space-y-1.5",children:c.options.map(a=>(0,d.jsxs)("button",{className:`flex w-full items-start gap-2 rounded-[8px] border px-3 py-2 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/35 disabled:opacity-60 ${a.recommended?"border-[#e0ae45]/45 bg-[#fff5dc]":"border-line bg-bg"}`,disabled:e||a.value>9,onClick:()=>void j(String(a.value),a.label),children:[(0,d.jsx)("span",{className:"mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded border border-line bg-panel text-[10px] font-bold",children:a.value}),(0,d.jsxs)("span",{className:"min-w-0",children:[(0,d.jsx)("span",{className:"block text-[13px] font-bold",children:a.label}),a.description?(0,d.jsx)("span",{className:"block text-[12px] text-dim",children:a.description}):null]})]},a.value))})]}):(0,d.jsx)("pre",{className:"mt-2 max-h-[240px] overflow-auto whitespace-pre-wrap break-words rounded-[8px] border border-line bg-bg px-3 py-2 text-[12px] text-dim",children:a.waitingInput.screenTail}),(0,d.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[["Tab","Enter","Escape"].map(a=>(0,d.jsx)("button",{className:"rounded-[8px] border border-line bg-bg px-2.5 py-1 text-[12px] font-semibold text-dim disabled:opacity-60",disabled:e,onClick:()=>void j(a,"Escape"===a?"Esc":a),children:"Escape"===a?"Esc":a},a)),(0,d.jsx)("span",{className:"text-[12px] text-dim",children:b("question.keysHint")})]}),"delivering"===f?(0,d.jsxs)("div",{className:"mt-2 inline-flex items-center gap-1.5 text-[12px] font-semibold text-dim",children:[(0,d.jsx)(bw,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0})," ",b("common.sending")]}):null,"failed"===f?(0,d.jsx)("div",{className:"mt-2 text-[12px] font-semibold text-err",children:h}):null]})}let u=async(a,d)=>{g("delivering"),i("");try{let e=await fetch("/api/answer",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({transcriptPath:c.transcriptPath,toolUseId:c.toolUseId,kind:c.kind,...a})}),f=await e.json();if(!e.ok||!f.ok){if(409===e.status&&(f.superseded||f.answer)){g("superseded"),i(f.answer??f.error??b("question.alreadyAnswered"));return}g("failed"),i(f.error??b("common.failedSend"));return}g("answered"),i(f.answer??d)}catch{g("failed"),i(b("common.serverUnavailable"))}},w=(a=j)=>c.questions?.map((b,c)=>a[c]??[])??[],x=c.questions?.length??0,y=x>1||(c.questions?.some(a=>a.multiSelect)??!1),z=c.questions?.every((a,b)=>(j[b]??[]).length>0)??!1,A=async()=>{r(!0),i("");try{let c=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"resume",path:a.path})}),d=await c.json();if(!c.ok||!d.ok)return void i(d.error??b("question.openFailed"));i(b("question.opened",{target:d.target??"tmux"}))}catch{i(b("common.serverUnavailable"))}finally{r(!1)}},B="delivering"===f||!s;return"answered"===f?(0,d.jsx)("div",{id:"question",className:"my-4 rounded-[8px] border border-ok/25 bg-[#eefaf1] px-4 py-3 text-[13px] font-semibold text-ok",children:b("question.answered",{text:h||t})}):"superseded"===f?(0,d.jsx)("div",{id:"question",className:"my-4 rounded-[8px] border border-line bg-chip px-4 py-3 text-[13px] font-semibold text-dim",children:b("question.answeredElsewhere",{text:h})}):c&&!s?(0,d.jsxs)("div",{id:"question",className:"my-4 rounded-[8px] border border-[#e0ae45]/45 bg-[#fff9ed] p-4 shadow-card",children:[(0,d.jsxs)("div",{className:"mb-2 inline-flex items-center gap-1.5 rounded-full bg-[#f5dfae] px-2 py-0.5 text-[11px] font-bold text-[#8a5a00]",children:[(0,d.jsx)(cY,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",b("question.waiting")]}),(0,d.jsx)("div",{className:"text-[13px] font-semibold text-err",children:b("question.noPane")}),"plan"===c.kind?(0,d.jsx)("pre",{className:"mt-2 max-h-[320px] overflow-auto whitespace-pre-wrap break-words rounded-[8px] border border-line bg-bg px-3 py-2 text-[13px]",children:c.plan}):c.questions?.map((a,b)=>(0,d.jsxs)("div",{className:"mt-2",children:[(0,d.jsx)("div",{className:"text-[12px] font-bold text-dim",children:a.header}),(0,d.jsx)("div",{className:"text-[13px] font-semibold text-ink",children:a.question})]},b)),(0,d.jsx)("button",{className:"mt-3 rounded-[8px] bg-accent px-3 py-1.5 text-[13px] font-bold text-white disabled:opacity-60",disabled:q,onClick:A,children:b("question.openSession")}),h?(0,d.jsx)("div",{className:"mt-2 text-[12px] font-semibold text-dim",children:h}):null]}):(0,d.jsxs)("div",{id:"question",className:"my-4 rounded-[8px] border border-[#e0ae45]/45 bg-[#fff9ed] p-4 shadow-card",children:[(0,d.jsxs)("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[(0,d.jsxs)("span",{className:"inline-flex items-center gap-1.5 rounded-full bg-[#f5dfae] px-2 py-0.5 text-[11px] font-bold text-[#8a5a00]",children:[(0,d.jsx)(cY,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",b("question.waiting")]}),s?null:(0,d.jsx)("span",{className:"text-[12px] font-semibold text-err",children:b("question.noPane")})]}),"plan"===c.kind?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("pre",{className:"max-h-[420px] overflow-auto whitespace-pre-wrap break-words rounded-[8px] border border-line bg-bg px-3 py-2 text-[13px]",children:c.plan}),(0,d.jsx)("textarea",{className:"mt-3 min-h-20 w-full resize-y rounded-[8px] border border-line bg-bg px-3 py-2 text-[13px] outline-none focus-visible:ring-2 focus-visible:ring-accent/35",placeholder:b("question.rejectComment"),value:o,onChange:a=>p(a.target.value)}),(0,d.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2",children:[(0,d.jsxs)("button",{className:"inline-flex items-center gap-1.5 rounded-[8px] bg-ok px-3 py-1.5 text-[13px] font-bold text-white disabled:opacity-60",disabled:B,onClick:()=>u({approve:!0},b("question.approved")),children:[(0,d.jsx)(a8,{className:"h-4 w-4","aria-hidden":!0})," ",b("question.approve")]}),(0,d.jsxs)("button",{className:"inline-flex items-center gap-1.5 rounded-[8px] bg-err px-3 py-1.5 text-[13px] font-bold text-white disabled:opacity-60",disabled:B,onClick:()=>u({approve:!1,text:o},b("question.rejected")),children:[(0,d.jsx)(n,{className:"h-4 w-4","aria-hidden":!0})," ",b("question.reject")]})]})]}):(0,d.jsxs)(d.Fragment,{children:[c.questions?.map((a,b)=>(0,d.jsxs)("section",{className:"mt-3 first:mt-0",children:[(0,d.jsx)("div",{className:"mb-1 inline-flex rounded-full bg-bg px-2 py-0.5 text-[11px] font-bold text-dim",children:a.header}),(0,d.jsx)("div",{className:"mb-2 text-[14px] font-bold text-ink",children:a.question}),(0,d.jsx)("div",{className:"space-y-1.5",children:a.options.map((c,e)=>{let f=(j[b]??[]).includes(e);return(0,d.jsxs)("button",{className:`flex w-full items-start gap-2 rounded-[8px] border px-3 py-2 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/35 ${f?"border-accent/45 bg-accent/10":c.recommended?"border-[#e0ae45]/45 bg-[#fff5dc]":"border-line bg-bg"}`,disabled:B,onClick:()=>{var d;let f={...j,[b]:[e]};d=a.multiSelect,k(a=>{let c=a[b]??[],f=d?c.includes(e)?c.filter(a=>a!==e):[...c,e]:[e];return{...a,[b]:f}}),a.multiSelect||1!==x||u({answers:w(f)},c.label)},children:[(0,d.jsx)("span",{className:"mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded border border-line bg-panel text-[10px] font-bold",children:f?"✓":e+1}),(0,d.jsxs)("span",{className:"min-w-0",children:[(0,d.jsx)("span",{className:"block text-[13px] font-bold",children:c.label}),c.description?(0,d.jsx)("span",{className:"block text-[12px] text-dim",children:c.description}):null]})]},e)})})]},b)),x<=1?(0,d.jsxs)("div",{className:"mt-3 flex gap-2",children:[(0,d.jsx)("input",{className:"min-w-0 flex-1 rounded-[8px] border border-line bg-bg px-3 py-1.5 text-[13px] outline-none focus-visible:ring-2 focus-visible:ring-accent/35",placeholder:b("question.ownAnswer"),value:l,onChange:a=>m(a.target.value)}),(0,d.jsxs)("button",{className:"inline-flex items-center gap-1.5 rounded-[8px] bg-accent px-3 py-1.5 text-[13px] font-bold text-white disabled:opacity-60",disabled:B||!l.trim(),onClick:()=>u({text:l},l),children:[(0,d.jsx)(cZ,{className:"h-4 w-4","aria-hidden":!0})," ",b("common.send")]})]}):null,y?(0,d.jsxs)("button",{className:"mt-3 inline-flex items-center gap-1.5 rounded-[8px] bg-accent px-3 py-1.5 text-[13px] font-bold text-white disabled:opacity-60",disabled:B||!z,onClick:()=>u({answers:w()},t),children:[(0,d.jsx)(cZ,{className:"h-4 w-4","aria-hidden":!0})," ",b("common.send")]}):null]}),"delivering"===f?(0,d.jsxs)("div",{className:"mt-3 inline-flex items-center gap-1.5 text-[12px] font-semibold text-dim",children:[(0,d.jsx)(bw,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0})," ",b("common.sending")]}):null,"failed"===f?(0,d.jsx)("div",{className:"mt-3 text-[12px] font-semibold text-err",children:h}):null]})}function c_({file:a}){let{t:b}=v();return"running"===a.proc?(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 whitespace-nowrap rounded-full bg-[#e5f6ea] px-2 py-0.5 text-[11px] font-bold tabular-nums text-ok",children:[(0,d.jsx)(bk,{className:"h-3 w-3","aria-hidden":!0})," PID ",a.pid]}):"killed"===a.proc||"stalled"===a.activity?(0,d.jsx)("span",{className:"inline-flex items-center gap-1 rounded-full bg-[#f7e8e8] px-2 py-0.5 text-[11px] font-bold text-err",children:b("task.interruptedBadge")}):"done"===a.proc?(0,d.jsx)("span",{className:"inline-flex items-center gap-1 rounded-full bg-chip px-2 py-0.5 text-[11px] font-bold text-dim",children:b("task.finishedBadge")}):null}function c0({file:a,compact:b=!1,hideChip:c=!1}){let{t:f}=v(),[g,h]=(0,e.useState)(!1),[i,j]=(0,e.useState)(!1),[k,l]=(0,e.useState)(""),[m,n]=(0,e.useState)(!1),o=(0,d.jsx)(c_,{file:a}),p=async()=>{j(!0),l("");try{let b=await fetch("/api/proc",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:a.path,force:m})}),c=await b.json();if(!b.ok||!c.ok){l(c.error??f("task.stopFailed")),n(!0);return}l(f("task.signalSent",{signal:m?"SIGKILL":"SIGTERM",pid:c.pid??""})),h(!1)}catch{l(f("common.serverUnavailable")),n(!0)}finally{j(!1)}};return(0,d.jsxs)("span",{className:`inline-flex min-w-0 flex-wrap items-center gap-1.5 ${b?"text-[10.5px]":"text-xs"}`,children:[c?null:o,"running"===a.proc?g?(0,d.jsxs)("span",{className:"inline-flex max-w-full items-center gap-1 rounded-[10px] border border-err/30 bg-[#fff5f5] px-1.5 py-0.5",children:[b?null:(0,d.jsx)("span",{className:"truncate px-1 text-[11px] font-semibold text-err",children:f("task.confirmKill",{pid:a.pid??""})}),(0,d.jsx)("button",{className:"whitespace-nowrap rounded-lg bg-err px-2 py-0.5 text-[11px] font-bold tabular-nums text-white disabled:opacity-60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-err/50",disabled:i,onClick:p,children:m?"SIGKILL":b?f("task.killPid",{pid:a.pid??""}):f("task.confirmKillYes")}),(0,d.jsx)("button",{className:"whitespace-nowrap rounded-lg border border-line bg-panel px-2 py-0.5 text-[11px] font-semibold text-dim focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>h(!1),children:b?f("common.no"):f("common.cancel")})]}):(0,d.jsx)("button",{className:"whitespace-nowrap rounded-full border border-line bg-panel px-2 py-0.5 text-[11px] font-semibold text-dim hover:border-err/40 hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":f("task.stopAria",{pid:a.pid??""}),onClick:()=>h(!0),children:f("task.kill")}):null,k?(0,d.jsx)("span",{className:"max-w-[220px] truncate text-[11px] font-semibold text-dim",children:k}):null]})}function c1({file:a}){let{t:b}=v();return"claude-tasks"!==a.root?null:(0,d.jsxs)("div",{className:"mb-4 mt-1 rounded-[14px] border border-line bg-panel px-4 py-3 shadow-card",children:[(0,d.jsx)("div",{className:"mb-2 flex flex-wrap items-center gap-2",children:(0,d.jsx)(c_,{file:a})}),a.cmd?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"mb-1 text-[13.5px] font-semibold",children:a.cmdDesc||b("task.backgroundCommand")}),(0,d.jsxs)("code",{className:"block whitespace-pre-wrap break-words rounded-lg border border-line bg-[#fafafc] px-2.5 py-2 font-mono text-[12.5px]",children:["$ ",a.cmd]})]}):(0,d.jsx)("div",{className:"text-[13.5px] text-dim",children:b("task.commandNotFound")})]})}let c2={items:[],hiddenServiceCount:0},c3=new Map;function c4(a,b,c){c3.size>300&&!c3.has(a)&&c3.clear(),c3.set(a,{magnet:b,fromBottom:c})}function c5({icon:a,label:b}){return(0,d.jsxs)("div",{className:"mt-2 flex items-center gap-2 text-[12px] font-semibold text-ok",children:[(0,d.jsxs)("span",{className:"flex items-center gap-0.5","aria-hidden":!0,children:[(0,d.jsx)("span",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-ok"}),(0,d.jsx)("span",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-ok [animation-delay:150ms]"}),(0,d.jsx)("span",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-ok [animation-delay:300ms]"})]}),(0,d.jsx)(a,{className:"h-3.5 w-3.5","aria-hidden":!0}),b]})}function c6({file:a,showSvc:b,lineFilter:c,onStatus:f,paused:g,follow:h,setFollow:i,compact:j=!1}){let{locale:k,t:l}=v(),[m,n]=(0,e.useState)(()=>a?c3.get(a.path)?.magnet??h:h),o=function(a,b=!1,c=2500){(0,e.useRef)(c);let[d,f]=(0,e.useState)({lines:[],start:0}),[g,h]=(0,e.useState)(0),[i,j]=(0,e.useState)(!1),[k,l]=(0,e.useState)(null),[m,n]=(0,e.useState)(null),[o,p]=(0,e.useState)(!1),[q,r]=(0,e.useState)(!1),[s,t]=(0,e.useState)(!1),[u,v]=(0,e.useState)(0),w=(0,e.useRef)(0),x=(0,e.useRef)(0),y=(0,e.useRef)(""),z=(0,e.useRef)(!0),A=(0,e.useRef)(0),B=(0,e.useRef)(!1),C=(0,e.useCallback)(()=>{f({lines:[],start:0}),w.current=0,x.current=0,y.current="",z.current=!0,r(!1)},[]),D=(0,e.useCallback)(async()=>{if(!a||B.current||x.current<=0)return 0;B.current=!0,t(!0);let b=A.current;try{let c="",d=x.current;for(let e=0;e<4;e+=1){let e=await fetch(`/api/log?path=${encodeURIComponent(a.path)}&before=${d}`),f=await e.json();if(b!==A.current||"error"in f&&f.error)return 0;if(c=f.data+c,d=f.start,0===d||c.slice(0,-1).includes("\n"))break}let e=d;if(d>0){let a,b=c.indexOf("\n");if(b<0||b===c.length-1)return 0;e=d+(a=c.slice(0,b+1),new TextEncoder().encode(a).length),c=c.slice(b+1)}let g=c.split("\n");""===g.at(-1)&&g.pop();let h=g.map(a=>a.trim()).filter(Boolean);return x.current=e,r(e>0),h.length&&(f(a=>({lines:h.concat(a.lines),start:a.start-h.length})),v(a=>a+1)),h.length}catch{return 0}finally{B.current=!1,t(!1)}},[a?.path]);return{lines:d.lines,linesStart:d.start,size:g,loading:i,error:k,tickTime:m,paused:o,setPaused:p,clear:C,hasMore:q,loadingOlder:s,loadOlder:D,prependGen:u}}(a,g,m?j?2500:6e3:0),p=(0,e.useRef)(null),q=(0,e.useRef)(null),r=(0,e.useRef)(null),s=j?500:1500,[t,u]=(0,e.useState)(j?300:1500),[w,x]=(0,e.useState)(0),[y,z]=(0,e.useState)(!1),[A,C]=(0,e.useState)(null);(0,e.useRef)(!1);let D=(0,e.useRef)(m);(0,e.useRef)(0),(0,e.useRef)(0);let E=(0,e.useRef)(null),F=(0,e.useRef)(0);(0,e.useRef)(null);let G=(b,c=!1)=>{D.current=b,n(b),i(b),b&&x(0),a&&c4(a.path,b,c3.get(a.path)?.fromBottom??0),c&&(z(!0),E.current&&window.clearTimeout(E.current),E.current=window.setTimeout(()=>z(!1),450))},H=()=>{let a=p.current;a&&(F.current=Date.now(),a.scrollTop=a.scrollHeight)},I=c.toLowerCase(),J=(0,e.useMemo)(()=>a?function(a){let{showSvc:b,lineFilter:c}=a,d="claude"===a.fmt||"codex"===a.fmt,e=[],f=new Map,g=new Map,h=new Map,i=new Map,j=0,k=0,l=0,m=null,n=-1/0,o=null,p=null,q=null,r=null,s=null,t=new Map,u=null,v=null,w=a=>e.length?a-e[0].seq:-1,x=a=>(e.push({seq:k,src:l,item:a}),u=null,k++),y=a=>!!(!(a.length<=2e4)&&(a.match(/\s/g)?.length??0)/a.length<.02)&&(x({kind:"blob",bytes:a.length,text:b8(a).slice(0,2e5)}),!0),z=(a,b)=>{let c=cm(a.source),d=cl(c.data)||cl(b.base64);if(!d)return;let e=cl(c.media_type)||cl(b.type),f=e.startsWith("image/")?e:"image/png",g=cm(b.dimensions);x({kind:"image",media:f,data:d,w:ce(g.originalWidth),h:ce(g.originalHeight),bytes:ce(b.originalSize)})},A=(a,b,c,d=x)=>{cd.lastIndex=0;let e=cd.test(b);if(cd.lastIndex=0,!e){let c=cb(b.trim(),a);return!!c&&(d(c),!0)}let f=!1,g=0,h=b=>{let e=b.trim();if(!e)return;let g=cb(e,a);g?(d(g),f=!0):c(e)};for(let a of b.matchAll(cd)){let c=a[0],e=a.index??0;h(b.slice(g,e)),d(co(c,a[1]??"",a[2]??"")),f=!0,g=e+c.length}return h(b.slice(g)),f},B=a=>{let b=[];return cd.lastIndex=0,{cleaned:a.replace(cd,(a,c,d)=>(b.push(co(a,c,d)),"")).trim(),cites:b}},C=(b,c)=>{if(!c.trim()||c===o?.text||(o={text:c,src:l},y(c)))return;let d="codex"===a.engine?"codex":"claude";A(b,c,a=>x({kind:"prose",ts:b,text:a,engine:d}))||x({kind:"prose",ts:b,text:c,engine:d})},D=(a,b,c,d)=>{let e=c||"plain-"+k+"-"+String(a??""),g=function(a,b="shell"){let c=b8(a);return{cmd:c,display:function(a){let b,c=a.match(/^([A-Za-z][\w.]*): /),d=c?c[0]:"",e=d?a.slice(d.length):a;do b=e,e=(e=(e=(e=e.replace(/^export PATH=[^;]+;\s*/,"")).replace(/^cd\s+\S+\s*&&\s*/,"")).replace(/^\/usr\/bin\/zsh -lc\s+/,"")).replace(/^(["'])([\s\S]*)\1$/,(a,b,c)=>RegExp(`(?<!\\\\)${b}`).test(c)?a:c);while(e!==b);let f=e.match(/^([\w./-]+(?:\s+-)?)\s*<<\s*['"]?(\w+)['"]?/);return f&&(e=`${f[1].trim()} \xabheredoc\xbb`),(d+(e=e.replace(/\s+/g," ").trim())).slice(0,160)}(c),icon:b,output:"",status:"run",label:cc("render.executing"),open:!1}}(b,d),h=x({kind:"cmd",id:e,call:g,ts:a}),i={call:g,seq:h};return f.set(e,i),s=i,g},E=(a,b,c)=>{if(!a)return null;let d=b.match(/exited with code (\d+)/)?.[1],f=b.replace(/^Chunk ID:[^\n]*\n/,"").replace(/Wall time:[^\n]*\n/,"").replace(/Original token count:[^\n]*\n?/,"").trim(),g=!0===c||void 0!==d&&"0"!==d,h={...a.call};h.status=g?"err":"ok",h.label=g?d&&"0"!==d?"exit "+d:cc("render.error"):"ok",h.open||=g,f&&(h.output=(h.output+"\n"+b8(f)).trim().slice(-(g?6e4:12e3))),a.call=h;let i=w(a.seq);if(i>=0&&i<e.length){let a=e[i].item;"cmd"===a.kind&&(e[i]={...e[i],item:{...a,call:h}},u=null)}return h},F=(a,c,d)=>{if(!a)return;let h=g.get(a);if(void 0!==h){let a=w(h);if(a>=0&&a<e.length){let b=e[a].item;if("tmsg"===b.kind){let f=d||/"success"\s*:\s*false/.test(c)?"err":"ok",g=c.match(/"msg_id"\s*:\s*"([^"]+)"/)?.[1];e[a]={...e[a],item:{...b,delivery:f,msgId:g}},u=null}}return}!E(f.get(a),c,d)&&c&&b&&x({kind:"svc",text:"output: "+b8(c).slice(0,200)})},G=a=>{b?x({kind:"svc",text:a.slice(0,300)}):(j+=1,i.set(l,(i.get(l)??0)+1),u=null)},H=a=>{x({kind:"note",text:a})},I=(a,b)=>{let c=b.replace(cf,(b,c,d,e)=>{let f=ck(d,"teammate_id")||ck(d,"from")||cc("render.teammate"),g=ck(d,"summary"),h=e.trim();if(h.startsWith("{"))try{let a=JSON.parse(h);if("idle_notification"===a.type){let b=ad(a.timestamp);return x({kind:"tnote",text:cc("render.left",{peer:f,at:b?" \xb7 "+b:""})}),""}}catch{}let{cleaned:i,cites:j}=B(h),k=b2.test(i)?cb(i,a):null;for(let b of(x({kind:"tmsg",ts:a,dir:"in",peer:f,summary:g,text:k?"":i}),k&&x(k),j))x(b);return""}).replace(/Another Claude session sent a message:\s*/g,"").trim();if(!c||y(c))return;if(ci.test(c))return void x({kind:"sysmsg",label:cj(c),text:c});let{cleaned:d,images:e}=ch(c);for(let b of(d&&!A(a,d,b=>x({kind:"user",ts:a,text:b}))&&x({kind:"user",ts:a,text:d}),e))x({kind:"inbox-image",name:b.name,path:b.path})},J=(a,b)=>{if(p&&p.text===b&&p.at===k)return;let{cleaned:c,images:d}=ch(b);for(let b of(c&&x({kind:"user",ts:a,text:c}),d))x({kind:"inbox-image",name:b.name,path:b.path});p={text:b,at:k,src:l}},K=(a,b)=>{p&&p.text===a&&p.at===k||(x({kind:"sysmsg",label:cj(a,b),text:a}),p={text:a,at:k,src:l})},L=(a,b)=>{x({kind:"compact",ts:a,trigger:b?.trigger,preTokens:b?.preTokens})},M=a=>b=>{for(let c of b.split("\n"))c.trim()&&a({kind:"raw",text:b8(c),err:/error|failed|traceback|exception/i.test(c)})},N=a=>{let b=a.replace(/\x1b\][^\x07]*(\x07|\x1b\\)/g,"").replace(/\x1b\[[0-9;?]*[A-Za-z]/g,"");if(r)if(/^\[codex\]/.test(b))(()=>{if(!r)return;let a=r.lines.join("\n").trim();if(r=null,!a)return;let b=M(x);A(null,a,b)||b(a)})();else{r.lines.push(b),u=null;return}if(/Assistant message$/.test(b))return;let c=b.match(/^\[([^\]]+)\]\s*(.*)$/),d=c?.[1]??null,e=c?.[2]??b;if(!(!e||/^Assistant message captured/.test(e))){if(!c&&(b2.test(b)||b.startsWith("<oai-mem-citation>"))){r={lines:[b],src:l},u=null;return}if(/^Running command: /.test(e))return void D(d,e.replace(/^Running command: /,"").replace(/^\/usr\/bin\/zsh -lc /,""));if(/^Command (completed|failed)/.test(e)){s&&E(s,/^Command failed/.test(e)?e+"\n"+cc("render.jobLogNote"):e,/^Command failed/.test(e));return}return/^Applying \d+ file/.test(e)?void x({kind:"edit",files:e}):c&&!/^(Running|Command|Applying)/.test(e)?C(d,e):void(!y(b)&&x({kind:"raw",text:b8(b),err:/error|failed|traceback|exception/i.test(b)}))}},O=b=>{if(!c||b.toLowerCase().includes(c))if(d)try{let c=JSON.parse(b);c&&"object"==typeof c&&!Array.isArray(c)&&("claude"===a.fmt?(a=>{let b=a.timestamp;if("user"===a.type&&a.message){let c=cm(a.message).content,d=cm(cm(a.toolUseResult).file);if(!0===a.isCompactSummary){let a="string"==typeof c?c:cn(c).filter(a=>"text"===a.type).map(a=>cl(a.text)).join(" ");a.trim()&&((a,b)=>{for(let a=e.length-1;a>=0;a-=1){let c=e[a].item;if("compact"===c.kind){e[a]={...e[a],item:{...c,summary:b}},u=null;return}if("svc"!==c.kind&&"note"!==c.kind)break}x({kind:"compact",ts:a,summary:b})})(b,a.trim());return}if("string"==typeof c)I(b,c);else for(let a of cn(c))if("text"===a.type)I(b,cl(a.text));else if("image"===a.type)z(a,d);else if("tool_result"===a.type){let b=cn(a.content);for(let a of b)"image"===a.type&&z(a,d);let c="string"==typeof a.content?a.content:b.filter(a=>"image"!==a.type).map(a=>cl(a.text)).join(" ");F(cl(a.tool_use_id),c,!0===a.is_error)}return}if("assistant"===a.type&&a.message){for(let c of cn(cm(a.message).content))if("text"===c.type&&cl(c.text).trim())C(b,cl(c.text));else if("thinking"===c.type&&cl(c.thinking).trim())x({kind:"think",text:cl(c.thinking).replace(/\s+/g," ").trim()});else if("tool_use"===c.type&&"SendMessage"===cl(c.name)){let a=cm(c.input),d=a.message;if("string"==typeof d){let{cleaned:e,cites:f}=B(d),i=b2.test(e)?cb(e,b):null,j=x({kind:"tmsg",ts:b,dir:"out",peer:String(a.to??""),summary:String(a.summary??""),text:i?"":e});for(let a of(i&&x(i),f))x(a);let k=cl(c.id);k&&(g.set(k,j),h.set(j,k))}else G(`SendMessage → ${String(a.to??"")} \xb7 ${cl(cm(d).type)||cc("render.protocol")}`)}else if("tool_use"===c.type){let a=cm(c.input),d=String(a.command??a.file_path??a.prompt??JSON.stringify(a));D(b,cl(c.name)+": "+d.slice(0,160),cl(c.id),"tool")}return}if("system"===a.type&&"compact_boundary"===a.subtype){let c=cm(a.compactMetadata);return L(b,{trigger:cl(c.trigger)||void 0,preTokens:ce(c.preTokens)})}G(cl(a.type)||cc("render.record"))})(c):(a=>{let b=cm(a.payload),c=a.timestamp;if("session_meta"===a.type)return H(`${cc("render.codexSessionCreated")} \xb7 ${cl(b.model)} \xb7 ${cl(b.cwd)}`);if("event_msg"===a.type){if("agent_message"===b.type&&b.message)return C(c,cl(b.message));if("user_message"===b.type&&b.message){let a=cl(b.message);return ci.test(a)?K(a):J(c,a)}return"task_started"===b.type?H(cc("render.taskStarted")+(c?" \xb7 "+ad(c):"")):"task_complete"===b.type?H(cc("render.taskComplete")+(c?" \xb7 "+ad(c):"")):"context_compacted"===b.type?q?q=null:L(c):G(cl(b.type)||"event")}if("response_item"===a.type){if("message"===b.type){let a=cn(b.content).map(a=>cl(a.text)||cl(a.input_text)).join(" ").trim();return a?"assistant"===b.role?C(c,a):"user"!==b.role||ci.test(a)?K(a,cl(b.role)):J(c,a):G("message "+cl(b.role))}if("function_call"===b.type){let a={};try{a=JSON.parse(cl(b.arguments)||"{}")}catch{a={}}let d=cl(b.name);if("exec_command"===d||"shell"===d)return D(c,String(a.cmd??a.command??"").replace(/^\/usr\/bin\/zsh -lc /,""),cl(b.call_id));if("apply_patch"===d){let b=String(a.input??"").match(/(Add|Update|Delete) File: [^\n]+/g);x({kind:"edit",files:b?b.join(", ").replace(/(Add|Update|Delete) File: /g,""):cc("render.patch")});return}return"write_stdin"===d?G(cc("render.stdinSession",{id:String(a.session_id??"")})):D(c,d+" "+JSON.stringify(a).slice(0,120),cl(b.call_id),"tool")}if("function_call_output"===b.type)return F(cl(b.call_id),"string"==typeof b.output?b.output:JSON.stringify(b.output??""));if("custom_tool_call"===b.type&&"apply_patch"===cl(b.name)){let a=cl(b.input).match(/(Add|Update|Delete) File: [^\n]+/g);x({kind:"edit",files:a?a.join(", ").replace(/(Add|Update|Delete) File: /g,""):cc("render.patch")});return}return"custom_tool_call_output"===b.type?F(cl(b.call_id),"string"==typeof b.output?b.output:JSON.stringify(b.output??"")):"reasoning"===b.type?G("reasoning"):G(cl(b.type)||"item")}if("compacted"===a.type)return q={src:l},L(c);G(cl(a.type)||cc("render.record"))})(c))}catch{N(b)}else N(b)},P=()=>{e.length=0,f.clear(),g.clear(),h.clear(),i.clear(),j=0,o=null,p=null,q=null,r=null,s=null,t=new Map,u=null};return{feed:(a,b,c)=>{let d=b+a.length;(null===m||d<m||b>m||b<n)&&(P(),m=b),n=b,(a=>{for(;e.length&&e[0].src<a;){let a=e.shift();if(u=null,"cmd"===a.item.kind){let b=f.get(a.item.id);b&&b.seq===a.seq&&f.delete(a.item.id)}let b=h.get(a.seq);void 0!==b&&(h.delete(a.seq),g.get(b)===a.seq&&g.delete(b))}for(let[b,c]of i){if(b>=a)break;j-=c,i.delete(b),u=null}return o&&o.src<a&&(o=null),p&&p.src<a&&(p=null),q&&q.src<a&&(q=null),s&&0>w(s.seq)&&(s=null),null!==r&&r.src<a})(b)&&(P(),m=b);for(let c=m-b;c<a.length;c+=1)l=b+c,O(a[c]);return m=d,u&&v===c||(u=(a=>{let b=[],c=new Map,d=0;for(;d<e.length;){let g=e[d];if("cmd"!==g.item.kind){b.push({key:String(g.seq),item:g.item}),d+=1;continue}let h=d,i=[];for(;h<e.length;){let a=e[h];if("cmd"===a.item.kind)i.push({seq:a.seq,item:a.item});else if("think"!==a.item.kind)break;h+=1}let j=h===e.length;if(i.length>=4&&!(a&&j)){let a,e=i[0].seq,g=t.get(e);if(g&&g.calls.length===i.length&&i.every((a,b)=>g.calls[b]===a.item.call))a=g;else{let b={},c=0,d=0;for(let a of i){var f;let e=(f=a.item.call.cmd,f.match(/^([A-Za-z][\w.]*): /)?.[1]??"cmd");b[e]=(b[e]??0)+1,"ok"===a.item.call.status?c+=1:"err"===a.item.call.status&&(d+=1)}a={kind:"cmd-group",ids:i.map(a=>a.item.id),calls:i.map(a=>a.item.call),t0:i[0]?.item.ts,t1:i.at(-1)?.item.ts,byTool:b,okCount:c,errCount:d,hasErr:d>0}}c.set(e,a),b.push({key:"g"+e,item:a}),d=h}else b.push({key:String(g.seq),item:g.item}),d+=1}return t=c,(()=>{if(!r)return[];let a=r.lines.join("\n").trim();if(!a)return[];let b=[],c=a=>b.push(a),d=M(c);return A(null,a,d,c)||d(a),b})().forEach((a,c)=>b.push({key:"pb"+c,item:a})),{items:b,hiddenServiceCount:j}})(c),v=c),u}}}({engine:a.engine,fmt:a.fmt,showSvc:b,lineFilter:I}):null,[a?.path,a?.engine,a?.fmt,b,I,k]),K=(0,e.useMemo)(()=>a&&J?J.feed(o.lines,o.linesStart,"live"===a.activity):c2,[J,a?.activity,o.lines,o.linesStart]),L=Math.max(0,K.items.length-t),M=L?K.items.slice(-t):K.items,N=()=>{let a=p.current;a&&(r.current={top:a.scrollTop,height:a.scrollHeight}),L?u(a=>a+s):o.hasMore&&o.loadOlder().then(()=>u(a=>a+s))},O=L>0||o.hasMore,P=K.items.at(-1)?.item,Q=P?.kind==="cmd"&&"run"===P.call.status?{icon:bp,label:l("feed.running",{tool:P.call.cmd.split(/[\s:]/,1)[0]||l("feed.tool")})}:P?.kind==="think"?{icon:bl,label:l("feed.thinking")}:{icon:bl,label:l("feed.working")},R=j?"left-1/2 -translate-x-1/2":"right-3";return(0,d.jsxs)("div",{className:"relative flex min-h-0 flex-1 flex-col",children:[a&&K.items.length?m?"live"===a.activity?(0,d.jsxs)("div",{className:`pointer-events-none absolute bottom-2 ${R} z-10 inline-flex items-center gap-1 rounded-full bg-ok px-2 py-0.5 text-[10px] font-bold text-white shadow-card transition-transform duration-200 ${y?"scale-125":"scale-100"}`,children:[(0,d.jsx)(b1,{className:"h-3 w-3","aria-hidden":!0})," ",l("feed.liveTail")]}):null:(0,d.jsxs)("button",{className:`absolute bottom-2 ${R} z-10 inline-flex items-center gap-1 whitespace-nowrap rounded-full border border-line bg-panel px-2.5 py-1 text-[11px] font-semibold text-ink shadow-card hover:border-accent/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":l("feed.backToLive"),onClick:()=>{H(),G(!0,!0)},children:[(0,d.jsx)(a3,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",w?l("feed.newCount",{count:w}):l("feed.down")]}):null,(0,d.jsx)("div",{ref:p,className:j?"min-h-0 flex-1 overflow-y-auto py-3":"min-h-0 flex-1 overflow-y-auto py-6",onScroll:b=>{let c=b.currentTarget,d=c.scrollTop+c.clientHeight>=c.scrollHeight-50,e=Date.now()-F.current<300;d&&!D.current?G(!0,!0):!d&&D.current&&(e?H():G(!1)),a&&!e&&c4(a.path,D.current,Math.max(0,c.scrollHeight-c.clientHeight-c.scrollTop)),c.scrollTop<120&&O&&!o.loadingOlder&&!o.loading&&N()},children:(0,d.jsx)("div",{ref:q,className:j?"px-3 pb-4 text-[13px]":"mx-auto w-full max-w-[1060px] px-6 pb-16",children:a?(0,d.jsxs)(d.Fragment,{children:[j&&O?(0,d.jsx)("button",{className:"mb-2 flex w-full items-center justify-center gap-1.5 rounded-[8px] border border-dashed border-line bg-bg px-2 py-1 text-[11px] font-semibold text-dim hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",disabled:o.loadingOlder,onClick:N,children:o.loadingOlder?l("common.loading"):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(ba,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",l("feed.showEarlier")]})}):null,!j&&O&&K.items.length?(0,d.jsx)("button",{className:"mb-3 flex w-full items-center justify-center gap-1.5 rounded-[10px] border border-dashed border-line bg-panel px-3 py-1.5 text-[12px] font-semibold text-dim hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",disabled:o.loadingOlder,onClick:N,children:o.loadingOlder?l("common.loading"):L?l("feed.showEarlierHidden",{count:L}):l("feed.loadEarlier")}):null,j||O||!K.items.length?null:(0,d.jsx)("div",{className:"mb-3 text-center text-[11px] text-dim",children:l("feed.startOfConvo")}),j?null:(0,d.jsx)(c1,{file:a}),K.items.length?(0,d.jsxs)(d.Fragment,{children:[M.map(({key:a,item:b})=>j?(0,d.jsx)("div",{className:"feed-cv",children:(0,d.jsx)(cX,{item:b})},a):(0,d.jsx)(cX,{item:b},a)),a.pendingQuestion||a.waitingInput?(0,d.jsx)(c$,{file:a},a.pendingQuestion?.toolUseId??"waiting"):null,a.pendingQuestion||a.waitingInput||!A?null:(0,d.jsx)("div",{className:"my-4 rounded-[8px] border border-line bg-chip px-4 py-3 text-[13px] font-semibold text-dim",children:A}),"live"===a.activity?(0,d.jsx)(c5,{icon:Q.icon,label:Q.label}):null,"recent"===a.activity&&au(a)?(0,d.jsxs)("div",{className:"mt-2 flex items-center gap-1.5 text-[11.5px] font-semibold text-[#b8860b]",children:[(0,d.jsx)("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-[#d29a2f]","aria-hidden":!0})," ",l("feed.finishedTurn")]}):"recent"===a.activity&&B(a)&&"running"!==a.proc?(0,d.jsxs)("div",{className:"mt-2 flex items-center gap-1 text-[11.5px] font-semibold text-accent",children:[(0,d.jsx)(a0,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",l("feed.returnedResult")]}):null]}):(0,d.jsxs)("div",{className:"mt-[14vh] text-center text-dim",children:[o.loading?l("common.loadingCap"):0===o.size?l("feed.noOutput"):K.hiddenServiceCount?l("feed.onlyService",{count:K.hiddenServiceCount}):l("feed.empty"),!o.loading&&(a.cmdDesc||a.cmd)?(0,d.jsxs)("div",{className:"mx-auto mt-3 max-w-[560px]",children:[a.cmdDesc?(0,d.jsx)("div",{className:"text-[12.5px] font-semibold text-ink",children:a.cmdDesc}):null,a.cmd?(0,d.jsx)("pre",{className:"mt-1.5 overflow-x-auto whitespace-pre-wrap break-words rounded-[10px] border border-line bg-bg px-3 py-2 text-left font-mono text-[11.5px] text-ink",children:a.cmd}):null]}):null]}),K.items.length?null:a.pendingQuestion||a.waitingInput?(0,d.jsx)(c$,{file:a},a.pendingQuestion?.toolUseId??"waiting"):null]}):(0,d.jsx)("div",{className:"mt-[20vh] text-center text-dim",children:l("feed.pickLog")})})})]})}let c7=()=>"uk"===r()?"uk-UA":"en-US",c8={completed:"✓",in_progress:"▸",pending:"○"};function c9({plan:a}){let b,{t:c}=v(),e=a.total?Math.round(a.done/a.total*100):0;return(0,d.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-full bg-[#f1f0fc] px-1.5 py-0.5 font-mono text-[9.5px] font-semibold text-accent",title:(b=a.steps.map(a=>`${c8[a.status]} ${a.text}`),[u(r(),"plan.agentPlan"),...b].join("\n")),"aria-label":c("plan.stepsAria",{done:a.done,total:a.total})+(a.current?c("plan.nowSuffix",{current:a.current}):""),children:[a.done,"/",a.total,(0,d.jsx)("span",{className:"h-1 w-6 overflow-hidden rounded-full bg-accent/20","aria-hidden":!0,children:(0,d.jsx)("span",{className:"block h-full rounded-full bg-accent",style:{width:`${e}%`}})})]})}let da={active:{labelKey:"plan.goal",className:"bg-[#f1f0fc] text-accent"},complete:{labelKey:"plan.goalDone",className:"bg-[#e7f4ea] text-ok"},blocked:{labelKey:"plan.goalBlocked",className:"bg-[#fbeaea] text-err"}};function db(a){if(a>=1e6){let b=a/1e6;return`${Number.isInteger(b)||b>=10?Math.round(b):Math.round(10*b)/10}M`}return a>=1e3?`${Math.round(a/1e3)}K`:`${a}`}function dc({ctx:a}){var b;let{t:c}=v();return(0,d.jsxs)("span",{className:`inline-flex shrink-0 items-center gap-0.5 rounded-full px-1.5 py-0.5 font-mono text-[9.5px] font-semibold ${(b=a.pct)>=90?"bg-[#fbeaea] text-err":b>=70?"bg-[#fff7e6] text-[#b07d18]":"bg-chip text-dim"}`,title:c("plan.ctxTitle",{pct:a.pct,used:a.usedTokens.toLocaleString(c7()),window:a.windowTokens.toLocaleString(c7())}),"aria-label":c("plan.ctxAria",{pct:a.pct}),children:["ctx ",db(a.usedTokens),(0,d.jsx)("span",{className:"opacity-50",children:"/"}),db(a.windowTokens)]})}function dd({goal:a}){let b,c,{t:e}=v(),f=da[a.status];return(0,d.jsx)("span",{className:`inline-flex shrink-0 items-center rounded-full px-1.5 py-0.5 text-[9.5px] font-semibold ${f.className}`,title:(b=r(),c=[a.objective??u(b,"plan.noObjective")],null!==a.tokensUsed&&c.push(u(b,"plan.tokens",{n:a.tokensUsed.toLocaleString(c7())})),null!==a.timeUsedSeconds&&c.push(u(b,"plan.time",{n:Math.round(a.timeUsedSeconds/60)})),c.join("\n")),"aria-label":e("plan.goalAria",{status:e(f.labelKey)})+(a.objective?` — ${a.objective.slice(0,120)}`:""),children:e(f.labelKey)})}let de=()=>void 0,df={live:{section:"border-ok/60 shadow-[0_0_0_3px_rgba(47,158,68,0.16)]",header:"bg-[#eef8f0]"},waiting:{section:"border-[#e0ae45]/60 shadow-[0_0_0_3px_rgba(224,174,69,0.2)]",header:"bg-[#fff7e6]",glow:"#e0ae45"},returned:{section:"border-accent/50 shadow-[0_0_0_3px_rgba(90,81,224,0.15)]",header:"bg-[#f1f0fc]",glow:"#7a6ff0"},stalled:{section:"border-err/50 shadow-[0_0_0_3px_rgba(198,40,40,0.13)]",header:"bg-[#fdf0f0]",glow:"#d76a6a"},done:{section:"border-line",header:"bg-[#f4f4f6] text-dim opacity-80 saturate-50"}};function dg(a,b){return"session"===b?a("kind.session"):"subagent"===b?a("kind.subagent"):"job"===b?a("kind.job"):"background"===b?a("kind.background"):b}function dh({file:a}){let{t:b}=v(),[c,f]=(0,e.useState)(()=>Date.now()),g=c/1e3-a.mtime,h=("live"===a.activity||"recent"===a.activity)&&g>180;return(0,d.jsx)("span",{className:`shrink-0 font-mono text-[9.5px] tabular-nums ${h?"font-semibold text-[#b3831d]":"text-dim"}`,title:b(h?"branch.lastActivityQuiet":"branch.lastActivity",{age:ac(a.mtime)}),children:ac(a.mtime)})}function di({file:a,tasks:b,isRoot:c,onClose:f,dragHandle:g,noComposer:h,banner:i,onToggleExpand:j,expanded:k,dormant:l}){let{t:m}=v(),o=aT(),p=(0,e.useRef)(null),q=as(a),r=ay(a),s=df[r],[t,u]=(0,e.useState)(()=>"u">typeof IntersectionObserver),x=!!l||t;return(0,d.jsx)("div",{className:`relative flex min-h-0 min-w-0 flex-1 ${s.glow?"pane-attention":""}`,style:s.glow?{"--pane-glow":s.glow}:void 0,children:(0,d.jsxs)("section",{ref:p,"data-pan-ignore":!0,"data-link-path":a.path,className:`relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden rounded-[10px] border bg-panel shadow-card ${s.section}`,children:[(0,d.jsx)("span",{"aria-hidden":!0,className:`w-full shrink-0 ${c?"h-1":"h-0.5"}`,style:"done"===r?{backgroundColor:"#c9c9d1"}:aq(a)}),(0,d.jsxs)("header",{className:`flex shrink-0 flex-col gap-y-1 border-b border-line px-2.5 py-1.5 ${s.header} ${g?"cursor-grab active:cursor-grabbing":""}`,...g,children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5",children:[(0,d.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${ae(a.activity)}`,title:m(`branch.${r}`)}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12px] font-semibold",title:w(a.title),children:w(a.title,90)}),(0,d.jsx)(c0,{file:a,compact:!0,hideChip:o}),j?(0,d.jsx)("button",{className:"inline-flex shrink-0 items-center rounded-[8px] border border-line bg-bg px-1.5 py-0.5 text-dim hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":k?m("branch.collapseFull"):m("branch.expandFull",{title:w(a.title,60)}),title:k?m("branch.collapseFull"):m("branch.expandFull",{title:w(a.title,60)}),onClick:j,children:k?(0,d.jsx)(aZ,{className:"h-3 w-3","aria-hidden":!0}):(0,d.jsx)(a$,{className:"h-3 w-3","aria-hidden":!0})}):null,(0,d.jsx)(b$,{file:a,onDeleted:f}),f?(0,d.jsx)("button",{className:"inline-flex shrink-0 items-center rounded-[8px] border border-line bg-bg px-1.5 py-0.5 text-dim hover:border-err/40 hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":m("branch.removeColumn",{title:w(a.title,60)}),onClick:f,children:(0,d.jsx)(n,{className:"h-3 w-3","aria-hidden":!0})}):null]}),(0,d.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-1",children:[(0,d.jsx)(dh,{file:a}),a.model?(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 font-mono text-[9.5px] font-semibold",style:{backgroundColor:am(a).soft,color:am(a).color},title:[q.label,an(a)].filter(Boolean).join(" \xb7 "),children:a.model}):(0,d.jsx)("span",{className:"inline-flex shrink-0 items-center rounded-full px-2 py-0.5 text-[10px] font-bold",style:q.style,children:q.label}),(0,d.jsx)(b_,{file:a}),a.ctx&&(!o||a.ctx.pct>=70)?(0,d.jsx)(dc,{ctx:a.ctx}):null,a.worktree&&!o?(0,d.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-0.5 rounded-full border border-line/80 px-1.5 py-0.5 font-mono text-[9.5px] text-dim",title:m("branch.worktree",{name:a.worktree}),children:[(0,d.jsx)(a_,{className:"h-2.5 w-2.5","aria-hidden":!0})," ",a.worktree]}):null,a.plan?(0,d.jsx)(c9,{plan:a.plan}):null,a.goal?(0,d.jsx)(dd,{goal:a.goal}):null,c||o?null:(0,d.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-0.5 text-[10px] text-dim",title:m(a.handoff?"branch.handoffTitle":"branch.branchTitle"),children:[(0,d.jsx)(a0,{className:"h-3 w-3","aria-hidden":!0})," ",a.handoff?m("kind.handoff"):dg(m,a.kind)]})]})]}),i??null,b.length?(0,d.jsx)(b0,{className:"shrink-0 border-b border-line bg-[#fbfbfd]",enter:"fade",children:b.map(a=>(0,d.jsx)("div",{"data-flip-key":a.path,children:(0,d.jsx)(dj,{file:a,paused:x})},a.path))}):null,(0,d.jsx)(c6,{file:a,showSvc:!1,lineFilter:"",onStatus:de,paused:x,follow:!0,setFollow:de,compact:!0}),h?null:(0,d.jsx)(bT,{file:a,pollPaused:x})]})})}function dj({file:a,paused:b=!1}){let{t:c}=v(),[f,g]=(0,e.useState)(!1),h=w(a.cmdDesc||a.title,80);return(0,d.jsxs)("div",{className:"border-t border-line first:border-t-0",children:[(0,d.jsxs)("div",{className:"flex min-h-7 flex-wrap items-center gap-1.5 pl-2 pr-2.5",children:[(0,d.jsxs)("button",{className:"flex min-h-7 min-w-0 flex-1 items-center gap-1.5 rounded-[6px] text-left hover:bg-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-expanded":f,"aria-label":c("branch.toggleBackground",{action:c(f?"branch.collapse":"branch.expand"),title:h}),onClick:()=>g(a=>!a),children:[(0,d.jsx)(a9,{className:`h-3.5 w-3.5 shrink-0 text-dim transition-transform ${f?"rotate-90":""}`,"aria-hidden":!0}),(0,d.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${ae(a.activity)}`}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-semibold",title:w(a.title),children:h})]}),(0,d.jsx)(c0,{file:a,compact:!0})]}),f?(0,d.jsx)("div",{className:"flex h-[220px] flex-col border-t border-dashed border-line bg-bg/60",children:(0,d.jsx)(c6,{file:a,showSvc:!1,lineFilter:"",onStatus:de,paused:b,follow:!0,setFollow:de,compact:!0})}):null]})}let dk={claude:["low","medium","high","xhigh","max"],codex:["low","medium","high","xhigh"]};function dl({engine:a,effort:b,speed:c,disabled:e,onEffort:f,onSpeed:g}){let{t:h}=v(),i="h-7 min-w-0 rounded-[8px] border border-line bg-panel px-1.5 text-[11px] text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60";return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("select",{value:b,disabled:e,"aria-label":h("draft.reasoningAria"),title:h("draft.reasoningAria"),className:i,onChange:a=>f(a.target.value),children:[(0,d.jsx)("option",{value:"",children:h("draft.effortDefault")}),dk[a].map(a=>(0,d.jsx)("option",{value:a,children:a},a))]}),"codex"===a?(0,d.jsxs)("select",{value:c,disabled:e,"aria-label":h("draft.speedAria"),title:h("draft.speedTitle"),className:i,onChange:a=>g(a.target.value),children:[(0,d.jsx)("option",{value:"",children:h("draft.speedDefault")}),(0,d.jsx)("option",{value:"fast",children:"fast"}),(0,d.jsx)("option",{value:"standard",children:"standard"})]}):null]})}let dm=[{key:"claude",label:"Claude"},{key:"codex",label:"Codex"}],dn=(a,b)=>`llvDraftPane:${a}:${b}`;function dp(a,b,c){c?sessionStorage.setItem(dn(a,b),c):sessionStorage.removeItem(dn(a,b))}function dq({draftId:a,project:b,files:c,onClose:f,onSpawned:g}){let{t:h}=v(),[i]=(0,e.useState)(()=>""),j=i?c.find(a=>a.path===i)??null:null,[k,l]=(0,e.useState)(()=>j?.engine==="codex"?"codex":"claude"),[m,o]=(0,e.useState)(()=>""),[p,q]=(0,e.useState)(()=>""),[r,s]=(0,e.useState)(()=>""),[t,u]=(0,e.useState)([]),[x,y]=(0,e.useState)(()=>(function(){try{let a=JSON.parse("null");return a&&"number"==typeof a.at&&"string"==typeof a.prompt?a:null}catch{return null}})()),[z,A]=(0,e.useState)(!1),B=(0,e.useRef)(null),C=b=>{q(b),dp(a,"effort",b)},D=bM({initialText:()=>i?h("draft.readPrompt",{src:i}):"",persistText:b=>dp(a,"text",b),submit:a=>L(a),disabled:!!x}),{text:E,setText:F,setStatus:G,busy:H,setBusy:I,voiceSending:J,attachments:K}=D,L=async b=>{let d=b??E;if(!H&&!J&&!x){if(!m.trim())return void G({kind:"err",text:h("draft.needDir")});if(d.trim()||K.images.length){I(!0),G(null);try{var e;let b=await fetch("/api/spawn",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({engine:k,cwd:m.trim(),...p?{effort:p}:{},..."codex"===k&&r?{fast:"fast"===r}:{},prompt:d,images:K.images.map(a=>({base64:a.base64,mime:a.mime})),...i?{src:i}:{}})}),f=await b.json();if(!b.ok||!f.ok)return void G({kind:"err",text:f.error??h("draft.launchFailed")});B.current=new Set(c.map(a=>a.path)),e={at:Date.now(),target:f.target??"",path:f.path??null,prompt:d.trim()},y(e),dp(a,"boot",e?JSON.stringify(e):""),F(""),K.clear()}catch{G({kind:"err",text:h("common.serverUnavailable")})}finally{I(!1)}}}},M=af[k]??ag,N=D.fieldsDisabled,O="draft-dirs-"+a;return(0,d.jsxs)("section",{"data-pan-ignore":!0,className:"relative flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-hidden rounded-[10px] border border-line bg-panel shadow-card","aria-label":h("draft.paneAria"),children:[(0,d.jsx)("span",{"aria-hidden":!0,className:"h-1 w-full shrink-0",style:{backgroundColor:M.color}}),(0,d.jsxs)("header",{className:"flex h-10 shrink-0 items-center gap-1.5 border-b border-line px-2.5",style:{backgroundColor:M.soft},children:[(0,d.jsx)("span",{className:"h-2 w-2 shrink-0 rounded-full bg-[#c9c9d1]",title:h("draft.notStarted")}),(0,d.jsx)("div",{className:"flex shrink-0 items-center gap-1",role:"radiogroup","aria-label":h("draft.engineAria"),children:dm.map(({key:b,label:c})=>{let e=k===b,f=af[b]??ag;return(0,d.jsx)("button",{type:"button",role:"radio","aria-checked":e,disabled:N,onClick:()=>{l(b),dp(a,"engine",b),p&&!dk[b].includes(p)&&C("")},style:e?{backgroundColor:"#fff",color:f.color,borderColor:f.color}:void 0,className:`rounded-full border px-2 py-0.5 text-[10.5px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60 ${e?"":"border-transparent bg-transparent text-dim hover:text-ink"}`,children:c},b)})}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12px] font-semibold text-dim",title:j?w(j.title):void 0,children:i?h("draft.handoffLabel",{title:j?w(j.title,60):h("draft.conversation")}):h("draft.newConvo")}),(0,d.jsx)("button",{className:"inline-flex shrink-0 items-center rounded-[8px] border border-line bg-bg px-1.5 py-0.5 text-dim hover:border-err/40 hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":h("draft.dismiss"),onClick:f,children:(0,d.jsx)(n,{className:"h-3 w-3","aria-hidden":!0})})]}),(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5 border-b border-line bg-[#fbfbfd] px-2.5 py-1.5",children:[(0,d.jsx)("span",{className:"shrink-0 text-[10px] font-semibold text-dim",children:h("draft.directory")}),(0,d.jsx)("input",{value:m,disabled:N,onChange:b=>{var c;o(c=b.target.value),dp(a,"cwd",c)},list:O,placeholder:"/home/…/Projects/…","aria-label":h("draft.dirAria"),className:"min-w-0 flex-1 rounded-[6px] border border-line bg-panel px-2 py-1 font-mono text-[11px] text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60"}),(0,d.jsx)("datalist",{id:O,children:t.map(a=>(0,d.jsx)("option",{value:a},a))})]}),(0,d.jsxs)("div",{className:"flex shrink-0 flex-wrap items-center gap-1.5 border-b border-line bg-[#fbfbfd] px-2.5 py-1.5",children:[(0,d.jsx)("span",{className:"shrink-0 text-[10px] font-semibold text-dim",children:h("draft.reasoning")}),(0,d.jsx)(dl,{engine:k,effort:p,speed:r,disabled:N,onEffort:C,onSpeed:b=>{s(b),dp(a,"speed",b)}})]}),(0,d.jsx)("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto px-4 py-4",children:x?(0,d.jsxs)("div",{className:"flex flex-1 flex-col justify-end gap-3",children:[(0,d.jsx)("div",{className:"flex justify-end",children:(0,d.jsx)("span",{className:"min-w-0 max-w-[85%] whitespace-pre-wrap rounded-[10px] rounded-br-[3px] bg-[#ecebfb] px-2.5 py-1.5 text-[12px] text-[#333]",children:x.prompt||h("draft.imagesOnly")})}),(0,d.jsxs)("div",{className:"flex items-center gap-2 text-[11.5px] font-semibold text-dim",children:[(0,d.jsx)(bw,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}),(0,d.jsx)("span",{children:h("draft.launched",{target:x.target})})]}),z?(0,d.jsx)("div",{className:"text-[11px] text-dim",children:h("draft.slow",{target:x.target})}):null]}):(0,d.jsxs)("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 text-center",children:[(0,d.jsx)("span",{className:"rounded-full px-3 py-1 text-[13px] font-bold",style:{backgroundColor:M.soft,color:M.color},children:"claude"===k?"Claude":"Codex"}),(0,d.jsx)("div",{className:"max-w-[360px] text-[12px] text-dim",children:i?h("draft.hintRelay"):h("draft.hintNew")}),i?(0,d.jsx)("div",{className:"max-w-[420px] truncate font-mono text-[10px] text-dim",title:i,children:i}):null]})}),(0,d.jsx)("form",{onSubmit:a=>{a.preventDefault(),L()},className:"flex shrink-0 flex-col gap-1.5 border-t border-line bg-[#fbfbfd] px-2.5 py-2","aria-label":h("draft.promptAria"),children:(0,d.jsx)(bQ,{composer:D,placeholder:h("draft.placeholder"),textareaAriaLabel:h("draft.promptTextAria"),imageAriaLabel:h("draft.addImages"),sendLabelIdle:h("composer.launchAgent"),sendLabelRecording:h("draft.stopAndLaunch"),sendIdleClassName:"hover:opacity-90",sendIdleStyle:{backgroundColor:M.color,borderColor:M.color},leftSlot:(0,d.jsxs)("span",{className:"inline-flex min-w-0 items-center gap-1 rounded-full bg-chip px-1.5 py-1 font-mono text-[9.5px] font-semibold text-[#555]",title:h("draft.newWindowTitle"),children:[(0,d.jsx)(bk,{className:"h-3 w-3 shrink-0","aria-hidden":!0})," ",h("draft.newAgent")]})})})]})}let dr=(a,b)=>`llvWfDraft:${a}:${b}`;function ds(a,b,c){c?sessionStorage.setItem(dr(a,b),c):sessionStorage.removeItem(dr(a,b))}function dt({draftId:a,project:b,onClose:c,onLaunched:f}){let{t:g}=v(),[h,i]=(0,e.useState)([]),[j,k]=(0,e.useState)(()=>""),[l,m]=(0,e.useState)(()=>""),[o,p]=(0,e.useState)(()=>""),[q,r]=(0,e.useState)(()=>!1),[s,t]=(0,e.useState)([]),[u,w]=(0,e.useState)(!1),[x,y]=(0,e.useState)(null),z=h.find(a=>a.name===j)??null,A=async()=>{if(!u){if(!l.trim())return void y(g("wfDraft.needDir"));if(!o.trim())return void y(g("wfDraft.needTask"));w(!0),y(null);try{let a=await fetch("/api/workflows",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({template:j,task:o.trim(),repoDir:l.trim(),mode:q?"manual":"auto"})}),b=await a.json();if(!a.ok||!b.ok)return void y(b.error??g("wfDraft.launchFailed"));window.dispatchEvent(new Event(aL)),f()}catch{y(g("common.serverUnavailable"))}finally{w(!1)}}},B="wf-draft-dirs-"+a;return(0,d.jsxs)("section",{"data-pan-ignore":!0,className:"relative flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-hidden rounded-[10px] border border-line bg-panel shadow-card","aria-label":g("wfDraft.paneAria"),children:[(0,d.jsx)("span",{"aria-hidden":!0,className:"h-1 w-full shrink-0 bg-accent"}),(0,d.jsxs)("header",{className:"flex h-10 shrink-0 items-center gap-2 border-b border-line bg-[#ecebfb] px-2.5",children:[(0,d.jsx)("span",{className:"h-2 w-2 shrink-0 rounded-full bg-[#c9c9d1]",title:g("wfDraft.notStarted")}),(0,d.jsx)("span",{className:"shrink-0 text-[10.5px] font-bold tracking-[0.08em] text-accent",children:g("wfStrip.workflow")}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12px] font-semibold text-dim",children:g("wfDraft.newWorkflow")}),(0,d.jsx)("button",{className:"inline-flex shrink-0 items-center rounded-[8px] border border-line bg-bg px-1.5 py-0.5 text-dim hover:border-err/40 hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":g("wfDraft.dismiss"),onClick:c,children:(0,d.jsx)(n,{className:"h-3 w-3","aria-hidden":!0})})]}),(0,d.jsxs)("div",{className:"flex shrink-0 flex-col gap-1.5 border-b border-line bg-[#fbfbfd] px-2.5 py-2",children:[(0,d.jsxs)("label",{className:"flex items-center gap-1.5",children:[(0,d.jsx)("span",{className:"w-[72px] shrink-0 text-[10px] font-semibold text-dim",children:g("wfDraft.template")}),(0,d.jsx)("select",{value:j,disabled:u,onChange:b=>{var c;k(c=b.target.value),ds(a,"template",c)},"aria-label":g("wfDraft.templateAria"),className:"min-w-0 flex-1 rounded-[6px] border border-line bg-panel px-2 py-1 text-[11.5px] text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60",children:h.map(a=>(0,d.jsx)("option",{value:a.name,children:a.name},a.name))})]}),(0,d.jsxs)("label",{className:"flex items-center gap-1.5",children:[(0,d.jsx)("span",{className:"w-[72px] shrink-0 text-[10px] font-semibold text-dim",children:g("wfDraft.repo")}),(0,d.jsx)("input",{value:l,disabled:u,onChange:b=>{var c;m(c=b.target.value),ds(a,"dir",c)},list:B,placeholder:"/home/…/Projects/…","aria-label":g("wfDraft.repoAria"),className:"min-w-0 flex-1 rounded-[6px] border border-line bg-panel px-2 py-1 font-mono text-[11px] text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60"}),(0,d.jsx)("datalist",{id:B,children:s.map(a=>(0,d.jsx)("option",{value:a},a))})]}),(0,d.jsxs)("label",{className:"flex items-center gap-1.5 text-[10.5px] font-semibold text-dim",children:[(0,d.jsx)("input",{type:"checkbox",checked:q,disabled:u,onChange:b=>{var c;r(c=b.target.checked),ds(a,"mode",c?"manual":"")},className:"accent-[#5a51e0]"}),g("wfDraft.manualMode")]})]}),(0,d.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto px-4 py-3",children:[z?(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5","aria-label":g("wfStrip.stagesAria"),children:[z.stages.map((a,b)=>(0,d.jsxs)("span",{className:"flex items-center gap-1.5",children:[b>0?(0,d.jsx)("span",{className:"text-[10px] font-bold text-[#c9c9d1]","aria-hidden":!0,children:"→"}):null,(0,d.jsx)("span",{className:"inline-flex h-6 max-w-[200px] items-center truncate rounded-full bg-chip px-2 text-[10.5px] font-bold text-[#555]",children:"review-loop"===a.kind?`${g("wfStrip.reviewStage")} \xb7 ${a.reviewer.engine}${a.reviewer.effort?" "+a.reviewer.effort:""}`:`${a.scope.split(/[.:\n]/)[0]} \xb7 ${a.agent.engine}${a.agent.model?" "+a.agent.model:""}${a.agent.effort?" "+a.agent.effort:""}`})]},b)),(0,d.jsxs)("span",{className:"inline-flex h-6 items-center rounded-full bg-chip px-2 text-[10.5px] font-bold text-[#555]",children:["→ ","merge"===z.finish?g("wfDraft.finishMerge"):"PR"]})]}):(0,d.jsx)("div",{className:"text-[12px] text-dim",children:g("wfDraft.hint")}),(0,d.jsx)("textarea",{value:o,disabled:u,onChange:b=>{var c;p(c=b.target.value),ds(a,"task",c)},placeholder:g("wfDraft.taskPlaceholder"),"aria-label":g("wfDraft.taskAria"),className:"min-h-[160px] flex-1 resize-none rounded-[8px] border border-line bg-panel px-2.5 py-2 text-[12.5px] leading-snug text-ink placeholder:text-dim/70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60"})]}),(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-2 border-t border-line bg-[#fbfbfd] px-2.5 py-2",children:[x?(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11px] font-semibold text-err",title:x,children:x}):(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[10.5px] text-dim",children:g("wfDraft.footerHint")}),(0,d.jsxs)("button",{className:"inline-flex shrink-0 items-center gap-1.5 rounded-full border border-accent bg-accent px-3.5 py-1.5 text-[11.5px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",disabled:u,onClick:()=>void A(),children:[u?(0,d.jsx)(bw,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):null,u?g("wfDraft.launching"):g("wfDraft.launch")]})]})]})}let du=k("refresh-cw",[["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"}]]),dv=k("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);function dw({wf:a}){var b;let{t:c}=v(),[f,g]=(0,e.useState)(!1),[h,i]=(0,e.useState)(null),j=async b=>{if(f)return;g(!0),i(null);let c=await aP(a.id,{action:b});c&&i(c),g(!1)},k=aN.has(a.state),l="closed"===a.state||"approved"===a.state,m=("implementing"===a.state||"reviewing"===a.state)&&!!a.stageRuns[a.stageIndex]?.doneAt,o=b=>{let d=a.template.stages[b];return d?"review-loop"===d.kind?c("wfStrip.reviewStage"):d.scope.split(/[.:\n]/)[0]?.trim()||`S${b+1}`:`S${b+1}`};return(0,d.jsxs)("div",{"data-scheme-ui":!0,className:`pointer-events-auto flex min-h-11 w-full items-center gap-3 rounded-[14px] border bg-panel/95 px-4 py-1 shadow-[0_2px_10px_rgb(20_20_30/0.08)] ${k?"border-[#e0ae45]/70":"border-line"}`,children:[(0,d.jsxs)("span",{className:"flex min-w-0 max-w-[46%] shrink-0 items-center gap-2",children:[(0,d.jsx)("span",{className:`h-2.5 w-2.5 shrink-0 rounded-full ${"approved"===a.state?"bg-ok":"needs_decision"===a.state?"bg-err":"paused"===a.state?"bg-[#e0ae45]":aO.has(a.state)?"bg-ok animate-pulse":"bg-[#9a9aa4]"}`,"aria-hidden":!0}),(0,d.jsx)("span",{className:"shrink-0 text-[10.5px] font-bold tracking-[0.08em] text-dim",children:c("wfStrip.workflow")}),(0,d.jsx)("span",{className:"shrink-0 text-[12px] font-bold",children:a.name}),(0,d.jsx)("span",{className:"shrink-0 text-[11.5px] font-semibold text-dim",children:(b=a.state,c(`wfState.${b}`))}),a.stateDetail?(0,d.jsx)("span",{className:"min-w-0 truncate text-[11.5px] font-semibold text-err",title:a.stateDetail,children:a.stateDetail}):null]}),(0,d.jsx)("span",{className:"no-scrollbar flex min-w-0 flex-1 items-center justify-center gap-1.5 overflow-x-auto","aria-label":c("wfStrip.stagesAria"),children:a.template.stages.map((b,c)=>{let e,f=(e=a.stageRuns[c],e?.doneAt?{color:"#1a8a3e",soft:"#e7f4ea",pulse:!1}:c===a.stageIndex&&aO.has(a.state)&&"provisioning"!==a.state?{color:"#5a51e0",soft:"#ecebfb",pulse:!0}:{color:"#8b8b95",soft:"#efeff3",pulse:!1}),g=a.stageRuns[c];return(0,d.jsxs)("span",{className:"flex shrink-0 items-center gap-1.5",children:[c>0?(0,d.jsx)("span",{className:"text-[10px] font-bold text-[#c9c9d1]","aria-hidden":!0,children:"→"}):null,(0,d.jsxs)("span",{className:`inline-flex h-6 max-w-[180px] items-center gap-1 truncate rounded-full px-2 text-[10.5px] font-bold ${f.pulse?"animate-pulse":""}`,style:{backgroundColor:f.soft,color:f.color},title:g?.doneNote??o(c),children:[g?.doneAt?"✓ ":"",o(c)]})]},c)})}),(0,d.jsxs)("span",{className:"flex shrink-0 items-center gap-1.5",children:[h?(0,d.jsx)("span",{className:"max-w-[220px] truncate text-[10.5px] font-semibold text-err",title:h,children:h}):null,f?(0,d.jsx)(du,{className:"h-3.5 w-3.5 shrink-0 animate-spin text-dim","aria-hidden":!0}):null,a.prUrl?(0,d.jsxs)("a",{className:"inline-flex h-6 shrink-0 items-center gap-1 rounded-full border border-ok/40 bg-[#eef8f0] px-2.5 text-[10.5px] font-bold text-ok hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",href:a.prUrl,target:"_blank",rel:"noreferrer",children:[(0,d.jsx)(dv,{className:"h-3 w-3","aria-hidden":!0})," PR"]}):null,m?(0,d.jsx)("button",{className:"shrink-0 rounded-full border border-accent bg-accent px-3 py-1 text-[11px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",disabled:f,onClick:()=>void j("advance"),children:c("wfStrip.advance")}):null,"needs_decision"===a.state?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("button",{className:"shrink-0 rounded-full border border-accent bg-accent px-3 py-1 text-[11px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",disabled:f,onClick:()=>void j("retry-stage"),children:c("wfStrip.retryStage")}),(0,d.jsx)("button",{className:"shrink-0 rounded-full border border-line bg-bg px-2.5 py-1 text-[10.5px] font-bold text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:f,onClick:()=>void j("advance"),children:c("wfStrip.skipStage")})]}):null,l?null:"paused"===a.state?(0,d.jsx)(bB,{label:c("wfStrip.resume"),children:(0,d.jsx)("button",{className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-ok hover:bg-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:f,"aria-label":c("wfStrip.resume"),onClick:()=>void j("resume"),children:(0,d.jsx)(bk,{className:"h-3.5 w-3.5","aria-hidden":!0})})}):(0,d.jsx)(bB,{label:c("wfStrip.pause"),children:(0,d.jsx)("button",{className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-dim hover:bg-bg hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:f,"aria-label":c("wfStrip.pause"),onClick:()=>void j("pause"),children:(0,d.jsx)(cY,{className:"h-3.5 w-3.5","aria-hidden":!0})})}),(0,d.jsx)(bB,{label:c("wfStrip.close"),children:(0,d.jsx)("button",{className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-dim hover:bg-bg hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:f,"aria-label":c("wfStrip.close"),onClick:()=>void j("close"),children:(0,d.jsx)(n,{className:"h-3.5 w-3.5","aria-hidden":!0})})})]})]})}let dx={inbox:{color:"#e0ae45",soft:"#fdf3dd"},assigned:{color:"#5a51e0",soft:"#efeefc"},blocked:{color:"#d97757",soft:"#faeee9"},done:{color:"#1a8a3e",soft:"#e7f4ea"}},dy=["inbox","assigned","blocked","done"];function dz(a){return a.split(/\r?\n/,1)[0]?.trim()??""}function dA(a,b){return("done"===a.status)-("done"===b.status)||b.updatedAt.localeCompare(a.updatedAt)}function dB({tasks:a,project:b,onOpenTask:c,onClose:f}){let{t:g}=v(),[h,i]=(0,e.useState)("project"),j=(0,e.useMemo)(()=>("project"===h?a.filter(a=>a.project===b):[...a]).sort(dA),[a,b,h]);return(0,d.jsxs)("aside",{className:"flex w-[280px] shrink-0 flex-col border-l border-line bg-panel","aria-label":g("tasks.panelTitle"),children:[(0,d.jsxs)("div",{className:"flex h-9 shrink-0 items-center gap-1.5 border-b border-line px-2.5",children:[(0,d.jsx)("span",{className:"text-[12px] font-bold",children:g("tasks.panelTitle")}),(0,d.jsx)("div",{className:"ml-1 flex items-center rounded-full border border-line p-0.5",children:["project","all"].map(a=>(0,d.jsx)("button",{type:"button","aria-pressed":h===a,className:`rounded-full px-2 py-0.5 text-[10px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${h===a?"bg-accent/10 text-accent":"text-dim hover:text-ink"}`,onClick:()=>i(a),children:"project"===a?g("tasks.panelThisProject"):g("tasks.panelAll")},a))}),(0,d.jsx)("button",{type:"button",className:"ml-auto inline-flex shrink-0 items-center rounded-[8px] border border-line bg-bg px-1.5 py-0.5 text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":g("tasks.panelClose"),onClick:f,children:(0,d.jsx)(n,{className:"h-3 w-3","aria-hidden":!0})})]}),(0,d.jsx)("div",{className:"flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto p-1.5",children:j.length?j.map(a=>{let b=dx[a.status];return(0,d.jsxs)("button",{type:"button",className:`flex w-full min-w-0 flex-col gap-0.5 rounded-[8px] border border-line bg-panel px-2 py-1.5 text-left shadow-card hover:border-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${"done"===a.status?"opacity-60":""}`,title:a.text,onClick:()=>c(a),children:[(0,d.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 text-[9px] font-bold",style:{backgroundColor:b.soft,color:b.color},children:g(`tasks.status.${a.status}`)}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-semibold",children:dz(a.text)||g("tasks.untitled")})]}),(0,d.jsxs)("span",{className:"flex items-center gap-2 pl-0.5 text-[10px] text-dim",children:["all"===h?(0,d.jsx)("span",{className:"min-w-0 max-w-[110px] truncate",children:a.project}):null,a.source?(0,d.jsxs)("span",{className:"inline-flex items-center gap-0.5 text-[#0d6f5f]",title:`${g("tasks.sourceTitle")}: ${a.source.text}`,children:[(0,d.jsx)(bg,{className:"h-2.5 w-2.5","aria-hidden":!0}),g("tasks.source")]}):null,a.assignments.length?(0,d.jsxs)("span",{children:["⤷ ",a.assignments.length]}):null,(0,d.jsx)("span",{children:ac(new Date(a.updatedAt).getTime()/1e3)})]})]},a.id)}):(0,d.jsx)("div",{className:"px-2 py-3 text-center text-[11px] text-dim",children:g("tasks.panelEmpty")})})]})}let dC=0,dD=new Set;function dE(a,b){let c={id:++dC,kind:a,text:b};for(let a of dD)a(c)}function dF(a,b){let c=r(),d=a.results.length,e=u(c,"tasks.sendOk",{delivered:a.delivered,total:d});if(!a.failed)return{kind:"ok",text:e};let f=new Map(b.map(a=>[a.path,a])),g=a.results.filter(a=>!a.ok).map(a=>{let b=f.get(a.path);return u(c,"tasks.sendFailPart",{title:b?w(b.title,40):a.path.split("/").pop()??a.path,error:a.error??""})});return{kind:"err",text:`${e}; ${g.join("; ")}`}}function dG(){let[a,b]=(0,e.useState)([]);return a.length?(0,d.jsx)("div",{className:"pointer-events-none absolute inset-x-0 bottom-14 z-50 flex flex-col items-center gap-1.5 px-3",children:a.map(a=>(0,d.jsxs)("div",{className:`pointer-events-auto flex max-w-[560px] items-start gap-2 rounded-[10px] border px-3 py-2 text-[11.5px] font-semibold shadow-[0_10px_36px_rgb(20_20_30/0.18)] ${"ok"===a.kind?"border-ok/40 bg-[#eef8f0] text-[#1c6b30]":"border-err/40 bg-[#fdf0f0] text-[#8f2525]"}`,children:[(0,d.jsx)("span",{className:"min-w-0 break-words",children:a.text}),(0,d.jsx)("button",{type:"button",className:"mt-0.5 shrink-0 rounded p-0.5 opacity-60 hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":u(r(),"viewer.closeNotification"),onClick:()=>b(b=>b.filter(b=>b.id!==a.id)),children:(0,d.jsx)(n,{className:"h-3 w-3","aria-hidden":!0})})]},a.id))}):null}let dH=k("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);async function dI(a,b,c){try{let d=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({pid:a.pid??void 0,path:a.path,text:b,images:c})}),e=await d.json().catch(()=>null);if(!d.ok||!e?.ok)return e?.error??u(r(),"common.failedSend");return null}catch{return u(r(),"common.serverUnavailable")}}function dJ({files:a,project:b,checked:c,onChange:f,maxHeight:g=240}){let{t:h}=v(),i=(0,e.useMemo)(()=>a.filter(a=>E(a)===b&&(A(a)||C(a))).sort((a,b)=>b.mtime-a.mtime),[a,b]),j=(0,e.useMemo)(()=>I(a),[a]),k=(0,e.useMemo)(()=>new Set(i.map(a=>a.path)),[i]);return i.length?(0,d.jsx)("div",{className:"flex flex-col gap-0.5 overflow-y-auto",style:{maxHeight:g},children:i.map(a=>{let b=as(a),e=J(a,j).filter(a=>k.has(a.path)).length;return(0,d.jsxs)("div",{className:"flex items-center gap-1",children:[(0,d.jsxs)("label",{className:"flex h-7 min-w-0 flex-1 cursor-pointer items-center gap-1.5 rounded-[6px] px-1.5 hover:bg-bg",children:[(0,d.jsx)("input",{type:"checkbox",checked:c.has(a.path),onChange:()=>{var b;let d;return b=a.path,void((d=new Set(c)).has(b)?d.delete(b):d.add(b),f(d))},className:"accent-accent"}),(0,d.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${ae(a.activity)}`}),(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:b.style,children:b.label}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11px] font-semibold",title:w(a.title),children:w(a.title,46)})]}),e?(0,d.jsxs)("button",{type:"button",className:"inline-flex h-6 shrink-0 items-center gap-0.5 rounded-[6px] px-1 text-[10px] font-semibold text-dim hover:bg-bg hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:h("tasks.pickerAllChildren"),onClick:()=>(a=>{let b=new Set(c);for(let c of(b.add(a.path),J(a,j)))k.has(c.path)&&b.add(c.path);f(b)})(a),children:[(0,d.jsx)(a0,{className:"h-3 w-3","aria-hidden":!0})," ",e]}):null]},a.path)})}):(0,d.jsx)("div",{className:"px-1.5 py-2 text-[11px] text-dim",children:h("tasks.pickerEmpty")})}function dK({value:a,onPick:b}){let{t:c}=v();return(0,d.jsx)("div",{className:"flex flex-wrap items-center gap-1",children:dy.map(e=>{let f=dx[e],g=e===a;return(0,d.jsx)("button",{type:"button","aria-pressed":g,className:"rounded-full border px-2 py-0.5 text-[10.5px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",style:g?{backgroundColor:f.soft,color:f.color,borderColor:f.color}:{borderColor:"transparent",color:"#8b8b95"},onClick:()=>b(e),children:c(`tasks.status.${e}`)},e)})})}function dL({project:a,files:b,onCreated:c}){let{t:f}=v(),[g,h]=(0,e.useState)(()=>new Set),i=bM({initialText:()=>"",persistText:b=>{b?sessionStorage.setItem("llvTaskSheetDraft:"+a,b):sessionStorage.removeItem("llvTaskSheetDraft:"+a)},submit:a=>q(a)}),{text:j,setText:k,setStatus:l,busy:m,setBusy:n,voiceSending:o,attachments:p}=i,q=async d=>{let e=d??j;if(!m&&!o){if(!e.trim())return void l({kind:"err",text:f("tasks.composerNeedsText")});n(!0),l(null);try{let d=await aD({project:a,text:e,pos:{x:120,y:120}});if("error"in d)return void l({kind:"err",text:d.error});let f=[...g];if(f.length){let a=await aK(d.task.id,f);if("error"in a)dE("err",a.error);else{let c=dF(a,b);dE(c.kind,c.text);let d=p.images.map(a=>({base64:a.base64,mime:a.mime}));if(d.length){let c=new Map(b.map(a=>[a.path,a])),e=a.results.filter(a=>a.ok).map(a=>{var b;let d,e,f;return c.get(a.path)??(d=(b=a.path).includes("/.claude/projects/")?"claude-projects":/\/tmp\/claude-\d+\//.test(b)?"claude-tasks":"codex-sessions",e=b.endsWith(".jsonl")?"claude-projects"===d?"claude":"codex":"plain",f=d.startsWith("codex")?"codex":"claude-tasks"===d?"shell":"claude",{path:b,root:d,fmt:e,engine:f,kind:"",title:w(b.split("/").pop()||b,120),project:"",worktree:void 0,mtime:Date.now()/1e3,size:0,activity:"idle",proc:null,pid:null,model:null,pendingQuestion:null,waitingInput:null,parent:null,name:b})}),f=[];for(let a of e)f.push(await dI(a,"",d));if(f.some(a=>null!==a)){let a=function(a,b){let c=r(),d=b.filter(a=>null===a).length,e=u(c,"tasks.sendOk",{delivered:d,total:a.length});if(d===a.length)return{kind:"ok",text:e};let f=a.map((a,c)=>({file:a,error:b[c]})).filter(a=>a.error).map(a=>u(c,"tasks.sendFailPart",{title:w(a.file.title,40),error:a.error??""}));return{kind:"err",text:`${e}; ${f.join("; ")}`}}(e,f);dE(a.kind,a.text)}}}}k(""),p.clear(),c(d.task)}finally{n(!1)}}};return(0,d.jsxs)("form",{onSubmit:a=>{a.preventDefault(),q()},className:"flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto p-3",children:[(0,d.jsx)("div",{className:"flex flex-col gap-1.5",children:(0,d.jsx)(bQ,{composer:i,placeholder:f("tasks.newPlaceholder"),textareaAriaLabel:f("tasks.editAria"),imageAriaLabel:f("composer.addImages"),sendLabelIdle:f("tasks.sheetCreate"),sendLabelRecording:f("composer.stopAndSend"),sendIdleClassName:"border-accent bg-accent hover:opacity-90",leftSlot:(0,d.jsx)("span",{className:"inline-flex min-w-0 items-center gap-1 rounded-full bg-chip px-1.5 py-1 text-[9.5px] font-semibold text-[#555]",children:f("tasks.sheetTargets",{count:g.size})})})}),(0,d.jsxs)("div",{className:"flex flex-col gap-1 rounded-[10px] border border-line bg-panel p-1.5",children:[(0,d.jsx)("div",{className:"px-1 text-[10.5px] font-bold text-dim",children:f("tasks.pickerTitle")}),(0,d.jsx)(dJ,{files:b,project:a,checked:g,onChange:h,maxHeight:9999})]})]})}function dM({task:a,files:b,onDeleted:c}){let{t:f}=v(),[g,h]=(0,e.useState)(a.text),[i,j]=(0,e.useState)(()=>new Set),[k,l]=(0,e.useState)(!1),[m,n]=(0,e.useState)(!1),o=bL({onError:a=>dE("err",a),onUnclaimedText:a=>h(b=>b?b.trimEnd()+" "+a:a),onLiveCommit:a=>h(b=>b?b.trimEnd()+" "+a:a)}),p=async()=>{if(g===a.text)return null;if(!g.trim())return f("tasks.emptyTextBlocked");let b=await aG(a.id,{text:g});return b&&dE("err",b),b},q=async()=>{let c=[...i];if(c.length&&!k){if(!g.trim())return void dE("err",f("tasks.emptyTextBlocked"));l(!0);try{if(await p()!==null)return;let d=await aK(a.id,c);if("error"in d)dE("err",d.error);else{let a=dF(d,b);dE(a.kind,a.text),j(new Set)}}finally{l(!1)}}},r=new Map(b.map(a=>[a.path,a]));return(0,d.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto p-3",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-1.5 rounded-[10px] border border-line bg-panel p-2",children:[(0,d.jsx)("textarea",{value:o.liveText?(g?g.trimEnd()+" ":"")+o.liveText:g,readOnly:!!o.liveText,onChange:a=>h(a.target.value),onBlur:()=>void p(),rows:Math.min(14,Math.max(4,g.split("\n").length+1)),"aria-label":f("tasks.editAria"),maxLength:6e3,className:"w-full resize-none rounded-[8px] border border-line bg-panel px-2.5 py-1.5 text-[12.5px] leading-[18px] text-[#222] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40"}),(0,d.jsxs)("div",{className:"flex items-center justify-between gap-1.5",children:[(0,d.jsx)(dK,{value:a.status,onPick:b=>{b!==a.status&&aG(a.id,{status:b}).then(a=>{a&&dE("err",a)})}}),(0,d.jsx)(bO,{...o,onText:a=>h(b=>b?b.trimEnd()+" "+a:a)})]})]}),a.assignments.length?(0,d.jsxs)("div",{className:"flex flex-col gap-1 rounded-[10px] border border-line bg-panel p-2",children:[(0,d.jsx)("div",{className:"text-[10.5px] font-bold text-dim",children:f("tasks.sheetAssignments")}),a.assignments.map((c,e)=>{let h=c.path?r.get(c.path)??null:null,i="failed"===c.state,j=h?as(h):null,k=c.path?h?w(h.title,44):c.path.split("/").pop()??c.path:f("tasks.spawning");return(0,d.jsxs)("div",{className:`flex h-7 items-center gap-1.5 rounded-[6px] px-1.5 ${i?"bg-[#faeee9] text-[#a04a2e]":h?"bg-bg":"bg-bg opacity-60"}`,title:i?f("tasks.chipFailedTitle",{error:c.error??""}):void 0,children:[h?(0,d.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${ae(h.activity)}`}):null,j?(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:j.style,children:j.label}):null,(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11px] font-semibold",children:k}),i?(0,d.jsx)("span",{"aria-hidden":!0,children:"⚠"}):null,c.path&&(i||!h)?(0,d.jsx)("button",{type:"button",className:"shrink-0 rounded px-1 text-[10px] font-bold text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>{(async()=>{if(!g.trim())return dE("err",f("tasks.emptyTextBlocked"));if(await p()!==null)return;let d=await aK(a.id,[c.path]);if("error"in d)dE("err",d.error);else{let a=dF(d,b);dE(a.kind,a.text)}})()},children:f("tasks.retry")}):null]},(c.path??"spawning")+e)})]}):null,(0,d.jsxs)("div",{className:"flex flex-col gap-1 rounded-[10px] border border-line bg-panel p-1.5",children:[(0,d.jsx)("div",{className:"px-1 text-[10.5px] font-bold text-dim",children:f("tasks.pickerTitle")}),(0,d.jsx)(dJ,{files:b,project:a.project,checked:i,onChange:j,maxHeight:9999}),(0,d.jsxs)("button",{type:"button",disabled:!i.size||k,className:"mt-1 inline-flex h-8 items-center justify-center gap-1.5 rounded-[8px] border border-accent bg-accent text-[11.5px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",onClick:()=>void q(),children:[k?(0,d.jsx)(bw,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):(0,d.jsx)(cZ,{className:"h-3.5 w-3.5","aria-hidden":!0}),f("tasks.pickerSend",{count:i.size})]})]}),(0,d.jsxs)("button",{type:"button",className:`inline-flex h-8 items-center justify-center gap-1.5 rounded-[8px] border text-[11.5px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${m?"border-err bg-err text-white":"border-line bg-panel text-dim hover:border-err/40 hover:text-err"}`,onClick:()=>{m?aH(a.id).then(a=>{a?dE("err",a):c()}):n(!0)},children:[(0,d.jsx)(bo,{className:"h-3.5 w-3.5","aria-hidden":!0}),m?f("tasks.deleteConfirm"):f("tasks.delete")]})]})}function dN({project:a,tasks:b,files:c,initialView:f,onClose:g}){let{t:h}=v(),[i,j]=(0,e.useState)(f),k=(0,e.useMemo)(()=>[...b].sort((a,b)=>("done"===a.status)-("done"===b.status)||b.updatedAt.localeCompare(a.updatedAt)),[b]),l="object"==typeof i?b.find(a=>a.id===i.taskId)??null:null;return(0,d.jsxs)("div",{className:"fixed inset-0 z-[60] flex flex-col bg-bg pb-[env(safe-area-inset-bottom)]",children:[(0,d.jsxs)("div",{className:"flex h-10 shrink-0 items-center gap-2 border-b border-line bg-panel px-3",children:["list"!==i?(0,d.jsx)("button",{type:"button",className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-[8px] border border-line bg-bg text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":h("tasks.sheetBack"),onClick:()=>j("list"),children:(0,d.jsx)(dH,{className:"h-4 w-4","aria-hidden":!0})}):null,(0,d.jsx)("span",{className:"shrink-0 text-[13px] font-bold",children:"new"===i?h("tasks.sheetNew"):l?dz(l.text)||h("tasks.untitled"):h("tasks.panelTitle")}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] text-dim",children:a}),(0,d.jsx)("button",{type:"button",className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-[8px] border border-line bg-bg text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":h("common.close"),onClick:g,children:(0,d.jsx)(n,{className:"h-4 w-4","aria-hidden":!0})})]}),"list"===i?(0,d.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-1 overflow-y-auto p-2",children:[(0,d.jsxs)("button",{type:"button",className:"flex h-9 shrink-0 items-center justify-center gap-1 rounded-[10px] border border-dashed border-accent/50 text-[12px] font-bold text-accent hover:bg-accent/5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>j("new"),children:["+ ",h("tasks.sheetNew")]}),k.map(a=>{let b=dx[a.status];return(0,d.jsxs)("button",{type:"button",className:`flex w-full min-w-0 flex-col gap-0.5 rounded-[10px] border border-line bg-panel px-2.5 py-2 text-left shadow-card focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${"done"===a.status?"opacity-60":""}`,onClick:()=>j({taskId:a.id}),children:[(0,d.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 text-[9px] font-bold",style:{backgroundColor:b.soft,color:b.color},children:h(`tasks.status.${a.status}`)}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12.5px] font-semibold",children:dz(a.text)||h("tasks.untitled")})]}),(0,d.jsxs)("span",{className:"flex items-center gap-2 pl-0.5 text-[10.5px] text-dim",children:[a.assignments.length?(0,d.jsxs)("span",{children:["⤷ ",a.assignments.length]}):null,(0,d.jsx)("span",{children:ac(new Date(a.updatedAt).getTime()/1e3)})]})]},a.id)}),k.length?null:(0,d.jsx)("div",{className:"px-2 py-4 text-center text-[11.5px] text-dim",children:h("tasks.sheetEmpty")})]}):"new"===i?(0,d.jsx)(dL,{project:a,files:c,onCreated:a=>j({taskId:a.id})}):l?(0,d.jsx)(dM,{task:l,files:c,onDeleted:()=>j("list")},l.id):(0,d.jsx)("div",{className:"flex flex-1 items-center justify-center text-[12px] text-dim",children:h("tasks.sheetGone")})]})}let dO=k("diamond",[["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0Z",key:"1f1r0c"}]]),dP=k("hourglass",[["path",{d:"M5 22h14",key:"ehvnwv"}],["path",{d:"M5 2h14",key:"pdyrp9"}],["path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22",key:"1d314k"}],["path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2",key:"1vvvr6"}]]);function dQ({verdict:a,error:b,className:c="h-3 w-3"}){return"APPROVE"===a?(0,d.jsx)(a8,{className:c,strokeWidth:3,"aria-hidden":!0}):"REQUEST_CHANGES"===a?(0,d.jsx)(n,{className:c,strokeWidth:3,"aria-hidden":!0}):"COMMENT"===a?(0,d.jsx)(dO,{className:c,strokeWidth:2.5,"aria-hidden":!0}):b?(0,d.jsx)(l,{className:c,"aria-hidden":!0}):(0,d.jsx)(dP,{className:c,"aria-hidden":!0})}function dR(a,b){return b.error?a("roundDeck.roundAborted",{n:b.n}):b.verdict?a("roundDeck.roundVerdict",{n:b.n,verdict:`${_[b.verdict]} ${b.verdict}`}):a("roundDeck.roundInProgress",{n:b.n})}function dS({round:a,depth:b,pulse:c,onPull:e}){let{t:f}=v(),g=aa(a.verdict);return(0,d.jsxs)("button",{className:`deck-tab absolute inset-x-0 flex items-center gap-1.5 rounded-[9px] border bg-panel px-2.5 text-left shadow-card focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${c?"deck-tab-live border-ok/50":"border-line hover:border-accent/45"}`,style:{height:36,bottom:-(30*b)-10,zIndex:10-b,transform:`scale(${1-.035*b}) translateZ(${-(34*b)}px)`},title:a.error?`${dR(f,a)}: ${a.error}`:dR(f,a),onClick:e,children:[(0,d.jsxs)("span",{className:"inline-flex h-4 shrink-0 items-center gap-1 rounded-full px-1.5 text-[9.5px] font-bold",style:{backgroundColor:g.soft,color:g.color},children:["R",a.n," ",(0,d.jsx)(dQ,{verdict:a.verdict,error:!!a.error,className:"h-2.5 w-2.5"})]}),(0,d.jsxs)("span",{className:"min-w-0 flex-1 truncate text-[10.5px] font-semibold text-dim",children:[a.error?f("roundDeck.aborted"):a.verdict?a.verdict:f("roundDeck.reviewInProgress"),null!=a.findingsCount&&a.findingsCount>0?` \xb7 ${f("roundDeck.findings",{count:a.findingsCount})}`:""]}),c?(0,d.jsx)("span",{className:"h-1.5 w-1.5 shrink-0 animate-pulse rounded-full bg-ok","aria-hidden":!0}):null]})}function dT({flow:a,rounds:b,focusRound:c,dormant:f=!1}){let{t:g}=v(),h=b.length?b[b.length-1]:null,[i,j]=(0,e.useState)(null),[k,l]=(0,e.useState)(null);null!=c&&c!==k&&(l(c),j(Math.round(c)));let[m,n]=(0,e.useState)(null);h&&h.round.n!==m&&(n(h.round.n),null!=i&&h.round.n>i&&null===h.round.verdict&&j(null));let o=(0,e.useMemo)(()=>b.find(a=>a.round.n===i)??h,[b,i,h]);if(!o)return(0,d.jsx)("div",{className:"flex h-full items-center justify-center rounded-[10px] border border-dashed border-[#c9c9d1] bg-panel/60",children:(0,d.jsx)("span",{className:"text-[12px] font-semibold text-dim",children:g("roundDeck.waitingFirst")})});let p=b.filter(a=>a.round.n!==o.round.n).reverse(),q=p.slice(0,5),r=p.length-q.length,s=aa(o.round.verdict),t=null!==o.round.verdict||!!o.round.error,u=h&&o.round.n!==h.round.n&&null===h.round.verdict&&!h.round.error?h:null;return(0,d.jsxs)("div",{className:"deck-3d relative h-full",style:{paddingBottom:30*Math.min(p.length,5+ +!!r)},children:[(0,d.jsx)("div",{className:"scheme-enter relative z-[11] flex h-full flex-col",children:o.file?(0,d.jsx)(di,{file:o.file,tasks:[],isRoot:!1,dormant:f,noComposer:"headless"===a.reviewerMode||t,banner:(0,d.jsxs)("div",{className:"flex h-6 shrink-0 items-center gap-1.5 border-b border-line px-2.5 text-[10.5px] font-bold",style:{backgroundColor:s.soft,color:s.color},children:[dR(g,o.round),null!=o.round.findingsCount&&o.round.findingsCount>0?(0,d.jsxs)("span",{className:"font-semibold opacity-80",children:["\xb7 ",g("roundDeck.findings",{count:o.round.findingsCount})]}):null,o.round.readyNote?(0,d.jsxs)("span",{className:"min-w-0 flex-1 truncate font-semibold opacity-70",title:o.round.readyNote,children:["\xb7 ",o.round.readyNote]}):null]})}):(0,d.jsxs)("div",{className:"flex h-full flex-col items-center justify-center gap-1 rounded-[10px] border border-line bg-panel shadow-card",children:[(0,d.jsx)("span",{className:"text-[12px] font-semibold text-dim",children:dR(g,o.round)}),(0,d.jsx)("span",{className:"text-[11px] text-dim",children:o.round.error?o.round.error:g("roundDeck.spawningReviewer")})]})},o.round.n),q.map((a,b)=>(0,d.jsx)(dS,{round:a.round,depth:b,pulse:u?.round.n===a.round.n,onPull:()=>j(a.round.n)},a.round.n)),r>0?(0,d.jsx)("div",{className:"pointer-events-none absolute inset-x-6 flex items-center justify-center rounded-[9px] border border-line bg-panel/70 text-[10px] font-semibold text-dim shadow-card",style:{height:26,bottom:-(30*q.length)-8,zIndex:10-q.length},"aria-hidden":!0,children:g("roundDeck.moreRounds",{count:r})}):null]})}let dU=k("arrow-right-left",[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]);function dV(a){return("claude-projects"===a.root||"codex-sessions"===a.root)&&a.path.endsWith(".jsonl")}function dW({file:a,onHandoff:b}){let{t:c}=v(),e=function(a){let{t:b}=v();return bY({exclude:a.path,onDragStart:void 0,onDrop:c=>(bS(c.file.path,b("link.handoffContext",{title:w(a.title,80),path:a.path,ask:""}).trimEnd()+"\n\n"),b("link.dropped",{title:w(c.file.title,48)}))})}(a);return(0,d.jsxs)("div",{"data-scheme-ui":!0,className:"group absolute -bottom-11 left-2 z-[2]",children:[(0,d.jsxs)("button",{type:"button","aria-label":c("handoff.aria"),title:c("handoff.title"),onPointerDown:e.onPillPointerDown,onClick:()=>{e.consumeClick()||b()},className:"flex h-7 touch-none items-center gap-1.5 rounded-full border border-line bg-panel px-2 text-dim shadow-card transition-[border-color,color] duration-150 hover:border-accent/50 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[(0,d.jsx)(dU,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),(0,d.jsx)("span",{className:"max-w-[0px] overflow-hidden whitespace-nowrap text-[11px] font-semibold transition-[max-width] duration-200 group-hover:max-w-[180px] group-focus-within:max-w-[180px]",children:c("handoff.label")}),(0,d.jsx)(a3,{className:"hidden h-3.5 w-3.5 shrink-0 group-hover:block group-focus-within:block","aria-hidden":!0})]}),e.overlay]})}function dX(a,b,c,d=[],e=[]){let f=new Map(c.map(a=>[a.path,a])),g=I(c),h=[],i=[],j=[],k=[],l=[],m=U(d),n=V(d),o=100,p=[],q=new Map;for(let a of e){let b="";if(!b)continue;let c=q.get(b);c?c.push(a):q.set(b,[a])}let r=new Set,s=a=>({file:a,branches:g.get(a.path)?.length??0}),t=(a,b,c,d,e)=>{let g=(a,o,t,u)=>{let v=0===u?780:680;h.push({file:a.file,tasks:a.tasks,under:d.get(a.file.path)??[],x:o,y:t,w:600,h:v,isRoot:a.file.path===e});let w=m.get(a.file.path),x=v;if(w){var y;let a,b,c=(y=o+600+170,a=w.rounds.map(a=>({round:a,file:a.reviewerPath?f.get(a.reviewerPath)??null:null})),b={key:"deck::"+w.id,flow:w,rounds:a,x:y,y:t,w:600,h:v+30*Math.min(Math.max(w.rounds.length-1,0),6)},k.push(b),b);l.push({key:"loop::"+w.id,flow:w,x1:o+600,x2:c.x,y:t}),x=Math.max(x,c.h)}let z=t+x+130,A=b.get(a.file.path)??[],B=o+64;for(let a of A)i.push({to:a.file.path,x1:o+40,y1:t+v,x2:B+300,y2:z,color:ap(a.file),live:"live"===a.file.activity}),B+=g(a,B,z,u+1)+48;let C=c.get(a.file.path)?.filter(a=>!n.has(a.path));for(let b of(C?.length&&(j.push({key:a.file.path+"::stack",parent:a.file.path,items:C.map(s),x:B,y:z,w:360,h:16+58*Math.min(C.length,8)-6}),i.push({to:a.file.path+"::stack",x1:o+40,y1:t+v,x2:B+180,y2:z,color:"#9a9aa4",live:!1,dashed:!0}),B+=408),q.get(a.file.path)??[]))r.add(b),p.push({key:"draft::"+b,id:b,src:a.file.path,x:B,y:z,w:600,h:680}),i.push({to:"draft::"+b,x1:o+40,y1:t+v,x2:B+300,y2:z,color:"#5a51e0",live:!1,dashed:!0}),B+=648;let D=B-48-(o+64);return Math.max(D>0?Math.max(600,64+D):600,w?1370:600)};return g(a,o,100,0)};for(let b of a){let a=b.columns;if(!a.length)continue;let c=a[0].file.path,d=new Set(a.map(a=>a.file.path)),e=a=>{let b=a.parent,e=new Set([a.path]);for(;b&&!e.has(b)&&!d.has(b);)e.add(b),b=f.get(b)?.parent??null;return b&&d.has(b)&&b!==a.path?b:c},g=new Map;for(let b of a){if(b.file.path===c)continue;let a=e(b.file),d=g.get(a);d?d.push(b):g.set(a,[b])}let h=new Map,i=[];for(let a of[...b.returnable,...b.finished])if(!n.has(a.path))if(C(a)){let b=e(a),c=h.get(b);c?c.push(a):h.set(b,[a])}else i.push(a);let j=new Map([[c,i]]);o+=t(a[0],g,h,j,b.key)+150}for(let a of b){let b=(function(a,b){if(!a)return[];let c=I(b),d=[],e=new Set([a.path]),f=(a,b)=>{for(let g of(c.get(a.path)??[]).filter(a=>!e.has(a.path)).sort((a,b)=>z(a)-z(b)||b.mtime-a.mtime))e.add(g.path),d.push({file:g,depth:b}),f(g,b+1)};return f(a,1),d})(a,c).map(a=>a.file).filter(a=>!n.has(a.path)),d=b.filter(a=>C(a)),e=b.filter(a=>!C(a));o+=t({file:a,tasks:[]},new Map,new Map(d.length?[[a.path,d]]:[]),new Map([[a.path,e]]),a.parent?"":a.path)+150}for(let a of e)r.has(a)||(p.push({key:"draft::"+a,id:a,x:o,y:100,w:600,h:780}),o+=750);let u=0;for(let a of h)u=Math.max(u,a.y+a.h);for(let a of j)u=Math.max(u,a.y+a.h);for(let a of k)u=Math.max(u,a.y+a.h);for(let a of p)u=Math.max(u,a.y+a.h);return{nodes:h,edges:i,stacks:j,decks:k,loops:l,drafts:p,byPath:new Map([...h.map(a=>[a.file.path,a]),...p.map(a=>[a.key,a]),...j.map(a=>[a.key,a]),...k.map(a=>[a.key,a])]),width:Math.max(o-150+100,800),height:u+100+140}}let dY=k("hand",[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1fvzgz"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"1kc0my"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",key:"10h0bg"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]]),dZ=k("mouse-pointer-2",[["path",{d:"M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z",key:"edeuup"}]]),d$=k("square-dashed",[["path",{d:"M5 3a2 2 0 0 0-2 2",key:"y57alp"}],["path",{d:"M19 3a2 2 0 0 1 2 2",key:"18rm91"}],["path",{d:"M21 19a2 2 0 0 1-2 2",key:"1j7049"}],["path",{d:"M5 21a2 2 0 0 1-2-2",key:"sbafld"}],["path",{d:"M9 3h1",key:"1yesri"}],["path",{d:"M9 21h1",key:"15o7lz"}],["path",{d:"M14 3h1",key:"1ec4yj"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"M3 9v1",key:"1r0deq"}],["path",{d:"M21 9v1",key:"mxsmne"}],["path",{d:"M3 14v1",key:"vnatye"}],["path",{d:"M21 14v1",key:"169vum"}]]),d_=k("sticky-note",[["path",{d:"M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z",key:"1dfntj"}],["path",{d:"M15 3v5a1 1 0 0 0 1 1h5",key:"6s6qgf"}]]),d0=k("octagon-minus",[["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}],["path",{d:"M8 12h8",key:"1wcyev"}]]),d1=k("repeat-2",[["path",{d:"m2 9 3-3 3 3",key:"1ltn5i"}],["path",{d:"M13 18H7a2 2 0 0 1-2-2V6",key:"1r6tfw"}],["path",{d:"m22 15-3 3-3-3",key:"4rnwn2"}],["path",{d:"M11 6h6a2 2 0 0 1 2 2v10",key:"2f72bc"}]]),d2=k("focus",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}]]),d3=k("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]),d4=k("rotate-ccw",[["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"}]]);async function d5(a,b,c){let d=[];for(let e of a){try{let a=await b(e);d.push(a.ok?{path:e,ok:!0}:{path:e,ok:!1,error:a.error})}catch(a){d.push({path:e,ok:!1,error:a instanceof Error?a.message:String(a)})}c?.(d,a[d.length]??null)}return d}function d6(a){return null!==a.file.pid}function d7(a){return a.isRoot}function d8(a){let b=0;for(let c of a.text.split(/\r?\n/))b+=Math.max(1,Math.ceil(c.length/34));return Math.max(64,6+(Math.min(17*b,340)+20)+((a.assignments.length+ +!!a.source)*26+(a.assignments.length||a.source?6:0)))}function d9(a){return{x:a.pos.x,y:a.pos.y,w:260,h:d8(a)}}function ea(a){return{x:a.x+a.w/2,y:a.y+a.h/2}}function eb(a,b){let{x:c,y:d}=ea(a),e=b.x-c,f=b.y-d;if(!e&&!f)return{x:c,y:d};let g=Math.min(e?a.w/2/Math.abs(e):1/0,f?a.h/2/Math.abs(f):1/0,1);return{x:c+e*g,y:d+f*g}}let ec={implementer:{engine:"claude",model:null,effort:null},reviewer:{engine:"codex",model:null,effort:"xhigh"}};async function ed(a,b){let c=await fetch(a,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(b)});if(c.ok)return{ok:!0};let d=await c.json().catch(()=>null);return{ok:!1,error:d?.error??`HTTP ${c.status}`}}function ee({icon:a,label:b,disabled:c,confirming:e,confirmLabel:f,onClick:g}){return(0,d.jsxs)("button",{className:`inline-flex h-7 items-center gap-1 whitespace-nowrap rounded-full border px-2.5 text-[11px] font-semibold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40 ${e?"border-err bg-err text-white":"border-line bg-bg text-dim hover:border-accent/45 hover:text-accent"}`,disabled:c,onClick:g,children:[a,e?f:b]})}let ef=(0,e.memo)(function({project:a,nodes:b,flowsByImpl:c,onRemove:f,onFit:g,onExit:h}){let{t:i}=v(),[j,k]=(0,e.useState)(null),[l,m]=(0,e.useState)(!0),[o,p]=(0,e.useState)(null),[q,r]=(0,e.useState)(null),[s,t]=(0,e.useState)(!1),u=(0,e.useRef)(null),x=(0,e.useRef)(b);(0,e.useLayoutEffect)(()=>{x.current=b},[b]),(0,e.useEffect)(()=>{if(!q)return;let a=window.setTimeout(()=>r(null),4e3);return()=>window.clearTimeout(a)},[q]);let y=async(a,c,d)=>{var e,f;if(j||!c.length)return[];k(a),r(null);let g=new Map(o?.titles??[]);for(let a of b)g.set(a.file.path,w(a.file.title,60));let h=(e=()=>new Set(x.current.map(a=>a.file.path)),f=i("bulk.nodeGone"),a=>e().has(a)?d(a):Promise.resolve({ok:!1,error:f}));u.current={action:a,runner:h},p({action:a,items:[],current:c[0]??null,titles:g});try{return await d5(c,h,(b,c)=>p({action:a,items:[...b],current:c,titles:g}))}finally{k(null)}},z=bM({initialText:()=>"",persistText:()=>{},submit:async c=>{let d=(c??z.textRef.current).trim(),e=z.attachments.images.map(a=>({base64:a.base64,mime:a.mime}));if((d||e.length)&&!j){z.setBusy(!0);try{let c=new Map(b.map(a=>[a.file.path,a]));if(l){if(!d)return void z.setStatus({kind:"err",text:i("tasks.composerNeedsText")});let b=await aD({project:a,text:d,pos:(()=>{let a=x.current;if(!a.length)return{x:120,y:120};let b=0,c=0;for(let d of a)b+=d.x+d.w/2,c+=d.y+d.h/2;return{x:Math.round(b/a.length-130),y:Math.round(c/a.length-60)}})()});if("error"in b)return void z.setStatus({kind:"err",text:b.error});let f=b.task.id,g=await y("message",[...c.keys()],async a=>{let b=await aK(f,[a]);if("error"in b)return{ok:!1,error:b.error};let d=b.results[0];if(!d?.ok)return{ok:!1,error:d?.error??i("common.failedSend")};if(e.length){let b=c.get(a);return ed("/api/tmux",{pid:b?.file.pid??void 0,path:a,text:"",images:e})}return{ok:!0}});(!c.size||g.length&&g.every(a=>a.ok))&&(z.setText(""),z.attachments.clear());return}let f=await y("message",[...c.keys()],a=>{let b=c.get(a);return ed("/api/tmux",{pid:b?.file.pid??void 0,path:a,text:d,images:e})});f.length&&f.every(a=>a.ok)&&(z.setText(""),z.attachments.clear())}finally{z.setBusy(!1)}}},disabled:null!==j}),A=b.filter(d6),B=b.filter(d7),C=b.filter(a=>W(a.file,c)),D=o?.items.filter(a=>!a.ok).length??0;return(0,d.jsxs)("div",{"data-scheme-ui":!0,className:"absolute bottom-3 left-1/2 z-40 flex w-[640px] max-w-[94%] -translate-x-1/2 flex-col gap-1.5 rounded-[12px] border border-line bg-panel/95 p-2.5 shadow-[0_10px_36px_rgb(20_20_30/0.18)]",children:[s?(0,d.jsx)(eg,{count:C.length,disabled:null!==j,onStart:a=>{t(!1),y("flow",C.map(a=>a.file.path),b=>ed("/api/flows",{implementerPath:b,...a}))},onClose:()=>t(!1)}):null,(0,d.jsx)("form",{onSubmit:a=>{a.preventDefault(),z.submit()},className:"flex flex-col gap-1.5",children:(0,d.jsx)(bQ,{composer:z,placeholder:i("bulk.placeholder"),textareaAriaLabel:i("bulk.textAria"),imageAriaLabel:i("composer.addImages"),sendLabelIdle:i("bulk.sendAll",{count:b.length}),sendLabelRecording:i("composer.stopAndSend"),sendTitleRecording:i("composer.stopAndSendTitle"),sendIdleClassName:"border-accent bg-accent hover:opacity-90",leftSlot:(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5",children:[(0,d.jsx)("span",{className:"inline-flex min-w-0 items-center gap-1 rounded-full bg-chip px-2 py-1 text-[10px] font-bold text-[#555]",children:i("bulk.selectedCount",{count:b.length})}),(0,d.jsxs)("button",{type:"button",role:"switch","aria-checked":l,title:i("tasks.composerToggleTitle"),onClick:()=>m(a=>!a),className:`inline-flex h-6 shrink-0 items-center gap-1 rounded-full border px-2 text-[10px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${l?"border-accent bg-accent/10 text-accent":"border-line bg-panel text-dim hover:text-ink"}`,children:[(0,d.jsx)("span",{className:`h-1.5 w-1.5 rounded-full ${l?"bg-accent":"bg-[#c9c9d1]"}`,"aria-hidden":!0}),i("tasks.composerToggle")]})]})})}),(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,d.jsx)(ee,{icon:(0,d.jsx)(d0,{className:"h-3.5 w-3.5","aria-hidden":!0}),label:`${i("bulk.interrupt")} ${A.length}/${b.length}`,disabled:null!==j||!A.length,onClick:()=>void y("interrupt",A.map(a=>a.file.path),a=>ed("/api/tmux",{action:"interrupt",path:a}))}),(0,d.jsx)(ee,{icon:(0,d.jsx)(bm,{className:"h-3.5 w-3.5","aria-hidden":!0}),label:`${i("bulk.stop")} ${B.length}/${b.length}`,confirming:"kill"===q,confirmLabel:i("bulk.stopConfirm",{count:B.length}),disabled:null!==j||!B.length,onClick:()=>{"kill"!==q?r("kill"):y("kill",B.map(a=>a.file.path),a=>ed("/api/tmux",{action:"kill",path:a}))}}),(0,d.jsx)(ee,{icon:(0,d.jsx)(bo,{className:"h-3.5 w-3.5","aria-hidden":!0}),label:`${i("bulk.remove")} ${b.length}`,confirming:"remove"===q,confirmLabel:i("bulk.removeConfirm",{count:b.length}),disabled:null!==j||!b.length,onClick:()=>{if("remove"!==q)return void r("remove");for(let a of b)f(a.file.path);r(null)}}),(0,d.jsx)(ee,{icon:(0,d.jsx)(d1,{className:"h-3.5 w-3.5","aria-hidden":!0}),label:`${i("bulk.flow")} ${C.length}/${b.length}`,disabled:null!==j||!C.length,onClick:()=>t(a=>!a)}),(0,d.jsx)(ee,{icon:(0,d.jsx)(d2,{className:"h-3.5 w-3.5","aria-hidden":!0}),label:i("bulk.fit"),disabled:!b.length,onClick:g}),(0,d.jsx)("button",{className:"ml-auto inline-flex h-7 w-7 items-center justify-center rounded-full text-dim hover:bg-bg hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":i("bulk.exit"),title:i("bulk.exit"),onClick:h,children:(0,d.jsx)(n,{className:"h-4 w-4","aria-hidden":!0})})]}),o?(0,d.jsxs)("div",{className:"flex max-h-[140px] flex-col gap-0.5 overflow-y-auto rounded-[8px] border border-line bg-bg/60 p-1.5",children:[o.items.map(a=>(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5 text-[11px]",children:[a.ok?(0,d.jsx)(bb,{className:"h-3.5 w-3.5 shrink-0 text-ok","aria-hidden":!0}):(0,d.jsx)(d3,{className:"h-3.5 w-3.5 shrink-0 text-err","aria-hidden":!0}),(0,d.jsx)("span",{className:"min-w-0 shrink-0 truncate font-semibold",style:{maxWidth:"40%"},children:o.titles.get(a.path)??a.path}),a.error?(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-err",children:a.error}):null]},a.path)),o.current?(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5 text-[11px] text-dim",children:[(0,d.jsx)(bw,{className:"h-3.5 w-3.5 shrink-0 animate-spin","aria-hidden":!0}),(0,d.jsx)("span",{className:"min-w-0 truncate font-semibold",children:o.titles.get(o.current)??o.current})]}):null,!j&&D?(0,d.jsxs)("button",{className:"mt-1 inline-flex h-6 items-center gap-1 self-start rounded-full border border-line bg-panel px-2 text-[10.5px] font-semibold text-dim hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>{let a=o?.items.filter(a=>!a.ok).map(a=>a.path)??[],b=u.current;a.length&&b&&y(b.action,a,b.runner)},children:[(0,d.jsx)(d4,{className:"h-3 w-3","aria-hidden":!0}),i("bulk.retryFailed",{count:D})]}):null]}):null]})});function eg({count:a,disabled:b,onStart:c,onClose:f}){let{t:g}=v(),[h,i]=(0,e.useState)([]),[j,k]=(0,e.useState)(null),[l,m]=(0,e.useState)("auto"),[n,o]=(0,e.useState)(5);return(0,d.jsxs)("div",{className:"absolute bottom-[calc(100%+8px)] left-1/2 flex w-[420px] max-w-[94%] -translate-x-1/2 flex-col gap-2 rounded-[12px] border border-line bg-panel p-2.5 shadow-[0_10px_36px_rgb(20_20_30/0.18)]",onKeyDown:a=>{"Escape"===a.key&&f()},children:[(0,d.jsx)("span",{className:"text-[12px] font-bold",children:g("bulk.flowTitle",{count:a})}),(0,d.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[(0,d.jsxs)("label",{className:"col-span-3 flex flex-col gap-1 text-[10.5px] font-semibold text-dim",children:[g("flowDialog.preset"),(0,d.jsx)("select",{value:j??"",className:"h-8 rounded-[8px] border border-line bg-bg px-2 text-[12px] font-normal text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:a=>k(a.target.value||null),children:h.length?h.map(a=>(0,d.jsx)("option",{value:a.name,children:a.name},a.name)):(0,d.jsx)("option",{value:"",children:g("flowDialog.effortDefault")})})]}),(0,d.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-dim",children:[g("flowDialog.transitions"),(0,d.jsxs)("select",{value:l,className:"h-8 rounded-[8px] border border-line bg-bg px-2 text-[11.5px] font-normal text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:a=>m(a.target.value),children:[(0,d.jsx)("option",{value:"auto",children:g("flowDialog.auto")}),(0,d.jsx)("option",{value:"manual",children:g("flowDialog.manual")})]})]}),(0,d.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-dim",children:[g("flowDialog.roundLimit"),(0,d.jsx)("input",{type:"number",min:1,max:20,value:n,className:"h-8 rounded-[8px] border border-line bg-bg px-2 text-[11.5px] font-normal text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:a=>o(Math.max(1,Math.min(20,Number(a.target.value)||5)))})]}),(0,d.jsxs)("div",{className:"flex items-end justify-end gap-1.5",children:[(0,d.jsx)("button",{className:"h-8 rounded-[8px] border border-line bg-bg px-2 text-[11px] font-semibold text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:f,children:g("common.cancel")}),(0,d.jsx)("button",{className:"h-8 rounded-[8px] border border-accent bg-accent px-2.5 text-[11.5px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",disabled:b||!a,onClick:()=>c({...j?{preset:j}:{roles:ec},baseMode:"head",mode:l,reviewerMode:"headless",roundLimit:n}),children:g("bulk.flowStart",{count:a})})]})]})]})}function eh({layout:a,tasks:b=[],cam:c,vp:f,onJump:g}){let{t:h}=v(),i=(0,e.useRef)(null),j=(0,e.useRef)(!1),k=Math.min(216/a.width,148/a.height),l=(216-a.width*k)/2,m=(148-a.height*k)/2,n=a=>{let b=i.current?.getBoundingClientRect();b&&g((a.clientX-b.left-l)/k,(a.clientY-b.top-m)/k)};return(0,d.jsx)("div",{ref:i,"data-scheme-ui":!0,className:"absolute bottom-3 right-3 z-40 cursor-pointer overflow-hidden rounded-[10px] border border-line bg-panel/95 shadow-card",style:{width:216,height:148},title:h("minimap.title"),onPointerDown:a=>{a.stopPropagation(),j.current=!0,n(a);try{a.currentTarget.setPointerCapture(a.pointerId)}catch{}},onPointerMove:a=>{j.current&&n(a)},onPointerUp:a=>{j.current=!1;try{a.currentTarget.releasePointerCapture(a.pointerId)}catch{}},onPointerCancel:()=>{j.current=!1},children:(0,d.jsx)("svg",{width:216,height:148,"aria-hidden":!0,children:(0,d.jsxs)("g",{transform:`translate(${l} ${m}) scale(${k})`,children:[a.stacks.map(a=>(0,d.jsx)("rect",{x:a.x,y:a.y,width:a.w,height:a.h,rx:18,fill:"#c9c9d1",opacity:.45},a.key)),a.drafts.map(a=>(0,d.jsx)("rect",{x:a.x,y:a.y,width:a.w,height:a.h,rx:18,fill:"#9a9aa4",opacity:.3},a.key)),a.decks.map(a=>(0,d.jsx)("rect",{x:a.x,y:a.y,width:a.w,height:a.h,rx:18,fill:"#5a51e0",opacity:.3},a.key)),a.nodes.map(a=>(0,d.jsx)("rect",{x:a.x,y:a.y,width:a.w,height:a.h,rx:18,fill:ap(a.file),opacity:"live"===a.file.activity?.85:.35},a.file.path)),b.map(a=>(0,d.jsx)("circle",{cx:a.pos.x+130,cy:a.pos.y+d8(a)/2,r:3/k,fill:dx[a.status].color,opacity:"done"===a.status?.5:.95},a.id)),(0,d.jsx)("rect",{x:-c.x/c.z,y:-c.y/c.z,width:f.w/c.z,height:f.h/c.z,fill:"rgba(90,81,224,0.08)",stroke:"#5a51e0",strokeWidth:2.5/k})]})})})}let ei=k("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"}]]),ej={implementer:{engine:"claude",model:null,effort:null},reviewer:{engine:"codex",model:null,effort:"xhigh"}};function ek({label:a,role:b,onChange:c}){let{t:e}=v();return(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsx)("span",{className:"w-[86px] shrink-0 text-[10.5px] font-semibold text-dim",children:a}),(0,d.jsxs)("select",{value:b.engine,"aria-label":e("flowDialog.engine",{label:a}),className:"h-7 rounded-[8px] border border-line bg-bg px-1.5 text-[11.5px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:a=>c({...b,engine:a.target.value,effort:null}),children:[(0,d.jsx)("option",{value:"claude",children:"Claude"}),(0,d.jsx)("option",{value:"codex",children:"Codex"})]}),(0,d.jsx)("input",{value:b.model??"",placeholder:e("flowDialog.modelPlaceholder"),"aria-label":e("flowDialog.model",{label:a}),className:"h-7 w-0 min-w-0 flex-1 rounded-[8px] border border-line bg-bg px-1.5 font-mono text-[11px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:a=>c({...b,model:a.target.value.trim()||null})}),(0,d.jsxs)("select",{value:b.effort??"","aria-label":`Reasoning effort: ${a}`,className:"h-7 rounded-[8px] border border-line bg-bg px-1.5 text-[11.5px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:a=>c({...b,effort:a.target.value||null}),children:[(0,d.jsx)("option",{value:"",children:e("flowDialog.effortDefault")}),dk[b.engine].map(a=>(0,d.jsx)("option",{value:a,children:a},a))]})]})}function el({file:a,onClose:b}){let{t:c}=v(),[f,g]=(0,e.useState)([]),[h,i]=(0,e.useState)(null),[j,k]=(0,e.useState)(ej),[l,m]=(0,e.useState)(!1),[n,o]=(0,e.useState)("head"),[p,q]=(0,e.useState)("auto"),[r,s]=(0,e.useState)("headless"),[t,u]=(0,e.useState)(5),[w,x]=(0,e.useState)(!1),[y,z]=(0,e.useState)(null),A=async()=>{if(!w){x(!0),z(null);try{let d=await fetch("/api/flows",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({implementerPath:a.path,...l||!h?{roles:j}:{preset:h},baseMode:n,mode:p,reviewerMode:r,roundLimit:t})});if(!d.ok){let a=await d.json().catch(()=>null);z(a?.error??c("flowDialog.createFailed",{status:d.status}));return}b()}catch{z(c("common.serverUnavailable"))}finally{x(!1)}}};return(0,d.jsxs)("div",{"data-scheme-ui":!0,className:"flex w-[420px] flex-col gap-2.5 rounded-[12px] border border-line bg-panel p-3 shadow-[0_10px_36px_rgb(20_20_30/0.18)]",onKeyDown:a=>{"Escape"===a.key&&b()},children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"text-[12.5px] font-bold",children:c("flowDialog.title")}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[10.5px] text-dim",children:c("flowDialog.subtitle")})]}),f.length?(0,d.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-dim",children:[c("flowDialog.preset"),(0,d.jsx)("select",{value:h??"",className:"h-8 rounded-[8px] border border-line bg-bg px-2 text-[12px] font-normal text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:a=>{var b;let c;return i(b=a.target.value),void((c=f.find(a=>a.name===b))&&k({implementer:c.implementer,reviewer:c.reviewer}))},children:f.map(a=>(0,d.jsx)("option",{value:a.name,children:a.name},a.name))})]}):null,(0,d.jsx)("button",{className:"self-start text-[10.5px] font-semibold text-dim hover:text-accent focus-visible:outline-none","aria-expanded":l,onClick:()=>m(a=>!a),children:l?c("flowDialog.rolesManualOpen"):c("flowDialog.rolesManual")}),l?(0,d.jsxs)("div",{className:"flex flex-col gap-1.5 rounded-[10px] border border-dashed border-line bg-bg/50 p-2",children:[(0,d.jsx)(ek,{label:c("flowDialog.implementer"),role:j.implementer,onChange:a=>k(b=>({...b,implementer:a}))}),(0,d.jsx)(ek,{label:c("flowDialog.reviewer"),role:j.reviewer,onChange:a=>k(b=>({...b,reviewer:a}))})]}):null,(0,d.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,d.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-dim",children:[c("flowDialog.diffBase"),(0,d.jsxs)("select",{value:n,className:"h-8 rounded-[8px] border border-line bg-bg px-2 text-[11.5px] font-normal text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:a=>o(a.target.value),children:[(0,d.jsx)("option",{value:"head",children:c("flowDialog.fromHead")}),(0,d.jsx)("option",{value:"merge-base",children:c("flowDialog.fromMergeBase")})]})]}),(0,d.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-dim",children:[c("flowDialog.reviewer"),(0,d.jsxs)("select",{value:r,className:"h-8 rounded-[8px] border border-line bg-bg px-2 text-[11.5px] font-normal text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:a=>s(a.target.value),children:[(0,d.jsx)("option",{value:"headless",children:c("flowDialog.headless")}),(0,d.jsx)("option",{value:"pane",children:c("flowDialog.tmuxPane")})]})]}),(0,d.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-dim",children:[c("flowDialog.transitions"),(0,d.jsxs)("select",{value:p,className:"h-8 rounded-[8px] border border-line bg-bg px-2 text-[11.5px] font-normal text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:a=>q(a.target.value),children:[(0,d.jsx)("option",{value:"auto",children:c("flowDialog.auto")}),(0,d.jsx)("option",{value:"manual",children:c("flowDialog.manual")})]})]}),(0,d.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-dim",children:[c("flowDialog.roundLimit"),(0,d.jsx)("input",{type:"number",min:1,max:20,value:t,className:"h-8 rounded-[8px] border border-line bg-bg px-2 text-[11.5px] font-normal text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:a=>u(Math.max(1,Math.min(20,Number(a.target.value)||5)))})]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[y?(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[10.5px] font-semibold text-err",children:y}):(0,d.jsx)("span",{className:"flex-1"}),(0,d.jsx)("button",{className:"rounded-[8px] border border-line bg-bg px-2.5 py-1.5 text-[11.5px] font-semibold text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:b,children:c("common.cancel")}),(0,d.jsx)("button",{className:"rounded-[8px] border border-accent bg-accent px-3 py-1.5 text-[12px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",disabled:w,onClick:()=>void A(),children:w?c("flowDialog.creating"):c("flowDialog.start")})]})]})}let em=k("infinity",[["path",{d:"M6 16c5 0 7-8 12-8a4 4 0 0 1 0 8c-5 0-7-8-12-8a4 4 0 1 0 0 8",key:"18ogeb"}]]),en={waiting_ready:{labelKey:"flowStrip.startReview",action:"advance"},spawn_pending:{labelKey:"flowStrip.spawnReviewer",action:"advance"},relay_pending:{labelKey:"flowStrip.relayNotes",action:"advance"},needs_decision:{labelKey:"flowStrip.retryRound",action:"retry-round"},done_comment:{labelKey:"flowStrip.anotherRound",action:"another-round"}},eo=new Set(["spawning","reviewing","relaying","fixing"]),ep=[1,2,3,4,5,0];function eq({flow:a,onFocusRound:b}){let{t:c}=v(),[f,g]=(0,e.useState)(!1),[h,i]=(0,e.useState)(null),[j,k]=(0,e.useState)(""),l=async(b,c)=>{if(f)return;g(!0),i(null);let d=await ab(a.id,{action:b,...c});d?i(d):c?.note!==void 0&&k(""),g(!1)},m=en[a.state],o=Y.has(a.state),p="closed"===a.state||"approved"===a.state,q="waiting_ready"===a.state||"needs_decision"===a.state;return(0,d.jsxs)("div",{"data-scheme-ui":!0,className:`pointer-events-auto flex h-11 w-full items-center gap-3 rounded-[14px] border bg-panel/95 px-4 shadow-[0_2px_10px_rgb(20_20_30/0.08)] ${o?"border-[#e0ae45]/70":"border-line"}`,children:[(0,d.jsxs)("span",{className:"flex min-w-0 max-w-[38%] shrink-0 items-center gap-2",children:[(0,d.jsx)("span",{className:`h-2.5 w-2.5 shrink-0 rounded-full ${"approved"===a.state?"bg-ok":"needs_decision"===a.state?"bg-err":"paused"===a.state?"bg-[#e0ae45]":eo.has(a.state)?"bg-ok animate-pulse":"bg-[#9a9aa4]"}`,"aria-hidden":!0}),(0,d.jsx)("span",{className:"shrink-0 text-[10.5px] font-bold tracking-[0.08em] text-dim",children:c("flowStrip.flow")}),(0,d.jsx)("span",{className:"shrink-0 text-[12px] font-bold",children:X(c,a.state)}),a.stateDetail?(0,d.jsx)("span",{className:"min-w-0 truncate text-[11.5px] font-semibold text-dim",title:a.stateDetail,children:a.stateDetail}):null]}),(0,d.jsx)("span",{className:"no-scrollbar flex min-w-0 flex-1 items-center justify-center gap-1.5 overflow-x-auto","aria-label":c("flowStrip.roundsAria"),children:a.rounds.map((a,e)=>{let f=aa(a.verdict),g=null===a.verdict&&!a.error;return(0,d.jsxs)("span",{className:"flex shrink-0 items-center gap-1.5",children:[e>0?(0,d.jsx)("span",{className:"text-[10px] font-bold text-[#c9c9d1]","aria-hidden":!0,children:"→"}):null,(0,d.jsxs)("button",{className:`inline-flex h-6 items-center gap-1 rounded-full px-2 text-[10.5px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${g?"animate-pulse":""}`,style:{backgroundColor:f.soft,color:f.color},title:a.error?c("flowStrip.roundError",{n:a.n,error:a.error}):a.verdict?c("flowStrip.roundVerdict",{n:a.n,verdict:a.verdict})+(null!=a.findingsCount?` \xb7 ${c("roundDeck.findings",{count:a.findingsCount})}`:""):c("flowStrip.roundInProgress",{n:a.n}),onClick:()=>b?.(a.n),children:["R",a.n,(0,d.jsx)(dQ,{verdict:a.verdict,error:!!a.error}),null!=a.findingsCount&&a.findingsCount>0?(0,d.jsx)("span",{children:a.findingsCount}):null]})]},a.n)})}),(0,d.jsxs)("span",{className:"flex shrink-0 items-center gap-1.5",children:[h?(0,d.jsx)("span",{className:"max-w-[220px] truncate text-[10.5px] font-semibold text-err",title:h,children:h}):null,f?(0,d.jsx)(du,{className:"h-3.5 w-3.5 shrink-0 animate-spin text-dim","aria-hidden":!0}):null,q?(0,d.jsx)(bB,{label:c("flowStrip.noteTitle"),children:(0,d.jsx)("input",{className:"w-40 shrink-0 rounded-full border border-line bg-bg px-2.5 py-1 text-[10.5px] font-medium text-ink placeholder:text-dim/70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",value:j,placeholder:c("flowStrip.notePlaceholder"),onChange:a=>k(a.target.value),onKeyDown:a=>{"Enter"===a.key&&m&&l(m.action,{note:j})}})}):null,"reviewing"===a.state?(0,d.jsx)(bB,{label:c("flowStrip.stopReviewerTitle"),children:(0,d.jsxs)("button",{className:"inline-flex h-6 shrink-0 items-center gap-1 rounded-full border border-err/40 bg-[#fbeaea] px-2.5 text-[10.5px] font-bold text-err hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:f,onClick:()=>void l("cancel-round"),children:[(0,d.jsx)(bm,{className:"h-3 w-3","aria-hidden":!0})," ",c("flowStrip.stopReviewer")]})}):null,m?(0,d.jsx)("button",{className:"shrink-0 rounded-full border border-accent bg-accent px-3 py-1 text-[11px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",disabled:f,onClick:()=>void l(m.action,q?{note:j}:void 0),children:c(m.labelKey)}):null,p?null:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(bB,{label:c("flowStrip.limitTitle"),children:(0,d.jsxs)("span",{className:"flex shrink-0 items-center gap-0.5 rounded-full border border-line bg-bg p-0.5",children:[ep.map(b=>{let e=a.roundLimit===b,g=0!==b&&b<a.rounds.length;return(0,d.jsx)("button",{className:`inline-flex h-5 min-w-5 items-center justify-center rounded-full px-1 text-[10px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-30 ${e?"bg-accent text-white":"text-dim hover:bg-panel hover:text-ink"}`,disabled:f||g,"aria-label":0===b?c("flowStrip.limitUnlimitedAria"):c("flowStrip.limitAria",{count:b}),"aria-pressed":e,onClick:()=>void l("set-round-limit",{rounds:b}),children:0===b?(0,d.jsx)(em,{className:"h-3 w-3","aria-hidden":!0}):b},b)}),ep.includes(a.roundLimit)?null:(0,d.jsx)("span",{className:"inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-accent px-1 text-[10px] font-bold text-white",children:a.roundLimit})]})}),(0,d.jsx)(bB,{label:"auto"===a.mode?c("flowStrip.autoTitle"):c("flowStrip.manualTitle"),children:(0,d.jsx)("button",{className:`shrink-0 rounded-full border px-2.5 py-1 text-[10px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40 ${"auto"===a.mode?"border-ok/40 bg-[#eef8f0] text-ok":"border-line bg-bg text-dim hover:text-ink"}`,disabled:f,onClick:()=>void l("set-mode",{mode:"auto"===a.mode?"manual":"auto"}),children:"auto"===a.mode?c("flowDialog.auto"):c("flowStrip.manualShort")})}),"paused"===a.state?(0,d.jsx)(bB,{label:c("flowStrip.resume"),children:(0,d.jsx)("button",{className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-ok hover:bg-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:f,"aria-label":c("flowStrip.resume"),onClick:()=>void l("resume"),children:(0,d.jsx)(bk,{className:"h-3.5 w-3.5","aria-hidden":!0})})}):(0,d.jsx)(bB,{label:c("flowStrip.pause"),children:(0,d.jsx)("button",{className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-dim hover:bg-bg hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:f,"aria-label":c("flowStrip.pause"),onClick:()=>void l("pause"),children:(0,d.jsx)(cY,{className:"h-3.5 w-3.5","aria-hidden":!0})})})]}),(0,d.jsx)(bB,{label:c("flowStrip.close"),children:(0,d.jsx)("button",{className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-dim hover:bg-bg hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:f,"aria-label":c("flowStrip.close"),onClick:()=>void l("close"),children:(0,d.jsx)(n,{className:"h-3.5 w-3.5","aria-hidden":!0})})})]})]})}function er({role:a,active:b}){let{t:c}=v();return(0,d.jsxs)("div",{className:`pointer-events-none absolute -top-3 left-4 z-[12] flex h-6 items-center gap-1.5 rounded-full border px-2.5 shadow-card ${b?"border-ok/50 bg-[#eef8f0]":"border-line bg-panel"}`,children:[(0,d.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${b?"animate-pulse bg-ok":"bg-[#c2c2cb]"}`,"aria-hidden":!0}),(0,d.jsx)("span",{className:`text-[10px] font-bold tracking-[0.06em] ${b?"text-ok":"text-ink"}`,children:c("implementer"===a?"scheme.roleImplementer":"scheme.roleReviewer")}),(0,d.jsx)("span",{className:`text-[10px] font-semibold ${b?"text-ok":"text-dim"}`,children:c(b?"scheme.roleWorking":"scheme.roleWaiting")})]})}let es="cubic-bezier(.22,.8,.36,1)",et=`transform 380ms ${es}`,eu=(0,e.memo)(function({edges:a,width:b,height:c}){return(0,d.jsx)("svg",{width:b,height:c,className:"absolute left-0 top-0","aria-hidden":!0,children:a.map(a=>{let b=Math.max(36,(a.y2-a.y1)*.5),c=`M ${a.x1} ${a.y1} C ${a.x1} ${a.y1+b}, ${a.x2} ${a.y2-b}, ${a.x2} ${a.y2-7}`,e=`M ${a.x2-5} ${a.y2-9} L ${a.x2+5} ${a.y2-9} L ${a.x2} ${a.y2-1} Z`;return(0,d.jsxs)("g",{opacity:a.live?.9:.5,children:[(0,d.jsx)("path",{d:c,style:{d:`path("${c}")`,transition:`d 380ms ${es}`},fill:"none",stroke:a.color,strokeWidth:2.5,strokeLinecap:"round",strokeDasharray:a.dashed?"5 7":void 0}),(0,d.jsx)("circle",{cx:a.x1,cy:a.y1,r:3.5,fill:a.color,style:{cx:`${a.x1}px`,cy:`${a.y1}px`,transition:`cx 380ms ${es}, cy 380ms ${es}`}}),(0,d.jsx)("path",{d:e,style:{d:`path("${e}")`,transition:`d 380ms ${es}`},fill:a.color})]},a.to)})})}),ev=Math.atan2(56,45),ew=Math.atan2(-56,-45);function ex(a,b,c){let d=a-9*Math.cos(c),e=b-9*Math.sin(c),f=-Math.sin(c),g=Math.cos(c);return`M ${d+5*f} ${e+5*g} L ${d-5*f} ${e-5*g} L ${a} ${b} Z`}let ey=(0,e.memo)(function({loops:a,width:b,height:c}){return a.length?(0,d.jsx)("svg",{width:b,height:c,className:"absolute left-0 top-0","aria-hidden":!0,children:a.map(a=>{var b,c;let e="spawn_pending"===(b=a.flow).state||"spawning"===b.state||"reviewing"===b.state?"forward":"relay_pending"===b.state||"relaying"===b.state||"fixing"===b.state||"waiting_ready"===b.state&&b.rounds.length?"back":null,f="approved"===(c=a.flow).state?"#1a8a3e":Z.has(c.state)?"#5a51e0":Y.has(c.state)?"#e0ae45":"#9a9aa4",g=a.y+150,h=a.y+330,i=(a.x1+a.x2)/2,j=(g+h)/2,k=`M ${a.x1} ${g} C ${a.x1+52} ${g-56}, ${a.x2-52} ${g-56}, ${a.x2-7} ${g}`,l=`M ${a.x2} ${h} C ${a.x2-52} ${h+56}, ${a.x1+52} ${h+56}, ${a.x1+7} ${h}`,m=ex(a.x2-7,g,ev),n=ex(a.x1+7,h,ew),o=(a,b)=>({d:a,fill:"none",stroke:b?"#5a51e0":"#c9c9d1",strokeWidth:b?3:2.5,strokeLinecap:"round",className:b?"loop-arc-live":void 0,style:{d:`path("${a}")`,transition:`d 380ms ${es}`}}),p=a=>({d:`path("${a}")`,transition:`d 380ms ${es}`});return(0,d.jsxs)("g",{children:[(0,d.jsx)("path",{...o(k,"forward"===e)}),(0,d.jsx)("path",{d:m,style:p(m),fill:"forward"===e?"#5a51e0":"#c9c9d1"}),(0,d.jsx)("path",{...o(l,"back"===e)}),(0,d.jsx)("path",{d:n,style:p(n),fill:"back"===e?"#5a51e0":"#c9c9d1"}),(0,d.jsx)("circle",{cx:i,cy:j,r:17,fill:"#ffffff",stroke:f,strokeWidth:2,style:{cx:`${i}px`,cy:`${j}px`,transition:`cx 380ms ${es}, cy 380ms ${es}`}}),(0,d.jsx)("text",{x:i,y:j+6,textAnchor:"middle",fontSize:17,fontWeight:700,fill:f,style:{x:`${i}px`,y:`${j+6}px`,transition:`x 380ms ${es}, y 380ms ${es}`},children:"⟳"})]},a.key)})}):null});function ez({file:a,onSelect:b}){let c=as(a);return(0,d.jsxs)("button",{className:"flex h-8 w-full min-w-0 items-center gap-1.5 rounded-[8px] px-2 text-left hover:bg-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:w(a.title),onClick:()=>b(a),children:[(0,d.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${ae(a.activity)}`}),(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:c.style,children:c.label}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-semibold",children:w(a.cmdDesc||a.title,80)}),(0,d.jsx)("span",{className:"shrink-0 text-[10.5px] text-dim",children:ac(a.mtime)})]})}function eA({file:a}){let b=as(a);return(0,d.jsx)("div",{className:"pointer-events-none absolute inset-0 z-[3] flex items-center justify-center",style:{opacity:"var(--label-o, 0)",transition:"opacity .25s"},"aria-hidden":!0,children:(0,d.jsxs)("div",{className:"flex max-w-[94%] items-center gap-[0.5em] rounded-[0.55em] border border-line bg-panel/95 px-[0.75em] py-[0.45em] shadow-[0_2px_14px_rgb(20_20_30/0.14)]",style:{fontSize:"calc(13px * min(var(--inv-z, 1), 2.6))"},children:[(0,d.jsx)("span",{className:`h-[0.6em] w-[0.6em] shrink-0 rounded-full ${ae(a.activity)}`}),(0,d.jsx)("span",{className:"shrink-0 rounded-full px-[0.45em] font-bold",style:{...b.style,fontSize:"0.72em"},children:b.label}),(0,d.jsx)("span",{className:"line-clamp-2 min-w-0 font-bold",children:w(a.title,70)})]})})}let eB=()=>void 0,eC=a=>a?" opacity-35":"";function eD({node:a,ringed:b,dimmed:c,flow:e}){let{t:f}=v(),g=as(a.file);return(0,d.jsxs)("div",{"data-scheme-node":a.file.path,className:`scheme-enter absolute${eC(c)}`,style:{transform:`translate(${a.x}px, ${a.y}px)`,width:a.w,height:a.h,transition:et},children:[e?(0,d.jsx)("div",{className:"absolute -top-[60px] left-0 z-[4]",style:{width:1370},children:(0,d.jsx)(eq,{flow:e,onFocusRound:eB})}):null,a.under.length?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"absolute inset-x-4 -bottom-4 h-5 rounded-[10px] border border-line bg-panel/70 shadow-card","aria-hidden":!0}),(0,d.jsx)("div",{className:"absolute inset-x-2 -bottom-2 h-5 rounded-[10px] border border-line bg-panel/90 shadow-card","aria-hidden":!0})]}):null,(0,d.jsxs)("div",{className:`relative z-[1] flex h-full min-w-0 flex-col overflow-hidden rounded-[10px] border border-line bg-panel shadow-card ${b?"ring-2 ring-accent/60 ring-offset-2 ring-offset-bg":""}`,children:[(0,d.jsx)("span",{"aria-hidden":!0,className:"h-1 w-full shrink-0",style:aq(a.file)}),(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-2 border-b border-line px-3 py-2.5",children:[(0,d.jsx)("span",{className:`h-2.5 w-2.5 shrink-0 rounded-full ${ae(a.file.activity)}`}),(0,d.jsx)("span",{className:"shrink-0 rounded-full px-2 py-0.5 text-[11px] font-bold",style:g.style,children:g.label}),a.file.model?(0,d.jsx)("span",{className:"min-w-0 truncate font-mono text-[11px] text-dim",children:a.file.model}):null,(0,d.jsx)("span",{className:"ml-auto shrink-0 text-[11px] text-dim",children:ac(a.file.mtime)})]}),(0,d.jsx)("div",{className:"min-w-0 flex-1 px-3 py-2.5 text-[14px] font-semibold leading-snug",children:(0,d.jsx)("span",{className:"line-clamp-5",children:w(a.file.title,180)})}),a.under.length?(0,d.jsxs)("div",{className:"shrink-0 px-3 pb-2.5 text-[11px] font-semibold text-dim",children:[a.under.length," ",f("scheme.underneath")]}):null]}),e?(0,d.jsx)(er,{role:"implementer",active:"implementer"===$(e)}):null,(0,d.jsx)(eA,{file:a.file})]})}function eE({draft:a,ringed:b,dimmed:c}){let{t:e}=v();return(0,d.jsx)("div",{"data-scheme-node":a.key,className:`scheme-enter absolute${eC(c)}`,style:{transform:`translate(${a.x}px, ${a.y}px)`,width:a.w,height:a.h,transition:et},children:(0,d.jsx)("div",{className:`flex h-full items-center justify-center rounded-[10px] border border-dashed border-line bg-panel/70 ${b?"ring-2 ring-accent/60 ring-offset-2 ring-offset-bg":""}`,children:(0,d.jsxs)("span",{className:"flex items-center gap-1.5 text-[13px] font-semibold text-dim",children:[(0,d.jsx)("span",{className:"text-[15px] leading-none text-accent",children:"+"})," ",e("mobile.agent")]})})})}function eF({deck:a,dimmed:b}){let{t:c}=v(),e=a.rounds.at(-1)??null,f=e?.round??null,g=aa(f?.verdict??null);return(0,d.jsxs)("div",{"data-scheme-node":a.key,className:`scheme-enter absolute${eC(b)}`,style:{transform:`translate(${a.x}px, ${a.y}px)`,width:a.w,height:a.h,transition:et},children:[(0,d.jsx)("div",{className:"flex h-full flex-col overflow-hidden rounded-[10px] border border-line bg-panel shadow-card",children:f?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5 border-b border-line px-3 py-2.5",style:{backgroundColor:g.soft,color:g.color},children:[(0,d.jsxs)("span",{className:"flex shrink-0 items-center gap-1 text-[12px] font-bold",children:["R",f.n," ",(0,d.jsx)(dQ,{verdict:f.verdict,error:!!f.error,className:"h-3.5 w-3.5"})]}),(0,d.jsx)("span",{className:"min-w-0 truncate text-[11px] font-semibold",children:f.error?c("roundDeck.aborted"):f.verdict??c("roundDeck.reviewInProgress")})]}),(0,d.jsx)("div",{className:"min-w-0 flex-1 px-3 py-2.5 text-[13px] font-semibold leading-snug",children:(0,d.jsx)("span",{className:"line-clamp-4",children:e?.file?w(e.file.title,140):c("roundDeck.spawningReviewer")})}),a.rounds.length>1?(0,d.jsx)("div",{className:"shrink-0 px-3 pb-2.5 text-[11px] font-semibold text-dim",children:c("roundDeck.moreRounds",{count:a.rounds.length-1})}):null]}):(0,d.jsx)("div",{className:"flex flex-1 items-center justify-center text-[12px] font-semibold text-dim",children:c("roundDeck.waitingFirst")})}),(0,d.jsx)(er,{role:"reviewer",active:"reviewer"===$(a.flow)})]})}function eG({stack:a,dimmed:b,onSelect:c}){let{t:e}=v();return(0,d.jsx)("div",{"data-scheme-node":a.key,className:`scheme-enter absolute${eC(b)}`,style:{transform:`translate(${a.x}px, ${a.y}px)`,width:a.w,height:a.h,transition:et},children:(0,d.jsx)("div",{className:"flex h-full flex-col gap-1.5 overflow-y-auto rounded-[10px] border border-dashed border-[#c9c9d1] bg-panel/60 p-2",children:a.items.map(({file:a,branches:b})=>{let f=as(a);return(0,d.jsxs)("button",{className:"flex min-h-[52px] w-full min-w-0 flex-col justify-center gap-0.5 rounded-[8px] border border-line bg-panel px-2 py-1 text-left shadow-card hover:border-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:w(a.title),onClick:()=>c(a),children:[(0,d.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,d.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${ae(a.activity)}`}),(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:f.style,children:f.label}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-semibold",children:w(a.title,70)})]}),(0,d.jsxs)("span",{className:"flex items-center gap-2 pl-3 text-[10.5px] text-dim",children:[(0,d.jsx)("span",{children:dg(e,a.kind)}),(0,d.jsx)("span",{children:ac(a.mtime)}),b?(0,d.jsxs)("span",{children:["⤷ ",b]}):null]})]},a.path)})})})}function eH({node:a,ringed:b,marked:c,dimmed:f,dormant:g,flow:h,canFlow:i,onSelect:j,onClose:k,onFocusRound:l,onHandoff:m,onExpand:n}){let{t:o}=v(),[p,q]=(0,e.useState)(!1),[r,s]=(0,e.useState)(!1);return(0,d.jsxs)("div",{"data-scheme-node":a.file.path,"data-lasso-selected":c?"true":void 0,className:`scheme-enter absolute ${p||r?"z-20":""}${eC(f)}`,style:{transform:`translate(${a.x}px, ${a.y}px)`,width:a.w,height:a.h,transition:et},children:[c?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"absolute -right-2.5 -top-2.5 z-[5] flex h-6 w-6 items-center justify-center rounded-full border-2 border-bg bg-accent text-white shadow-card",children:(0,d.jsx)(a8,{className:"h-3.5 w-3.5","aria-hidden":!0})}),(0,d.jsx)("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 z-[4] rounded-[10px] bg-accent/[0.06]"})]}):null,h?(0,d.jsx)("div",{className:"absolute -top-[60px] left-0 z-[4]",style:{width:1370},children:(0,d.jsx)(eq,{flow:h,onFocusRound:a=>l(h.id,a)})}):i?(0,d.jsx)("div",{className:"absolute -top-11 left-0 z-[4]",children:(0,d.jsxs)("button",{"data-scheme-ui":!0,className:"inline-flex h-7 items-center gap-1 rounded-full border border-line bg-panel px-2.5 text-[11px] font-semibold text-dim shadow-card hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-expanded":r,title:o("scheme.flowTitle"),onClick:()=>s(a=>!a),children:[(0,d.jsx)("span",{className:"text-[13px] leading-none text-accent",children:"⟳"})," ",o("scheme.flow")]})}):null,r?(0,d.jsx)("div",{className:"absolute left-0 top-[-8px] z-40 -translate-y-full",children:(0,d.jsx)(el,{file:a.file,onClose:()=>s(!1)})}):null,a.under.length?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"absolute inset-x-4 -bottom-4 h-5 rounded-[10px] border border-line bg-panel/70 shadow-card","aria-hidden":!0}),(0,d.jsx)("div",{className:"absolute inset-x-2 -bottom-2 h-5 rounded-[10px] border border-line bg-panel/90 shadow-card","aria-hidden":!0})]}):null,(0,d.jsx)("div",{className:`relative z-[1] flex h-full ${b?"rounded-[10px] ring-2 ring-accent/60 ring-offset-2 ring-offset-bg":""}`,children:(0,d.jsx)(di,{file:a.file,tasks:a.tasks,isRoot:a.isRoot,dormant:g,onClose:()=>k(a.file.path),onToggleExpand:()=>n(a.file.path)})}),h?(0,d.jsx)(er,{role:"implementer",active:"implementer"===$(h)}):null,(0,d.jsx)(eA,{file:a.file}),m&&dV(a.file)?(0,d.jsx)(dW,{file:a.file,onHandoff:()=>m(a.file)}):null,a.under.length?(0,d.jsxs)("button",{className:"absolute -bottom-11 left-1/2 z-[2] inline-flex h-7 -translate-x-1/2 items-center gap-1.5 whitespace-nowrap rounded-full border border-line bg-panel px-2.5 text-[11px] font-semibold text-dim shadow-card hover:border-accent/40 hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-expanded":p,title:o("scheme.collapsedTitle"),onClick:()=>q(a=>!a),children:[(0,d.jsx)(ei,{className:"h-3.5 w-3.5","aria-hidden":!0}),a.under.length," ",o("scheme.underneath"),(0,d.jsx)(a9,{className:`h-3 w-3 transition-transform ${p?"rotate-90":""}`,"aria-hidden":!0})]}):null,p?(0,d.jsx)("div",{className:"absolute left-0 top-[calc(100%+52px)] z-30 max-h-[280px] w-full overflow-y-auto rounded-[10px] border border-line bg-panel p-1.5 shadow-[0_10px_36px_rgb(20_20_30/0.18)]",children:a.under.map(a=>(0,d.jsx)(ez,{file:a,onSelect:j},a.path))}):null]})}function eI({draft:a,project:b,files:c,ringed:e,dimmed:f,onDraftClose:g,onDraftSpawned:h}){return(0,d.jsx)("div",{"data-scheme-node":a.key,className:`scheme-enter absolute${eC(f)}`,style:{transform:`translate(${a.x}px, ${a.y}px)`,width:a.w,height:a.h,transition:et},children:(0,d.jsx)("div",{className:`flex h-full ${e?"rounded-[10px] ring-2 ring-accent/60 ring-offset-2 ring-offset-bg":""}`,children:aM(a.id)?(0,d.jsx)(dt,{draftId:a.id,project:b,onClose:()=>g(a.id),onLaunched:()=>g(a.id)}):(0,d.jsx)(dq,{draftId:a.id,project:b,files:c,onClose:()=>g(a.id),onSpawned:b=>h(a.id,b)})})})}function eJ({deck:a,focus:b,dimmed:c,dormant:e}){let f=b&&b.flowId===a.flow.id?b.round+b.nonce/1e3:null;return(0,d.jsxs)("div",{"data-scheme-node":a.key,className:`scheme-enter absolute${eC(c)}`,style:{transform:`translate(${a.x}px, ${a.y}px)`,width:a.w,height:a.h,transition:et},children:[(0,d.jsx)(dT,{flow:a.flow,rounds:a.rounds,focusRound:f,dormant:e}),(0,d.jsx)(er,{role:"reviewer",active:"reviewer"===$(a.flow)})]})}let eK=(0,e.memo)(function({layout:a,project:b,files:c,interactive:e,lite:f,dormant:g,selected:h,multi:i,session:j,focus:k,attentionPaths:l,flowsByImpl:m,deckFocus:n,onSelect:o,onClose:p,onFocusRound:q,onDraftClose:r,onDraftSpawned:s,onHandoff:t,onExpand:u}){let v=a=>null!==l&&!a.rounds.some(a=>a.file&&l.has(a.file.path));return(0,d.jsxs)("div",{className:`${e?"":"pointer-events-none select-none"} ${j?"scheme-session":""}`.trim()||void 0,children:[a.stacks.map(a=>(0,d.jsx)(eG,{stack:a,dimmed:null!==l&&!a.items.some(a=>l.has(a.file.path)),onSelect:o},a.key)),a.decks.map(a=>f?(0,d.jsx)(eF,{deck:a,dimmed:v(a)},a.key):(0,d.jsx)(eJ,{deck:a,focus:n,dimmed:v(a),dormant:g},a.key)),a.drafts.map(a=>f?(0,d.jsx)(eE,{draft:a,ringed:h===a.key||k===a.key,dimmed:null!==l},a.key):(0,d.jsx)(eI,{draft:a,project:b,files:c,ringed:h===a.key||k===a.key,dimmed:null!==l,onDraftClose:r,onDraftSpawned:s},a.key)),a.nodes.map(a=>f?(0,d.jsx)(eD,{node:a,ringed:h===a.file.path||k===a.file.path,dimmed:null!==l&&!l.has(a.file.path),flow:m.get(a.file.path)??null},a.file.path):(0,d.jsx)(eH,{node:a,ringed:j?i.has(a.file.path):h===a.file.path||k===a.file.path,marked:j&&i.has(a.file.path),dimmed:null!==l&&!l.has(a.file.path),dormant:g,flow:m.get(a.file.path)??null,canFlow:W(a.file,m),onSelect:o,onClose:p,onFocusRound:q,onHandoff:t,onExpand:u},a.file.path))]})}),eL="#d97757",eM=(0,e.memo)(function({edges:a,width:b,height:c,onRetry:e}){return a.length?(0,d.jsx)("svg",{width:b,height:c,className:"pointer-events-none absolute left-0 top-0 z-[2]",children:a.map(a=>{let b="source"===a.relation,c=a.failed?eL:b?"#0d8a72":dx[a.status].color,f=a.failed?.95:b?.4:.65,g=(a.x1+a.x2)/2,h=`M ${a.x1} ${a.y1} C ${g} ${a.y1}, ${g} ${a.y2}, ${a.x2} ${a.y2}`,i=(a.x1+a.x2)/2,j=(a.y1+a.y2)/2;return(0,d.jsxs)("g",{opacity:f,children:[(0,d.jsx)("path",{d:h,style:{d:`path("${h}")`,transition:`d 380ms ${es}`},fill:"none",stroke:c,strokeWidth:b?1.75:2.5,strokeLinecap:"round",strokeDasharray:b?"2 6":"5 7"}),(0,d.jsx)("circle",{cx:a.x2,cy:a.y2,r:b?3:4,fill:c,style:{cx:`${a.x2}px`,cy:`${a.y2}px`,transition:`cx 380ms ${es}, cy 380ms ${es}`}}),a.failed&&"assignment"===a.relation?(0,d.jsxs)("g",{className:"pointer-events-auto cursor-pointer",role:"button","aria-label":`retry ${a.path}`,onClick:()=>e(a.taskId,a.path),children:[(0,d.jsx)("title",{children:a.error??""}),(0,d.jsx)("path",{d:h,fill:"none",stroke:"transparent",strokeWidth:22,style:{pointerEvents:"stroke"}}),(0,d.jsx)("circle",{cx:i,cy:j,r:11,fill:"#fff",stroke:eL,strokeWidth:2,style:{cx:`${i}px`,cy:`${j}px`,transition:`cx 380ms ${es}, cy 380ms ${es}`}}),(0,d.jsx)("text",{x:i,y:j+4.5,textAnchor:"middle",fontSize:13,fontWeight:700,fill:eL,style:{x:`${i}px`,y:`${j+4.5}px`,transition:`x 380ms ${es}, y 380ms ${es}`},children:"⚠"})]}):null]},a.key)})}):null});function eN(a,b){document.hasFocus()?b():window.addEventListener("focus",()=>a?.focus(),{once:!0})}function eO({task:a,assignment:b,file:c,onDetach:e}){let{t:f}=v();if(!b.path)return(0,d.jsxs)("span",{className:"flex h-6 items-center gap-1.5 rounded-[6px] bg-white/55 px-1.5 text-[10.5px] font-semibold text-dim",children:[(0,d.jsx)(bw,{className:"h-3 w-3 shrink-0 animate-spin","aria-hidden":!0}),f("tasks.spawning")]});let g=!c,h="failed"===b.state,i="handoff"===b.state,j=c?as(c):null,k=c?w(c.title,40):b.path.split("/").pop()??b.path,l=h?f("tasks.chipFailedTitle",{error:b.error??""}):g?f("tasks.deadChip"):i?f("tasks.handoffChip"):c?w(c.title):void 0;return(0,d.jsxs)("span",{className:`flex h-6 w-full min-w-0 items-center gap-1.5 rounded-[6px] px-1.5 ${h?"bg-[#faeee9] text-[#a04a2e]":g?"bg-white/45 text-dim opacity-70":"bg-white/55"}`,title:l,children:[i?(0,d.jsx)(bg,{className:"h-3 w-3 shrink-0 text-[#0d9488]","aria-hidden":!0}):null,c?(0,d.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${ae(c.activity)}`}):null,j?(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:j.style,children:j.label}):null,(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[10.5px] font-semibold",children:k}),h?(0,d.jsx)("span",{"aria-hidden":!0,children:"⚠"}):null,(0,d.jsx)("button",{type:"button",className:"flex h-4 w-4 shrink-0 items-center justify-center rounded-full text-dim hover:bg-black/5 hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":f("tasks.detachAria",{title:k}),title:f("tasks.detach"),onClick:()=>e(a,b.path),children:(0,d.jsx)(n,{className:"h-3 w-3","aria-hidden":!0})})]})}function eP({task:a,file:b}){let{t:c}=v(),e=a.source;if(!e)return null;let f=b?w(b.title,40):e.path.split("/").pop()??e.path,g=ar(e.engine);return(0,d.jsxs)("span",{className:"flex h-6 w-full min-w-0 items-center gap-1.5 rounded-[6px] bg-white/55 px-1.5 text-[#0d6f5f]",title:`${c("tasks.sourceTitle")}: ${e.text}`,children:[(0,d.jsx)(bg,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:g.style,children:g.label}),(0,d.jsx)("span",{className:"shrink-0 text-[10.5px] font-bold",children:c("tasks.source")}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[10.5px] font-semibold",children:f})]})}let eQ=(0,e.memo)(function({task:a,files:b,camRef:c,handlers:f}){let{t:g}=v(),[h,i]=(0,e.useState)(null),j=(0,e.useRef)(null),[k,l]=(0,e.useState)(null),[m,n]=(0,e.useState)(!1),[o,p]=(0,e.useState)(""),[q,r]=(0,e.useState)(!1),[s,t]=(0,e.useState)(!1),u=(0,e.useRef)(null);(0,e.useEffect)(()=>{if(!s)return;let a=window.setTimeout(()=>t(!1),4e3);return()=>window.clearTimeout(a)},[s]),(0,e.useEffect)(()=>{if(!m)return;let b=window.setTimeout(()=>{o.trim()&&o!==a.text&&f.patch(a.id,{text:o})},900);return()=>window.clearTimeout(b)},[m,o,a.id,a.text,f]);let x=()=>{if(n(!1),!o.trim()){o!==a.text&&(r(!0),dE("err",g("tasks.emptyTextBlocked")));return}r(!1),o!==a.text&&f.patch(a.id,{text:o})},y=()=>(m?!o.trim():!!q)&&(dE("err",g("tasks.emptyTextBlocked")),!0),z=h??(k&&k.seen===a.updatedAt?k:a.pos),A=dx[a.status],B=dz(a.text)||g("tasks.untitled"),C=a.text.includes("\n")?a.text.slice(a.text.indexOf("\n")+1):"",D=new Map(b.map(a=>[a.path,a])),E=m||null!==h,F=bY({onDrop:b=>y()?null:(f.handoff(a,b.file),g("tasks.linkHanded",{title:w(b.file.title,48)})),onMiss:()=>{y()||f.draft(a)}});return(0,d.jsxs)("div",{"data-scheme-task":a.id,className:`group absolute pb-9 ${E?"z-30":"z-[4]"}`,style:{transform:`translate(${z.x}px, ${z.y}px)`,width:260,transition:h?void 0:`transform 380ms ${es}`},onPointerDown:a=>{if(0===a.button&&!m&&!a.target.closest("button, a, input, textarea, select, [data-task-pop]")){j.current={sx:a.clientX,sy:a.clientY,ox:z.x,oy:z.y,moved:!1};try{a.currentTarget.setPointerCapture(a.pointerId)}catch{}}},onPointerMove:a=>{let b=j.current;if(!b)return;let d=a.clientX-b.sx,e=a.clientY-b.sy;if(!b.moved&&4>Math.hypot(d,e))return;b.moved=!0;let f=c.current?.z??1;i({x:b.ox+d/f,y:b.oy+e/f})},onPointerUp:b=>{let d=j.current;if(j.current=null,d){if(d.moved){let e=c.current?.z??1,g={x:Math.round(d.ox+(b.clientX-d.sx)/e),y:Math.round(d.oy+(b.clientY-d.sy)/e)};i(null),l({...g,seen:a.updatedAt}),f.patch(a.id,{pos:g}).then(a=>{a&&l(null)});return}m||((c.current?.z??1)<.55&&f.center(d9(a)),p(a.text),n(!0),requestAnimationFrame(()=>{let a=u.current;a&&(a.focus(),a.setSelectionRange(a.value.length,a.value.length))}))}},children:[(0,d.jsxs)("div",{className:`flex flex-col overflow-hidden rounded-[8px] border border-line shadow-card ${"done"===a.status?"opacity-60 saturate-50":""} ${m?"ring-2 ring-accent/50":""}`,style:{backgroundColor:A.soft},children:[(0,d.jsx)("div",{"aria-hidden":!0,className:"h-1 w-full shrink-0",style:{backgroundColor:A.color}}),m?(0,d.jsx)("textarea",{ref:u,value:o,onChange:a=>p(a.target.value),onBlur:()=>eN(u.current,x),onKeyDown:a=>{"Escape"===a.key&&(a.preventDefault(),x())},"aria-label":g("tasks.editAria"),rows:Math.min(16,Math.max(3,o.split("\n").length+1)),className:"w-full resize-none bg-transparent px-3 py-2 text-[12.5px] leading-[17px] text-[#26262c] placeholder:text-dim focus-visible:outline-none",maxLength:6e3}):(0,d.jsxs)("div",{"data-task-body":!0,className:"cursor-text overflow-y-auto px-3 py-2",style:{maxHeight:340},children:[(0,d.jsx)("div",{className:"whitespace-pre-wrap break-words text-[12.5px] font-bold leading-[17px] text-[#26262c]",children:B}),C.trim()?(0,d.jsx)("div",{className:"whitespace-pre-wrap break-words text-[12.5px] leading-[17px] text-[#3a3a42]",children:C}):null]}),a.source||a.assignments.length?(0,d.jsxs)("div",{className:"flex flex-col gap-1 px-2 pb-2",children:[(0,d.jsx)(eP,{task:a,file:a.source?D.get(a.source.path)??null:null}),a.assignments.map((b,c)=>(0,d.jsx)(eO,{task:a,assignment:b,file:b.path?D.get(b.path)??null:null,onDetach:(a,b)=>f.unassign(a,b)},(b.path??"spawning")+"::"+c))]}):null]}),(0,d.jsxs)("div",{className:`absolute left-0 top-full flex -translate-y-8 items-center gap-1 ${E?"":"pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100"} transition-opacity`,children:[(0,d.jsxs)("button",{type:"button",className:"inline-flex h-7 touch-none items-center gap-1 rounded-full border border-line bg-panel px-2 text-[10.5px] font-semibold text-dim shadow-card hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:g("tasks.sendTitle"),onPointerDown:F.onPillPointerDown,onClick:()=>{F.consumeClick()||y()||f.draft(a)},children:[(0,d.jsx)(cZ,{className:"h-3 w-3","aria-hidden":!0})," ",g("tasks.send")]}),(0,d.jsxs)("button",{type:"button",className:"inline-flex h-7 items-center rounded-full border px-2 text-[10.5px] font-bold shadow-card focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",style:{backgroundColor:"#fff",color:A.color,borderColor:A.color},title:g("tasks.statusTitle",{label:g(`tasks.status.${a.status}`)}),onClick:()=>{var b;let c;f.patch(a.id,{status:(b=a.status,c=dy.indexOf(b),dy[(c+1)%dy.length])})},children:[g("tasks.statusPrefix"),": ",g(`tasks.status.${a.status}`)]}),(0,d.jsxs)("button",{type:"button",className:`inline-flex h-7 items-center gap-1 rounded-full border px-2 text-[10.5px] font-semibold shadow-card focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${s?"border-err bg-err text-white":"border-line bg-panel text-dim hover:border-err/40 hover:text-err"}`,"aria-label":g("tasks.deleteAria",{title:B}),title:s?g("tasks.deleteConfirm"):g("tasks.delete"),onClick:()=>{s?(t(!1),f.remove(a.id)):t(!0)},children:[(0,d.jsx)(bo,{className:"h-3 w-3","aria-hidden":!0}),s?g("tasks.deleteConfirm"):null]})]}),F.overlay]})});function eR({pos:a,onCommit:b,onCancel:c}){let{t:f}=v(),[g,h]=(0,e.useState)(""),i=(0,e.useRef)(null),j=()=>{g.trim()?b(g):c()};return(0,d.jsx)("div",{"data-scheme-task":"new",className:"absolute z-30",style:{transform:`translate(${a.x}px, ${a.y}px)`,width:260},children:(0,d.jsxs)("div",{className:"flex flex-col overflow-hidden rounded-[8px] border border-line shadow-card ring-2 ring-accent/50",style:{backgroundColor:dx.inbox.soft},children:[(0,d.jsx)("div",{"aria-hidden":!0,className:"h-1 w-full shrink-0",style:{backgroundColor:dx.inbox.color}}),(0,d.jsx)("textarea",{ref:i,value:g,onChange:a=>h(a.target.value),onBlur:()=>eN(i.current,j),onKeyDown:a=>{"Escape"===a.key&&(a.preventDefault(),j())},placeholder:f("tasks.newPlaceholder"),"aria-label":f("tasks.editAria"),rows:4,className:"w-full resize-none bg-transparent px-3 py-2 text-[12.5px] leading-[17px] text-[#26262c] placeholder:text-dim focus-visible:outline-none",maxLength:6e3})]})})}function eS({task:a}){let{t:b}=v(),c=dx[a.status];return(0,d.jsxs)("div",{"data-scheme-task":a.id,className:`absolute overflow-hidden rounded-[8px] border border-line shadow-card ${"done"===a.status?"opacity-60 saturate-50":""}`,style:{transform:`translate(${a.pos.x}px, ${a.pos.y}px)`,width:260,height:d8(a),backgroundColor:c.soft},children:[(0,d.jsx)("div",{"aria-hidden":!0,className:"h-1 w-full",style:{backgroundColor:c.color}}),(0,d.jsx)("div",{className:"px-3 py-2 text-[12.5px] font-bold leading-[17px] text-[#26262c]",children:(0,d.jsx)("span",{className:"line-clamp-4 whitespace-pre-wrap break-words",children:dz(a.text)||b("tasks.untitled")})})]})}let eT=(0,e.memo)(function({tasks:a,files:b,interactive:c,lite:e,camRef:f,handlers:g,pending:h,onCreate:i,onCreateCancel:j}){return(0,d.jsxs)("div",{className:c?void 0:"pointer-events-none select-none",children:[a.map(a=>e?(0,d.jsx)(eS,{task:a},a.id):(0,d.jsx)(eQ,{task:a,files:b,camRef:f,handlers:g},a.id)),h&&!e?(0,d.jsx)(eR,{pos:h,onCommit:i,onCancel:j}):null]})}),eU=(a,b)=>Math.hypot(a.x-b.x,a.y-b.y),eV=new Set;function eW({active:a,title:b,onClick:c,children:e}){return(0,d.jsx)("button",{className:`inline-flex h-7 w-7 items-center justify-center rounded-[8px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${a?"bg-accent/10 text-accent":"text-dim hover:bg-bg hover:text-ink"}`,title:b,"aria-label":b,"aria-pressed":a,onClick:c,children:e})}function eX({project:a,groups:b,manual:c,files:f,flows:g,tasks:h,drafts:i,focus:j,ring:k,attentionPaths:l,onSelect:m,onNodePick:n,onClose:o,onDraftClose:p,onDraftSpawned:q,onHandoff:r,onTaskDraft:s}){let{t}=v(),u=!!n,[x,y]=(0,e.useState)(null),[z,A]=(0,e.useState)(eV),[B,C]=(0,e.useState)(!1),D=(0,e.useMemo)(()=>dX(b,c,f,g,i),[b,c,f,g,i]),E=!u&&(B||z.size>0),F=(0,e.useCallback)(()=>{A(eV),C(!1)},[]),G=(0,e.useCallback)(a=>{A(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[]),H=(0,e.useRef)(x),I=(0,e.useCallback)((a,b)=>{if(null===a){y(null),F();return}if(b&&D.byPath.has(a)&&D.nodes.some(b=>b.file.path===a)){y(null),A(b=>{let c=new Set(b),d=H.current;return d&&d!==a&&D.nodes.some(a=>a.file.path===d)&&c.add(d),c.has(a)?c.delete(a):c.add(a),c});return}y(a)},[D,F]),J=(0,e.useMemo)(()=>U(g),[g]),[K,L]=(0,e.useState)(null),M=K?D.nodes.find(a=>a.file.path===K)??null:null,[N,O]=(0,e.useState)(null),P=(0,e.useCallback)((a,b)=>{O(c=>({flowId:a,round:b,nonce:(c?.nonce??0)+1}))},[]),Q=k??j,R=(0,e.useRef)(m),S=(0,e.useRef)(n),T=(0,e.useRef)(o),V=(0,e.useRef)(p),W=(0,e.useRef)(q),X=(0,e.useRef)(r),Y=(0,e.useRef)(s),Z=(0,e.useCallback)(a=>{let b=S.current;b?b(a.path):R.current(a)},[]),$=(0,e.useCallback)(a=>T.current(a),[]),_=(0,e.useCallback)(a=>V.current(a),[]),aa=(0,e.useCallback)((a,b)=>W.current(a,b),[]),ab=(0,e.useCallback)(a=>X.current?.(a),[]),ac=(0,e.useCallback)(a=>L(a),[]),ad=(0,e.useRef)(E),ae=(0,e.useRef)(!1),af=(0,e.useCallback)((a,b)=>{var c,d;if(ae.current)return ae.current=!1,!0;if(!ad.current)return y(null),!0;let e=(c=D.nodes,d={x:a,y:b,w:0,h:0},c.filter(a=>a.x<=d.x+d.w&&a.x+a.w>=d.x&&a.y<=d.y+d.h&&a.y+a.h>=d.y).map(a=>a.file.path));return e.length?G(e[0]):F(),!0},[D,G,F]),ag=(0,e.useRef)(()=>!1),[ah,ai]=(0,e.useState)([]),[aj,ak]=(0,e.useState)(null),al=(0,e.useMemo)(()=>{let b=new Set(h.map(a=>a.id)),c=ah.filter(c=>!b.has(c.id)&&c.project===a);return c.length?[...h,...c]:h},[h,ah,a]),am=(0,e.useMemo)(()=>new Map(al.map(a=>["task::"+a.id,d9(a)])),[al]),an=(0,e.useMemo)(()=>(function(a,b){let c=[];for(let d of a){let a=d9(d),e=ea(a);if(d.source){let f=b.get(d.source.path);if(f){let b=eb(a,ea(f)),g=eb(f,e);c.push({key:d.id+"::source::"+d.source.path,taskId:d.id,relation:"source",path:d.source.path,x1:b.x,y1:b.y,x2:g.x,y2:g.y,status:d.status,failed:!1,error:null})}}for(let f of d.assignments){if(!f.path)continue;let g=b.get(f.path);if(!g)continue;let h=eb(a,ea(g)),i=eb(g,e);c.push({key:d.id+"::"+f.path,taskId:d.id,relation:"assignment",path:f.path,x1:h.x,y1:h.y,x2:i.x,y2:i.y,status:d.status,failed:"failed"===f.state,error:f.error})}}return c})(al,function(a){let b=new Map,c=({x:a,y:b,w:c,h:d})=>({x:a,y:b,w:c,h:d});for(let d of a.stacks)for(let a of d.items)b.set(a.file.path,c(d));for(let d of a.decks)for(let a of d.rounds){let e=a.file?.path??a.round.reviewerPath;e&&b.set(e,c(d))}for(let d of a.nodes)for(let a of d.under)b.set(a.path,c(d));for(let d of a.nodes)b.set(d.file.path,c(d));return b}(D)),[al,D]),ao=(0,e.useCallback)((a,b)=>{ak({x:Math.round(a-130),y:Math.round(b-14)})},[]),{cam:ap,vp:aq,viewportRef:ar,handLike:as,taskTool:at,setTaskTool:au,centerOn:av,panning:aw,glide:ax,setMode:ay,onPointerDown:az,onPointerMove:aA,onDoubleClick:aB,onClick:aC,zoomCenter:aE,zoomTo:aF,fit:aK,fitRect:aL,jump:aM}=function({project:a,layout:b,mapMode:c,focus:d,onNodePick:f,setSelected:g,onBackgroundDown:h,onWorldTap:i,taskRects:j,onPlaceTask:k}){let l=(0,e.useRef)(null),m=(0,e.useRef)(null),[n,o]=(0,e.useState)({x:0,y:0,z:.5}),[p,q]=(0,e.useState)("select"),[r,s]=(0,e.useState)(!1),[t,u]=(0,e.useState)(!1),[v,w]=(0,e.useState)(!1),[x,y]=(0,e.useState)(!1),[z,A]=(0,e.useState)({w:1,h:1}),B=(0,e.useRef)(null),C=(0,e.useRef)(new Map),D=(0,e.useRef)(null);(0,e.useRef)(p),(0,e.useRef)(t),(0,e.useRef)(r);let E=(0,e.useRef)(k),F=(0,e.useRef)(null);(0,e.useRef)(null);let G=(0,e.useCallback)(a=>{s(!1),q(a),localStorage.setItem("llvSchemeMode",a)},[]),H=(0,e.useCallback)(a=>{let c=Math.min(Math.max(a.x,120-b.width*a.z),z.w-120),d=Math.min(Math.max(a.y,120-b.height*a.z),z.h-120);return c===a.x&&d===a.y?a:{...a,x:c,y:d}},[b.width,b.height,z]),I=(0,e.useRef)([]),J=(0,e.useRef)(null),K=(0,e.useCallback)(a=>{I.current.push(a),null==J.current&&(J.current=requestAnimationFrame(()=>{J.current=null;let a=I.current;I.current=[],o(b=>a.reduce((a,b)=>b(a),b))}))},[]),L=(0,e.useCallback)((a,b,c)=>{K(d=>{let e=Math.min(1.6,Math.max(.12,d.z*c));if(e===d.z)return d;let f=e/d.z;return H({z:e,x:a-(a-d.x)*f,y:b-(b-d.y)*f})})},[H,K]),M=(0,e.useCallback)(a=>{let b=l.current?.getBoundingClientRect();b&&L(b.width/2,b.height/2,a)},[L]),N=(0,e.useCallback)(a=>{let b=l.current?.getBoundingClientRect();b&&o(c=>{let d=Math.min(1.6,Math.max(.12,a));if(d===c.z)return c;let e=d/c.z,f=b.width/2,g=b.height/2;return H({z:d,x:f-(f-c.x)*e,y:g-(g-c.y)*e})})},[H]),O=(0,e.useCallback)(()=>{let a=l.current?.getBoundingClientRect();if(!a||!b.nodes.length&&!b.drafts.length)return null;let c=Math.min(1.6,Math.max(.12,Math.min((a.width-48)/b.width,(a.height-48)/b.height,1)));return{z:c,x:(a.width-b.width*c)/2,y:(a.height-b.height*c)/2}},[b]),P=(0,e.useCallback)(a=>{y(!0),o(a),F.current&&window.clearTimeout(F.current),F.current=window.setTimeout(()=>y(!1),500)},[]),Q=(0,e.useCallback)(()=>{let a=O();a&&P(a)},[O,P]),R=(0,e.useCallback)(a=>{let b=l.current?.getBoundingClientRect();if(!b||a.w<=0||a.h<=0)return;let c=Math.min(1.6,Math.max(.12,Math.min((b.width-48)/a.w,(b.height-48)/a.h,1)));P(H({z:c,x:(b.width-a.w*c)/2-a.x*c,y:(b.height-a.h*c)/2-a.y*c}))},[P,H]),S=(0,e.useCallback)((a,b)=>{let c=l.current?.getBoundingClientRect();c&&P(d=>{let e=Math.min(1.6,Math.max(d.z,b));return{z:e,x:c.width/2-(a.x+a.w/2)*e,y:Math.min(c.height/2-a.y*e,.08*c.height-(a.y-40)*e)}})},[P]);(0,e.useRef)(null);let T=a=>{let b=l.current?.getBoundingClientRect();return b?{x:a.clientX-b.left,y:a.clientY-b.top}:{x:a.clientX,y:a.clientY}},U=a=>{B.current={sx:a.clientX,sy:a.clientY,cx:n.x,cy:n.y},w(!0);try{l.current?.setPointerCapture(a.pointerId)}catch{}},V=c||"hand"===p||t,W=(0,e.useCallback)((a,b)=>o(c=>H({...c,x:z.w/2-a*c.z,y:z.h/2-b*c.z})),[z,H]);return{cam:n,vp:z,viewportRef:l,mode:p,setMode:G,handLike:V,taskTool:r,setTaskTool:s,centerOn:S,panning:v,glide:x,onPointerDown:a=>{let b=a.target;if(!b.closest("[data-scheme-ui]")){if(c&&a.isPrimary&&(m.current={x:a.clientX,y:a.clientY}),"touch"===a.pointerType&&(C.current.set(a.pointerId,T(a)),2===C.current.size)){let[a,b]=[...C.current.values()];D.current={d:eU(a,b),cx:(a.x+b.x)/2,cy:(a.y+b.y)/2},B.current=null,w(!1);return}if(1===a.button){a.preventDefault(),U(a);return}if(0===a.button){if(r&&!c&&E.current){let b=l.current?.getBoundingClientRect();if(b){a.preventDefault(),E.current((a.clientX-b.left-n.x)/n.z,(a.clientY-b.top-n.y)/n.z),s(!1),G("select");return}}if(!(c||"hand"===p||t)){if(b.closest("[data-scheme-task]"))return;let c=b.closest("[data-scheme-node]");if(c)return void g(c.getAttribute("data-scheme-node"),a.shiftKey||a.ctrlKey||a.metaKey);i&&a.isPrimary&&(m.current={x:a.clientX,y:a.clientY});let d=h?.(a)??!1;if(d&&"touch"!==a.pointerType||!d&&(g(null),b.closest("button, a, input, textarea, select")))return}U(a)}}},onPointerMove:a=>{if("touch"===a.pointerType&&C.current.has(a.pointerId)){C.current.set(a.pointerId,T(a));let b=D.current;if(b&&C.current.size>=2){let[a,c]=[...C.current.values()],d=eU(a,c),e=(a.x+c.x)/2,f=(a.y+c.y)/2,g=b.d>0?d/b.d:1;K(a=>{let c=Math.min(1.6,Math.max(.12,a.z*g)),d=c/a.z;return H({z:c,x:e-(b.cx-a.x)*d,y:f-(b.cy-a.y)*d})}),D.current={d,cx:e,cy:f};return}}let b=B.current;if(!b)return;let c=a.clientX-b.sx,d=a.clientY-b.sy;K(a=>H({...a,x:b.cx+c,y:b.cy+d}))},onDoubleClick:a=>{let c=a.target;if(c.closest("[data-scheme-ui]"))return;let d=c.closest("[data-scheme-node]");if(!d)return void Q();if("hand"!==p&&!t)return;let e=b.byPath.get(d.getAttribute("data-scheme-node")??"");e&&S(e,.9)},onClick:a=>{if(!f&&!i)return;let c=m.current;if(m.current=null,!c||Math.hypot(a.clientX-c.x,a.clientY-c.y)>9||a.target.closest("[data-scheme-ui]"))return;let d=l.current?.getBoundingClientRect();if(!d)return;let e=(a.clientX-d.left-n.x)/n.z,g=(a.clientY-d.top-n.y)/n.z;if(i?.(e,g)||!f)return;let h=((a,c)=>{let d=b=>a>=b.x&&a<=b.x+b.w&&c>=b.y&&c<=b.y+b.h;if(j){for(let[a,b]of j)if(d(b))return a}for(let a of b.nodes)if(d(a))return a.file.path;for(let a of b.drafts)if(d(a))return a.key;for(let a of b.stacks)if(d(a))return function(a,b){let c=Math.floor((b-a.y-8)/58);return a.items[Math.max(0,Math.min(c,a.items.length-1))]?.file??null}(a,c)?.path??null;for(let a of b.decks)if(d(a))return a.key;return null})(e,g);h&&f(h)},zoomCenter:M,zoomTo:N,fit:Q,fitRect:R,jump:W}}({project:a,layout:D,mapMode:u,focus:j,onNodePick:n,setSelected:I,onBackgroundDown:u?void 0:a=>(ae.current=!1,ag.current(a)),onWorldTap:u?void 0:af,taskRects:am,onPlaceTask:u?void 0:ao}),{marquee:aN,onBackgroundDown:aO}=function({viewportRef:a,cam:b,layout:c,enabled:d,session:f,onCommit:g}){let[h,i]=(0,e.useState)(null),j=(0,e.useRef)(null);(0,e.useRef)(b),(0,e.useRef)(c),(0,e.useRef)(g);let k=(0,e.useCallback)(b=>{let c=a.current?.getBoundingClientRect();return c?{x:b.clientX-c.left,y:b.clientY-c.top}:{x:b.clientX,y:b.clientY}},[a]);return{marquee:h,onBackgroundDown:(0,e.useCallback)(a=>{if(!d)return!1;if("touch"===a.pointerType)return f;if(!a.isPrimary||0!==a.button)return!1;let b=k(a);return j.current={sx:b.x,sy:b.y,additive:a.shiftKey,active:!1},!0},[d,f,k])}}({viewportRef:ar,cam:ap,layout:D,enabled:!u,session:E,onCommit:(0,e.useCallback)((a,b)=>{ae.current=!0,y(null),A(c=>{if(!b)return a.length?new Set(a):eV;if(!a.length)return c;let d=new Set(c);for(let b of a)d.add(b);return d})},[])}),aP=(0,e.useMemo)(()=>D.nodes.filter(a=>z.has(a.file.path)),[D,z]),aQ=(0,e.useMemo)(()=>(function(a,b){let c=1/0,d=1/0,e=-1/0,f=-1/0,g=!1;for(let h of a)b.has(h.file.path)&&(g=!0,c=Math.min(c,h.x),d=Math.min(d,h.y),e=Math.max(e,h.x+h.w),f=Math.max(f,h.y+h.h));return g?{x:c,y:d,w:e-c,h:f-d}:null})(D.nodes,z),[D,z]),aR=(0,e.useRef)(aQ),aS=(0,e.useCallback)(()=>{aR.current&&aL(aR.current)},[aL]),aT=(0,e.useRef)(ap),aU=(0,e.useCallback)((a,b)=>void aJ(a,b),[]),aV=(0,e.useMemo)(()=>({patch:async(a,b)=>{let c=await aG(a,b);return c&&dE("err",c),c},remove:a=>{ai(b=>b.some(b=>b.id===a)?b.filter(b=>b.id!==a):b),aH(a).then(a=>{a&&dE("err",a)})},handoff:async(a,b)=>{var c,d;let e=await aI(a.id,b.path);return"error"in e?(dE("err",e.error),e.error):(bS(b.path,(c=e.task.id,d=e.task.text,`Task #${c.slice(0,8)}: ${d}`)),null)},draft:a=>Y.current?.(a),unassign:async(a,b)=>{let c=await aJ(a.id,b);c&&dE("err",c)},center:a=>av(a,.75)}),[av]),aW=(0,e.useCallback)(b=>{aj&&aD({project:a,text:b,pos:aj}).then(a=>{"error"in a?dE("err",a.error):(ai(b=>[...b,a.task]),ak(null))})},[a,aj]),aX=(0,e.useCallback)(()=>ak(null),[]),[aY,aZ]=(0,e.useState)(!1),a_=24*ap.z;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{ref:ar,className:`relative min-h-0 flex-1 overflow-hidden ${aw?"cursor-grabbing select-none":at?"cursor-crosshair":as?"cursor-grab":""} ${as?"touch-none":""}`,onPointerDown:az,onPointerMove:aA,onDoubleClick:aB,onClick:aC,children:[(0,d.jsx)("div",{"aria-hidden":!0,className:"pointer-events-none absolute",style:{inset:-a_,backgroundImage:"radial-gradient(rgba(28,28,34,0.09) 1px, transparent 1px)",backgroundSize:`${a_}px ${a_}px`,transform:`translate(${(ap.x%a_+a_)%a_}px, ${(ap.y%a_+a_)%a_}px)`,willChange:"transform"}}),(0,d.jsxs)("div",{className:`absolute left-0 top-0 ${aw?"scheme-panning":""}`,style:{width:D.width,height:D.height,transform:`translate(${ap.x}px, ${ap.y}px) scale(${ap.z})`,transformOrigin:"0 0",transition:ax?`transform .45s ${es}`:void 0,willChange:"transform","--inv-z":String(1/ap.z),"--label-o":ap.z<.45?"1":"0"},children:[(0,d.jsx)(eu,{edges:D.edges,width:D.width,height:D.height}),(0,d.jsx)(ey,{loops:D.loops,width:D.width,height:D.height}),(0,d.jsx)(eK,{layout:D,project:a,files:f,interactive:!as&&!E,lite:u,dormant:aY,selected:x,multi:z,session:E,focus:Q,attentionPaths:l??null,flowsByImpl:J,deckFocus:N,onSelect:Z,onClose:$,onFocusRound:P,onDraftClose:_,onDraftSpawned:aa,onHandoff:r?ab:void 0,onExpand:ac}),(0,d.jsx)(eM,{edges:an,width:D.width,height:D.height,onRetry:aU}),(0,d.jsx)(eT,{tasks:al,files:f,interactive:!as&&!E,lite:u,camRef:aT,handlers:aV,pending:aj,onCreate:aW,onCreateCancel:aX}),E&&aQ?(0,d.jsx)("div",{"aria-hidden":!0,className:"pointer-events-none absolute z-[6] rounded-[14px] border-2 border-dashed border-accent/60",style:{left:aQ.x-14,top:aQ.y-14,width:aQ.w+28,height:aQ.h+28},children:(0,d.jsx)("span",{className:"absolute -top-3 left-4 rounded-full border border-accent/50 bg-panel px-2 py-0.5 font-bold text-accent",style:{fontSize:"calc(11px * min(var(--inv-z, 1), 2.6))"},children:t("bulk.selectedCount",{count:z.size})})}):null]},a),aN?(0,d.jsxs)("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 z-30",children:[(0,d.jsx)("div",{className:"absolute rounded-[4px] border border-accent/70 bg-accent/10",style:{left:aN.rect.x,top:aN.rect.y,width:aN.rect.w,height:aN.rect.h}}),aN.candidates.map(a=>{let b=D.byPath.get(a);return b?(0,d.jsx)("div",{className:"absolute rounded-[10px] border-2 border-accent/70",style:{left:b.x*ap.z+ap.x,top:b.y*ap.z+ap.y,width:b.w*ap.z,height:b.h*ap.z}},a):null})]}):null,(0,d.jsxs)("div",{"data-scheme-ui":!0,className:"absolute left-3 top-3 z-40 flex items-center gap-1 rounded-[10px] border border-line bg-panel/95 p-1 shadow-card",children:[u?null:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(eW,{active:as&&!at,title:t("scheme.handTool"),onClick:()=>ay("hand"),children:(0,d.jsx)(dY,{className:"h-4 w-4","aria-hidden":!0})}),(0,d.jsx)(eW,{active:!as&&!E&&!at,title:t("scheme.selectTool"),onClick:()=>ay("select"),children:(0,d.jsx)(dZ,{className:"h-4 w-4","aria-hidden":!0})}),(0,d.jsx)(eW,{active:E,title:t("scheme.lassoTool"),onClick:()=>{E?F():(ay("select"),C(!0))},children:(0,d.jsx)(d$,{className:"h-4 w-4","aria-hidden":!0})}),(0,d.jsx)(eW,{active:at,title:t("tasks.tool"),onClick:()=>au(!at),children:(0,d.jsx)(d_,{className:"h-4 w-4","aria-hidden":!0})}),(0,d.jsx)("div",{className:"mx-0.5 h-5 w-px bg-line","aria-hidden":!0})]}),(0,d.jsx)(eW,{title:t("scheme.zoomOut"),onClick:()=>aE(.8),children:(0,d.jsx)(cr,{className:"h-4 w-4","aria-hidden":!0})}),(0,d.jsxs)("button",{className:"min-w-[46px] rounded-[8px] px-1 text-center text-[11px] font-semibold text-dim hover:bg-bg hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:t("scheme.zoom100"),onClick:()=>aF(1),children:[Math.round(100*ap.z),"%"]}),(0,d.jsx)(eW,{title:t("scheme.zoomIn"),onClick:()=>aE(1.25),children:(0,d.jsx)(bA,{className:"h-4 w-4","aria-hidden":!0})}),(0,d.jsx)(eW,{title:t("scheme.fit"),onClick:aK,children:(0,d.jsx)(a$,{className:"h-4 w-4","aria-hidden":!0})})]}),E?(0,d.jsx)(ef,{project:a,nodes:aP,flowsByImpl:J,onRemove:$,onFit:aS,onExit:F}):null,(0,d.jsx)(eh,{layout:D,tasks:al,cam:ap,vp:aq,onJump:aM})]}),M?(0,d.jsx)("div",{className:"fixed inset-0 z-40 flex flex-col bg-bg p-3",role:"dialog","aria-modal":"true","aria-label":w(M.file.title,90),children:(0,d.jsx)(di,{file:M.file,tasks:M.tasks,isRoot:M.isRoot,expanded:!0,onToggleExpand:()=>L(null)})}):null]})}let eY={waiting:5,stalled:4,live:3,returned:2,done:1};function eZ({project:a,groups:b,manual:c,files:f,flows:g,tasks:h,drafts:i,loaded:j,focus:k,onSelect:l,onClose:m,onDraftClose:o,onDraftSpawned:p,onHandoff:q}){let{t:r}=v(),[s,t]=(0,e.useState)(null),[u,w]=(0,e.useState)(!1),[x,y]=(0,e.useState)(null),z=(0,e.useRef)(null),A=(0,e.useRef)(null),B=(0,e.useMemo)(()=>dX(b,c,f,g,i),[b,c,f,g,i]),C=(0,e.useMemo)(()=>[...B.nodes.map(a=>({key:a.file.path,file:a.file,isRoot:a.isRoot,kind:"node"})),...B.decks.map(a=>({key:a.key,file:null,isRoot:!1,kind:"deck"})),...B.drafts.map(a=>({key:a.key,file:null,isRoot:!0,kind:"draft"}))],[B]),D=(0,e.useMemo)(()=>new Map(C.map(a=>[a.key,a])),[C]),E=(0,e.useMemo)(()=>{if(s&&D.has(s))return s;let a=null,b=-1;for(let c of C){if(!c.file)continue;let d=1e12*eY[ay(c.file)]+c.file.mtime;d>b&&(b=d,a=c)}return(a??C[0])?.key??null},[s,D,C]),F=(0,e.useMemo)(()=>B.nodes.find(a=>a.file.path===E)??null,[B,E]),G=(0,e.useMemo)(()=>B.decks.find(a=>a.key===E)??null,[B,E]),H=(0,e.useMemo)(()=>B.drafts.find(a=>a.key===E)??null,[B,E]),I=(0,e.useCallback)(a=>{if(!C.length)return;let b=C.findIndex(a=>a.key===E),c=C[Math.min(C.length-1,Math.max(0,(-1===b?0:b)+a))];c&&c.key!==E&&t(c.key)},[C,E]),J=(0,e.useCallback)(a=>{if(w(!1),a.startsWith("task::"))return void y({taskId:a.slice(6)});if(D.has(a))return void t(a);let b=f.find(b=>b.path===a);b&&l(b)},[D,f,l]);return(0,d.jsxs)("div",{className:"relative flex min-h-0 min-w-0 flex-1 flex-col",children:[C.length>1?(0,d.jsx)("div",{className:"flex shrink-0 items-center gap-1.5 overflow-x-auto border-b border-line bg-panel px-2 py-1.5",children:C.map(a=>(0,d.jsx)(e$,{entry:a,active:a.key===E,chipRef:a.key===E?A:void 0,onClick:()=>t(a.key)},a.key))}):null,(0,d.jsxs)("div",{className:"relative flex min-h-0 flex-1 flex-col p-1.5 pb-[max(0.375rem,env(safe-area-inset-bottom))]",children:[F?(0,d.jsxs)("div",{className:"relative flex min-h-0 flex-1",children:[(0,d.jsx)(di,{file:F.file,tasks:F.tasks,isRoot:F.isRoot,onClose:()=>m(F.file.path),dragHandle:{onTouchStart:a=>{let b=a.touches[0];b&&(z.current={x:b.clientX,y:b.clientY})},onTouchEnd:a=>{let b=z.current;z.current=null;let c=a.changedTouches[0];if(!b||!c)return;let d=c.clientX-b.x,e=c.clientY-b.y;56>Math.abs(d)||Math.abs(d)<2*Math.abs(e)||I(d<0?1:-1)}}}),q&&dV(F.file)?(0,d.jsx)(dW,{file:F.file,onHandoff:()=>q(F.file)}):null]},F.file.path):G?(0,d.jsx)("div",{className:"relative min-h-0 flex-1",children:(0,d.jsx)(dT,{flow:G.flow,rounds:G.rounds,focusRound:null})},G.key):H?aM(H.id)?(0,d.jsx)(dt,{draftId:H.id,project:a,onClose:()=>o(H.id),onLaunched:()=>o(H.id)},H.key):(0,d.jsx)(dq,{draftId:H.id,project:a,files:f,onClose:()=>o(H.id),onSpawned:a=>p(H.id,a)},H.key):j?(0,d.jsx)("div",{className:"flex flex-1 items-center justify-center text-center text-[13px] text-dim",children:r("mobile.noConvos")}):(0,d.jsxs)("div",{className:"flex flex-1 items-center justify-center gap-2 text-center text-[13px] text-dim",children:[(0,d.jsx)(bw,{className:"h-4 w-4 animate-spin","aria-hidden":!0}),r("common.loading")]}),(0,d.jsx)(e_,{layout:B,tasks:h,current:E,onOpen:()=>w(!0)}),(0,d.jsxs)("button",{type:"button",className:"absolute bottom-[168px] right-4 z-30 inline-flex h-9 items-center gap-1 rounded-full border border-line bg-panel/95 px-2.5 text-[11px] font-bold text-ink shadow-card focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":r("tasks.panelToggleAria"),onClick:()=>y("list"),children:[(0,d.jsx)(aW,{className:"h-4 w-4 text-accent","aria-hidden":!0}),h.filter(a=>"done"!==a.status).length||null]})]}),u?(0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex flex-col bg-bg pb-[env(safe-area-inset-bottom)]",children:[(0,d.jsxs)("div",{className:"flex h-10 shrink-0 items-center gap-2 border-b border-line bg-panel px-3",children:[(0,d.jsx)("span",{className:"shrink-0 text-[13px] font-bold",children:r("mobile.map")}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] text-dim",children:a}),(0,d.jsx)("button",{type:"button",className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-[8px] border border-line bg-bg text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":r("mobile.closeMap"),onClick:()=>w(!1),children:(0,d.jsx)(n,{className:"h-4 w-4","aria-hidden":!0})})]}),(0,d.jsx)(eX,{project:a,groups:b,manual:c,files:f,flows:g,tasks:h,drafts:i,focus:null,ring:E,onSelect:l,onClose:m,onDraftClose:o,onDraftSpawned:p,onNodePick:J}),(0,d.jsx)("div",{className:"shrink-0 border-t border-line bg-panel px-3 py-1.5 text-center text-[11px] text-dim",children:r("mobile.tapNode")})]}):null,x?(0,d.jsx)(dN,{project:a,tasks:h,files:f,initialView:x,onClose:()=>y(null)}):null]})}function e$({entry:a,active:b,chipRef:c,onClick:e}){let{t:f}=v();if(!a.file){let g="deck"===a.kind;return(0,d.jsxs)("button",{ref:c,type:"button",className:`flex h-7 shrink-0 items-center gap-1 rounded-full border px-2.5 text-[11px] font-semibold ${b?"border-accent/60 bg-accent/10 text-ink":"border-dashed border-line bg-bg text-dim"}`,onClick:e,children:[(0,d.jsx)("span",{className:"text-[13px] leading-none text-accent",children:g?"R":"+"})," ",f(g?"scheme.flow":"mobile.agent")]})}let g=a.file,h=ay(g),i="waiting"===h||"stalled"===h,j=as(g),k=w(g.title,60);return(0,d.jsxs)("button",{ref:c,type:"button",className:`flex h-7 shrink-0 items-center gap-1.5 rounded-full border px-2.5 text-[11px] font-semibold ${b?"border-accent/60 bg-accent/10 text-ink":i?"border-[#e0ae45]/60 bg-[#fff7e6] text-[#8a5a00]":"border-line bg-bg text-dim"}`,title:k,onClick:e,children:[(0,d.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${ae(g.activity)}`}),a.isRoot?null:(0,d.jsx)("span",{"aria-hidden":!0,children:"⤷"}),b?(0,d.jsx)("span",{className:"max-w-[52vw] truncate",children:k}):(0,d.jsxs)("span",{children:[i?"⏸ ":"",j.label]})]})}function e_({layout:a,tasks:b,current:c,onOpen:e}){let{t:f}=v(),g=Math.min(96/a.width,64/a.height),h=(96-a.width*g)/2,i=(64-a.height*g)/2;return(0,d.jsx)("button",{type:"button",className:"absolute bottom-[92px] right-4 z-30 overflow-hidden rounded-[10px] border border-line bg-panel/95 shadow-card focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",style:{width:96,height:64},"aria-label":f("mobile.openMap"),onClick:e,children:(0,d.jsx)("svg",{width:96,height:64,"aria-hidden":!0,children:(0,d.jsxs)("g",{transform:`translate(${h} ${i}) scale(${g})`,children:[a.stacks.map(a=>(0,d.jsx)("rect",{x:a.x,y:a.y,width:a.w,height:a.h,rx:24,fill:"#c9c9d1",opacity:.45},a.key)),a.drafts.map(a=>(0,d.jsx)("rect",{x:a.x,y:a.y,width:a.w,height:a.h,rx:24,fill:"#9a9aa4",opacity:.3,stroke:a.key===c?"#5a51e0":void 0,strokeWidth:a.key===c?5/g:void 0},a.key)),a.decks.map(a=>(0,d.jsx)("rect",{x:a.x,y:a.y,width:a.w,height:a.h,rx:24,fill:"#5a51e0",opacity:.35,stroke:a.key===c?"#5a51e0":void 0,strokeWidth:a.key===c?5/g:void 0},a.key)),a.nodes.map(a=>(0,d.jsx)("rect",{x:a.x,y:a.y,width:a.w,height:a.h,rx:24,fill:ap(a.file),opacity:"live"===a.file.activity?.85:.35,stroke:a.file.path===c?"#5a51e0":void 0,strokeWidth:a.file.path===c?5/g:void 0},a.file.path)),b.map(a=>(0,d.jsx)("circle",{cx:a.pos.x+130,cy:a.pos.y+d8(a)/2,r:3/g,fill:dx[a.status].color,opacity:"done"===a.status?.5:.95},a.id))]})})})}function e0(a){try{window.localStorage.setItem("llvArchived",JSON.stringify([...a]))}catch{}}function e1({data:a,onOpen:b}){let{t:c}=v(),f=a.waiting.length;(0,e.useRef)(f);let[g,h]=(0,e.useState)(!1);return(0,d.jsxs)("div",{className:"group absolute bottom-3 right-3 z-20",children:[a.livePreview.length?(0,d.jsx)("div",{className:"pointer-events-none mb-1.5 hidden w-[300px] rounded-[8px] border border-line bg-panel/95 px-3 py-2 shadow-card backdrop-blur group-focus-within:block group-hover:block",children:a.livePreview.map(a=>(0,d.jsxs)("div",{className:"flex min-w-0 gap-1.5 py-0.5 text-[10.5px]",children:[(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate font-semibold",children:a.title}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-dim",children:a.statusLine||c("status.working")})]},a.file.path))}):null,(0,d.jsxs)("button",{className:`ml-auto flex items-center gap-1.5 rounded-full border border-line bg-panel/95 px-2.5 py-1 text-[11.5px] font-bold shadow-card backdrop-blur transition-transform hover:border-accent/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 ${g?"scale-110 border-[#e0ae45]/70":""} motion-reduce:transition-none`,"aria-label":c("corner.openSwitchboard"),onClick:b,children:[(0,d.jsx)("span",{className:`h-2 w-2 rounded-full ${a.working.length?"animate-pulse bg-ok":"bg-dim"}`}),(0,d.jsx)("span",{children:a.working.length}),(0,d.jsx)("span",{className:f?"text-[#b8860b]":"text-dim",children:c("corner.waitingCount",{count:f})})]})]})}function e2({file:a,title:b,project:c,currentProject:e,descendants:f,statusLine:g,size:h,tone:i,onOpen:j,onArchive:k}){let{t:l}=v(),m=as(a),o="large"===h;return(0,d.jsxs)("article",{className:`group relative flex ${o?"h-[150px] w-[300px]":"h-[108px] w-[220px]"} shrink-0 flex-col rounded-[8px] border p-3 shadow-card transition-colors hover:border-accent/45 ${"working"===i?"border-ok/40 bg-[#f3fbf5] shadow-[0_0_0_3px_rgba(26,138,62,0.12)]":"stalled"===i?"border-err/35 bg-[#fff5f5]":"waiting"===i?"border-[#e0ae45]/45 bg-[#fff9ed]":"border-line bg-panel"}`,role:"button",tabIndex:0,"aria-label":l("switchCard.openColumn",{title:w(b,80)}),onClick:()=>j(a),onKeyDown:b=>{"Enter"===b.key&&j(a)},children:["live"===a.activity?null:(0,d.jsx)("button",{type:"button",className:"absolute right-1.5 top-1.5 z-10 hidden h-5 w-5 items-center justify-center rounded-full border border-line bg-bg text-dim hover:border-err/50 hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 group-hover:flex group-focus-within:flex","aria-label":l("switchCard.remove"),onClick:b=>{b.stopPropagation(),k(a)},onKeyDown:a=>a.stopPropagation(),children:(0,d.jsx)(n,{className:"h-3 w-3","aria-hidden":!0})}),(0,d.jsxs)("div",{className:"relative flex min-w-0 items-center gap-1.5",children:[(0,d.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${ae(a.activity)}`}),a.model?(0,d.jsx)("span",{className:"min-w-0 truncate rounded-full px-1.5 py-0.5 font-mono text-[9px] font-semibold",style:{backgroundColor:am(a).soft,color:am(a).color},title:[m.label,an(a)].filter(Boolean).join(" \xb7 "),children:a.model}):(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 text-[9.5px] font-bold",style:m.style,children:m.label}),(0,d.jsx)(b_,{file:a}),(0,d.jsx)("span",{className:`ml-auto min-w-0 truncate rounded-full border border-line bg-bg px-1.5 py-0.5 text-[9.5px] font-semibold ${c===e?"text-dim":"text-ink"}`,title:c,children:c})]}),(0,d.jsx)("div",{className:`relative mt-2 min-w-0 ${o?"text-[14px]":"text-[12.5px]"} font-bold leading-snug`,title:b,children:(0,d.jsx)("span",{className:"line-clamp-2",children:b})}),(0,d.jsxs)("div",{className:"relative mt-auto flex min-w-0 items-center gap-2 text-[10.5px] font-semibold text-dim",children:[(0,d.jsx)("span",{className:"shrink-0",children:ac(a.mtime)}),a.ctx?(0,d.jsx)(dc,{ctx:a.ctx}):null,f?(0,d.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-0.5",children:[(0,d.jsx)(a0,{className:"h-3 w-3","aria-hidden":!0})," ",f]}):null]}),g?(0,d.jsx)("div",{className:`relative mt-1 min-w-0 truncate ${o?"text-[11.5px]":"text-[10.5px]"} font-semibold text-ink/75`,children:g}):null,a.pid&&"running"===a.proc?(0,d.jsx)("div",{className:"relative mt-2",onClick:a=>a.stopPropagation(),onKeyDown:a=>a.stopPropagation(),children:(0,d.jsx)(c0,{file:a,compact:!0})}):null]})}function e3({title:a,items:b,size:c,currentProject:e,onOpenFile:f,onArchive:g}){return b.length?(0,d.jsxs)("section",{className:"shrink-0",children:[(0,d.jsxs)("div",{className:"mb-2 flex items-baseline gap-2",children:[(0,d.jsx)("h2",{className:"text-[13px] font-bold",children:a}),(0,d.jsx)("span",{className:"text-[11px] font-semibold text-dim",children:b.length})]}),(0,d.jsx)(b0,{className:"flex flex-wrap gap-2.5",enter:"fade",children:b.map(a=>(0,d.jsx)("div",{"data-flip-key":a.file.path,children:(0,d.jsx)(e2,{file:a.file,title:a.title,project:a.project,currentProject:e,descendants:a.descendants,statusLine:a.statusLine,size:c,tone:"working"===a.kind?"working":"waiting"===a.kind&&"stalled"===a.file.activity?"stalled":"waiting"===a.kind?"waiting":"quiet",onOpen:f,onArchive:g})},a.file.path))})]}):null}function e4({files:a,flows:b,project:c,loaded:f,onOpenFile:g}){let{t:h}=v(),[i,j]=(0,e.useState)(!1),[k,l]=(0,e.useState)(""),[m,o]=(0,e.useState)(!1),[p,q]=(0,e.useState)(!1),[r,s]=(0,e.useState)(0),t=(0,e.useRef)(null),u=function(){let[a,b]=(0,e.useState)([]),[c,d]=(0,e.useState)(!1);return{events:a,loading:c}}(),{archivedPaths:x,archive:y,unarchive:z}=function(){let[a,b]=(0,e.useState)(()=>new Set),c=(0,e.useRef)(a);return{archivedPaths:a,archive:(0,e.useCallback)(a=>{b(b=>{if(b.has(a))return b;let d=new Set(b);return d.add(a),c.current=d,e0(d),d})},[]),unarchive:(0,e.useCallback)(a=>{b(b=>{if(!b.has(a))return b;let d=new Set(b);return d.delete(a),c.current=d,e0(d),d})},[])}}(),A=av(a,u.events,k,r,x,b),B=av(a,[],"",r,x,b),C=(0,e.useMemo)(()=>a.filter(a=>x.has(a.path)).map(a=>({file:a,title:w(a.title),project:E(a)})).sort((a,b)=>b.file.mtime-a.file.mtime),[a,x]),D=a=>{g(a),j(!1)},F=a=>y(a.path);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(e1,{data:B,onOpen:()=>j(!0)}),i?(0,d.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-ink/28 p-[2.5vh]",onMouseDown:()=>j(!1),children:(0,d.jsxs)("div",{className:"flex h-[95vh] w-[95vw] flex-col overflow-hidden rounded-[8px] border border-line bg-bg shadow-[0_18px_70px_rgb(20_20_30/0.28)]",role:"dialog","aria-modal":"true","aria-label":h("switch.aria"),onMouseDown:a=>a.stopPropagation(),children:[(0,d.jsxs)("header",{className:"flex h-14 shrink-0 items-center gap-3 border-b border-line bg-panel px-4",children:[(0,d.jsx)("div",{className:"text-[15px] font-bold",children:h("switch.title")}),(0,d.jsx)("input",{ref:t,value:k,onChange:a=>l(a.target.value),placeholder:h("switch.search"),className:"h-9 min-w-0 flex-1 rounded-[8px] border border-line bg-bg px-3 text-[13px] outline-none focus-visible:ring-2 focus-visible:ring-accent/40"}),u.loading?(0,d.jsx)("span",{className:"text-[11px] font-semibold text-dim",children:h("switch.updating")}):null,(0,d.jsx)("button",{className:"inline-flex h-8 w-8 items-center justify-center rounded-[8px] border border-line bg-bg text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":h("switch.close"),onClick:()=>j(!1),children:(0,d.jsx)(n,{className:"h-4 w-4","aria-hidden":!0})})]}),(0,d.jsxs)("div",{className:"min-h-0 flex-1 space-y-5 overflow-y-auto px-4 py-4",children:[(0,d.jsx)(e3,{title:h("switch.waiting"),items:A.waiting,size:"large",currentProject:c,onOpenFile:D,onArchive:F}),(0,d.jsx)(e3,{title:h("switch.working"),items:A.working,size:"large",currentProject:c,onOpenFile:D,onArchive:F}),(0,d.jsx)(e3,{title:h("switch.recent"),items:A.recent,size:"small",currentProject:c,onOpenFile:D,onArchive:F}),(0,d.jsxs)("section",{className:"shrink-0",children:[(0,d.jsxs)("button",{className:"flex h-10 w-full items-center justify-between rounded-[8px] border border-line bg-panel px-3 text-left text-[12.5px] font-bold hover:border-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-expanded":m,onClick:()=>o(a=>!a),children:[(0,d.jsx)("span",{children:h("switch.older")}),(0,d.jsx)("span",{className:"text-dim",children:A.older.length})]}),m?(0,d.jsx)("div",{className:"mt-2",children:(0,d.jsx)(e3,{title:"",items:A.older,size:"small",currentProject:c,onOpenFile:D,onArchive:F})}):null]}),A.waiting.length||A.working.length||A.recent.length||A.older.length?null:f?(0,d.jsx)("div",{className:"pt-[18vh] text-center text-[13px] font-semibold text-dim",children:h("common.nothingFound")}):(0,d.jsxs)("div",{className:"flex items-center justify-center gap-2 pt-[18vh] text-[13px] font-semibold text-dim",children:[(0,d.jsx)(bw,{className:"h-4 w-4 animate-spin","aria-hidden":!0}),h("common.loading")]}),C.length?(0,d.jsxs)("section",{className:"shrink-0",children:[(0,d.jsxs)("button",{className:"flex h-9 w-full items-center justify-between rounded-[8px] border border-line bg-panel px-3 text-left text-[12px] font-bold text-dim hover:border-accent/40 hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-expanded":p,onClick:()=>q(a=>!a),children:[(0,d.jsx)("span",{children:h("switch.hidden",{count:C.length})}),(0,d.jsx)("span",{children:p?h("switch.hide"):h("common.show")})]}),p?(0,d.jsx)("div",{className:"mt-2 space-y-1",children:C.map(a=>(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-2 rounded-[8px] border border-line bg-panel/60 px-3 py-1.5 text-[11.5px] text-dim",children:[(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate",children:a.title}),(0,d.jsx)("span",{className:"shrink-0 truncate text-[10.5px]",children:a.project}),(0,d.jsx)("button",{className:"shrink-0 rounded-full border border-line bg-bg px-2 py-0.5 text-[10.5px] font-semibold text-ink hover:border-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>z(a.file.path),children:h("switch.restore")})]},a.file.path))}):null]}):null]})]})}):null]})}function e5(){location.hash="#p="+encodeURIComponent(x)}function e6({files:a,activeRootPaths:b,onOpen:c}){let{t:e}=v();return(0,d.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto px-4 py-5",children:(0,d.jsxs)("div",{className:"mx-auto w-full max-w-[760px]",children:[(0,d.jsx)("div",{className:"text-[13.5px] font-semibold text-dim",children:e("trash.title")}),(0,d.jsx)("div",{className:"mb-3 mt-0.5 text-[12px] text-dim",children:e("trash.hint")}),(0,d.jsx)("div",{className:"space-y-1.5",children:a.map(a=>(0,d.jsx)(e7,{file:a,activeSubtree:b?.has(a.path)??!1,onOpen:c},a.path))})]})})}function e7({file:a,activeSubtree:b,onOpen:c}){let{t:f}=v(),[g,h]=(0,e.useState)(!1),i=as(a);return g?(0,d.jsxs)("div",{className:"flex items-center gap-2 rounded-[8px] border border-line bg-chip/60 px-3 py-1.5 text-[11.5px] font-semibold text-dim",children:[(0,d.jsx)(bo,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),(0,d.jsx)("span",{className:"min-w-0 truncate",children:w(a.title,80)}),(0,d.jsx)("span",{className:"shrink-0",children:f("trash.deletedFromDisk")})]}):(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-2 rounded-[8px] border border-line bg-panel px-3 py-1.5 shadow-card",children:[(0,d.jsxs)("button",{type:"button",className:"flex h-full min-w-0 flex-1 items-center gap-2 rounded-[6px] text-left hover:bg-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":f("trash.open",{title:w(a.title,60)}),onClick:()=>c(a),children:[(0,d.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${ae(a.activity)}`}),(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 text-[9.5px] font-bold",style:i.style,children:i.label}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12.5px] font-semibold",title:a.path,children:w(a.title,90)}),b?(0,d.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-full border border-accent/25 bg-accent/10 px-1.5 py-0.5 text-[10px] font-bold text-accent",title:f("trash.activeSubtree"),children:[(0,d.jsx)(a_,{className:"h-3 w-3","aria-hidden":!0}),f("trash.activeSubtree")]}):null,(0,d.jsx)("span",{className:"shrink-0 text-[10.5px] font-semibold text-dim",children:ac(a.mtime)}),(0,d.jsxs)("span",{className:"shrink-0 text-[10.5px] text-dim",children:[(a.size/1024).toFixed(0)," ",f("common.kb")]})]}),(0,d.jsx)(b$,{file:a,onDeleted:()=>h(!0)})]})}function e8({files:a,onArchive:b,compact:c=!1}){let{t:e}=v();return!a.length||a.some(a=>"running"===a.proc||"live"===a.activity)?null:(0,d.jsxs)("button",{type:"button",className:`inline-flex shrink-0 items-center gap-1 rounded-full border border-line bg-bg text-[11px] font-semibold text-dim hover:border-accent/40 hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${c?"p-1":"px-2 py-0.5"}`,"aria-label":e("trash.toArchive"),title:e("trash.toArchive"),onClick:()=>{b(),e5()},children:[(0,d.jsx)(a1,{className:"h-3 w-3","aria-hidden":!0})," ",c?null:e("trash.toArchive")]})}function e9({files:a}){let{t:b}=v(),[c,f]=(0,e.useState)(!1),[g,h]=(0,e.useState)(!1),[i,j]=(0,e.useState)("");if(!a.length||a.some(a=>"running"===a.proc||"live"===a.activity))return null;let k=async()=>{h(!0),j("");let c=0;for(let b of a)try{let a=await fetch(`/api/log?path=${encodeURIComponent(b.path)}`,{method:"DELETE"}),d=await a.json();a.ok&&d.ok||(c+=1)}catch{c+=1}(h(!1),f(!1),c)?j(b("trash.notDeleted",{failed:c,total:a.length})):e5()};return c?(0,d.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-[10px] border border-err/30 bg-[#fff5f5] px-1.5 py-0.5 text-[11px]",children:[(0,d.jsx)("span",{className:"px-0.5 font-semibold text-err",children:b("trash.confirmDelete",{count:a.length})}),(0,d.jsx)("button",{type:"button",className:"rounded-lg bg-err px-2 py-0.5 font-bold text-white disabled:opacity-60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-err/50",disabled:g,onClick:k,children:g?b("trash.deleting"):b("trash.confirmYes")}),(0,d.jsx)("button",{type:"button",className:"rounded-lg border border-line bg-panel px-2 py-0.5 font-semibold text-dim focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>f(!1),children:b("common.cancel")})]}):(0,d.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1.5",children:[(0,d.jsx)("button",{type:"button",className:"inline-flex items-center rounded-full border border-line bg-bg p-1 text-dim hover:border-err/40 hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":b("trash.deleteProject"),title:b("trash.deleteProject"),onClick:()=>f(!0),children:(0,d.jsx)(bo,{className:"h-3 w-3","aria-hidden":!0})}),i?(0,d.jsx)("span",{className:"max-w-[180px] truncate text-[10.5px] font-semibold text-err",children:i}):null]})}let fa=k("volume-2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]),fb=k("volume-x",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]]);function fc(){let{t:a}=v(),[b,c]=(0,e.useState)(!0);return(0,d.jsx)("button",{className:"ml-auto inline-flex h-[26px] w-[26px] shrink-0 items-center justify-center rounded-full border border-line bg-panel text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:a(b?"sound.on":"sound.off"),"aria-label":a(b?"sound.mute":"sound.unmute"),"aria-pressed":b,onClick:()=>{let a=!b;c(a);try{localStorage.setItem(az,a?"on":"off")}catch{}a&&function(a=0){(function(){try{localStorage.getItem(az)}catch{return!0}})()}()},children:b?(0,d.jsx)(fa,{className:"h-3.5 w-3.5","aria-hidden":!0}):(0,d.jsx)(fb,{className:"h-3.5 w-3.5","aria-hidden":!0})})}function fd({items:a,activeRootPaths:b,onSelect:c}){let{t:f}=v(),[g,h]=(0,e.useState)(!1);return(0,d.jsxs)("div",{className:"shrink-0 border-t border-line bg-panel",children:[(0,d.jsxs)("button",{className:"flex h-8 items-center gap-2 px-4 text-[10px] font-bold uppercase tracking-[.6px] text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-expanded":g,onClick:()=>h(a=>!a),children:[(0,d.jsx)(a9,{className:`h-3.5 w-3.5 transition-transform ${g?"rotate-90":""}`,"aria-hidden":!0}),f("tree.quiet"),(0,d.jsx)("span",{className:"font-semibold normal-case tracking-normal",children:a.length})]}),g?(0,d.jsx)(b0,{className:"flex max-h-44 flex-wrap items-start gap-1.5 overflow-y-auto px-3 pb-2.5",children:a.map(a=>{let e=as(a),g=w(a.cmdDesc||a.title,70),h=b?.has(a.path)??!1;return(0,d.jsxs)("button",{"data-flip-key":a.path,className:"inline-flex h-7 max-w-[360px] items-center gap-1.5 rounded-full border border-line bg-bg px-2 text-[11px] font-semibold text-ink hover:border-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:w(a.title),onClick:()=>c(a),children:[(0,d.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${ae(a.activity)}`}),(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px]",style:e.style,children:e.label}),(0,d.jsx)("span",{className:"truncate",children:g}),h?(0,d.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-full bg-accent/10 px-1.5 text-[9px] font-bold text-accent",title:f("trash.activeSubtree"),children:[(0,d.jsx)(a_,{className:"h-2.5 w-2.5","aria-hidden":!0}),f("trash.activeSubtree")]}):null,(0,d.jsx)("span",{className:"shrink-0 font-normal text-dim",children:ac(a.mtime)})]},a.path)})}):null]})}let fe=a=>`llvCols:${a}`;function ff(a,b,c=!1){let d=function(a){try{let b=JSON.parse(localStorage.getItem(fe(a))??"{}");return{manual:b.manual??[],hidden:b.hidden??[],expanded:b.expanded??[]}}catch{return{manual:[],hidden:[],expanded:[]}}}(a);c?d.expanded.includes(b)||d.expanded.push(b):d.manual.includes(b)||d.manual.push(b),d.hidden=d.hidden.filter(a=>a!==b),localStorage.setItem(fe(a),JSON.stringify(d))}function fg(a){location.hash="#p="+encodeURIComponent(a)}function fh({files:a,flows:b,workflows:c,tasks:f,project:g,loaded:h,openNonce:i,focusRequest:j,attentionPaths:k,archived:l,onArchive:m,onUnarchive:n,onMenu:o,attention:p}){let{t:q}=v(),r=aT(),s=(0,e.useRef)(null),t=(0,e.useRef)(null),[u,w]=(0,e.useState)({manual:[],hidden:[],expanded:[]}),[x,B]=(0,e.useState)([]),[F,G]=(0,e.useState)("scheme"),[K,N]=(0,e.useState)(null),[O,P]=(0,e.useState)(!1),[Q,R]=(0,e.useState)([]),S=(0,e.useRef)(u),U=()=>{P(a=>(localStorage.setItem("llvTaskPanel",a?"0":"1"),!a))},W=a=>{S.current=a,w(a),localStorage.setItem(fe(g),JSON.stringify(a))},X=(0,e.useMemo)(()=>{let c=b.filter(T),d=function(a,b){let c=V(b),d=new Map;for(let b of a){if(!b.parent)continue;let a=d.get(b.parent);a?a.push(b):d.set(b.parent,[b])}let e=new Set,f=[...c],g=new Set(f);for(;f.length;){let a=f.pop();for(let b of d.get(a)??[])g.has(b.path)||(g.add(b.path),e.add(b.path),f.push(b.path))}return e}(a,c);for(let a of c)d.add(a.implementerPath);return d},[a,b]),Y=(0,e.useMemo)(()=>{let a=new Set(X);for(let b of u.expanded)a.add(b);return a},[X,u.expanded]),Z=(0,e.useMemo)(()=>(function(a,b){let c=new Map;for(let a of b)for(let b of a.rounds)b.reviewerPath&&c.set(b.reviewerPath,a.implementerPath);if(!c.size)return a;let d=[];for(let b of a){if(c.has(b.path))continue;let a=b.parent?c.get(b.parent):void 0;d.push(a?{...b,parent:a}:b)}return d})(a,b),[a,b]),$=(0,e.useMemo)(()=>{let b;return b=new Set(a.filter(a=>a.project===g).map(a=>a.path)),c.filter(a=>"closed"!==a.state&&(!!(a.project===g||a.stageRuns.some(a=>a.agentPath&&b.has(a.agentPath)))||!!(a.fixerPath&&b.has(a.fixerPath))))},[c,g,a]),_=(0,e.useMemo)(()=>M(Z,g,{expandedConversationPaths:Y}),[Z,g,Y]),aa=(0,e.useMemo)(()=>new Set(_.map(a=>a.key)),[_]),ab=(0,e.useMemo)(()=>(function(a,b,c){let d=I(a),e=[];for(let f of a){if(E(f)!==b||!A(f)||c.has(f.path))continue;let a=J(f,d);if(!a.length)continue;let g=f.mtime,h=z(f);for(let b of a)g=Math.max(g,b.mtime),h=Math.min(h,z(b));e.push({root:f,branchCount:a.length,smt:g,band:h})}return e.sort((a,b)=>a.band-b.band||b.smt-a.smt)})(Z,g,aa),[Z,g,aa]),ac=(0,e.useMemo)(()=>(function(a,b,c){let d=I(a),e=new Set;for(let f of a)E(f)===b&&A(f)&&c.has(f.path)&&"idle"===f.activity&&J(f,d).some(L)&&e.add(f.path);return e})(Z,g,aa),[Z,g,aa]),ad=(0,e.useMemo)(()=>(function(a,b,c,d=new Set){let e=I(a);return a.filter(a=>E(a)===b&&!a.parent&&(!!d.has(a.path)||!(c.has(a.path)||e.get(a.path)?.length)&&"live"!==a.activity)).sort((a,b)=>z(a)-z(b)||b.mtime-a.mtime)})(Z,g,aa,ac),[Z,g,aa,ac]),ae=(0,e.useMemo)(()=>new Set(_.flatMap(a=>a.columns.map(a=>a.file.path))),[_]),af=(0,e.useMemo)(()=>new Set(u.hidden),[u.hidden]),ag=(0,e.useMemo)(()=>f.filter(a=>a.project===g),[f,g]),ah=(0,e.useMemo)(()=>{let a=new Map(Z.map(a=>[a.path,a]));return u.manual.map(b=>a.get(b)).filter(a=>void 0!==a&&E(a)===g&&!ae.has(a.path)&&!af.has(a.path))},[u.manual,Z,g,ae,af]),ai=(0,e.useMemo)(()=>{let a=new Map(Z.map(a=>[a.path,a])),b=new Set(ah.map(a=>a.path)),c=Q.map(b=>a.get(b)).filter(a=>void 0!==a&&E(a)===g&&!b.has(a.path)&&(!ae.has(a.path)||af.has(a.path)));return c.length?[...ah,...c]:ah},[Q,Z,g,ae,af,ah]),aj=(0,e.useMemo)(()=>_.reduce((a,b)=>a+b.columns.reduce((a,b)=>a+ +("live"===b.file.activity)+b.tasks.filter(a=>"live"===a.activity).length,0),0),[_]),ak=_.filter(a=>!a.orphanTask).length,al=a=>{N(a),s.current&&window.clearTimeout(s.current),s.current=window.setTimeout(()=>N(null),1800)},am=a=>{B(a),sessionStorage.setItem(`llvDrafts:${g}`,JSON.stringify(a))},an=()=>"function"==typeof crypto.randomUUID?crypto.randomUUID():Date.now().toString(36)+Math.random().toString(36).slice(2,10),ao=()=>{let a=an();am([...x,a]),t.current="draft::"+a},ap=a=>{let b=x.find(b=>""===a.path);if(b)return void al("draft::"+b);let c=an();dp(c,"src",a.path),am([...x,c]),t.current="draft::"+c},aq=a=>{if(aM(a))for(let b of["template","dir","task","mode"])sessionStorage.removeItem(dr(a,b));else for(let b of["engine","cwd","text","boot","src","effort","speed"])sessionStorage.removeItem(dn(a,b));am(x.filter(b=>b!==a))},ar=(a,b)=>{aq(a),at(b)},as=a=>{fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"kill",path:a})}).catch(()=>{});let b=u.manual.filter(b=>b!==a),c=ae.has(a)?[...new Set([...u.hidden,a])]:u.hidden,d=u.expanded.filter(b=>b!==a);W({...u,manual:b,hidden:c,expanded:d}),R(b=>b.includes(a)?b.filter(b=>b!==a):b)},at=a=>{let b=E(a);if(b!==g){ff(b,a.path,C(a)),fg(b);return}if(ae.has(a.path)&&!af.has(a.path)||ah.some(b=>b.path===a.path))return void al(a.path);let c=u.hidden.filter(b=>b!==a.path);if(C(a)){let b=[...new Set([...u.expanded,a.path])];W({...u,hidden:c,expanded:b})}else{let b=ae.has(a.path)?u.manual:[...new Set([...u.manual,a.path])];W({...u,hidden:c,manual:b})}t.current=a.path},au=[];aj?au.push(`${q("dash.branchesLive",{count:aj})} \xb7 ${q("dash.trees",{count:ak})}`):ak&&au.push(q("dash.recentConvos",{count:ak})),ab.length&&au.push(q("dash.quietTrees",{count:ab.length}));let av=_.map(a=>({...a,columns:a.columns.filter(a=>!af.has(a.file.path))})).filter(a=>a.columns.length),aw=av.filter(a=>a.orphanTask).map(a=>a.columns[0].file),ax=av.filter(a=>!a.orphanTask),ay=ax.length>0||ai.length>0||x.length>0||ag.length>0,az=(0,e.useMemo)(()=>a.filter(a=>E(a)===g).sort((a,b)=>b.mtime-a.mtime),[a,g]),aA=(0,e.useMemo)(()=>ay?[]:function(a,b,c=100){let d=new Map(a.map(a=>[a.path,a])),e=I(a),f=new Set(a.filter(a=>E(a)===b).sort((a,b)=>b.mtime-a.mtime||a.path.localeCompare(b.path)).slice(0,c).map(a=>a.path)),g=new Set;for(let a of f){let c=d.get(a)??null,e=new Set;for(;c&&E(c)===b&&!e.has(c.path);)e.add(c.path),g.add(c.path),c=c.parent?d.get(c.parent)??null:null}let h=new Map,i=new Map;for(let a of g){let c=d.get(a);if(!c)continue;let e=H(c,d);E(e)===b&&(D(e)?i.set(e.path,e):h.set(e.path,e))}let j=[];for(let a of h.values()){let c=J(a,e).filter(a=>g.has(a.path)&&E(a)===b).sort((a,b)=>z(a)-z(b)||b.mtime-a.mtime||a.path.localeCompare(b.path)),d=c.filter(a=>!D(a)&&C(a)),f=new Set([a.path,...d.map(a=>a.path)]),h=[a,...d].map(a=>({file:a,tasks:[]})),i=c.filter(a=>!f.has(a.path)),k=Math.max(a.mtime,...c.map(a=>a.mtime));j.push({key:a.path,columns:h,returnable:[],finished:i,smt:k,orphanTask:!1})}for(let a of i.values())j.push({key:a.path,columns:[{file:a,tasks:[]}],returnable:[],finished:[],smt:a.mtime,orphanTask:!0});return j.sort((a,b)=>y(b.smt)-y(a.smt)||a.key.localeCompare(b.key))}(Z.filter(a=>!af.has(a.path)),g,100),[ay,Z,af,g]),aB=aA.length>0,aC=!ay&&aB&&az.length>0,aD=ay||aB&&(!aC||"scheme"===F);return(0,d.jsxs)("div",{className:"relative flex min-h-0 min-w-0 flex-1 flex-col",children:[(0,d.jsxs)("div",{className:"flex h-10 shrink-0 items-center gap-2.5 border-b border-line bg-panel px-4",children:[o?(0,d.jsx)("button",{type:"button",className:"-ml-1.5 flex h-7 w-7 shrink-0 items-center justify-center rounded-[8px] border border-line bg-bg text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":q("dash.openProjects"),onClick:o,children:(0,d.jsx)(aU,{className:"h-4 w-4","aria-hidden":!0})}):null,(0,d.jsx)("h1",{className:"truncate text-[13.5px] font-bold",children:g}),r?null:(0,d.jsx)("span",{className:"truncate text-[11.5px] text-dim",children:au.length?au.join(" \xb7 "):q("common.nothingRunning")}),(0,d.jsx)(fc,{}),l?(0,d.jsxs)("button",{type:"button",className:"inline-flex shrink-0 items-center gap-1 rounded-full border border-line bg-bg px-2 py-0.5 text-[11px] font-semibold text-dim hover:border-accent/40 hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>n(g),children:[(0,d.jsx)(a2,{className:"h-3 w-3","aria-hidden":!0})," ",q("dash.unarchive")]}):(0,d.jsx)(e8,{files:az,onArchive:()=>m(g),compact:r}),(0,d.jsx)(e9,{files:az}),r?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"ml-auto","aria-hidden":!0}),p,(0,d.jsxs)("button",{type:"button",onClick:ao,"aria-label":q("dash.newConvo"),className:"flex shrink-0 items-center gap-1 rounded-[8px] border border-line bg-panel px-2.5 py-1 text-[11.5px] font-bold text-ink shadow-card hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[(0,d.jsx)("span",{className:"text-[13px] leading-none text-accent",children:"+"})," ",q("dash.agent")]})]}):(0,d.jsxs)("button",{type:"button",onClick:U,"aria-pressed":O,"aria-label":q("tasks.panelToggleAria"),className:`ml-auto flex shrink-0 items-center gap-1 rounded-[8px] border px-2.5 py-1 text-[11.5px] font-bold shadow-card focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${O?"border-accent/45 bg-accent/10 text-accent":"border-line bg-panel text-ink hover:border-accent/45 hover:text-accent"}`,children:[(0,d.jsx)(aW,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",q("tasks.panelTitle"),ag.filter(a=>"done"!==a.status).length?(0,d.jsx)("span",{className:"rounded-full bg-accent/10 px-1.5 text-[10px] font-bold text-accent",children:ag.filter(a=>"done"!==a.status).length}):null]}),(0,d.jsxs)("button",{type:"button",onClick:()=>{let a="wf-"+an();am([...x,a]),t.current="draft::"+a},"aria-label":q("dash.newWorkflow"),className:"flex shrink-0 items-center gap-1 rounded-[8px] border border-line bg-panel px-2.5 py-1 text-[11.5px] font-bold text-ink shadow-card hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[(0,d.jsx)("span",{className:"text-[13px] leading-none text-accent",children:"+"})," ",q("dash.workflow")]})]}),$.length?(0,d.jsx)("div",{className:"flex shrink-0 flex-col gap-1.5 border-b border-line bg-[#fbfbfd] px-3 py-1.5",children:$.map(a=>(0,d.jsx)(dw,{wf:a},a.id))}):null,aw.length?(0,d.jsx)("div",{className:"shrink-0 border-b border-line bg-[#fbfbfd]",children:aw.map(a=>(0,d.jsx)("div",{className:`border-l-4 ${"live"===a.activity?"border-l-ok bg-[#f2faf4]":"border-l-[#9a9aa4]"}`,children:(0,d.jsx)(dj,{file:a})},a.path))}):null,r?ay||aB?(0,d.jsx)(eZ,{project:g,groups:ay?ax:aA,manual:ay?ai:[],files:a,flows:b,tasks:ay?ag:[],drafts:ay?x:[],loaded:h,focus:K,onSelect:at,onClose:as,onDraftClose:aq,onDraftSpawned:ar,onHandoff:ap}):az.length?(0,d.jsx)(e6,{files:az,activeRootPaths:ac,onOpen:at}):(0,d.jsx)("div",{className:"flex flex-1 items-center justify-center px-4 py-5 text-center",children:(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"text-[13.5px] font-semibold text-dim",children:q("dash.emptyTitle")}),(0,d.jsx)("div",{className:"mt-0.5 text-[12px] text-dim",children:q("dash.emptyHint")})]})}):(0,d.jsxs)("div",{className:"flex min-h-0 min-w-0 flex-1",children:[(0,d.jsxs)("div",{className:"relative flex min-h-0 min-w-0 flex-1 flex-col",children:[aD?(0,d.jsx)(eX,{project:g,groups:ay?ax:aA,manual:ay?ai:[],files:a,flows:b,tasks:ay?ag:[],drafts:ay?x:[],focus:K,attentionPaths:k,onSelect:at,onClose:as,onDraftClose:aq,onDraftSpawned:ar,onHandoff:ap,onTaskDraft:a=>{let b=an();dp(b,"text",a.text),am([...x,b]),t.current="draft::"+b}}):az.length?(0,d.jsx)(e6,{files:az,activeRootPaths:ac,onOpen:at}):(0,d.jsx)("div",{className:"flex flex-1 items-center justify-center px-4 py-5 text-center",children:(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"text-[13.5px] font-semibold text-dim",children:q("dash.emptyTitle")}),(0,d.jsx)("div",{className:"mt-0.5 text-[12px] text-dim",children:q("dash.emptyHint")})]})}),aC?(0,d.jsx)("div",{className:"absolute left-3 top-3 z-30 inline-flex items-center gap-0.5 rounded-full border border-line bg-panel p-0.5 shadow-card",children:["scheme","list"].map(a=>(0,d.jsxs)("button",{type:"button","aria-pressed":F===a,onClick:()=>(G(a),void localStorage.setItem(`llvEmptyView:${g}`,a)),className:`inline-flex items-center gap-1 rounded-full px-2 py-1 text-[11px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${F===a?"bg-accent/10 text-accent":"text-dim hover:text-ink"}`,children:["scheme"===a?(0,d.jsx)(aX,{className:"h-3 w-3","aria-hidden":!0}):(0,d.jsx)(aY,{className:"h-3 w-3","aria-hidden":!0}),q("scheme"===a?"dash.viewScheme":"dash.viewList")]},a))}):null,(0,d.jsx)("div",{className:"pointer-events-none absolute bottom-4 left-4 z-30 flex items-center gap-2",children:(0,d.jsxs)("button",{type:"button",onClick:ao,"aria-label":q("dash.newConvo"),className:"pointer-events-auto flex shrink-0 items-center gap-1 rounded-[8px] border border-line bg-panel px-3 py-1.5 text-[11.5px] font-bold text-ink shadow-card hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[(0,d.jsx)("span",{className:"text-[13px] leading-none text-accent",children:"+"})," ",q("dash.agent")]})})]}),O?(0,d.jsx)(dB,{tasks:f,project:g,onOpenTask:a=>{if(a.project!==g){sessionStorage.setItem("llvTaskFocus",a.id),fg(a.project);return}al("task::"+a.id)},onClose:U}):null]}),r?null:(0,d.jsx)(e4,{files:a,flows:b,project:g,loaded:h,onOpenFile:at}),!aB&&ad.length?(0,d.jsx)(fd,{items:ad,activeRootPaths:ac,onSelect:at}):null,(0,d.jsx)(dG,{})]})}let fi=k("qr-code",[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]]);function fj(){let{t:a}=v(),[b,c]=(0,e.useState)(!1),[f,g]=(0,e.useState)({status:"idle"}),[h,i]=(0,e.useState)(null),[j,k]=(0,e.useState)(!1),l=(0,e.useRef)(null),m="ready"===f.status&&h&&h.url===f.url?h.dataUrl:null,n=(0,e.useCallback)(()=>{"ready"===f.status&&navigator.clipboard.writeText(f.url).then(()=>{k(!0),window.setTimeout(()=>k(!1),2e3)}).catch(()=>{})},[f]);return(0,d.jsxs)("div",{ref:l,className:"relative ml-auto shrink-0",children:[(0,d.jsx)("button",{type:"button","aria-expanded":b,"aria-label":a("qr.showAria"),onClick:()=>{b||g({status:"idle"}),c(!b)},className:"flex items-center justify-center rounded-[8px] border border-line bg-panel p-1.5 text-dim hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:(0,d.jsx)(fi,{className:"h-4 w-4","aria-hidden":!0})}),b?(0,d.jsx)("div",{className:"fixed left-1/2 top-12 z-50 flex w-[260px] -translate-x-1/2 flex-col gap-2.5 rounded-[12px] border border-line bg-panel p-3 shadow-[0_8px_28px_rgba(20,20,30,0.14)] sm:absolute sm:left-0 sm:right-auto sm:top-full sm:mt-1.5 sm:translate-x-0",children:"idle"===f.status?(0,d.jsx)("span",{className:"text-[12px] text-ink",children:a("common.loading")}):"error"===f.status?(0,d.jsx)("span",{className:"text-[12px] font-semibold text-err",children:a("qr.failed")}):"unavailable"===f.status?(0,d.jsxs)("span",{className:"text-[12px] leading-relaxed text-ink",children:[a("qr.startHint"),(0,d.jsx)("code",{className:"break-all rounded bg-chip px-1 py-0.5 font-mono text-[11px]",children:"bunx agent-log-viewer --tailscale"})]}):(0,d.jsxs)(d.Fragment,{children:[m?(0,d.jsx)("img",{src:m,alt:a("qr.alt"),className:"mx-auto h-[220px] w-[220px]"}):(0,d.jsx)("span",{className:"text-[12px] text-ink",children:a("qr.generating")}),(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsx)("input",{readOnly:!0,value:f.url,"aria-label":a("qr.linkAria"),onFocus:a=>a.currentTarget.select(),className:"min-w-0 flex-1 truncate rounded-[8px] border border-line bg-bg px-2 py-1.5 font-mono text-[10.5px] text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40"}),(0,d.jsx)("button",{type:"button","aria-label":a("qr.copy"),onClick:n,className:"flex shrink-0 items-center gap-1 rounded-[8px] border border-line bg-panel px-2 py-1.5 text-[11px] font-semibold text-dim hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:j?(0,d.jsx)(a8,{className:"h-3.5 w-3.5","aria-hidden":!0}):(0,d.jsx)(bd,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),(0,d.jsx)("span",{className:"text-[10.5px] text-dim",children:a("qr.scanHint")})]})}):null]})}function fk(){let{locale:a,t:b,setLocale:c}=v(),e="en"===a?"uk":"en";return(0,d.jsx)("button",{className:"inline-flex h-[26px] shrink-0 items-center justify-center rounded-full border border-line bg-panel px-2 text-[10.5px] font-bold text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:b("lang.aria"),"aria-label":b("lang.aria"),onClick:()=>c(e),children:a.toUpperCase()})}let fl=(a=r())=>"uk"===a?"uk-UA":"en-US";function fm({label:a,window:b,engineColor:c,now:e}){var f,g;let h,i,j,k,{t:l}=v();if(!b)return null;let m=Math.max(0,Math.min(100,100-b.usedPercent)),n=m<=10?"#c62828":m<=30?"#d29a2f":c;return(0,d.jsxs)("div",{className:"mt-1.5",children:[(0,d.jsxs)("div",{className:"flex items-baseline justify-between",children:[(0,d.jsx)("span",{className:"text-[11px] font-semibold text-ink",children:a}),(0,d.jsxs)("span",{className:"text-[11px] text-dim",children:[l("limits.left")," ",(0,d.jsxs)("span",{className:`font-bold tabular-nums ${m<=30?"":"text-ink"}`,style:m<=30?{color:n}:void 0,children:[Math.round(m),"%"]})]})]}),(0,d.jsx)("div",{className:"mt-1 h-[4px] overflow-hidden rounded-full bg-chip",children:(0,d.jsx)("div",{className:"h-full rounded-full transition-[width] duration-700 ease-out",style:{width:Math.max(m,1.5)+"%",backgroundColor:n}})}),b.resetsAt?(0,d.jsx)("div",{className:"mt-[3px] text-[10px] leading-none text-dim",children:l("limits.reset",{eta:(f=b.resetsAt,h=r(),(i=f-e)<=60?u(h,"limits.now"):i<5400?u(h,"limits.inMin",{n:Math.round(i/60)}):i<129600?u(h,"limits.inHour",{n:Math.round(i/3600)}):u(h,"limits.inDay",{n:Math.round(i/86400)})),at:(g=b.resetsAt,k=(j=new Date(1e3*g)).toLocaleTimeString(fl(),{hour:"2-digit",minute:"2-digit",hour12:!1}),g-e<86400?k:j.toLocaleDateString(fl(),{day:"numeric",month:"short"})+" "+k)})}):null]})}function fn({label:a,engine:b,limits:c,now:e,staleHint:f}){let{t:g}=v();if(!c||!c.session&&!c.weekly)return null;let h=af[b]??ag,i=c.capturedAt&&e-c.capturedAt>1200?ac(c.capturedAt):null;return(0,d.jsxs)("div",{className:`mt-2.5 first:mt-0 ${f?"opacity-60":""}`,children:[(0,d.jsxs)("div",{className:"flex items-baseline gap-1.5",children:[(0,d.jsx)("span",{className:"text-[11.5px] font-bold",style:{color:h.color},children:a}),c.plan?(0,d.jsx)("span",{className:"truncate text-[10px] text-dim",children:c.plan}):null,f?(0,d.jsx)("span",{className:"truncate text-[10px] text-dim",children:f}):null,i?(0,d.jsx)("span",{className:"h-1.5 w-1.5 shrink-0 self-center rounded-full bg-[#d29a2f]",title:g("limits.stale",{stale:i})}):null]}),(0,d.jsx)(fm,{label:g("limits.5h"),window:c.session,engineColor:h.color,now:e}),(0,d.jsx)(fm,{label:g("limits.week"),window:c.weekly,engineColor:h.color,now:e})]})}function fo(){let{locale:a}=v(),[b,c]=(0,e.useState)(null);if(!b||!b.data.claude&&!b.data.codex)return null;let f=function(a,b){if(!a)return null;let c=new Date(a);return Number.isNaN(c.getTime())?null:u(b,"limits.asOf",{time:c.toLocaleTimeString(fl(b),{hour:"2-digit",minute:"2-digit",hour12:!1})})}(b.data.staleSince,a);return(0,d.jsxs)("div",{className:"shrink-0 border-t border-line px-3.5 pb-3 pt-2.5",children:[(0,d.jsx)(fn,{label:"Claude",engine:"claude",limits:b.data.claude,now:b.at,staleHint:f}),(0,d.jsx)(fn,{label:"Codex",engine:"codex",limits:b.data.codex,now:b.at,staleHint:f})]})}let fp=k("bell",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]),fq=k("bell-off",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]]);function fr(){let{t:a}=v(),[b,c]=(0,e.useState)(!1),[f,g]=(0,e.useState)(!1),h=async()=>{if(!f||"default"===Notification.permission&&"granted"!==await Notification.requestPermission()||"granted"!==Notification.permission)return;let a=await navigator.serviceWorker.register("/question-push-sw.js"),b=await a.pushManager.getSubscription();if(b){await b.unsubscribe(),c(!1);return}let d=await (await fetch("/api/push")).json(),e=await a.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:function(a){let b=atob((a+"=".repeat((4-a.length%4)%4)).replace(/-/g,"+").replace(/_/g,"/")),c=new Uint8Array(b.length);for(let a=0;a<b.length;a+=1)c[a]=b.charCodeAt(a);return c.buffer.slice(0)}(d.publicKey)});await fetch("/api/push",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)}),c(!0)};return(0,d.jsx)("button",{className:"inline-flex h-[26px] w-[26px] shrink-0 items-center justify-center rounded-full border border-line bg-panel text-dim hover:text-ink disabled:opacity-45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:a(f?b?"push.enabled":"push.enable":"push.needsHttps"),"aria-label":a(f?b?"push.disable":"push.enable":"push.needsHttps"),"aria-pressed":b,disabled:!f,onClick:h,children:b?(0,d.jsx)(fp,{className:"h-3.5 w-3.5","aria-hidden":!0}):(0,d.jsx)(fq,{className:"h-3.5 w-3.5","aria-hidden":!0})})}let fs=[2,6,12];function ft(a){return a>=0x280000000?Math.round(a/0x40000000)+" GiB":a>=0x40000000?(a/0x40000000).toFixed(1)+" GiB":Math.max(0,Math.round(a/1048576))+" MiB"}function fu({label:a,usedPercent:b,color:c,note:e}){let f=Math.max(1.5,Math.min(100,b));return(0,d.jsxs)("div",{className:"mt-1.5 first:mt-0",children:[(0,d.jsxs)("div",{className:"flex items-baseline justify-between",children:[(0,d.jsx)("span",{className:"text-[11px] font-semibold text-ink",children:a}),(0,d.jsx)("span",{className:"text-[11px] tabular-nums text-dim",children:e})]}),(0,d.jsx)("div",{className:"mt-1 h-[4px] overflow-hidden rounded-full bg-chip",children:(0,d.jsx)("div",{className:"h-full rounded-full transition-[width] duration-700 ease-out",style:{width:f+"%",backgroundColor:c}})})]})}function fv(){let{t:a}=v(),[b,c]=(0,e.useState)(null),[f,g]=(0,e.useState)(!1),h=(0,e.useRef)(null),i=(0,e.useRef)(async()=>{}),j=b?.data.system??null,k=b?.data.sessions??[];if(!b||!j&&0===k.length)return null;let l=j?100*(j.ramTotal-j.ramAvailable)/j.ramTotal:0,m=j?100*j.ramAvailable/j.ramTotal:100,n=j&&j.swapTotal>0?100*j.swapUsed/j.swapTotal:0;return(0,d.jsxs)("div",{ref:h,className:"relative shrink-0 border-t border-line",children:[(0,d.jsxs)("button",{type:"button","aria-expanded":f,"aria-label":a("resources.openAria"),onClick:()=>g(a=>!a),className:"block w-full px-3.5 pb-2.5 pt-2 text-left hover:bg-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[b.staleSince?(0,d.jsx)("span",{className:"absolute right-2 top-2 h-1.5 w-1.5 rounded-full bg-[#d29a2f]",title:a("resources.stale",{stale:ac(b.staleSince)})}):null,j?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(fu,{label:a("resources.ram"),usedPercent:l,color:m<10?"#c62828":m<30?"#d29a2f":"#9a9aa4",note:a("resources.free",{amount:ft(j.ramAvailable)})}),j.swapTotal>0?(0,d.jsx)(fu,{label:a("resources.swap"),usedPercent:n,color:n>85?"#c62828":n>60?"#d29a2f":"#9a9aa4",note:a("resources.used",{amount:ft(j.swapUsed)})}):null]}):(0,d.jsx)("span",{className:"text-[11px] font-semibold text-ink",children:a("resources.title")})]}),f?(0,d.jsx)(fx,{sessions:k,now:b.at,onRefresh:()=>i.current(!0),onClose:()=>g(!1)}):null]})}async function fw(a){let b=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"kill-target",target:a.target})});return b.ok?null:(await b.json().catch(()=>({}))).error??String(b.status)}function fx({sessions:a,now:b,onRefresh:c,onClose:f}){let{t:g}=v(),[h,i]=(0,e.useState)(new Set),[j,k]=(0,e.useState)(null),[l,m]=(0,e.useState)(null),[o,p]=(0,e.useState)(2),[q,r]=(0,e.useState)(!1),[s,t]=(0,e.useState)(!1),[u,w]=(0,e.useState)(!1),x=(a,b)=>i(c=>{let d=new Set(c);return b?d.add(a):d.delete(a),d}),y=async a=>{m(null),t(!1),x(a.target,!0);try{let b=await fw(a);b&&m(b),await c()}finally{x(a.target,!1),k(null)}},z=c=>{let d=(b-3600*c)*1e3;return a.filter(a=>"live"!==a.activity&&null!==a.lastActiveAt&&Date.parse(a.lastActiveAt)<d)},A=async()=>{let a=z(o);if(0!==a.length&&!q){m(null),t(!1),r(!0);try{for(let b of a){x(b.target,!0);let a=await fw(b);a&&m(a)}await c()}finally{i(new Set),r(!1)}}},B=async()=>{if(0!==a.length&&!u){m(null),w(!0);try{for(let b of a){x(b.target,!0);let a=await fw(b);a&&m(a)}await c()}finally{i(new Set),w(!1),t(!1)}}},C=a.reduce((a,b)=>a+b.rssBytes+b.swapBytes,0),D=z(o).length;return(0,d.jsxs)("div",{className:"fixed bottom-3 left-1/2 z-50 flex w-[min(430px,calc(100vw-16px))] -translate-x-1/2 flex-col rounded-[12px] border border-line bg-panel shadow-[0_8px_28px_rgba(20,20,30,0.14)] sm:absolute sm:bottom-1 sm:left-full sm:ml-2 sm:translate-x-0",children:[(0,d.jsxs)("header",{className:"flex items-center gap-2 border-b border-line px-3 py-2",children:[(0,d.jsx)("span",{className:"text-[12.5px] font-bold",children:g("resources.title")}),a.length?(0,d.jsx)("span",{className:"text-[11px] tabular-nums text-dim",children:g("resources.total",{amount:ft(C)})}):null,(0,d.jsx)("button",{type:"button","aria-label":g("resources.close"),onClick:f,className:"ml-auto rounded-[6px] p-1 text-dim hover:bg-bg hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:(0,d.jsx)(n,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),(0,d.jsx)("div",{className:"max-h-[min(420px,60vh)] overflow-y-auto py-1",children:0===a.length?(0,d.jsx)("div",{className:"px-3 py-4 text-center text-[12px] text-dim",children:g("resources.empty")}):a.map(a=>(0,d.jsx)(fy,{session:a,busy:h.has(a.target),armed:j===a.target,onArm:()=>k(a.target),onKill:()=>void y(a)},a.target))}),(0,d.jsxs)("footer",{className:"flex items-center gap-2 border-t border-line px-3 py-2",children:[(0,d.jsx)("span",{className:"text-[11px] text-dim",children:g("resources.bulkLabel")}),(0,d.jsx)("select",{value:o,onChange:a=>p(Number(a.target.value)),className:"rounded-[8px] border border-line bg-bg px-1.5 py-1 text-[11px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:fs.map(a=>(0,d.jsx)("option",{value:a,children:g("resources.hoursN",{n:a})},a))}),(0,d.jsxs)("button",{type:"button",disabled:q||0===D,title:0===D?g("resources.bulkNone"):void 0,onClick:()=>void A(),className:"ml-auto rounded-[8px] border border-err/40 px-2.5 py-1 text-[11px] font-semibold text-err hover:bg-err/10 disabled:cursor-not-allowed disabled:opacity-45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-err/40",children:[g("resources.bulkKill"),D?` (${D})`:""]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2 border-t border-line px-3 py-2",children:[(0,d.jsx)("span",{className:"text-[13px] leading-none text-err","aria-hidden":!0,children:"⚠"}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[10.5px] text-dim",title:g("resources.killAllHint"),children:g("resources.killAllHint")}),(0,d.jsx)("button",{type:"button",disabled:u||0===a.length,title:0===a.length?g("resources.killAllNone"):g("resources.killAllHint"),onClick:()=>s?void B():t(!0),className:["shrink-0 rounded-[8px] border px-2.5 py-1 text-[11px] font-semibold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-err/40 disabled:cursor-not-allowed disabled:opacity-45",s?"border-err bg-err text-white":"border-err/40 text-err hover:bg-err/10"].join(" "),children:s?g("resources.killAllConfirm",{n:a.length}):g("resources.killAll")+(a.length?` (${a.length})`:"")})]}),l?(0,d.jsx)("div",{className:"border-t border-line px-3 py-1.5 text-[11px] font-semibold text-err",children:l}):null]})}function fy({session:a,busy:b,armed:c,onArm:e,onKill:f}){var g;let{t:h}=v(),i=af[a.engine??""]??ag,j="live"===a.activity,k=null!==a.lastActiveAt?Date.parse(a.lastActiveAt)/1e3:null,l=j&&!c;return(0,d.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 hover:bg-bg",children:[(0,d.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${ae(a.activity??"idle")}`}),(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 text-[10px] font-bold",style:{backgroundColor:i.soft,color:i.color},children:"codex"===a.engine?"Codex":"claude"===a.engine?"Claude":"?"}),(0,d.jsxs)("span",{className:"min-w-0 flex-1",title:[a.cwd,a.target,h("resources.procs",{count:a.procCount})].filter(Boolean).join(" \xb7 "),children:[(0,d.jsx)("span",{className:"block truncate text-[12px] font-semibold",children:a.title??(a.cwd?(g=a.cwd).split("/").filter(Boolean).slice(-2).join("/")||g:h("resources.orphan"))}),(0,d.jsxs)("span",{className:"block truncate text-[10.5px] text-dim",children:[null===a.title?h("resources.orphan")+" \xb7 ":a.project?a.project+" \xb7 ":"",null!==k?ac(k):a.target]})]}),(0,d.jsxs)("span",{className:"shrink-0 text-right",children:[(0,d.jsx)("span",{className:"block text-[11.5px] font-bold tabular-nums",children:ft(a.rssBytes)}),a.swapBytes>0?(0,d.jsx)("span",{className:"block text-[10px] tabular-nums text-dim",children:h("resources.swapShare",{amount:ft(a.swapBytes)})}):null]}),(0,d.jsx)("button",{type:"button",disabled:b,"aria-disabled":l||b,title:h(j?"resources.killLiveHint":"resources.killHint"),onClick:()=>l?e():f(),className:["shrink-0 rounded-[8px] border px-2 py-1 text-[11px] font-semibold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-err/40",b?"cursor-wait opacity-50":"",c?"border-err bg-err text-white":l?"border-line text-dim opacity-60 hover:opacity-90":"border-err/40 text-err hover:bg-err/10"].join(" "),children:h(c?"resources.confirm":"resources.kill")})]})}function fz({files:a,workflows:b,archivedProjects:c,selected:f,loaded:g,now:h,onSelect:i}){let{t:j}=v(),[k,l]=(0,e.useState)(""),[m,n]=(0,e.useState)(!1),o=(0,e.useMemo)(()=>G(a,h,b),[a,h,b]),p=(0,e.useMemo)(()=>{let a=k.trim().toLowerCase();return a?o.filter(b=>b.project.toLowerCase().includes(a)):o},[o,k]),q=(0,e.useMemo)(()=>p.filter(a=>!c.has(a.project)),[p,c]),r=(0,e.useMemo)(()=>p.filter(a=>c.has(a.project)),[p,c]),s=(0,e.useMemo)(()=>o.reduce((a,b)=>a+b.liveCount,0),[o]),t=(0,e.useMemo)(()=>o.reduce((a,b)=>a+b.attentionCount,0),[o]);return(0,d.jsxs)("aside",{className:"flex w-[248px] shrink-0 flex-col border-r border-line bg-panel",children:[(0,d.jsxs)("header",{className:"flex h-10 shrink-0 items-center gap-2 border-b border-line px-4 text-[13.5px] font-bold",children:[j("rail.title"),s?(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-[#e5f6ea] px-2 py-0.5 text-[10.5px] font-bold text-ok",children:[(0,d.jsx)("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-ok"}),s]}):null,t?(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-[#fff1ca] px-2 py-0.5 text-[10.5px] font-bold text-[#8a5a00]",children:["⏸ ",t]}):null,(0,d.jsx)(fk,{}),(0,d.jsx)(fj,{}),(0,d.jsx)(fr,{})]}),(0,d.jsx)("div",{className:"px-2.5 pb-1 pt-2.5",children:(0,d.jsx)("input",{className:"w-full rounded-[9px] border border-line bg-bg px-2.5 py-1.5 text-[12px] outline-none focus-visible:ring-2 focus-visible:ring-accent/40",placeholder:j("rail.filter"),value:k,onChange:a=>l(a.target.value)})}),(0,d.jsxs)("nav",{className:"flex-1 overflow-y-auto px-2 pb-3 pt-1","aria-label":j("rail.projects"),children:[(0,d.jsx)(fA,{label:j("rail.overview"),live:0,attention:0,total:null,age:"",active:f===x,hasLive:!1,onClick:()=>i(x)}),(0,d.jsx)("div",{className:"mx-2.5 my-1.5 border-t border-line"}),(0,d.jsx)(b0,{children:q.map(a=>(0,d.jsx)("div",{"data-flip-key":a.project,children:(0,d.jsx)(fA,{label:a.project,live:a.liveCount,attention:a.attentionCount,total:a.conversations,age:ac(a.smt),active:f===a.project,hasLive:a.liveCount>0,onClick:()=>i(a.project)})},a.project))}),r.length?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"mx-2.5 my-1.5 border-t border-line"}),(0,d.jsxs)("button",{type:"button",className:"mb-0.5 flex w-full items-center gap-1.5 rounded-[10px] px-2.5 py-1.5 text-left text-[11.5px] font-bold text-dim hover:bg-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-expanded":m,onClick:()=>n(a=>!a),children:[(0,d.jsx)(a9,{className:`h-3 w-3 shrink-0 transition-transform ${m?"rotate-90":""}`,"aria-hidden":!0}),(0,d.jsx)(a1,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),j("rail.archive"),(0,d.jsx)("span",{className:"font-semibold",children:r.length})]}),m?r.map(a=>(0,d.jsx)(fA,{label:a.project,live:a.liveCount,attention:a.attentionCount,total:a.conversations,age:ac(a.smt),active:f===a.project,hasLive:a.liveCount>0,onClick:()=>i(a.project)},a.project)):null]}):null,q.length||r.length?null:g?(0,d.jsx)("div",{className:"px-3 py-4 text-center text-[12px] text-dim",children:j("common.nothingFound")}):(0,d.jsxs)("div",{className:"flex items-center justify-center gap-2 px-3 py-4 text-[12px] text-dim",children:[(0,d.jsx)(bw,{className:"h-4 w-4 animate-spin","aria-hidden":!0}),j("common.loading")]})]}),(0,d.jsx)(fv,{}),(0,d.jsx)(fo,{})]})}function fA({label:a,live:b,attention:c,total:e,age:f,active:g,hasLive:h,onClick:i}){return(0,d.jsxs)("button",{className:["mb-0.5 flex w-full items-center gap-2 rounded-[10px] border px-2.5 py-2 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",g?"border-line bg-bg shadow-card":"border-transparent hover:bg-bg"].join(" "),"aria-current":g?"page":void 0,onClick:i,children:[(0,d.jsx)("span",{className:["h-2 w-2 shrink-0 rounded-full",h?"animate-pulse bg-ok":"bg-[#d6d6dd]"].join(" ")}),(0,d.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,d.jsx)("span",{className:`block truncate text-[13px] ${g?"font-bold":"font-semibold"}`,children:a}),f?(0,d.jsx)("span",{className:"block text-[10.5px] text-dim",children:f}):null]}),b>0?(0,d.jsx)("span",{className:"shrink-0 rounded-full bg-[#e5f6ea] px-1.5 py-0.5 text-[10.5px] font-bold text-ok",children:b}):null,c>0?(0,d.jsxs)("span",{className:"shrink-0 rounded-full bg-[#fff1ca] px-1.5 py-0.5 text-[10.5px] font-bold text-[#8a5a00]",children:["⏸ ",c]}):null,null!==e?(0,d.jsx)("span",{className:"shrink-0 text-[11px] font-semibold text-dim",children:e}):null]})}function fB(){let a,{t:b}=v(),{files:c,flows:f,workflows:g,tasks:h,loaded:i}=function(){let[a,b]=(0,e.useState)(aQ);return a}(),j=(a=(0,e.useSyncExternalStore)(R,()=>P,()=>S),(0,e.useMemo)(()=>f.some(b=>a.has(b.id)&&"closed"!==b.state)?f.map(b=>a.has(b.id)&&"closed"!==b.state?{...b,state:"closed",closedAt:b.closedAt??new Date().toISOString()}:b):f,[f,a]));(0,e.useRef)(null),(0,e.useRef)(new Set);let{archivedProjects:k,archiveProject:o,unarchiveProject:p}=function(){let[a,b]=(0,e.useState)(()=>new Set),c=(0,e.useRef)(a);return{archivedProjects:a,archiveProject:(0,e.useCallback)(a=>{b(b=>{if(b.has(a))return b;let d=new Set(b);return d.add(a),c.current=d,aA(d),d})},[]),unarchiveProject:(0,e.useCallback)(a=>{b(b=>{if(!b.has(a))return b;let d=new Set(b);return d.delete(a),c.current=d,aA(d),d})},[])}}(),q=aT(),[r,s]=(0,e.useState)(!1),[t,u]=(0,e.useState)(x),[y,z]=(0,e.useState)(null),[A,B]=(0,e.useState)(null);(0,e.useRef)(null);let[D,F]=(0,e.useState)(0),G=(0,e.useCallback)(a=>{u(a),localStorage.setItem("llvProject",a),a!==x?history.replaceState(null,"","#p="+encodeURIComponent(a)):history.replaceState(null,"",location.pathname),s(!1)},[]),H=(0,e.useCallback)(a=>{let b=E(a);ff(b,a.path,C(a)),G(b),F(a=>a+1)},[G]),[I,J]=(0,e.useState)(()=>Date.now()/1e3),K=(0,e.useMemo)(()=>(function(a,b=Date.now()/1e3){let c=[];for(let d of a){let a=N(d,b);if(null===a)continue;let e=d.pendingQuestion||d.waitingInput?"blocked":"stalled",f=d.pendingQuestion?function(a){let b=Date.parse(a);return Number.isFinite(b)?b/1e3:null}(d.pendingQuestion.askedAt)??d.mtime:d.waitingInput?d.waitingInput.since:d.mtime;c.push({id:a,file:d,project:E(d),tier:e,since:f})}return c.sort((a,b)=>(a.tier===b.tier?0:"blocked"===a.tier?-1:1)||a.since-b.since||a.id.localeCompare(b.id))})(c,I),[c,I]),[L,M]=(0,e.useState)(!1),O=(0,e.useRef)(null),[Q,T]=(0,e.useState)(!1),[U,V]=(0,e.useState)(null),W=(0,e.useCallback)(a=>{V(b=>({path:a,nonce:(b?.nonce??0)+1}))},[]),X=(0,e.useRef)(null),Y=(0,e.useMemo)(()=>K.map(a=>a.file.path).sort().join("\n"),[K]),Z=(0,e.useMemo)(()=>Q?new Set(Y.split("\n").filter(Boolean)):null,[Q,Y]);(0,e.useMemo)(()=>t===x?[]:K.filter(a=>a.project===t),[K,t]);let $=(0,e.useCallback)(a=>{M(!1),a.project!==t&&G(a.project),X.current=a.id,W(a.file.path)},[t,G,W]),_=A?c.find(a=>a.path===A):null,aa=K.length?(0,d.jsxs)("div",{ref:O,className:"pointer-events-auto relative",children:[(0,d.jsxs)("div",{className:"flex items-center overflow-hidden rounded-full border border-[#e0ae45]/45 bg-[#fff9ed] shadow-card",children:[(0,d.jsx)("button",{type:"button",className:"px-3 py-1 text-[12px] font-bold text-[#8a5a00] hover:bg-[#e0ae45]/15 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent/40","aria-expanded":L,"aria-label":b("attention.badge",{count:K.length}),title:b("attention.openQueue"),onClick:()=>M(a=>!a),children:q?(0,d.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,d.jsx)(l,{className:"h-3 w-3","aria-hidden":!0})," ",K.length]}):b("attention.badge",{count:K.length})}),q?null:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"h-4 w-px shrink-0 bg-[#e0ae45]/45","aria-hidden":!0}),(0,d.jsx)("button",{type:"button",className:`px-2 py-1.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent/40 ${Q?"bg-[#e0ae45]/30 text-[#8a5a00]":"text-[#b8860b]/70 hover:bg-[#e0ae45]/15 hover:text-[#8a5a00]"}`,"aria-pressed":Q,title:Q?b("attention.filterOff"):b("attention.filterOn"),"aria-label":Q?b("attention.filterOff"):b("attention.filterOn"),onClick:()=>T(a=>!a),children:(0,d.jsx)(m,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})]}),L?(0,d.jsxs)("div",{className:`${q?"fixed inset-x-3 top-12":"absolute right-0 top-[calc(100%+6px)] w-[340px] max-w-[calc(100vw-2rem)]"} z-50 max-h-[60vh] overflow-y-auto rounded-[10px] border border-line bg-panel p-1.5 shadow-card`,children:[(0,d.jsx)("div",{className:"px-2.5 pb-1 pt-1.5 text-[10.5px] font-bold uppercase tracking-wide text-dim",children:b("attention.popoverTitle")}),K.map(a=>(0,d.jsxs)("button",{type:"button",className:"flex w-full min-w-0 flex-col gap-0.5 rounded-[8px] px-2.5 py-2 text-left hover:bg-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>$(a),children:[(0,d.jsxs)("span",{className:"flex w-full min-w-0 items-center gap-1.5",children:[(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12px] font-semibold text-ink",children:w(a.file.title,90)}),(0,d.jsx)("span",{className:"shrink-0 rounded-full border border-line bg-bg px-1.5 text-[10px] font-semibold text-dim",children:a.project}),(0,d.jsx)("span",{className:"shrink-0 text-[10.5px] text-dim",children:ac(a.since)})]}),(0,d.jsx)("span",{className:`w-full truncate text-[11px] ${"stalled"===a.tier?"text-[#b8860b]":"text-dim"}`,children:function(a,b){let c=b.file.pendingQuestion;if(c){if("plan"===c.kind)return a("status.awaitingPlan");let b=c.questions?.[0];return b?.header||b?.question.split("\n")[0]||a("status.awaitingAnswer")}let d=b.file.waitingInput;return d?d.menu?.question.split("\n")[0]||d.screenTail||a("status.awaitingTerminal"):a("status.stalled")}(b,a)})]},a.id))]}):null]}):null;return(0,d.jsxs)("div",{className:"flex h-full",children:[q?null:(0,d.jsx)(fz,{files:c,workflows:g,archivedProjects:k,selected:t,now:I,loaded:i,onSelect:G}),q&&r?(0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex",children:[(0,d.jsx)(fz,{files:c,workflows:g,archivedProjects:k,selected:t,now:I,loaded:i,onSelect:G}),(0,d.jsx)("button",{type:"button",className:"min-w-0 flex-1 bg-ink/35","aria-label":b("viewer.closeProjects"),onClick:()=>s(!1)})]}):null,(0,d.jsxs)("main",{className:"flex min-w-0 flex-1 flex-col",children:[(0,d.jsxs)("div",{className:"pointer-events-none fixed right-4 top-4 z-50 flex flex-col items-end gap-2",children:[q?null:aa,_?(0,d.jsxs)("div",{className:"pointer-events-auto flex max-w-[360px] gap-2 rounded-[8px] border border-[#e0ae45]/45 bg-[#fff9ed] px-4 py-3 text-[13px] font-semibold text-ink shadow-card",children:[(0,d.jsxs)("button",{className:"min-w-0 flex-1 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>{H(_),B(null)},children:[(0,d.jsx)("span",{className:"block text-[11px] font-bold text-[#8a5a00]",children:b("viewer.agentWaiting")}),(0,d.jsx)("span",{className:"line-clamp-2",children:_.title})]}),(0,d.jsx)("button",{className:"mt-0.5 flex h-6 w-6 shrink-0 items-center justify-center rounded-full border border-line bg-bg text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":b("viewer.closeNotification"),onClick:()=>B(null),children:(0,d.jsx)(n,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}):null]}),t===x?(0,d.jsx)(aV,{files:c,workflows:g,archivedProjects:k,now:I,onSelectProject:G,onSelectFile:H,onMenu:q?()=>s(!0):void 0,attention:q?aa:void 0}):(0,d.jsx)(fh,{files:c,flows:j,workflows:g,tasks:h,project:t,loaded:i,openNonce:D,focusRequest:U,attentionPaths:Z,archived:k.has(t),onArchive:o,onUnarchive:p,onMenu:q?()=>s(!0):void 0,attention:q?aa:void 0})]})]})}},78335:()=>{},79428:a=>{"use strict";a.exports=require("buffer")},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},95487:(a,b,c)=>{Promise.resolve().then(c.bind(c,77845))},96487:()=>{},98058:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,95547,23))}};var b=require("../webpack-runtime.js");b.C(a);var c=b.X(0,[741,319,918],()=>b(b.s=32076));module.exports=c})();
|