agent-log-viewer 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +171 -51
- package/bin/cli.mjs +89 -22
- package/bin/tailscale.mjs +101 -41
- package/dist/standalone/.next/BUILD_ID +1 -1
- package/dist/standalone/.next/app-path-routes-manifest.json +6 -5
- package/dist/standalone/.next/build-manifest.json +2 -2
- package/dist/standalone/.next/prerender-manifest.json +3 -3
- package/dist/standalone/.next/routes-manifest.json +6 -0
- package/dist/standalone/.next/server/app/_global-error/page.js +2 -2
- 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.js +2 -2
- 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 +4 -4
- package/dist/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +4 -4
- 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 +2 -2
- 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 +2 -2
- package/dist/standalone/.next/server/app/api/access/route.js +1 -1
- package/dist/standalone/.next/server/app/api/answer/route.js +1 -1
- package/dist/standalone/.next/server/app/api/files/route.js +1 -1
- package/dist/standalone/.next/server/app/api/flows/[id]/route.js +1 -1
- package/dist/standalone/.next/server/app/api/flows/[id]/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/flows/route.js +1 -1
- package/dist/standalone/.next/server/app/api/flows/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/inbox/route.js +1 -1
- package/dist/standalone/.next/server/app/api/limits/route.js +1 -1
- package/dist/standalone/.next/server/app/api/log/route.js +1 -1
- package/dist/standalone/.next/server/app/api/proc/route.js +1 -1
- package/dist/standalone/.next/server/app/api/push/route.js +1 -1
- package/dist/standalone/.next/server/app/api/spawn/route.js +1 -1
- package/dist/standalone/.next/server/app/api/timeline/route.js +1 -1
- package/dist/standalone/.next/server/app/api/tmux/route.js +2 -2
- package/dist/standalone/.next/server/app/api/transcribe/route.js +1 -1
- package/dist/standalone/.next/server/app/api/transcribe/token/route.js +1 -0
- package/dist/standalone/.next/server/app/api/transcribe/token/route.js.nft.json +1 -0
- package/dist/standalone/.next/server/app/api/transcribe/token/route_client-reference-manifest.js +1 -0
- package/dist/standalone/.next/server/app/favicon.ico/route.js +1 -1
- package/dist/standalone/.next/server/app/index.html +1 -1
- package/dist/standalone/.next/server/app/index.rsc +5 -5
- package/dist/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/dist/standalone/.next/server/app/index.segments/_full.segment.rsc +5 -5
- package/dist/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/index.segments/_index.segment.rsc +2 -2
- package/dist/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/dist/standalone/.next/server/app/page.js +3 -6
- package/dist/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/dist/standalone/.next/server/app-paths-manifest.json +6 -5
- package/dist/standalone/.next/server/chunks/289.js +2 -0
- package/dist/standalone/.next/server/chunks/871.js +2 -3
- package/dist/standalone/.next/server/functions-config-manifest.json +2 -1
- package/dist/standalone/.next/server/middleware-build-manifest.js +1 -1
- package/dist/standalone/.next/server/middleware.js +3 -3
- 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/159-d2dbe811eeab290f.js +1 -0
- package/dist/standalone/.next/static/chunks/app/_global-error/page-81fecd9eba007478.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/access/route-81fecd9eba007478.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/answer/route-81fecd9eba007478.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/files/route-81fecd9eba007478.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/flows/[id]/route-81fecd9eba007478.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/flows/route-81fecd9eba007478.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/inbox/route-81fecd9eba007478.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/limits/route-81fecd9eba007478.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/log/route-81fecd9eba007478.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/proc/route-81fecd9eba007478.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/push/route-81fecd9eba007478.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/spawn/route-81fecd9eba007478.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/timeline/route-81fecd9eba007478.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/tmux/route-81fecd9eba007478.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/transcribe/route-81fecd9eba007478.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/transcribe/token/route-81fecd9eba007478.js +1 -0
- package/dist/standalone/.next/static/chunks/app/page-39971eba742f6b2e.js +2 -0
- package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/app-error-81fecd9eba007478.js +1 -0
- package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/forbidden-81fecd9eba007478.js +1 -0
- package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/not-found-81fecd9eba007478.js +1 -0
- package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/unauthorized-81fecd9eba007478.js +1 -0
- package/dist/standalone/.next/static/css/331d03725ce2ef2f.css +1 -0
- package/dist/standalone/.next/static/eVZqd0xcmD_g_vTrSrlTL/_buildManifest.js +1 -0
- package/dist/standalone/package.json +4 -2
- package/package.json +4 -2
- package/dist/standalone/.next/static/0YxRBiEgYCSV92_fZOmmC/_buildManifest.js +0 -1
- package/dist/standalone/.next/static/chunks/703-1f675e3bf3e228de.js +0 -1
- package/dist/standalone/.next/static/chunks/app/_global-error/page-b58291c8001879c8.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/access/route-b58291c8001879c8.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/answer/route-b58291c8001879c8.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/files/route-b58291c8001879c8.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/flows/[id]/route-b58291c8001879c8.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/flows/route-b58291c8001879c8.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/inbox/route-b58291c8001879c8.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/limits/route-b58291c8001879c8.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/log/route-b58291c8001879c8.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/proc/route-b58291c8001879c8.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/push/route-b58291c8001879c8.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/spawn/route-b58291c8001879c8.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/timeline/route-b58291c8001879c8.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/tmux/route-b58291c8001879c8.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/transcribe/route-b58291c8001879c8.js +0 -1
- package/dist/standalone/.next/static/chunks/app/page-169f116d08445993.js +0 -5
- package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/app-error-b58291c8001879c8.js +0 -1
- package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/forbidden-b58291c8001879c8.js +0 -1
- package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/not-found-b58291c8001879c8.js +0 -1
- package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/unauthorized-b58291c8001879c8.js +0 -1
- package/dist/standalone/.next/static/css/e3457e19c8be328e.css +0 -1
- /package/dist/standalone/.next/static/{0YxRBiEgYCSV92_fZOmmC → eVZqd0xcmD_g_vTrSrlTL}/_ssgManifest.js +0 -0
|
@@ -1,6 +1,3 @@
|
|
|
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")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},25880:()=>{},26713:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/is-bot")},26896:(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))},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/latand/.agents/tools/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")},33873:a=>{"use strict";a.exports=require("path")},41025:a=>{"use strict";a.exports=require("next/dist/server/app-render/dynamic-access-async-storage.external.js")},43954:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/interception-routes")},48056:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,95547,23))},57784:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,81921,23))},60728:()=>{},61135:()=>{},61744:(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))},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},68673:(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:()=>f,metadata:()=>e});var d=c(5735);c(61135);let e={title:"Живі логи",description:"Live viewer for Codex/Claude agent logs"};function f({children:a}){return(0,d.jsx)("html",{lang:"uk",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")},78335:()=>{},79428:a=>{"use strict";a.exports=require("buffer")},81825:(a,b,c)=>{Promise.resolve().then(c.bind(c,95170))},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},89175:(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/latand/.agents/tools/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/latand/.agents/tools/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}}},95170:(a,b,c)=>{"use strict";c.d(b,{Viewer:()=>c6});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("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function m(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 n="__overview__",o=a=>Math.floor(a/300);function p(a){return"live"===a.activity?0:"recent"===a.activity?1:"stalled"===a.activity?2:3}function q(a){return"claude-projects"===a.root?"сесія"===a.kind&&!a.parent:"codex-sessions"===a.root&&!a.parent}function r(a){return"claude-projects"===a.root&&"субагент"===a.kind}function s(a){return!!r(a)||!!a.handoff&&!!a.parent||"codex-sessions"===a.root&&!!a.parent}function t(a){return"shell"===a.engine||"codex-jobs"===a.root}function u(a){return a.project||"інше"}function v(a){let b=new Map;for(let c of a){let a=u(c),d=b.get(a);d||(d={project:a,liveCount:0,attentionCount:0,conversations:0,smt:0},b.set(a,d)),"live"===c.activity&&(d.liveCount+=1),(c.pendingQuestion||c.waitingInput)&&(d.attentionCount+=1),q(c)&&(d.conversations+=1),d.smt=Math.max(d.smt,c.mtime)}return[...b.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:o(b.smt)-o(a.smt)||a.project.localeCompare(b.project)})}function w(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 x(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 y(a){return!t(a)&&("live"===a.activity||"recent"===a.activity&&s(a))}function z(a,b){let c=new Map(a.map(a=>[a.path,a])),d=w(a),e=new Map,f=new Map;for(let d of a)if(u(d)===b){if("live"===d.activity||"recent"===d.activity&&s(d)){let a=function(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}(d,c);t(a)?f.set(a.path,a):e.set(a.path,a);continue}"recent"===d.activity&&q(d)&&e.set(d.path,d)}let g=[...e.values()].map(a=>(function(a,b,c){let d=x(a,b),e=d.filter(y).sort((a,b)=>("live"!==a.activity)-("live"!==b.activity)||o(b.mtime)-o(a.mtime)||a.path.localeCompare(b.path)),f=d.filter(a=>t(a)&&"live"===a.activity).sort((a,b)=>o(b.mtime)-o(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=>s(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),"сесія"===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:o(b.smt)-o(a.smt)||a.key.localeCompare(b.key))}function A(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 B(a){let b=new Set;for(let c of a)for(let a of c.rounds)a.reviewerPath&&b.add(a.reviewerPath);return b}let C={waiting_ready:"чекає READY",spawn_pending:"готовий спавнити ревʼюера",spawning:"запускаю ревʼюера",reviewing:"ревью",relay_pending:"вердикт є — передати?",relaying:"передаю зауваження",fixing:"фікси",approved:"затверджено",done_comment:"готово із зауваженнями",needs_decision:"потребує рішення",paused:"пауза",closed:"закрито"},D=new Set(["spawn_pending","relay_pending","needs_decision","paused","approved"]),E={APPROVE:"✓",REQUEST_CHANGES:"✖",COMMENT:"◆"};function F(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 G(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 null;let d=await c.json().catch(()=>null);return d?.error??`не вдалося (${c.status})`}catch{return"сервер недоступний"}}function H(a){let b=Date.now()/1e3-a;return b<90?Math.round(b)+" с тому":b<5400?Math.round(b/60)+" хв тому":b<129600?Math.round(b/3600)+" год тому":Math.round(b/86400)+" д тому"}function I(a){if("string"!=typeof a&&"number"!=typeof a)return"";let b=new Date(a);return Number.isNaN(b.getTime())?"":b.toLocaleTimeString("uk",{hour12:!1})}function J(a,b,c,d){let e=a%10,f=a%100;return 1===e&&11!==f?b:e>=2&&e<=4&&(f<12||f>14)?c:d}function K(a){return"live"===a?"animate-pulse bg-ok":"recent"===a?"bg-[#d29a2f]":"stalled"===a?"bg-err":"bg-[#c9c9d1]"}let L={codex:{color:"#2f6fd0",soft:"#e8f0fb"},claude:{color:"#d97757",soft:"#faeee9"}},M={color:"#9a9aa4",soft:"#ececf1"},N=[[/fable|mythos/,{color:"#c2410c",soft:"#fbeade"}],[/opus/,{color:"#8a5ad6",soft:"#f1ebfb"}],[/sonnet/,{color:"#e0913f",soft:"#fbf1e4"}],[/haiku/,{color:"#d9a58c",soft:"#f9f1ec"}]],O=[[/spark/,{color:"#5ea3e4",soft:"#ecf4fd"}],[/mini|nano/,{color:"#7fb1e8",soft:"#eff6fd"}],[/codex/,{color:"#1d55ab",soft:"#e4edfa"}]];function P(a){let b=L[a.engine];if(!b)return M;let c=(a.model??"").toLowerCase();for(let[b,d]of"codex"===a.engine?O:N)if(b.test(c))return d;return b}let Q={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 R(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 S(a){let b=P(a),c=Q[a.effort??""];return c?{color:R(b.color,c.dl,c.ds),soft:R(b.soft,Math.round(c.dl/3),Math.round(c.ds/2))}:b}function T(a){return a.effort?`Зусилля міркування: ${a.effort}`:void 0}function U(a){let b={codex:"Codex",claude:"Claude",shell:"Bash"}[a.engine]??a.engine,c=L[a.engine]??M;return{label:b,style:{backgroundColor:c.soft,color:c.color}}}function V(a,b){return Math.floor(b.smt/300)-Math.floor(a.smt/300)||a.file.path.localeCompare(b.file.path)}function W(a){return r(a)&&"running"!==a.proc}function X(a,b=Date.now()/1e3){return!!a.pendingQuestion||!!a.waitingInput||("stalled"===a.activity?!W(a)&&b-a.mtime<=7200:"recent"===a.activity&&("claude"===a.engine||"codex"===a.engine)&&q(a)&&!r(a))}function Y(a,b,c,d,f=Z,g=$){return(0,e.useMemo)(()=>{let e=function(a){let b=w(a),c=new Map;for(let d of a){let a=[...b.get(d.path)??[]],e=new Set,f=0;for(;a.length;){let c=a.pop();e.has(c.path)||(e.add(c.path),f+=1,a.push(...b.get(c.path)??[]))}c.set(d.path,f)}return c}(a),h=new Map;for(let a of b){let b=h.get(a.file);(!b||a.ts>b.ts)&&h.set(a.file,a)}let i=A(g),j=B(g),k=c.trim().toLowerCase(),l=a.filter(a=>!f.has(a.path)&&!j.has(a.path)&&(q(a)||"live"===a.activity||"stalled"===a.activity||"recent"===a.activity&&!t(a))).map(a=>{let b=u(a),c=m(a.title),f=d-a.mtime,g=i.get(a.path),j=a.pendingQuestion||a.waitingInput?"waiting":"live"===a.activity?"working":X(a,d)?"waiting":f<=86400?"recent":"older",k=function(a,b){if(a.pendingQuestion)return"plan"===a.pendingQuestion.kind?"чекає затвердження плану":"чекає відповіді на питання";if(a.waitingInput)return"чекає на відповідь у терміналі";if("live"===a.activity&&a.plan?.current)return`${a.plan.done}/${a.plan.total} \xb7 ${a.plan.current}`;let c=b.get(a.path);return c?`${c.label} \xb7 ${H(c.ts)}`:"live"===a.activity?"працює…":W(a)?"повернувся з результатом":"stalled"===a.activity?"перервано або чекає дозволу":X(a)?"закінчив хід — чекає відповіді":""}(a,h);return g&&(D.has(g.state)?j="waiting":("reviewing"===g.state||"relaying"===g.state||"spawning"===g.state)&&(j="working"),k=`флоу: ${C[g.state]}${g.stateDetail?` — ${g.stateDetail}`:""}`),{file:a,project:b,title:c,descendants:e.get(a.path)??0,smt:a.mtime,kind:j,statusLine:k}}).filter(a=>!k||`${a.title} ${a.project}`.toLowerCase().includes(k)),n=(a,b)=>b.smt-a.smt||a.file.path.localeCompare(b.file.path),o=l.filter(a=>"waiting"===a.kind).sort(n),p=l.filter(a=>"working"===a.kind).sort(n);return{waiting:o,working:p,recent:l.filter(a=>"recent"===a.kind).sort(V),older:l.filter(a=>"older"===a.kind).sort(V),livePreview:p.slice(0,3)}},[a,b,c,d,f,g])}let Z=new Set,$=[],_="llvSound";function aa(a){try{window.localStorage.setItem("llvArchivedProjects",JSON.stringify([...a]))}catch{}}let ab={files:[],flows:[]};function ac({files:a,archivedProjects:b,onSelectProject:c,onSelectFile:f}){let g=function(){let[a,b]=(0,e.useState)(3);return a}(),h=(0,e.useMemo)(()=>v(a),[a]),i=(0,e.useMemo)(()=>h.filter(a=>!b.has(a.project)),[h,b]),j=h.length-i.length,k=(0,e.useMemo)(()=>i.reduce((a,b)=>a+b.liveCount,0),[i]),l=i.filter(a=>a.liveCount>0).length,n=(0,e.useMemo)(()=>i.map(b=>{let c=z(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=>u(a)===b.project).sort((a,b)=>b.mtime-a.mtime)[0];return{summary:b,liveBranches:d,moreLive:c.length-d.length,latest:e}}),[a,i]);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:[(0,d.jsx)("h1",{className:"text-[13.5px] font-bold",children:"Огляд"}),(0,d.jsxs)("span",{className:"text-[11.5px] text-dim",children:[k?`${k} ${J(k,"гілка працює","гілки працюють","гілок працюють")} у ${l} ${J(l,"проєкті","проєктах","проєктах")}`:"зараз нічого не працює",j?` \xb7 ${j} в архіві`:""]})]}),(0,d.jsxs)("div",{className:"grid flex-1 auto-rows-min gap-2.5 overflow-y-auto p-3",style:{gridTemplateColumns:`repeat(${g}, minmax(0, 1fr))`},children:[n.map(({summary:a,liveBranches:b,moreLive:e,latest:g})=>(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:()=>c(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=U(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:m(a.title),onClick:b=>{b.stopPropagation(),f(a)},onKeyDown:b=>{"Enter"===b.key&&(b.stopPropagation(),f(a))},children:[(0,d.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${K(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:m(a.title,70)})]},a.path)}),e>0?(0,d.jsxs)("span",{className:"px-1 text-[10.5px] font-semibold text-dim",children:["ще ",e," live"]}):null]}):(0,d.jsxs)("span",{className:"text-[11px] text-dim",children:["тихо \xb7 остання активність ",g?H(g.mtime):"—"]})]},a.project)),i.length?null:(0,d.jsx)("div",{className:"col-span-full mt-[20vh] text-center text-dim",children:"Логів поки нема"})]})]})}let ad=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"}]]),ae=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"}]]),af=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"}]]),ag=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"}]]),ah=k("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]),ai=k("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),aj=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"}]]),ak=k("ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}]]),al=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"}]]),am=k("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),an=k("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),ao=k("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),ap=k("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),aq=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"}]]),ar=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"}]]),as=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"}]]),at=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"}]]),au=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"}]]),av=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"}]]),aw=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"}]]),ax=k("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]),ay=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"}]]),az=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"}]]),aA=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"}]]),aB=k("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]),aC=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"}]]),aD=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"}]]),aE=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"}]]),aF=k("power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]),aG=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"}]]),aH=k("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),aI={shell:an,tool:aA,"cmd-group":aB,codex:aq,claude:aw,image:ar,blob:aC,note:aD,citation:aE,message:as,shutdown:aF,plan:aG};function aJ({name:a,className:b}){let c=aI[a];return(0,d.jsx)(c,{className:b??"h-3.5 w-3.5","aria-hidden":!0})}let aK=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"}]]);var aL=c(74429);let aM="#0d9488",aN=new Map;function aO(){for(let a of document.querySelectorAll("[data-link-hover]"))a.removeAttribute("data-link-hover")}function aP(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 aQ({source:a,drop:b,onClose:c}){let f=(0,e.useRef)(null),[g,h]=(0,e.useState)(""),[i,j]=(0,e.useState)(!1),[k,n]=(0,e.useState)(null),o=b.file,p=U(o),q=Math.max(8,Math.min(b.to.x+14,window.innerWidth-340-8)),r=Math.max(8,Math.min(b.to.y+12,window.innerHeight-320)),s=async()=>{if(i||!g.trim())return;j(!0),n(null);let b=`Тобі передали контекст іншого агента — розмову \xab${m(a.title,80)}\xbb. Її транскрипт: ${a.path} — спочатку прочитай цей файл, щоб мати повний контекст, а тоді виконай прохання нижче.
|
|
3
|
-
|
|
4
|
-
${g.trim()}`;try{let a=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...null!==o.pid?{pid:o.pid}:{},path:o.path,text:b})}),c=await a.json();if(!a.ok||!c.ok)return void n({kind:"err",text:c.error??"не вдалося надіслати"});n({kind:"ok",text:c.spawned?`агент прокинувся у tmux ${c.target??""}`:`надіслано у tmux ${c.target??""}`})}catch{n({kind:"err",text:"сервер недоступний"})}finally{j(!1)}};return(0,d.jsxs)("div",{ref:f,className:"pointer-events-auto fixed flex w-[340px] cursor-default flex-col gap-2.5 rounded-[12px] border border-line bg-panel p-3 shadow-[0_8px_28px_rgba(20,20,30,0.14)]",style:{left:q,top:r},children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsx)(aK,{className:"h-3.5 w-3.5 shrink-0",style:{color:aM},"aria-hidden":!0}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12px] font-bold",children:"звʼязати агентів"}),(0,d.jsx)("button",{type:"button","aria-label":"Закрити картку звʼязування",onClick:c,className:"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",children:(0,d.jsx)(l,{className:"h-3 w-3","aria-hidden":!0})})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-1.5 rounded-[8px] border border-line bg-bg px-2 py-2",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5",children:[(0,d.jsx)("span",{className:"w-[64px] shrink-0 text-[10px] font-semibold text-dim",children:"кому"}),(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 text-[9.5px] font-bold",style:p.style,children:p.label}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[10.5px] font-semibold",title:m(o.title),children:m(o.title,60)})]}),(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5",children:[(0,d.jsx)("span",{className:"w-[64px] shrink-0 text-[10px] font-semibold text-dim",children:"контекст"}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate font-mono text-[10px] text-ink",title:a.path,children:a.path})]})]}),(0,d.jsx)("p",{className:"text-[10.5px] text-dim",children:"Агент отримає шлях до цього транскрипта з пропозицією прочитати розмову. Додай, що саме в нього попросити:"}),(0,d.jsx)("textarea",{value:g,onChange:a=>h(a.target.value),rows:4,autoFocus:!0,placeholder:"що зробити з цим контекстом…","aria-label":"Прохання для звʼязаного агента",className:"resize-y rounded-[8px] border border-line bg-bg px-2 py-1.5 text-[12px] text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40"}),(0,d.jsx)("div",{className:"flex items-center",children:(0,d.jsx)("button",{type:"button",disabled:i||!g.trim(),onClick:()=>void s(),className:"ml-auto rounded-[8px] border 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",style:{backgroundColor:aM,borderColor:aM},children:i?"звʼязую…":"▶ Звʼязати"})}),i?(0,d.jsx)("span",{className:"text-[10.5px] text-dim",children:"якщо агент не запущений — резюмую його вікно (до хвилини)…"}):null,k?(0,d.jsx)("span",{className:`text-[11px] font-semibold ${"ok"===k.kind?"text-ok":"text-err"}`,children:k.text}):null]})}function aR({file:a,onDeleted:b}){let[c,f]=(0,e.useState)(!1),[g,h]=(0,e.useState)(!1),[i,j]=(0,e.useState)("");if("running"===a.proc)return null;let k=async()=>{h(!0),j("");try{let c=await fetch(`/api/log?path=${encodeURIComponent(a.path)}`,{method:"DELETE"}),d=await c.json();if(!c.ok||!d.ok)return void j(d.error??"не вдалося видалити");f(!1),b?.()}catch{j("сервер недоступний")}finally{h(!1)}};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:"Видалити з диска?"}),(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?"…":"Так"}),(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:"Ні"})]}):(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":"Видалити розмову з диска",title:"Видалити розмову з диска",onClick:()=>f(!0),children:(0,d.jsx)(az,{className:"h-3 w-3","aria-hidden":!0})}),i?(0,d.jsx)("span",{className:"max-w-[160px] truncate text-[10.5px] font-semibold text-err",title:i,children:i}):null]})}function aS({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 aT=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"}]]),aU=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"}]]);function aV({file:a}){return"running"===a.proc?(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-[#e5f6ea] px-2 py-0.5 text-[11px] font-bold text-ok",children:[(0,d.jsx)(av,{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:"перервано"}):"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:"завершено"}):null}function aW({file:a,compact:b=!1}){let[c,f]=(0,e.useState)(!1),[g,h]=(0,e.useState)(!1),[i,j]=(0,e.useState)(""),[k,l]=(0,e.useState)(!1),m=(0,d.jsx)(aV,{file:a}),n=async()=>{h(!0),j("");try{let b=await fetch("/api/proc",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:a.path,force:k})}),c=await b.json();if(!b.ok||!c.ok){j(c.error??"помилка зупинки"),l(!0);return}j(`надіслано ${k?"SIGKILL":"SIGTERM"} PID ${c.pid}`),f(!1)}catch{j("сервер недоступний"),l(!0)}finally{h(!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:[m,"running"===a.proc?c?(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.jsxs)("span",{className:"truncate px-1 text-[11px] font-semibold text-err",children:["Точно вбити PID ",a.pid,"?"]}),(0,d.jsx)("button",{className:"rounded-lg bg-err px-2 py-0.5 text-[11px] font-bold text-white disabled:opacity-60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-err/50",disabled:g,onClick:n,children:k?"SIGKILL":b?`Вбити ${a.pid}`:"Так, вбити"}),(0,d.jsx)("button",{className:"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:()=>f(!1),children:b?"Ні":"Скасувати"})]}):(0,d.jsx)("button",{className:"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":`Зупинити процес PID ${a.pid}`,onClick:()=>f(!0),children:"Вбити"}):null,i?(0,d.jsx)("span",{className:"max-w-[220px] truncate text-[11px] font-semibold text-dim",children:i}):null]})}function aX({file:a,files:b,onSelect:c}){if("codex-jobs"===a.root){let e=b.find(b=>"codex-sessions"===b.root&&b.parent===a.path);return(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)(aV,{file:a})}),e?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"mb-2 whitespace-pre-line text-[13.5px] font-semibold",children:"Це короткий джоб-лог (лише службові події). Реальна робота Codex — у повній сесії:"}),(0,d.jsxs)("button",{className:"inline-flex items-center gap-1.5 rounded-[10px] border border-line bg-bg px-3 py-1.5 text-[13px] font-semibold text-codex hover:bg-codex-soft",onClick:()=>c(e),children:[(0,d.jsx)(aq,{className:"h-3.5 w-3.5","aria-hidden":!0})," Відкрити сесію Codex (",(e.size/1024).toFixed(0)," kB","live"===e.activity?", працює":"stalled"===e.activity?", перервано":"recent"===e.activity?", закінчив":"",")"]})]}):(0,d.jsx)("div",{className:"text-[13.5px] text-dim",children:"Це короткий джоб-лог. Повна rollout-сесія Codex ще не з'явилась у списку"})]})}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)(aV,{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||"Фонова команда"}),(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:"Команду, що запустила цю фонову задачу, не знайдено у транскриптах сесії"})]})}let aY=[{key:"claude",label:"Claude"},{key:"codex",label:"Codex"}];function aZ({file:a,paneRef:b}){let c=(0,e.useRef)(null),f=(0,e.useRef)({target:88,current:88,raf:0}),g=(0,e.useRef)(!1),h=(0,e.useRef)(null),i=(0,e.useRef)(null),[j,k]=(0,e.useState)(!1),[n,o]=(0,e.useState)({top:-18,maxH:480}),[p,q]=(0,e.useState)(!1),[r,s]=(0,e.useState)("codex"===a.engine?"codex":"claude"),[t,u]=(0,e.useState)(""),[v,w]=(0,e.useState)([]),[x,y]=(0,e.useState)(()=>`Прочитай розмову агента у файлі ${a.path} і продовж роботу звідти: `),[z,A]=(0,e.useState)(!1),[B,C]=(0,e.useState)(null),[D,E]=(0,e.useState)(!1),F=(0,e.useId)(),G=function(a,b){let[c,f]=(0,e.useState)(!1),[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:c=>{if("mouse"===c.pointerType&&0!==c.button||k.current)return;let d=c.currentTarget.getBoundingClientRect(),e=c=>{let d=k.current;if(!d)return;if(d.lastX=c.clientX,d.lastY=c.clientY,!d.active){if(7>Math.hypot(c.clientX-d.startX,c.clientY-d.startY))return;d.active=!0,l.current=!0,m.current=!0,document.body.style.cursor="crosshair",aO(),j(null),h({x:d.anchorX,y:d.anchorY}),f(!0),b?.()}n.current?.setAttribute("d",aP(d.anchorX,d.anchorY,c.clientX,c.clientY));let e=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=aN.get(e);return f&&f.el===d?f:null}(c.clientX,c.clientY,a.path);e?.el!==d.hover?.el&&(d.hover?.el.removeAttribute("data-link-hover"),e?.el.setAttribute("data-link-hover","1"),d.hover=e)},g=a=>{let b=k.current;k.current=null,b?.detach(),l.current=!1,document.body.style.cursor="",b?.active&&(f(!1),b.hover?j({file:b.hover.file,from:{x:b.anchorX,y:b.anchorY},to:{x:a.clientX,y:a.clientY}}):aO())};k.current={startX:c.clientX,startY:c.clientY,anchorX:d.right,anchorY:d.top+d.height/2,lastX:c.clientX,lastY:c.clientY,active:!1,hover:null,detach:()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",g),window.removeEventListener("pointercancel",g)}},window.addEventListener("pointermove",e),window.addEventListener("pointerup",g),window.addEventListener("pointercancel",g)},consumeClick:()=>{let a=m.current;return m.current=!1,a},draggingRef:l,overlay:c||i?(0,aL.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:aM})})}),(0,d.jsx)("path",{ref:a=>{n.current=a;let b=k.current;a&&b?.active&&a.setAttribute("d",aP(b.anchorX,b.anchorY,b.lastX,b.lastY))},d:i?aP(i.from.x,i.from.y,i.to.x,i.to.y):void 0,fill:"none",stroke:aM,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:aM})]}),i?(0,d.jsx)(aQ,{source:a,drop:i,onClose:()=>{aO(),j(null)}},i.file.path):null]}),document.body):null}}(a,()=>{h.current&&window.clearTimeout(h.current),h.current=null,g.current=!1,k(!1)}),{draggingRef:H}=G,I=a=>{g.current=a,k(a)},J=()=>{if(g.current)return;let a=b.current;if(a){let b=a.getBoundingClientRect().height,c=f.current.current;if(c>.55*b){let a=Math.min(c+18,b-8);o({bottom:c-a,maxH:a-8})}else{let a=Math.max(8,c-18);o({top:a-c,maxH:b-a-8})}}I(!0)},K=async()=>{if(!z&&t.trim()){A(!0),C(null);try{let b=await fetch("/api/spawn",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({engine:r,cwd:t.trim(),prompt:x,src:a.path})}),c=await b.json();if(!b.ok||!c.ok)return void C({kind:"err",text:c.error??"не вдалося запустити"});C({kind:"ok",text:`запущено в tmux ${c.target??""} — з'явиться гілкою поруч із цією колонкою`})}catch{C({kind:"err",text:"сервер недоступний"})}finally{A(!1)}}},N=U(a);return(0,d.jsxs)("div",{ref:c,className:"pointer-events-none absolute left-1.5 top-0 z-40 h-0 w-0",style:{transform:"translate3d(0, 88px, 0)",willChange:"transform"},children:[(0,d.jsx)("button",{type:"button","aria-expanded":j,"aria-label":"Перекинути розмову іншому агенту або потягнути стрілку на його панель",title:"клік — перекинути новому агенту \xb7 потягни стрілку — звʼязати з наявним",onPointerDown:G.onPillPointerDown,onPointerEnter:()=>{p&&!g.current&&(h.current&&window.clearTimeout(h.current),h.current=window.setTimeout(J,130))},onPointerLeave:()=>{h.current&&window.clearTimeout(h.current),h.current=null},onClick:()=>{G.consumeClick()||(h.current&&window.clearTimeout(h.current),g.current?I(!1):J())},className:`pointer-events-auto absolute left-0 top-0 flex h-9 w-6 -translate-y-1/2 touch-none items-center justify-center rounded-full border bg-panel shadow-card transition-[opacity,border-color,color] duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${j?"border-accent/50 text-accent opacity-100":"border-line text-dim opacity-60 hover:border-accent/45 hover:text-accent hover:opacity-100"}`,children:(0,d.jsx)(aT,{className:"h-3.5 w-3.5","aria-hidden":!0})}),j?(0,d.jsxs)("div",{className:"pointer-events-auto absolute left-8 z-50 flex w-[340px] cursor-default flex-col gap-2.5 overflow-y-auto rounded-[12px] border border-line bg-panel p-3 shadow-[0_8px_28px_rgba(20,20,30,0.14)] [&>*]:shrink-0",style:{top:n.top,bottom:n.bottom,maxHeight:n.maxH},children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsx)(aT,{className:"h-3.5 w-3.5 shrink-0 text-accent","aria-hidden":!0}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12px] font-bold",children:"перекинути розмову іншому агенту"}),(0,d.jsx)("button",{type:"button","aria-label":"Закрити картку передачі",onClick:()=>I(!1),className:"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",children:(0,d.jsx)(l,{className:"h-3 w-3","aria-hidden":!0})})]}),(0,d.jsx)("div",{className:"truncate text-[10.5px] font-semibold text-dim",title:m(a.title),children:m(a.title,70)}),(0,d.jsxs)("div",{className:"flex flex-col gap-1.5 rounded-[8px] border border-line bg-bg px-2 py-2",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5",children:[(0,d.jsx)("span",{className:"w-[64px] shrink-0 text-[10px] font-semibold text-dim",children:"агент"}),(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 text-[9.5px] font-bold",style:N.style,children:N.label}),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:P(a).soft,color:P(a).color},children:a.model}):null,(0,d.jsx)(aV,{file:a})]}),(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5",children:[(0,d.jsx)("span",{className:"w-[64px] shrink-0 text-[10px] font-semibold text-dim",children:"транскрипт"}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate font-mono text-[10px] text-ink",title:a.path,children:a.path}),(0,d.jsx)("button",{type:"button","aria-label":"Скопіювати шлях транскрипта",onClick:()=>{navigator.clipboard?.writeText(a.path).then(()=>{E(!0),i.current&&window.clearTimeout(i.current),i.current=window.setTimeout(()=>E(!1),1500)}).catch(()=>{})},className:`inline-flex shrink-0 items-center rounded-[8px] border border-line bg-panel px-1.5 py-0.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${D?"text-ok":"text-dim hover:text-accent"}`,children:D?(0,d.jsx)(am,{className:"h-3 w-3","aria-hidden":!0}):(0,d.jsx)(aU,{className:"h-3 w-3","aria-hidden":!0})})]}),a.kind?(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5",children:[(0,d.jsx)("span",{className:"w-[64px] shrink-0 text-[10px] font-semibold text-dim",children:"тип"}),(0,d.jsx)("span",{className:"min-w-0 truncate text-[10.5px] font-semibold text-ink",children:a.kind})]}):null]}),(0,d.jsx)("div",{className:"flex items-center gap-1.5",role:"radiogroup","aria-label":"Кому передати розмову",children:aY.map(({key:a,label:b})=>{let c;return(0,d.jsx)("button",{type:"button",role:"radio","aria-checked":r===a,onClick:()=>s(a),style:r===a?{backgroundColor:(c=L[a]??M).soft,color:c.color,borderColor:c.color}:void 0,className:`flex-1 rounded-[8px] border px-2 py-1.5 text-[12px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${r===a?"":"border-line bg-bg text-dim hover:text-ink"}`,children:b},a)})}),(0,d.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-dim",children:["директорія (успадкована)",(0,d.jsx)("input",{value:t,onChange:a=>u(a.target.value),list:F,placeholder:"/home/…/Projects/…","aria-label":"Робоча директорія нового агента",className:"rounded-[8px] border border-line bg-bg px-2 py-1.5 font-mono text-[11.5px] font-normal text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40"}),(0,d.jsx)("datalist",{id:F,children:v.map(a=>(0,d.jsx)("option",{value:a},a))})]}),(0,d.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-dim",children:["промпт для нового агента",(0,d.jsx)("textarea",{value:x,onChange:a=>y(a.target.value),rows:4,placeholder:"що зробити далі…","aria-label":"Промпт для нового агента",className:"resize-y rounded-[8px] border border-line bg-bg px-2 py-1.5 text-[12px] font-normal text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40"})]}),(0,d.jsx)("div",{className:"flex items-center",children:(0,d.jsx)("button",{type:"button",disabled:z||!t.trim(),onClick:()=>void K(),className:"ml-auto 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",children:z?"перекидаю…":"▶ Перекинути"})}),z?(0,d.jsx)("span",{className:"text-[10.5px] text-dim",children:"чекаю, поки CLI підніметься (до хвилини)…"}):null,B?(0,d.jsx)("span",{className:`text-[11px] font-semibold ${"ok"===B.kind?"text-ok":"text-err"}`,children:B.text}):null]}):null,G.overlay]})}let a$=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"}]]),a_=/^\s*(?:VERDICT:\s*)?(REQUEST_CHANGES|APPROVE|COMMENT)\b/m,a0=/^\s*(\d+)[.)]\s+(.*)$/,a1=/(?:\[(P[0-3])\]|\b(Critical|High|Medium|Low|Info|P[0-3])\b)/i,a2=/((?:\.{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,a3=/\[([^\]]+)\]\(([^)\s]+)\)/,a4=/([\w.-]*(?:api[_-]?key|access[_-]?token|refresh[_-]?token|authorization|bearer|secret|password|passwd|pwd|token))\b(\s*[:=]\s*)(["']?)[^\s"',}]+/gi;function a5(a){return a.replace(a4,(a,b,c,d)=>`${b}${c}${d}[redacted]`)}function a6(a){let b=a5(a);return{raw:b.slice(0,24e3),truncated:b.length>24e3}}function a7(a){let b=a.match(/^(.*?):(\d+(?:-\d+)?)$/);return b?{target:b[1]??a,line:b[2]}:{target:a}}function a8(a,b){let c=a.match(a_)?.[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(a1)?.[1]??e.match(a1)?.[2]??"Info"),b=function(a){let b=a.match(a3);if(b){let a=a7((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(a2);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(a1);if(c&&void 0!==c.index){let a=b.slice(c.index+c[0].length).replace(/^[\s.:–—-]+/,"");a&&(b=a)}return b.replace(a3,"$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:a6(e).raw})),f=null};for(let b of a.split("\n")){let a=b.trimEnd(),c=a.match(a0);if(c){g(),f=c[2]??"";continue}let h=a.trim();if(null!==f){h?f=`${f}
|
|
5
|
-
${h}`:g();continue}!(!h||a_.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=>a1.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:a6(a).raw}:null}let a9=k("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]),ba=k("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);function bb({src:a,alt:b,caption:c,onClose:f}){let[g,h]=(0,e.useState)(1),[i,j]=(0,e.useState)(0),[k,m]=(0,e.useState)(0),[n,o]=(0,e.useState)(!1),p=(0,e.useRef)(null),q=(a,b=0,c=0)=>{let d=Math.min(8,Math.max(.25,g*a)),e=d/g;h(d),j(b-(b-i)*e),m(c-(c-k)*e)},r=()=>{h(1),j(0),m(0)};return(0,aL.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":"Зменшити",onClick:()=>q(1/1.4),children:(0,d.jsx)(a9,{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":"Скинути масштаб",onClick:r,children:[Math.round(100*g),"%"]}),(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":"Збільшити",onClick:()=>q(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":"Закрити",onClick:f,children:(0,d.jsx)(l,{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;q(a.deltaY<0?1.18:1/1.18,c,d)},onPointerDown:a=>{a.currentTarget.setPointerCapture(a.pointerId),p.current={x:a.clientX,y:a.clientY,tx:i,ty:k},o(!0)},onPointerMove:a=>{p.current&&(j(p.current.tx+(a.clientX-p.current.x)),m(p.current.ty+(a.clientY-p.current.y)))},onPointerUp:()=>{p.current=null,o(!1)},onPointerCancel:()=>{p.current=null,o(!1)},onDoubleClick:()=>1===g?q(2):r(),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 ${n?"":"transition-transform duration-75"} ${g>1?"cursor-grab active:cursor-grabbing":"cursor-zoom-in"}`,style:{transform:`translate(${i}px, ${k}px) scale(${g})`}})})})]}),document.body)}function bc({name:a,path:b}){let[c,f]=(0,e.useState)("thumb"),[g,h]=(0,e.useState)(null),[i,j]=(0,e.useState)(!1),[k,l]=(0,e.useState)(!1),[m,n]=(0,e.useState)(""),o=`/api/inbox?name=${encodeURIComponent(a)}`,p=async()=>{l(!0),n("");try{let a=await fetch(o,{method:"DELETE"}),b=await a.json();if(!a.ok||!b.ok)return void n(b.error??"не вдалося видалити");h("deleted")}catch{n("сервер недоступний")}finally{l(!1),j(!1)}};return g?(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)(aJ,{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"===g?"видалено з диска":"файла вже немає на диску"]})]})}):"chip"===c?(0,d.jsx)("div",{className:"my-2 flex justify-end",children:(0,d.jsxs)("button",{type:"button",onClick:()=>f("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)(aJ,{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:"показати"})]})}):(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:o,alt:`вкладена картинка ${a}`,onClick:()=>f("full"),onError:()=>h("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:()=>f("chip"),className:"shrink-0 text-dim hover:text-ink",children:"згорнути"}),i?(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:"Видалити файл з диска?"}),(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:k,onClick:p,children:k?"видаляю…":"Так, видалити"}),(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:()=>j(!1),children:"Скасувати"})]}):(0,d.jsxs)("button",{type:"button",onClick:()=>j(!0),"aria-label":`Видалити ${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)(az,{className:"h-3 w-3","aria-hidden":!0})," видалити з диска"]}),m?(0,d.jsx)("span",{className:"shrink-0 font-semibold text-err",children:m}):null]})]}),"full"===c?(0,d.jsx)(bb,{src:o,alt:`вкладена картинка ${a}`,caption:b,onClose:()=>f("thumb")}):null]})}let bd=/<oai-mem-citation>\s*<citation_entries>([\s\S]*?)<\/citation_entries>\s*<rollout_ids>([\s\S]*?)<\/rollout_ids>\s*<\/oai-mem-citation>/g,be=/(?:\/\.codex\/sessions\/|\/\.claude\/projects\/|\/\.claude\/plugins\/data\/codex-openai-codex\/state\/|^\/tmp\/claude-\d+\/)/;function bf(a){return"number"==typeof a&&Number.isFinite(a)?a:void 0}let bg=/<(teammate-message|agent-message)\b([^>]*)>([\s\S]*?)<\/\1>/g,bh=/\S*\/\.claude\/viewer-inbox\/([A-Za-z0-9._-]+\.(?:png|jpe?g|gif|webp))/gi;function bi(a){if(!a.includes("/.claude/viewer-inbox/"))return{cleaned:a,images:[]};let b=[],c=new Set,d=[];for(let e of a.split("\n"))e.replace(bh,(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 bj=/^\s*(?:<[a-zA-Z][\w:-]*|Caveat: The messages below|\[Request interrupted|This came from another Claude session)/;function bk(a){let b=a.match(/^\s*<([a-zA-Z][\w:-]*)/)?.[1];return b||(/^\s*Caveat:/.test(a)?"caveat":"системне")}function bl(a,b){return a.match(RegExp(`${b}="([^"]*)"`))?.[1]??""}function bm(a){return"string"==typeof a?a:""}function bn(a){return a&&"object"==typeof a&&!Array.isArray(a)?a:{}}function bo(a){return Array.isArray(a)?a.filter(a=>a&&"object"==typeof a&&!Array.isArray(a)):[]}let bp=/(`[^`]+`|\*\*[^*]+\*\*|\[[^\]]+\]\([^)\s]+\)|https?:\/\/[^\s<>"')\]]+)/g;function bq({href:a,label:b}){return(0,d.jsx)("a",{href:a,target:"_blank",rel:"noreferrer",title:a,className:"break-all text-accent underline decoration-accent/40 underline-offset-2 hover:decoration-accent",children:b})}function br(a){return a.split(bp).map((a,b)=>{if(!a)return null;if(a.startsWith("`")&&a.endsWith("`"))return(0,d.jsx)("span",{className:"rounded-md bg-chip px-1.5 py-0.5 font-mono",children: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){let a=c[2].replace(/\\([()])/g,"$1");return/^https?:\/\//.test(a)?(0,d.jsx)(bq,{href:a,label:c[1]},b):(0,d.jsx)("span",{className:"rounded-md bg-chip px-1.5 py-0.5 font-mono",children:c[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)(bq,{href:c,label:f}),e]},b)}return a})}let bs=/^\s*\|.*\|\s*$/,bt=/^:?-{1,}:?$/;function bu({rows:a}){let b=a.map(a=>a.trim().replace(/^\|/,"").replace(/\|$/,"").split("|").map(a=>a.trim())),c=b.length>1&&b[1].every(a=>bt.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:br(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:br(a)},b))},b))})]})})}function bv(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)("pre",{className:"my-1.5 max-w-full overflow-x-auto rounded-[10px] border border-line bg-bg px-3 py-2 font-mono text-[11.5px]",children:e},`c${a}`));continue}if(bs.test(b[f])){let a=f;for(;f<b.length&&bs.test(b[f]);)f++;"\n"===c[c.length-1]&&c.pop(),c.push((0,d.jsx)(bu,{rows:b.slice(a,f)},`t${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:br(g[1])},f)):h?c.push((0,d.jsx)("span",{className:"border-l-2 border-line pl-2 text-dim",children:br(h[1])},f)):c.push((0,d.jsx)(e.Fragment,{children:br(a)},f)),++f<b.length&&c.push("\n")}return c}function bw(a,b,c){let d=b.split("\n").map(a=>a.trim()).filter(Boolean).map(a=>{let b=a.match(/\|note=\[(.*)\]$/)?.[1],c=a7(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=a6(a);return{kind:"mem-citation",entries:d,rolloutIds:e,raw:f.raw,truncated:f.truncated}}function bx(a,b,c){if(!a)return null;let d=b.match(/exited with code (\d+)/)?.[1],e=b.replace(/^Chunk ID:[^\n]*\n/,"").replace(/Wall time:[^\n]*\n/,"").replace(/Original token count:[^\n]*\n?/,"").trim(),f=!0===c||void 0!==d&&"0"!==d;return a.status=f?"err":"ok",a.label=f?d&&"0"!==d?"exit "+d:"помилка":"ok",a.open||=f,e&&(a.output=(a.output+"\n"+a5(e)).trim().slice(-(f?6e4:12e3))),a}function by({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}`:"зображення";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)(aJ,{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," КБ"]}),(0,d.jsx)("span",{className:"ml-1 text-[12px] font-semibold text-accent",children:"показати"})]});let l=`data:${a};base64,${b}`;return(0,d.jsxs)("div",{className:"my-2 ml-9",children:[(0,d.jsx)("img",{src:l,alt:`зображення ${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:"згорнути"}),"full"===h?(0,d.jsx)(bb,{src:l,alt:`зображення ${k}`,caption:`${k} \xb7 ${j} КБ`,onClose:()=>i("thumb")}):null]})}function bz({label:a,text:b}){let c=b.length>=2048?`${(b.length/1024).toFixed(1)} кБ`:`${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)(aJ,{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:["системне \xb7 ",c]}),(0,d.jsx)("span",{className:"text-accent group-open:hidden",children:"показати"}),(0,d.jsx)("span",{className:"hidden text-dim group-open:inline",children:"згорнути"})]}),(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})]})}function bA({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:"згорнути"})]}):(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)(aJ,{name:"blob",className:"h-4 w-4"})}),(0,d.jsxs)("span",{className:"font-semibold",children:["даних ",g," КБ"]}),(0,d.jsx)("span",{className:"ml-1 text-[12px] font-semibold text-accent",children:"показати"})]})}function bB({verdict:a}){return(0,d.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,d.jsx)("REQUEST_CHANGES"===a?ak:"APPROVE"===a?ap:at,{className:"h-3.5 w-3.5","aria-hidden":!0}),"REQUEST_CHANGES"===a?"REQUEST_CHANGES":"APPROVE"===a?"APPROVE":"COMMENT"]})}function bC({status:a,className:b}){let c=b??"h-3.5 w-3.5";return"ok"===a?(0,d.jsx)(am,{className:c,"aria-hidden":!0}):"err"===a?(0,d.jsx)(l,{className:c,"aria-hidden":!0}):(0,d.jsx)(aH,{className:`${c} animate-spin`,"aria-hidden":!0})}function bD({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 be.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 bE({item:a}){let b=Object.entries(a.byTool).map(([a,b])=>`${a} \xd7${b}`).join(" \xb7 "),c=I(a.t0),e=I(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)(aJ,{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:[a.calls.length," ",J(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)(am,{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)(l,{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)(aJ,{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)(bC,{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])})})]})}function bF({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)(aq,{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)(bB,{verdict:a.verdict})}):null,(0,d.jsx)("span",{className:"text-[11px] text-dim",children:c?`${c} finding${1===c?"":"s"}`:"без findings"}),I(a.ts)?(0,d.jsx)("span",{className:"ml-auto text-[11px] text-dim",children:I(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:bv(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)(bD,{file:a.file,line:a.line}):null]}),(0,d.jsx)("div",{className:"mt-1.5 whitespace-pre-wrap break-words text-[13px]",children:br(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:bv(a.body)})]}):null]},b)})}):null,a.findings.length>e.length?(0,d.jsxs)("div",{className:"mt-2 text-[12px] text-dim",children:["ще ",a.findings.length-e.length," findings у raw"]}):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 bG({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)(aJ,{name:"citation",className:"h-4 w-4"})}),(0,d.jsxs)("span",{className:"text-[13px] font-semibold",children:["цитати пам'яті (",a.entries.length,")"]}),(0,d.jsx)("span",{className:"ml-auto text-[11px] font-semibold text-accent group-open:hidden",children:"показати"}),(0,d.jsx)("span",{className:"ml-auto hidden text-[11px] font-semibold text-accent group-open:inline",children:"згорнути"})]}),(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)(bD,{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:"без citation entries"}),a.entries.length>b.length?(0,d.jsxs)("div",{className:"mt-1.5 text-[12px] text-dim",children:["ще ",a.entries.length-b.length," entries у raw"]}):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 обрізано":""]}),(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 bH={shutdown_request:{icon:"shutdown",label:"запит на завершення",tone:"amber"},shutdown_response:{icon:"shutdown",label:"відповідь на завершення",tone:"amber"},plan_approval_request:{icon:"plan",label:"запит на затвердження плану",tone:"accent"},plan_approval_response:{icon:"plan",label:"вердикт по плану",tone:"accent"}};function bI(a){return"string"==typeof a&&a.length?a:void 0}function bJ({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?"схвалено":"відхилено"})}function bK({payload:a}){let b=bI(a.from),c=bI(a.requestId),e=I(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.jsxs)("span",{children:["від ",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 bL({payload:a}){let b=bI(a.type),c=b?bH[b]:void 0;if(!c)return(0,d.jsxs)("div",{className:"text-[13px]",children:[(0,d.jsx)("div",{className:"text-dim",children:"структуроване повідомлення"}),(0,d.jsxs)("details",{className:"mt-1 text-[12px]",children:[(0,d.jsx)("summary",{className:"cursor-pointer list-none font-semibold text-accent",children:"показати JSON"}),(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=bI(a.reason)??bI(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)(aJ,{name:c.icon,className:"h-3.5 w-3.5"}),c.label]}),void 0!==e?(0,d.jsx)(bJ,{approve:e}):null]}),f?(0,d.jsx)("div",{className:"mt-1.5 whitespace-pre-wrap break-words",children:bv(f)}):null,(0,d.jsx)(bK,{payload:a})]})}let bM=(0,e.memo)(function({item:a}){if("image"===a.kind)return(0,d.jsx)(by,{media:a.media,data:a.data,w:a.w,h:a.h,bytes:a.bytes});if("inbox-image"===a.kind)return(0,d.jsx)(bc,{name:a.name,path:a.path});if("blob"===a.kind)return(0,d.jsx)(bA,{bytes:a.bytes,text:a.text});if("sysmsg"===a.kind)return(0,d.jsx)(bz,{label:a.label,text:a.text});if("review"===a.kind)return(0,d.jsx)(bF,{item:a});if("mem-citation"===a.kind)return(0,d.jsx)(bG,{item:a});if("prose"===a.kind){let b="codex"===a.engine?"bg-codex":"bg-claude",c="codex"===a.engine?aq:aw;return(0,d.jsxs)("div",{className:"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:"min-w-0 flex-1 whitespace-pre-wrap break-words",children:[I(a.ts)?(0,d.jsx)("div",{className:"mb-0.5 text-[11px] text-dim",children:I(a.ts)}):null,bv(a.text)]})]})}if("user"===a.kind){let b=a.text.length>500;return(0,d.jsx)("div",{className:"my-3.5 flex justify-end",children:(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:["(",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:["згорнути ",(0,d.jsx)(ao,{className:"h-3 w-3","aria-hidden":!0})]})]}),bv(a.text)]}):bv(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)(aJ,{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)(bC,{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(вивід у цьому лог-файлі відсутній — повний є в rollout-сесії Codex)")})]})}if("cmd-group"===a.kind)return(0,d.jsx)(bE,{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)(aJ,{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:"файли змінені"})]})]});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)(as,{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?"до":"від"}),(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)(am,{className:"h-3 w-3","aria-hidden":!0}):(0,d.jsx)(l,{className:"h-3 w-3","aria-hidden":!0}),"ok"===a.delivery?"доставлено":"не доставлено"]}):null,I(a.ts)?(0,d.jsx)("span",{className:"ml-auto shrink-0 text-[11px] text-dim",children:I(a.ts)}):null]}),(0,d.jsx)("div",{className:"px-3.5 pb-2.5 pt-1",children:b?(0,d.jsx)(bL,{payload:b}):(0,d.jsxs)(d.Fragment,{children:[a.summary?(0,d.jsx)("div",{className:"text-[13px] font-bold",children:br(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:"показати все"})]}),(0,d.jsxs)("span",{className:"hidden items-center gap-1 text-[11px] font-semibold text-dim group-open/tmsg:inline-flex",children:["згорнути ",(0,d.jsx)(ao,{className:"h-3 w-3","aria-hidden":!0})]})]}),bv(a.text)]}):(0,d.jsx)("div",{className:"mt-0.5 whitespace-pre-wrap break-words text-[13px]",children:bv(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)(as,{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:"міркування агента",children:[(0,d.jsx)(al,{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:bv(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:br(a.text)}):(0,d.jsx)("div",{className:`my-0.5 break-words text-[12.5px] ${a.err?"text-err":"text-[#555]"}`,children:a.text})}),bN=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"}]]),bO=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 bP({file:a}){let b=a.pendingQuestion,[c,f]=(0,e.useState)("pending"),[g,h]=(0,e.useState)(""),[i,j]=(0,e.useState)({}),[k,m]=(0,e.useState)(""),[n,o]=(0,e.useState)(""),[p,q]=(0,e.useState)(!1),r=b?null!==b.paneTarget:null!==a.pid&&"running"===a.proc,s=(0,e.useMemo)(()=>b?.questions?b.questions.map((a,b)=>(i[b]??[]).map(b=>a.options[b]?.label??String(b+1)).join(", ")).filter(Boolean).join(" \xb7 "):"",[i,b]);if(!b)return a.waitingInput?(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)(bN,{className:"h-3.5 w-3.5","aria-hidden":!0})," чекає на відповідь"]}),(0,d.jsxs)("div",{className:"text-[13px] font-semibold text-ink",children:["Пейн ",a.waitingInput.target," \xb7 ",function(a){let b=Math.max(0,Math.floor(Date.now()/1e3-a));if(b<60)return`${b} с`;let c=Math.floor(b/60);return c<60?`${c} хв`:`${Math.floor(c/60)} год`}(a.waitingInput.since)]}),(0,d.jsx)("pre",{className:"mt-2 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.jsx)("div",{className:"mt-3 text-[12px] text-dim",children:"Можна відповісти через композер нижче."})]}):null;let t=async(a,c)=>{f("delivering"),h("");try{let d=await fetch("/api/answer",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({transcriptPath:b.transcriptPath,toolUseId:b.toolUseId,kind:b.kind,...a})}),e=await d.json();if(!d.ok||!e.ok){if(409===d.status&&(e.superseded||e.answer)){f("superseded"),h(e.answer??e.error??"відповідь уже записана");return}f("failed"),h(e.error??"не вдалося надіслати");return}f("answered"),h(e.answer??c)}catch{f("failed"),h("сервер недоступний")}},u=(a=i)=>b.questions?.map((b,c)=>a[c]??[])??[],v=b.questions?.length??0,w=v>1||(b.questions?.some(a=>a.multiSelect)??!1),x=b.questions?.every((a,b)=>(i[b]??[]).length>0)??!1,y=async()=>{q(!0),h("");try{let b=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"resume",path:a.path})}),c=await b.json();if(!b.ok||!c.ok)return void h(c.error??"не вдалося відкрити сесію");h(`відкрито ${c.target??"tmux"}`)}catch{h("сервер недоступний")}finally{q(!1)}},z="delivering"===c||!r;return"answered"===c?(0,d.jsxs)("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:["Відповідено: ",g||s]}):"superseded"===c?(0,d.jsxs)("div",{id:"question",className:"my-4 rounded-[8px] border border-line bg-chip px-4 py-3 text-[13px] font-semibold text-dim",children:["Відповідено в іншому місці: ",g]}):b&&!r?(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)(bN,{className:"h-3.5 w-3.5","aria-hidden":!0})," чекає на відповідь"]}),(0,d.jsx)("div",{className:"text-[13px] font-semibold text-err",children:"tmux-пейн недоступний"}),"plan"===b.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:b.plan}):b.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:p,onClick:y,children:"відкрити сесію"}),g?(0,d.jsx)("div",{className:"mt-2 text-[12px] font-semibold text-dim",children:g}):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)(bN,{className:"h-3.5 w-3.5","aria-hidden":!0})," чекає на відповідь"]}),r?null:(0,d.jsx)("span",{className:"text-[12px] font-semibold text-err",children:"tmux-пейн недоступний"})]}),"plan"===b.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:b.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:"Коментар до відхилення…",value:n,onChange:a=>o(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:z,onClick:()=>t({approve:!0},"затверджено"),children:[(0,d.jsx)(am,{className:"h-4 w-4","aria-hidden":!0})," Затвердити"]}),(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:z,onClick:()=>t({approve:!1,text:n},"відхилено"),children:[(0,d.jsx)(l,{className:"h-4 w-4","aria-hidden":!0})," Відхилити"]})]})]}):(0,d.jsxs)(d.Fragment,{children:[b.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=(i[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:z,onClick:()=>{var d;let f={...i,[b]:[e]};d=a.multiSelect,j(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!==v||t({answers:u(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)),v<=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:"Своя відповідь…",value:k,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:z||!k.trim(),onClick:()=>t({text:k},k),children:[(0,d.jsx)(bO,{className:"h-4 w-4","aria-hidden":!0})," Надіслати"]})]}):null,w?(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:z||!x,onClick:()=>t({answers:u()},s),children:[(0,d.jsx)(bO,{className:"h-4 w-4","aria-hidden":!0})," Надіслати"]}):null]}),"delivering"===c?(0,d.jsxs)("div",{className:"mt-3 inline-flex items-center gap-1.5 text-[12px] font-semibold text-dim",children:[(0,d.jsx)(aH,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0})," надсилаю…"]}):null,"failed"===c?(0,d.jsx)("div",{className:"mt-3 text-[12px] font-semibold text-err",children:g}):null]})}function bQ({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 bR({file:a,files:b,onSelect:c,showSvc:f,lineFilter:g,onStatus:h,paused:i,follow:j,setFollow:k,compact:l=!1}){let[m,n]=(0,e.useState)(j),o=function(a,b=!1,c=2500){(0,e.useRef)(c);let[d,f]=(0,e.useState)([]),[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);(0,e.useRef)(!1);let B=(0,e.useRef)(!1);return{lines:d,size:g,loading:i,error:k,tickTime:m,paused:o,setPaused:p,clear:(0,e.useCallback)(()=>{f([]),w.current=0,x.current=0,y.current="",z.current=!0,r(!1)},[]),hasMore:q,loadingOlder:s,loadOlder:(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=>h.concat(a)),v(a=>a+1)),h.length}catch{return 0}finally{B.current=!1,t(!1)}},[a?.path]),prependGen:u}}(a,i,m&&l?2500:0),p=(0,e.useRef)(null),q=(0,e.useRef)(null),s=(0,e.useRef)(null),t=l?500:1500,[u,v]=(0,e.useState)(l?300:1500),[w,x]=(0,e.useState)(0),[y,z]=(0,e.useState)(!1),[A,B]=(0,e.useState)(null);(0,e.useRef)(!1);let C=(0,e.useRef)(m);(0,e.useRef)(0),(0,e.useRef)(0);let D=(0,e.useRef)(null),E=(a,b=!1)=>{C.current=a,n(a),k(a),a&&x(0),b&&(z(!0),D.current&&window.clearTimeout(D.current),D.current=window.setTimeout(()=>z(!1),450))},F=(0,e.useMemo)(()=>a?function(a,b,c,d){let e=new Map,f=new Map,g=[],h=0,i="",j=a=>!!(!(a.length<=2e4)&&(a.match(/\s/g)?.length??0)/a.length<.02)&&(g.push({kind:"blob",bytes:a.length,text:a5(a).slice(0,2e5)}),!0),k=(a,b)=>{let c=bn(a.source),d=bm(c.data)||bm(b.base64);if(!d)return;let e=bm(c.media_type)||bm(b.type),f=e.startsWith("image/")?e:"image/png",h=bn(b.dimensions);g.push({kind:"image",media:f,data:d,w:bf(h.originalWidth),h:bf(h.originalHeight),bytes:bf(b.originalSize)})},l=(a,b,c)=>{bd.lastIndex=0;let d=bd.test(b);if(bd.lastIndex=0,!d){let c=a8(b.trim(),a);return!!c&&(g.push(c),!0)}let e=!1,f=0,h=b=>{let d=b.trim();if(!d)return;let f=a8(d,a);f?(g.push(f),e=!0):c(d)};for(let a of b.matchAll(bd)){let c=a[0],d=a.index??0;h(b.slice(f,d)),g.push(bw(c,a[1]??"",a[2]??"")),e=!0,f=d+c.length}return h(b.slice(f)),e},m=a=>{let b=[];return bd.lastIndex=0,{cleaned:a.replace(bd,(a,c,d)=>(b.push(bw(a,c,d)),"")).trim(),cites:b}},n=(b,c)=>{if(!c.trim()||c===i||(i=c,j(c)))return;let d="codex"===a.engine?"codex":"claude";l(b,c,a=>g.push({kind:"prose",ts:b,text:a,engine:d}))||g.push({kind:"prose",ts:b,text:c,engine:d})},o=(a,b,c,d)=>{let f=c||"plain-"+g.length+"-"+String(a??""),h=function(a,b="shell"){let c=a5(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:"виконується…",open:!1}}(b,d);return e.set(f,h),g.push({kind:"cmd",id:f,call:h,ts:a}),h},p=(a,b,d)=>{if(!a)return;let h=f.get(a);if(h){h.delivery=d||/"success"\s*:\s*false/.test(b)?"err":"ok",h.msgId=b.match(/"msg_id"\s*:\s*"([^"]+)"/)?.[1];return}!bx(e.get(a),b,d)&&b&&c&&g.push({kind:"svc",text:"output: "+a5(b).slice(0,200)})},q=a=>{c?g.push({kind:"svc",text:a.slice(0,300)}):h+=1},r=a=>{g.push({kind:"note",text:a})},s=(a,b)=>{let c=b.replace(bg,(b,c,d,e)=>{let f=bl(d,"teammate_id")||bl(d,"from")||"тімейт",h=bl(d,"summary"),i=e.trim();if(i.startsWith("{"))try{let a=JSON.parse(i);if("idle_notification"===a.type){let b=I(a.timestamp);return g.push({kind:"tnote",text:`${f}: звільнився${b?" \xb7 "+b:""}`}),""}}catch{}let{cleaned:j,cites:k}=m(i),l=a_.test(j)?a8(j,a):null;for(let b of(g.push({kind:"tmsg",ts:a,dir:"in",peer:f,summary:h,text:l?"":j}),l&&g.push(l),k))g.push(b);return""}).replace(/Another Claude session sent a message:\s*/g,"").trim();if(!c||j(c))return;if(bj.test(c))return void g.push({kind:"sysmsg",label:bk(c),text:c});let{cleaned:d,images:e}=bi(c);for(let b of(d&&!l(a,d,b=>g.push({kind:"user",ts:a,text:b}))&&g.push({kind:"user",ts:a,text:d}),e))g.push({kind:"inbox-image",name:b.name,path:b.path})},t=(a,b)=>{let{cleaned:c,images:d}=bi(b);for(let b of(c&&g.push({kind:"user",ts:a,text:c}),d))g.push({kind:"inbox-image",name:b.name,path:b.path})},u=a=>{let b=bn(a.payload),c=a.timestamp;if("session_meta"===a.type)return r(`Сесія Codex створена \xb7 ${bm(b.model)} \xb7 ${bm(b.cwd)}`);if("event_msg"===a.type){if("agent_message"===b.type&&b.message)return n(c,bm(b.message));if("user_message"===b.type&&b.message){let a=bm(b.message);return bj.test(a)?g.push({kind:"sysmsg",label:bk(a),text:a}):t(c,a)}return"task_started"===b.type?r("Задача стартувала"+(c?" \xb7 "+I(c):"")):"task_complete"===b.type?r("Задачу завершено"+(c?" \xb7 "+I(c):"")):q(bm(b.type)||"event")}if("response_item"===a.type){if("message"===b.type){let a=bo(b.content).map(a=>bm(a.text)||bm(a.input_text)).join(" ").trim();return a?"user"!==b.role?n(c,a):bj.test(a)?g.push({kind:"sysmsg",label:bk(a),text:a}):t(c,a):q("message "+bm(b.role))}if("function_call"===b.type){let a={};try{a=JSON.parse(bm(b.arguments)||"{}")}catch{a={}}let d=bm(b.name);if("exec_command"===d||"shell"===d)return o(c,String(a.cmd??a.command??"").replace(/^\/usr\/bin\/zsh -lc /,""),bm(b.call_id));if("apply_patch"===d){let b=String(a.input??"").match(/(Add|Update|Delete) File: [^\n]+/g);g.push({kind:"edit",files:b?b.join(", ").replace(/(Add|Update|Delete) File: /g,""):"патч"});return}return"write_stdin"===d?q("stdin → сесія "+String(a.session_id??"")):o(c,d+" "+JSON.stringify(a).slice(0,120),bm(b.call_id),"tool")}if("function_call_output"===b.type)return p(bm(b.call_id),"string"==typeof b.output?b.output:JSON.stringify(b.output??""));if("custom_tool_call"===b.type&&"apply_patch"===bm(b.name)){let a=bm(b.input).match(/(Add|Update|Delete) File: [^\n]+/g);g.push({kind:"edit",files:a?a.join(", ").replace(/(Add|Update|Delete) File: /g,""):"патч"});return}return"custom_tool_call_output"===b.type?p(bm(b.call_id),"string"==typeof b.output?b.output:JSON.stringify(b.output??"")):"reasoning"===b.type?q("reasoning"):q(bm(b.type)||"item")}q(bm(a.type)||"запис")},v=a=>{let b=a.timestamp;if("user"===a.type&&a.message){let c=bn(a.message).content,d=bn(bn(a.toolUseResult).file);if("string"==typeof c)s(b,c);else for(let a of bo(c))if("text"===a.type)s(b,bm(a.text));else if("image"===a.type)k(a,d);else if("tool_result"===a.type){let b=bo(a.content);for(let a of b)"image"===a.type&&k(a,d);let c="string"==typeof a.content?a.content:b.filter(a=>"image"!==a.type).map(a=>bm(a.text)).join(" ");p(bm(a.tool_use_id),c,!0===a.is_error)}return}if("assistant"===a.type&&a.message){for(let c of bo(bn(a.message).content))if("text"===c.type&&bm(c.text).trim())n(b,bm(c.text));else if("thinking"===c.type&&bm(c.thinking).trim())g.push({kind:"think",text:bm(c.thinking).replace(/\s+/g," ").trim()});else if("tool_use"===c.type&&"SendMessage"===bm(c.name)){let a=bn(c.input),d=a.message;if("string"==typeof d){let{cleaned:e,cites:h}=m(d),i=a_.test(e)?a8(e,b):null,j={kind:"tmsg",ts:b,dir:"out",peer:String(a.to??""),summary:String(a.summary??""),text:i?"":e};for(let a of(g.push(j),i&&g.push(i),h))g.push(a);bm(c.id)&&f.set(bm(c.id),j)}else q(`SendMessage → ${String(a.to??"")} \xb7 ${bm(bn(d).type)||"протокол"}`)}else if("tool_use"===c.type){let a=bn(c.input),d=String(a.command??a.file_path??a.prompt??JSON.stringify(a));o(b,bm(c.name)+": "+d.slice(0,160),bm(c.id),"tool")}return}q(bm(a.type)||"запис")},w=null,x=()=>{if(!w)return;let a=w.join("\n").trim();if(w=null,!a)return;let b=a=>{for(let b of a.split("\n"))b.trim()&&g.push({kind:"raw",text:a5(b),err:/error|failed|traceback|exception/i.test(b)})};l(null,a,b)||b(a)},y=a=>{let b=a.replace(/\x1b\][^\x07]*(\x07|\x1b\\)/g,"").replace(/\x1b\[[0-9;?]*[A-Za-z]/g,"");if(w)if(!/^\[codex\]/.test(b))return void w.push(b);else x();if(/Assistant message$/.test(b))return;let c=b.match(/^\[([^\]]+)\]\s*(.*)$/),d=c?.[1]??null,f=c?.[2]??b;if(!(!f||/^Assistant message captured/.test(f))){if(!c&&(a_.test(b)||b.startsWith("<oai-mem-citation>"))){w=[b];return}if(/^Running command: /.test(f))return o(d,f.replace(/^Running command: /,"").replace(/^\/usr\/bin\/zsh -lc /,""));if(/^Command (completed|failed)/.test(f)){let a=[...e.values()].at(-1);a&&bx(a,/^Command failed/.test(f)?f+"\n(це джоб-лог: він не містить stdout команд; повний вивід — у rollout-сесії Codex у списку зліва)":f,/^Command failed/.test(f));return}return/^Applying \d+ file/.test(f)?g.push({kind:"edit",files:f}):c&&!/^(Running|Command|Applying)/.test(f)?n(d,f):void(!j(b)&&g.push({kind:"raw",text:a5(b),err:/error|failed|traceback|exception/i.test(b)}))}};for(let c of b)if(!d||c.toLowerCase().includes(d))if("claude"===a.fmt||"codex"===a.fmt)try{let b=JSON.parse(c);b&&"object"==typeof b&&!Array.isArray(b)&&("claude"===a.fmt?v(b):u(b))}catch{y(c)}else y(c);return x(),{items:function(a,b){let c=[],d=0;for(;d<a.length;){if("cmd"!==a[d].kind){c.push(a[d]),d+=1;continue}let f=d,g=[];for(;f<a.length;){let b=a[f];if("cmd"===b.kind)g.push(b);else if("think"!==b.kind)break;f+=1}let h=f===a.length;if(g.length>=4&&!(b&&h)){let a={},b=0,h=0;for(let c of g){var e;let d=(e=c.call.cmd,e.match(/^([A-Za-z][\w.]*): /)?.[1]??"cmd");a[d]=(a[d]??0)+1,"ok"===c.call.status?b+=1:"err"===c.call.status&&(h+=1)}c.push({kind:"cmd-group",ids:g.map(a=>a.id),calls:g.map(a=>a.call),t0:g[0]?.ts,t1:g.at(-1)?.ts,byTool:a,okCount:b,errCount:h,hasErr:h>0}),d=f}else c.push(a[d]),d+=1}return c}(g,"live"===a.activity),hiddenServiceCount:h}}(a,o.lines,f,g.toLowerCase()):{items:[],hiddenServiceCount:0},[a?.path,a?.engine,a?.fmt,a?.activity,o.lines,f,g]),G=Math.max(0,F.items.length-u),H=G?F.items.slice(-u):F.items,J=()=>{let a=p.current;a&&(s.current={top:a.scrollTop,height:a.scrollHeight}),G?v(a=>a+t):o.hasMore&&o.loadOlder().then(()=>v(a=>a+t))},K=G>0||o.hasMore,L=F.items.at(-1),M=L?.kind==="cmd"&&"run"===L.call.status?{icon:aA,label:`виконує ${L.call.cmd.split(/[\s:]/,1)[0]||"інструмент"}…`}:L?.kind==="think"?{icon:aw,label:"думає…"}:{icon:aw,label:"працює…"};return(0,d.jsxs)("div",{className:"relative flex min-h-0 flex-1 flex-col",children:[a&&F.items.length?m?"live"===a.activity?(0,d.jsxs)("div",{className:`pointer-events-none absolute bottom-2 right-3 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)(a$,{className:"h-3 w-3","aria-hidden":!0})," живий хвіст"]}):null:(0,d.jsxs)("button",{className:"absolute bottom-2 right-3 z-10 inline-flex items-center gap-1 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":"Повернутись до живого хвоста",onClick:()=>{let a=p.current;a&&(a.scrollTop=a.scrollHeight),E(!0,!0)},children:[(0,d.jsx)(ah,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",w?`${w} нових`:"вниз"]}):null,(0,d.jsx)("div",{ref:p,className:l?"min-h-0 flex-1 overflow-y-auto py-3":"min-h-0 flex-1 overflow-y-auto py-6",onScroll:a=>{let b=a.currentTarget,c=b.scrollTop+b.clientHeight>=b.scrollHeight-50;c&&!C.current?E(!0,!0):!c&&C.current&&E(!1),b.scrollTop<120&&K&&!o.loadingOlder&&!o.loading&&J()},children:(0,d.jsx)("div",{ref:q,className:l?"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:[l&&K?(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:J,children:o.loadingOlder?"завантаження…":(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(ao,{className:"h-3.5 w-3.5","aria-hidden":!0})," показати раніше"]})}):null,!l&&K&&F.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:J,children:o.loadingOlder?"завантаження…":G?`показати раніше (сховано ${G})`:"завантажити раніше з файлу"}):null,l||K||!F.items.length?null:(0,d.jsx)("div",{className:"mb-3 text-center text-[11px] text-dim",children:"початок розмови"}),l?null:(0,d.jsx)(aX,{file:a,files:b,onSelect:c}),F.items.length?(0,d.jsxs)(d.Fragment,{children:[H.map((a,b)=>{let c=b+F.items.length-H.length;return l?(0,d.jsx)("div",{className:"feed-cv",children:(0,d.jsx)(bM,{item:a})},c):(0,d.jsx)(bM,{item:a},c)}),a.pendingQuestion||a.waitingInput?(0,d.jsx)(bP,{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)(bQ,{icon:M.icon,label:M.label}):null,"recent"===a.activity&&X(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})," закінчив хід — чекає відповіді"]}):"recent"===a.activity&&r(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)(ae,{className:"h-3.5 w-3.5","aria-hidden":!0})," повернувся з результатом"]}):null]}):(0,d.jsxs)("div",{className:"mt-[14vh] text-center text-dim",children:[o.loading?"Завантаження…":0===o.size?"Ще без виводу — файл поки порожній":F.hiddenServiceCount?`Видимих повідомлень нема — лише службові записи (${F.hiddenServiceCount}). Натисни \xabСлужбові\xbb`:"Порожньо (немає рядків для показу)",!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]}),F.items.length?null:a.pendingQuestion||a.waitingInput?(0,d.jsx)(bP,{file:a},a.pendingQuestion?.toolUseId??"waiting"):null]}):(0,d.jsx)("div",{className:"mt-[20vh] text-center text-dim",children:"Вибери лог зліва — стрічка оновлюється сама"})})})]})}let bS={completed:"✓",in_progress:"▸",pending:"○"};function bT({plan:a}){let b=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:["План агента:",...a.steps.map(a=>`${bS[a.status]} ${a.text}`)].join("\n"),"aria-label":`План: ${a.done} з ${a.total} кроків${a.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:`${b}%`}})})]})}let bU={active:{label:"ціль",className:"bg-[#f1f0fc] text-accent"},complete:{label:"ціль ✓",className:"bg-[#e7f4ea] text-ok"},blocked:{label:"ціль ✖",className:"bg-[#fbeaea] text-err"}};function bV({ctx:a}){var b;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:`Контекстне вікно: використано ${a.pct}%
|
|
6
|
-
${a.usedTokens.toLocaleString("uk-UA")} з ${a.windowTokens.toLocaleString("uk-UA")} токенів`,"aria-label":`Контекст: використано ${a.pct} відсотків вікна`,children:["ctx ",a.pct,"%"]})}function bW({goal:a}){let b,c=bU[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 ${c.className}`,title:(b=[a.objective??"(objective не записаний у хвості транскрипта)"],null!==a.tokensUsed&&b.push(`токенів: ${a.tokensUsed.toLocaleString("uk-UA")}`),null!==a.timeUsedSeconds&&b.push(`часу: ${Math.round(a.timeUsedSeconds/60)} хв`),b.join("\n")),"aria-label":`Ціль сесії: ${a.status}${a.objective?` — ${a.objective.slice(0,120)}`:""}`,children:c.label})}function bX({onError:a,onUnclaimedText:b}){let[c,d]=(0,e.useState)("idle"),[f,g]=(0,e.useState)(0),h=(0,e.useRef)(null),i=(0,e.useRef)([]),j=(0,e.useRef)(!1),k=(0,e.useRef)(null),l=(0,e.useRef)(null),m=(0,e.useRef)(null),n=(0,e.useRef)(null),o=(0,e.useRef)(!1),p=async()=>{let c;null!==k.current&&(clearInterval(k.current),k.current=null),c=m.current,m.current=null,c&&(cancelAnimationFrame(c.raf),c.ctx.close().catch(()=>void 0));let e=h.current;h.current=null,e?.stream.getTracks().forEach(a=>a.stop());let f=new Blob(i.current,{type:"audio/webm"});i.current=[];let g=n.current;if(n.current=null,j.current||f.size<2e3){d("idle"),g?.(null);return}d("busy");try{let c=new FormData;c.append("file",f,"dictation.webm");let d=await fetch("/api/transcribe",{method:"POST",body:c}),e=await d.json();if(!d.ok||"string"!=typeof e.text){a(e.error??"не вдалося розпізнати"),g?.(null);return}let h=e.text.trim();h?g?g(h):b(h):(a("тиша — нічого не розпізналось"),g?.(null))}catch{a("сервер недоступний"),g?.(null)}finally{d("idle")}},q=async()=>{let b;if(o.current||h.current)return;o.current=!0;try{b=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1}})}catch{a("немає доступу до мікрофона");return}finally{o.current=!1}let c=MediaRecorder.isTypeSupported("audio/webm;codecs=opus")?"audio/webm;codecs=opus":"audio/webm",e=new MediaRecorder(b,{mimeType:c});i.current=[],j.current=!1,e.ondataavailable=a=>{a.data.size&&i.current.push(a.data)},e.onstop=()=>{p()},e.start(250),h.current=e,(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(!m.current)return;m.current.raf=requestAnimationFrame(e),c.getByteFrequencyData(d);let a=l.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)};m.current={ctx:b,raf:requestAnimationFrame(e)}})(b),g(0),d("rec"),k.current=window.setInterval(()=>{g(a=>{let b=a+1;return b>=120&&h.current?.state==="recording"&&h.current.stop(),b})},1e3)};return{phase:c,elapsed:f,canvasRef:l,start:q,stop:()=>new Promise(a=>{let b=h.current;b&&"recording"===b.state?(n.current=a,b.stop()):a(null)}),discard:()=>{j.current=!0,h.current?.state==="recording"&&h.current.stop()}}}let bY={"image/png":"png","image/jpeg":"jpg","image/jpg":"jpg","image/gif":"gif","image/webp":"webp"};function bZ(a){return new Promise((b,c)=>{let d=new FileReader;d.onload=()=>{let e=String(d.result),f=e.indexOf(",");f<0?c(Error("не вдалося прочитати картинку")):b({base64:e.slice(f+1),mime:a.type||"image/png",preview:e})},d.onerror=()=>c(d.error??Error("не вдалося прочитати картинку")),d.onabort=()=>c(Error("читання картинки перервано")),d.readAsDataURL(a)})}function b$(a){let[b,c]=(0,e.useState)([]),d=b=>{if(!b.length)return;let d=[];for(let c of b){if(null===(bY[c.type]??null)){a.onError(`непідтримуваний формат картинки: ${c.name||c.type||"невідомий файл"}`);continue}if(c.size>0xa00000){a.onError(`${c.name||"картинка"}: завелика (ліміт 10 МБ)`);continue}d.push(c)}if(!d.length)return;let e=d.length<b.length;Promise.all(d.map(bZ)).then(b=>{c(a=>[...a,...b]),e||a.onAdded?.()}).catch(b=>{a.onError(b instanceof Error?b.message:"помилка картинки")})};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([])}}function b_({images:a,onRemove:b}){return a.length?(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[a.map((a,c)=>(0,d.jsxs)("div",{className:"group/img relative",children:[(0,d.jsx)("img",{src:a.preview,alt:`прев'ю картинки ${c+1}`,className:"h-10 w-10 rounded border border-line object-cover"}),(0,d.jsx)("button",{type:"button",onClick:()=>b(c),"aria-label":`Прибрати картинку ${c+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)(l,{className:"h-2.5 w-2.5","aria-hidden":!0})})]},c)),(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 text-[10.5px] font-semibold text-dim",children:[a.length," ",1===a.length?"картинка":"картинки"," ",(0,d.jsx)(ai,{className:"h-3 w-3","aria-hidden":!0})," шляхами до файлів"]})]}):null}function b0({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)(ar,{className:"h-4 w-4","aria-hidden":!0})})]})}function b1({phase:a,elapsed:b,canvasRef:c,start:e,stop:f,discard:g,onText:h,busy:i=!1}){let j=()=>{i||("idle"===a?e():"rec"===a&&f().then(a=>{a&&h(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":"Зупинити запис і розпізнати",onClick:j,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":"Скасувати запис",onClick:g,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)(l,{className:"h-3.5 w-3.5","aria-hidden":!0})})]});return(0,d.jsx)("button",{type:"button","aria-label":"busy"===a?"Розпізнаю…":"Надиктувати",title:"busy"===a?"розпізнаю…":"надиктувати (до 2 хв)",disabled:"busy"===a||i,onClick:j,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 disabled:opacity-60",children:"busy"===a?(0,d.jsx)(aH,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):(0,d.jsx)(au,{className:"h-4 w-4","aria-hidden":!0})})}function b2(a){return"claude-projects"===a.root?"сесія"===a.kind||"субагент"===a.kind:"codex-sessions"===a.root}function b3({file:a}){let b=function(a,b){let[c,d]=(0,e.useState)(null);return null!==a||b?c:null}(a.pid,b2(a)?a.path:void 0),[c,f]=(0,e.useState)(()=>""),g=(0,e.useRef)(c),h=b=>{let c="function"==typeof b?b(g.current):b;(g.current=c,f(c),c)?sessionStorage.setItem("llvDraft:"+a.path,c):sessionStorage.removeItem("llvDraft:"+a.path)},[i,j]=(0,e.useState)(!1),[k,m]=(0,e.useState)(!1),[n,o]=(0,e.useState)(!1),[p,q]=(0,e.useState)(null),[r,s]=(0,e.useState)([]),t=(0,e.useRef)(null),u=b$({onError:a=>q({kind:"err",text:a}),onAdded:()=>q(null)}),v=a=>{h(b=>b?b.trimEnd()+" "+a:a),q(null),t.current?.focus()},w=bX({onError:a=>q({kind:"err",text:a}),onUnclaimedText:v}),x=b2(a);if(null===b&&!x)return null;let y=null===b,z=y&&"claude-projects"===a.root&&"субагент"===a.kind,A=b=>{s(b),sessionStorage.setItem("llvSent:"+a.path,JSON.stringify(b))},B=async b=>{let d=b??c;if(!i&&!k&&(d.trim()||u.images.length)){j(!0),q(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:u.images.map(a=>({base64:a.base64,mime:a.mime}))})}),c=await b.json();if(!b.ok||!c.ok)return void q({kind:"err",text:c.error??"не вдалося надіслати"});let e=u.images.length,f={id:Date.now(),text:d.trim()||(e?`${e} ${1===e?"картинка":"картинки"}`:""),at:Date.now(),via:c.spawned?"spawn":"pane"};A([...r,f].slice(-8)),h(""),u.clear(),q({kind:"ok",text:c.spawned?`запущено агента в tmux ${c.target??""}`:c.imagePaths?.length?`надіслано ${c.imagePaths.length} шлях(и)`:"надіслано"}),t.current?.focus()}catch{q({kind:"err",text:"сервер недоступний"})}finally{j(!1)}}},C=async()=>{if(!i&&!k){m(!0);try{let a=await w.stop();if(null===a)return;let b=g.current?g.current.trimEnd()+" "+a:a;h(b),await B(b)}finally{m(!1)}}},D=async()=>{if(!n){o(!0),q(null);try{let b=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"interrupt",path:a.path})}),c=await b.json();if(!b.ok||!c.ok)return void q({kind:"err",text:c.error??"не вдалося перервати"});q({kind:"ok",text:"надіслано Escape — агент перервано"})}catch{q({kind:"err",text:"сервер недоступний"})}finally{o(!1)}}},E="rec"===w.phase,F="busy"===w.phase,G=!i&&!k&&!F&&(E||!!c.trim()||u.images.length>0),H=i||k;return(0,d.jsxs)("form",{onSubmit:a=>{a.preventDefault(),B()},className:"flex shrink-0 flex-col gap-1.5 border-t border-line bg-[#fbfbfd] px-2.5 py-2","aria-label":y?"Запустити агента з промптом у tmux":`Надіслати повідомлення агенту в tmux ${b}`,children:[r.length?(0,d.jsx)("div",{className:"flex flex-col gap-0.5","aria-label":"Черга надісланих повідомлень",children:r.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)(av,{className:"h-2.5 w-2.5","aria-hidden":!0}):(0,d.jsx)(ai,{className:"h-2.5 w-2.5","aria-hidden":!0}),new Date(a.at).toLocaleTimeString("uk",{hour12:!1,hour:"2-digit",minute:"2-digit"})]}),(0,d.jsx)("button",{type:"button","aria-label":"Прибрати з черги",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:()=>A(r.filter(b=>b.id!==a.id)),children:(0,d.jsx)(l,{className:"h-3 w-3","aria-hidden":!0})})]},a.id))}):null,(0,d.jsx)("textarea",{ref:t,value:c,rows:1,onChange:a=>h(a.target.value),onPaste:u.handlePaste,onKeyDown:a=>{"Enter"!==a.key||a.shiftKey||a.nativeEvent.isComposing||(a.preventDefault(),"rec"===w.phase?C():B())},placeholder:z?"написати — передам через кореневу сесію…":y?"промпт — агент запуститься в tmux…":"написати агенту…","aria-label":"Текст для агента",disabled:H,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:[(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-1.5 py-1 font-mono text-[9.5px] font-semibold text-[#555]",title:z?"передасться через кореневу сесію гілки":y?"нове tmux-вікно з відновленим агентом":`tmux ${b}`,children:z?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(aj,{className:"h-3 w-3 shrink-0","aria-hidden":!0})," корінь"]}):y?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(av,{className:"h-3 w-3 shrink-0","aria-hidden":!0})," resume"]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(ay,{className:"h-3 w-3 shrink-0","aria-hidden":!0})," ",(0,d.jsx)("span",{className:"truncate",children:b})]})}),y?null:(0,d.jsx)("button",{type:"button","aria-label":"Перервати агента (Escape)",title:"надіслати Escape у пейн агента",disabled:n,onClick:()=>void D(),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:n?(0,d.jsx)(aH,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):(0,d.jsx)(ax,{className:"h-4 w-4",fill:"currentColor","aria-hidden":!0})})]}),(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5",children:[(0,d.jsx)(b1,{...w,busy:k,onText:v}),(0,d.jsx)(b0,{ariaLabel:"Додати картинки",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:u.addFiles}),(0,d.jsx)("button",{type:E?"button":"submit",onClick:E?()=>void C():void 0,disabled:!G,"aria-label":E?"Зупинити запис і надіслати":y?"Запустити агента":"Надіслати агенту",title:E?"зупинити запис і надіслати":void 0,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 ${E?"border-err bg-err hover:opacity-90":"border-accent bg-accent hover:opacity-90"}`,children:i||k?(0,d.jsx)(aH,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):(0,d.jsx)(av,{className:"h-4 w-4","aria-hidden":!0})})]})]}),(0,d.jsx)(b_,{images:u.images,onRemove:u.removeAt}),p?(0,d.jsx)("span",{className:`truncate text-[10.5px] font-semibold ${"ok"===p.kind?"text-ok":"text-err"}`,children:p.text}):null]})}let b4=()=>void 0,b5={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"}},b6={live:"працює",waiting:"закінчив хід — чекає відповіді",returned:"повернувся з результатом",stalled:"перервано або чекає дозволу",done:"завершено — можна прибрати"};function b7({file:a,files:b,tasks:c,onSelect:f,isRoot:g,onClose:h,dragHandle:i,noComposer:j,banner:k}){let n=(0,e.useRef)(null),o=U(a),p=function(a,b=Date.now()/1e3){return a.pendingQuestion||a.waitingInput?"waiting":"live"===a.activity?"live":"recent"===a.activity&&s(a)&&"running"!==a.proc?"returned":X(a,b)?"stalled"===a.activity?"stalled":"waiting":"done"}(a),q=b5[p];return(0,d.jsxs)("section",{ref:n,"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 ${g?"border-t-4":"border-t-2"} ${q.section} ${q.glow?"pane-attention":""}`,style:{..."done"===p?{borderTopColor:"#c9c9d1"}:{borderTopColor:P(a).color},...q.glow?{"--pane-glow":q.glow}:null},children:[(0,d.jsxs)("header",{className:`flex h-10 shrink-0 items-center gap-1.5 border-b border-line px-2.5 ${q.header} ${i?"cursor-grab active:cursor-grabbing":""}`,...i,children:[(0,d.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${K(a.activity)}`,title:b6[p]}),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:S(a).soft,color:S(a).color},title:[o.label,T(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:o.style,children:o.label}),a.ctx?(0,d.jsx)(bV,{ctx:a.ctx}):null,a.worktree?(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:`Ворк-дерево ${a.worktree}`,children:[(0,d.jsx)(ad,{className:"h-2.5 w-2.5","aria-hidden":!0})," ",a.worktree]}):null,a.plan?(0,d.jsx)(bT,{plan:a.plan}):null,a.goal?(0,d.jsx)(bW,{goal:a.goal}):null,g?null:(0,d.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-0.5 text-[10px] text-dim",title:a.handoff?"агент, породжений хендоффом цієї розмови":"гілка цієї розмови",children:[(0,d.jsx)(ae,{className:"h-3 w-3","aria-hidden":!0})," ",a.handoff?"хендофф":a.kind]}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12px] font-semibold",title:m(a.title),children:m(a.title,90)}),(0,d.jsx)(aW,{file:a,compact:!0}),(0,d.jsx)(aR,{file:a,onDeleted:h}),h?(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(a.title,60)}`,onClick:h,children:(0,d.jsx)(l,{className:"h-3 w-3","aria-hidden":!0})}):null]}),k??null,c.length?(0,d.jsx)(aS,{className:"shrink-0 border-b border-line bg-[#fbfbfd]",enter:"fade",children:c.map(a=>(0,d.jsx)("div",{"data-flip-key":a.path,children:(0,d.jsx)(b8,{file:a,files:b,onSelect:f})},a.path))}):null,(0,d.jsx)(bR,{file:a,files:b,onSelect:f,showSvc:!1,lineFilter:"",onStatus:b4,paused:!1,follow:!0,setFollow:b4,compact:!0}),j?null:(0,d.jsx)(b3,{file:a}),("claude-projects"===a.root||"codex-sessions"===a.root)&&a.path.endsWith(".jsonl")?(0,d.jsx)(aZ,{file:a,paneRef:n}):null]})}function b8({file:a,files:b,onSelect:c}){let[f,g]=(0,e.useState)(!1),h=m(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 h-7 items-center gap-1.5 pl-2 pr-2.5",children:[(0,d.jsxs)("button",{className:"flex h-full 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":`${f?"Згорнути":"Розгорнути"} фонову задачу ${h}`,onClick:()=>g(a=>!a),children:[(0,d.jsx)(an,{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 ${K(a.activity)}`}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-semibold",title:m(a.title),children:h})]}),(0,d.jsx)(aW,{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)(bR,{file:a,files:b,onSelect:c,showSvc:!1,lineFilter:"",onStatus:b4,paused:!1,follow:!0,setFollow:b4,compact:!0})}):null]})}let b9=[{key:"claude",label:"Claude"},{key:"codex",label:"Codex"}],ca=(a,b)=>`llvDraftPane:${a}:${b}`;function cb(a,b,c){c?sessionStorage.setItem(ca(a,b),c):sessionStorage.removeItem(ca(a,b))}function cc({draftId:a,project:b,files:c,onClose:f,onSpawned:g}){let[h,i]=(0,e.useState)(()=>"claude"),[j,k]=(0,e.useState)(()=>""),[m,n]=(0,e.useState)([]),[o,p]=(0,e.useState)(()=>""),[q,r]=(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}})()),[s,t]=(0,e.useState)(!1),[u,v]=(0,e.useState)(!1),[w,x]=(0,e.useState)(!1),[y,z]=(0,e.useState)(null),A=(0,e.useRef)(null),B=(0,e.useRef)(null),C=(0,e.useRef)(o),D=b=>{let c="function"==typeof b?b(C.current):b;C.current=c,p(c),cb(a,"text",c)},E=b$({onError:a=>z({kind:"err",text:a}),onAdded:()=>z(null)}),F=a=>{D(b=>b?b.trimEnd()+" "+a:a),z(null),A.current?.focus()},G=bX({onError:a=>z({kind:"err",text:a}),onUnclaimedText:F}),H=async b=>{let d=b??o;if(!s&&!u&&!q){if(!j.trim())return void z({kind:"err",text:"вкажи робочу директорію"});if(d.trim()||E.images.length){t(!0),z(null);try{var e;let b=await fetch("/api/spawn",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({engine:h,cwd:j.trim(),prompt:d,images:E.images.map(a=>({base64:a.base64,mime:a.mime}))})}),f=await b.json();if(!b.ok||!f.ok)return void z({kind:"err",text:f.error??"не вдалося запустити"});B.current=new Set(c.map(a=>a.path)),e={at:Date.now(),target:f.target??"",path:f.path??null,prompt:d.trim()},r(e),cb(a,"boot",e?JSON.stringify(e):""),D(""),E.clear()}catch{z({kind:"err",text:"сервер недоступний"})}finally{t(!1)}}}},I=async()=>{if(!s&&!u){v(!0);try{let a=await G.stop();if(null===a)return;let b=C.current?C.current.trimEnd()+" "+a:a;D(b),await H(b)}finally{v(!1)}}},J=L[h]??M,K="rec"===G.phase,N="busy"===G.phase,O=s||u||!!q,P=!O&&!N&&(K||!!o.trim()||E.images.length>0),Q="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-t-4 border-line bg-panel shadow-card",style:{borderTopColor:J.color},"aria-label":"Чернетка нової розмови з агентом",children:[(0,d.jsxs)("header",{className:"flex h-10 shrink-0 items-center gap-1.5 border-b border-line px-2.5",style:{backgroundColor:J.soft},children:[(0,d.jsx)("span",{className:"h-2 w-2 shrink-0 rounded-full bg-[#c9c9d1]",title:"агент ще не запущений"}),(0,d.jsx)("div",{className:"flex shrink-0 items-center gap-1",role:"radiogroup","aria-label":"Двигун агента",children:b9.map(({key:b,label:c})=>{let e=h===b,f=L[b]??M;return(0,d.jsx)("button",{type:"button",role:"radio","aria-checked":e,disabled:O,onClick:()=>{i(b),cb(a,"engine",b)},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",children:"нова розмова"}),(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":"Прибрати чернетку розмови",onClick:f,children:(0,d.jsx)(l,{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:"директорія"}),(0,d.jsx)("input",{value:j,disabled:O,onChange:b=>{var c;k(c=b.target.value),cb(a,"cwd",c)},list:Q,placeholder:"/home/…/Projects/…","aria-label":"Робоча директорія агента",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:Q,children:m.map(a=>(0,d.jsx)("option",{value:a},a))})]}),(0,d.jsx)("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto px-4 py-4",children:q?(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:q.prompt||"(картинки)"})}),(0,d.jsxs)("div",{className:"flex items-center gap-2 text-[11.5px] font-semibold text-dim",children:[(0,d.jsx)(aH,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}),(0,d.jsxs)("span",{children:["агент запущений у tmux ",q.target,"— чекаю, поки розмова з'явиться тут…"]})]}),w?(0,d.jsxs)("div",{className:"text-[11px] text-dim",children:["Щось довго. Перевір вікно tmux ",q.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:J.soft,color:J.color},children:"claude"===h?"Claude":"Codex"}),(0,d.jsx)("div",{className:"max-w-[360px] text-[12px] text-dim",children:"Обери двигун і директорію, напиши перший промпт — агент запуститься в tmux, і розмова продовжиться в цій самій панелі."})]})}),(0,d.jsxs)("form",{onSubmit:a=>{a.preventDefault(),H()},className:"flex shrink-0 flex-col gap-1.5 border-t border-line bg-[#fbfbfd] px-2.5 py-2","aria-label":"Перший промпт для нового агента",children:[(0,d.jsx)("textarea",{ref:A,value:o,rows:1,onChange:a=>D(a.target.value),onPaste:E.handlePaste,onKeyDown:a=>{"Enter"!==a.key||a.shiftKey||a.nativeEvent.isComposing||(a.preventDefault(),"rec"===G.phase?I():H())},placeholder:"перший промпт — агент запуститься в tmux…","aria-label":"Текст першого промпта",disabled:O,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:[(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:"нове tmux-вікно зі свіжим агентом",children:[(0,d.jsx)(av,{className:"h-3 w-3 shrink-0","aria-hidden":!0})," новий агент"]}),(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5",children:[(0,d.jsx)(b1,{...G,busy:u,onText:F}),(0,d.jsx)(b0,{ariaLabel:"Додати картинки до промпта",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:E.addFiles}),(0,d.jsx)("button",{type:K?"button":"submit",onClick:K?()=>void I():void 0,disabled:!P,"aria-label":K?"Зупинити запис і запустити агента":"Запустити агента",style:K?void 0:{backgroundColor:J.color,borderColor:J.color},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 ${K?"border-err bg-err hover:opacity-90":"hover:opacity-90"}`,children:s||u?(0,d.jsx)(aH,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):(0,d.jsx)(av,{className:"h-4 w-4","aria-hidden":!0})})]})]}),(0,d.jsx)(b_,{images:E.images,onRemove:E.removeAt}),y?(0,d.jsx)("span",{className:`truncate text-[10.5px] font-semibold ${"ok"===y.kind?"text-ok":"text-err"}`,children:y.text}):null]})]})}let cd=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"}]]),ce=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"}]]),cf=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"}]]),cg=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"}]]),ch=["low","medium","high","xhigh"],ci={implementer:{engine:"claude",model:null,effort:null},reviewer:{engine:"codex",model:null,effort:"xhigh"}};function cj({label:a,role:b,onChange:c}){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":`Двигун: ${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:"модель (дефолт)","aria-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})}),"codex"===b.engine?(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:"effort: дефолт"}),ch.map(a=>(0,d.jsx)("option",{value:a,children:a},a))]}):null]})}function ck({file:a,onClose:b}){let[c,f]=(0,e.useState)([]),[g,h]=(0,e.useState)(null),[i,j]=(0,e.useState)(ci),[k,l]=(0,e.useState)(!1),[m,n]=(0,e.useState)("head"),[o,p]=(0,e.useState)("auto"),[q,r]=(0,e.useState)("headless"),[s,t]=(0,e.useState)(5),[u,v]=(0,e.useState)(!1),[w,x]=(0,e.useState)(null),y=async()=>{if(!u){v(!0),x(null);try{let c=await fetch("/api/flows",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({implementerPath:a.path,...k||!g?{roles:i}:{preset:g},baseMode:m,mode:o,reviewerMode:q,roundLimit:s})});if(!c.ok){let a=await c.json().catch(()=>null);x(a?.error??`не вдалося створити флоу (${c.status})`);return}b()}catch{x("сервер недоступний")}finally{v(!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:"Запустити флоу"}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[10.5px] text-dim",children:"implement → review \xb7 ця розмова стає виконавцем"})]}),c.length?(0,d.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-dim",children:["пресет",(0,d.jsx)("select",{value:g??"",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 d;return h(b=a.target.value),void((d=c.find(a=>a.name===b))&&j({implementer:d.implementer,reviewer:d.reviewer}))},children:c.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":k,onClick:()=>l(a=>!a),children:k?"▾ ролі вручну":"▸ ролі вручну (модель / effort)"}),k?(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)(cj,{label:"виконавець",role:i.implementer,onChange:a=>j(b=>({...b,implementer:a}))}),(0,d.jsx)(cj,{label:"ревʼюер",role:i.reviewer,onChange:a=>j(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:["база діфу",(0,d.jsxs)("select",{value:m,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=>n(a.target.value),children:[(0,d.jsx)("option",{value:"head",children:"від поточного HEAD"}),(0,d.jsx)("option",{value:"merge-base",children:"від merge-base з main"})]})]}),(0,d.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-dim",children:["ревʼюер",(0,d.jsxs)("select",{value:q,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=>r(a.target.value),children:[(0,d.jsx)("option",{value:"headless",children:"headless (без панелі)"}),(0,d.jsx)("option",{value:"pane",children:"tmux-панель"})]})]}),(0,d.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-dim",children:["переходи",(0,d.jsxs)("select",{value:o,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=>p(a.target.value),children:[(0,d.jsx)("option",{value:"auto",children:"авто"}),(0,d.jsx)("option",{value:"manual",children:"вручну (гейт на кожен крок)"})]})]}),(0,d.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-dim",children:["ліміт раундів",(0,d.jsx)("input",{type:"number",min:1,max:20,value:s,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=>t(Math.max(1,Math.min(20,Number(a.target.value)||5)))})]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[w?(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[10.5px] font-semibold text-err",children:w}):(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:"Скасувати"}),(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:u,onClick:()=>void y(),children:u?"створюю…":"▶ Запустити"})]})]})}let cl=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"}]]),cm={waiting_ready:{label:"Почати ревью",action:"advance"},spawn_pending:{label:"Заспавнити ревʼюера",action:"advance"},relay_pending:{label:"Передати зауваження",action:"advance"},needs_decision:{label:"Повторити раунд",action:"retry-round"},done_comment:{label:"Ще коло",action:"another-round"}},cn=new Set(["spawning","reviewing","relaying","fixing"]);function co({flow:a,onFocusRound:b}){let[c,f]=(0,e.useState)(!1),[g,h]=(0,e.useState)(null),i=async(b,d)=>{if(c)return;f(!0),h(null);let e=await G(a.id,{action:b,...d});e&&h(e),f(!1)},j=cm[a.state],k=D.has(a.state),m="closed"===a.state||"approved"===a.state;return(0,d.jsxs)("div",{"data-scheme-ui":!0,className:`pointer-events-auto flex h-8 max-w-full items-center gap-1.5 overflow-x-auto rounded-full border bg-panel px-2 shadow-card ${k?"border-[#e0ae45]/70":"border-line"}`,children:[(0,d.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${"approved"===a.state?"bg-ok":"needs_decision"===a.state?"bg-err":"paused"===a.state?"bg-[#e0ae45]":cn.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-wide text-dim",children:"ФЛОУ"}),(0,d.jsxs)("span",{className:"shrink-0 text-[11px] font-semibold",title:a.stateDetail??void 0,children:[C[a.state],a.stateDetail?(0,d.jsxs)("span",{className:"text-dim",children:[" \xb7 ",a.stateDetail]}):null]}),a.rounds.length?(0,d.jsx)("span",{className:"flex shrink-0 items-center gap-1","aria-label":"Раунди ревью",children:a.rounds.map(a=>{let c=F(a.verdict),e=null===a.verdict&&!a.error;return(0,d.jsxs)("button",{className:`inline-flex h-5 items-center gap-0.5 rounded-full px-1.5 text-[10px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${e?"animate-pulse":""}`,style:{backgroundColor:c.soft,color:c.color},title:a.error?`Раунд ${a.n}: ${a.error}`:a.verdict?`Раунд ${a.n}: ${a.verdict}${null!=a.findingsCount?` \xb7 ${a.findingsCount} знахідок`:""}`:`Раунд ${a.n}: триває`,onClick:()=>b?.(a.n),children:["R",a.n,a.verdict?(0,d.jsx)("span",{children:E[a.verdict]}):e?(0,d.jsx)("span",{children:"⏳"}):(0,d.jsx)("span",{children:"!"}),null!=a.findingsCount&&a.findingsCount>0?(0,d.jsx)("span",{children:a.findingsCount}):null]},a.n)})}):null,j?(0,d.jsx)("button",{className:"shrink-0 rounded-full border border-accent bg-accent px-2.5 py-0.5 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:c,onClick:()=>void i(j.action),children:j.label}):null,"needs_decision"===a.state?(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 disabled:opacity-40",disabled:c,title:"Додати ще раунди до ліміту",onClick:()=>void i("extend",{rounds:2}),children:"+2 раунди"}):null,m?null:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("button",{className:`shrink-0 rounded-full border px-2 py-0.5 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:c,title:"auto"===a.mode?"Авто: переходи самі. Клік — вручну.":"Вручну: кожен перехід чекає кліку. Клік — авто.",onClick:()=>void i("set-mode",{mode:"auto"===a.mode?"manual":"auto"}),children:"auto"===a.mode?"авто":"вручну"}),"paused"===a.state?(0,d.jsx)("button",{className:"inline-flex h-5 w-5 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:c,title:"Продовжити флоу","aria-label":"Продовжити флоу",onClick:()=>void i("resume"),children:(0,d.jsx)(av,{className:"h-3.5 w-3.5","aria-hidden":!0})}):(0,d.jsx)("button",{className:"inline-flex h-5 w-5 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:c,title:"Пауза","aria-label":"Пауза",onClick:()=>void i("pause"),children:(0,d.jsx)(bN,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),c?(0,d.jsx)(cl,{className:"h-3 w-3 shrink-0 animate-spin text-dim","aria-hidden":!0}):null,g?(0,d.jsx)("span",{className:"shrink-0 text-[10.5px] font-semibold text-err",children:g}):null,(0,d.jsx)("button",{className:"inline-flex h-5 w-5 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:c,title:"Закрити флоу","aria-label":"Закрити флоу",onClick:()=>void i("close"),children:(0,d.jsx)(l,{className:"h-3 w-3","aria-hidden":!0})})]})}function cp(a){return a.error?`Раунд ${a.n} \xb7 перервано`:a.verdict?`Раунд ${a.n} \xb7 ${E[a.verdict]} ${a.verdict}`:`Раунд ${a.n} \xb7 триває`}function cq({round:a,depth:b,pulse:c,onPull:e}){let f=F(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?`${cp(a)}: ${a.error}`:cp(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:f.soft,color:f.color},children:["R",a.n," ",a.verdict?E[a.verdict]:a.error?"!":"⏳"]}),(0,d.jsxs)("span",{className:"min-w-0 flex-1 truncate text-[10.5px] font-semibold text-dim",children:[a.error?"перервано":a.verdict?a.verdict:"ревью триває",null!=a.findingsCount&&a.findingsCount>0?` \xb7 ${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 cr({flow:a,rounds:b,files:c,onSelect:f,focusRound:g}){let h=b.length?b[b.length-1]:null,[i,j]=(0,e.useState)(null),[k,l]=(0,e.useState)(null);null!=g&&g!==k&&(l(g),j(Math.round(g)));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:"чекаю на перший раунд ревью…"})});let p=b.filter(a=>a.round.n!==o.round.n).reverse(),q=p.slice(0,5),r=p.length-q.length,s=F(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)(b7,{file:o.file,files:c,tasks:[],onSelect:f,isRoot:!1,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:[cp(o.round),null!=o.round.findingsCount&&o.round.findingsCount>0?(0,d.jsxs)("span",{className:"font-semibold opacity-80",children:["\xb7 ",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:cp(o.round)}),(0,d.jsx)("span",{className:"text-[11px] text-dim",children:o.round.error?o.round.error:"запускаю ревʼюера — транскрипт зʼявиться за мить…"})]})},o.round.n),q.map((a,b)=>(0,d.jsx)(cq,{round:a.round,depth:b,pulse:u?.round.n===a.round.n,onPull:()=>j(a.round.n)},a.round.n)),r>0?(0,d.jsxs)("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:["ще ",r," раунд(и) — клікни чипи на стрічці флоу"]}):null]})}let cs=new Set(["spawning","reviewing","relaying"]);function ct({layout:a,cam:b,vp:c,onJump:f}){let g=(0,e.useRef)(null),h=(0,e.useRef)(!1),i=Math.min(216/a.width,148/a.height),j=(216-a.width*i)/2,k=(148-a.height*i)/2,l=a=>{let b=g.current?.getBoundingClientRect();b&&f((a.clientX-b.left-j)/i,(a.clientY-b.top-k)/i)};return(0,d.jsx)("div",{ref:g,"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:"Мінімапа — клікни або тягни, щоб перейти",onPointerDown:a=>{a.stopPropagation(),h.current=!0,l(a);try{a.currentTarget.setPointerCapture(a.pointerId)}catch{}},onPointerMove:a=>{h.current&&l(a)},onPointerUp:a=>{h.current=!1;try{a.currentTarget.releasePointerCapture(a.pointerId)}catch{}},onPointerCancel:()=>{h.current=!1},children:(0,d.jsx)("svg",{width:216,height:148,"aria-hidden":!0,children:(0,d.jsxs)("g",{transform:`translate(${j} ${k}) scale(${i})`,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.nodes.map(a=>(0,d.jsx)("rect",{x:a.x,y:a.y,width:a.w,height:a.h,rx:18,fill:P(a.file).color,opacity:"live"===a.file.activity?.85:.35},a.file.path)),(0,d.jsx)("rect",{x:-b.x/b.z,y:-b.y/b.z,width:c.w/b.z,height:c.h/b.z,fill:"rgba(90,81,224,0.08)",stroke:"#5a51e0",strokeWidth:2.5/i})]})})})}let cu="cubic-bezier(.22,.8,.36,1)",cv=`transform 380ms ${cu}`,cw=(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 ${cu}`},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 ${cu}, cy 380ms ${cu}`}}),(0,d.jsx)("path",{d:e,style:{d:`path("${e}")`,transition:`d 380ms ${cu}`},fill:a.color})]},a.to)})})});function cx({file:a,onSelect:b}){let c=U(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:m(a.title),onClick:()=>b(a),children:[(0,d.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${K(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:m(a.cmdDesc||a.title,80)}),(0,d.jsx)("span",{className:"shrink-0 text-[10.5px] text-dim",children:H(a.mtime)})]})}function cy({file:a}){let b=U(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 ${K(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:m(a.title,70)})]})})}function cz({stack:a,onSelect:b}){return(0,d.jsx)("div",{"data-scheme-node":a.key,className:"scheme-enter absolute",style:{transform:`translate(${a.x}px, ${a.y}px)`,width:a.w,height:a.h,transition:cv},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:c})=>{let e=U(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:m(a.title),onClick:()=>b(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 ${K(a.activity)}`}),(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:e.style,children:e.label}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-semibold",children:m(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:a.kind}),(0,d.jsx)("span",{children:H(a.mtime)}),c?(0,d.jsxs)("span",{children:["⤷ ",c]}):null]})]},a.path)})})})}function cA({node:a,files:b,ringed:c,flow:f,canFlow:g,onSelect:h,onClose:i,onFocusRound:j}){let[k,l]=(0,e.useState)(!1),[m,n]=(0,e.useState)(!1);return(0,d.jsxs)("div",{"data-scheme-node":a.file.path,className:`scheme-enter absolute ${k||m?"z-20":""}`,style:{transform:`translate(${a.x}px, ${a.y}px)`,width:a.w,height:a.h,transition:cv},children:[f?(0,d.jsx)("div",{className:"absolute inset-x-0 -top-10 z-[4] flex justify-center",children:(0,d.jsx)(co,{flow:f,onFocusRound:a=>j(f.id,a)})}):g?(0,d.jsx)("div",{className:"absolute -top-10 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":m,title:"Запустити цикл implement → review для цієї розмови",onClick:()=>n(a=>!a),children:[(0,d.jsx)("span",{className:"text-[13px] leading-none text-accent",children:"⟳"})," Флоу"]})}):null,m?(0,d.jsx)("div",{className:"absolute left-0 top-[-8px] z-40 -translate-y-full",children:(0,d.jsx)(ck,{file:a.file,onClose:()=>n(!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 ${c?"rounded-[10px] ring-2 ring-accent/60":""}`,children:(0,d.jsx)(b7,{file:a.file,tasks:a.tasks,files:b,onSelect:h,isRoot:a.isRoot,onClose:()=>i(a.file.path)})}),(0,d.jsx)(cy,{file:a.file}),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":k,title:"Згорнуті гілки й задачі цієї розмови",onClick:()=>l(a=>!a),children:[(0,d.jsx)(cd,{className:"h-3.5 w-3.5","aria-hidden":!0}),a.under.length," під сподом",(0,d.jsx)(an,{className:`h-3 w-3 transition-transform ${k?"rotate-90":""}`,"aria-hidden":!0})]}):null,k?(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)(cx,{file:a,onSelect:h},a.path))}):null]})}function cB({draft:a,project:b,files:c,ringed:e,onDraftClose:f,onDraftSpawned:g}){return(0,d.jsx)("div",{"data-scheme-node":a.key,className:"scheme-enter absolute",style:{transform:`translate(${a.x}px, ${a.y}px)`,width:a.w,height:a.h,transition:cv},children:(0,d.jsx)("div",{className:`flex h-full ${e?"rounded-[10px] ring-2 ring-accent/60":""}`,children:(0,d.jsx)(cc,{draftId:a.id,project:b,files:c,onClose:()=>f(a.id),onSpawned:b=>g(a.id,b)})})})}function cC({deck:a,files:b,focus:c,onSelect:e}){let f=c&&c.flowId===a.flow.id?c.round+c.nonce/1e3:null;return(0,d.jsx)("div",{"data-scheme-node":a.key,className:"scheme-enter absolute",style:{transform:`translate(${a.x}px, ${a.y}px)`,width:a.w,height:a.h,transition:cv},children:(0,d.jsx)(cr,{flow:a.flow,rounds:a.rounds,files:b,onSelect:e,focusRound:f})})}let cD=(0,e.memo)(function({layout:a,project:b,files:c,interactive:e,selected:f,focus:g,flowsByImpl:h,deckFocus:i,onSelect:j,onClose:k,onFocusRound:l,onDraftClose:m,onDraftSpawned:n}){return(0,d.jsxs)("div",{className:e?void 0:"pointer-events-none select-none",children:[a.stacks.map(a=>(0,d.jsx)(cz,{stack:a,onSelect:j},a.key)),a.decks.map(a=>(0,d.jsx)(cC,{deck:a,files:c,focus:i,onSelect:j},a.key)),a.drafts.map(a=>(0,d.jsx)(cB,{draft:a,project:b,files:c,ringed:f===a.key||g===a.key,onDraftClose:m,onDraftSpawned:n},a.key)),a.nodes.map(a=>{var b;return(0,d.jsx)(cA,{node:a,files:c,ringed:f===a.file.path||g===a.file.path,flow:h.get(a.file.path)??null,canFlow:(b=a.file,!h.has(b.path)&&("claude"===b.engine||"codex"===b.engine)&&q(b)),onSelect:j,onClose:k,onFocusRound:l},a.file.path)})]})});function cE({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})}let cF=(a,b)=>Math.hypot(a.x-b.x,a.y-b.y);function cG({project:a,groups:b,manual:c,files:f,flows:g,drafts:h,focus:i,onSelect:j,onClose:k,onDraftClose:l,onDraftSpawned:m}){let n=(0,e.useRef)(null),[o,q]=(0,e.useState)({x:0,y:0,z:.5}),[r,t]=(0,e.useState)("select"),[u,v]=(0,e.useState)(!1),[x,y]=(0,e.useState)(!1),[z,C]=(0,e.useState)(!1),[D,E]=(0,e.useState)(null),[F,G]=(0,e.useState)({w:1,h:1}),H=(0,e.useRef)(null),I=(0,e.useRef)(new Map),J=(0,e.useRef)(null);(0,e.useRef)(r),(0,e.useRef)(u);let K=(0,e.useRef)(null);(0,e.useRef)(null),(0,e.useRef)(null);let L=(0,e.useCallback)(a=>{t(a),localStorage.setItem("llvSchemeMode",a)},[]),M=(0,e.useMemo)(()=>(function(a,b,c,d=[],e=[]){let f=new Map(c.map(a=>[a.path,a])),g=w(c),h=[],i=[],j=[],k=[],l=A(d),m=B(d),n=100,o=a=>({file:a,branches:g.get(a.path)?.length??0}),q=(a,b,c,d,e)=>{let g=(a,n,p,q)=>{let r=0===q?780:680;h.push({file:a.file,tasks:a.tasks,under:d.get(a.file.path)??[],x:n,y:p,w:600,h:r,isRoot:a.file.path===e});let s=b.get(a.file.path)??[],t=n+64;for(let a of s)i.push({to:a.file.path,x1:n+40,y1:p+r,x2:t+300,y2:p+r+130,color:P(a.file).color,live:"live"===a.file.activity}),t+=g(a,t,p+r+130,q+1)+48;let u=l.get(a.file.path);if(u){var v,w,x;let a,b,c=(v=u,w=t,x=p+r+130,a=v.rounds.map(a=>({round:a,file:a.reviewerPath?f.get(a.reviewerPath)??null:null})),b={key:"deck::"+v.id,flow:v,rounds:a,x:w,y:x,w:600,h:680+30*Math.min(Math.max(v.rounds.length-1,0),6)},k.push(b),b);i.push({to:c.key,x1:n+40,y1:p+r,x2:t+300,y2:p+r+130,color:"#5a51e0",live:cs.has(u.state)}),t+=648}let y=c.get(a.file.path)?.filter(a=>!m.has(a.path));if(y?.length){let b=p+r+130;j.push({key:a.file.path+"::stack",parent:a.file.path,items:y.map(o),x:t,y:b,w:360,h:16+58*Math.min(y.length,8)-6}),i.push({to:a.file.path+"::stack",x1:n+40,y1:p+r,x2:t+180,y2:b,color:"#9a9aa4",live:!1,dashed:!0}),t+=408}let z=t-48-(n+64);return z>0?Math.max(600,64+z):600};return g(a,n,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(!m.has(a.path))if(s(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]]);n+=q(a[0],g,h,j,b.key)+150}for(let a of b){let b=(function(a,b){if(!a)return[];let c=w(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)=>p(a)-p(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=>!m.has(a.path)),d=b.filter(a=>s(a)),e=b.filter(a=>!s(a));n+=q({file:a,tasks:[]},new Map,new Map(d.length?[[a.path,d]]:[]),new Map([[a.path,e]]),a.parent?"":a.path)+150}let r=[];for(let a of e)r.push({key:"draft::"+a,id:a,x:n,y:100,w:600,h:780}),n+=750;let t=0;for(let a of h)t=Math.max(t,a.y+a.h);for(let a of j)t=Math.max(t,a.y+a.h);for(let a of k)t=Math.max(t,a.y+a.h);for(let a of r)t=Math.max(t,a.y+a.h);return{nodes:h,edges:i,stacks:j,decks:k,drafts:r,byPath:new Map([...h.map(a=>[a.file.path,a]),...r.map(a=>[a.key,a])]),width:Math.max(n-150+100,800),height:t+100+140}})(b,c,f,g,h),[b,c,f,g,h]),N=(0,e.useMemo)(()=>A(g),[g]),[O,Q]=(0,e.useState)(null),R=(0,e.useCallback)((a,b)=>{Q(c=>({flowId:a,round:b,nonce:(c?.nonce??0)+1}))},[]),S=(0,e.useRef)(j),T=(0,e.useRef)(k),U=(0,e.useRef)(l),V=(0,e.useRef)(m),W=(0,e.useCallback)(a=>S.current(a),[]),X=(0,e.useCallback)(a=>T.current(a),[]),Y=(0,e.useCallback)(a=>U.current(a),[]),Z=(0,e.useCallback)((a,b)=>V.current(a,b),[]),$=(0,e.useCallback)(a=>{let b=Math.min(Math.max(a.x,120-M.width*a.z),F.w-120),c=Math.min(Math.max(a.y,120-M.height*a.z),F.h-120);return b===a.x&&c===a.y?a:{...a,x:b,y:c}},[M.width,M.height,F]),_=(0,e.useRef)([]),aa=(0,e.useRef)(null),ab=(0,e.useCallback)(a=>{_.current.push(a),null==aa.current&&(aa.current=requestAnimationFrame(()=>{aa.current=null;let a=_.current;_.current=[],q(b=>a.reduce((a,b)=>b(a),b))}))},[]),ac=(0,e.useCallback)((a,b,c)=>{ab(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 $({z:e,x:a-(a-d.x)*f,y:b-(b-d.y)*f})})},[$,ab]),ad=(0,e.useCallback)(a=>{let b=n.current?.getBoundingClientRect();b&&ac(b.width/2,b.height/2,a)},[ac]),ae=(0,e.useCallback)(a=>{let b=n.current?.getBoundingClientRect();b&&q(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 $({z:d,x:f-(f-c.x)*e,y:g-(g-c.y)*e})})},[$]),af=(0,e.useCallback)(()=>{let a=n.current?.getBoundingClientRect();if(!a||!M.nodes.length&&!M.drafts.length)return null;let b=Math.min(1.6,Math.max(.12,Math.min((a.width-48)/M.width,(a.height-48)/M.height,1)));return{z:b,x:(a.width-M.width*b)/2,y:(a.height-M.height*b)/2}},[M]),ag=(0,e.useCallback)(a=>{C(!0),q(a),K.current&&window.clearTimeout(K.current),K.current=window.setTimeout(()=>C(!1),500)},[]),ah=(0,e.useCallback)(()=>{let a=af();a&&ag(a)},[af,ag]),ai=(0,e.useCallback)((a,b)=>{let c=n.current?.getBoundingClientRect();c&&ag(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)}})},[ag]),aj=a=>{let b=n.current?.getBoundingClientRect();return b?{x:a.clientX-b.left,y:a.clientY-b.top}:{x:a.clientX,y:a.clientY}},ak=a=>{H.current={sx:a.clientX,sy:a.clientY,cx:o.x,cy:o.y},y(!0);try{n.current?.setPointerCapture(a.pointerId)}catch{}},al="hand"===r||u,am=(0,e.useCallback)((a,b)=>q(c=>$({...c,x:F.w/2-a*c.z,y:F.h/2-b*c.z})),[F,$]),an=24*o.z;return(0,d.jsxs)("div",{ref:n,className:`relative min-h-0 flex-1 overflow-hidden ${x?"cursor-grabbing select-none":al?"cursor-grab":""} ${al?"touch-none":""}`,onPointerDown:a=>{let b=a.target;if(!b.closest("[data-scheme-ui]")){if("touch"===a.pointerType&&(I.current.set(a.pointerId,aj(a)),2===I.current.size)){let[a,b]=[...I.current.values()];J.current={d:cF(a,b),cx:(a.x+b.x)/2,cy:(a.y+b.y)/2},H.current=null,y(!1);return}if(1===a.button){a.preventDefault(),ak(a);return}if(0===a.button){if(!("hand"===r||u)){let a=b.closest("[data-scheme-node]");if(a)return void E(a.getAttribute("data-scheme-node"));if(E(null),b.closest("button, a, input, textarea, select"))return}ak(a)}}},onPointerMove:a=>{if("touch"===a.pointerType&&I.current.has(a.pointerId)){I.current.set(a.pointerId,aj(a));let b=J.current;if(b&&I.current.size>=2){let[a,c]=[...I.current.values()],d=cF(a,c),e=(a.x+c.x)/2,f=(a.y+c.y)/2,g=b.d>0?d/b.d:1;ab(a=>{let c=Math.min(1.6,Math.max(.12,a.z*g)),d=c/a.z;return $({z:c,x:e-(b.cx-a.x)*d,y:f-(b.cy-a.y)*d})}),J.current={d,cx:e,cy:f};return}}let b=H.current;if(!b)return;let c=a.clientX-b.sx,d=a.clientY-b.sy;ab(a=>$({...a,x:b.cx+c,y:b.cy+d}))},onDoubleClick:a=>{let b=a.target;if(b.closest("[data-scheme-ui]"))return;let c=b.closest("[data-scheme-node]");if(!c)return void ah();if("hand"!==r&&!u)return;let d=M.byPath.get(c.getAttribute("data-scheme-node")??"");d&&ai(d,.9)},children:[(0,d.jsx)("div",{"aria-hidden":!0,className:"pointer-events-none absolute",style:{inset:-an,backgroundImage:"radial-gradient(rgba(28,28,34,0.09) 1px, transparent 1px)",backgroundSize:`${an}px ${an}px`,transform:`translate(${(o.x%an+an)%an}px, ${(o.y%an+an)%an}px)`,willChange:"transform"}}),(0,d.jsxs)("div",{className:`absolute left-0 top-0 ${x?"scheme-panning":""}`,style:{width:M.width,height:M.height,transform:`translate(${o.x}px, ${o.y}px) scale(${o.z})`,transformOrigin:"0 0",transition:z?`transform .45s ${cu}`:void 0,willChange:"transform","--inv-z":String(1/o.z),"--label-o":o.z<.45?"1":"0"},children:[(0,d.jsx)(cw,{edges:M.edges,width:M.width,height:M.height}),(0,d.jsx)(cD,{layout:M,project:a,files:f,interactive:!al,selected:D,focus:i,flowsByImpl:N,deckFocus:O,onSelect:W,onClose:X,onFocusRound:R,onDraftClose:Y,onDraftSpawned:Z})]},a),(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:[(0,d.jsx)(cE,{active:al,title:"Рука — тягнути полотно (H, або тримай Space)",onClick:()=>L("hand"),children:(0,d.jsx)(ce,{className:"h-4 w-4","aria-hidden":!0})}),(0,d.jsx)(cE,{active:!al,title:"Виділення — клік і робота з розмовами (V)",onClick:()=>L("select"),children:(0,d.jsx)(cf,{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)(cE,{title:"Віддалити (−)",onClick:()=>ad(.8),children:(0,d.jsx)(a9,{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:"Масштаб 100% (1)",onClick:()=>ae(1),children:[Math.round(100*o.z),"%"]}),(0,d.jsx)(cE,{title:"Наблизити (+)",onClick:()=>ad(1.25),children:(0,d.jsx)(ba,{className:"h-4 w-4","aria-hidden":!0})}),(0,d.jsx)(cE,{title:"Вписати все (0, або подвійний клік по фону)",onClick:ah,children:(0,d.jsx)(cg,{className:"h-4 w-4","aria-hidden":!0})})]}),(0,d.jsx)(ct,{layout:M,cam:o,vp:F,onJump:am})]})}function cH(a){try{window.localStorage.setItem("llvArchived",JSON.stringify([...a]))}catch{}}function cI({data:a,onOpen:b}){let c=a.waiting.length;(0,e.useRef)(c);let[f,g]=(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||"працює…"})]},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 ${f?"scale-110 border-[#e0ae45]/70":""} motion-reduce:transition-none`,"aria-label":"Відкрити пульт агентів",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.jsxs)("span",{className:c?"text-[#b8860b]":"text-dim",children:["\xb7 ",c," чекають"]})]})]})}function cJ({file:a,title:b,project:c,currentProject:e,descendants:f,statusLine:g,size:h,tone:i,onOpen:j,onArchive:k}){let n=U(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":`Відкрити колонкою ${m(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":"Прибрати з пульта",onClick:b=>{b.stopPropagation(),k(a)},onKeyDown:a=>a.stopPropagation(),children:(0,d.jsx)(l,{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 ${K(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:S(a).soft,color:S(a).color},title:[n.label,T(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:n.style,children:n.label}),(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:H(a.mtime)}),a.ctx?(0,d.jsx)(bV,{ctx:a.ctx}):null,f?(0,d.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-0.5",children:[(0,d.jsx)(ae,{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)(aW,{file:a,compact:!0})}):null]})}function cK({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)(aS,{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)(cJ,{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 cL({files:a,flows:b,project:c,onOpenFile:f}){let[g,h]=(0,e.useState)(!1),[i,j]=(0,e.useState)(""),[k,n]=(0,e.useState)(!1),[o,p]=(0,e.useState)(!1),[q,r]=(0,e.useState)(0),s=(0,e.useRef)(null),t=function(){let[a,b]=(0,e.useState)([]),[c,d]=(0,e.useState)(!1);return{events:a,loading:c}}(),{archivedPaths:v,archive:w,unarchive:x}=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,cH(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,cH(d),d})},[])}}(),y=Y(a,t.events,i,q,v,b),z=Y(a,[],"",q,v,b),A=(0,e.useMemo)(()=>a.filter(a=>v.has(a.path)).map(a=>({file:a,title:m(a.title),project:u(a)})).sort((a,b)=>b.file.mtime-a.file.mtime),[a,v]),B=a=>{f(a),h(!1)},C=a=>w(a.path);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(cI,{data:z,onOpen:()=>h(!0)}),g?(0,d.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-ink/28 p-[2.5vh]",onMouseDown:()=>h(!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":"Пульт агентів",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:"Пульт"}),(0,d.jsx)("input",{ref:s,value:i,onChange:a=>j(a.target.value),placeholder:"Пошук за назвою або проєктом",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"}),t.loading?(0,d.jsx)("span",{className:"text-[11px] font-semibold text-dim",children:"оновлення…"}):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":"Закрити пульт",onClick:()=>h(!1),children:(0,d.jsx)(l,{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)(cK,{title:"Чекає тебе",items:y.waiting,size:"large",currentProject:c,onOpenFile:B,onArchive:C}),(0,d.jsx)(cK,{title:"Працюють",items:y.working,size:"large",currentProject:c,onOpenFile:B,onArchive:C}),(0,d.jsx)(cK,{title:"Нещодавні",items:y.recent,size:"small",currentProject:c,onOpenFile:B,onArchive:C}),(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":k,onClick:()=>n(a=>!a),children:[(0,d.jsx)("span",{children:"Старіше"}),(0,d.jsx)("span",{className:"text-dim",children:y.older.length})]}),k?(0,d.jsx)("div",{className:"mt-2",children:(0,d.jsx)(cK,{title:"",items:y.older,size:"small",currentProject:c,onOpenFile:B,onArchive:C})}):null]}),y.waiting.length||y.working.length||y.recent.length||y.older.length?null:(0,d.jsx)("div",{className:"pt-[18vh] text-center text-[13px] font-semibold text-dim",children:"Нічого не знайдено"}),A.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":o,onClick:()=>p(a=>!a),children:[(0,d.jsxs)("span",{children:["Приховані (",A.length,")"]}),(0,d.jsx)("span",{children:o?"сховати":"показати"})]}),o?(0,d.jsx)("div",{className:"mt-2 space-y-1",children:A.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:()=>x(a.file.path),children:"повернути"})]},a.file.path))}):null]}):null]})]})}):null]})}function cM(){location.hash="#p="+encodeURIComponent(n)}function cN({files:a,onOpen:b}){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:"На схемі порожньо, але в проєкті є записи"}),(0,d.jsx)("div",{className:"mb-3 mt-0.5 text-[12px] text-dim",children:"Клік по рядку відкриває розмову нодою; смітник видаляє її файл з диска назавжди."}),(0,d.jsx)("div",{className:"space-y-1.5",children:a.map(a=>(0,d.jsx)(cO,{file:a,onOpen:b},a.path))})]})})}function cO({file:a,onOpen:b}){let[c,f]=(0,e.useState)(!1),g=U(a);return c?(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)(az,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),(0,d.jsx)("span",{className:"min-w-0 truncate",children:m(a.title,80)}),(0,d.jsx)("span",{className:"shrink-0",children:"\xb7 видалено з диска"})]}):(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":`Відкрити ${m(a.title,60)}`,onClick:()=>b(a),children:[(0,d.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${K(a.activity)}`}),(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 text-[9.5px] font-bold",style:g.style,children:g.label}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12.5px] font-semibold",title:a.path,children:m(a.title,90)}),(0,d.jsx)("span",{className:"shrink-0 text-[10.5px] font-semibold text-dim",children:H(a.mtime)}),(0,d.jsxs)("span",{className:"shrink-0 text-[10.5px] text-dim",children:[(a.size/1024).toFixed(0)," кБ"]})]}),(0,d.jsx)(aR,{file:a,onDeleted:()=>f(!0)})]})}function cP({files:a,onArchive:b}){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 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:()=>{b(),cM()},children:[(0,d.jsx)(af,{className:"h-3 w-3","aria-hidden":!0})," В архів"]})}function cQ({files:a}){let[b,c]=(0,e.useState)(!1),[f,g]=(0,e.useState)(!1),[h,i]=(0,e.useState)("");if(!a.length||a.some(a=>"running"===a.proc||"live"===a.activity))return null;let j=async()=>{g(!0),i("");let b=0;for(let c of a)try{let a=await fetch(`/api/log?path=${encodeURIComponent(c.path)}`,{method:"DELETE"}),d=await a.json();a.ok&&d.ok||(b+=1)}catch{b+=1}(g(!1),c(!1),b)?i(`не видалено ${b} з ${a.length}`):cM()};return b?(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.jsxs)("span",{className:"px-0.5 font-semibold text-err",children:["Видалити з диска ",a.length," ",J(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:f,onClick:j,children:f?"видаляю…":"Так, видалити"}),(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:()=>c(!1),children:"Скасувати"})]}):(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":"Видалити проєкт з диска",title:"Видалити проєкт з диска",onClick:()=>c(!0),children:(0,d.jsx)(az,{className:"h-3 w-3","aria-hidden":!0})}),h?(0,d.jsx)("span",{className:"max-w-[180px] truncate text-[10.5px] font-semibold text-err",children:h}):null]})}let cR=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"}]]),cS=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 cT(){let[a,b]=(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?"Звукові сповіщення увімкнено":"Звукові сповіщення вимкнено","aria-label":a?"Вимкнути звукові сповіщення":"Увімкнути звукові сповіщення","aria-pressed":a,onClick:()=>{let c=!a;b(c);try{localStorage.setItem(_,c?"on":"off")}catch{}c&&function(a=0){(function(){try{localStorage.getItem(_)}catch{return!0}})()}()},children:a?(0,d.jsx)(cR,{className:"h-3.5 w-3.5","aria-hidden":!0}):(0,d.jsx)(cS,{className:"h-3.5 w-3.5","aria-hidden":!0})})}function cU({items:a,onSelect:b}){let[c,f]=(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":c,onClick:()=>f(a=>!a),children:[(0,d.jsx)(an,{className:`h-3.5 w-3.5 transition-transform ${c?"rotate-90":""}`,"aria-hidden":!0}),"Тихі розмови й задачі",(0,d.jsx)("span",{className:"font-semibold normal-case tracking-normal",children:a.length})]}),c?(0,d.jsx)(aS,{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 c=U(a),e=m(a.cmdDesc||a.title,70);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:m(a.title),onClick:()=>b(a),children:[(0,d.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${K(a.activity)}`}),(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px]",style:c.style,children:c.label}),(0,d.jsx)("span",{className:"truncate",children:e}),(0,d.jsx)("span",{className:"shrink-0 font-normal text-dim",children:H(a.mtime)})]},a.path)})}):null]})}let cV=a=>`llvCols:${a}`;function cW(a,b){let c=function(a){try{let b=JSON.parse(localStorage.getItem(cV(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(cV(a),JSON.stringify(c))}function cX({files:a,flows:b,project:c,openNonce:f,archived:g,onArchive:h,onUnarchive:i}){let j=(0,e.useRef)(null),k=(0,e.useRef)(null),[l,m]=(0,e.useState)({manual:[],hidden:[]}),[n,o]=(0,e.useState)([]),[r,s]=(0,e.useState)(null),t=(0,e.useRef)(l),v=a=>{t.current=a,m(a),localStorage.setItem(cV(c),JSON.stringify(a))},y=(0,e.useMemo)(()=>{let c=B(b);return c.size?a.filter(a=>!c.has(a.path)):a},[a,b]),A=(0,e.useMemo)(()=>z(y,c),[y,c]),C=(0,e.useMemo)(()=>new Set(A.map(a=>a.key)),[A]),D=(0,e.useMemo)(()=>(function(a,b,c){let d=w(a),e=[];for(let f of a){if(u(f)!==b||!q(f)||c.has(f.path))continue;let a=x(f,d);if(!a.length)continue;let g=f.mtime,h=p(f);for(let b of a)g=Math.max(g,b.mtime),h=Math.min(h,p(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)})(y,c,C),[y,c,C]),E=(0,e.useMemo)(()=>{let a;return a=w(y),y.filter(b=>!(u(b)!==c||b.parent||C.has(b.path)||a.get(b.path)?.length)&&"live"!==b.activity).sort((a,b)=>p(a)-p(b)||b.mtime-a.mtime)},[y,c,C]),F=(0,e.useMemo)(()=>new Set(A.flatMap(a=>a.columns.map(a=>a.file.path))),[A]),G=(0,e.useMemo)(()=>new Set(l.hidden),[l.hidden]),H=(0,e.useMemo)(()=>{let a=new Map(y.map(a=>[a.path,a]));return l.manual.map(b=>a.get(b)).filter(a=>void 0!==a&&u(a)===c&&!F.has(a.path)&&!G.has(a.path))},[l.manual,y,c,F,G]),I=(0,e.useMemo)(()=>A.reduce((a,b)=>a+b.columns.reduce((a,b)=>a+ +("live"===b.file.activity)+b.tasks.filter(a=>"live"===a.activity).length,0),0),[A]),K=A.filter(a=>!a.orphanTask).length,L=a=>{o(a),sessionStorage.setItem(`llvDrafts:${c}`,JSON.stringify(a))},M=a=>{for(let b of["engine","cwd","text","boot"])sessionStorage.removeItem(ca(a,b));L(n.filter(b=>b!==a))},N=a=>{let b=u(a);if(b!==c){cW(b,a.path),location.hash="#p="+encodeURIComponent(b);return}if(F.has(a.path)&&!G.has(a.path)||H.some(b=>b.path===a.path))return void(s(a.path),j.current&&window.clearTimeout(j.current),j.current=window.setTimeout(()=>s(null),1800));let d=l.hidden.filter(b=>b!==a.path);v({manual:F.has(a.path)?l.manual:[...new Set([...l.manual,a.path])],hidden:d}),k.current=a.path},O=[];I?O.push(`${I} ${J(I,"гілка працює","гілки працюють","гілок працюють")} \xb7 ${K} ${J(K,"дерево","дерева","дерев")}`):K&&O.push(`${K} ${J(K,"нещодавня розмова","нещодавні розмови","нещодавніх розмов")}`),D.length&&O.push(`${D.length} ${J(D.length,"тихе дерево","тихі дерева","тихих дерев")}`);let P=A.map(a=>({...a,columns:a.columns.filter(a=>!G.has(a.file.path))})).filter(a=>a.columns.length),Q=P.filter(a=>a.orphanTask).map(a=>a.columns[0].file),R=P.filter(a=>!a.orphanTask),S=R.length>0||H.length>0||n.length>0,T=(0,e.useMemo)(()=>a.filter(a=>u(a)===c).sort((a,b)=>b.mtime-a.mtime),[a,c]);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:[(0,d.jsx)("h1",{className:"truncate text-[13.5px] font-bold",children:c}),(0,d.jsx)("span",{className:"truncate text-[11.5px] text-dim",children:O.length?O.join(" \xb7 "):"зараз нічого не працює"}),(0,d.jsx)(cT,{}),g?(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:()=>i(c),children:[(0,d.jsx)(ag,{className:"h-3 w-3","aria-hidden":!0})," Повернути з архіву"]}):(0,d.jsx)(cP,{files:T,onArchive:()=>h(c)}),(0,d.jsx)(cQ,{files:T}),(0,d.jsxs)("button",{type:"button",onClick:()=>{let a="function"==typeof crypto.randomUUID?crypto.randomUUID():Date.now().toString(36)+Math.random().toString(36).slice(2,10);L([...n,a]),k.current="draft::"+a},"aria-label":"Нова розмова з агентом",className:"ml-auto 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.length?(0,d.jsx)("div",{className:"shrink-0 border-b border-line bg-[#fbfbfd]",children:Q.map(b=>(0,d.jsx)("div",{className:`border-l-4 ${"live"===b.activity?"border-l-ok bg-[#f2faf4]":"border-l-[#9a9aa4]"}`,children:(0,d.jsx)(b8,{file:b,files:a,onSelect:N})},b.path))}):null,S?(0,d.jsx)(cG,{project:c,groups:R,manual:H,files:a,flows:b,drafts:n,focus:r,onSelect:N,onClose:a=>{fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"kill",path:a})}).catch(()=>{}),v({manual:l.manual.filter(b=>b!==a),hidden:F.has(a)?[...new Set([...l.hidden,a])]:l.hidden})},onDraftClose:M,onDraftSpawned:(a,b)=>{M(a),N(b)}}):T.length?(0,d.jsx)(cN,{files:T,onOpen:N}):(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:"На схемі поки порожньо"}),(0,d.jsx)("div",{className:"mt-0.5 text-[12px] text-dim",children:"Відкрий пульт у правому нижньому куті і клікни розмову — вона з'явиться тут"})]})}),(0,d.jsx)(cL,{files:a,flows:b,project:c,onOpenFile:N}),E.length?(0,d.jsx)(cU,{items:E,onSelect:N}):null]})}let cY=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 cZ(){let[a,b]=(0,e.useState)(!1),[c,f]=(0,e.useState)({status:"idle"}),[g,h]=(0,e.useState)(null),[i,j]=(0,e.useState)(!1),k=(0,e.useRef)(null),l="ready"===c.status&&g&&g.url===c.url?g.dataUrl:null,m=(0,e.useCallback)(()=>{"ready"===c.status&&navigator.clipboard.writeText(c.url).then(()=>{j(!0),window.setTimeout(()=>j(!1),2e3)}).catch(()=>{})},[c]);return(0,d.jsxs)("div",{ref:k,className:"relative ml-auto shrink-0",children:[(0,d.jsx)("button",{type:"button","aria-expanded":a,"aria-label":"Показати QR для входу з телефона",onClick:()=>{a||f({status:"idle"}),b(!a)},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)(cY,{className:"h-4 w-4","aria-hidden":!0})}),a?(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"===c.status?(0,d.jsx)("span",{className:"text-[12px] text-ink",children:"завантаження…"}):"error"===c.status?(0,d.jsx)("span",{className:"text-[12px] font-semibold text-err",children:"не вдалося отримати посилання"}):"unavailable"===c.status?(0,d.jsxs)("span",{className:"text-[12px] leading-relaxed text-ink",children:["Запустіть viewer з доступом через Tailscale:"," ",(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:[l?(0,d.jsx)("img",{src:l,alt:"QR код для входу з телефона",className:"mx-auto h-[220px] w-[220px]"}):(0,d.jsx)("span",{className:"text-[12px] text-ink",children:"генерую QR…"}),(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsx)("input",{readOnly:!0,value:c.url,"aria-label":"Посилання для входу з телефона",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":"Копіювати посилання",onClick:m,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:i?(0,d.jsx)(am,{className:"h-3.5 w-3.5","aria-hidden":!0}):(0,d.jsx)(aU,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),(0,d.jsx)("span",{className:"text-[10.5px] text-dim",children:"скануй з телефона в тому ж tailnet"})]})}):null]})}function c$({label:a,window:b,engineColor:c,now:e}){var f;let g,h,i;if(!b)return null;let j=Math.max(0,Math.min(100,100-b.usedPercent)),k=j<=10?"#c62828":j<=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:["лишилось ",(0,d.jsxs)("span",{className:`font-bold tabular-nums ${j<=30?"":"text-ink"}`,style:j<=30?{color:k}:void 0,children:[Math.round(j),"%"]})]})]}),(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(j,1.5)+"%",backgroundColor:k}})}),b.resetsAt?(0,d.jsxs)("div",{className:"mt-[3px] text-[10px] leading-none text-dim",children:["скид ",(g=b.resetsAt-e)<=60?"зараз":g<5400?"через "+Math.round(g/60)+" хв":g<129600?"через "+Math.round(g/3600)+" год":"через "+Math.round(g/86400)+" д"," \xb7 ",(f=b.resetsAt,i=(h=new Date(1e3*f)).toLocaleTimeString("uk",{hour:"2-digit",minute:"2-digit",hour12:!1}),f-e<86400?i:h.toLocaleDateString("uk",{day:"numeric",month:"short"})+" "+i)]}):null]})}function c_({label:a,engine:b,limits:c,now:e,staleHint:f}){if(!c||!c.session&&!c.weekly)return null;let g=L[b]??M,h=c.capturedAt&&e-c.capturedAt>1200?H(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:g.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,h?(0,d.jsx)("span",{className:"h-1.5 w-1.5 shrink-0 self-center rounded-full bg-[#d29a2f]",title:`дані застарілі: ${h}`}):null]}),(0,d.jsx)(c$,{label:"5 год",window:c.session,engineColor:g.color,now:e}),(0,d.jsx)(c$,{label:"Тиждень",window:c.weekly,engineColor:g.color,now:e})]})}function c0(){let[a,b]=(0,e.useState)(null);if(!a||!a.data.claude&&!a.data.codex)return null;let c=function(a){if(!a)return null;let b=new Date(a);return Number.isNaN(b.getTime())?null:"станом на "+b.toLocaleTimeString("uk",{hour:"2-digit",minute:"2-digit",hour12:!1})}(a.data.staleSince);return(0,d.jsxs)("div",{className:"shrink-0 border-t border-line px-3.5 pb-3 pt-2.5",children:[(0,d.jsx)(c_,{label:"Claude",engine:"claude",limits:a.data.claude,now:a.at,staleHint:c}),(0,d.jsx)(c_,{label:"Codex",engine:"codex",limits:a.data.codex,now:a.at,staleHint:c})]})}let c1=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"}]]),c2=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 c3(){let[a,b]=(0,e.useState)(!1),[c,f]=(0,e.useState)(!1),g=async()=>{if(!c||"default"===Notification.permission&&"granted"!==await Notification.requestPermission()||"granted"!==Notification.permission)return;let a=await navigator.serviceWorker.register("/question-push-sw.js"),d=await a.pushManager.getSubscription();if(d){await d.unsubscribe(),b(!1);return}let e=await (await fetch("/api/push")).json(),f=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)}(e.publicKey)});await fetch("/api/push",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(f)}),b(!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:c?a?"Push-сповіщення увімкнено":"Увімкнути push-сповіщення":"Push потребує HTTPS","aria-label":c?a?"Вимкнути push-сповіщення":"Увімкнути push-сповіщення":"Push потребує HTTPS","aria-pressed":a,disabled:!c,onClick:g,children:a?(0,d.jsx)(c1,{className:"h-3.5 w-3.5","aria-hidden":!0}):(0,d.jsx)(c2,{className:"h-3.5 w-3.5","aria-hidden":!0})})}function c4({files:a,archivedProjects:b,selected:c,onSelect:f}){let[g,h]=(0,e.useState)(""),[i,j]=(0,e.useState)(!1),k=(0,e.useMemo)(()=>v(a),[a]),l=(0,e.useMemo)(()=>{let a=g.trim().toLowerCase();return a?k.filter(b=>b.project.toLowerCase().includes(a)):k},[k,g]),m=(0,e.useMemo)(()=>l.filter(a=>!b.has(a.project)),[l,b]),o=(0,e.useMemo)(()=>l.filter(a=>b.has(a.project)),[l,b]),p=(0,e.useMemo)(()=>k.reduce((a,b)=>a+b.liveCount,0),[k]),q=(0,e.useMemo)(()=>k.reduce((a,b)=>a+b.attentionCount,0),[k]);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:["Логи агентів",p?(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"}),p]}):null,q?(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:["⏸ ",q]}):null,(0,d.jsx)(cZ,{}),(0,d.jsx)(c3,{})]}),(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:"Фільтр проєктів…",value:g,onChange:a=>h(a.target.value)})}),(0,d.jsxs)("nav",{className:"flex-1 overflow-y-auto px-2 pb-3 pt-1","aria-label":"Проєкти",children:[(0,d.jsx)(c5,{label:"Огляд",live:0,attention:0,total:null,age:"",active:c===n,hasLive:!1,onClick:()=>f(n)}),(0,d.jsx)("div",{className:"mx-2.5 my-1.5 border-t border-line"}),(0,d.jsx)(aS,{children:m.map(a=>(0,d.jsx)("div",{"data-flip-key":a.project,children:(0,d.jsx)(c5,{label:a.project,live:a.liveCount,attention:a.attentionCount,total:a.conversations,age:H(a.smt),active:c===a.project,hasLive:a.liveCount>0,onClick:()=>f(a.project)})},a.project))}),o.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":i,onClick:()=>j(a=>!a),children:[(0,d.jsx)(an,{className:`h-3 w-3 shrink-0 transition-transform ${i?"rotate-90":""}`,"aria-hidden":!0}),(0,d.jsx)(af,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),"Архів",(0,d.jsx)("span",{className:"font-semibold",children:o.length})]}),i?o.map(a=>(0,d.jsx)(c5,{label:a.project,live:a.liveCount,attention:a.attentionCount,total:a.conversations,age:H(a.smt),active:c===a.project,hasLive:a.liveCount>0,onClick:()=>f(a.project)},a.project)):null]}):null,m.length||o.length?null:(0,d.jsx)("div",{className:"px-3 py-4 text-center text-[12px] text-dim",children:"Нічого не знайдено"})]}),(0,d.jsx)(c0,{})]})}function c5({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 c6(){let{files:a,flows:b}=function(){let[a,b]=(0,e.useState)(ab);return a}();(0,e.useRef)(null);let{archivedProjects:c,archiveProject:f,unarchiveProject:g}=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})},[])}}(),[h,i]=(0,e.useState)(n),[j,k]=(0,e.useState)(null),[m,o]=(0,e.useState)(null);(0,e.useRef)(null);let[p,q]=(0,e.useState)(0),r=(0,e.useCallback)(a=>{i(a),localStorage.setItem("llvProject",a),a!==n?history.replaceState(null,"","#p="+encodeURIComponent(a)):history.replaceState(null,"",location.pathname)},[]),s=(0,e.useCallback)(a=>{let b=u(a);cW(b,a.path),r(b),q(a=>a+1)},[r]),t=m?a.find(a=>a.path===m):null;return(0,d.jsxs)("div",{className:"flex h-full",children:[(0,d.jsx)(c4,{files:a,archivedProjects:c,selected:h,onSelect:r}),(0,d.jsxs)("main",{className:"flex min-w-0 flex-1 flex-col",children:[t?(0,d.jsxs)("div",{className:"fixed right-4 top-4 z-50 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:()=>{s(t),o(null)},children:[(0,d.jsx)("span",{className:"block text-[11px] font-bold text-[#8a5a00]",children:"Агент чекає відповіді"}),(0,d.jsx)("span",{className:"line-clamp-2",children:t.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":"Закрити сповіщення",onClick:()=>o(null),children:(0,d.jsx)(l,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}):null,h===n?(0,d.jsx)(ac,{files:a,archivedProjects:c,onSelectProject:r,onSelectFile:s}):(0,d.jsx)(cX,{files:a,flows:b,project:h,openNonce:p,archived:c.has(h),onArchive:f,onUnarchive:g})]})]})}},96487:()=>{}};var b=require("../webpack-runtime.js");b.C(a);var c=b.X(0,[445,319,918],()=>b(b.s=89175));module.exports=c})();
|
|
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")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},25880:()=>{},26713:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/is-bot")},26896:(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))},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/latand/.agents/tools/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")},33873:a=>{"use strict";a.exports=require("path")},41025:a=>{"use strict";a.exports=require("next/dist/server/app-render/dynamic-access-async-storage.external.js")},43954:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/interception-routes")},48056:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,95547,23))},55096:(a,b,c)=>{"use strict";c.d(b,{Viewer:()=>dS});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("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),m={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.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.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","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.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.stopAndSend":"Stop recording and send","composer.launchAgent":"Launch the agent","composer.sendToAgent":"Send to the agent","composer.stopAndSendTitle":"stop recording and send","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.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)","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.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})","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","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","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","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.jobLogHint":"This is a short job log (service events only). Codex's real work is in the full session:","task.openCodexSession":"Open Codex session ({size} kB{activity})","task.rolloutMissing":"This is a short job log. The full Codex rollout session hasn't appeared in the list yet","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","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"},uk:{"common.serverUnavailable":"сервер недоступний","common.loading":"завантаження…","common.loadingCap":"Завантаження…","common.cancel":"Скасувати","common.show":"показати","common.showAll":"показати все","common.collapse":"згорнути","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.emptyTitle":"На схемі поки порожньо","dash.emptyHint":"Відкрий пульт у правому нижньому куті і клікни розмову — вона з'явиться тут","trash.title":"На схемі порожньо, але в проєкті є записи","trash.hint":"Клік по рядку відкриває розмову нодою; смітник видаляє її файл з диска назавжди.","trash.deletedFromDisk":"\xb7 видалено з диска","trash.open":"Відкрити {title}","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.stopAndSend":"Зупинити запис і надіслати","composer.launchAgent":"Запустити агента","composer.sendToAgent":"Надіслати агенту","composer.stopAndSendTitle":"зупинити запис і надіслати","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.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 хв)","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.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})","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":"чекає","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":"Тиждень","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":"Розгорнути","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.jobLogHint":"Це короткий джоб-лог (лише службові події). Реальна робота Codex — у повній сесії:","task.openCodexSession":"Відкрити сесію Codex ({size} kB{activity})","task.rolloutMissing":"Це короткий джоб-лог. Повна rollout-сесія Codex ще не з'явилась у списку","task.backgroundCommand":"Фонова команда","task.commandNotFound":"Команду, що запустила цю фонову задачу, не знайдено у транскриптах сесії","viewer.closeProjects":"Закрити список проєктів","viewer.agentWaiting":"Агент чекає відповіді","viewer.closeNotification":"Закрити сповіщення","mobile.noConvos":"Розмов поки нема","mobile.map":"Карта","mobile.closeMap":"Закрити карту","mobile.tapNode":"Тапни вузол — розмова відкриється на весь екран","mobile.agent":"агент","mobile.openMap":"Відкрити карту проєкту"}},n="en",o=new Set;function p(){return n}function q(a){if(a!==n){n=a;try{window.localStorage.setItem("llv_lang",a)}catch{}for(let b of("u">typeof document&&(document.documentElement.lang=a),o))b()}}function r(a){return o.add(a),()=>o.delete(a)}function s(a,b,c){var d;let e,f=m[a][b]??m.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 t(){let a=(0,e.useSyncExternalStore)(r,p,()=>"en");return{locale:a,t:(b,c)=>s(a,b,c),setLocale:q}}function u(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 v="__overview__",w=a=>Math.floor(a/300);function x(a){return"live"===a.activity?0:"recent"===a.activity?1:"stalled"===a.activity?2:3}function y(a){return"claude-projects"===a.root?"сесія"===a.kind&&!a.parent:"codex-sessions"===a.root&&!a.parent}function z(a){return"claude-projects"===a.root&&"субагент"===a.kind}function A(a){return!!z(a)||!!a.handoff&&!!a.parent||"codex-sessions"===a.root&&!!a.parent}function B(a){return"shell"===a.engine||"codex-jobs"===a.root}function C(a){return a.project||"інше"}function D(a){let b=new Map;for(let c of a){let a=C(c),d=b.get(a);d||(d={project:a,liveCount:0,attentionCount:0,conversations:0,smt:0},b.set(a,d)),"live"===c.activity&&(d.liveCount+=1),(c.pendingQuestion||c.waitingInput)&&(d.attentionCount+=1),y(c)&&(d.conversations+=1),d.smt=Math.max(d.smt,c.mtime)}return[...b.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:w(b.smt)-w(a.smt)||a.project.localeCompare(b.project)})}function E(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 F(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 G(a){return!B(a)&&("live"===a.activity||"recent"===a.activity&&A(a))}function H(a,b){let c=new Map(a.map(a=>[a.path,a])),d=E(a),e=new Map,f=new Map;for(let d of a)if(C(d)===b){if("live"===d.activity||"recent"===d.activity&&A(d)){let a=function(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}(d,c);B(a)?f.set(a.path,a):e.set(a.path,a);continue}"recent"===d.activity&&y(d)&&e.set(d.path,d)}let g=[...e.values()].map(a=>(function(a,b,c){let d=F(a,b),e=d.filter(G).sort((a,b)=>("live"!==a.activity)-("live"!==b.activity)||w(b.mtime)-w(a.mtime)||a.path.localeCompare(b.path)),f=d.filter(a=>B(a)&&"live"===a.activity).sort((a,b)=>w(b.mtime)-w(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=>A(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),"сесія"===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:w(b.smt)-w(a.smt)||a.key.localeCompare(b.key))}let I=new Set,J=I,K=new Set;function L(a){return K.add(a),()=>K.delete(a)}let M=new Set;function N(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 O(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 P(a,b){return a(`flowState.${b}`)}let Q=new Set(["spawn_pending","relay_pending","needs_decision","paused","approved"]),R=new Set(["spawning","reviewing","relaying","fixing"]);function S(a){return"spawning"===a.state||"reviewing"===a.state?"reviewer":"waiting_ready"===a.state||"relaying"===a.state||"fixing"===a.state?"implementer":null}let T={APPROVE:"✓",REQUEST_CHANGES:"✖",COMMENT:"◆"};function U(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 V(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(!I.has(a))for(let b of(I.add(a),J=new Set(I),K))b()}(a),window.dispatchEvent(new Event("llv:flows-changed")),null;let d=await c.json().catch(()=>null);return d?.error??s(p(),"flowModel.failed",{status:c.status})}catch{return s(p(),"common.serverUnavailable")}}function W(a){let b=p(),c=Date.now()/1e3-a;return c<90?s(b,"time.agoSec",{n:Math.round(c)}):c<5400?s(b,"time.agoMin",{n:Math.round(c/60)}):c<129600?s(b,"time.agoHour",{n:Math.round(c/3600)}):s(b,"time.agoDay",{n:Math.round(c/86400)})}function X(a){if("string"!=typeof a&&"number"!=typeof a)return"";let b=new Date(a),c="uk"===p()?"uk-UA":"en-US";return Number.isNaN(b.getTime())?"":b.toLocaleTimeString(c,{hour12:!1})}function Y(a){return"live"===a?"animate-pulse bg-ok":"recent"===a?"bg-[#d29a2f]":"stalled"===a?"bg-err":"bg-[#c9c9d1]"}let Z={codex:{color:"#2f6fd0",soft:"#e8f0fb"},claude:{color:"#d97757",soft:"#faeee9"}},$={color:"#9a9aa4",soft:"#ececf1"},_=[[/fable|mythos/,{color:"#c2410c",soft:"#fbeade"}],[/opus/,{color:"#8a5ad6",soft:"#f1ebfb"}],[/sonnet/,{color:"#e0913f",soft:"#fbf1e4"}],[/haiku/,{color:"#d9a58c",soft:"#f9f1ec"}]],aa=[[/spark/,{color:"#5ea3e4",soft:"#ecf4fd"}],[/mini|nano/,{color:"#7fb1e8",soft:"#eff6fd"}],[/codex/,{color:"#1d55ab",soft:"#e4edfa"}]];function ab(a){let b=Z[a.engine];if(!b)return $;let c=(a.model??"").toLowerCase();for(let[b,d]of"codex"===a.engine?aa:_)if(b.test(c))return d;return b}let ac={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 ad(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 ae(a){let b=ab(a),c=ac[a.effort??""];return c?{color:ad(b.color,c.dl,c.ds),soft:ad(b.soft,Math.round(c.dl/3),Math.round(c.ds/2))}:b}function af(a){return a.effort?s(p(),"util.effortTitle",{effort:a.effort}):void 0}function ag(a){return ab(a).color}function ah(a){return{borderTopColor:ab(a).color}}function ai(a){let b={codex:"Codex",claude:"Claude",shell:"Bash"}[a.engine]??a.engine,c=Z[a.engine]??$;return{label:b,style:{backgroundColor:c.soft,color:c.color}}}function aj(a,b){return Math.floor(b.smt/300)-Math.floor(a.smt/300)||a.file.path.localeCompare(b.file.path)}function ak(a){return z(a)&&"running"!==a.proc}function al(a,b=Date.now()/1e3){return!!a.pendingQuestion||!!a.waitingInput||("stalled"===a.activity?!ak(a)&&b-a.mtime<=7200:"recent"===a.activity&&("claude"===a.engine||"codex"===a.engine)&&y(a)&&!z(a))}function am(a,b,c,d,f=an,g=ao){let{locale:h}=t();return(0,e.useMemo)(()=>{let e=(a,b)=>s(h,a,b),i=function(a){let b=E(a),c=new Map;for(let d of a)c.set(d.path,F(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=N(g),l=O(g),m=c.trim().toLowerCase(),n=a.filter(a=>!f.has(a.path)&&!l.has(a.path)&&(y(a)||"live"===a.activity||"stalled"===a.activity||"recent"===a.activity&&!B(a))).map(a=>{let b=C(a),c=u(a.title),f=d-a.mtime,g=k.get(a.path),h=a.pendingQuestion||a.waitingInput?"waiting":"live"===a.activity?"working":al(a,d)?"waiting":f<=86400?"recent":"older",l=function(a,b,c){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 d=c.get(b.path);return d?`${d.label} \xb7 ${W(d.ts)}`:"live"===b.activity?a("status.working"):ak(b)?a("status.returnedResult"):"stalled"===b.activity?a("status.stalled"):al(b)?a("status.finishedTurn"):""}(e,a,j);return g&&(Q.has(g.state)?h="waiting":("reviewing"===g.state||"relaying"===g.state||"spawning"===g.state)&&(h="working"),l=`${e("status.flow",{label:P(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(aj),older:n.filter(a=>"older"===a.kind).sort(aj),livePreview:q.slice(0,3)}},[a,b,c,d,f,g,h])}let an=new Set,ao=[];function ap(a,b=Date.now()/1e3){return a.pendingQuestion||a.waitingInput?"waiting":"live"===a.activity?"live":"recent"===a.activity&&A(a)&&"running"!==a.proc?"returned":al(a,b)?"stalled"===a.activity?"stalled":"waiting":"done"}let aq="llvSound";function ar(a){try{window.localStorage.setItem("llvArchivedProjects",JSON.stringify([...a]))}catch{}}let as={files:[],flows:[]},at="(max-width: 767px)";function au(a){let b=window.matchMedia(at);return b.addEventListener("change",a),()=>b.removeEventListener("change",a)}function av(){return(0,e.useSyncExternalStore)(au,()=>window.matchMedia(at).matches,()=>!1)}let aw=k("menu",[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]]);function ax({files:a,archivedProjects:b,onSelectProject:c,onSelectFile:f,onMenu:g}){let{t:h}=t(),i=function(){let[a,b]=(0,e.useState)(3);return a}(),j=(0,e.useMemo)(()=>D(a),[a]),k=(0,e.useMemo)(()=>j.filter(a=>!b.has(a.project)),[j,b]),l=j.length-k.length,m=(0,e.useMemo)(()=>k.reduce((a,b)=>a+b.liveCount,0),[k]),n=k.filter(a=>a.liveCount>0).length,o=(0,e.useMemo)(()=>k.map(b=>{let c=H(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=>C(a)===b.project).sort((a,b)=>b.mtime-a.mtime)[0];return{summary:b,liveBranches:d,moreLive:c.length-d.length,latest:e}}),[a,k]);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:[g?(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":h("dash.openProjects"),onClick:g,children:(0,d.jsx)(aw,{className:"h-4 w-4","aria-hidden":!0})}):null,(0,d.jsx)("h1",{className:"text-[13.5px] font-bold",children:h("rail.overview")}),(0,d.jsxs)("span",{className:"text-[11.5px] text-dim",children:[m?h("overview.branchesLiveIn",{count:m,projects:h("overview.projects",{count:n})}):h("common.nothingRunning"),l?` ${h("overview.archived",{count:l})}`:""]})]}),(0,d.jsxs)("div",{className:"grid flex-1 auto-rows-min gap-2.5 overflow-y-auto p-3",style:{gridTemplateColumns:`repeat(${i}, minmax(0, 1fr))`},children:[o.map(({summary:a,liveBranches:b,moreLive:e,latest:g})=>(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:()=>c(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=ai(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:u(a.title),onClick:b=>{b.stopPropagation(),f(a)},onKeyDown:b=>{"Enter"===b.key&&(b.stopPropagation(),f(a))},children:[(0,d.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${Y(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:u(a.title,70)})]},a.path)}),e>0?(0,d.jsx)("span",{className:"px-1 text-[10.5px] font-semibold text-dim",children:h("overview.moreLive",{count:e})}):null]}):(0,d.jsx)("span",{className:"text-[11px] text-dim",children:h("overview.quiet",{age:g?W(g.mtime):"—"})})]},a.project)),k.length?null:(0,d.jsx)("div",{className:"col-span-full mt-[20vh] text-center text-dim",children:h("overview.empty")})]})]})}let ay=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"}]]),az=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"}]]),aA=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"}]]),aB=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"}]]),aC=k("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]),aD=k("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),aE=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"}]]),aF=k("ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}]]),aG=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"}]]),aH=k("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),aI=k("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),aJ=k("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),aK=k("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),aL=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"}]]),aM=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"}]]),aN=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"}]]),aO=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"}]]),aP=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"}]]),aQ=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"}]]),aR=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"}]]),aS=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"}]]),aT=k("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]),aU=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"}]]),aV=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"}]]),aW=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"}]]),aX=k("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]),aY=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"}]]),aZ=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"}]]),a$=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"}]]),a_=k("power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]),a0=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"}]]),a1=k("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),a2={shell:aI,tool:aW,"cmd-group":aX,codex:aL,claude:aS,image:aN,blob:aY,note:aZ,citation:a$,message:aO,shutdown:a_,plan:a0,compact:aM};function a3({name:a,className:b}){let c=a2[a];return(0,d.jsx)(c,{className:b??"h-3.5 w-3.5","aria-hidden":!0})}let a4=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"}]]);var a5=c(74429);function a6({label:a,side:b="top",children:c}){return(0,d.jsxs)("span",{className:"group/hint relative inline-flex",children:[c,(0,d.jsx)("span",{role:"tooltip",className:`pointer-events-none absolute left-1/2 z-[60] -translate-x-1/2 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 ${"top"===b?"bottom-full mb-1.5":"top-full mt-1.5"}`,children:a})]})}let a7={"image/png":"png","image/jpeg":"jpg","image/jpg":"jpg","image/gif":"gif","image/webp":"webp"};function a8(a){return new Promise((b,c)=>{let d=new FileReader;d.onload=()=>{let e=String(d.result),f=e.indexOf(",");f<0?c(Error(s(p(),"img.readFailed"))):b({base64:e.slice(f+1),mime:a.type||"image/png",preview:e})},d.onerror=()=>c(d.error??Error(s(p(),"img.readFailed"))),d.onabort=()=>c(Error(s(p(),"img.readAborted"))),d.readAsDataURL(a)})}function a9({images:a,onRemove:b}){let{t:c}=t();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)(l,{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)(aD,{className:"h-3 w-3","aria-hidden":!0})," ",c("img.toFilePaths")]})]}):null}function ba({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)(aN,{className:"h-4 w-4","aria-hidden":!0})})]})}function bb({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),q=(0,e.useRef)(null),r=function(a){let[b,c]=(0,e.useState)([]),d=b=>{if(!b.length)return;let d=[];for(let c of b){if(null===(a7[c.type]??null)){a.onError(s(p(),"img.unsupported",{name:c.name||c.type||s(p(),"img.unknownFile")}));continue}if(c.size>0xa00000){a.onError(s(p(),"img.tooLarge",{name:c.name||s(p(),"img.image")}));continue}d.push(c)}if(!d.length)return;let e=d.length<b.length;Promise.all(d.map(a8)).then(b=>{c(a=>[...a,...b]),e||a.onAdded?.()}).catch(b=>{a.onError(b instanceof Error?b.message:s(p(),"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)}),u=a=>{i(b=>b?b.trimEnd()+" "+a:a),o(null),q.current?.focus()},v=function({onError:a,onUnclaimedText:b,onLiveCommit:c}){let{t:d}=t(),[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),u=(0,e.useRef)(!1),v=(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()=>{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}},B=async()=>{if(u.current||l.current||n.current)return;u.current=!0;let b=null,e=!0;try{if(b=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1}}),!v.current)return;o.current=!1,k("");let f=await A();if(!v.current||o.current)return;if(!(null!==f&&((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,f))){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{v.current&&a(b?d("dictation.unsupported"):d("dictation.noMic"))}finally{var f;e&&(f=b,f?.getTracks().forEach(a=>a.stop())),u.current=!1}};return{phase:f,elapsed:h,liveText:j,canvasRef:q,start:B,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)}}}({onError:a=>o({kind:"err",text:a}),onUnclaimedText:u,onLiveCommit:u}),w=v.liveText?(f?f.trimEnd()+" ":"")+v.liveText:f,x=async()=>{if(!j&&!l){m(!0);try{let a=await v.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)}}},y="rec"===v.phase,z="busy"===v.phase,A=j||l||d,B=!A&&!z&&(y||!!f.trim()||r.images.length>0);return{text:f,textRef:h,setText:i,setTextState:g,displayText:w,inputRef:q,status:n,setStatus:o,busy:j,setBusy:k,voiceSending:l,dictation:v,attachments:r,insertSpoken:u,stopAndSend:x,submit:c,dictationRecording:y,dictationBusy:z,fieldsDisabled:A,canSend:B}}function bc({phase:a,elapsed:b,canvasRef:c,start:e,stop:f,discard:g,onText:h,busy:i=!1}){let{t:j}=t(),k=()=>{i||("idle"===a?e():"rec"===a&&f().then(a=>{a&&h(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":j("mic.stopRecognize"),onClick:k,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":j("mic.cancel"),onClick:g,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)(l,{className:"h-3.5 w-3.5","aria-hidden":!0})})]});return(0,d.jsx)("button",{type:"button","aria-label":j("busy"===a?"mic.recognizing":"mic.dictate"),title:j("busy"===a?"mic.recognizing":"mic.dictateHint"),disabled:"busy"===a||i,onClick:k,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 disabled:opacity-60",children:"busy"===a?(0,d.jsx)(a1,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):(0,d.jsx)(aQ,{className:"h-4 w-4","aria-hidden":!0})})}function bd({composer:a,placeholder:b,textareaAriaLabel:c,imageAriaLabel:e,leftSlot:f,sendLabelIdle:g,sendLabelRecording:h,sendTitleRecording:i,sendIdleClassName:j,sendIdleStyle:k}){let{displayText:l,inputRef:m,dictation:n,setText:o,attachments:p,voiceSending:q,insertSpoken:r,stopAndSend:s,submit:t,fieldsDisabled:u,canSend:v,dictationRecording:w,busy:x,status:y}=a;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("textarea",{ref:m,value:l,rows:1,readOnly:!!n.liveText,onChange:a=>o(a.target.value),onPaste:p.handlePaste,onKeyDown:a=>{"Enter"!==a.key||a.shiftKey||a.nativeEvent.isComposing||(a.preventDefault(),"rec"===n.phase?s():t())},placeholder:b,"aria-label":c,disabled:u,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:[f,(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5",children:[(0,d.jsx)(bc,{...n,busy:q,onText:r}),(0,d.jsx)(a6,{label:e,children:(0,d.jsx)(ba,{ariaLabel:e,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:p.addFiles})}),(0,d.jsx)(a6,{label:w?i??h:g,children:(0,d.jsx)("button",{type:w?"button":"submit",onClick:w?()=>void s():void 0,disabled:!v,"aria-label":w?h:g,style:w?void 0:k,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 ${w?"border-err bg-err hover:opacity-90":j}`,children:x||q?(0,d.jsx)(a1,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):(0,d.jsx)(aR,{className:"h-4 w-4","aria-hidden":!0})})})]})]}),(0,d.jsx)(a9,{images:p.images,onRemove:p.removeAt}),y?(0,d.jsx)("span",{className:`truncate text-[10.5px] font-semibold ${"ok"===y.kind?"text-ok":"text-err"}`,children:y.text}):null]})}function be(a){return"claude-projects"===a.root?"сесія"===a.kind||"субагент"===a.kind:"codex-sessions"===a.root}function bf({file:a}){let{t:b}=t(),c=function(a,b){let[c,d]=(0,e.useState)(null);return null!==a||b?c:null}(a.pid,be(a)?a.path:void 0),f=bb({initialText:()=>"",persistText:b=>{b?sessionStorage.setItem("llvDraft:"+a.path,b):sessionStorage.removeItem("llvDraft:"+a.path)},submit:a=>F(a)}),{text:g,textRef:h,setText:i,setTextState:j,inputRef:k,setStatus:m,busy:n,setBusy:o,voiceSending:q,attachments:r}=f,[s,u]=(0,e.useState)(!1),[v,w]=(0,e.useState)(!1),[x,y]=(0,e.useState)(!1),[z,A]=(0,e.useState)([]),B=be(a);if(null===c&&!B)return null;let C=null===c,D=C&&"claude-projects"===a.root&&"субагент"===a.kind,E=b=>{A(b),sessionStorage.setItem("llvSent:"+a.path,JSON.stringify(b))},F=async c=>{let d=c??g;if(!n&&!q&&(d.trim()||r.images.length)){o(!0),m(null);try{let c=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:r.images.map(a=>({base64:a.base64,mime:a.mime}))})}),e=await c.json();if(!c.ok||!e.ok)return void m({kind:"err",text:e.error??b("common.failedSend")});let f=r.images.length,g={id:Date.now(),text:d.trim()||(f?b("composer.imagesCount",{count:f}):""),at:Date.now(),via:e.spawned?"spawn":"pane"};E([...z,g].slice(-8)),i(""),r.clear(),m({kind:"ok",text:e.spawned?b("composer.spawned",{target:e.target??""}):e.imagePaths?.length?b("composer.sentPaths",{count:e.imagePaths.length}):b("common.sent")}),k.current?.focus()}catch{m({kind:"err",text:b("common.serverUnavailable")})}finally{o(!1)}}},G=async()=>{if(!s){u(!0),m(null);try{let c=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"interrupt",path:a.path})}),d=await c.json();if(!c.ok||!d.ok)return void m({kind:"err",text:d.error??b("composer.failedInterrupt")});m({kind:"ok",text:b("composer.escapeSent")})}catch{m({kind:"err",text:b("common.serverUnavailable")})}finally{u(!1)}}},H=async()=>{if(!v){w(!0),m(null);try{let c=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"compact",path:a.path})}),d=await c.json();if(!c.ok||!d.ok)return void m({kind:"err",text:d.error??b("composer.failedCompact")});m({kind:"ok",text:b("composer.compactSent")})}catch{m({kind:"err",text:b("common.serverUnavailable")})}finally{w(!1)}}};return(0,d.jsxs)("form",{onSubmit:a=>{a.preventDefault(),F()},className:"flex shrink-0 flex-col gap-1.5 border-t border-line bg-[#fbfbfd] px-2.5 py-2","aria-label":C?b("composer.spawnAria"):b("composer.sendAria",{target:c??""}),children:[z.length?(0,d.jsx)("div",{className:"flex flex-col gap-0.5","aria-label":b("composer.queueAria"),children:z.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)(aR,{className:"h-2.5 w-2.5","aria-hidden":!0}):(0,d.jsx)(aD,{className:"h-2.5 w-2.5","aria-hidden":!0}),new Date(a.at).toLocaleTimeString("uk"===p()?"uk-UA":"en-US",{hour12:!1,hour:"2-digit",minute:"2-digit"})]}),(0,d.jsx)("button",{type:"button","aria-label":b("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:()=>E(z.filter(b=>b.id!==a.id)),children:(0,d.jsx)(l,{className:"h-3 w-3","aria-hidden":!0})})]},a.id))}):null,(0,d.jsx)(bd,{composer:f,placeholder:D?b("composer.placeholderRelay"):C?b("composer.placeholderSpawn"):b("composer.placeholderSend"),textareaAriaLabel:b("composer.textAria"),imageAriaLabel:b("composer.addImages"),sendLabelIdle:C?b("composer.launchAgent"):b("composer.sendToAgent"),sendLabelRecording:b("composer.stopAndSend"),sendTitleRecording:b("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-1.5 py-1 font-mono text-[9.5px] font-semibold text-[#555]",title:D?b("composer.titleRelay"):C?b("composer.titleSpawnResumed"):`tmux ${c}`,children:D?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(aE,{className:"h-3 w-3 shrink-0","aria-hidden":!0})," ",b("composer.root")]}):C?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(aR,{className:"h-3 w-3 shrink-0","aria-hidden":!0})," resume"]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(aU,{className:"h-3 w-3 shrink-0","aria-hidden":!0})," ",(0,d.jsx)("span",{className:"truncate",children:c})]})}),C?null:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(a6,{label:b("composer.interruptTitle"),children:(0,d.jsx)("button",{type:"button","aria-label":b("composer.interruptAria"),disabled:s,onClick:()=>void G(),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:s?(0,d.jsx)(a1,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):(0,d.jsx)(aT,{className:"h-4 w-4",fill:"currentColor","aria-hidden":!0})})}),(0,d.jsx)(a6,{label:x?b("composer.compactConfirmTitle"):b("composer.compactTitle"),children:(0,d.jsx)("button",{type:"button","aria-label":x?b("composer.compactConfirmTitle"):b("composer.compactAria"),disabled:v,onClick:()=>{x?(y(!1),H()):y(!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 ${x?"border-[#0d9488] bg-[#e3f4f0] text-[#0b7c72]":"border-line bg-panel text-dim hover:border-[#0d9488]/50 hover:text-[#0b7c72]"}`,children:v?(0,d.jsx)(a1,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):x?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(aH,{className:"h-4 w-4","aria-hidden":!0}),(0,d.jsx)("span",{className:"text-[10.5px] font-bold",children:b("composer.compactConfirm")})]}):(0,d.jsx)(aM,{className:"h-4 w-4","aria-hidden":!0})})})]})]})})]})}let bg="#0d9488",bh=new Map;function bi(){for(let a of document.querySelectorAll("[data-link-hover]"))a.removeAttribute("data-link-hover")}function bj(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 bk({drop:a}){let{t:b}=t(),c=Math.max(8,Math.min(a.to.x+14,window.innerWidth-288)),e=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:c,top:e,backgroundColor:bg},children:[(0,d.jsx)(a4,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),(0,d.jsx)("span",{className:"truncate",children:b("link.dropped",{title:u(a.file.title,48)})})]})}function bl({file:a,onDeleted:b}){let{t:c}=t(),[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)(aV,{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 bm({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 bn=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"}]]),bo=/^\s*(?:VERDICT:\s*)?(REQUEST_CHANGES|APPROVE|COMMENT)\b/m,bp=/^\s*(\d+)[.)]\s+(.*)$/,bq=/(?:\[(P[0-3])\]|\b(Critical|High|Medium|Low|Info|P[0-3])\b)/i,br=/((?:\.{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,bs=/\[([^\]]+)\]\(([^)\s]+)\)/,bt=/([\w.-]*(?:api[_-]?key|access[_-]?token|refresh[_-]?token|authorization|bearer|secret|password|passwd|pwd|token))\b(\s*[:=]\s*)(["']?)[^\s"',}]+/gi;function bu(a){return a.replace(bt,(a,b,c,d)=>`${b}${c}${d}[redacted]`)}function bv(a){let b=bu(a);return{raw:b.slice(0,24e3),truncated:b.length>24e3}}function bw(a){let b=a.match(/^(.*?):(\d+(?:-\d+)?)$/);return b?{target:b[1]??a,line:b[2]}:{target:a}}function bx(a,b){let c=a.match(bo)?.[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(bq)?.[1]??e.match(bq)?.[2]??"Info"),b=function(a){let b=a.match(bs);if(b){let a=bw((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(br);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(bq);if(c&&void 0!==c.index){let a=b.slice(c.index+c[0].length).replace(/^[\s.:–—-]+/,"");a&&(b=a)}return b.replace(bs,"$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:bv(e).raw})),f=null};for(let b of a.split("\n")){let a=b.trimEnd(),c=a.match(bp);if(c){g(),f=c[2]??"";continue}let h=a.trim();if(null!==f){h?f=`${f}
|
|
2
|
+
${h}`:g();continue}!(!h||bo.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=>bq.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:bv(a).raw}:null}let by=(a,b)=>s(p(),a,b),bz=/<oai-mem-citation>\s*<citation_entries>([\s\S]*?)<\/citation_entries>\s*<rollout_ids>([\s\S]*?)<\/rollout_ids>\s*<\/oai-mem-citation>/g;function bA(a){return"number"==typeof a&&Number.isFinite(a)?a:void 0}let bB=/<(teammate-message|agent-message)\b([^>]*)>([\s\S]*?)<\/\1>/g,bC=/\S*\/\.claude\/viewer-inbox\/([A-Za-z0-9._-]+\.(?:png|jpe?g|gif|webp))/gi;function bD(a){if(!a.includes("/.claude/viewer-inbox/"))return{cleaned:a,images:[]};let b=[],c=new Set,d=[];for(let e of a.split("\n"))e.replace(bC,(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 bE=/^\s*(?:<[a-zA-Z][\w:-]*|Caveat: The messages below|\[Request interrupted|This came from another Claude session|# AGENTS\.md instructions)/;function bF(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||by("render.system"))}function bG(a,b){return a.match(RegExp(`${b}="([^"]*)"`))?.[1]??""}function bH(a){return"string"==typeof a?a:""}function bI(a){return a&&"object"==typeof a&&!Array.isArray(a)?a:{}}function bJ(a){return Array.isArray(a)?a.filter(a=>a&&"object"==typeof a&&!Array.isArray(a)):[]}function bK(a,b,c){let d=b.split("\n").map(a=>a.trim()).filter(Boolean).map(a=>{let b=a.match(/\|note=\[(.*)\]$/)?.[1],c=bw(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=bv(a);return{kind:"mem-citation",entries:d,rolloutIds:e,raw:f.raw,truncated:f.truncated}}function bL(a,b,c){if(!a)return null;let d=b.match(/exited with code (\d+)/)?.[1],e=b.replace(/^Chunk ID:[^\n]*\n/,"").replace(/Wall time:[^\n]*\n/,"").replace(/Original token count:[^\n]*\n?/,"").trim(),f=!0===c||void 0!==d&&"0"!==d;return a.status=f?"err":"ok",a.label=f?d&&"0"!==d?"exit "+d:by("render.error"):"ok",a.open||=f,e&&(a.output=(a.output+"\n"+bu(e)).trim().slice(-(f?6e4:12e3))),a}let bM=k("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]),bN=k("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);function bO({src:a,alt:b,caption:c,onClose:f}){let{t:g}=t(),[h,i]=(0,e.useState)(1),[j,k]=(0,e.useState)(0),[m,n]=(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),n(c-(c-m)*e)},s=()=>{i(1),k(0),n(0)};return(0,a5.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)(bM,{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)(bN,{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)(l,{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:m},p(!0)},onPointerMove:a=>{q.current&&(k(q.current.tx+(a.clientX-q.current.x)),n(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, ${m}px) scale(${h})`}})})})]}),document.body)}function bP({name:a,path:b}){let{t:c}=t(),[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)(a3,{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)(a3,{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)(aV,{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)(bO,{src:p,alt:c("inbox.attachedAlt",{name:a}),caption:b,onClose:()=>g("thumb")}):null]})}let bQ=/(`[^`]+`|\*\*[^*]+\*\*|\[[^\]]+\]\([^)\s]+\)|https?:\/\/[^\s<>"')\]]+)/g;function bR({href:a,label:b}){return(0,d.jsx)("a",{href:a,target:"_blank",rel:"noreferrer",title:a,className:"break-all text-accent underline decoration-accent/40 underline-offset-2 hover:decoration-accent",children:b})}function bS(a){return a.split(bQ).map((a,b)=>{if(!a)return null;if(a.startsWith("`")&&a.endsWith("`"))return(0,d.jsx)("span",{className:"rounded-md bg-chip px-1.5 py-0.5 font-mono",children: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){let a=c[2].replace(/\\([()])/g,"$1");return/^https?:\/\//.test(a)?(0,d.jsx)(bR,{href:a,label:c[1]},b):(0,d.jsx)("span",{className:"rounded-md bg-chip px-1.5 py-0.5 font-mono",children:c[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)(bR,{href:c,label:f}),e]},b)}return a})}let bT=/^\s*\|.*\|\s*$/,bU=/^:?-{1,}:?$/;function bV({rows:a}){let b=a.map(a=>a.trim().replace(/^\|/,"").replace(/\|$/,"").split("|").map(a=>a.trim())),c=b.length>1&&b[1].every(a=>bU.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:bS(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:bS(a)},b))},b))})]})})}function bW(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)("pre",{className:"my-1.5 max-w-full overflow-x-auto rounded-[10px] border border-line bg-bg px-3 py-2 font-mono text-[11.5px]",children:e},`c${a}`));continue}if(bT.test(b[f])){let a=f;for(;f<b.length&&bT.test(b[f]);)f++;"\n"===c[c.length-1]&&c.pop(),c.push((0,d.jsx)(bV,{rows:b.slice(a,f)},`t${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:bS(g[1])},f)):h?c.push((0,d.jsx)("span",{className:"border-l-2 border-line pl-2 text-dim",children:bS(h[1])},f)):c.push((0,d.jsx)(e.Fragment,{children:bS(a)},f)),++f<b.length&&c.push("\n")}return c}function bX({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:by("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)(a3,{name:"blob",className:"h-4 w-4"})}),(0,d.jsx)("span",{className:"font-semibold",children:by("render.dataKb",{n:g})}),(0,d.jsx)("span",{className:"ml-1 text-[12px] font-semibold text-accent",children:by("common.show")})]})}let bY=/(?:\/\.codex\/sessions\/|\/\.claude\/projects\/|\/\.claude\/plugins\/data\/codex-openai-codex\/state\/|^\/tmp\/claude-\d+\/)/;function bZ({status:a,className:b}){let c=b??"h-3.5 w-3.5";return"ok"===a?(0,d.jsx)(aH,{className:c,"aria-hidden":!0}):"err"===a?(0,d.jsx)(l,{className:c,"aria-hidden":!0}):(0,d.jsx)(a1,{className:`${c} animate-spin`,"aria-hidden":!0})}function b$({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 bY.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 b_({item:a}){let b=Object.entries(a.byTool).map(([a,b])=>`${a} \xd7${b}`).join(" \xb7 "),c=X(a.t0),e=X(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)(a3,{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:[by("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)(aH,{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)(l,{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)(a3,{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)(bZ,{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])})})]})}function b0({item:a}){let b=[a.trigger?by("auto"===a.trigger?"render.compactAuto":"render.compactManual"):"",a.preTokens?by("render.compactPre",{n:Math.round(a.preTokens/1e3)}):"",X(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)(a3,{name:"compact",className:"h-3.5 w-3.5"}),by("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:[by("render.compactSummary")," \xb7 ",by("common.show")]}),(0,d.jsx)("span",{className:"hidden group-open/cmp:inline",children:by("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 b1({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}`:by("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)(a3,{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," ",by("common.kb")]}),(0,d.jsx)("span",{className:"ml-1 text-[12px] font-semibold text-accent",children:by("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:`${by("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:by("common.collapse")}),"full"===h?(0,d.jsx)(bO,{src:l,alt:`${by("render.image")} ${k}`,caption:`${k} \xb7 ${j} ${by("common.kb")}`,onClose:()=>i("thumb")}):null]})}function b2({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)(a3,{name:"citation",className:"h-4 w-4"})}),(0,d.jsx)("span",{className:"text-[13px] font-semibold",children:by("render.memoryCitations",{count:a.entries.length})}),(0,d.jsx)("span",{className:"ml-auto text-[11px] font-semibold text-accent group-open:hidden",children:by("common.show")}),(0,d.jsx)("span",{className:"ml-auto hidden text-[11px] font-semibold text-accent group-open:inline",children:by("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)(b$,{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:by("render.noCitations")}),a.entries.length>b.length?(0,d.jsx)("div",{className:"mt-1.5 text-[12px] text-dim",children:by("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 "+by("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 b3={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 b4(a){return"string"==typeof a&&a.length?a:void 0}function b5({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?by("render.approved"):by("render.rejected")})}function b6({payload:a}){let b=b4(a.from),c=b4(a.requestId),e=X(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:by("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 b7({payload:a}){let b=b4(a.type),c=b?b3[b]:void 0;if(!c)return(0,d.jsxs)("div",{className:"text-[13px]",children:[(0,d.jsx)("div",{className:"text-dim",children:by("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:by("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=b4(a.reason)??b4(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)(a3,{name:c.icon,className:"h-3.5 w-3.5"}),by(c.labelKey)]}),void 0!==e?(0,d.jsx)(b5,{approve:e}):null]}),f?(0,d.jsx)("div",{className:"mt-1.5 whitespace-pre-wrap break-words",children:bW(f)}):null,(0,d.jsx)(b6,{payload:a})]})}function b8({verdict:a}){return(0,d.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,d.jsx)("REQUEST_CHANGES"===a?aF:"APPROVE"===a?aK:aP,{className:"h-3.5 w-3.5","aria-hidden":!0}),"REQUEST_CHANGES"===a?"REQUEST_CHANGES":"APPROVE"===a?"APPROVE":"COMMENT"]})}function b9({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)(aL,{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)(b8,{verdict:a.verdict})}):null,(0,d.jsx)("span",{className:"text-[11px] text-dim",children:c?`${c} finding${1===c?"":"s"}`:by("render.noFindings")}),X(a.ts)?(0,d.jsx)("span",{className:"ml-auto text-[11px] text-dim",children:X(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:bW(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)(b$,{file:a.file,line:a.line}):null]}),(0,d.jsx)("div",{className:"mt-1.5 whitespace-pre-wrap break-words text-[13px]",children:bS(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:bW(a.body)})]}):null]},b)})}):null,a.findings.length>e.length?(0,d.jsx)("div",{className:"mt-2 text-[12px] text-dim",children:by("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 ca({label:a,text:b}){let c=b.length>=2048?`${(b.length/1024).toFixed(1)} ${by("common.kb")}`:by("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)(a3,{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:[by("render.system")," \xb7 ",c]}),(0,d.jsx)("span",{className:"text-accent group-open:hidden",children:by("common.show")}),(0,d.jsx)("span",{className:"hidden text-dim group-open:inline",children:by("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 cb=(0,e.memo)(function({item:a}){if("image"===a.kind)return(0,d.jsx)(b1,{media:a.media,data:a.data,w:a.w,h:a.h,bytes:a.bytes});if("inbox-image"===a.kind)return(0,d.jsx)(bP,{name:a.name,path:a.path});if("blob"===a.kind)return(0,d.jsx)(bX,{bytes:a.bytes,text:a.text});if("sysmsg"===a.kind)return(0,d.jsx)(ca,{label:a.label,text:a.text});if("compact"===a.kind)return(0,d.jsx)(b0,{item:a});if("review"===a.kind)return(0,d.jsx)(b9,{item:a});if("mem-citation"===a.kind)return(0,d.jsx)(b2,{item:a});if("prose"===a.kind){let b="codex"===a.engine?"bg-codex":"bg-claude",c="codex"===a.engine?aL:aS;return(0,d.jsxs)("div",{className:"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:"min-w-0 flex-1 whitespace-pre-wrap break-words",children:[X(a.ts)?(0,d.jsx)("div",{className:"mb-0.5 text-[11px] text-dim",children:X(a.ts)}):null,bW(a.text)]})]})}if("user"===a.kind){let b=a.text.length>500;return(0,d.jsx)("div",{className:"my-3.5 flex justify-end",children:(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:["(",by("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:[by("common.collapse")," ",(0,d.jsx)(aJ,{className:"h-3 w-3","aria-hidden":!0})]})]}),bW(a.text)]}):bW(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)(a3,{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)(bZ,{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"+by("render.noOutputInLog"))})]})}if("cmd-group"===a.kind)return(0,d.jsx)(b_,{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)(a3,{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:by("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)(aO,{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?by("render.toDir"):by("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)(aH,{className:"h-3 w-3","aria-hidden":!0}):(0,d.jsx)(l,{className:"h-3 w-3","aria-hidden":!0}),"ok"===a.delivery?by("render.delivered"):by("render.notDelivered")]}):null,X(a.ts)?(0,d.jsx)("span",{className:"ml-auto shrink-0 text-[11px] text-dim",children:X(a.ts)}):null]}),(0,d.jsx)("div",{className:"px-3.5 pb-2.5 pt-1",children:b?(0,d.jsx)(b7,{payload:b}):(0,d.jsxs)(d.Fragment,{children:[a.summary?(0,d.jsx)("div",{className:"text-[13px] font-bold",children:bS(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:by("common.showAll")})]}),(0,d.jsxs)("span",{className:"hidden items-center gap-1 text-[11px] font-semibold text-dim group-open/tmsg:inline-flex",children:[by("common.collapse")," ",(0,d.jsx)(aJ,{className:"h-3 w-3","aria-hidden":!0})]})]}),bW(a.text)]}):(0,d.jsx)("div",{className:"mt-0.5 whitespace-pre-wrap break-words text-[13px]",children:bW(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)(aO,{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:by("render.reasoning"),children:[(0,d.jsx)(aG,{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:bW(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:bS(a.text)}):(0,d.jsx)("div",{className:`my-0.5 break-words text-[12.5px] ${a.err?"text-err":"text-[#555]"}`,children:a.text})}),cc=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"}]]),cd=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 ce({file:a}){let{t:b}=t(),c=a.pendingQuestion,[f,g]=(0,e.useState)("pending"),[h,i]=(0,e.useState)(""),[j,k]=(0,e.useState)({}),[m,n]=(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,u=(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)(cc,{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)(a1,{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 v=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||u})}):"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)(cc,{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)(cc,{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:()=>v({approve:!0},b("question.approved")),children:[(0,d.jsx)(aH,{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:()=>v({approve:!1,text:o},b("question.rejected")),children:[(0,d.jsx)(l,{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||v({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:m,onChange:a=>n(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||!m.trim(),onClick:()=>v({text:m},m),children:[(0,d.jsx)(cd,{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:()=>v({answers:w()},u),children:[(0,d.jsx)(cd,{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)(a1,{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 cf({file:a}){let{t:b}=t();return"running"===a.proc?(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-[#e5f6ea] px-2 py-0.5 text-[11px] font-bold text-ok",children:[(0,d.jsx)(aR,{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 cg({file:a,compact:b=!1}){let{t:c}=t(),[f,g]=(0,e.useState)(!1),[h,i]=(0,e.useState)(!1),[j,k]=(0,e.useState)(""),[l,m]=(0,e.useState)(!1),n=(0,d.jsx)(cf,{file:a}),o=async()=>{i(!0),k("");try{let b=await fetch("/api/proc",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:a.path,force:l})}),d=await b.json();if(!b.ok||!d.ok){k(d.error??c("task.stopFailed")),m(!0);return}k(c("task.signalSent",{signal:l?"SIGKILL":"SIGTERM",pid:d.pid??""})),g(!1)}catch{k(c("common.serverUnavailable")),m(!0)}finally{i(!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:[n,"running"===a.proc?f?(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:c("task.confirmKill",{pid:a.pid??""})}),(0,d.jsx)("button",{className:"rounded-lg bg-err px-2 py-0.5 text-[11px] font-bold text-white disabled:opacity-60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-err/50",disabled:h,onClick:o,children:l?"SIGKILL":b?c("task.killPid",{pid:a.pid??""}):c("task.confirmKillYes")}),(0,d.jsx)("button",{className:"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:()=>g(!1),children:b?c("common.no"):c("common.cancel")})]}):(0,d.jsx)("button",{className:"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":c("task.stopAria",{pid:a.pid??""}),onClick:()=>g(!0),children:c("task.kill")}):null,j?(0,d.jsx)("span",{className:"max-w-[220px] truncate text-[11px] font-semibold text-dim",children:j}):null]})}function ch({file:a,files:b,onSelect:c}){let{t:e}=t();if("codex-jobs"===a.root){let f=b.find(b=>"codex-sessions"===b.root&&b.parent===a.path);return(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)(cf,{file:a})}),f?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"mb-2 whitespace-pre-line text-[13.5px] font-semibold",children:e("task.jobLogHint")}),(0,d.jsxs)("button",{className:"inline-flex items-center gap-1.5 rounded-[10px] border border-line bg-bg px-3 py-1.5 text-[13px] font-semibold text-codex hover:bg-codex-soft",onClick:()=>c(f),children:[(0,d.jsx)(aL,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",e("task.openCodexSession",{size:(f.size/1024).toFixed(0),activity:"live"===f.activity?e("task.working"):"stalled"===f.activity?e("task.interrupted"):"recent"===f.activity?e("task.finished"):""})]})]}):(0,d.jsx)("div",{className:"text-[13.5px] text-dim",children:e("task.rolloutMissing")})]})}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)(cf,{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||e("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:e("task.commandNotFound")})]})}let ci=new Map;function cj(a,b,c){ci.size>300&&!ci.has(a)&&ci.clear(),ci.set(a,{magnet:b,fromBottom:c})}function ck({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 cl({file:a,files:b,onSelect:c,showSvc:f,lineFilter:g,onStatus:h,paused:i,follow:j,setFollow:k,compact:l=!1}){let{locale:m,t:n}=t(),[o,p]=(0,e.useState)(()=>a?ci.get(a.path)?.magnet??j:j),q=function(a,b=!1,c=2500){(0,e.useRef)(c);let[d,f]=(0,e.useState)([]),[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);(0,e.useRef)(!1);let B=(0,e.useRef)(!1);return{lines:d,size:g,loading:i,error:k,tickTime:m,paused:o,setPaused:p,clear:(0,e.useCallback)(()=>{f([]),w.current=0,x.current=0,y.current="",z.current=!0,r(!1)},[]),hasMore:q,loadingOlder:s,loadOlder:(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=>h.concat(a)),v(a=>a+1)),h.length}catch{return 0}finally{B.current=!1,t(!1)}},[a?.path]),prependGen:u}}(a,i,o&&l?2500:0),r=(0,e.useRef)(null),s=(0,e.useRef)(null),u=(0,e.useRef)(null),v=l?500:1500,[w,x]=(0,e.useState)(l?300:1500),[y,A]=(0,e.useState)(0),[B,C]=(0,e.useState)(!1),[D,E]=(0,e.useState)(null);(0,e.useRef)(!1);let F=(0,e.useRef)(o);(0,e.useRef)(0),(0,e.useRef)(0);let G=(0,e.useRef)(null),H=(0,e.useRef)(0);(0,e.useRef)(null);let I=(b,c=!1)=>{F.current=b,p(b),k(b),b&&A(0),a&&cj(a.path,b,ci.get(a.path)?.fromBottom??0),c&&(C(!0),G.current&&window.clearTimeout(G.current),G.current=window.setTimeout(()=>C(!1),450))},J=()=>{let a=r.current;a&&(H.current=Date.now(),a.scrollTop=a.scrollHeight)},K=(0,e.useMemo)(()=>a?function(a,b,c,d){let e=new Map,f=new Map,g=[],h=0,i="",j=a=>!!(!(a.length<=2e4)&&(a.match(/\s/g)?.length??0)/a.length<.02)&&(g.push({kind:"blob",bytes:a.length,text:bu(a).slice(0,2e5)}),!0),k=(a,b)=>{let c=bI(a.source),d=bH(c.data)||bH(b.base64);if(!d)return;let e=bH(c.media_type)||bH(b.type),f=e.startsWith("image/")?e:"image/png",h=bI(b.dimensions);g.push({kind:"image",media:f,data:d,w:bA(h.originalWidth),h:bA(h.originalHeight),bytes:bA(b.originalSize)})},l=(a,b,c)=>{bz.lastIndex=0;let d=bz.test(b);if(bz.lastIndex=0,!d){let c=bx(b.trim(),a);return!!c&&(g.push(c),!0)}let e=!1,f=0,h=b=>{let d=b.trim();if(!d)return;let f=bx(d,a);f?(g.push(f),e=!0):c(d)};for(let a of b.matchAll(bz)){let c=a[0],d=a.index??0;h(b.slice(f,d)),g.push(bK(c,a[1]??"",a[2]??"")),e=!0,f=d+c.length}return h(b.slice(f)),e},m=a=>{let b=[];return bz.lastIndex=0,{cleaned:a.replace(bz,(a,c,d)=>(b.push(bK(a,c,d)),"")).trim(),cites:b}},n=(b,c)=>{if(!c.trim()||c===i||(i=c,j(c)))return;let d="codex"===a.engine?"codex":"claude";l(b,c,a=>g.push({kind:"prose",ts:b,text:a,engine:d}))||g.push({kind:"prose",ts:b,text:c,engine:d})},o=(a,b,c,d)=>{let f=c||"plain-"+g.length+"-"+String(a??""),h=function(a,b="shell"){let c=bu(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:by("render.executing"),open:!1}}(b,d);return e.set(f,h),g.push({kind:"cmd",id:f,call:h,ts:a}),h},p=(a,b,d)=>{if(!a)return;let h=f.get(a);if(h){h.delivery=d||/"success"\s*:\s*false/.test(b)?"err":"ok",h.msgId=b.match(/"msg_id"\s*:\s*"([^"]+)"/)?.[1];return}!bL(e.get(a),b,d)&&b&&c&&g.push({kind:"svc",text:"output: "+bu(b).slice(0,200)})},q=a=>{c?g.push({kind:"svc",text:a.slice(0,300)}):h+=1},r=a=>{g.push({kind:"note",text:a})},s=(a,b)=>{let c=b.replace(bB,(b,c,d,e)=>{let f=bG(d,"teammate_id")||bG(d,"from")||by("render.teammate"),h=bG(d,"summary"),i=e.trim();if(i.startsWith("{"))try{let a=JSON.parse(i);if("idle_notification"===a.type){let b=X(a.timestamp);return g.push({kind:"tnote",text:by("render.left",{peer:f,at:b?" \xb7 "+b:""})}),""}}catch{}let{cleaned:j,cites:k}=m(i),l=bo.test(j)?bx(j,a):null;for(let b of(g.push({kind:"tmsg",ts:a,dir:"in",peer:f,summary:h,text:l?"":j}),l&&g.push(l),k))g.push(b);return""}).replace(/Another Claude session sent a message:\s*/g,"").trim();if(!c||j(c))return;if(bE.test(c))return void g.push({kind:"sysmsg",label:bF(c),text:c});let{cleaned:d,images:e}=bD(c);for(let b of(d&&!l(a,d,b=>g.push({kind:"user",ts:a,text:b}))&&g.push({kind:"user",ts:a,text:d}),e))g.push({kind:"inbox-image",name:b.name,path:b.path})},t=null,u=(a,b)=>{if(t&&t.text===b&&t.at===g.length)return;let{cleaned:c,images:d}=bD(b);for(let b of(c&&g.push({kind:"user",ts:a,text:c}),d))g.push({kind:"inbox-image",name:b.name,path:b.path});t={text:b,at:g.length}},v=(a,b)=>{t&&t.text===a&&t.at===g.length||(g.push({kind:"sysmsg",label:bF(a,b),text:a}),t={text:a,at:g.length})},w=!1,x=(a,b)=>{g.push({kind:"compact",ts:a,trigger:b?.trigger,preTokens:b?.preTokens})},y=a=>{let b=bI(a.payload),c=a.timestamp;if("session_meta"===a.type)return r(`${by("render.codexSessionCreated")} \xb7 ${bH(b.model)} \xb7 ${bH(b.cwd)}`);if("event_msg"===a.type){if("agent_message"===b.type&&b.message)return n(c,bH(b.message));if("user_message"===b.type&&b.message){let a=bH(b.message);return bE.test(a)?v(a):u(c,a)}return"task_started"===b.type?r(by("render.taskStarted")+(c?" \xb7 "+X(c):"")):"task_complete"===b.type?r(by("render.taskComplete")+(c?" \xb7 "+X(c):"")):"context_compacted"===b.type?w?void(w=!1):x(c):q(bH(b.type)||"event")}if("response_item"===a.type){if("message"===b.type){let a=bJ(b.content).map(a=>bH(a.text)||bH(a.input_text)).join(" ").trim();return a?"assistant"===b.role?n(c,a):"user"!==b.role||bE.test(a)?v(a,bH(b.role)):u(c,a):q("message "+bH(b.role))}if("function_call"===b.type){let a={};try{a=JSON.parse(bH(b.arguments)||"{}")}catch{a={}}let d=bH(b.name);if("exec_command"===d||"shell"===d)return o(c,String(a.cmd??a.command??"").replace(/^\/usr\/bin\/zsh -lc /,""),bH(b.call_id));if("apply_patch"===d){let b=String(a.input??"").match(/(Add|Update|Delete) File: [^\n]+/g);g.push({kind:"edit",files:b?b.join(", ").replace(/(Add|Update|Delete) File: /g,""):by("render.patch")});return}return"write_stdin"===d?q(by("render.stdinSession",{id:String(a.session_id??"")})):o(c,d+" "+JSON.stringify(a).slice(0,120),bH(b.call_id),"tool")}if("function_call_output"===b.type)return p(bH(b.call_id),"string"==typeof b.output?b.output:JSON.stringify(b.output??""));if("custom_tool_call"===b.type&&"apply_patch"===bH(b.name)){let a=bH(b.input).match(/(Add|Update|Delete) File: [^\n]+/g);g.push({kind:"edit",files:a?a.join(", ").replace(/(Add|Update|Delete) File: /g,""):by("render.patch")});return}return"custom_tool_call_output"===b.type?p(bH(b.call_id),"string"==typeof b.output?b.output:JSON.stringify(b.output??"")):"reasoning"===b.type?q("reasoning"):q(bH(b.type)||"item")}if("compacted"===a.type)return w=!0,x(c);q(bH(a.type)||by("render.record"))},z=a=>{let b=a.timestamp;if("user"===a.type&&a.message){let c=bI(a.message).content,d=bI(bI(a.toolUseResult).file);if(!0===a.isCompactSummary){let a="string"==typeof c?c:bJ(c).filter(a=>"text"===a.type).map(a=>bH(a.text)).join(" ");a.trim()&&((a,b)=>{for(let a=g.length-1;a>=0;a-=1){let c=g[a];if("compact"===c.kind){c.summary=b;return}if("svc"!==c.kind&&"note"!==c.kind)break}g.push({kind:"compact",ts:a,summary:b})})(b,a.trim());return}if("string"==typeof c)s(b,c);else for(let a of bJ(c))if("text"===a.type)s(b,bH(a.text));else if("image"===a.type)k(a,d);else if("tool_result"===a.type){let b=bJ(a.content);for(let a of b)"image"===a.type&&k(a,d);let c="string"==typeof a.content?a.content:b.filter(a=>"image"!==a.type).map(a=>bH(a.text)).join(" ");p(bH(a.tool_use_id),c,!0===a.is_error)}return}if("assistant"===a.type&&a.message){for(let c of bJ(bI(a.message).content))if("text"===c.type&&bH(c.text).trim())n(b,bH(c.text));else if("thinking"===c.type&&bH(c.thinking).trim())g.push({kind:"think",text:bH(c.thinking).replace(/\s+/g," ").trim()});else if("tool_use"===c.type&&"SendMessage"===bH(c.name)){let a=bI(c.input),d=a.message;if("string"==typeof d){let{cleaned:e,cites:h}=m(d),i=bo.test(e)?bx(e,b):null,j={kind:"tmsg",ts:b,dir:"out",peer:String(a.to??""),summary:String(a.summary??""),text:i?"":e};for(let a of(g.push(j),i&&g.push(i),h))g.push(a);bH(c.id)&&f.set(bH(c.id),j)}else q(`SendMessage → ${String(a.to??"")} \xb7 ${bH(bI(d).type)||by("render.protocol")}`)}else if("tool_use"===c.type){let a=bI(c.input),d=String(a.command??a.file_path??a.prompt??JSON.stringify(a));o(b,bH(c.name)+": "+d.slice(0,160),bH(c.id),"tool")}return}if("system"===a.type&&"compact_boundary"===a.subtype){let c=bI(a.compactMetadata);return x(b,{trigger:bH(c.trigger)||void 0,preTokens:bA(c.preTokens)})}q(bH(a.type)||by("render.record"))},A=null,B=()=>{if(!A)return;let a=A.join("\n").trim();if(A=null,!a)return;let b=a=>{for(let b of a.split("\n"))b.trim()&&g.push({kind:"raw",text:bu(b),err:/error|failed|traceback|exception/i.test(b)})};l(null,a,b)||b(a)},C=a=>{let b=a.replace(/\x1b\][^\x07]*(\x07|\x1b\\)/g,"").replace(/\x1b\[[0-9;?]*[A-Za-z]/g,"");if(A)if(!/^\[codex\]/.test(b))return void A.push(b);else B();if(/Assistant message$/.test(b))return;let c=b.match(/^\[([^\]]+)\]\s*(.*)$/),d=c?.[1]??null,f=c?.[2]??b;if(!(!f||/^Assistant message captured/.test(f))){if(!c&&(bo.test(b)||b.startsWith("<oai-mem-citation>"))){A=[b];return}if(/^Running command: /.test(f))return o(d,f.replace(/^Running command: /,"").replace(/^\/usr\/bin\/zsh -lc /,""));if(/^Command (completed|failed)/.test(f)){let a=[...e.values()].at(-1);a&&bL(a,/^Command failed/.test(f)?f+"\n"+by("render.jobLogNote"):f,/^Command failed/.test(f));return}return/^Applying \d+ file/.test(f)?g.push({kind:"edit",files:f}):c&&!/^(Running|Command|Applying)/.test(f)?n(d,f):void(!j(b)&&g.push({kind:"raw",text:bu(b),err:/error|failed|traceback|exception/i.test(b)}))}};for(let c of b)if(!d||c.toLowerCase().includes(d))if("claude"===a.fmt||"codex"===a.fmt)try{let b=JSON.parse(c);b&&"object"==typeof b&&!Array.isArray(b)&&("claude"===a.fmt?z(b):y(b))}catch{C(c)}else C(c);return B(),{items:function(a,b){let c=[],d=0;for(;d<a.length;){if("cmd"!==a[d].kind){c.push(a[d]),d+=1;continue}let f=d,g=[];for(;f<a.length;){let b=a[f];if("cmd"===b.kind)g.push(b);else if("think"!==b.kind)break;f+=1}let h=f===a.length;if(g.length>=4&&!(b&&h)){let a={},b=0,h=0;for(let c of g){var e;let d=(e=c.call.cmd,e.match(/^([A-Za-z][\w.]*): /)?.[1]??"cmd");a[d]=(a[d]??0)+1,"ok"===c.call.status?b+=1:"err"===c.call.status&&(h+=1)}c.push({kind:"cmd-group",ids:g.map(a=>a.id),calls:g.map(a=>a.call),t0:g[0]?.ts,t1:g.at(-1)?.ts,byTool:a,okCount:b,errCount:h,hasErr:h>0}),d=f}else c.push(a[d]),d+=1}return c}(g,"live"===a.activity),hiddenServiceCount:h}}(a,q.lines,f,g.toLowerCase()):{items:[],hiddenServiceCount:0},[a?.path,a?.engine,a?.fmt,a?.activity,q.lines,f,g,m]),L=Math.max(0,K.items.length-w),M=L?K.items.slice(-w):K.items,N=()=>{let a=r.current;a&&(u.current={top:a.scrollTop,height:a.scrollHeight}),L?x(a=>a+v):q.hasMore&&q.loadOlder().then(()=>x(a=>a+v))},O=L>0||q.hasMore,P=K.items.at(-1),Q=P?.kind==="cmd"&&"run"===P.call.status?{icon:aW,label:n("feed.running",{tool:P.call.cmd.split(/[\s:]/,1)[0]||n("feed.tool")})}:P?.kind==="think"?{icon:aS,label:n("feed.thinking")}:{icon:aS,label:n("feed.working")},R=l?"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?o?"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 ${B?"scale-125":"scale-100"}`,children:[(0,d.jsx)(bn,{className:"h-3 w-3","aria-hidden":!0})," ",n("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":n("feed.backToLive"),onClick:()=>{J(),I(!0,!0)},children:[(0,d.jsx)(aC,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",y?n("feed.newCount",{count:y}):n("feed.down")]}):null,(0,d.jsx)("div",{ref:r,className:l?"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()-H.current<300;d&&!F.current?I(!0,!0):!d&&F.current&&(e?J():I(!1)),a&&!e&&cj(a.path,F.current,Math.max(0,c.scrollHeight-c.clientHeight-c.scrollTop)),c.scrollTop<120&&O&&!q.loadingOlder&&!q.loading&&N()},children:(0,d.jsx)("div",{ref:s,className:l?"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:[l&&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:q.loadingOlder,onClick:N,children:q.loadingOlder?n("common.loading"):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(aJ,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",n("feed.showEarlier")]})}):null,!l&&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:q.loadingOlder,onClick:N,children:q.loadingOlder?n("common.loading"):L?n("feed.showEarlierHidden",{count:L}):n("feed.loadEarlier")}):null,l||O||!K.items.length?null:(0,d.jsx)("div",{className:"mb-3 text-center text-[11px] text-dim",children:n("feed.startOfConvo")}),l?null:(0,d.jsx)(ch,{file:a,files:b,onSelect:c}),K.items.length?(0,d.jsxs)(d.Fragment,{children:[M.map((a,b)=>{let c=b+K.items.length-M.length;return l?(0,d.jsx)("div",{className:"feed-cv",children:(0,d.jsx)(cb,{item:a})},c):(0,d.jsx)(cb,{item:a},c)}),a.pendingQuestion||a.waitingInput?(0,d.jsx)(ce,{file:a},a.pendingQuestion?.toolUseId??"waiting"):null,a.pendingQuestion||a.waitingInput||!D?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:D}),"live"===a.activity?(0,d.jsx)(ck,{icon:Q.icon,label:Q.label}):null,"recent"===a.activity&&al(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})," ",n("feed.finishedTurn")]}):"recent"===a.activity&&z(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)(az,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",n("feed.returnedResult")]}):null]}):(0,d.jsxs)("div",{className:"mt-[14vh] text-center text-dim",children:[q.loading?n("common.loadingCap"):0===q.size?n("feed.noOutput"):K.hiddenServiceCount?n("feed.onlyService",{count:K.hiddenServiceCount}):n("feed.empty"),!q.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)(ce,{file:a},a.pendingQuestion?.toolUseId??"waiting"):null]}):(0,d.jsx)("div",{className:"mt-[20vh] text-center text-dim",children:n("feed.pickLog")})})})]})}let cm=()=>"uk"===p()?"uk-UA":"en-US",cn={completed:"✓",in_progress:"▸",pending:"○"};function co({plan:a}){let b,{t:c}=t(),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=>`${cn[a.status]} ${a.text}`),[s(p(),"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 cp={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 cq({ctx:a}){var b;let{t:c}=t();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(cm()),window:a.windowTokens.toLocaleString(cm())}),"aria-label":c("plan.ctxAria",{pct:a.pct}),children:["ctx ",a.pct,"%"]})}function cr({goal:a}){let b,c,{t:e}=t(),f=cp[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=p(),c=[a.objective??s(b,"plan.noObjective")],null!==a.tokensUsed&&c.push(s(b,"plan.tokens",{n:a.tokensUsed.toLocaleString(cm())})),null!==a.timeUsedSeconds&&c.push(s(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 cs=()=>void 0,ct={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 cu(a,b){return"сесія"===b?a("kind.session"):"субагент"===b?a("kind.subagent"):"джоба"===b?a("kind.job"):"фон"===b?a("kind.background"):b}function cv({file:a}){let{t:b}=t(),[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:W(a.mtime)}),children:W(a.mtime)})}function cw({file:a,files:b,tasks:c,onSelect:f,isRoot:g,onClose:h,dragHandle:i,noComposer:j,banner:k}){let{t:m}=t(),n=(0,e.useRef)(null),o=ai(a),p=ap(a),q=ct[p];return(0,d.jsx)("div",{className:`relative flex min-h-0 min-w-0 flex-1 ${q.glow?"pane-attention":""}`,style:q.glow?{"--pane-glow":q.glow}:void 0,children:(0,d.jsxs)("section",{ref:n,"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 ${g?"border-t-4":"border-t-2"} ${q.section}`,style:"done"===p?{borderTopColor:"#c9c9d1"}:ah(a),children:[(0,d.jsxs)("header",{className:`flex h-10 shrink-0 items-center gap-1.5 border-b border-line px-2.5 ${q.header} ${i?"cursor-grab active:cursor-grabbing":""}`,...i,children:[(0,d.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${Y(a.activity)}`,title:m(`branch.${p}`)}),(0,d.jsx)(cv,{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:ae(a).soft,color:ae(a).color},title:[o.label,af(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:o.style,children:o.label}),a.ctx?(0,d.jsx)(cq,{ctx:a.ctx}):null,a.worktree?(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)(ay,{className:"h-2.5 w-2.5","aria-hidden":!0})," ",a.worktree]}):null,a.plan?(0,d.jsx)(co,{plan:a.plan}):null,a.goal?(0,d.jsx)(cr,{goal:a.goal}):null,g?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)(az,{className:"h-3 w-3","aria-hidden":!0})," ",a.handoff?m("kind.handoff"):cu(m,a.kind)]}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12px] font-semibold",title:u(a.title),children:u(a.title,90)}),(0,d.jsx)(cg,{file:a,compact:!0}),(0,d.jsx)(bl,{file:a,onDeleted:h}),h?(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:u(a.title,60)}),onClick:h,children:(0,d.jsx)(l,{className:"h-3 w-3","aria-hidden":!0})}):null]}),k??null,c.length?(0,d.jsx)(bm,{className:"shrink-0 border-b border-line bg-[#fbfbfd]",enter:"fade",children:c.map(a=>(0,d.jsx)("div",{"data-flip-key":a.path,children:(0,d.jsx)(cx,{file:a,files:b,onSelect:f})},a.path))}):null,(0,d.jsx)(cl,{file:a,files:b,onSelect:f,showSvc:!1,lineFilter:"",onStatus:cs,paused:!1,follow:!0,setFollow:cs,compact:!0}),j?null:(0,d.jsx)(bf,{file:a})]})})}function cx({file:a,files:b,onSelect:c}){let{t:f}=t(),[g,h]=(0,e.useState)(!1),i=u(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 h-7 items-center gap-1.5 pl-2 pr-2.5",children:[(0,d.jsxs)("button",{className:"flex h-full 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":g,"aria-label":f("branch.toggleBackground",{action:f(g?"branch.collapse":"branch.expand"),title:i}),onClick:()=>h(a=>!a),children:[(0,d.jsx)(aI,{className:`h-3.5 w-3.5 shrink-0 text-dim transition-transform ${g?"rotate-90":""}`,"aria-hidden":!0}),(0,d.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${Y(a.activity)}`}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-semibold",title:u(a.title),children:i})]}),(0,d.jsx)(cg,{file:a,compact:!0})]}),g?(0,d.jsx)("div",{className:"flex h-[220px] flex-col border-t border-dashed border-line bg-bg/60",children:(0,d.jsx)(cl,{file:a,files:b,onSelect:c,showSvc:!1,lineFilter:"",onStatus:cs,paused:!1,follow:!0,setFollow:cs,compact:!0})}):null]})}let cy=[{key:"claude",label:"Claude"},{key:"codex",label:"Codex"}],cz=(a,b)=>`llvDraftPane:${a}:${b}`;function cA(a,b,c){c?sessionStorage.setItem(cz(a,b),c):sessionStorage.removeItem(cz(a,b))}function cB({draftId:a,project:b,files:c,onClose:f,onSpawned:g}){let{t:h}=t(),[i]=(0,e.useState)(()=>""),j=i?c.find(a=>a.path===i)??null:null,[k,m]=(0,e.useState)(()=>j?.engine==="codex"?"codex":"claude"),[n,o]=(0,e.useState)(()=>""),[p,q]=(0,e.useState)([]),[r,s]=(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}})()),[v,w]=(0,e.useState)(!1),x=(0,e.useRef)(null),y=bb({initialText:()=>i?h("draft.readPrompt",{src:i}):"",persistText:b=>cA(a,"text",b),submit:a=>G(a),disabled:!!r}),{text:z,setText:A,setStatus:B,busy:C,setBusy:D,voiceSending:E,attachments:F}=y,G=async b=>{let d=b??z;if(!C&&!E&&!r){if(!n.trim())return void B({kind:"err",text:h("draft.needDir")});if(d.trim()||F.images.length){D(!0),B(null);try{var e;let b=await fetch("/api/spawn",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({engine:k,cwd:n.trim(),prompt:d,images:F.images.map(a=>({base64:a.base64,mime:a.mime})),...i?{src:i}:{}})}),f=await b.json();if(!b.ok||!f.ok)return void B({kind:"err",text:f.error??h("draft.launchFailed")});x.current=new Set(c.map(a=>a.path)),e={at:Date.now(),target:f.target??"",path:f.path??null,prompt:d.trim()},s(e),cA(a,"boot",e?JSON.stringify(e):""),A(""),F.clear()}catch{B({kind:"err",text:h("common.serverUnavailable")})}finally{D(!1)}}}},H=Z[k]??$,I=y.fieldsDisabled,J="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-t-4 border-line bg-panel shadow-card",style:{borderTopColor:H.color},"aria-label":h("draft.paneAria"),children:[(0,d.jsxs)("header",{className:"flex h-10 shrink-0 items-center gap-1.5 border-b border-line px-2.5",style:{backgroundColor:H.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:cy.map(({key:b,label:c})=>{let e=k===b,f=Z[b]??$;return(0,d.jsx)("button",{type:"button",role:"radio","aria-checked":e,disabled:I,onClick:()=>{m(b),cA(a,"engine",b)},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?u(j.title):void 0,children:i?h("draft.handoffLabel",{title:j?u(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)(l,{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:n,disabled:I,onChange:b=>{var c;o(c=b.target.value),cA(a,"cwd",c)},list:J,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:J,children:p.map(a=>(0,d.jsx)("option",{value:a},a))})]}),(0,d.jsx)("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto px-4 py-4",children:r?(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:r.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)(a1,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}),(0,d.jsx)("span",{children:h("draft.launched",{target:r.target})})]}),v?(0,d.jsx)("div",{className:"text-[11px] text-dim",children:h("draft.slow",{target:r.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:H.soft,color:H.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(),G()},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)(bd,{composer:y,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:H.color,borderColor:H.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)(aR,{className:"h-3 w-3 shrink-0","aria-hidden":!0})," ",h("draft.newAgent")]})})})]})}let cC=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"}]]),cD=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"}]]),cE=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 cF({verdict:a,error:b,className:c="h-3 w-3"}){return"APPROVE"===a?(0,d.jsx)(aH,{className:c,strokeWidth:3,"aria-hidden":!0}):"REQUEST_CHANGES"===a?(0,d.jsx)(l,{className:c,strokeWidth:3,"aria-hidden":!0}):"COMMENT"===a?(0,d.jsx)(cC,{className:c,strokeWidth:2.5,"aria-hidden":!0}):b?(0,d.jsx)(cD,{className:c,"aria-hidden":!0}):(0,d.jsx)(cE,{className:c,"aria-hidden":!0})}function cG(a,b){return b.error?a("roundDeck.roundAborted",{n:b.n}):b.verdict?a("roundDeck.roundVerdict",{n:b.n,verdict:`${T[b.verdict]} ${b.verdict}`}):a("roundDeck.roundInProgress",{n:b.n})}function cH({round:a,depth:b,pulse:c,onPull:e}){let{t:f}=t(),g=U(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?`${cG(f,a)}: ${a.error}`:cG(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)(cF,{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 cI({flow:a,rounds:b,files:c,onSelect:f,focusRound:g}){let{t:h}=t(),i=b.length?b[b.length-1]:null,[j,k]=(0,e.useState)(null),[l,m]=(0,e.useState)(null);null!=g&&g!==l&&(m(g),k(Math.round(g)));let[n,o]=(0,e.useState)(null);i&&i.round.n!==n&&(o(i.round.n),null!=j&&i.round.n>j&&null===i.round.verdict&&k(null));let p=(0,e.useMemo)(()=>b.find(a=>a.round.n===j)??i,[b,j,i]);if(!p)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:h("roundDeck.waitingFirst")})});let q=b.filter(a=>a.round.n!==p.round.n).reverse(),r=q.slice(0,5),s=q.length-r.length,u=U(p.round.verdict),v=null!==p.round.verdict||!!p.round.error,w=i&&p.round.n!==i.round.n&&null===i.round.verdict&&!i.round.error?i:null;return(0,d.jsxs)("div",{className:"deck-3d relative h-full",style:{paddingBottom:30*Math.min(q.length,5+ +!!s)},children:[(0,d.jsx)("div",{className:"scheme-enter relative z-[11] flex h-full flex-col",children:p.file?(0,d.jsx)(cw,{file:p.file,files:c,tasks:[],onSelect:f,isRoot:!1,noComposer:"headless"===a.reviewerMode||v,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:u.soft,color:u.color},children:[cG(h,p.round),null!=p.round.findingsCount&&p.round.findingsCount>0?(0,d.jsxs)("span",{className:"font-semibold opacity-80",children:["\xb7 ",h("roundDeck.findings",{count:p.round.findingsCount})]}):null,p.round.readyNote?(0,d.jsxs)("span",{className:"min-w-0 flex-1 truncate font-semibold opacity-70",title:p.round.readyNote,children:["\xb7 ",p.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:cG(h,p.round)}),(0,d.jsx)("span",{className:"text-[11px] text-dim",children:p.round.error?p.round.error:h("roundDeck.spawningReviewer")})]})},p.round.n),r.map((a,b)=>(0,d.jsx)(cH,{round:a.round,depth:b,pulse:w?.round.n===a.round.n,onPull:()=>k(a.round.n)},a.round.n)),s>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*r.length)-8,zIndex:10-r.length},"aria-hidden":!0,children:h("roundDeck.moreRounds",{count:s})}):null]})}let cJ=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 cK(a){return("claude-projects"===a.root||"codex-sessions"===a.root)&&a.path.endsWith(".jsonl")}function cL({file:a,onHandoff:b}){let{t:c}=t(),f=function(a){let{t:b}=t(),[c,f]=(0,e.useState)(!1),[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:c=>{if("mouse"===c.pointerType&&0!==c.button||k.current)return;let d=c.currentTarget.getBoundingClientRect(),e=b=>{let c=k.current;if(!c)return;if(c.lastX=b.clientX,c.lastY=b.clientY,!c.active){if(7>Math.hypot(b.clientX-c.startX,b.clientY-c.startY))return;c.active=!0,l.current=!0,m.current=!0,document.body.style.cursor="crosshair",bi(),j(null),h({x:c.anchorX,y:c.anchorY}),f(!0)}n.current?.setAttribute("d",bj(c.anchorX,c.anchorY,b.clientX,b.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=bh.get(e);return f&&f.el===d?f:null}(b.clientX,b.clientY,a.path);d?.el!==c.hover?.el&&(c.hover?.el.removeAttribute("data-link-hover"),d?.el.setAttribute("data-link-hover","1"),c.hover=d)},g=c=>{var d,e;let g,h,i=k.current;k.current=null,i?.detach(),l.current=!1,document.body.style.cursor="",i?.active&&(f(!1),i.hover?(d=i.hover.file.path,e=b("link.handoffContext",{title:u(a.title,80),path:a.path,ask:""}).trimEnd()+"\n\n",g="llvDraft:"+d,h=sessionStorage.getItem(g)??"",sessionStorage.setItem(g,h.trim()?h.replace(/\s*$/,"")+"\n\n"+e:e),window.dispatchEvent(new CustomEvent("llv-compose-draft",{detail:{path:d}})),j({file:i.hover.file,from:{x:i.anchorX,y:i.anchorY},to:{x:c.clientX,y:c.clientY}})):bi())};k.current={startX:c.clientX,startY:c.clientY,anchorX:d.right,anchorY:d.top+d.height/2,lastX:c.clientX,lastY:c.clientY,active:!1,hover:null,detach:()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",g),window.removeEventListener("pointercancel",g)}},window.addEventListener("pointermove",e),window.addEventListener("pointerup",g),window.addEventListener("pointercancel",g)},consumeClick:()=>{let a=m.current;return m.current=!1,a},draggingRef:l,overlay:c||i?(0,a5.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:bg})})}),(0,d.jsx)("path",{ref:a=>{n.current=a;let b=k.current;a&&b?.active&&a.setAttribute("d",bj(b.anchorX,b.anchorY,b.lastX,b.lastY))},d:i?bj(i.from.x,i.from.y,i.to.x,i.to.y):void 0,fill:"none",stroke:bg,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:bg})]}),i?(0,d.jsx)(bk,{drop:i}):null]}),document.body):null}}(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:f.onPillPointerDown,onClick:()=>{f.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)(cJ,{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)(aC,{className:"hidden h-3.5 w-3.5 shrink-0 group-hover:block group-focus-within:block","aria-hidden":!0})]}),f.overlay]})}function cM(a,b,c,d=[],e=[]){let f=new Map(c.map(a=>[a.path,a])),g=E(c),h=[],i=[],j=[],k=[],l=[],m=N(d),n=O(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:ag(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(A(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=E(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)=>x(a)-x(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=>A(a)),e=b.filter(a=>!A(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])]),width:Math.max(o-150+100,800),height:u+100+140}}let cN=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"}]]),cO=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"}]]),cP=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"}]]);function cQ({layout:a,cam:b,vp:c,onJump:f}){let{t:g}=t(),h=(0,e.useRef)(null),i=(0,e.useRef)(!1),j=Math.min(216/a.width,148/a.height),k=(216-a.width*j)/2,l=(148-a.height*j)/2,m=a=>{let b=h.current?.getBoundingClientRect();b&&f((a.clientX-b.left-k)/j,(a.clientY-b.top-l)/j)};return(0,d.jsx)("div",{ref:h,"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:g("minimap.title"),onPointerDown:a=>{a.stopPropagation(),i.current=!0,m(a);try{a.currentTarget.setPointerCapture(a.pointerId)}catch{}},onPointerMove:a=>{i.current&&m(a)},onPointerUp:a=>{i.current=!1;try{a.currentTarget.releasePointerCapture(a.pointerId)}catch{}},onPointerCancel:()=>{i.current=!1},children:(0,d.jsx)("svg",{width:216,height:148,"aria-hidden":!0,children:(0,d.jsxs)("g",{transform:`translate(${k} ${l}) scale(${j})`,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:ag(a.file),opacity:"live"===a.file.activity?.85:.35},a.file.path)),(0,d.jsx)("rect",{x:-b.x/b.z,y:-b.y/b.z,width:c.w/b.z,height:c.h/b.z,fill:"rgba(90,81,224,0.08)",stroke:"#5a51e0",strokeWidth:2.5/j})]})})})}let cR=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"}]]),cS=["low","medium","high","xhigh"],cT={implementer:{engine:"claude",model:null,effort:null},reviewer:{engine:"codex",model:null,effort:"xhigh"}};function cU({label:a,role:b,onChange:c}){let{t:e}=t();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})}),"codex"===b.engine?(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")}),cS.map(a=>(0,d.jsx)("option",{value:a,children:a},a))]}):null]})}function cV({file:a,onClose:b}){let{t:c}=t(),[f,g]=(0,e.useState)([]),[h,i]=(0,e.useState)(null),[j,k]=(0,e.useState)(cT),[l,m]=(0,e.useState)(!1),[n,o]=(0,e.useState)("head"),[p,q]=(0,e.useState)("auto"),[r,s]=(0,e.useState)("headless"),[u,v]=(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:u})});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)(cU,{label:c("flowDialog.implementer"),role:j.implementer,onChange:a=>k(b=>({...b,implementer:a}))}),(0,d.jsx)(cU,{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:u,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=>v(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 cW=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"}]]),cX=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"}]]),cY={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"}},cZ=new Set(["spawning","reviewing","relaying","fixing"]),c$=[1,2,3,4,5,0];function c_({flow:a,onFocusRound:b}){let{t:c}=t(),[f,g]=(0,e.useState)(!1),[h,i]=(0,e.useState)(null),[j,k]=(0,e.useState)(""),m=async(b,c)=>{if(f)return;g(!0),i(null);let d=await V(a.id,{action:b,...c});d?i(d):c?.note!==void 0&&k(""),g(!1)},n=cY[a.state],o=Q.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]":cZ.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:P(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=U(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)(cF,{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)(cW,{className:"h-3.5 w-3.5 shrink-0 animate-spin text-dim","aria-hidden":!0}):null,q?(0,d.jsx)(a6,{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&&n&&m(n.action,{note:j})}})}):null,"reviewing"===a.state?(0,d.jsx)(a6,{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 m("cancel-round"),children:[(0,d.jsx)(aT,{className:"h-3 w-3","aria-hidden":!0})," ",c("flowStrip.stopReviewer")]})}):null,n?(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 m(n.action,q?{note:j}:void 0),children:c(n.labelKey)}):null,p?null:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(a6,{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:[c$.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 m("set-round-limit",{rounds:b}),children:0===b?(0,d.jsx)(cX,{className:"h-3 w-3","aria-hidden":!0}):b},b)}),c$.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)(a6,{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 m("set-mode",{mode:"auto"===a.mode?"manual":"auto"}),children:"auto"===a.mode?c("flowDialog.auto"):c("flowStrip.manualShort")})}),"paused"===a.state?(0,d.jsx)(a6,{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 m("resume"),children:(0,d.jsx)(aR,{className:"h-3.5 w-3.5","aria-hidden":!0})})}):(0,d.jsx)(a6,{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 m("pause"),children:(0,d.jsx)(cc,{className:"h-3.5 w-3.5","aria-hidden":!0})})})]}),(0,d.jsx)(a6,{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 m("close"),children:(0,d.jsx)(l,{className:"h-3.5 w-3.5","aria-hidden":!0})})})]})]})}function c0({role:a,active:b}){let{t:c}=t();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 c1="cubic-bezier(.22,.8,.36,1)",c2=`transform 380ms ${c1}`,c3=(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 ${c1}`},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 ${c1}, cy 380ms ${c1}`}}),(0,d.jsx)("path",{d:e,style:{d:`path("${e}")`,transition:`d 380ms ${c1}`},fill:a.color})]},a.to)})})}),c4=(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":R.has(c.state)?"#5a51e0":Q.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 ${c1}`}}),p=a=>({d:`path("${a}")`,transition:`d 380ms ${c1}`});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 ${c1}, cy 380ms ${c1}`}}),(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 ${c1}, y 380ms ${c1}`},children:"⟳"})]},a.key)})}):null});function c5({file:a,onSelect:b}){let c=ai(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:u(a.title),onClick:()=>b(a),children:[(0,d.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${Y(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:u(a.cmdDesc||a.title,80)}),(0,d.jsx)("span",{className:"shrink-0 text-[10.5px] text-dim",children:W(a.mtime)})]})}function c6({file:a}){let b=ai(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 ${Y(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:u(a.title,70)})]})})}let c7=()=>void 0;function c8({node:a,ringed:b,flow:c}){let{t:e}=t(),f=ai(a.file);return(0,d.jsxs)("div",{"data-scheme-node":a.file.path,className:"scheme-enter absolute",style:{transform:`translate(${a.x}px, ${a.y}px)`,width:a.w,height:a.h,transition:c2},children:[c?(0,d.jsx)("div",{className:"absolute -top-[60px] left-0 z-[4]",style:{width:1370},children:(0,d.jsx)(c_,{flow:c,onFocusRound:c7})}):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-t-4 bg-panel shadow-card ${b?"ring-2 ring-accent/60 ring-offset-2 ring-offset-bg":""}`,style:ah(a.file),children:[(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 ${Y(a.file.activity)}`}),(0,d.jsx)("span",{className:"shrink-0 rounded-full px-2 py-0.5 text-[11px] font-bold",style:f.style,children:f.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:W(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:u(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," ",e("scheme.underneath")]}):null]}),c?(0,d.jsx)(c0,{role:"implementer",active:"implementer"===S(c)}):null,(0,d.jsx)(c6,{file:a.file})]})}function c9({draft:a,ringed:b}){let{t:c}=t();return(0,d.jsx)("div",{"data-scheme-node":a.key,className:"scheme-enter absolute",style:{transform:`translate(${a.x}px, ${a.y}px)`,width:a.w,height:a.h,transition:c2},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:"+"})," ",c("mobile.agent")]})})})}function da({deck:a}){let{t:b}=t(),c=a.rounds.at(-1)??null,e=c?.round??null,f=U(e?.verdict??null);return(0,d.jsxs)("div",{"data-scheme-node":a.key,className:"scheme-enter absolute",style:{transform:`translate(${a.x}px, ${a.y}px)`,width:a.w,height:a.h,transition:c2},children:[(0,d.jsx)("div",{className:"flex h-full flex-col overflow-hidden rounded-[10px] border border-line bg-panel shadow-card",children:e?(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:f.soft,color:f.color},children:[(0,d.jsxs)("span",{className:"flex shrink-0 items-center gap-1 text-[12px] font-bold",children:["R",e.n," ",(0,d.jsx)(cF,{verdict:e.verdict,error:!!e.error,className:"h-3.5 w-3.5"})]}),(0,d.jsx)("span",{className:"min-w-0 truncate text-[11px] font-semibold",children:e.error?b("roundDeck.aborted"):e.verdict??b("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:c?.file?u(c.file.title,140):b("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:b("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:b("roundDeck.waitingFirst")})}),(0,d.jsx)(c0,{role:"reviewer",active:"reviewer"===S(a.flow)})]})}function db({stack:a,onSelect:b}){let{t:c}=t();return(0,d.jsx)("div",{"data-scheme-node":a.key,className:"scheme-enter absolute",style:{transform:`translate(${a.x}px, ${a.y}px)`,width:a.w,height:a.h,transition:c2},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:e})=>{let f=ai(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:u(a.title),onClick:()=>b(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 ${Y(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:u(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:cu(c,a.kind)}),(0,d.jsx)("span",{children:W(a.mtime)}),e?(0,d.jsxs)("span",{children:["⤷ ",e]}):null]})]},a.path)})})})}function dc({node:a,files:b,ringed:c,flow:f,canFlow:g,onSelect:h,onClose:i,onFocusRound:j,onHandoff:k}){let{t:l}=t(),[m,n]=(0,e.useState)(!1),[o,p]=(0,e.useState)(!1);return(0,d.jsxs)("div",{"data-scheme-node":a.file.path,className:`scheme-enter absolute ${m||o?"z-20":""}`,style:{transform:`translate(${a.x}px, ${a.y}px)`,width:a.w,height:a.h,transition:c2},children:[f?(0,d.jsx)("div",{className:"absolute -top-[60px] left-0 z-[4]",style:{width:1370},children:(0,d.jsx)(c_,{flow:f,onFocusRound:a=>j(f.id,a)})}):g?(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":o,title:l("scheme.flowTitle"),onClick:()=>p(a=>!a),children:[(0,d.jsx)("span",{className:"text-[13px] leading-none text-accent",children:"⟳"})," ",l("scheme.flow")]})}):null,o?(0,d.jsx)("div",{className:"absolute left-0 top-[-8px] z-40 -translate-y-full",children:(0,d.jsx)(cV,{file:a.file,onClose:()=>p(!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 ${c?"rounded-[10px] ring-2 ring-accent/60 ring-offset-2 ring-offset-bg":""}`,children:(0,d.jsx)(cw,{file:a.file,tasks:a.tasks,files:b,onSelect:h,isRoot:a.isRoot,onClose:()=>i(a.file.path)})}),f?(0,d.jsx)(c0,{role:"implementer",active:"implementer"===S(f)}):null,(0,d.jsx)(c6,{file:a.file}),k&&cK(a.file)?(0,d.jsx)(cL,{file:a.file,onHandoff:()=>k(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":m,title:l("scheme.collapsedTitle"),onClick:()=>n(a=>!a),children:[(0,d.jsx)(cR,{className:"h-3.5 w-3.5","aria-hidden":!0}),a.under.length," ",l("scheme.underneath"),(0,d.jsx)(aI,{className:`h-3 w-3 transition-transform ${m?"rotate-90":""}`,"aria-hidden":!0})]}):null,m?(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)(c5,{file:a,onSelect:h},a.path))}):null]})}function dd({draft:a,project:b,files:c,ringed:e,onDraftClose:f,onDraftSpawned:g}){return(0,d.jsx)("div",{"data-scheme-node":a.key,className:"scheme-enter absolute",style:{transform:`translate(${a.x}px, ${a.y}px)`,width:a.w,height:a.h,transition:c2},children:(0,d.jsx)("div",{className:`flex h-full ${e?"rounded-[10px] ring-2 ring-accent/60 ring-offset-2 ring-offset-bg":""}`,children:(0,d.jsx)(cB,{draftId:a.id,project:b,files:c,onClose:()=>f(a.id),onSpawned:b=>g(a.id,b)})})})}function de({deck:a,files:b,focus:c,onSelect:e}){let f=c&&c.flowId===a.flow.id?c.round+c.nonce/1e3:null;return(0,d.jsxs)("div",{"data-scheme-node":a.key,className:"scheme-enter absolute",style:{transform:`translate(${a.x}px, ${a.y}px)`,width:a.w,height:a.h,transition:c2},children:[(0,d.jsx)(cI,{flow:a.flow,rounds:a.rounds,files:b,onSelect:e,focusRound:f}),(0,d.jsx)(c0,{role:"reviewer",active:"reviewer"===S(a.flow)})]})}let df=(0,e.memo)(function({layout:a,project:b,files:c,interactive:e,lite:f,selected:g,focus:h,flowsByImpl:i,deckFocus:j,onSelect:k,onClose:l,onFocusRound:m,onDraftClose:n,onDraftSpawned:o,onHandoff:p}){return(0,d.jsxs)("div",{className:e?void 0:"pointer-events-none select-none",children:[a.stacks.map(a=>(0,d.jsx)(db,{stack:a,onSelect:k},a.key)),a.decks.map(a=>f?(0,d.jsx)(da,{deck:a},a.key):(0,d.jsx)(de,{deck:a,files:c,focus:j,onSelect:k},a.key)),a.drafts.map(a=>f?(0,d.jsx)(c9,{draft:a,ringed:g===a.key||h===a.key},a.key):(0,d.jsx)(dd,{draft:a,project:b,files:c,ringed:g===a.key||h===a.key,onDraftClose:n,onDraftSpawned:o},a.key)),a.nodes.map(a=>{var b;return f?(0,d.jsx)(c8,{node:a,ringed:g===a.file.path||h===a.file.path,flow:i.get(a.file.path)??null},a.file.path):(0,d.jsx)(dc,{node:a,files:c,ringed:g===a.file.path||h===a.file.path,flow:i.get(a.file.path)??null,canFlow:(b=a.file,!i.has(b.path)&&("claude"===b.engine||"codex"===b.engine)&&y(b)),onSelect:k,onClose:l,onFocusRound:m,onHandoff:p},a.file.path)})]})}),dg=(a,b)=>Math.hypot(a.x-b.x,a.y-b.y);function dh({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 di({project:a,groups:b,manual:c,files:f,flows:g,drafts:h,focus:i,ring:j,onSelect:k,onNodePick:l,onClose:m,onDraftClose:n,onDraftSpawned:o,onHandoff:p}){let{t:q}=t(),r=!!l,[s,u]=(0,e.useState)(null),v=(0,e.useMemo)(()=>cM(b,c,f,g,h),[b,c,f,g,h]),w=(0,e.useMemo)(()=>N(g),[g]),[x,y]=(0,e.useState)(null),z=(0,e.useCallback)((a,b)=>{y(c=>({flowId:a,round:b,nonce:(c?.nonce??0)+1}))},[]),A=j??i,B=(0,e.useRef)(k),C=(0,e.useRef)(l),D=(0,e.useRef)(m),E=(0,e.useRef)(n),F=(0,e.useRef)(o),G=(0,e.useRef)(p),H=(0,e.useCallback)(a=>{let b=C.current;b?b(a.path):B.current(a)},[]),I=(0,e.useCallback)(a=>D.current(a),[]),J=(0,e.useCallback)(a=>E.current(a),[]),K=(0,e.useCallback)((a,b)=>F.current(a,b),[]),L=(0,e.useCallback)(a=>G.current?.(a),[]),{cam:M,vp:O,viewportRef:P,handLike:Q,panning:R,glide:S,setMode:T,onPointerDown:U,onPointerMove:V,onDoubleClick:W,onClick:X,zoomCenter:Y,zoomTo:Z,fit:$,jump:_}=function({project:a,layout:b,mapMode:c,focus:d,onNodePick:f,setSelected:g}){let h=(0,e.useRef)(null),i=(0,e.useRef)(null),[j,k]=(0,e.useState)({x:0,y:0,z:.5}),[l,m]=(0,e.useState)("select"),[n,o]=(0,e.useState)(!1),[p,q]=(0,e.useState)(!1),[r,s]=(0,e.useState)(!1),[t,u]=(0,e.useState)({w:1,h:1}),v=(0,e.useRef)(null),w=(0,e.useRef)(new Map),x=(0,e.useRef)(null);(0,e.useRef)(l),(0,e.useRef)(n);let y=(0,e.useRef)(null);(0,e.useRef)(null);let z=(0,e.useCallback)(a=>{m(a),localStorage.setItem("llvSchemeMode",a)},[]),A=(0,e.useCallback)(a=>{let c=Math.min(Math.max(a.x,120-b.width*a.z),t.w-120),d=Math.min(Math.max(a.y,120-b.height*a.z),t.h-120);return c===a.x&&d===a.y?a:{...a,x:c,y:d}},[b.width,b.height,t]),B=(0,e.useRef)([]),C=(0,e.useRef)(null),D=(0,e.useCallback)(a=>{B.current.push(a),null==C.current&&(C.current=requestAnimationFrame(()=>{C.current=null;let a=B.current;B.current=[],k(b=>a.reduce((a,b)=>b(a),b))}))},[]),E=(0,e.useCallback)((a,b,c)=>{D(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 A({z:e,x:a-(a-d.x)*f,y:b-(b-d.y)*f})})},[A,D]),F=(0,e.useCallback)(a=>{let b=h.current?.getBoundingClientRect();b&&E(b.width/2,b.height/2,a)},[E]),G=(0,e.useCallback)(a=>{let b=h.current?.getBoundingClientRect();b&&k(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 A({z:d,x:f-(f-c.x)*e,y:g-(g-c.y)*e})})},[A]),H=(0,e.useCallback)(()=>{let a=h.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]),I=(0,e.useCallback)(a=>{s(!0),k(a),y.current&&window.clearTimeout(y.current),y.current=window.setTimeout(()=>s(!1),500)},[]),J=(0,e.useCallback)(()=>{let a=H();a&&I(a)},[H,I]),K=(0,e.useCallback)((a,b)=>{let c=h.current?.getBoundingClientRect();c&&I(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)}})},[I]);(0,e.useRef)(null);let L=a=>{let b=h.current?.getBoundingClientRect();return b?{x:a.clientX-b.left,y:a.clientY-b.top}:{x:a.clientX,y:a.clientY}},M=a=>{v.current={sx:a.clientX,sy:a.clientY,cx:j.x,cy:j.y},q(!0);try{h.current?.setPointerCapture(a.pointerId)}catch{}},N=c||"hand"===l||n,O=(0,e.useCallback)((a,b)=>k(c=>A({...c,x:t.w/2-a*c.z,y:t.h/2-b*c.z})),[t,A]);return{cam:j,vp:t,viewportRef:h,mode:l,setMode:z,handLike:N,panning:p,glide:r,onPointerDown:a=>{let b=a.target;if(!b.closest("[data-scheme-ui]")){if(c&&a.isPrimary&&(i.current={x:a.clientX,y:a.clientY}),"touch"===a.pointerType&&(w.current.set(a.pointerId,L(a)),2===w.current.size)){let[a,b]=[...w.current.values()];x.current={d:dg(a,b),cx:(a.x+b.x)/2,cy:(a.y+b.y)/2},v.current=null,q(!1);return}if(1===a.button){a.preventDefault(),M(a);return}if(0===a.button){if(!(c||"hand"===l||n)){let a=b.closest("[data-scheme-node]");if(a)return void g(a.getAttribute("data-scheme-node"));if(g(null),b.closest("button, a, input, textarea, select"))return}M(a)}}},onPointerMove:a=>{if("touch"===a.pointerType&&w.current.has(a.pointerId)){w.current.set(a.pointerId,L(a));let b=x.current;if(b&&w.current.size>=2){let[a,c]=[...w.current.values()],d=dg(a,c),e=(a.x+c.x)/2,f=(a.y+c.y)/2,g=b.d>0?d/b.d:1;D(a=>{let c=Math.min(1.6,Math.max(.12,a.z*g)),d=c/a.z;return A({z:c,x:e-(b.cx-a.x)*d,y:f-(b.cy-a.y)*d})}),x.current={d,cx:e,cy:f};return}}let b=v.current;if(!b)return;let c=a.clientX-b.sx,d=a.clientY-b.sy;D(a=>A({...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 J();if("hand"!==l&&!n)return;let e=b.byPath.get(d.getAttribute("data-scheme-node")??"");e&&K(e,.9)},onClick:a=>{if(!f)return;let c=i.current;if(i.current=null,!c||Math.hypot(a.clientX-c.x,a.clientY-c.y)>9||a.target.closest("[data-scheme-ui]"))return;let d=h.current?.getBoundingClientRect();if(!d)return;let e=((a,c)=>{let d=b=>a>=b.x&&a<=b.x+b.w&&c>=b.y&&c<=b.y+b.h;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})((a.clientX-d.left-j.x)/j.z,(a.clientY-d.top-j.y)/j.z);e&&f(e)},zoomCenter:F,zoomTo:G,fit:J,jump:O}}({project:a,layout:v,mapMode:r,focus:i,onNodePick:l,setSelected:u}),aa=24*M.z;return(0,d.jsxs)("div",{ref:P,className:`relative min-h-0 flex-1 overflow-hidden ${R?"cursor-grabbing select-none":Q?"cursor-grab":""} ${Q?"touch-none":""}`,onPointerDown:U,onPointerMove:V,onDoubleClick:W,onClick:X,children:[(0,d.jsx)("div",{"aria-hidden":!0,className:"pointer-events-none absolute",style:{inset:-aa,backgroundImage:"radial-gradient(rgba(28,28,34,0.09) 1px, transparent 1px)",backgroundSize:`${aa}px ${aa}px`,transform:`translate(${(M.x%aa+aa)%aa}px, ${(M.y%aa+aa)%aa}px)`,willChange:"transform"}}),(0,d.jsxs)("div",{className:`absolute left-0 top-0 ${R?"scheme-panning":""}`,style:{width:v.width,height:v.height,transform:`translate(${M.x}px, ${M.y}px) scale(${M.z})`,transformOrigin:"0 0",transition:S?`transform .45s ${c1}`:void 0,willChange:"transform","--inv-z":String(1/M.z),"--label-o":M.z<.45?"1":"0"},children:[(0,d.jsx)(c3,{edges:v.edges,width:v.width,height:v.height}),(0,d.jsx)(c4,{loops:v.loops,width:v.width,height:v.height}),(0,d.jsx)(df,{layout:v,project:a,files:f,interactive:!Q,lite:r,selected:s,focus:A,flowsByImpl:w,deckFocus:x,onSelect:H,onClose:I,onFocusRound:z,onDraftClose:J,onDraftSpawned:K,onHandoff:p?L:void 0})]},a),(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:[r?null:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(dh,{active:Q,title:q("scheme.handTool"),onClick:()=>T("hand"),children:(0,d.jsx)(cN,{className:"h-4 w-4","aria-hidden":!0})}),(0,d.jsx)(dh,{active:!Q,title:q("scheme.selectTool"),onClick:()=>T("select"),children:(0,d.jsx)(cO,{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)(dh,{title:q("scheme.zoomOut"),onClick:()=>Y(.8),children:(0,d.jsx)(bM,{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:q("scheme.zoom100"),onClick:()=>Z(1),children:[Math.round(100*M.z),"%"]}),(0,d.jsx)(dh,{title:q("scheme.zoomIn"),onClick:()=>Y(1.25),children:(0,d.jsx)(bN,{className:"h-4 w-4","aria-hidden":!0})}),(0,d.jsx)(dh,{title:q("scheme.fit"),onClick:$,children:(0,d.jsx)(cP,{className:"h-4 w-4","aria-hidden":!0})})]}),(0,d.jsx)(cQ,{layout:v,cam:M,vp:O,onJump:_})]})}let dj={waiting:5,stalled:4,live:3,returned:2,done:1};function dk({project:a,groups:b,manual:c,files:f,flows:g,drafts:h,focus:i,onSelect:j,onClose:k,onDraftClose:m,onDraftSpawned:n,onHandoff:o}){let{t:p}=t(),[q,r]=(0,e.useState)(null),[s,u]=(0,e.useState)(!1),v=(0,e.useRef)(null),w=(0,e.useRef)(null),x=(0,e.useMemo)(()=>cM(b,c,f,g,h),[b,c,f,g,h]),y=(0,e.useMemo)(()=>[...x.nodes.map(a=>({key:a.file.path,file:a.file,isRoot:a.isRoot,kind:"node"})),...x.decks.map(a=>({key:a.key,file:null,isRoot:!1,kind:"deck"})),...x.drafts.map(a=>({key:a.key,file:null,isRoot:!0,kind:"draft"}))],[x]),z=(0,e.useMemo)(()=>new Map(y.map(a=>[a.key,a])),[y]),A=(0,e.useMemo)(()=>{if(q&&z.has(q))return q;let a=null,b=-1;for(let c of y){if(!c.file)continue;let d=1e12*dj[ap(c.file)]+c.file.mtime;d>b&&(b=d,a=c)}return(a??y[0])?.key??null},[q,z,y]),B=(0,e.useMemo)(()=>x.nodes.find(a=>a.file.path===A)??null,[x,A]),C=(0,e.useMemo)(()=>x.decks.find(a=>a.key===A)??null,[x,A]),D=(0,e.useMemo)(()=>x.drafts.find(a=>a.key===A)??null,[x,A]),E=(0,e.useCallback)(a=>{if(!y.length)return;let b=y.findIndex(a=>a.key===A),c=y[Math.min(y.length-1,Math.max(0,(-1===b?0:b)+a))];c&&c.key!==A&&r(c.key)},[y,A]),F=(0,e.useCallback)(a=>{if(u(!1),z.has(a))return void r(a);let b=f.find(b=>b.path===a);b&&j(b)},[z,f,j]);return(0,d.jsxs)("div",{className:"relative flex min-h-0 min-w-0 flex-1 flex-col",children:[y.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:y.map(a=>(0,d.jsx)(dl,{entry:a,active:a.key===A,chipRef:a.key===A?w:void 0,onClick:()=>r(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:[B?(0,d.jsxs)("div",{className:"relative flex min-h-0 flex-1",children:[(0,d.jsx)(cw,{file:B.file,tasks:B.tasks,files:f,onSelect:j,isRoot:B.isRoot,onClose:()=>k(B.file.path),dragHandle:{onTouchStart:a=>{let b=a.touches[0];b&&(v.current={x:b.clientX,y:b.clientY})},onTouchEnd:a=>{let b=v.current;v.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)||E(d<0?1:-1)}}}),o&&cK(B.file)?(0,d.jsx)(cL,{file:B.file,onHandoff:()=>o(B.file)}):null]},B.file.path):C?(0,d.jsx)("div",{className:"relative min-h-0 flex-1",children:(0,d.jsx)(cI,{flow:C.flow,rounds:C.rounds,files:f,onSelect:j,focusRound:null})},C.key):D?(0,d.jsx)(cB,{draftId:D.id,project:a,files:f,onClose:()=>m(D.id),onSpawned:a=>n(D.id,a)},D.key):(0,d.jsx)("div",{className:"flex flex-1 items-center justify-center text-center text-[13px] text-dim",children:p("mobile.noConvos")}),(0,d.jsx)(dm,{layout:x,current:A,onOpen:()=>u(!0)})]}),s?(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:p("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":p("mobile.closeMap"),onClick:()=>u(!1),children:(0,d.jsx)(l,{className:"h-4 w-4","aria-hidden":!0})})]}),(0,d.jsx)(di,{project:a,groups:b,manual:c,files:f,flows:g,drafts:h,focus:null,ring:A,onSelect:j,onClose:k,onDraftClose:m,onDraftSpawned:n,onNodePick:F}),(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:p("mobile.tapNode")})]}):null]})}function dl({entry:a,active:b,chipRef:c,onClick:e}){let{t:f}=t();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=ap(g),i="waiting"===h||"stalled"===h,j=ai(g),k=u(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 ${Y(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 dm({layout:a,current:b,onOpen:c}){let{t:e}=t(),f=Math.min(96/a.width,64/a.height),g=(96-a.width*f)/2,h=(64-a.height*f)/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":e("mobile.openMap"),onClick:c,children:(0,d.jsx)("svg",{width:96,height:64,"aria-hidden":!0,children:(0,d.jsxs)("g",{transform:`translate(${g} ${h}) scale(${f})`,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===b?"#5a51e0":void 0,strokeWidth:a.key===b?5/f: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===b?"#5a51e0":void 0,strokeWidth:a.key===b?5/f: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:ag(a.file),opacity:"live"===a.file.activity?.85:.35,stroke:a.file.path===b?"#5a51e0":void 0,strokeWidth:a.file.path===b?5/f:void 0},a.file.path))]})})})}function dn(a){try{window.localStorage.setItem("llvArchived",JSON.stringify([...a]))}catch{}}function dp({data:a,onOpen:b}){let{t:c}=t(),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 dq({file:a,title:b,project:c,currentProject:e,descendants:f,statusLine:g,size:h,tone:i,onOpen:j,onArchive:k}){let{t:m}=t(),n=ai(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":m("switchCard.openColumn",{title:u(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":m("switchCard.remove"),onClick:b=>{b.stopPropagation(),k(a)},onKeyDown:a=>a.stopPropagation(),children:(0,d.jsx)(l,{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 ${Y(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:ae(a).soft,color:ae(a).color},title:[n.label,af(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:n.style,children:n.label}),(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:W(a.mtime)}),a.ctx?(0,d.jsx)(cq,{ctx:a.ctx}):null,f?(0,d.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-0.5",children:[(0,d.jsx)(az,{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)(cg,{file:a,compact:!0})}):null]})}function dr({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)(bm,{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)(dq,{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 ds({files:a,flows:b,project:c,onOpenFile:f}){let{t:g}=t(),[h,i]=(0,e.useState)(!1),[j,k]=(0,e.useState)(""),[m,n]=(0,e.useState)(!1),[o,p]=(0,e.useState)(!1),[q,r]=(0,e.useState)(0),s=(0,e.useRef)(null),v=function(){let[a,b]=(0,e.useState)([]),[c,d]=(0,e.useState)(!1);return{events:a,loading:c}}(),{archivedPaths:w,archive:x,unarchive:y}=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,dn(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,dn(d),d})},[])}}(),z=am(a,v.events,j,q,w,b),A=am(a,[],"",q,w,b),B=(0,e.useMemo)(()=>a.filter(a=>w.has(a.path)).map(a=>({file:a,title:u(a.title),project:C(a)})).sort((a,b)=>b.file.mtime-a.file.mtime),[a,w]),D=a=>{f(a),i(!1)},E=a=>x(a.path);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(dp,{data:A,onOpen:()=>i(!0)}),h?(0,d.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-ink/28 p-[2.5vh]",onMouseDown:()=>i(!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":g("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:g("switch.title")}),(0,d.jsx)("input",{ref:s,value:j,onChange:a=>k(a.target.value),placeholder:g("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"}),v.loading?(0,d.jsx)("span",{className:"text-[11px] font-semibold text-dim",children:g("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":g("switch.close"),onClick:()=>i(!1),children:(0,d.jsx)(l,{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)(dr,{title:g("switch.waiting"),items:z.waiting,size:"large",currentProject:c,onOpenFile:D,onArchive:E}),(0,d.jsx)(dr,{title:g("switch.working"),items:z.working,size:"large",currentProject:c,onOpenFile:D,onArchive:E}),(0,d.jsx)(dr,{title:g("switch.recent"),items:z.recent,size:"small",currentProject:c,onOpenFile:D,onArchive:E}),(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:()=>n(a=>!a),children:[(0,d.jsx)("span",{children:g("switch.older")}),(0,d.jsx)("span",{className:"text-dim",children:z.older.length})]}),m?(0,d.jsx)("div",{className:"mt-2",children:(0,d.jsx)(dr,{title:"",items:z.older,size:"small",currentProject:c,onOpenFile:D,onArchive:E})}):null]}),z.waiting.length||z.working.length||z.recent.length||z.older.length?null:(0,d.jsx)("div",{className:"pt-[18vh] text-center text-[13px] font-semibold text-dim",children:g("common.nothingFound")}),B.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":o,onClick:()=>p(a=>!a),children:[(0,d.jsx)("span",{children:g("switch.hidden",{count:B.length})}),(0,d.jsx)("span",{children:o?g("switch.hide"):g("common.show")})]}),o?(0,d.jsx)("div",{className:"mt-2 space-y-1",children:B.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:()=>y(a.file.path),children:g("switch.restore")})]},a.file.path))}):null]}):null]})]})}):null]})}function dt(){location.hash="#p="+encodeURIComponent(v)}function du({files:a,onOpen:b}){let{t:c}=t();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:c("trash.title")}),(0,d.jsx)("div",{className:"mb-3 mt-0.5 text-[12px] text-dim",children:c("trash.hint")}),(0,d.jsx)("div",{className:"space-y-1.5",children:a.map(a=>(0,d.jsx)(dv,{file:a,onOpen:b},a.path))})]})})}function dv({file:a,onOpen:b}){let{t:c}=t(),[f,g]=(0,e.useState)(!1),h=ai(a);return f?(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)(aV,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),(0,d.jsx)("span",{className:"min-w-0 truncate",children:u(a.title,80)}),(0,d.jsx)("span",{className:"shrink-0",children:c("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":c("trash.open",{title:u(a.title,60)}),onClick:()=>b(a),children:[(0,d.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${Y(a.activity)}`}),(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 text-[9.5px] font-bold",style:h.style,children:h.label}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12.5px] font-semibold",title:a.path,children:u(a.title,90)}),(0,d.jsx)("span",{className:"shrink-0 text-[10.5px] font-semibold text-dim",children:W(a.mtime)}),(0,d.jsxs)("span",{className:"shrink-0 text-[10.5px] text-dim",children:[(a.size/1024).toFixed(0)," ",c("common.kb")]})]}),(0,d.jsx)(bl,{file:a,onDeleted:()=>g(!0)})]})}function dw({files:a,onArchive:b}){let{t:c}=t();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 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:()=>{b(),dt()},children:[(0,d.jsx)(aA,{className:"h-3 w-3","aria-hidden":!0})," ",c("trash.toArchive")]})}function dx({files:a}){let{t:b}=t(),[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})):dt()};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)(aV,{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 dy=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"}]]),dz=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 dA(){let{t:a}=t(),[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(aq,a?"on":"off")}catch{}a&&function(a=0){(function(){try{localStorage.getItem(aq)}catch{return!0}})()}()},children:b?(0,d.jsx)(dy,{className:"h-3.5 w-3.5","aria-hidden":!0}):(0,d.jsx)(dz,{className:"h-3.5 w-3.5","aria-hidden":!0})})}function dB({items:a,onSelect:b}){let{t:c}=t(),[f,g]=(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":f,onClick:()=>g(a=>!a),children:[(0,d.jsx)(aI,{className:`h-3.5 w-3.5 transition-transform ${f?"rotate-90":""}`,"aria-hidden":!0}),c("tree.quiet"),(0,d.jsx)("span",{className:"font-semibold normal-case tracking-normal",children:a.length})]}),f?(0,d.jsx)(bm,{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 c=ai(a),e=u(a.cmdDesc||a.title,70);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:u(a.title),onClick:()=>b(a),children:[(0,d.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${Y(a.activity)}`}),(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px]",style:c.style,children:c.label}),(0,d.jsx)("span",{className:"truncate",children:e}),(0,d.jsx)("span",{className:"shrink-0 font-normal text-dim",children:W(a.mtime)})]},a.path)})}):null]})}let dC=a=>`llvCols:${a}`;function dD(a,b){let c=function(a){try{let b=JSON.parse(localStorage.getItem(dC(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(dC(a),JSON.stringify(c))}function dE({files:a,flows:b,project:c,openNonce:f,archived:g,onArchive:h,onUnarchive:i,onMenu:j}){let{t:k}=t(),l=av(),m=(0,e.useRef)(null),n=(0,e.useRef)(null),[o,p]=(0,e.useState)({manual:[],hidden:[]}),[q,r]=(0,e.useState)([]),[s,u]=(0,e.useState)(null),v=(0,e.useRef)(o),w=a=>{v.current=a,p(a),localStorage.setItem(dC(c),JSON.stringify(a))},z=(0,e.useMemo)(()=>{let c=O(b);return c.size?a.filter(a=>!c.has(a.path)):a},[a,b]),A=(0,e.useMemo)(()=>H(z,c),[z,c]),B=(0,e.useMemo)(()=>new Set(A.map(a=>a.key)),[A]),D=(0,e.useMemo)(()=>(function(a,b,c){let d=E(a),e=[];for(let f of a){if(C(f)!==b||!y(f)||c.has(f.path))continue;let a=F(f,d);if(!a.length)continue;let g=f.mtime,h=x(f);for(let b of a)g=Math.max(g,b.mtime),h=Math.min(h,x(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,c,B),[z,c,B]),G=(0,e.useMemo)(()=>{let a;return a=E(z),z.filter(b=>!(C(b)!==c||b.parent||B.has(b.path)||a.get(b.path)?.length)&&"live"!==b.activity).sort((a,b)=>x(a)-x(b)||b.mtime-a.mtime)},[z,c,B]),I=(0,e.useMemo)(()=>new Set(A.flatMap(a=>a.columns.map(a=>a.file.path))),[A]),J=(0,e.useMemo)(()=>new Set(o.hidden),[o.hidden]),K=(0,e.useMemo)(()=>{let a=new Map(z.map(a=>[a.path,a]));return o.manual.map(b=>a.get(b)).filter(a=>void 0!==a&&C(a)===c&&!I.has(a.path)&&!J.has(a.path))},[o.manual,z,c,I,J]),L=(0,e.useMemo)(()=>A.reduce((a,b)=>a+b.columns.reduce((a,b)=>a+ +("live"===b.file.activity)+b.tasks.filter(a=>"live"===a.activity).length,0),0),[A]),M=A.filter(a=>!a.orphanTask).length,N=a=>{u(a),m.current&&window.clearTimeout(m.current),m.current=window.setTimeout(()=>u(null),1800)},P=a=>{r(a),sessionStorage.setItem(`llvDrafts:${c}`,JSON.stringify(a))},Q=()=>"function"==typeof crypto.randomUUID?crypto.randomUUID():Date.now().toString(36)+Math.random().toString(36).slice(2,10),R=a=>{let b=q.find(b=>""===a.path);if(b)return void N("draft::"+b);let c=Q();cA(c,"src",a.path),P([...q,c]),n.current="draft::"+c},S=a=>{for(let b of["engine","cwd","text","boot","src"])sessionStorage.removeItem(cz(a,b));P(q.filter(b=>b!==a))},T=(a,b)=>{S(a),V(b)},U=a=>{fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"kill",path:a})}).catch(()=>{}),w({manual:o.manual.filter(b=>b!==a),hidden:I.has(a)?[...new Set([...o.hidden,a])]:o.hidden})},V=a=>{let b=C(a);if(b!==c){dD(b,a.path),location.hash="#p="+encodeURIComponent(b);return}if(I.has(a.path)&&!J.has(a.path)||K.some(b=>b.path===a.path))return void N(a.path);let d=o.hidden.filter(b=>b!==a.path);w({manual:I.has(a.path)?o.manual:[...new Set([...o.manual,a.path])],hidden:d}),n.current=a.path},W=[];L?W.push(`${k("dash.branchesLive",{count:L})} \xb7 ${k("dash.trees",{count:M})}`):M&&W.push(k("dash.recentConvos",{count:M})),D.length&&W.push(k("dash.quietTrees",{count:D.length}));let X=A.map(a=>({...a,columns:a.columns.filter(a=>!J.has(a.file.path))})).filter(a=>a.columns.length),Y=X.filter(a=>a.orphanTask).map(a=>a.columns[0].file),Z=X.filter(a=>!a.orphanTask),$=Z.length>0||K.length>0||q.length>0,_=(0,e.useMemo)(()=>a.filter(a=>C(a)===c).sort((a,b)=>b.mtime-a.mtime),[a,c]);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:[j?(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:j,children:(0,d.jsx)(aw,{className:"h-4 w-4","aria-hidden":!0})}):null,(0,d.jsx)("h1",{className:"truncate text-[13.5px] font-bold",children:c}),(0,d.jsx)("span",{className:"truncate text-[11.5px] text-dim",children:W.length?W.join(" \xb7 "):k("common.nothingRunning")}),(0,d.jsx)(dA,{}),g?(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:()=>i(c),children:[(0,d.jsx)(aB,{className:"h-3 w-3","aria-hidden":!0})," ",k("dash.unarchive")]}):(0,d.jsx)(dw,{files:_,onArchive:()=>h(c)}),(0,d.jsx)(dx,{files:_}),(0,d.jsxs)("button",{type:"button",onClick:()=>{let a=Q();P([...q,a]),n.current="draft::"+a},"aria-label":k("dash.newConvo"),className:"ml-auto 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:"+"})," ",k("dash.agent")]})]}),Y.length?(0,d.jsx)("div",{className:"shrink-0 border-b border-line bg-[#fbfbfd]",children:Y.map(b=>(0,d.jsx)("div",{className:`border-l-4 ${"live"===b.activity?"border-l-ok bg-[#f2faf4]":"border-l-[#9a9aa4]"}`,children:(0,d.jsx)(cx,{file:b,files:a,onSelect:V})},b.path))}):null,$?l?(0,d.jsx)(dk,{project:c,groups:Z,manual:K,files:a,flows:b,drafts:q,focus:s,onSelect:V,onClose:U,onDraftClose:S,onDraftSpawned:T,onHandoff:R}):(0,d.jsx)(di,{project:c,groups:Z,manual:K,files:a,flows:b,drafts:q,focus:s,onSelect:V,onClose:U,onDraftClose:S,onDraftSpawned:T,onHandoff:R}):_.length?(0,d.jsx)(du,{files:_,onOpen:V}):(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:k("dash.emptyTitle")}),(0,d.jsx)("div",{className:"mt-0.5 text-[12px] text-dim",children:k("dash.emptyHint")})]})}),l?null:(0,d.jsx)(ds,{files:a,flows:b,project:c,onOpenFile:V}),G.length?(0,d.jsx)(dB,{items:G,onSelect:V}):null]})}let dF=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"}]]),dG=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"}]]);function dH(){let{t:a}=t(),[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)(dF,{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)(aH,{className:"h-3.5 w-3.5","aria-hidden":!0}):(0,d.jsx)(dG,{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 dI(){let{locale:a,t:b,setLocale:c}=t(),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 dJ=(a=p())=>"uk"===a?"uk-UA":"en-US";function dK({label:a,window:b,engineColor:c,now:e}){var f,g;let h,i,j,k,{t:l}=t();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=p(),(i=f-e)<=60?s(h,"limits.now"):i<5400?s(h,"limits.inMin",{n:Math.round(i/60)}):i<129600?s(h,"limits.inHour",{n:Math.round(i/3600)}):s(h,"limits.inDay",{n:Math.round(i/86400)})),at:(g=b.resetsAt,k=(j=new Date(1e3*g)).toLocaleTimeString(dJ(),{hour:"2-digit",minute:"2-digit",hour12:!1}),g-e<86400?k:j.toLocaleDateString(dJ(),{day:"numeric",month:"short"})+" "+k)})}):null]})}function dL({label:a,engine:b,limits:c,now:e,staleHint:f}){let{t:g}=t();if(!c||!c.session&&!c.weekly)return null;let h=Z[b]??$,i=c.capturedAt&&e-c.capturedAt>1200?W(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)(dK,{label:g("limits.5h"),window:c.session,engineColor:h.color,now:e}),(0,d.jsx)(dK,{label:g("limits.week"),window:c.weekly,engineColor:h.color,now:e})]})}function dM(){let{locale:a}=t(),[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:s(b,"limits.asOf",{time:c.toLocaleTimeString(dJ(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)(dL,{label:"Claude",engine:"claude",limits:b.data.claude,now:b.at,staleHint:f}),(0,d.jsx)(dL,{label:"Codex",engine:"codex",limits:b.data.codex,now:b.at,staleHint:f})]})}let dN=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"}]]),dO=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 dP(){let{t:a}=t(),[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)(dN,{className:"h-3.5 w-3.5","aria-hidden":!0}):(0,d.jsx)(dO,{className:"h-3.5 w-3.5","aria-hidden":!0})})}function dQ({files:a,archivedProjects:b,selected:c,onSelect:f}){let{t:g}=t(),[h,i]=(0,e.useState)(""),[j,k]=(0,e.useState)(!1),l=(0,e.useMemo)(()=>D(a),[a]),m=(0,e.useMemo)(()=>{let a=h.trim().toLowerCase();return a?l.filter(b=>b.project.toLowerCase().includes(a)):l},[l,h]),n=(0,e.useMemo)(()=>m.filter(a=>!b.has(a.project)),[m,b]),o=(0,e.useMemo)(()=>m.filter(a=>b.has(a.project)),[m,b]),p=(0,e.useMemo)(()=>l.reduce((a,b)=>a+b.liveCount,0),[l]),q=(0,e.useMemo)(()=>l.reduce((a,b)=>a+b.attentionCount,0),[l]);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:[g("rail.title"),p?(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"}),p]}):null,q?(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:["⏸ ",q]}):null,(0,d.jsx)(dI,{}),(0,d.jsx)(dH,{}),(0,d.jsx)(dP,{})]}),(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:g("rail.filter"),value:h,onChange:a=>i(a.target.value)})}),(0,d.jsxs)("nav",{className:"flex-1 overflow-y-auto px-2 pb-3 pt-1","aria-label":g("rail.projects"),children:[(0,d.jsx)(dR,{label:g("rail.overview"),live:0,attention:0,total:null,age:"",active:c===v,hasLive:!1,onClick:()=>f(v)}),(0,d.jsx)("div",{className:"mx-2.5 my-1.5 border-t border-line"}),(0,d.jsx)(bm,{children:n.map(a=>(0,d.jsx)("div",{"data-flip-key":a.project,children:(0,d.jsx)(dR,{label:a.project,live:a.liveCount,attention:a.attentionCount,total:a.conversations,age:W(a.smt),active:c===a.project,hasLive:a.liveCount>0,onClick:()=>f(a.project)})},a.project))}),o.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":j,onClick:()=>k(a=>!a),children:[(0,d.jsx)(aI,{className:`h-3 w-3 shrink-0 transition-transform ${j?"rotate-90":""}`,"aria-hidden":!0}),(0,d.jsx)(aA,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),g("rail.archive"),(0,d.jsx)("span",{className:"font-semibold",children:o.length})]}),j?o.map(a=>(0,d.jsx)(dR,{label:a.project,live:a.liveCount,attention:a.attentionCount,total:a.conversations,age:W(a.smt),active:c===a.project,hasLive:a.liveCount>0,onClick:()=>f(a.project)},a.project)):null]}):null,n.length||o.length?null:(0,d.jsx)("div",{className:"px-3 py-4 text-center text-[12px] text-dim",children:g("common.nothingFound")})]}),(0,d.jsx)(dM,{})]})}function dR({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 dS(){let a,{t:b}=t(),{files:c,flows:f}=function(){let[a,b]=(0,e.useState)(as);return a}(),g=(a=(0,e.useSyncExternalStore)(L,()=>J,()=>M),(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);let{archivedProjects:h,archiveProject:i,unarchiveProject:j}=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,ar(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,ar(d),d})},[])}}(),k=av(),[m,n]=(0,e.useState)(!1),[o,p]=(0,e.useState)(v),[q,r]=(0,e.useState)(null),[s,u]=(0,e.useState)(null);(0,e.useRef)(null);let[w,x]=(0,e.useState)(0),y=(0,e.useCallback)(a=>{p(a),localStorage.setItem("llvProject",a),a!==v?history.replaceState(null,"","#p="+encodeURIComponent(a)):history.replaceState(null,"",location.pathname),n(!1)},[]),z=(0,e.useCallback)(a=>{let b=C(a);dD(b,a.path),y(b),x(a=>a+1)},[y]),A=s?c.find(a=>a.path===s):null;return(0,d.jsxs)("div",{className:"flex h-full",children:[k?null:(0,d.jsx)(dQ,{files:c,archivedProjects:h,selected:o,onSelect:y}),k&&m?(0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex",children:[(0,d.jsx)(dQ,{files:c,archivedProjects:h,selected:o,onSelect:y}),(0,d.jsx)("button",{type:"button",className:"min-w-0 flex-1 bg-ink/35","aria-label":b("viewer.closeProjects"),onClick:()=>n(!1)})]}):null,(0,d.jsxs)("main",{className:"flex min-w-0 flex-1 flex-col",children:[A?(0,d.jsxs)("div",{className:"fixed right-4 top-4 z-50 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:()=>{z(A),u(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:A.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:()=>u(null),children:(0,d.jsx)(l,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}):null,o===v?(0,d.jsx)(ax,{files:c,archivedProjects:h,onSelectProject:y,onSelectFile:z,onMenu:k?()=>n(!0):void 0}):(0,d.jsx)(dE,{files:c,flows:g,project:o,openNonce:w,archived:h.has(o),onArchive:i,onUnarchive:j,onMenu:k?()=>n(!0):void 0})]})]})}},57784:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,81921,23))},60728:()=>{},61135:()=>{},61744:(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))},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},68673:(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")},78335:()=>{},78464:(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/latand/.agents/tools/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/latand/.agents/tools/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}`:""}
|
|
3
|
+
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}}},79428:a=>{"use strict";a.exports=require("buffer")},81825:(a,b,c)=>{Promise.resolve().then(c.bind(c,55096))},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},96487:()=>{}};var b=require("../webpack-runtime.js");b.C(a);var c=b.X(0,[445,319,918],()=>b(b.s=78464));module.exports=c})();
|