agent-log-viewer 0.2.0 → 0.4.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/dist/standalone/.next/BUILD_ID +1 -1
- package/dist/standalone/.next/app-path-routes-manifest.json +14 -8
- package/dist/standalone/.next/build-manifest.json +3 -3
- package/dist/standalone/.next/prerender-manifest.json +3 -3
- package/dist/standalone/.next/required-server-files.json +4 -4
- package/dist/standalone/.next/routes-manifest.json +44 -0
- package/dist/standalone/.next/server/app/_global-error/page.js +3 -3
- package/dist/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/dist/standalone/.next/server/app/_global-error.html +1 -1
- package/dist/standalone/.next/server/app/_global-error.rsc +1 -1
- package/dist/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/_not-found/page.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 +2 -2
- package/dist/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- 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/access/route_client-reference-manifest.js +1 -1
- package/dist/standalone/.next/server/app/api/answer/route.js +1 -1
- package/dist/standalone/.next/server/app/api/answer/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/answer/route_client-reference-manifest.js +1 -1
- package/dist/standalone/.next/server/app/api/files/route.js +1 -1
- package/dist/standalone/.next/server/app/api/files/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/files/route_client-reference-manifest.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/[id]/route_client-reference-manifest.js +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/flows/route_client-reference-manifest.js +1 -1
- package/dist/standalone/.next/server/app/api/inbox/route.js +1 -1
- package/dist/standalone/.next/server/app/api/inbox/route_client-reference-manifest.js +1 -1
- package/dist/standalone/.next/server/app/api/limits/route.js +1 -1
- package/dist/standalone/.next/server/app/api/limits/route_client-reference-manifest.js +1 -1
- package/dist/standalone/.next/server/app/api/log/route.js +1 -1
- package/dist/standalone/.next/server/app/api/log/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/log/route_client-reference-manifest.js +1 -1
- package/dist/standalone/.next/server/app/api/proc/route.js +1 -1
- package/dist/standalone/.next/server/app/api/proc/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/proc/route_client-reference-manifest.js +1 -1
- package/dist/standalone/.next/server/app/api/push/route.js +1 -1
- package/dist/standalone/.next/server/app/api/push/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/push/route_client-reference-manifest.js +1 -1
- package/dist/standalone/.next/server/app/api/spawn/route.js +1 -1
- package/dist/standalone/.next/server/app/api/spawn/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/spawn/route_client-reference-manifest.js +1 -1
- package/dist/standalone/.next/server/app/api/tasks/[id]/route.js +1 -0
- package/dist/standalone/.next/server/app/api/tasks/[id]/route.js.nft.json +1 -0
- package/dist/standalone/.next/server/app/api/tasks/[id]/route_client-reference-manifest.js +1 -0
- package/dist/standalone/.next/server/app/api/tasks/[id]/send/route.js +1 -0
- package/dist/standalone/.next/server/app/api/tasks/[id]/send/route.js.nft.json +1 -0
- package/dist/standalone/.next/server/app/api/tasks/[id]/send/route_client-reference-manifest.js +1 -0
- package/dist/standalone/.next/server/app/api/tasks/[id]/spawn/route.js +1 -0
- package/dist/standalone/.next/server/app/api/tasks/[id]/spawn/route.js.nft.json +1 -0
- package/dist/standalone/.next/server/app/api/tasks/[id]/spawn/route_client-reference-manifest.js +1 -0
- package/dist/standalone/.next/server/app/api/tasks/route.js +1 -0
- package/dist/standalone/.next/server/app/api/tasks/route.js.nft.json +1 -0
- package/dist/standalone/.next/server/app/api/tasks/route_client-reference-manifest.js +1 -0
- package/dist/standalone/.next/server/app/api/timeline/route.js +1 -1
- package/dist/standalone/.next/server/app/api/timeline/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/timeline/route_client-reference-manifest.js +1 -1
- package/dist/standalone/.next/server/app/api/tmux/route.js +1 -2
- package/dist/standalone/.next/server/app/api/tmux/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/tmux/route_client-reference-manifest.js +1 -1
- package/dist/standalone/.next/server/app/api/transcribe/route.js +1 -1
- package/dist/standalone/.next/server/app/api/transcribe/route_client-reference-manifest.js +1 -1
- package/dist/standalone/.next/server/app/api/transcribe/token/route.js +1 -1
- package/dist/standalone/.next/server/app/api/transcribe/token/route_client-reference-manifest.js +1 -1
- package/dist/standalone/.next/server/app/api/workflows/[id]/route.js +1 -0
- package/dist/standalone/.next/server/app/api/workflows/[id]/route.js.nft.json +1 -0
- package/dist/standalone/.next/server/app/api/workflows/[id]/route_client-reference-manifest.js +1 -0
- package/dist/standalone/.next/server/app/api/workflows/route.js +1 -0
- package/dist/standalone/.next/server/app/api/workflows/route.js.nft.json +1 -0
- package/dist/standalone/.next/server/app/api/workflows/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 +3 -3
- package/dist/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/dist/standalone/.next/server/app/index.segments/_full.segment.rsc +3 -3
- 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 -3
- package/dist/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/dist/standalone/.next/server/app-paths-manifest.json +14 -8
- package/dist/standalone/.next/server/chunks/319.js +3 -3
- package/dist/standalone/.next/server/chunks/51.js +4 -0
- package/dist/standalone/.next/server/chunks/628.js +1 -0
- package/dist/standalone/.next/server/functions-config-manifest.json +7 -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/_Dl3LKxoOqqIiQ3cL5oOx/_buildManifest.js +1 -0
- package/dist/standalone/.next/static/chunks/680-e2cc45e50038da25.js +1 -0
- package/dist/standalone/.next/static/chunks/app/_global-error/page-2c88d1e3e1518770.js +1 -0
- package/dist/standalone/.next/static/chunks/app/_not-found/{page-51e53d11a3244389.js → page-811f7dc4ec7ef451.js} +1 -1
- package/dist/standalone/.next/static/chunks/app/api/access/route-2c88d1e3e1518770.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/answer/route-2c88d1e3e1518770.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/files/route-2c88d1e3e1518770.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/flows/[id]/route-2c88d1e3e1518770.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/flows/route-2c88d1e3e1518770.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/inbox/route-2c88d1e3e1518770.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/limits/route-2c88d1e3e1518770.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/log/route-2c88d1e3e1518770.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/proc/route-2c88d1e3e1518770.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/push/route-2c88d1e3e1518770.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/spawn/route-2c88d1e3e1518770.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/tasks/[id]/route-2c88d1e3e1518770.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/tasks/[id]/send/route-2c88d1e3e1518770.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/tasks/[id]/spawn/route-2c88d1e3e1518770.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/tasks/route-2c88d1e3e1518770.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/timeline/route-2c88d1e3e1518770.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/tmux/route-2c88d1e3e1518770.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/transcribe/route-2c88d1e3e1518770.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/transcribe/token/route-2c88d1e3e1518770.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/workflows/[id]/route-2c88d1e3e1518770.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/workflows/route-2c88d1e3e1518770.js +1 -0
- package/dist/standalone/.next/static/chunks/app/layout-22e93960d4e3259a.js +1 -0
- package/dist/standalone/.next/static/chunks/app/page-f48448e03fac75b1.js +2 -0
- package/dist/standalone/.next/static/chunks/{main-app-518cea4217042452.js → main-app-e6ff5fbff7d5b38f.js} +1 -1
- package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/app-error-2c88d1e3e1518770.js +1 -0
- package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/forbidden-2c88d1e3e1518770.js +1 -0
- package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/global-error-2b3b5eea82b805ca.js +1 -0
- package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/not-found-2c88d1e3e1518770.js +1 -0
- package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/unauthorized-2c88d1e3e1518770.js +1 -0
- package/dist/standalone/.next/static/css/543219aee607c693.css +1 -0
- package/dist/standalone/package.json +5 -1
- package/dist/standalone/server.js +1 -1
- package/package.json +5 -1
- package/dist/standalone/.next/server/chunks/289.js +0 -2
- package/dist/standalone/.next/server/chunks/871.js +0 -3
- package/dist/standalone/.next/static/chunks/159-d2dbe811eeab290f.js +0 -1
- package/dist/standalone/.next/static/chunks/app/_global-error/page-81fecd9eba007478.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/access/route-81fecd9eba007478.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/answer/route-81fecd9eba007478.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/files/route-81fecd9eba007478.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/flows/[id]/route-81fecd9eba007478.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/flows/route-81fecd9eba007478.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/inbox/route-81fecd9eba007478.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/limits/route-81fecd9eba007478.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/log/route-81fecd9eba007478.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/proc/route-81fecd9eba007478.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/push/route-81fecd9eba007478.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/spawn/route-81fecd9eba007478.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/timeline/route-81fecd9eba007478.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/tmux/route-81fecd9eba007478.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/transcribe/route-81fecd9eba007478.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/transcribe/token/route-81fecd9eba007478.js +0 -1
- package/dist/standalone/.next/static/chunks/app/layout-fdd4e6d70b3c92cb.js +0 -1
- package/dist/standalone/.next/static/chunks/app/page-39971eba742f6b2e.js +0 -2
- package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/app-error-81fecd9eba007478.js +0 -1
- package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/forbidden-81fecd9eba007478.js +0 -1
- package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/global-error-d958576418125130.js +0 -1
- package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/not-found-81fecd9eba007478.js +0 -1
- package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/unauthorized-81fecd9eba007478.js +0 -1
- package/dist/standalone/.next/static/css/331d03725ce2ef2f.css +0 -1
- package/dist/standalone/.next/static/eVZqd0xcmD_g_vTrSrlTL/_buildManifest.js +0 -1
- /package/dist/standalone/.next/static/{eVZqd0xcmD_g_vTrSrlTL → _Dl3LKxoOqqIiQ3cL5oOx}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[974],{6381:(e,t,n)=>{"use strict";n.d(t,{Viewer:()=>su});var r=n(5155),i=n(233),s=n(9005),l=n(2115);let a={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.newWorkflow":"New workflow: stages → review → PR","dash.workflow":"Workflow","dash.emptyTitle":"The scheme is empty for now","dash.emptyHint":"Open the switchboard in the bottom-right corner and click a conversation — it will appear here","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})","wfState.provisioning":"provisioning the worktree","wfState.implementing":"stages running","wfState.reviewing":"reviewing","wfState.finishing":"finishing","wfState.approved":"approved","wfState.needs_decision":"needs a decision","wfState.paused":"paused","wfState.closed":"closed","wfModel.failed":"failed ({status})","wfStrip.workflow":"WORKFLOW","wfStrip.stagesAria":"Workflow stages","wfStrip.reviewStage":"review","wfStrip.advance":"Advance","wfStrip.retryStage":"Retry stage","wfStrip.skipStage":"Skip","wfStrip.resume":"Resume workflow","wfStrip.pause":"Pause","wfStrip.close":"Close workflow","wfDraft.paneAria":"Draft of a new workflow","wfDraft.notStarted":"the workflow is not launched yet","wfDraft.newWorkflow":"new workflow","wfDraft.dismiss":"Dismiss the workflow draft","wfDraft.template":"template","wfDraft.templateAria":"Workflow template","wfDraft.repo":"repository","wfDraft.repoAria":"Repository directory","wfDraft.manualMode":"manual: a gate at every stage boundary","wfDraft.hint":"Pick a template and a repository, describe the task — the workflow creates a worktree, runs the stages and the review, then opens a PR.","wfDraft.taskPlaceholder":"the task for the workflow — the brief goes to every stage…","wfDraft.taskAria":"Workflow task brief","wfDraft.footerHint":"worktree \xb7 stages \xb7 review \xb7 PR","wfDraft.finishMerge":"local merge","wfDraft.needDir":"set the repository directory","wfDraft.needTask":"describe the task","wfDraft.launchFailed":"launch failed","wfDraft.launch":"▶ Launch workflow","wfDraft.launching":"launching…","scheme.flowTitle":"Run the implement → review cycle for this conversation","scheme.flow":"Flow","scheme.collapsedTitle":"Collapsed branches and tasks of this conversation","scheme.underneath":"underneath","scheme.handTool":"Hand — drag the canvas (H, or hold Space)","scheme.selectTool":"Select — click and work with conversations (V)","scheme.zoomOut":"Zoom out (−)","scheme.zoom100":"Zoom 100% (1)","scheme.zoomIn":"Zoom in (+)","scheme.fit":"Fit all (0, or double-click the background)","scheme.roleImplementer":"Implementer","scheme.roleReviewer":"Reviewer","scheme.roleWorking":"working","scheme.roleWaiting":"waiting","scheme.lassoTool":"Multi-select — draw a box around agents, click cards to toggle","bulk.selectedCount":{one:"{count} selected",other:"{count} selected"},"bulk.placeholder":"one message to every selected agent…","bulk.textAria":"Broadcast text for the selected agents","bulk.sendAll":"Send to {count} agents","bulk.interrupt":"Interrupt","bulk.stop":"Stop","bulk.stopConfirm":"Stop {count} agents?","bulk.remove":"Clear from board","bulk.removeConfirm":"Close {count} cards?","bulk.flow":"Flow","bulk.fit":"Show selection","bulk.exit":"Exit selection (Esc)","bulk.retryFailed":"Retry failed ({count})","bulk.nodeGone":"node left the board","bulk.flowTitle":"Start a review flow on {count} agents","bulk.flowStart":"Start {count} flows","minimap.title":"Minimap — click or drag to navigate","plan.agentPlan":"Agent plan:","plan.stepsAria":"Plan: {done} of {total} steps","plan.nowSuffix":", now: {current}","plan.goal":"goal","plan.goalDone":"goal ✓","plan.goalBlocked":"goal ✖","plan.noObjective":"(objective not recorded in the transcript tail)","plan.tokens":"tokens: {n}","plan.time":"time: {n} min","plan.ctxTitle":"Context window: {pct}% used\n{used} of {window} tokens","plan.ctxAria":"Context: {pct} percent of the window used","plan.goalAria":"Session goal: {status}","limits.now":"now","limits.inMin":"in {n}m","limits.inHour":"in {n}h","limits.inDay":"in {n}d","limits.asOf":"as of {time}","limits.left":"left","limits.reset":"reset {eta} \xb7 {at}","limits.stale":"data is stale: {stale}","limits.5h":"5h","limits.week":"Week","status.awaitingPlan":"awaiting plan approval","status.awaitingAnswer":"awaiting an answer to a question","status.awaitingTerminal":"awaiting a reply in the terminal","status.working":"working…","status.returnedResult":"returned with a result","status.stalled":"interrupted or awaiting permission","status.finishedTurn":"finished the turn — waiting for a reply","status.flow":"flow: {label}","dictation.failed":"couldn't transcribe","dictation.silence":"silence — nothing recognized","dictation.unsupported":"recording is not supported in this browser","dictation.liveError":"live transcription error","dictation.connectionLost":"transcription connection dropped","dictation.noMic":"no microphone access","overview.branchesLiveIn":{one:"{count} branch running in {projects}",other:"{count} branches running in {projects}"},"overview.projects":{one:"{count} project",other:"{count} projects"},"overview.archived":"\xb7 {count} archived","overview.moreLive":"{count} more live","overview.quiet":"quiet \xb7 last activity {age}","overview.empty":"No logs yet","branch.live":"working","branch.waiting":"finished the turn — waiting for a reply","branch.returned":"returned with a result","branch.stalled":"interrupted or awaiting permission","branch.done":"done — safe to remove","branch.worktree":"Worktree {name}","branch.lastActivity":"Last activity: {age}","branch.lastActivityQuiet":"Marked active, but the transcript is quiet: last activity {age}","branch.handoffTitle":"agent spawned by this conversation's handoff","branch.branchTitle":"branch of this conversation","branch.removeColumn":"Remove column {title}","branch.toggleBackground":"{action} background task {title}","branch.collapse":"Collapse","branch.expand":"Expand","branch.expandFull":"Expand conversation {title} to the full window","branch.collapseFull":"Back to the canvas (Esc)","tree.quiet":"Quiet conversations and tasks","corner.waitingCount":"\xb7 {count} waiting","corner.openSwitchboard":"Open the agent switchboard","task.working":", working","task.interrupted":", interrupted","task.finished":", finished","task.interruptedBadge":"interrupted","task.finishedBadge":"finished","task.stopFailed":"couldn't stop","task.signalSent":"sent {signal} to PID {pid}","task.confirmKill":"Really kill PID {pid}?","task.killPid":"Kill {pid}","task.confirmKillYes":"Yes, kill","task.stopAria":"Stop process PID {pid}","task.kill":"Kill","task.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","attention.badge":{one:"{count} waiting",other:"{count} waiting"},"attention.openQueue":"Attention queue — who is blocked on you (N — next)","attention.popoverTitle":"Waiting on you","attention.filterOn":"Show only those waiting on you (F)","attention.filterOff":"Show all nodes (F)","mobile.noConvos":"No conversations yet","mobile.map":"Map","mobile.closeMap":"Close the map","mobile.tapNode":"Tap a node — the conversation opens full-screen","mobile.agent":"agent","mobile.openMap":"Open the project map","tasks.failed":"failed ({status})","tasks.tool":"Task — the next click drops a card on the canvas (T)","tasks.untitled":"untitled","tasks.newPlaceholder":"task text… (the first line is the title)","tasks.editAria":"Task text","tasks.spawning":"starting…","tasks.deadChip":"the conversation is gone from the list","tasks.retry":"retry delivery","tasks.chipFailedTitle":"not delivered: {error}","tasks.send":"send","tasks.sendTitle":"Pull the arrow onto an agent's pane to deliver the task there; drop it on empty canvas to spawn a fresh agent. A click opens the list","tasks.linkSent":"task sent → “{title}”","tasks.spawn":"agent","tasks.spawnTitle":"Spawn a fresh agent with this task as the brief","tasks.spawnGo":"Launch","tasks.statusTitle":"Status: {label} — click cycles","tasks.status.inbox":"inbox","tasks.status.assigned":"assigned","tasks.status.blocked":"blocked","tasks.status.done":"done","tasks.delete":"delete","tasks.deleteConfirm":"sure?","tasks.deleteAria":"Delete task {title}","tasks.pickerTitle":"Send to","tasks.pickerAllChildren":"⤷ all children","tasks.pickerEmpty":"no conversations in the project","tasks.pickerSend":"Send ({count})","tasks.sendOk":"Delivered {delivered} of {total}","tasks.sendFailPart":"✗ “{title}”: {error}","tasks.spawnOk":"agent started in tmux {target}","tasks.composerToggle":"create a task","tasks.composerToggleTitle":"On — the text becomes a tracked task card assigned to the selection; off — a plain broadcast with no trace","tasks.composerNeedsText":"a task needs text","tasks.panelTitle":"Tasks","tasks.panelToggleAria":"Toggle the task panel","tasks.panelThisProject":"this project","tasks.panelAll":"all","tasks.panelEmpty":"no tasks yet — drop one with the board's task tool (T)","tasks.panelClose":"Close the task panel","tasks.sheetNew":"new task","tasks.sheetCreate":"Create the task","tasks.sheetBack":"Back to the task list","tasks.sheetTargets":{one:"{count} target",other:"{count} targets"},"tasks.sheetAssignments":"assignments","tasks.sheetEmpty":"no tasks yet","tasks.sheetGone":"the task is gone","tasks.textNotSaved":"the text didn't save — delivery aborted, try again","tasks.emptyTextBlocked":"empty text isn't saved — restore the task text before sending"},uk:{"common.serverUnavailable":"сервер недоступний","common.loading":"завантаження…","common.loadingCap":"Завантаження…","common.cancel":"Скасувати","common.show":"показати","common.showAll":"показати все","common.collapse":"згорнути","common.yes":"Так","common.no":"Ні","common.send":"Надіслати","common.sending":"надсилаю…","common.sent":"надіслано","common.close":"Закрити","common.failedSend":"не вдалося надіслати","common.failedDelete":"не вдалося видалити","common.nothingFound":"Нічого не знайдено","common.nothingRunning":"зараз нічого не працює","common.kb":"кБ","common.chars":"{n} симв.","lang.aria":"Мова інтерфейсу","util.effortTitle":"Зусилля міркування: {effort}","time.agoSec":"{n} с тому","time.agoMin":"{n} хв тому","time.agoHour":"{n} год тому","time.agoDay":"{n} д тому","kind.session":"сесія","kind.subagent":"субагент","kind.job":"джоба","kind.background":"фон","kind.handoff":"хендофф","rail.title":"Логи агентів","rail.filter":"Фільтр проєктів…","rail.projects":"Проєкти","rail.overview":"Огляд","rail.archive":"Архів","dash.branchesLive":{one:"{count} гілка працює",few:"{count} гілки працюють",many:"{count} гілок працюють",other:"{count} гілок працюють"},"dash.trees":{one:"{count} дерево",few:"{count} дерева",many:"{count} дерев",other:"{count} дерев"},"dash.recentConvos":{one:"{count} нещодавня розмова",few:"{count} нещодавні розмови",many:"{count} нещодавніх розмов",other:"{count} нещодавніх розмов"},"dash.quietTrees":{one:"{count} тихе дерево",few:"{count} тихі дерева",many:"{count} тихих дерев",other:"{count} тихих дерев"},"dash.openProjects":"Відкрити список проєктів","dash.unarchive":"Повернути з архіву","dash.newConvo":"Нова розмова з агентом","dash.agent":"Агент","dash.newWorkflow":"Новий воркфлоу: етапи → ревью → PR","dash.workflow":"Воркфлоу","dash.emptyTitle":"На схемі поки порожньо","dash.emptyHint":"Відкрий пульт у правому нижньому куті і клікни розмову — вона з'явиться тут","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})","wfState.provisioning":"готую worktree","wfState.implementing":"етапи виконуються","wfState.reviewing":"ревью","wfState.finishing":"завершення","wfState.approved":"approved","wfState.needs_decision":"потребує рішення","wfState.paused":"пауза","wfState.closed":"закрито","wfModel.failed":"не вдалося ({status})","wfStrip.workflow":"ВОРКФЛОУ","wfStrip.stagesAria":"Етапи воркфлоу","wfStrip.reviewStage":"ревью","wfStrip.advance":"Далі","wfStrip.retryStage":"Повторити етап","wfStrip.skipStage":"Пропустити","wfStrip.resume":"Продовжити воркфлоу","wfStrip.pause":"Пауза","wfStrip.close":"Закрити воркфлоу","wfDraft.paneAria":"Чернетка нового воркфлоу","wfDraft.notStarted":"воркфлоу ще не запущений","wfDraft.newWorkflow":"новий воркфлоу","wfDraft.dismiss":"Прибрати чернетку воркфлоу","wfDraft.template":"шаблон","wfDraft.templateAria":"Шаблон воркфлоу","wfDraft.repo":"репозиторій","wfDraft.repoAria":"Директорія репозиторію","wfDraft.manualMode":"вручну: гейт на межі кожного етапу","wfDraft.hint":"Обери шаблон і репозиторій, опиши задачу — воркфлоу створить worktree, прожене етапи, ревью і відкриє PR.","wfDraft.taskPlaceholder":"задача для воркфлоу — бриф піде кожному етапу…","wfDraft.taskAria":"Бриф задачі воркфлоу","wfDraft.footerHint":"worktree \xb7 етапи \xb7 ревью \xb7 PR","wfDraft.finishMerge":"merge локально","wfDraft.needDir":"вкажи директорію репозиторію","wfDraft.needTask":"опиши задачу","wfDraft.launchFailed":"не вдалося запустити","wfDraft.launch":"▶ Запустити воркфлоу","wfDraft.launching":"запускаю…","scheme.flowTitle":"Запустити цикл implement → review для цієї розмови","scheme.flow":"Флоу","scheme.collapsedTitle":"Згорнуті гілки й задачі цієї розмови","scheme.underneath":"під сподом","scheme.handTool":"Рука — тягнути полотно (H, або тримай Space)","scheme.selectTool":"Виділення — клік і робота з розмовами (V)","scheme.zoomOut":"Віддалити (−)","scheme.zoom100":"Масштаб 100% (1)","scheme.zoomIn":"Наблизити (+)","scheme.fit":"Вписати все (0, або подвійний клік по фону)","scheme.roleImplementer":"Імплементер","scheme.roleReviewer":"Ревʼюер","scheme.roleWorking":"працює","scheme.roleWaiting":"чекає","scheme.lassoTool":"Вибірка — обведи агентів рамкою, кліком додавай чи знімай","bulk.selectedCount":{one:"Вибрано {count}",few:"Вибрано {count}",many:"Вибрано {count}",other:"Вибрано {count}"},"bulk.placeholder":"одне повідомлення кожному вибраному агенту…","bulk.textAria":"Текст розсилки вибраним агентам","bulk.sendAll":"Надіслати {count} агентам","bulk.interrupt":"Перервати","bulk.stop":"Зупинити","bulk.stopConfirm":"Точно зупинити {count}?","bulk.remove":"Прибрати зі схеми","bulk.removeConfirm":"Закрити {count} карток?","bulk.flow":"Флоу","bulk.fit":"Показати вибірку","bulk.exit":"Вийти з вибірки (Esc)","bulk.retryFailed":"Повторити невдалі ({count})","bulk.nodeGone":"вузол зник зі схеми","bulk.flowTitle":"Запустити ревʼю-флоу для {count} агентів","bulk.flowStart":"Запустити {count} флоу","minimap.title":"Мінімапа — клікни або тягни, щоб перейти","plan.agentPlan":"План агента:","plan.stepsAria":"План: {done} з {total} кроків","plan.nowSuffix":", зараз: {current}","plan.goal":"ціль","plan.goalDone":"ціль ✓","plan.goalBlocked":"ціль ✖","plan.noObjective":"(objective не записаний у хвості транскрипта)","plan.tokens":"токенів: {n}","plan.time":"часу: {n} хв","plan.ctxTitle":"Контекстне вікно: використано {pct}%\n{used} з {window} токенів","plan.ctxAria":"Контекст: використано {pct} відсотків вікна","plan.goalAria":"Ціль сесії: {status}","limits.now":"зараз","limits.inMin":"через {n} хв","limits.inHour":"через {n} год","limits.inDay":"через {n} д","limits.asOf":"станом на {time}","limits.left":"лишилось","limits.reset":"скид {eta} \xb7 {at}","limits.stale":"дані застарілі: {stale}","limits.5h":"5 год","limits.week":"Тиждень","status.awaitingPlan":"чекає затвердження плану","status.awaitingAnswer":"чекає відповіді на питання","status.awaitingTerminal":"чекає на відповідь у терміналі","status.working":"працює…","status.returnedResult":"повернувся з результатом","status.stalled":"перервано або чекає дозволу","status.finishedTurn":"закінчив хід — чекає відповіді","status.flow":"флоу: {label}","dictation.failed":"не вдалося розпізнати","dictation.silence":"тиша — нічого не розпізналось","dictation.unsupported":"запис не підтримується в цьому браузері","dictation.liveError":"помилка live-транскрипції","dictation.connectionLost":"зʼєднання з транскрипцією обірвалось","dictation.noMic":"немає доступу до мікрофона","overview.branchesLiveIn":{one:"{count} гілка працює у {projects}",few:"{count} гілки працюють у {projects}",many:"{count} гілок працюють у {projects}",other:"{count} гілок працюють у {projects}"},"overview.projects":{one:"{count} проєкті",few:"{count} проєктах",many:"{count} проєктах",other:"{count} проєктах"},"overview.archived":"\xb7 {count} в архіві","overview.moreLive":"ще {count} live","overview.quiet":"тихо \xb7 остання активність {age}","overview.empty":"Логів поки нема","branch.live":"працює","branch.waiting":"закінчив хід — чекає відповіді","branch.returned":"повернувся з результатом","branch.stalled":"перервано або чекає дозволу","branch.done":"завершено — можна прибрати","branch.worktree":"Ворк-дерево {name}","branch.lastActivity":"Остання активність: {age}","branch.lastActivityQuiet":"Позначений активним, але транскрипт мовчить: остання активність {age}","branch.handoffTitle":"агент, породжений хендоффом цієї розмови","branch.branchTitle":"гілка цієї розмови","branch.removeColumn":"Прибрати колонку {title}","branch.toggleBackground":"{action} фонову задачу {title}","branch.collapse":"Згорнути","branch.expand":"Розгорнути","branch.expandFull":"Розгорнути розмову {title} на все вікно","branch.collapseFull":"Повернутися до полотна (Esc)","tree.quiet":"Тихі розмови й задачі","corner.waitingCount":"\xb7 {count} чекають","corner.openSwitchboard":"Відкрити пульт агентів","task.working":", працює","task.interrupted":", перервано","task.finished":", закінчив","task.interruptedBadge":"перервано","task.finishedBadge":"завершено","task.stopFailed":"помилка зупинки","task.signalSent":"надіслано {signal} PID {pid}","task.confirmKill":"Точно вбити PID {pid}?","task.killPid":"Вбити {pid}","task.confirmKillYes":"Так, вбити","task.stopAria":"Зупинити процес PID {pid}","task.kill":"Вбити","task.jobLogHint":"Це короткий джоб-лог (лише службові події). Реальна робота Codex — у повній сесії:","task.openCodexSession":"Відкрити сесію Codex ({size} kB{activity})","task.rolloutMissing":"Це короткий джоб-лог. Повна rollout-сесія Codex ще не з'явилась у списку","task.backgroundCommand":"Фонова команда","task.commandNotFound":"Команду, що запустила цю фонову задачу, не знайдено у транскриптах сесії","viewer.closeProjects":"Закрити список проєктів","viewer.agentWaiting":"Агент чекає відповіді","viewer.closeNotification":"Закрити сповіщення","attention.badge":{one:"{count} чекає",few:"{count} чекають",many:"{count} чекають",other:"{count} чекають"},"attention.openQueue":"Черга уваги — хто заблокований на тобі (N — наступний)","attention.popoverTitle":"Чекають на тебе","attention.filterOn":"Показати лише тих, хто чекає на тебе (F)","attention.filterOff":"Показати всі вузли (F)","mobile.noConvos":"Розмов поки нема","mobile.map":"Карта","mobile.closeMap":"Закрити карту","mobile.tapNode":"Тапни вузол — розмова відкриється на весь екран","mobile.agent":"агент","mobile.openMap":"Відкрити карту проєкту","tasks.failed":"не вдалося ({status})","tasks.tool":"Задача — наступний клік кладе картку на полотно (T)","tasks.untitled":"без назви","tasks.newPlaceholder":"текст задачі… (перший рядок — назва)","tasks.editAria":"Текст задачі","tasks.spawning":"запускається…","tasks.deadChip":"розмови вже немає у списку","tasks.retry":"повторити доставку","tasks.chipFailedTitle":"не доставлено: {error}","tasks.send":"надіслати","tasks.sendTitle":"Потягни стрілку на панель агента — задача полетить туди; на порожнє місце — запуститься новий агент. Клік відкриває список","tasks.linkSent":"задачу надіслано → \xab{title}\xbb","tasks.spawn":"агент","tasks.spawnTitle":"Запустити нового агента з цією задачею як брифом","tasks.spawnGo":"Запустити","tasks.statusTitle":"Статус: {label} — клік перемикає","tasks.status.inbox":"інбокс","tasks.status.assigned":"призначено","tasks.status.blocked":"заблоковано","tasks.status.done":"готово","tasks.delete":"видалити","tasks.deleteConfirm":"точно?","tasks.deleteAria":"Видалити задачу {title}","tasks.pickerTitle":"Кому надіслати","tasks.pickerAllChildren":"⤷ всім дітям","tasks.pickerEmpty":"у проєкті немає розмов","tasks.pickerSend":"Надіслати ({count})","tasks.sendOk":"Доставлено {delivered} з {total}","tasks.sendFailPart":"✗ „{title}“: {error}","tasks.spawnOk":"агента запущено в tmux {target}","tasks.composerToggle":"створити задачу","tasks.composerToggleTitle":"Увімкнено — текст стає задачею-карткою з призначеннями на вибір; вимкнено — проста розсилка без сліду","tasks.composerNeedsText":"для задачі потрібен текст","tasks.panelTitle":"Задачі","tasks.panelToggleAria":"Показати або сховати панель задач","tasks.panelThisProject":"цей проєкт","tasks.panelAll":"всі","tasks.panelEmpty":"задач поки нема — кинь картку інструментом \xabзадача\xbb (T)","tasks.panelClose":"Закрити панель задач","tasks.sheetNew":"нова задача","tasks.sheetCreate":"Створити задачу","tasks.sheetBack":"Назад до списку задач","tasks.sheetTargets":{one:"{count} адресат",few:"{count} адресати",many:"{count} адресатів",other:"{count} адресатів"},"tasks.sheetAssignments":"призначення","tasks.sheetEmpty":"задач поки нема","tasks.sheetGone":"задачі вже немає","tasks.textNotSaved":"текст не зберігся — надсилання скасовано, спробуй ще раз","tasks.emptyTextBlocked":"порожній текст не зберігається — віднови текст задачі перед надсиланням"}},o="llv_lang",c="en",d=!1,u=new Set;function p(){return d||(d=!0,c=function(){try{let e=window.localStorage.getItem(o);if("en"===e||"uk"===e)return e}catch{}return("u">typeof navigator?navigator.language:"").toLowerCase().startsWith("uk")?"uk":"en"}(),document.documentElement.lang=c),c}function f(e){if(d=!0,e!==c){c=e;try{window.localStorage.setItem(o,e)}catch{}for(let t of("u">typeof document&&(document.documentElement.lang=e),u))t()}}function m(e){return u.add(e),()=>u.delete(e)}function x(e,t,n){var r;let i,s=a[e][t]??a.en[t]??t;if("string"==typeof s)i=s;else{let t="number"==typeof n?.count?n.count:0;i=s[new Intl.PluralRules("uk"===e?"uk-UA":"en-US").select(t)]??s.other??s.one??""}return r=i,n?r.replace(/\{(\w+)\}/g,(e,t)=>t in n?String(n[t]):e):r}function h(){let e=(0,l.useSyncExternalStore)(m,p,()=>"en");return{locale:e,t:(t,n)=>x(e,t,n),setLocale:f}}function b(e,t=160){let n=e.replace(/\[([^\]]+)\]\(([^)]+)\)/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/[*_~#>]+/g,"").replace(/\s+/g," ").trim().replace(/(?:\/[^\s)]+){3,}/g,e=>{if(e.length<=40)return e;let t=e.split("/").filter(Boolean);return t.length>=2?".../"+t.slice(-2).join("/"):e}).replace(/\s+/g," ").trim();return n.length>t?n.slice(0,t-1).trimEnd()+"…":n}let g="__overview__",w=e=>Math.floor(e/300);function v(e){return"live"===e.activity?0:"recent"===e.activity?1:"stalled"===e.activity?2:3}function k(e){return"claude-projects"===e.root?"сесія"===e.kind&&!e.parent:"codex-sessions"===e.root&&!e.parent}function y(e){return"claude-projects"===e.root&&"субагент"===e.kind}function j(e){return!!y(e)||!!e.handoff&&!!e.parent||"codex-sessions"===e.root&&!!e.parent}function N(e){return"shell"===e.engine||"codex-jobs"===e.root}function S(e){return e.project||"інше"}let C=new Set(["provisioning","implementing","reviewing","finishing"]);function A(e,t=Date.now()/1e3,n=[]){let r=new Map,i=e=>{let t=r.get(e);return t||(t={project:e,liveCount:0,attentionCount:0,conversations:0,smt:0},r.set(e,t)),t};for(let n of e){let e=i(S(n));"live"===n.activity&&(e.liveCount+=1),null!==M(n,t)&&(e.attentionCount+=1),k(n)&&(e.conversations+=1),e.smt=Math.max(e.smt,n.mtime)}for(let e of n){if("closed"===e.state||!e.project)continue;let t=i(e.project);C.has(e.state)&&(t.liveCount+=1),("needs_decision"===e.state||"paused"===e.state)&&(t.attentionCount+=1),t.smt=Math.max(t.smt,(Date.parse(e.createdAt)||0)/1e3)}return[...r.values()].sort((e,t)=>{let n=e.attentionCount>0;return n!==t.attentionCount>0?n?-1:1:e.liveCount!==t.liveCount?t.liveCount-e.liveCount:w(t.smt)-w(e.smt)||e.project.localeCompare(t.project)})}function $(e){let t=new Map;for(let n of e){if(!n.parent)continue;let e=t.get(n.parent);e?e.push(n):t.set(n.parent,[n])}return t}function T(e,t){let n=[],r=[...t.get(e.path)??[]],i=new Set([e.path]);for(;r.length;){let e=r.pop();i.has(e.path)||(i.add(e.path),n.push(e),r.push(...t.get(e.path)??[]))}return n}function E(e){return!N(e)&&("live"===e.activity||"recent"===e.activity&&j(e))}function D(e,t){let n=new Map(e.map(e=>[e.path,e])),r=$(e),i=new Map,s=new Map;for(let r of e)if(S(r)===t){if("live"===r.activity||"recent"===r.activity&&j(r)){let e=function(e,t){let n=new Set,r=e;for(;r.parent&&!n.has(r.path);){n.add(r.path);let e=t.get(r.parent);if(!e)break;r=e}return r}(r,n);N(e)?s.set(e.path,e):i.set(e.path,e);continue}"recent"===r.activity&&k(r)&&i.set(r.path,r)}let l=[...i.values()].map(e=>(function(e,t,n){let r=T(e,t),i=r.filter(E).sort((e,t)=>("live"!==e.activity)-("live"!==t.activity)||w(t.mtime)-w(e.mtime)||e.path.localeCompare(t.path)),s=r.filter(e=>N(e)&&"live"===e.activity).sort((e,t)=>w(t.mtime)-w(e.mtime)||e.path.localeCompare(t.path)),l=[e,...i].map(e=>({file:e,tasks:[]})),a=new Map(l.map(e=>[e.file.path,e]));for(let e of s)(e.parent&&a.get(e.parent)||l[0]).tasks.push(e);let o=new Set([...a.keys(),...s.map(e=>e.path)]),c=r.filter(e=>!o.has(e.path)).sort((e,t)=>t.mtime-e.mtime),d=c.filter(e=>j(e)&&function(e,t){let n=new Set([e.path]),r=e;for(;r.parent&&!n.has(r.parent);){let e=t.get(r.parent);if(!e)break;if(n.add(e.path),"сесія"===e.kind)return"live"===e.activity||"recent"===e.activity;r=e}return!1}(e,n)),u=new Set(d.map(e=>e.path)),p=c.filter(e=>!u.has(e.path)),f=Math.max(...l.map(e=>e.file.mtime),...s.map(e=>e.mtime));return{key:e.path,columns:l,returnable:d,finished:p,smt:f,orphanTask:!1}})(e,r,n));for(let e of s.values())l.push({key:e.path,columns:[{file:e,tasks:[]}],returnable:[],finished:[],smt:e.mtime,orphanTask:!0});return l.sort((e,t)=>e.orphanTask!==t.orphanTask?e.orphanTask?1:-1:w(t.smt)-w(e.smt)||e.key.localeCompare(t.key))}function M(e,t=Date.now()/1e3){return e.pendingQuestion?e.pendingQuestion.toolUseId:e.waitingInput?`${e.path}:waiting:${Math.floor(e.waitingInput.since)}`:"stalled"===e.activity&&"running"===e.proc&&t-e.mtime<=7200?`${e.path}:stalled:${Math.floor(e.mtime)}`:null}let R="llv:flows-changed",P=new Set,I=P,_=new Set;function L(e){return _.add(e),()=>_.delete(e)}let z=new Set;function O(e){let t=new Map;for(let n of e){if("closed"===n.state)continue;let e=t.get(n.implementerPath);(!e||n.createdAt>e.createdAt)&&t.set(n.implementerPath,n)}return t}function q(e){let t=new Set;for(let n of e)for(let e of n.rounds)e.reviewerPath&&t.add(e.reviewerPath);return t}function F(e,t){return!t.has(e.path)&&("claude"===e.engine||"codex"===e.engine)&&k(e)}function U(e,t){return e(`flowState.${t}`)}let H=new Set(["spawn_pending","relay_pending","needs_decision","paused","approved"]),B=new Set(["spawning","reviewing","relaying","fixing"]);function W(e){return"spawning"===e.state||"reviewing"===e.state?"reviewer":"waiting_ready"===e.state||"relaying"===e.state||"fixing"===e.state?"implementer":null}let K={APPROVE:"✓",REQUEST_CHANGES:"✖",COMMENT:"◆"};function Y(e){return"APPROVE"===e?{color:"#1a8a3e",soft:"#e7f4ea"}:"REQUEST_CHANGES"===e?{color:"#c62828",soft:"#fbeaea"}:"COMMENT"===e?{color:"#b07d1f",soft:"#fdf3dd"}:{color:"#8b8b95",soft:"#efeff3"}}async function J(e,t){try{let n=await fetch(`/api/flows/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t)});if(n.ok)return"close"===t.action&&function(e){if(!P.has(e))for(let t of(P.add(e),I=new Set(P),_))t()}(e),window.dispatchEvent(new Event(R)),null;let r=await n.json().catch(()=>null);return r?.error??x(p(),"flowModel.failed",{status:n.status})}catch{return x(p(),"common.serverUnavailable")}}function Q(e){let t=p(),n=Date.now()/1e3-e;return n<90?x(t,"time.agoSec",{n:Math.round(n)}):n<5400?x(t,"time.agoMin",{n:Math.round(n/60)}):n<129600?x(t,"time.agoHour",{n:Math.round(n/3600)}):x(t,"time.agoDay",{n:Math.round(n/86400)})}function X(e){if("string"!=typeof e&&"number"!=typeof e)return"";let t=new Date(e),n="uk"===p()?"uk-UA":"en-US";return Number.isNaN(t.getTime())?"":t.toLocaleTimeString(n,{hour12:!1})}function G(e){return"live"===e?"animate-pulse bg-ok":"recent"===e?"bg-[#d29a2f]":"stalled"===e?"bg-err":"bg-[#c9c9d1]"}let V={codex:{color:"#2f6fd0",soft:"#e8f0fb"},claude:{color:"#d97757",soft:"#faeee9"}},Z={color:"#9a9aa4",soft:"#ececf1"},ee=[[/fable|mythos/,{color:"#c2410c",soft:"#fbeade"}],[/opus/,{color:"#8a5ad6",soft:"#f1ebfb"}],[/sonnet/,{color:"#e0913f",soft:"#fbf1e4"}],[/haiku/,{color:"#d9a58c",soft:"#f9f1ec"}]],et=[[/spark/,{color:"#5ea3e4",soft:"#ecf4fd"}],[/mini|nano/,{color:"#7fb1e8",soft:"#eff6fd"}],[/codex/,{color:"#1d55ab",soft:"#e4edfa"}]];function en(e){let t=V[e.engine];if(!t)return Z;let n=(e.model??"").toLowerCase();for(let[t,r]of"codex"===e.engine?et:ee)if(t.test(n))return r;return t}let er={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 ei(e,t,n){let[r,i,s]=function(e){let t=parseInt(e.slice(1),16),n=(t>>16&255)/255,r=(t>>8&255)/255,i=(255&t)/255,s=Math.max(n,r,i),l=Math.min(n,r,i),a=(s+l)/2,o=s-l;if(0===o)return[0,0,100*a];let c=o/(1-Math.abs(2*a-1));return[60*(s===n?((r-i)/o+6)%6:s===r?(i-n)/o+2:(n-r)/o+4),100*c,100*a]}(e),l=e=>Math.min(100,Math.max(0,e));return`hsl(${Math.round(r)} ${Math.round(l(i+n))}% ${Math.round(l(s+t))}%)`}function es(e){let t=en(e),n=er[e.effort??""];return n?{color:ei(t.color,n.dl,n.ds),soft:ei(t.soft,Math.round(n.dl/3),Math.round(n.ds/2))}:t}function el(e){return e.effort?x(p(),"util.effortTitle",{effort:e.effort}):void 0}function ea(e){return en(e).color}function eo(e){return{borderTopColor:en(e).color}}function ec(e){let t={codex:"Codex",claude:"Claude",shell:"Bash"}[e.engine]??e.engine,n=V[e.engine]??Z;return{label:t,style:{backgroundColor:n.soft,color:n.color}}}function ed(e,t){return Math.floor(t.smt/300)-Math.floor(e.smt/300)||e.file.path.localeCompare(t.file.path)}function eu(e,t=Date.now()/1e3){return!!e.pendingQuestion||!!e.waitingInput||("stalled"===e.activity?null!==M(e,t):"recent"===e.activity&&("claude"===e.engine||"codex"===e.engine)&&k(e)&&!y(e))}function ep(e,t,n,r,i=ef,s=em){let{locale:a}=h();return(0,l.useMemo)(()=>{let l=(e,t)=>x(a,e,t),o=function(e){let t=$(e),n=new Map;for(let r of e)n.set(r.path,T(r,t).length);return n}(e),c=new Map;for(let e of t){let t=c.get(e.file);(!t||e.ts>t.ts)&&c.set(e.file,e)}let d=O(s),u=q(s),p=n.trim().toLowerCase(),f=e.filter(e=>!i.has(e.path)&&!u.has(e.path)&&(k(e)||"live"===e.activity||"stalled"===e.activity||"recent"===e.activity&&!N(e))).map(e=>{let t=S(e),n=b(e.title),i=r-e.mtime,s=d.get(e.path),a=e.pendingQuestion||e.waitingInput?"waiting":"live"===e.activity?"working":eu(e,r)?"waiting":i<=86400?"recent":"older",u=function(e,t,n){var r;if(t.pendingQuestion)return e("plan"===t.pendingQuestion.kind?"status.awaitingPlan":"status.awaitingAnswer");if(t.waitingInput)return e("status.awaitingTerminal");if("live"===t.activity&&t.plan?.current)return`${t.plan.done}/${t.plan.total} \xb7 ${t.plan.current}`;let i=n.get(t.path);return i?`${i.label} \xb7 ${Q(i.ts)}`:"live"===t.activity?e("status.working"):y(r=t)&&"running"!==r.proc?e("status.returnedResult"):"stalled"===t.activity?e("status.stalled"):eu(t)?e("status.finishedTurn"):""}(l,e,c);return s&&(H.has(s.state)?a="waiting":("reviewing"===s.state||"relaying"===s.state||"spawning"===s.state)&&(a="working"),u=`${l("status.flow",{label:U(l,s.state)})}${s.stateDetail?` — ${s.stateDetail}`:""}`),{file:e,project:t,title:n,descendants:o.get(e.path)??0,smt:e.mtime,kind:a,statusLine:u}}).filter(e=>!p||`${e.title} ${e.project}`.toLowerCase().includes(p)),m=(e,t)=>t.smt-e.smt||e.file.path.localeCompare(t.file.path),h=f.filter(e=>"waiting"===e.kind).sort(m),g=f.filter(e=>"working"===e.kind).sort(m);return{waiting:h,working:g,recent:f.filter(e=>"recent"===e.kind).sort(ed),older:f.filter(e=>"older"===e.kind).sort(ed),livePreview:g.slice(0,3)}},[e,t,n,r,i,s,a])}let ef=new Set,em=[];function ex(e,t=Date.now()/1e3){return e.pendingQuestion||e.waitingInput?"waiting":"live"===e.activity?"live":"recent"===e.activity&&j(e)&&"running"!==e.proc?"returned":eu(e,t)?"stalled"===e.activity?"stalled":"waiting":"done"}let eh="llvSound";function eb(){try{return"off"!==localStorage.getItem(eh)}catch{return!0}}let eg=new Map,ew=null;function ev(){if(!ew){let e=window.AudioContext??window.webkitAudioContext;if(!e)return null;ew=new e}return ew}let ek={waiting:[{freq:784,at:0,dur:.5},{freq:1175,at:.16,dur:.75}],returned:[{freq:659,at:0,dur:.3},{freq:784,at:.09,dur:.3},{freq:988,at:.18,dur:.65}],stalled:[{freq:880,at:0,dur:.35},{freq:587,at:.14,dur:.7}],question:[{freq:1047,at:0,dur:.28},{freq:1319,at:.12,dur:.35},{freq:1568,at:.24,dur:.6}]};function ey(e,t,n=0){if(!eb())return;let r=ev();if(!r)return;if("running"!==r.state)return void r.resume().catch(()=>void 0);let i=r.currentTime+.02+n/1e3,s=r.destination;if("function"==typeof r.createStereoPanner){let e=r.createStereoPanner();e.pan.value=Math.max(-1,Math.min(1,t)),e.connect(r.destination),s=e}for(let t of ek[e])!function(e,t,n,r){let i=r+n.at,s=e.createOscillator();s.type="sine",s.frequency.value=n.freq;let l=e.createGain();l.gain.setValueAtTime(0,i),l.gain.linearRampToValueAtTime(.07,i+.012),l.gain.exponentialRampToValueAtTime(4e-4,i+n.dur),s.connect(l).connect(t),s.start(i),s.stop(i+n.dur+.05);let a=e.createOscillator();a.type="sine",a.frequency.value=2*n.freq;let o=e.createGain();o.gain.setValueAtTime(0,i),o.gain.linearRampToValueAtTime(.0126,i+.012),o.gain.exponentialRampToValueAtTime(3e-4,i+.7*n.dur),a.connect(o).connect(t),a.start(i),a.stop(i+n.dur)}(r,s,t,i)}let ej={waiting:"waiting",returned:"returned",stalled:"stalled"},eN="llvArchivedProjects";function eS(e){try{window.localStorage.setItem(eN,JSON.stringify([...e]))}catch{}}let eC="llv:tasks-changed";function eA(){window.dispatchEvent(new Event(eC))}async function e$(e,t,n){try{let r=await fetch(e,{method:t,...void 0===n?{}:{headers:{"content-type":"application/json"},body:JSON.stringify(n)}}),i=await r.json().catch(()=>null);if(!r.ok||!i)return{ok:!1,status:r.status,error:i?.error??x(p(),"tasks.failed",{status:r.status})};return eA(),{ok:!0,data:i}}catch{return{ok:!1,status:0,error:x(p(),"common.serverUnavailable")}}}async function eT(e){let t=await e$("/api/tasks","POST",e);return t.ok?{task:t.data.task}:{error:t.error}}let eE=new Map;async function eD(e){let t=eE.get(e);return t&&await t!==null?x(p(),"tasks.textNotSaved"):null}function eM(e,t){let n=void 0!==t.text?eE.get(e):void 0,r=(async()=>{n&&await n;let r=await e$(`/api/tasks/${encodeURIComponent(e)}`,"PATCH",t);return r.ok||404!==r.status?r.ok?null:r.error:(eA(),null)})();return void 0!==t.text&&(eE.set(e,r),r.finally(()=>{eE.get(e)===r&&eE.delete(e)})),r}async function eR(e){let t=await e$(`/api/tasks/${encodeURIComponent(e)}`,"DELETE");return t.ok||404!==t.status?t.ok?null:t.error:(eA(),null)}async function eP(e,t){let n=await eD(e);if(n)return{error:n};let r=await e$(`/api/tasks/${encodeURIComponent(e)}/send`,"POST",{paths:t});return r.ok?r.data:{error:r.error}}async function eI(e,t){let n=await eD(e);if(n)return{error:n};let r=await e$(`/api/tasks/${encodeURIComponent(e)}/spawn`,"POST",t);return r.ok?r.data:{error:r.error}}let e_="llv:workflows-changed";function eL(e){return e.startsWith("wf-")}let ez=new Set(["needs_decision","paused","approved"]),eO=new Set(["provisioning","implementing","reviewing","finishing"]);async function eq(e,t){try{let n=await fetch(`/api/workflows/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t)});if(n.ok)return window.dispatchEvent(new Event(e_)),null;let r=await n.json().catch(()=>null);return r?.error??x(p(),"wfModel.failed",{status:n.status})}catch{return x(p(),"common.serverUnavailable")}}let eF={files:[],flows:[],workflows:[],tasks:[]},eU="(max-width: 767px)";function eH(e){let t=window.matchMedia(eU);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}function eB(){return(0,l.useSyncExternalStore)(eH,()=>window.matchMedia(eU).matches,()=>!1)}var eW=n(6304);let eK=[[1920,4],[1440,3],[1024,2]];function eY({files:e,workflows:t,archivedProjects:n,now:i,onSelectProject:s,onSelectFile:a,onMenu:o}){let{t:c}=h(),d=function(){let[e,t]=(0,l.useState)(3);return(0,l.useEffect)(()=>{let e=()=>t(function(){for(let[e,t]of eK)if(window.innerWidth>=e)return t;return 1}());return window.addEventListener("resize",e),e(),()=>window.removeEventListener("resize",e)},[]),e}(),u=(0,l.useMemo)(()=>A(e,i,t),[e,i,t]),p=(0,l.useMemo)(()=>u.filter(e=>!n.has(e.project)),[u,n]),f=u.length-p.length,m=(0,l.useMemo)(()=>p.reduce((e,t)=>e+t.liveCount,0),[p]),x=p.filter(e=>e.liveCount>0).length,g=(0,l.useMemo)(()=>p.map(t=>{let n=D(e,t.project).flatMap(e=>e.columns.flatMap(e=>[e.file,...e.tasks])).filter(e=>"live"===e.activity),r=n.slice(0,4),i=e.filter(e=>S(e)===t.project).sort((e,t)=>t.mtime-e.mtime)[0];return{summary:t,liveBranches:r,moreLive:n.length-r.length,latest:i}}),[e,p]);return(0,r.jsxs)("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[(0,r.jsxs)("div",{className:"flex h-10 shrink-0 items-center gap-2.5 border-b border-line bg-panel px-4",children:[o?(0,r.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":c("dash.openProjects"),onClick:o,children:(0,r.jsx)(eW.A,{className:"h-4 w-4","aria-hidden":!0})}):null,(0,r.jsx)("h1",{className:"text-[13.5px] font-bold",children:c("rail.overview")}),(0,r.jsxs)("span",{className:"text-[11.5px] text-dim",children:[m?c("overview.branchesLiveIn",{count:m,projects:c("overview.projects",{count:x})}):c("common.nothingRunning"),f?` ${c("overview.archived",{count:f})}`:""]})]}),(0,r.jsxs)("div",{className:"grid flex-1 auto-rows-min gap-2.5 overflow-y-auto p-3",style:{gridTemplateColumns:`repeat(${d}, minmax(0, 1fr))`},children:[g.map(({summary:e,liveBranches:t,moreLive:n,latest:i})=>(0,r.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:()=>s(e.project),children:[(0,r.jsxs)("span",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${e.liveCount?"animate-pulse bg-ok":"bg-[#d6d6dd]"}`}),(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate text-[13px] font-bold",children:e.project}),e.liveCount?(0,r.jsx)("span",{className:"shrink-0 rounded-full bg-[#e5f6ea] px-1.5 py-0.5 text-[10.5px] font-bold text-ok",children:e.liveCount}):null,(0,r.jsx)("span",{className:"shrink-0 text-[11px] font-semibold text-dim",children:e.conversations})]}),t.length?(0,r.jsxs)("span",{className:"flex flex-col gap-1",children:[t.map(e=>{let t=ec(e);return(0,r.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:b(e.title),onClick:t=>{t.stopPropagation(),a(e)},onKeyDown:t=>{"Enter"===t.key&&(t.stopPropagation(),a(e))},children:[(0,r.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${G(e.activity)}`}),(0,r.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:t.style,children:t.label}),(0,r.jsx)("span",{className:"truncate font-semibold",children:b(e.title,70)})]},e.path)}),n>0?(0,r.jsx)("span",{className:"px-1 text-[10.5px] font-semibold text-dim",children:c("overview.moreLive",{count:n})}):null]}):(0,r.jsx)("span",{className:"text-[11px] text-dim",children:c("overview.quiet",{age:i?Q(i.mtime):"—"})})]},e.project)),p.length?null:(0,r.jsx)("div",{className:"col-span-full mt-[20vh] text-center text-dim",children:c("overview.empty")})]})]})}var eJ=n(6420),eQ=n(5480),eX=n(6408),eG=n(5408),eV=n(8962),eZ=n(2159),e0=n(7218),e1=n(9805),e5=n(467),e2=n(99),e3=n(7381),e4=n(5045),e6=n(4577),e8=n(6721),e9=n(4088),e7=n(4962),te=n(5222),tt=n(4885),tn=n(6210),tr=n(5796),ti=n(4551),ts=n(5688),tl=n(6619),ta=n(6851),to=n(852),tc=n(4179),td=n(5738),tu=n(7990),tp=n(6449),tf=n(8910),tm=n(7979),tx=n(5561),th=n(966),tb=n(2750),tg=n(2571);let tw={shell:e8.A,tool:tu.A,"cmd-group":tp.A,codex:te.A,claude:ta.A,image:tn.A,blob:tf.A,note:tm.A,citation:tx.A,message:tr.A,shutdown:th.A,plan:tb.A,compact:tt.A};function tv({name:e,className:t}){let n=tw[e];return(0,r.jsx)(n,{className:t??"h-3.5 w-3.5","aria-hidden":!0})}var tk=n(8747),ty=n(7650);function tj({label:e,side:t="top",children:n}){return(0,r.jsxs)("span",{className:"group/hint relative inline-flex",children:[n,(0,r.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"===t?"bottom-full mb-1.5":"top-full mt-1.5"}`,children:e})]})}let tN={"image/png":"png","image/jpeg":"jpg","image/jpg":"jpg","image/gif":"gif","image/webp":"webp"};function tS(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>{let i=String(r.result),s=i.indexOf(",");s<0?n(Error(x(p(),"img.readFailed"))):t({base64:i.slice(s+1),mime:e.type||"image/png",preview:i})},r.onerror=()=>n(r.error??Error(x(p(),"img.readFailed"))),r.onabort=()=>n(Error(x(p(),"img.readAborted"))),r.readAsDataURL(e)})}function tC({images:e,onRemove:t}){let{t:n}=h();return e.length?(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.map((e,i)=>(0,r.jsxs)("div",{className:"group/img relative",children:[(0,r.jsx)("img",{src:e.preview,alt:n("img.previewAlt",{n:i+1}),className:"h-10 w-10 rounded border border-line object-cover"}),(0,r.jsx)("button",{type:"button",onClick:()=>t(i),"aria-label":n("img.removeAria",{n:i+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,r.jsx)(s.A,{className:"h-2.5 w-2.5","aria-hidden":!0})})]},i)),(0,r.jsxs)("span",{className:"inline-flex items-center gap-1 text-[10.5px] font-semibold text-dim",children:[n("composer.imagesCount",{count:e.length})," ",(0,r.jsx)(e5.A,{className:"h-3 w-3","aria-hidden":!0})," ",n("img.toFilePaths")]})]}):null}function tA({onFiles:e,ariaLabel:t,className:n}){let i=(0,l.useRef)(null);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("input",{ref:i,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:t=>{e(Array.from(t.target.files??[])),t.target.value=""}}),(0,r.jsx)("button",{type:"button","aria-label":t,onClick:()=>i.current?.click(),className:n,children:(0,r.jsx)(tn.A,{className:"h-4 w-4","aria-hidden":!0})})]})}function t$({onError:e,onUnclaimedText:t,onLiveCommit:n}){let{t:r}=h(),[i,s]=(0,l.useState)("idle"),[a,o]=(0,l.useState)(0),[c,d]=(0,l.useState)(""),u=(0,l.useRef)(null),p=(0,l.useRef)([]),f=(0,l.useRef)(null),m=(0,l.useRef)(!1),x=(0,l.useRef)(null),b=(0,l.useRef)(null),g=(0,l.useRef)(null),w=(0,l.useRef)(null),v=(0,l.useRef)(!1),k=(0,l.useRef)(!0),y=()=>{null!==x.current&&(clearInterval(x.current),x.current=null)},j=()=>{let e=g.current;g.current=null,e&&(cancelAnimationFrame(e.raf),e.ctx.close().catch(()=>void 0))},N=()=>{let e=f.current;if(f.current=null,e){try{e.processor.disconnect()}catch{}try{e.ws.close()}catch{}e.stream.getTracks().forEach(e=>e.stop()),e.ctx.close().catch(()=>void 0)}},S=e=>{y(),j(),N(),d(""),s("idle");let n=w.current;if(w.current=null,m.current)return void n?.(null);let r=e.partial.trim();n?n(r):r&&t(r)};(0,l.useEffect)(()=>()=>{k.current=!1,y(),j(),m.current=!0,N();let e=u.current;e&&"inactive"!==e.state&&e.stop(),e?.stream.getTracks().forEach(e=>e.stop())},[]);let C=async()=>{y(),j();let n=u.current;u.current=null,n?.stream.getTracks().forEach(e=>e.stop());let i=new Blob(p.current,{type:"audio/webm"});p.current=[];let l=w.current;if(w.current=null,m.current||i.size<2e3){s("idle"),l?.(null);return}s("busy");try{let n=new FormData;n.append("file",i,"dictation.webm");let s=await fetch("/api/transcribe",{method:"POST",body:n}),a=await s.json();if(!s.ok||"string"!=typeof a.text){e(a.error??r("dictation.failed")),l?.(null);return}let o=a.text.trim();o?l?l(o):t(o):(e(r("dictation.silence")),l?.(null))}catch{e(r("common.serverUnavailable")),l?.(null)}finally{s("idle")}},A=async()=>{try{let e=await fetch("/api/transcribe/token",{method:"POST"});if(!e.ok)return null;let t=await e.json();return"string"==typeof t.token&&t.token?t.token:null}catch{return null}},$=async()=>{if(v.current||u.current||f.current)return;v.current=!0;let t=null,i=!0;try{if(t=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1}}),!k.current)return;m.current=!1,d("");let l=await A();if(!k.current||m.current)return;if(!(null!==l&&((t,i)=>{let s;try{s=new AudioContext({sampleRate:16e3})}catch{return!1}let l=new URLSearchParams({model_id:"scribe_v2_realtime",token:i,audio_format:"pcm_16000",commit_strategy:"vad",vad_silence_threshold_secs:"1.2"}),a=new WebSocket(`wss://api.elevenlabs.io/v1/speech-to-text/realtime?${l.toString()}`),o=s.createScriptProcessor(4096,1,1),c={ws:a,ctx:s,processor:o,stream:t,preOpenQueue:[],partial:""};f.current=c;let u=s.createMediaStreamSource(t);return o.onaudioprocess=e=>{if(f.current!==c)return;let t=function(e){let t=new Int16Array(e.length);for(let n=0;n<e.length;n+=1){let r=Math.max(-1,Math.min(1,e[n]??0));t[n]=r<0?32768*r:32767*r}let n=new Uint8Array(t.buffer),r="";for(let e=0;e<n.length;e+=1)r+=String.fromCharCode(n[e]??0);return btoa(r)}(e.inputBuffer.getChannelData(0));a.readyState===WebSocket.OPEN?a.send(JSON.stringify({message_type:"input_audio_chunk",audio_base_64:t})):a.readyState===WebSocket.CONNECTING&&c.preOpenQueue.push(t)},u.connect(o),o.connect(s.destination),a.addEventListener("open",()=>{if(f.current===c){for(let e of c.preOpenQueue)a.send(JSON.stringify({message_type:"input_audio_chunk",audio_base_64:e}));c.preOpenQueue=[]}}),a.addEventListener("message",t=>{if(f.current===c)try{let i=JSON.parse(t.data);if("partial_transcript"===i.message_type)c.partial=i.text??"";else if(("committed_transcript"===i.message_type||"committed_transcript_with_timestamps"===i.message_type)&&i.text)c.partial="",n(i.text);else if("auth_error"===i.message_type||"error"===i.message_type||"invalid_request"===i.message_type||"quota_exceeded"===i.message_type){e(i.error||r("dictation.liveError")),S(c);return}d(c.partial)}catch{}}),a.addEventListener("close",()=>{f.current!==c||w.current||(e(r("dictation.connectionLost")),S(c))}),!0})(t,l))){let e=MediaRecorder.isTypeSupported("audio/webm;codecs=opus")?"audio/webm;codecs=opus":MediaRecorder.isTypeSupported("audio/webm")?"audio/webm":"",n=e?new MediaRecorder(t,{mimeType:e}):new MediaRecorder(t);p.current=[],n.ondataavailable=e=>{e.data.size&&p.current.push(e.data)},n.onstop=()=>{C()},n.start(250),u.current=n}i=!1,(e=>{let t;try{t=new AudioContext}catch{return}let n=t.createAnalyser();n.fftSize=128,n.smoothingTimeConstant=.7,t.createMediaStreamSource(e).connect(n);let r=new Uint8Array(n.frequencyBinCount),i=()=>{if(!g.current)return;g.current.raf=requestAnimationFrame(i),n.getByteFrequencyData(r);let e=b.current;e&&function(e,t){let n=window.devicePixelRatio||1;(e.width!==56*n||e.height!==16*n)&&(e.width=56*n,e.height=16*n);let r=e.getContext("2d");if(!r)return;r.setTransform(n,0,0,n,0,0),r.clearRect(0,0,56,16);let i=Math.max(13,Math.floor(.65*t.length))/13;for(let e=0;e<13;e+=1){let n=Math.floor(e*i),s=Math.max(n+1,Math.floor((e+1)*i)),l=0;for(let e=n;e<s;e+=1)l+=t[e]??0;let a=l/(s-n)/255,o=Math.max(1.5,16*a);r.fillStyle=`rgba(198, 40, 40, ${(.35+.65*a).toFixed(3)})`,r.fillRect(4.3076923076923075*e+1,(16-o)/2,2.3076923076923075,o)}}(e,r)};g.current={ctx:t,raf:requestAnimationFrame(i)}})(t),o(0),s("rec"),x.current=window.setInterval(()=>{o(e=>{let t=e+1;return t>=120&&(u.current?.state==="recording"?u.current.stop():f.current&&S(f.current)),t})},1e3)}catch{k.current&&e(t?r("dictation.unsupported"):r("dictation.noMic"))}finally{var l;i&&(l=t,l?.getTracks().forEach(e=>e.stop())),v.current=!1}};return{phase:i,elapsed:a,liveText:c,canvasRef:b,start:$,stop:()=>new Promise(e=>{let t=f.current;if(t){w.current=e,S(t);return}let n=u.current;n&&"recording"===n.state?(w.current=e,n.stop()):e(null)}),discard:()=>{m.current=!0,u.current?.state==="recording"?u.current.stop():f.current&&S(f.current)}}}function tT({initialText:e,persistText:t,submit:n,disabled:r=!1}){let[i,s]=(0,l.useState)(e),a=(0,l.useRef)(i),o=e=>{let n="function"==typeof e?e(a.current):e;a.current=n,s(n),t(n)},[c,d]=(0,l.useState)(!1),[u,f]=(0,l.useState)(!1),[m,h]=(0,l.useState)(null),b=(0,l.useRef)(null),g=function(e){let[t,n]=(0,l.useState)([]),r=t=>{if(!t.length)return;let r=[];for(let n of t){if(null===(tN[n.type]??null)){e.onError(x(p(),"img.unsupported",{name:n.name||n.type||x(p(),"img.unknownFile")}));continue}if(n.size>0xa00000){e.onError(x(p(),"img.tooLarge",{name:n.name||x(p(),"img.image")}));continue}r.push(n)}if(!r.length)return;let i=r.length<t.length;Promise.all(r.map(tS)).then(t=>{n(e=>[...e,...t]),i||e.onAdded?.()}).catch(t=>{e.onError(t instanceof Error?t.message:x(p(),"img.error"))})};return{images:t,addFiles:r,handlePaste:e=>{let t=Array.from(e.clipboardData.items).filter(e=>e.type.startsWith("image/")).map(e=>e.getAsFile()).filter(e=>null!==e);t.length&&(e.preventDefault(),r(t))},removeAt:e=>n(t=>t.filter((t,n)=>n!==e)),clear:()=>n([])}}({onError:e=>h({kind:"err",text:e}),onAdded:()=>h(null)}),w=e=>{o(t=>t?t.trimEnd()+" "+e:e),h(null),b.current?.focus()},v=t$({onError:e=>h({kind:"err",text:e}),onUnclaimedText:w,onLiveCommit:w}),k=v.liveText?(i?i.trimEnd()+" ":"")+v.liveText:i;(0,l.useLayoutEffect)(()=>{let e=b.current;e&&(e.style.height="0px",e.style.height=Math.min(e.scrollHeight+2,160)+"px")},[k]);let y=async()=>{if(!c&&!u){f(!0);try{let e=await v.stop();if(null===e)return;let t=e?a.current?a.current.trimEnd()+" "+e:e:a.current;o(t),await n(t)}finally{f(!1)}}},j="rec"===v.phase,N="busy"===v.phase,S=c||u||r,C=!S&&!N&&(j||!!i.trim()||g.images.length>0);return{text:i,textRef:a,setText:o,setTextState:s,displayText:k,inputRef:b,status:m,setStatus:h,busy:c,setBusy:d,voiceSending:u,dictation:v,attachments:g,insertSpoken:w,stopAndSend:y,submit:n,dictationRecording:j,dictationBusy:N,fieldsDisabled:S,canSend:C}}function tE({phase:e,elapsed:t,canvasRef:n,start:i,stop:l,discard:a,onText:o,busy:c=!1}){let{t:d}=h(),u=()=>{c||("idle"===e?i():"rec"===e&&l().then(e=>{e&&o(e)}))};if("rec"===e)return(0,r.jsxs)("span",{className:"flex shrink-0 items-center gap-1",children:[(0,r.jsxs)("button",{type:"button","aria-label":d("mic.stopRecognize"),onClick:u,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,r.jsx)("canvas",{ref:n,width:56,height:16,className:"h-4 w-14","aria-hidden":!0}),`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`]}),(0,r.jsx)("button",{type:"button","aria-label":d("mic.cancel"),onClick:a,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,r.jsx)(s.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})]});return(0,r.jsx)("button",{type:"button","aria-label":d("busy"===e?"mic.recognizing":"mic.dictate"),title:d("busy"===e?"mic.recognizing":"mic.dictateHint"),disabled:"busy"===e||c,onClick:u,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"===e?(0,r.jsx)(tg.A,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):(0,r.jsx)(ts.A,{className:"h-4 w-4","aria-hidden":!0})})}function tD({composer:e,placeholder:t,textareaAriaLabel:n,imageAriaLabel:i,leftSlot:s,sendLabelIdle:l,sendLabelRecording:a,sendTitleRecording:o,sendIdleClassName:c,sendIdleStyle:d}){let{displayText:u,inputRef:p,dictation:f,setText:m,attachments:x,voiceSending:h,insertSpoken:b,stopAndSend:g,submit:w,fieldsDisabled:v,canSend:k,dictationRecording:y,busy:j,status:N}=e;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("textarea",{ref:p,value:u,rows:1,readOnly:!!f.liveText,onChange:e=>m(e.target.value),onPaste:x.handlePaste,onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||e.nativeEvent.isComposing||(e.preventDefault(),"rec"===f.phase?g():w())},placeholder:t,"aria-label":n,disabled:v,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,r.jsxs)("div",{className:"flex items-center justify-between gap-1.5",children:[s,(0,r.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5",children:[(0,r.jsx)(tE,{...f,busy:h,onText:b}),(0,r.jsx)(tj,{label:i,children:(0,r.jsx)(tA,{ariaLabel:i,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:x.addFiles})}),(0,r.jsx)(tj,{label:y?o??a:l,children:(0,r.jsx)("button",{type:y?"button":"submit",onClick:y?()=>void g():void 0,disabled:!k,"aria-label":y?a:l,style:y?void 0:d,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 ${y?"border-err bg-err hover:opacity-90":c}`,children:j||h?(0,r.jsx)(tg.A,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):(0,r.jsx)(tl.A,{className:"h-4 w-4","aria-hidden":!0})})})]})]}),(0,r.jsx)(tC,{images:x.images,onRemove:x.removeAt}),N?(0,r.jsx)("span",{className:`truncate text-[10.5px] font-semibold ${"ok"===N.kind?"text-ok":"text-err"}`,children:N.text}):null]})}function tM(e){return"claude-projects"===e.root?"сесія"===e.kind||"субагент"===e.kind:"codex-sessions"===e.root}let tR="llv-compose-draft";function tP({file:e}){let{t}=h(),n=function(e,t){let[n,r]=(0,l.useState)(null);return(0,l.useEffect)(()=>{if(null===e&&!t)return;let n=!0,i=async()=>{try{let i=new URLSearchParams;null!==e&&i.set("pid",String(e)),t&&i.set("path",t);let s=await fetch(`/api/tmux?${i.toString()}`);if(!s.ok)return;let l=await s.json();n&&r(l.target??null)}catch{}};i();let s=setInterval(i,5e3);return()=>{n=!1,clearInterval(s)}},[e,t]),null!==e||t?n:null}(e.pid,tM(e)?e.path:void 0),i=tT({initialText:()=>sessionStorage.getItem("llvDraft:"+e.path)??"",persistText:t=>{t?sessionStorage.setItem("llvDraft:"+e.path,t):sessionStorage.removeItem("llvDraft:"+e.path)},submit:e=>D(e)}),{text:a,textRef:o,setText:c,setTextState:d,inputRef:u,setStatus:f,busy:m,setBusy:x,voiceSending:b,attachments:g}=i,[w,v]=(0,l.useState)(!1),[k,y]=(0,l.useState)(!1),[j,N]=(0,l.useState)(!1),[S,C]=(0,l.useState)([]);(0,l.useEffect)(()=>{if(!j)return;let e=window.setTimeout(()=>N(!1),4e3);return()=>window.clearTimeout(e)},[j]),(0,l.useEffect)(()=>C(function(e){try{let t=JSON.parse(sessionStorage.getItem("llvSent:"+e)??"[]");return Array.isArray(t)?t:[]}catch{return[]}}(e.path)),[e.path]),(0,l.useEffect)(()=>{let t=t=>{if(t.detail?.path!==e.path)return;let n=sessionStorage.getItem("llvDraft:"+e.path)??"";o.current=n,d(n),requestAnimationFrame(()=>{let e=u.current;e&&(e.focus(),e.setSelectionRange(e.value.length,e.value.length))})};return window.addEventListener(tR,t),()=>window.removeEventListener(tR,t)},[e.path,u,d,o]),(0,l.useEffect)(()=>{let t=()=>C(t=>{let n=t.filter(t=>"pane"===t.via?1e3*e.mtime<t.at+2e3&&Date.now()-t.at<6e5:Date.now()-t.at<9e4);return n.length!==t.length&&sessionStorage.setItem("llvSent:"+e.path,JSON.stringify(n)),n.length!==t.length?n:t});t();let n=setInterval(t,5e3);return()=>clearInterval(n)},[e.mtime,e.path]);let A=tM(e);if(null===n&&!A)return null;let $=null===n,T=$&&"claude-projects"===e.root&&"субагент"===e.kind,E=t=>{C(t),sessionStorage.setItem("llvSent:"+e.path,JSON.stringify(t))},D=async n=>{let r=n??a;if(!m&&!b&&(r.trim()||g.images.length)){x(!0),f(null);try{let n=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({pid:e.pid??void 0,path:e.path,text:r,images:g.images.map(e=>({base64:e.base64,mime:e.mime}))})}),i=await n.json();if(!n.ok||!i.ok)return void f({kind:"err",text:i.error??t("common.failedSend")});let s=g.images.length,l={id:Date.now(),text:r.trim()||(s?t("composer.imagesCount",{count:s}):""),at:Date.now(),via:i.spawned?"spawn":"pane"};E([...S,l].slice(-8)),c(""),g.clear(),f({kind:"ok",text:i.spawned?t("composer.spawned",{target:i.target??""}):i.imagePaths?.length?t("composer.sentPaths",{count:i.imagePaths.length}):t("common.sent")}),u.current?.focus()}catch{f({kind:"err",text:t("common.serverUnavailable")})}finally{x(!1)}}},M=async()=>{if(!w){v(!0),f(null);try{let n=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"interrupt",path:e.path})}),r=await n.json();if(!n.ok||!r.ok)return void f({kind:"err",text:r.error??t("composer.failedInterrupt")});f({kind:"ok",text:t("composer.escapeSent")})}catch{f({kind:"err",text:t("common.serverUnavailable")})}finally{v(!1)}}},R=async()=>{if(!k){y(!0),f(null);try{let n=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"compact",path:e.path})}),r=await n.json();if(!n.ok||!r.ok)return void f({kind:"err",text:r.error??t("composer.failedCompact")});f({kind:"ok",text:t("composer.compactSent")})}catch{f({kind:"err",text:t("common.serverUnavailable")})}finally{y(!1)}}};return(0,r.jsxs)("form",{onSubmit:e=>{e.preventDefault(),D()},className:"flex shrink-0 flex-col gap-1.5 border-t border-line bg-[#fbfbfd] px-2.5 py-2","aria-label":$?t("composer.spawnAria"):t("composer.sendAria",{target:n??""}),children:[S.length?(0,r.jsx)("div",{className:"flex flex-col gap-0.5","aria-label":t("composer.queueAria"),children:S.map(e=>(0,r.jsxs)("div",{className:"flex items-center justify-end gap-1.5",children:[(0,r.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:e.text,children:e.text}),(0,r.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-0.5 text-[9.5px] text-dim",children:["spawn"===e.via?(0,r.jsx)(tl.A,{className:"h-2.5 w-2.5","aria-hidden":!0}):(0,r.jsx)(e5.A,{className:"h-2.5 w-2.5","aria-hidden":!0}),new Date(e.at).toLocaleTimeString("uk"===p()?"uk-UA":"en-US",{hour12:!1,hour:"2-digit",minute:"2-digit"})]}),(0,r.jsx)("button",{type:"button","aria-label":t("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(S.filter(t=>t.id!==e.id)),children:(0,r.jsx)(s.A,{className:"h-3 w-3","aria-hidden":!0})})]},e.id))}):null,(0,r.jsx)(tD,{composer:i,placeholder:T?t("composer.placeholderRelay"):$?t("composer.placeholderSpawn"):t("composer.placeholderSend"),textareaAriaLabel:t("composer.textAria"),imageAriaLabel:t("composer.addImages"),sendLabelIdle:$?t("composer.launchAgent"):t("composer.sendToAgent"),sendLabelRecording:t("composer.stopAndSend"),sendTitleRecording:t("composer.stopAndSendTitle"),sendIdleClassName:"border-accent bg-accent hover:opacity-90",leftSlot:(0,r.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5",children:[(0,r.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:T?t("composer.titleRelay"):$?t("composer.titleSpawnResumed"):`tmux ${n}`,children:T?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(e2.A,{className:"h-3 w-3 shrink-0","aria-hidden":!0})," ",t("composer.root")]}):$?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(tl.A,{className:"h-3 w-3 shrink-0","aria-hidden":!0})," resume"]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(tc.A,{className:"h-3 w-3 shrink-0","aria-hidden":!0})," ",(0,r.jsx)("span",{className:"truncate",children:n})]})}),$?null:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(tj,{label:t("composer.interruptTitle"),children:(0,r.jsx)("button",{type:"button","aria-label":t("composer.interruptAria"),disabled:w,onClick:()=>void M(),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:w?(0,r.jsx)(tg.A,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):(0,r.jsx)(to.A,{className:"h-4 w-4",fill:"currentColor","aria-hidden":!0})})}),(0,r.jsx)(tj,{label:j?t("composer.compactConfirmTitle"):t("composer.compactTitle"),children:(0,r.jsx)("button",{type:"button","aria-label":j?t("composer.compactConfirmTitle"):t("composer.compactAria"),disabled:k,onClick:()=>{j?(N(!1),R()):N(!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 ${j?"border-[#0d9488] bg-[#e3f4f0] text-[#0b7c72]":"border-line bg-panel text-dim hover:border-[#0d9488]/50 hover:text-[#0b7c72]"}`,children:k?(0,r.jsx)(tg.A,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):j?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(e6.A,{className:"h-4 w-4","aria-hidden":!0}),(0,r.jsx)("span",{className:"text-[10.5px] font-bold",children:t("composer.compactConfirm")})]}):(0,r.jsx)(tt.A,{className:"h-4 w-4","aria-hidden":!0})})})]})]})})]})}let tI="#0d9488",t_=new Map;function tL(){for(let e of document.querySelectorAll("[data-link-hover]"))e.removeAttribute("data-link-hover")}function tz(e,t,n,r){let i=Math.max(48,.45*Math.abs(n-e));return`M ${e} ${t} C ${e+i} ${t}, ${n-i} ${r}, ${n} ${r}`}function tO(e){let[t,n]=(0,l.useState)(!1),i=(0,l.useRef)(e);(0,l.useEffect)(()=>{i.current=e},[e]);let[s,a]=(0,l.useState)(null),[o,c]=(0,l.useState)(null),d=(0,l.useRef)(null),u=(0,l.useRef)(!1),p=(0,l.useRef)(!1),f=(0,l.useRef)(null),m="link-arrow-"+(0,l.useId)().replace(/[^a-zA-Z0-9-]/g,"");return(0,l.useEffect)(()=>()=>{d.current?.detach(),d.current=null,document.body.style.cursor="",tL()},[]),(0,l.useEffect)(()=>{if(!o)return;let e=window.setTimeout(()=>{tL(),c(null)},1600);return()=>window.clearTimeout(e)},[o]),{onPillPointerDown:e=>{if("mouse"===e.pointerType&&0!==e.button||d.current)return;let t=e.currentTarget.getBoundingClientRect(),r=e=>{let t=d.current;if(!t)return;if(t.lastX=e.clientX,t.lastY=e.clientY,!t.active){if(7>Math.hypot(e.clientX-t.startX,e.clientY-t.startY))return;t.active=!0,u.current=!0,p.current=!0,document.body.style.cursor="crosshair",tL(),c(null),a({x:t.anchorX,y:t.anchorY}),n(!0),i.current.onDragStart?.()}f.current?.setAttribute("d",tz(t.anchorX,t.anchorY,e.clientX,e.clientY));let r=function(e,t,n){let r=document.elementFromPoint(e,t)?.closest("[data-link-path]"),i=r?.getAttribute("data-link-path");if(!r||!i||i===n)return null;let s=t_.get(i);return s&&s.el===r?s:null}(e.clientX,e.clientY,i.current.exclude??null);r?.el!==t.hover?.el&&(t.hover?.el.removeAttribute("data-link-hover"),r?.el.setAttribute("data-link-hover","1"),t.hover=r)},s=e=>{let t=d.current;if(d.current=null,t?.detach(),u.current=!1,document.body.style.cursor="",t?.active)if(n(!1),t.hover){let n=i.current.onDrop(t.hover,{x:e.clientX,y:e.clientY});null!==n?c({label:n,from:{x:t.anchorX,y:t.anchorY},to:{x:e.clientX,y:e.clientY}}):tL()}else tL(),i.current.onMiss?.({x:e.clientX,y:e.clientY})};d.current={startX:e.clientX,startY:e.clientY,anchorX:t.right,anchorY:t.top+t.height/2,lastX:e.clientX,lastY:e.clientY,active:!1,hover:null,detach:()=>{window.removeEventListener("pointermove",r),window.removeEventListener("pointerup",s),window.removeEventListener("pointercancel",s)}},window.addEventListener("pointermove",r),window.addEventListener("pointerup",s),window.addEventListener("pointercancel",s)},consumeClick:()=>{let e=p.current;return p.current=!1,e},draggingRef:u,overlay:t||o?(0,ty.createPortal)((0,r.jsxs)("div",{className:"pointer-events-none fixed inset-0 z-[95]",children:[(0,r.jsxs)("svg",{className:"block h-full w-full",children:[(0,r.jsx)("defs",{children:(0,r.jsx)("marker",{id:m,markerWidth:"9",markerHeight:"9",refX:"7",refY:"4.5",orient:"auto",children:(0,r.jsx)("path",{d:"M0,0 L8,4.5 L0,9 Z",fill:tI})})}),(0,r.jsx)("path",{ref:e=>{f.current=e;let t=d.current;e&&t?.active&&e.setAttribute("d",tz(t.anchorX,t.anchorY,t.lastX,t.lastY))},d:o?tz(o.from.x,o.from.y,o.to.x,o.to.y):void 0,fill:"none",stroke:tI,strokeWidth:2.5,strokeLinecap:"round",markerEnd:`url(#${m})`}),(0,r.jsx)("circle",{cx:o?o.from.x:s?.x??0,cy:o?o.from.y:s?.y??0,r:4,fill:tI})]}),o?(0,r.jsx)(tq,{drop:o}):null]}),document.body):null}}function tq({drop:e}){let t=Math.max(8,Math.min(e.to.x+14,window.innerWidth-288)),n=Math.max(8,Math.min(e.to.y+12,window.innerHeight-44));return(0,r.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:t,top:n,backgroundColor:tI},children:[(0,r.jsx)(tk.A,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),(0,r.jsx)("span",{className:"truncate",children:e.label})]})}function tF({file:e,onDeleted:t}){let{t:n}=h(),[i,s]=(0,l.useState)(!1),[a,o]=(0,l.useState)(!1),[c,d]=(0,l.useState)("");if((0,l.useEffect)(()=>{if(!i)return;let e=window.setTimeout(()=>s(!1),5e3);return()=>window.clearTimeout(e)},[i]),"running"===e.proc)return null;let u=async()=>{o(!0),d("");try{let r=await fetch(`/api/log?path=${encodeURIComponent(e.path)}`,{method:"DELETE"}),i=await r.json();if(!r.ok||!i.ok)return void d(i.error??n("common.failedDelete"));s(!1),t?.()}catch{d(n("common.serverUnavailable"))}finally{o(!1)}};return i?(0,r.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,r.jsx)("span",{className:"px-0.5 font-semibold text-err",children:n("delFile.confirm")}),(0,r.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:a,onClick:u,children:a?"…":n("common.yes")}),(0,r.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:()=>s(!1),children:n("common.no")})]}):(0,r.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1",children:[(0,r.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":n("delFile.aria"),title:n("delFile.aria"),onClick:()=>s(!0),children:(0,r.jsx)(td.A,{className:"h-3 w-3","aria-hidden":!0})}),c?(0,r.jsx)("span",{className:"max-w-[160px] truncate text-[10.5px] font-semibold text-err",title:c,children:c}):null]})}function tU({className:e,style:t,enter:n="scale",children:i}){let s=(0,l.useRef)(null);return!function(e,t="scale"){let n=(0,l.useRef)(new Map),r=(0,l.useRef)(new WeakMap),i=(0,l.useRef)(!0);(0,l.useLayoutEffect)(()=>{let s=e.current;if(!s)return;let l="u">typeof matchMedia&&matchMedia("(prefers-reduced-motion: reduce)").matches,a=s.getBoundingClientRect(),o=[...s.children].filter(e=>e instanceof HTMLElement&&void 0!==e.dataset.flipKey),c=new Map;for(let e of o){let o=e.dataset.flipKey,d=e.getBoundingClientRect(),u=r.current.get(e);u&&(u.cancel(),r.current.delete(e));let p=e.getBoundingClientRect(),f={x:p.left-a.left+s.scrollLeft,y:p.top-a.top+s.scrollTop},m=n.current.get(o);if(c.set(o,f),l||i.current||void 0!==e.dataset.flipSkip)continue;if(!m){if("none"===t)continue;let n="fade"===t?[{opacity:0},{opacity:1}]:[{opacity:0,transform:"scale(0.96)"},{opacity:1,transform:"scale(1)"}],i=e.animate(n,{duration:"fade"===t?120:240,easing:"ease-out"});r.current.set(e,i),i.addEventListener("finish",()=>r.current.delete(e));continue}let x=m.x-f.x+(d.left-p.left),h=m.y-f.y+(d.top-p.top);if(2>Math.abs(x)&&2>Math.abs(h))continue;let b=e.animate([{transform:`translate(${x}px, ${h}px)`},{transform:"translate(0px, 0px)"}],{duration:280,easing:"cubic-bezier(0.22, 0.72, 0.3, 1)"});r.current.set(e,b),b.addEventListener("finish",()=>r.current.delete(e))}n.current=c,i.current=!1})}(s,n),(0,r.jsx)("div",{ref:s,className:e,style:t,children:i})}var tH=n(4760);let tB=e=>new TextEncoder().encode(e).length,tW=/^\s*(?:VERDICT:\s*)?(REQUEST_CHANGES|APPROVE|COMMENT)\b/m,tK=/^\s*(\d+)[.)]\s+(.*)$/,tY=/(?:\[(P[0-3])\]|\b(Critical|High|Medium|Low|Info|P[0-3])\b)/i,tJ=/((?:\.{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,tQ=/\[([^\]]+)\]\(([^)\s]+)\)/,tX=/([\w.-]*(?:api[_-]?key|access[_-]?token|refresh[_-]?token|authorization|bearer|secret|password|passwd|pwd|token))\b(\s*[:=]\s*)(["']?)[^\s"',}]+/gi;function tG(e){return e.replace(tX,(e,t,n,r)=>`${t}${n}${r}[redacted]`)}function tV(e){let t=tG(e);return{raw:t.slice(0,24e3),truncated:t.length>24e3}}function tZ(e){let t=e.match(/^(.*?):(\d+(?:-\d+)?)$/);return t?{target:t[1]??e,line:t[2]}:{target:e}}function t0(e,t){let n=e.match(tW)?.[1];if(!n)return null;let r=[],i=[],s=null,l=()=>{let e,t,n,i=s?.trim();i&&r.push((e=function(e){let t=e.toUpperCase();if("P0"===t||"P1"===t||"P2"===t||"P3"===t)return t;let n=e.toLowerCase();return"critical"===n?"Critical":"high"===n?"High":"medium"===n?"Medium":"low"===n?"Low":"Info"}(i.match(tY)?.[1]??i.match(tY)?.[2]??"Info"),t=function(e){let t=e.match(tQ);if(t){let e=tZ((t[2]??"").replace(/^file:\/\//,"")),n=e.line?Number(e.line.split("-",1)[0]):void 0;return{file:e.target||t[1],line:Number.isFinite(n)?n:void 0}}let n=e.match(tJ);if(!n)return{};let r=n[2]?Number(n[2]):void 0;return{file:n[1],line:Number.isFinite(r)?r:void 0}}(i),n=function(e){let t=e,n=t.match(tY);if(n&&void 0!==n.index){let e=t.slice(n.index+n[0].length).replace(/^[\s.:–—-]+/,"");e&&(t=e)}return t.replace(tQ,"$1").replace(/`([^`]*)`/g,"$1").replace(/\s+/g," ").trim().slice(0,200)}(i)||i.slice(0,200)||"Finding",{severity:e,file:t.file,line:t.line,title:n,body:tV(i).raw})),s=null};for(let t of e.split("\n")){let e=t.trimEnd(),n=e.match(tK);if(n){l(),s=n[2]??"";continue}let a=e.trim();if(null!==s){a?s=`${s}
|
|
2
|
+
${a}`:l();continue}!(!a||tW.test(e)||/^(findings?|summary|open questions?|tests?|residual risk)\s*:?\s*$/i.test(a))&&0===r.length&&i.length<3&&a.length<=240&&i.push(a)}l();let a=r.filter(e=>tY.test(e.body)).length;return n||/^findings?\s*:?$/im.test(e)||a>=2||a>=1&&/\b(review|request_changes|approve|comment)\b/i.test(e)?{kind:"review",ts:t,verdict:n,findings:r,summary:i,raw:tV(e).raw}:null}let t1=(e,t)=>x(p(),e,t),t5=/<oai-mem-citation>\s*<citation_entries>([\s\S]*?)<\/citation_entries>\s*<rollout_ids>([\s\S]*?)<\/rollout_ids>\s*<\/oai-mem-citation>/g;function t2(e){return"number"==typeof e&&Number.isFinite(e)?e:void 0}let t3=/<(teammate-message|agent-message)\b([^>]*)>([\s\S]*?)<\/\1>/g,t4=/\S*\/\.claude\/viewer-inbox\/([A-Za-z0-9._-]+\.(?:png|jpe?g|gif|webp))/gi;function t6(e){if(!e.includes("/.claude/viewer-inbox/"))return{cleaned:e,images:[]};let t=[],n=new Set,r=[];for(let i of e.split("\n"))i.replace(t4,(e,r)=>(n.has(e)||(n.add(e),t.push({name:r,path:e})),"")).trim()&&r.push(i);return{cleaned:r.join("\n").trim(),images:t}}let t8=/^\s*(?:<[a-zA-Z][\w:-]*|Caveat: The messages below|\[Request interrupted|This came from another Claude session|# AGENTS\.md instructions)/;function t9(e,t){let n=e.match(/^\s*<([a-zA-Z][\w:-]*)/)?.[1];return n||(/^\s*# AGENTS\.md/.test(e)?"AGENTS.md":/^\s*Caveat:/.test(e)?"caveat":t||t1("render.system"))}function t7(e,t){return e.match(RegExp(`${t}="([^"]*)"`))?.[1]??""}function ne(e){return"string"==typeof e?e:""}function nt(e){return e&&"object"==typeof e&&!Array.isArray(e)?e:{}}function nn(e){return Array.isArray(e)?e.filter(e=>e&&"object"==typeof e&&!Array.isArray(e)):[]}function nr(e,t,n){let r=t.split("\n").map(e=>e.trim()).filter(Boolean).map(e=>{let t=e.match(/\|note=\[(.*)\]$/)?.[1],n=tZ(e.replace(/\|note=\[.*\]$/,""));return{target:n.target,line:n.line,note:t,raw:e}}),i=n.split(/\s+/).map(e=>e.trim()).filter(e=>/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)),s=tV(e);return{kind:"mem-citation",entries:r,rolloutIds:i,raw:s.raw,truncated:s.truncated}}function ni(e,t,n){if(!e)return null;let r=t.match(/exited with code (\d+)/)?.[1],i=t.replace(/^Chunk ID:[^\n]*\n/,"").replace(/Wall time:[^\n]*\n/,"").replace(/Original token count:[^\n]*\n?/,"").trim(),s=!0===n||void 0!==r&&"0"!==r;return e.status=s?"err":"ok",e.label=s?r&&"0"!==r?"exit "+r:t1("render.error"):"ok",e.open||=s,i&&(e.output=(e.output+"\n"+tG(i)).trim().slice(-(s?6e4:12e3))),e}var ns=n(6565),nl=n(2125);function na({src:e,alt:t,caption:n,onClose:i}){let{t:a}=h(),[o,c]=(0,l.useState)(1),[d,u]=(0,l.useState)(0),[p,f]=(0,l.useState)(0),[m,x]=(0,l.useState)(!1),b=(0,l.useRef)(null);(0,l.useEffect)(()=>{let e=e=>{"Escape"===e.key&&i()};window.addEventListener("keydown",e);let t=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{window.removeEventListener("keydown",e),document.body.style.overflow=t}},[i]);let g=(e,t=0,n=0)=>{let r=Math.min(8,Math.max(.25,o*e)),i=r/o;c(r),u(t-(t-d)*i),f(n-(n-p)*i)},w=()=>{c(1),u(0),f(0)};return(0,ty.createPortal)((0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex flex-col bg-black/85 backdrop-blur-sm",role:"dialog","aria-modal":"true","aria-label":t,onClick:i,children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 px-4 py-2.5",onClick:e=>e.stopPropagation(),children:[(0,r.jsx)("span",{className:"min-w-0 truncate text-[12.5px] font-semibold text-white/85",children:n??t}),(0,r.jsxs)("span",{className:"ml-auto flex items-center gap-1.5",children:[(0,r.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":a("lightbox.zoomOut"),onClick:()=>g(1/1.4),children:(0,r.jsx)(ns.A,{className:"h-4 w-4","aria-hidden":!0})}),(0,r.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":a("lightbox.resetZoom"),onClick:w,children:[Math.round(100*o),"%"]}),(0,r.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":a("lightbox.zoomIn"),onClick:()=>g(1.4),children:(0,r.jsx)(nl.A,{className:"h-4 w-4","aria-hidden":!0})}),(0,r.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":a("common.close"),onClick:i,children:(0,r.jsx)(s.A,{className:"h-4 w-4","aria-hidden":!0})})]})]}),(0,r.jsx)("div",{className:"min-h-0 flex-1 touch-none overflow-hidden",onClick:e=>e.stopPropagation(),onWheel:e=>{let t=e.currentTarget.getBoundingClientRect(),n=e.clientX-t.left-t.width/2,r=e.clientY-t.top-t.height/2;g(e.deltaY<0?1.18:1/1.18,n,r)},onPointerDown:e=>{e.currentTarget.setPointerCapture(e.pointerId),b.current={x:e.clientX,y:e.clientY,tx:d,ty:p},x(!0)},onPointerMove:e=>{b.current&&(u(b.current.tx+(e.clientX-b.current.x)),f(b.current.ty+(e.clientY-b.current.y)))},onPointerUp:()=>{b.current=null,x(!1)},onPointerCancel:()=>{b.current=null,x(!1)},onDoubleClick:()=>1===o?g(2):w(),children:(0,r.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,r.jsx)("img",{src:e,alt:t,draggable:!1,className:`max-h-full max-w-full select-none ${m?"":"transition-transform duration-75"} ${o>1?"cursor-grab active:cursor-grabbing":"cursor-zoom-in"}`,style:{transform:`translate(${d}px, ${p}px) scale(${o})`}})})})]}),document.body)}function no({name:e,path:t}){let{t:n}=h(),[i,s]=(0,l.useState)("thumb"),[a,o]=(0,l.useState)(null),[c,d]=(0,l.useState)(!1),[u,p]=(0,l.useState)(!1),[f,m]=(0,l.useState)("");(0,l.useEffect)(()=>{if(!c)return;let e=window.setTimeout(()=>d(!1),5e3);return()=>window.clearTimeout(e)},[c]);let x=`/api/inbox?name=${encodeURIComponent(e)}`,b=async()=>{p(!0),m("");try{let e=await fetch(x,{method:"DELETE"}),t=await e.json();if(!e.ok||!t.ok)return void m(t.error??n("common.failedDelete"));o("deleted")}catch{m(n("common.serverUnavailable"))}finally{p(!1),d(!1)}};return a?(0,r.jsx)("div",{className:"my-2 flex justify-end",children:(0,r.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:t,children:[(0,r.jsx)(tv,{name:"image",className:"h-3.5 w-3.5"}),(0,r.jsx)("span",{className:"truncate",children:e}),(0,r.jsxs)("span",{className:"shrink-0",children:["\xb7 ","deleted"===a?n("inbox.deleted"):n("inbox.fileGone")]})]})}):"chip"===i?(0,r.jsx)("div",{className:"my-2 flex justify-end",children:(0,r.jsxs)("button",{type:"button",onClick:()=>s("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:t,children:[(0,r.jsx)("span",{className:"flex h-6.5 w-6.5 shrink-0 items-center justify-center rounded-lg bg-chip",children:(0,r.jsx)(tv,{name:"image",className:"h-4 w-4"})}),(0,r.jsx)("span",{className:"truncate font-mono text-[12px]",children:e}),(0,r.jsx)("span",{className:"shrink-0 text-[12px] font-semibold text-accent",children:n("common.show")})]})}):(0,r.jsxs)("div",{className:"my-2 flex justify-end",children:[(0,r.jsxs)("div",{className:"max-w-[75%]",children:[(0,r.jsx)("img",{src:x,alt:n("inbox.attachedAlt",{name:e}),onClick:()=>s("full"),onError:()=>o("missing"),className:"ml-auto block max-h-[240px] cursor-zoom-in rounded-[14px] border border-line"}),(0,r.jsxs)("div",{className:"mt-1 flex flex-wrap items-center justify-end gap-1.5 text-[11px]",children:[(0,r.jsx)("span",{className:"min-w-0 truncate font-mono text-dim",title:t,children:e}),(0,r.jsx)("button",{type:"button",onClick:()=>s("chip"),className:"shrink-0 text-dim hover:text-ink",children:n("common.collapse")}),c?(0,r.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,r.jsx)("span",{className:"px-1 font-semibold text-err",children:n("inbox.confirmDelete")}),(0,r.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:u,onClick:b,children:u?n("trash.deleting"):n("trash.confirmYes")}),(0,r.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:()=>d(!1),children:n("common.cancel")})]}):(0,r.jsxs)("button",{type:"button",onClick:()=>d(!0),"aria-label":n("inbox.deleteAria",{name:e}),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,r.jsx)(td.A,{className:"h-3 w-3","aria-hidden":!0})," ",n("inbox.deleteFromDisk")]}),f?(0,r.jsx)("span",{className:"shrink-0 font-semibold text-err",children:f}):null]})]}),"full"===i?(0,r.jsx)(na,{src:x,alt:n("inbox.attachedAlt",{name:e}),caption:t,onClose:()=>s("thumb")}):null]})}let nc=/(`[^`]+`|\*\*[^*]+\*\*|\[[^\]]+\]\([^)\s]+\)|https?:\/\/[^\s<>"')\]]+)/g;function nd({href:e,label:t}){return(0,r.jsx)("a",{href:e,target:"_blank",rel:"noreferrer",title:e,className:"break-all text-accent underline decoration-accent/40 underline-offset-2 hover:decoration-accent",children:t})}function nu(e){return e.split(nc).map((e,t)=>{if(!e)return null;if(e.startsWith("`")&&e.endsWith("`"))return(0,r.jsx)("span",{className:"rounded-md bg-chip px-1.5 py-0.5 font-mono",children:e.slice(1,-1)},t);if(e.startsWith("**")&&e.endsWith("**"))return(0,r.jsx)("b",{children:e.slice(2,-2)},t);let n=e.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);if(n){let e=n[2].replace(/\\([()])/g,"$1");return/^https?:\/\//.test(e)?(0,r.jsx)(nd,{href:e,label:n[1]},t):(0,r.jsx)("span",{className:"rounded-md bg-chip px-1.5 py-0.5 font-mono",children:n[1]},t)}if(/^https?:\/\//.test(e)){let n=e.replace(/[.,;:!?…»)]+$/,""),i=e.slice(n.length),s=n.length>72?n.slice(0,69)+"…":n;return(0,r.jsxs)("span",{children:[(0,r.jsx)(nd,{href:n,label:s}),i]},t)}return e})}let np=/^\s*\|.*\|\s*$/,nf=/^:?-{1,}:?$/;function nm({rows:e}){let t=e.map(e=>e.trim().replace(/^\|/,"").replace(/\|$/,"").split("|").map(e=>e.trim())),n=t.length>1&&t[1].every(e=>nf.test(e)),i=n?t[0]:null,s=n?t.slice(2):t;return(0,r.jsx)("div",{className:"my-1.5 max-w-full overflow-x-auto",children:(0,r.jsxs)("table",{className:"border-collapse text-[12.5px]",children:[i?(0,r.jsx)("thead",{children:(0,r.jsx)("tr",{children:i.map((e,t)=>(0,r.jsx)("th",{className:"border border-line bg-chip px-2.5 py-1 text-left font-semibold",children:nu(e)},t))})}):null,(0,r.jsx)("tbody",{children:s.map((e,t)=>(0,r.jsx)("tr",{children:e.map((e,t)=>(0,r.jsx)("td",{className:"border border-line px-2.5 py-1 align-top",children:nu(e)},t))},t))})]})})}function nx(e){let t=e.split("\n"),n=[],i=0;for(;i<t.length;){if(/^\s*```/.test(t[i])){let e=i;for(i++;i<t.length&&!/^\s*```\s*$/.test(t[i]);)i++;let s=t.slice(e+1,i).join("\n");i<t.length&&i++,"\n"===n[n.length-1]&&n.pop(),n.push((0,r.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:s},`c${e}`));continue}if(np.test(t[i])){let e=i;for(;i<t.length&&np.test(t[i]);)i++;"\n"===n[n.length-1]&&n.pop(),n.push((0,r.jsx)(nm,{rows:t.slice(e,i)},`t${e}`));continue}let e=t[i],s=e.match(/^#{1,6}\s+(.*)$/),a=e.match(/^>\s?(.*)$/);s?n.push((0,r.jsx)("span",{className:"text-[14px] font-bold",children:nu(s[1])},i)):a?n.push((0,r.jsx)("span",{className:"border-l-2 border-line pl-2 text-dim",children:nu(a[1])},i)):n.push((0,r.jsx)(l.Fragment,{children:nu(e)},i)),++i<t.length&&n.push("\n")}return n}function nh({bytes:e,text:t}){let[n,i]=(0,l.useState)(!1),s=Math.round(e/1024);return n?(0,r.jsxs)("div",{className:"my-2 ml-9 overflow-hidden rounded-[14px] border border-line bg-panel shadow-card",children:[(0,r.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:t}),(0,r.jsx)("button",{type:"button",onClick:()=>i(!1),className:"block w-full border-t border-line px-3.5 py-1.5 text-[12px] text-dim",children:t1("common.collapse")})]}):(0,r.jsxs)("button",{type:"button",onClick:()=>i(!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,r.jsx)("span",{className:"flex h-6.5 w-6.5 items-center justify-center rounded-lg bg-chip",children:(0,r.jsx)(tv,{name:"blob",className:"h-4 w-4"})}),(0,r.jsx)("span",{className:"font-semibold",children:t1("render.dataKb",{n:s})}),(0,r.jsx)("span",{className:"ml-1 text-[12px] font-semibold text-accent",children:t1("common.show")})]})}let nb=/(?:\/\.codex\/sessions\/|\/\.claude\/projects\/|\/\.claude\/plugins\/data\/codex-openai-codex\/state\/|^\/tmp\/claude-\d+\/)/;function ng({status:e,className:t}){let n=t??"h-3.5 w-3.5";return"ok"===e?(0,r.jsx)(e6.A,{className:n,"aria-hidden":!0}):"err"===e?(0,r.jsx)(s.A,{className:n,"aria-hidden":!0}):(0,r.jsx)(tg.A,{className:`${n} animate-spin`,"aria-hidden":!0})}function nw({file:e,line:t}){let n=t?`${e}:${t}`:e,i="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 nb.test(e)?(0,r.jsx)("a",{href:`#f=${encodeURIComponent(e)}`,className:`${i} text-accent underline decoration-dotted`,title:n,children:n}):(0,r.jsx)("code",{className:i,title:n,children:n})}function nv({item:e}){let t=Object.entries(e.byTool).map(([e,t])=>`${e} \xd7${t}`).join(" \xb7 "),n=X(e.t0),i=X(e.t1),l=n&&i&&n!==i?`${n}–${i}`:n||i;return(0,r.jsxs)("details",{className:`my-2.5 ml-9 overflow-hidden rounded-[14px] border shadow-card ${e.hasErr?"border-err/35 bg-[#fff4f4]":"border-line bg-panel"}`,open:e.hasErr,children:[(0,r.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-2.5 px-3.5 py-2",children:[(0,r.jsx)("span",{className:"flex h-6.5 w-6.5 shrink-0 items-center justify-center rounded-lg bg-chip",children:(0,r.jsx)(tv,{name:"cmd-group",className:"h-4 w-4"})}),(0,r.jsxs)("span",{className:"flex min-w-0 flex-1 items-center gap-1 truncate text-[12.5px]",children:[t1("render.commands",{count:e.calls.length}),t?" \xb7 "+t:""," \xb7",(0,r.jsxs)("span",{className:"inline-flex items-center gap-0.5 text-ok",children:[(0,r.jsx)(e6.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),e.okCount]}),e.errCount?(0,r.jsxs)("span",{className:"inline-flex items-center gap-0.5 text-err",children:[(0,r.jsx)(s.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),e.errCount]}):null]}),l?(0,r.jsx)("span",{className:"ml-auto shrink-0 text-[11px] text-dim",children:l}):null]}),(0,r.jsx)("div",{className:"space-y-1 border-t border-line bg-[#fafafc] px-2 py-1.5",children:e.calls.map((t,n)=>{let i="ok"===t.status?"text-ok":"err"===t.status?"text-err":"text-dim";return(0,r.jsxs)("details",{className:"overflow-hidden rounded-[10px] border border-line bg-panel",open:t.open,children:[(0,r.jsxs)("summary",{className:"flex h-6 cursor-pointer list-none items-center gap-2 px-2.5 text-[11.5px]",children:[(0,r.jsx)("span",{className:"flex h-4.5 w-4.5 shrink-0 items-center justify-center rounded-md bg-chip",children:(0,r.jsx)(tv,{name:t.icon,className:"h-3 w-3"})}),(0,r.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:t.display}),(0,r.jsxs)("span",{className:`ml-auto inline-flex shrink-0 items-center gap-1 text-[10.5px] font-semibold ${i}`,children:[(0,r.jsx)(ng,{status:t.status,className:"h-3 w-3"}),t.label]})]}),(0,r.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:"$ "+t.cmd+(t.output?"\n"+t.output:"")})]},e.ids[n])})})]})}function nk({item:e}){let t=[e.trigger?t1("auto"===e.trigger?"render.compactAuto":"render.compactManual"):"",e.preTokens?t1("render.compactPre",{n:Math.round(e.preTokens/1e3)}):"",X(e.ts)||""].filter(Boolean).join(" \xb7 ");return(0,r.jsxs)("div",{className:"my-3.5",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,r.jsx)("span",{className:"h-px flex-1 bg-[#0d9488]/30","aria-hidden":!0}),(0,r.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,r.jsx)(tv,{name:"compact",className:"h-3.5 w-3.5"}),t1("render.compacted"),t?(0,r.jsx)("span",{className:"font-semibold opacity-75",children:t}):null]}),(0,r.jsx)("span",{className:"h-px flex-1 bg-[#0d9488]/30","aria-hidden":!0})]}),e.summary?(0,r.jsxs)("details",{className:"group/cmp mt-1.5 text-center",children:[(0,r.jsxs)("summary",{className:"cursor-pointer list-none text-[11px] font-semibold text-[#0b7c72] [&::-webkit-details-marker]:hidden",children:[(0,r.jsxs)("span",{className:"group-open/cmp:hidden",children:[t1("render.compactSummary")," \xb7 ",t1("common.show")]}),(0,r.jsx)("span",{className:"hidden group-open/cmp:inline",children:t1("common.collapse")})]}),(0,r.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:e.summary})]}):null]})}function ny({media:e,data:t,w:n,h:i,bytes:s}){let[a,o]=(0,l.useState)("thumb"),c=Math.round((s??3*t.length/4)/1024),d=n&&i?`${n}\xd7${i}`:t1("render.image");if("chip"===a)return(0,r.jsxs)("button",{type:"button",onClick:()=>o("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,r.jsx)("span",{className:"flex h-6.5 w-6.5 items-center justify-center rounded-lg bg-chip",children:(0,r.jsx)(tv,{name:"image",className:"h-4 w-4"})}),(0,r.jsx)("span",{className:"font-semibold",children:d}),(0,r.jsxs)("span",{className:"text-dim",children:["\xb7 ",c," ",t1("common.kb")]}),(0,r.jsx)("span",{className:"ml-1 text-[12px] font-semibold text-accent",children:t1("common.show")})]});let u=`data:${e};base64,${t}`;return(0,r.jsxs)("div",{className:"my-2 ml-9",children:[(0,r.jsx)("img",{src:u,alt:`${t1("render.image")} ${d}`,onClick:()=>o("full"),className:"max-h-[240px] cursor-zoom-in rounded-[14px] border border-line"}),(0,r.jsx)("button",{type:"button",onClick:()=>o("chip"),className:"mt-1 block text-[12px] text-dim",children:t1("common.collapse")}),"full"===a?(0,r.jsx)(na,{src:u,alt:`${t1("render.image")} ${d}`,caption:`${d} \xb7 ${c} ${t1("common.kb")}`,onClose:()=>o("thumb")}):null]})}function nj({item:e}){let t=e.entries.slice(0,8),n=e.rolloutIds.slice(0,6);return(0,r.jsxs)("details",{className:"group my-2 ml-9 overflow-hidden rounded-[14px] border border-line bg-panel text-[12px] shadow-card",children:[(0,r.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-2 px-3.5 py-2",children:[(0,r.jsx)("span",{className:"flex h-6.5 w-6.5 shrink-0 items-center justify-center rounded-lg bg-chip",children:(0,r.jsx)(tv,{name:"citation",className:"h-4 w-4"})}),(0,r.jsx)("span",{className:"text-[13px] font-semibold",children:t1("render.memoryCitations",{count:e.entries.length})}),(0,r.jsx)("span",{className:"ml-auto text-[11px] font-semibold text-accent group-open:hidden",children:t1("common.show")}),(0,r.jsx)("span",{className:"ml-auto hidden text-[11px] font-semibold text-accent group-open:inline",children:t1("common.collapse")})]}),(0,r.jsxs)("div",{className:"border-t border-line px-3.5 py-2.5",children:[t.length?(0,r.jsx)("div",{className:"space-y-1.5",children:t.map((e,t)=>(0,r.jsxs)("div",{className:"min-w-0 rounded-[9px] bg-[#fbfbfd] px-2.5 py-1.5",children:[(0,r.jsx)(nw,{file:e.target,line:e.line?Number(e.line.split("-",1)[0]):void 0}),e.note?(0,r.jsx)("div",{className:"mt-1 whitespace-pre-wrap break-words text-[12px] text-[#555]",children:e.note}):null]},t))}):(0,r.jsx)("div",{className:"text-[12px] text-dim",children:t1("render.noCitations")}),e.entries.length>t.length?(0,r.jsx)("div",{className:"mt-1.5 text-[12px] text-dim",children:t1("render.moreEntries",{count:e.entries.length-t.length})}):null,n.length?(0,r.jsxs)("div",{className:"mt-2 flex flex-wrap items-center gap-1.5",children:[(0,r.jsx)("span",{className:"text-[11px] text-dim",children:"rollout:"}),n.map(e=>(0,r.jsx)("code",{className:"rounded-full bg-chip px-2 py-0.5 font-mono text-[10.5px] text-dim",title:e,children:e.slice(0,8)},e)),e.rolloutIds.length>n.length?(0,r.jsxs)("span",{className:"text-[11px] text-dim",children:["+",e.rolloutIds.length-n.length]}):null]}):null,(0,r.jsxs)("details",{className:"mt-2 rounded-[10px] border border-line bg-[#fafafc] text-[12px]",children:[(0,r.jsxs)("summary",{className:"cursor-pointer list-none px-3 py-1.5 font-semibold text-dim",children:["raw citation block",e.truncated?" \xb7 "+t1("render.truncated"):""]}),(0,r.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:e.raw})]})]})]})}let nN={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 nS(e){return"string"==typeof e&&e.length?e:void 0}function nC({approve:e}){return(0,r.jsx)("span",{className:`rounded-full border px-2 py-0.5 text-[10.5px] font-extrabold ${e?"border-ok/25 bg-[#eefaf1] text-ok":"border-err/25 bg-[#fff0f0] text-err"}`,children:e?t1("render.approved"):t1("render.rejected")})}function nA({payload:e}){let t=nS(e.from),n=nS(e.requestId),i=X(e.timestamp);return t||n||i?(0,r.jsxs)("div",{className:"mt-1.5 flex flex-wrap items-center gap-x-2.5 gap-y-1 text-[11px] text-dim",children:[t?(0,r.jsx)("span",{children:t1("render.from",{from:t})}):null,n?(0,r.jsx)("span",{className:"truncate font-mono",title:n,children:n.length>40?n.slice(0,40)+"…":n}):null,i?(0,r.jsx)("span",{children:i}):null]}):null}function n$({payload:e}){let t=nS(e.type),n=t?nN[t]:void 0;if(!n)return(0,r.jsxs)("div",{className:"text-[13px]",children:[(0,r.jsx)("div",{className:"text-dim",children:t1("render.structured")}),(0,r.jsxs)("details",{className:"mt-1 text-[12px]",children:[(0,r.jsx)("summary",{className:"cursor-pointer list-none font-semibold text-accent",children:t1("render.showJson")}),(0,r.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(e,null,2)})]})]});let i="boolean"==typeof e.approve?e.approve:void 0,s=nS(e.reason)??nS(e.feedback);return(0,r.jsxs)("div",{className:"text-[13px]",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsxs)("span",{className:`inline-flex items-center gap-1 rounded-full border px-2.5 py-0.5 text-[11.5px] font-bold ${"amber"===n.tone?"border-[#d89b21]/35 bg-[#fff9ea] text-[#9a6500]":"border-accent/25 bg-accent/10 text-accent"}`,children:[(0,r.jsx)(tv,{name:n.icon,className:"h-3.5 w-3.5"}),t1(n.labelKey)]}),void 0!==i?(0,r.jsx)(nC,{approve:i}):null]}),s?(0,r.jsx)("div",{className:"mt-1.5 whitespace-pre-wrap break-words",children:nx(s)}):null,(0,r.jsx)(nA,{payload:e})]})}function nT({verdict:e}){let t="REQUEST_CHANGES"===e?e3.A:"APPROVE"===e?e7.A:ti.A;return(0,r.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,r.jsx)(t,{className:"h-3.5 w-3.5","aria-hidden":!0}),"REQUEST_CHANGES"===e?"REQUEST_CHANGES":"APPROVE"===e?"APPROVE":"COMMENT"]})}function nE({item:e}){var t;let n=e.findings.length,i=e.findings.slice(0,12);return(0,r.jsxs)("div",{className:"my-3.5 ml-9 overflow-hidden rounded-[14px] border border-codex/20 bg-panel shadow-card",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2 border-b border-line px-3.5 py-2.5",children:[(0,r.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,r.jsx)(te.A,{className:"h-4 w-4","aria-hidden":!0})}),(0,r.jsx)("span",{className:"text-[13.5px] font-bold",children:"Codex review"}),e.verdict?(0,r.jsx)("span",{className:`rounded-full border px-2.5 py-0.5 text-[11.5px] font-extrabold ${"REQUEST_CHANGES"===(t=e.verdict)?"bg-[#fff0f0] text-err border-err/25":"APPROVE"===t?"bg-[#eefaf1] text-ok border-ok/25":"bg-chip text-[#555] border-line"}`,children:(0,r.jsx)(nT,{verdict:e.verdict})}):null,(0,r.jsx)("span",{className:"text-[11px] text-dim",children:n?`${n} finding${1===n?"":"s"}`:t1("render.noFindings")}),X(e.ts)?(0,r.jsx)("span",{className:"ml-auto text-[11px] text-dim",children:X(e.ts)}):null]}),(0,r.jsxs)("div",{className:"px-3.5 py-2.5",children:[e.summary.length?(0,r.jsx)("div",{className:"mb-2 whitespace-pre-wrap break-words text-[13px] text-[#444]",children:nx(e.summary.join("\n"))}):null,i.length?(0,r.jsx)("div",{className:"space-y-2",children:i.map((e,t)=>{var n;return(0,r.jsxs)("div",{className:"rounded-[10px] border border-line bg-[#fbfbfd] px-3 py-2",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsx)("span",{className:`rounded-full border px-2 py-0.5 text-[10.5px] font-extrabold ${"Critical"===(n=e.severity)||"High"===n||"P0"===n||"P1"===n?"border-err/30 bg-[#fff4f4] text-err":"Medium"===n||"P2"===n?"border-[#d89b21]/35 bg-[#fff9ea] text-[#9a6500]":"Low"===n||"P3"===n?"border-line bg-chip text-[#555]":"border-line bg-panel text-dim"}`,children:e.severity}),e.file?(0,r.jsx)(nw,{file:e.file,line:e.line}):null]}),(0,r.jsx)("div",{className:"mt-1.5 whitespace-pre-wrap break-words text-[13px]",children:nu(e.title)}),e.body&&e.body!==e.title?(0,r.jsxs)("details",{className:"mt-1 text-[12px] text-dim",children:[(0,r.jsx)("summary",{className:"cursor-pointer list-none font-semibold text-accent",children:"details"}),(0,r.jsx)("div",{className:"mt-1 whitespace-pre-wrap break-words",children:nx(e.body)})]}):null]},t)})}):null,e.findings.length>i.length?(0,r.jsx)("div",{className:"mt-2 text-[12px] text-dim",children:t1("render.moreFindings",{count:e.findings.length-i.length})}):null,(0,r.jsxs)("details",{className:"mt-2 rounded-[10px] border border-line bg-[#fafafc] text-[12px]",children:[(0,r.jsx)("summary",{className:"cursor-pointer list-none px-3 py-1.5 font-semibold text-dim",children:"raw review text"}),(0,r.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:e.raw})]})]})]})}function nD({label:e,text:t}){let n=t.length>=2048?`${(t.length/1024).toFixed(1)} ${t1("common.kb")}`:t1("common.chars",{n:t.length});return(0,r.jsxs)("details",{className:"group my-1.5 ml-9",children:[(0,r.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,r.jsx)("span",{className:"flex h-4.5 w-4.5 items-center justify-center rounded-md bg-chip",children:(0,r.jsx)(tv,{name:"cmd-group",className:"h-3 w-3"})}),(0,r.jsx)("span",{className:"rounded-full bg-chip px-1.5 py-0.5 font-mono text-[9.5px]",children:e}),(0,r.jsxs)("span",{children:[t1("render.system")," \xb7 ",n]}),(0,r.jsx)("span",{className:"text-accent group-open:hidden",children:t1("common.show")}),(0,r.jsx)("span",{className:"hidden text-dim group-open:inline",children:t1("common.collapse")})]}),(0,r.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:t})]})}let nM=(0,l.memo)(function({item:e}){if("image"===e.kind)return(0,r.jsx)(ny,{media:e.media,data:e.data,w:e.w,h:e.h,bytes:e.bytes});if("inbox-image"===e.kind)return(0,r.jsx)(no,{name:e.name,path:e.path});if("blob"===e.kind)return(0,r.jsx)(nh,{bytes:e.bytes,text:e.text});if("sysmsg"===e.kind)return(0,r.jsx)(nD,{label:e.label,text:e.text});if("compact"===e.kind)return(0,r.jsx)(nk,{item:e});if("review"===e.kind)return(0,r.jsx)(nE,{item:e});if("mem-citation"===e.kind)return(0,r.jsx)(nj,{item:e});if("prose"===e.kind){let t="codex"===e.engine?"bg-codex":"bg-claude",n="codex"===e.engine?te.A:ta.A;return(0,r.jsxs)("div",{className:"my-3.5 flex gap-2.5",children:[(0,r.jsx)("div",{className:`mt-1 flex h-6.5 w-6.5 shrink-0 items-center justify-center rounded-full text-white ${t}`,children:(0,r.jsx)(n,{className:"h-3.5 w-3.5","aria-hidden":!0})}),(0,r.jsxs)("div",{className:"min-w-0 flex-1 whitespace-pre-wrap break-words",children:[X(e.ts)?(0,r.jsx)("div",{className:"mb-0.5 text-[11px] text-dim",children:X(e.ts)}):null,nx(e.text)]})]})}if("user"===e.kind){let t=e.text.length>500;return(0,r.jsx)("div",{className:"my-3.5 flex justify-end",children:(0,r.jsx)("div",{className:"max-w-[75%] whitespace-pre-wrap break-words rounded-2xl bg-user px-4 py-2.5",children:t?(0,r.jsxs)("details",{className:"group/usr",children:[(0,r.jsxs)("summary",{className:"cursor-pointer list-none [&::-webkit-details-marker]:hidden",children:[(0,r.jsxs)("span",{className:"group-open/usr:hidden",children:[e.text.slice(0,180),"… ",(0,r.jsxs)("span",{className:"font-semibold text-accent",children:["(",t1("common.chars",{n:e.text.length}),")"]})]}),(0,r.jsxs)("span",{className:"hidden items-center gap-1 text-[11px] font-semibold text-dim group-open/usr:inline-flex",children:[t1("common.collapse")," ",(0,r.jsx)(e9.A,{className:"h-3 w-3","aria-hidden":!0})]})]}),nx(e.text)]}):nx(e.text)})})}if("cmd"===e.kind){let t="ok"===e.call.status?"text-ok":"err"===e.call.status?"text-err":"text-dim";return(0,r.jsxs)("details",{className:"my-2.5 ml-9 overflow-hidden rounded-[14px] border border-line bg-panel shadow-card",open:e.call.open,children:[(0,r.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-2.5 px-3.5 py-2",children:[(0,r.jsx)("span",{className:"flex h-6.5 w-6.5 shrink-0 items-center justify-center rounded-lg bg-chip",children:(0,r.jsx)(tv,{name:e.call.icon,className:"h-4 w-4"})}),(0,r.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:e.call.display}),(0,r.jsxs)("span",{className:`ml-auto inline-flex shrink-0 items-center gap-1 text-xs font-semibold ${t}`,children:[(0,r.jsx)(ng,{status:e.call.status}),e.call.label]})]}),(0,r.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:"$ "+e.call.cmd+(e.call.output?"\n"+e.call.output:"\n"+t1("render.noOutputInLog"))})]})}if("cmd-group"===e.kind)return(0,r.jsx)(nv,{item:e});if("edit"===e.kind)return(0,r.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,r.jsx)("span",{className:"flex h-7.5 w-7.5 items-center justify-center rounded-lg bg-chip",children:(0,r.jsx)(tv,{name:"note",className:"h-4 w-4"})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-[13.5px] font-semibold",children:e.files}),(0,r.jsx)("div",{className:"text-xs text-dim",children:t1("render.filesChanged")})]})]});if("tmsg"===e.kind){let t=function(e){let t=e.trim();if((t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))&&(t=t.slice(1,-1).trim()),!t.startsWith("{"))return null;try{let e=JSON.parse(t);if(null!==e&&"object"==typeof e&&!Array.isArray(e))return e}catch{}return null}(e.text),n=e.text.length>420||e.text.split("\n").length>6;return(0,r.jsxs)("div",{className:"my-2.5 ml-9 overflow-hidden rounded-[14px] border border-accent/25 bg-[#f8f8fd] shadow-card",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3.5 pt-2",children:[(0,r.jsx)("span",{className:"flex h-6.5 w-6.5 shrink-0 items-center justify-center rounded-lg bg-[#ecebfb] text-accent",children:(0,r.jsx)(tr.A,{className:"h-3.5 w-3.5","aria-hidden":!0})}),(0,r.jsx)("span",{className:"text-[11px] font-semibold text-dim",children:"out"===e.dir?t1("render.toDir"):t1("render.fromDir")}),(0,r.jsx)("span",{className:"rounded-full bg-accent/10 px-2 py-0.5 text-[11px] font-bold text-accent",children:e.peer}),e.delivery?(0,r.jsxs)("span",{className:`inline-flex shrink-0 items-center gap-1 text-[10.5px] font-semibold ${"ok"===e.delivery?"text-ok":"text-err"}`,title:e.msgId?`msg_id: ${e.msgId}`:void 0,children:["ok"===e.delivery?(0,r.jsx)(e6.A,{className:"h-3 w-3","aria-hidden":!0}):(0,r.jsx)(s.A,{className:"h-3 w-3","aria-hidden":!0}),"ok"===e.delivery?t1("render.delivered"):t1("render.notDelivered")]}):null,X(e.ts)?(0,r.jsx)("span",{className:"ml-auto shrink-0 text-[11px] text-dim",children:X(e.ts)}):null]}),(0,r.jsx)("div",{className:"px-3.5 pb-2.5 pt-1",children:t?(0,r.jsx)(n$,{payload:t}):(0,r.jsxs)(r.Fragment,{children:[e.summary?(0,r.jsx)("div",{className:"text-[13px] font-bold",children:nu(e.summary)}):null,n?(0,r.jsxs)("details",{className:"group/tmsg mt-0.5 whitespace-pre-wrap break-words text-[13px]",children:[(0,r.jsxs)("summary",{className:"cursor-pointer list-none text-[12.5px] text-[#555] [&::-webkit-details-marker]:hidden",children:[(0,r.jsxs)("span",{className:"group-open/tmsg:hidden",children:[e.text.slice(0,260).trimEnd(),"… ",(0,r.jsx)("span",{className:"font-semibold text-accent",children:t1("common.showAll")})]}),(0,r.jsxs)("span",{className:"hidden items-center gap-1 text-[11px] font-semibold text-dim group-open/tmsg:inline-flex",children:[t1("common.collapse")," ",(0,r.jsx)(e9.A,{className:"h-3 w-3","aria-hidden":!0})]})]}),nx(e.text)]}):(0,r.jsx)("div",{className:"mt-0.5 whitespace-pre-wrap break-words text-[13px]",children:nx(e.text)})]})})]})}if("tnote"===e.kind)return(0,r.jsxs)("div",{className:"my-1 ml-9 flex items-center gap-1.5 text-[11.5px] text-dim",children:[(0,r.jsx)(tr.A,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),e.text]});if("think"===e.kind){let t=e.text.length>150;return(0,r.jsxs)("details",{className:"my-1 ml-9 text-[11.5px] italic text-dim",children:[(0,r.jsxs)("summary",{className:`flex list-none items-center gap-1.5 truncate ${t?"cursor-pointer":""}`,title:t1("render.reasoning"),children:[(0,r.jsx)(e4.A,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),(0,r.jsxs)("span",{className:"truncate",children:[e.text.slice(0,150),t?"…":""]})]}),t?(0,r.jsx)("div",{className:"whitespace-pre-wrap break-words pt-1 not-italic",children:nx(e.text)}):null]})}return"svc"===e.kind?(0,r.jsx)("div",{className:"my-1 break-words text-[11.5px] text-dim",children:e.text}):"note"===e.kind?(0,r.jsx)("div",{className:"my-2 break-words text-[12.5px] text-dim",children:nu(e.text)}):(0,r.jsx)("div",{className:`my-0.5 break-words text-[12.5px] ${e.err?"text-err":"text-[#555]"}`,children:e.text})});var nR=n(9267),nP=n(9383);function nI({file:e}){let{t}=h(),n=e.pendingQuestion,[i,a]=(0,l.useState)("pending"),[o,c]=(0,l.useState)(""),[d,u]=(0,l.useState)({}),[p,f]=(0,l.useState)(""),[m,x]=(0,l.useState)(""),[b,g]=(0,l.useState)(!1),w=n?null!==n.paneTarget:null!==e.pid&&"running"===e.proc,v=(0,l.useMemo)(()=>n?.questions?n.questions.map((e,t)=>(d[t]??[]).map(t=>e.options[t]?.label??String(t+1)).join(", ")).filter(Boolean).join(" \xb7 "):"",[d,n]);if(!n){if(!e.waitingInput)return null;let n=e.waitingInput.menu,s="delivering"===i,l=async(r,i)=>{a("delivering"),c("");try{let s=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"dialog-key",path:e.path,key:r,...n?{question:n.question}:{},.../^[1-9]$/.test(r)?{label:i}:{}})}),l=await s.json();if(!s.ok||!l.ok){a("failed"),c(l.error??t("common.failedSend"));return}a("answered"),c(i)}catch{a("failed"),c(t("common.serverUnavailable"))}};return"answered"===i?(0,r.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:t("question.sentToPane",{text:o})}):(0,r.jsxs)("div",{id:"question",className:"my-4 rounded-[8px] border border-[#e0ae45]/45 bg-[#fff9ed] p-4 shadow-card",children:[(0,r.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,r.jsx)(nR.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",t("question.waiting")]}),(0,r.jsxs)("div",{className:"text-[13px] font-semibold text-ink",children:[t("question.pane",{target:e.waitingInput.target})," \xb7 ",function(e,t){let n=Math.max(0,Math.floor(Date.now()/1e3-t));if(n<60)return e("question.sec",{n:n});let r=Math.floor(n/60);return r<60?e("question.min",{n:r}):e("question.hour",{n:Math.floor(r/60)})}(t,e.waitingInput.since)]}),n?(0,r.jsxs)(r.Fragment,{children:[n.tabs.length?(0,r.jsx)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:n.tabs.map((e,t)=>(0,r.jsxs)("span",{className:`rounded-full px-2 py-0.5 text-[11px] font-bold ${e.done?"bg-ok/15 text-ok":"bg-bg text-dim"}`,children:[e.done?"✓ ":"",e.label]},t))}):null,(0,r.jsx)("div",{className:"mt-2 text-[14px] font-bold text-ink",children:n.question}),(0,r.jsx)("div",{className:"mt-2 space-y-1.5",children:n.options.map(e=>(0,r.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 ${e.recommended?"border-[#e0ae45]/45 bg-[#fff5dc]":"border-line bg-bg"}`,disabled:s||e.value>9,onClick:()=>void l(String(e.value),e.label),children:[(0,r.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:e.value}),(0,r.jsxs)("span",{className:"min-w-0",children:[(0,r.jsx)("span",{className:"block text-[13px] font-bold",children:e.label}),e.description?(0,r.jsx)("span",{className:"block text-[12px] text-dim",children:e.description}):null]})]},e.value))})]}):(0,r.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:e.waitingInput.screenTail}),(0,r.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[["Tab","Enter","Escape"].map(e=>(0,r.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:s,onClick:()=>void l(e,"Escape"===e?"Esc":e),children:"Escape"===e?"Esc":e},e)),(0,r.jsx)("span",{className:"text-[12px] text-dim",children:t("question.keysHint")})]}),"delivering"===i?(0,r.jsxs)("div",{className:"mt-2 inline-flex items-center gap-1.5 text-[12px] font-semibold text-dim",children:[(0,r.jsx)(tg.A,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0})," ",t("common.sending")]}):null,"failed"===i?(0,r.jsx)("div",{className:"mt-2 text-[12px] font-semibold text-err",children:o}):null]})}let k=async(e,r)=>{a("delivering"),c("");try{let i=await fetch("/api/answer",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({transcriptPath:n.transcriptPath,toolUseId:n.toolUseId,kind:n.kind,...e})}),s=await i.json();if(!i.ok||!s.ok){if(409===i.status&&(s.superseded||s.answer)){a("superseded"),c(s.answer??s.error??t("question.alreadyAnswered"));return}a("failed"),c(s.error??t("common.failedSend"));return}a("answered"),c(s.answer??r)}catch{a("failed"),c(t("common.serverUnavailable"))}},y=(e=d)=>n.questions?.map((t,n)=>e[n]??[])??[],j=n.questions?.length??0,N=j>1||(n.questions?.some(e=>e.multiSelect)??!1),S=n.questions?.every((e,t)=>(d[t]??[]).length>0)??!1,C=async()=>{g(!0),c("");try{let n=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"resume",path:e.path})}),r=await n.json();if(!n.ok||!r.ok)return void c(r.error??t("question.openFailed"));c(t("question.opened",{target:r.target??"tmux"}))}catch{c(t("common.serverUnavailable"))}finally{g(!1)}},A="delivering"===i||!w;return"answered"===i?(0,r.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:t("question.answered",{text:o||v})}):"superseded"===i?(0,r.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:t("question.answeredElsewhere",{text:o})}):n&&!w?(0,r.jsxs)("div",{id:"question",className:"my-4 rounded-[8px] border border-[#e0ae45]/45 bg-[#fff9ed] p-4 shadow-card",children:[(0,r.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,r.jsx)(nR.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",t("question.waiting")]}),(0,r.jsx)("div",{className:"text-[13px] font-semibold text-err",children:t("question.noPane")}),"plan"===n.kind?(0,r.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:n.plan}):n.questions?.map((e,t)=>(0,r.jsxs)("div",{className:"mt-2",children:[(0,r.jsx)("div",{className:"text-[12px] font-bold text-dim",children:e.header}),(0,r.jsx)("div",{className:"text-[13px] font-semibold text-ink",children:e.question})]},t)),(0,r.jsx)("button",{className:"mt-3 rounded-[8px] bg-accent px-3 py-1.5 text-[13px] font-bold text-white disabled:opacity-60",disabled:b,onClick:C,children:t("question.openSession")}),o?(0,r.jsx)("div",{className:"mt-2 text-[12px] font-semibold text-dim",children:o}):null]}):(0,r.jsxs)("div",{id:"question",className:"my-4 rounded-[8px] border border-[#e0ae45]/45 bg-[#fff9ed] p-4 shadow-card",children:[(0,r.jsxs)("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[(0,r.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,r.jsx)(nR.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",t("question.waiting")]}),w?null:(0,r.jsx)("span",{className:"text-[12px] font-semibold text-err",children:t("question.noPane")})]}),"plan"===n.kind?(0,r.jsxs)(r.Fragment,{children:[(0,r.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:n.plan}),(0,r.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:t("question.rejectComment"),value:m,onChange:e=>x(e.target.value)}),(0,r.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2",children:[(0,r.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:A,onClick:()=>k({approve:!0},t("question.approved")),children:[(0,r.jsx)(e6.A,{className:"h-4 w-4","aria-hidden":!0})," ",t("question.approve")]}),(0,r.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:A,onClick:()=>k({approve:!1,text:m},t("question.rejected")),children:[(0,r.jsx)(s.A,{className:"h-4 w-4","aria-hidden":!0})," ",t("question.reject")]})]})]}):(0,r.jsxs)(r.Fragment,{children:[n.questions?.map((e,t)=>(0,r.jsxs)("section",{className:"mt-3 first:mt-0",children:[(0,r.jsx)("div",{className:"mb-1 inline-flex rounded-full bg-bg px-2 py-0.5 text-[11px] font-bold text-dim",children:e.header}),(0,r.jsx)("div",{className:"mb-2 text-[14px] font-bold text-ink",children:e.question}),(0,r.jsx)("div",{className:"space-y-1.5",children:e.options.map((n,i)=>{let s=(d[t]??[]).includes(i);return(0,r.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 ${s?"border-accent/45 bg-accent/10":n.recommended?"border-[#e0ae45]/45 bg-[#fff5dc]":"border-line bg-bg"}`,disabled:A,onClick:()=>{var r;let s={...d,[t]:[i]};r=e.multiSelect,u(e=>{let n=e[t]??[],s=r?n.includes(i)?n.filter(e=>e!==i):[...n,i]:[i];return{...e,[t]:s}}),e.multiSelect||1!==j||k({answers:y(s)},n.label)},children:[(0,r.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:s?"✓":i+1}),(0,r.jsxs)("span",{className:"min-w-0",children:[(0,r.jsx)("span",{className:"block text-[13px] font-bold",children:n.label}),n.description?(0,r.jsx)("span",{className:"block text-[12px] text-dim",children:n.description}):null]})]},i)})})]},t)),j<=1?(0,r.jsxs)("div",{className:"mt-3 flex gap-2",children:[(0,r.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:t("question.ownAnswer"),value:p,onChange:e=>f(e.target.value)}),(0,r.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:A||!p.trim(),onClick:()=>k({text:p},p),children:[(0,r.jsx)(nP.A,{className:"h-4 w-4","aria-hidden":!0})," ",t("common.send")]})]}):null,N?(0,r.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:A||!S,onClick:()=>k({answers:y()},v),children:[(0,r.jsx)(nP.A,{className:"h-4 w-4","aria-hidden":!0})," ",t("common.send")]}):null]}),"delivering"===i?(0,r.jsxs)("div",{className:"mt-3 inline-flex items-center gap-1.5 text-[12px] font-semibold text-dim",children:[(0,r.jsx)(tg.A,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0})," ",t("common.sending")]}):null,"failed"===i?(0,r.jsx)("div",{className:"mt-3 text-[12px] font-semibold text-err",children:o}):null]})}function n_({file:e}){let{t}=h();return"running"===e.proc?(0,r.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,r.jsx)(tl.A,{className:"h-3 w-3","aria-hidden":!0})," PID ",e.pid]}):"killed"===e.proc||"stalled"===e.activity?(0,r.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:t("task.interruptedBadge")}):"done"===e.proc?(0,r.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:t("task.finishedBadge")}):null}function nL({file:e,compact:t=!1}){let{t:n}=h(),[i,s]=(0,l.useState)(!1),[a,o]=(0,l.useState)(!1),[c,d]=(0,l.useState)(""),[u,p]=(0,l.useState)(!1);(0,l.useEffect)(()=>{if(!i)return;let e=window.setTimeout(()=>s(!1),5e3);return()=>window.clearTimeout(e)},[i]);let f=(0,r.jsx)(n_,{file:e}),m=async()=>{o(!0),d("");try{let t=await fetch("/api/proc",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:e.path,force:u})}),r=await t.json();if(!t.ok||!r.ok){d(r.error??n("task.stopFailed")),p(!0);return}d(n("task.signalSent",{signal:u?"SIGKILL":"SIGTERM",pid:r.pid??""})),s(!1)}catch{d(n("common.serverUnavailable")),p(!0)}finally{o(!1)}};return(0,r.jsxs)("span",{className:`inline-flex min-w-0 flex-wrap items-center gap-1.5 ${t?"text-[10.5px]":"text-xs"}`,children:[f,"running"===e.proc?i?(0,r.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:[t?null:(0,r.jsx)("span",{className:"truncate px-1 text-[11px] font-semibold text-err",children:n("task.confirmKill",{pid:e.pid??""})}),(0,r.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:a,onClick:m,children:u?"SIGKILL":t?n("task.killPid",{pid:e.pid??""}):n("task.confirmKillYes")}),(0,r.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:()=>s(!1),children:t?n("common.no"):n("common.cancel")})]}):(0,r.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":n("task.stopAria",{pid:e.pid??""}),onClick:()=>s(!0),children:n("task.kill")}):null,c?(0,r.jsx)("span",{className:"max-w-[220px] truncate text-[11px] font-semibold text-dim",children:c}):null]})}function nz({file:e,files:t,onSelect:n}){let{t:i}=h();if("codex-jobs"===e.root){let s=t.find(t=>"codex-sessions"===t.root&&t.parent===e.path);return(0,r.jsxs)("div",{className:"mb-4 mt-1 rounded-[14px] border border-line bg-panel px-4 py-3 shadow-card",children:[(0,r.jsx)("div",{className:"mb-2 flex flex-wrap items-center gap-2",children:(0,r.jsx)(n_,{file:e})}),s?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"mb-2 whitespace-pre-line text-[13.5px] font-semibold",children:i("task.jobLogHint")}),(0,r.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:()=>n(s),children:[(0,r.jsx)(te.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",i("task.openCodexSession",{size:(s.size/1024).toFixed(0),activity:"live"===s.activity?i("task.working"):"stalled"===s.activity?i("task.interrupted"):"recent"===s.activity?i("task.finished"):""})]})]}):(0,r.jsx)("div",{className:"text-[13.5px] text-dim",children:i("task.rolloutMissing")})]})}return"claude-tasks"!==e.root?null:(0,r.jsxs)("div",{className:"mb-4 mt-1 rounded-[14px] border border-line bg-panel px-4 py-3 shadow-card",children:[(0,r.jsx)("div",{className:"mb-2 flex flex-wrap items-center gap-2",children:(0,r.jsx)(n_,{file:e})}),e.cmd?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"mb-1 text-[13.5px] font-semibold",children:e.cmdDesc||i("task.backgroundCommand")}),(0,r.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:["$ ",e.cmd]})]}):(0,r.jsx)("div",{className:"text-[13.5px] text-dim",children:i("task.commandNotFound")})]})}let nO=window.matchMedia("(pointer: coarse)").matches?500:2500,nq=new Map;function nF(e,t,n){nq.size>300&&!nq.has(e)&&nq.clear(),nq.set(e,{magnet:t,fromBottom:n})}function nU({icon:e,label:t}){return(0,r.jsxs)("div",{className:"mt-2 flex items-center gap-2 text-[12px] font-semibold text-ok",children:[(0,r.jsxs)("span",{className:"flex items-center gap-0.5","aria-hidden":!0,children:[(0,r.jsx)("span",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-ok"}),(0,r.jsx)("span",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-ok [animation-delay:150ms]"}),(0,r.jsx)("span",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-ok [animation-delay:300ms]"})]}),(0,r.jsx)(e,{className:"h-3.5 w-3.5","aria-hidden":!0}),t]})}function nH({file:e,files:t,onSelect:n,showSvc:i,lineFilter:s,onStatus:a,paused:o,follow:c,setFollow:d,compact:u=!1}){let{locale:f,t:m}=h(),[b,g]=(0,l.useState)(()=>e?nq.get(e.path)?.magnet??c:c),w=function(e,t=!1,n=2500){let r=(0,l.useRef)(n),[i,s]=(0,l.useState)([]),[a,o]=(0,l.useState)(0),[c,d]=(0,l.useState)(!1),[u,f]=(0,l.useState)(null),[m,h]=(0,l.useState)(null),[b,g]=(0,l.useState)(!1),[w,v]=(0,l.useState)(!1),[k,y]=(0,l.useState)(!1),[j,N]=(0,l.useState)(0),S=(0,l.useRef)(0),C=(0,l.useRef)(0),A=(0,l.useRef)(""),$=(0,l.useRef)(!0),T=(0,l.useRef)(0),E=(0,l.useRef)(!1),D=(0,l.useRef)(!1);(0,l.useEffect)(()=>{r.current=n},[n]),(0,l.useEffect)(()=>{E.current=b||t},[b,t]);let M=()=>{S.current=0,C.current=0,A.current="",$.current=!0,v(!1)},R=(0,l.useCallback)(()=>{s([]),M()},[]);return(0,l.useEffect)(()=>{T.current+=1,M(),s([]),o(e?.size??0),f(null),d(!!e)},[e?.path]),(0,l.useEffect)(()=>{if(!e)return;let t=!0,n=T.current,i=async()=>{if(t&&!E.current)try{let i=await fetch(`/api/log?path=${encodeURIComponent(e.path)}&offset=${S.current}`),l=await i.json();if(!t||n!==T.current)return;if("error"in l&&l.error){f(l.error),d(!1);return}if(S.current>l.size&&(M(),s([])),l.data){let e=A.current+l.data;if(A.current="",$.current){if(C.current=l.start,l.start>0){let t=e.indexOf("\n");C.current=l.start+(t>=0?tB(e.slice(0,t+1)):tB(e)),e=t>=0?e.slice(t+1):""}v(C.current>0)}let t=e.split("\n");A.current=t.pop()??"";let n=t.map(e=>e.trim()).filter(Boolean);0===S.current?s(n):n.length&&s(e=>r.current>0?e.concat(n).slice(-r.current):e.concat(n)),$.current=!1}S.current=l.offset,o(l.size),f(null),l.data&&h(new Date),d(!1)}catch{t&&n===T.current&&(f(x(p(),"common.serverUnavailable")),d(!1))}};i();let l=setInterval(i,1200);return()=>{t=!1,clearInterval(l)}},[e?.path]),{lines:i,size:a,loading:c,error:u,tickTime:m,paused:b,setPaused:g,clear:R,hasMore:w,loadingOlder:k,loadOlder:(0,l.useCallback)(async()=>{if(!e||D.current||C.current<=0)return 0;D.current=!0,y(!0);let t=T.current;try{let n="",r=C.current;for(let i=0;i<4;i+=1){let i=await fetch(`/api/log?path=${encodeURIComponent(e.path)}&before=${r}`),s=await i.json();if(t!==T.current||"error"in s&&s.error)return 0;if(n=s.data+n,r=s.start,0===r||n.slice(0,-1).includes("\n"))break}let i=r;if(r>0){let e=n.indexOf("\n");if(e<0||e===n.length-1)return 0;i=r+tB(n.slice(0,e+1)),n=n.slice(e+1)}let l=n.split("\n");""===l.at(-1)&&l.pop();let a=l.map(e=>e.trim()).filter(Boolean);return C.current=i,v(i>0),a.length&&(s(e=>a.concat(e)),N(e=>e+1)),a.length}catch{return 0}finally{D.current=!1,y(!1)}},[e?.path]),prependGen:j}}(e,o,b&&u?nO:0),v=(0,l.useRef)(null),k=(0,l.useRef)(null),j=(0,l.useRef)(null),N=u?300:1500,S=u?500:1500,[C,A]=(0,l.useState)(N),[$,T]=(0,l.useState)(0),[E,D]=(0,l.useState)(!1),[M,R]=(0,l.useState)(null),P=(0,l.useRef)(!1),I=(0,l.useRef)(b),_=(0,l.useRef)(0),L=(0,l.useRef)(0),z=(0,l.useRef)(null),O=(0,l.useRef)(0),q=(0,l.useRef)(null),F=(t,n=!1)=>{I.current=t,g(t),d(t),t&&T(0),e&&nF(e.path,t,nq.get(e.path)?.fromBottom??0),n&&(D(!0),z.current&&window.clearTimeout(z.current),z.current=window.setTimeout(()=>D(!1),450))},U=()=>{let e=v.current;e&&(O.current=Date.now(),e.scrollTop=e.scrollHeight)};(0,l.useEffect)(()=>A(N),[e?.path,N]),(0,l.useEffect)(()=>{if(!e)return;let t=nq.get(e.path)?.magnet??!0;t!==I.current&&(I.current=t,g(t))},[e?.path]),(0,l.useEffect)(()=>{c!==I.current&&(I.current=c,g(c),c&&T(0))},[c]),(0,l.useEffect)(()=>()=>{z.current&&window.clearTimeout(z.current)},[]),(0,l.useEffect)(()=>{P.current=!1,queueMicrotask(()=>R(null))},[e?.path]),(0,l.useEffect)(()=>{if(e){if(e.pendingQuestion){P.current=!0,queueMicrotask(()=>R(null));return}P.current&&e.proc&&"running"!==e.proc&&(queueMicrotask(()=>R(x(f,"feed.agentEnded"))),P.current=!1)}},[e?.pendingQuestion?.toolUseId,e?.proc,e,f]);let H=(0,l.useMemo)(()=>e?function(e,t,n,r){let i=new Map,s=new Map,l=[],a=0,o="",c=e=>!!(!(e.length<=2e4)&&(e.match(/\s/g)?.length??0)/e.length<.02)&&(l.push({kind:"blob",bytes:e.length,text:tG(e).slice(0,2e5)}),!0),d=(e,t)=>{let n=nt(e.source),r=ne(n.data)||ne(t.base64);if(!r)return;let i=ne(n.media_type)||ne(t.type),s=i.startsWith("image/")?i:"image/png",a=nt(t.dimensions);l.push({kind:"image",media:s,data:r,w:t2(a.originalWidth),h:t2(a.originalHeight),bytes:t2(t.originalSize)})},u=(e,t,n)=>{t5.lastIndex=0;let r=t5.test(t);if(t5.lastIndex=0,!r){let n=t0(t.trim(),e);return!!n&&(l.push(n),!0)}let i=!1,s=0,a=t=>{let r=t.trim();if(!r)return;let s=t0(r,e);s?(l.push(s),i=!0):n(r)};for(let e of t.matchAll(t5)){let n=e[0],r=e.index??0;a(t.slice(s,r)),l.push(nr(n,e[1]??"",e[2]??"")),i=!0,s=r+n.length}return a(t.slice(s)),i},p=e=>{let t=[];return t5.lastIndex=0,{cleaned:e.replace(t5,(e,n,r)=>(t.push(nr(e,n,r)),"")).trim(),cites:t}},f=(t,n)=>{if(!n.trim()||n===o||(o=n,c(n)))return;let r="codex"===e.engine?"codex":"claude";u(t,n,e=>l.push({kind:"prose",ts:t,text:e,engine:r}))||l.push({kind:"prose",ts:t,text:n,engine:r})},m=(e,t,n,r)=>{let s=n||"plain-"+l.length+"-"+String(e??""),a=function(e,t="shell"){let n=tG(e);return{cmd:n,display:function(e){let t,n=e.match(/^([A-Za-z][\w.]*): /),r=n?n[0]:"",i=r?e.slice(r.length):e;do t=i,i=(i=(i=(i=i.replace(/^export PATH=[^;]+;\s*/,"")).replace(/^cd\s+\S+\s*&&\s*/,"")).replace(/^\/usr\/bin\/zsh -lc\s+/,"")).replace(/^(["'])([\s\S]*)\1$/,(e,t,n)=>RegExp(`(?<!\\\\)${t}`).test(n)?e:n);while(i!==t);let s=i.match(/^([\w./-]+(?:\s+-)?)\s*<<\s*['"]?(\w+)['"]?/);return s&&(i=`${s[1].trim()} \xabheredoc\xbb`),(r+(i=i.replace(/\s+/g," ").trim())).slice(0,160)}(n),icon:t,output:"",status:"run",label:t1("render.executing"),open:!1}}(t,r);return i.set(s,a),l.push({kind:"cmd",id:s,call:a,ts:e}),a},x=(e,t,r)=>{if(!e)return;let a=s.get(e);if(a){a.delivery=r||/"success"\s*:\s*false/.test(t)?"err":"ok",a.msgId=t.match(/"msg_id"\s*:\s*"([^"]+)"/)?.[1];return}!ni(i.get(e),t,r)&&t&&n&&l.push({kind:"svc",text:"output: "+tG(t).slice(0,200)})},h=e=>{n?l.push({kind:"svc",text:e.slice(0,300)}):a+=1},b=e=>{l.push({kind:"note",text:e})},g=(e,t)=>{let n=t.replace(t3,(t,n,r,i)=>{let s=t7(r,"teammate_id")||t7(r,"from")||t1("render.teammate"),a=t7(r,"summary"),o=i.trim();if(o.startsWith("{"))try{let e=JSON.parse(o);if("idle_notification"===e.type){let t=X(e.timestamp);return l.push({kind:"tnote",text:t1("render.left",{peer:s,at:t?" \xb7 "+t:""})}),""}}catch{}let{cleaned:c,cites:d}=p(o),u=tW.test(c)?t0(c,e):null;for(let t of(l.push({kind:"tmsg",ts:e,dir:"in",peer:s,summary:a,text:u?"":c}),u&&l.push(u),d))l.push(t);return""}).replace(/Another Claude session sent a message:\s*/g,"").trim();if(!n||c(n))return;if(t8.test(n))return void l.push({kind:"sysmsg",label:t9(n),text:n});let{cleaned:r,images:i}=t6(n);for(let t of(r&&!u(e,r,t=>l.push({kind:"user",ts:e,text:t}))&&l.push({kind:"user",ts:e,text:r}),i))l.push({kind:"inbox-image",name:t.name,path:t.path})},w=null,v=(e,t)=>{if(w&&w.text===t&&w.at===l.length)return;let{cleaned:n,images:r}=t6(t);for(let t of(n&&l.push({kind:"user",ts:e,text:n}),r))l.push({kind:"inbox-image",name:t.name,path:t.path});w={text:t,at:l.length}},k=(e,t)=>{w&&w.text===e&&w.at===l.length||(l.push({kind:"sysmsg",label:t9(e,t),text:e}),w={text:e,at:l.length})},y=!1,j=(e,t)=>{l.push({kind:"compact",ts:e,trigger:t?.trigger,preTokens:t?.preTokens})},N=e=>{let t=nt(e.payload),n=e.timestamp;if("session_meta"===e.type)return b(`${t1("render.codexSessionCreated")} \xb7 ${ne(t.model)} \xb7 ${ne(t.cwd)}`);if("event_msg"===e.type){if("agent_message"===t.type&&t.message)return f(n,ne(t.message));if("user_message"===t.type&&t.message){let e=ne(t.message);return t8.test(e)?k(e):v(n,e)}return"task_started"===t.type?b(t1("render.taskStarted")+(n?" \xb7 "+X(n):"")):"task_complete"===t.type?b(t1("render.taskComplete")+(n?" \xb7 "+X(n):"")):"context_compacted"===t.type?y?void(y=!1):j(n):h(ne(t.type)||"event")}if("response_item"===e.type){if("message"===t.type){let e=nn(t.content).map(e=>ne(e.text)||ne(e.input_text)).join(" ").trim();return e?"assistant"===t.role?f(n,e):"user"!==t.role||t8.test(e)?k(e,ne(t.role)):v(n,e):h("message "+ne(t.role))}if("function_call"===t.type){let e={};try{e=JSON.parse(ne(t.arguments)||"{}")}catch{e={}}let r=ne(t.name);if("exec_command"===r||"shell"===r)return m(n,String(e.cmd??e.command??"").replace(/^\/usr\/bin\/zsh -lc /,""),ne(t.call_id));if("apply_patch"===r){let t=String(e.input??"").match(/(Add|Update|Delete) File: [^\n]+/g);l.push({kind:"edit",files:t?t.join(", ").replace(/(Add|Update|Delete) File: /g,""):t1("render.patch")});return}return"write_stdin"===r?h(t1("render.stdinSession",{id:String(e.session_id??"")})):m(n,r+" "+JSON.stringify(e).slice(0,120),ne(t.call_id),"tool")}if("function_call_output"===t.type)return x(ne(t.call_id),"string"==typeof t.output?t.output:JSON.stringify(t.output??""));if("custom_tool_call"===t.type&&"apply_patch"===ne(t.name)){let e=ne(t.input).match(/(Add|Update|Delete) File: [^\n]+/g);l.push({kind:"edit",files:e?e.join(", ").replace(/(Add|Update|Delete) File: /g,""):t1("render.patch")});return}return"custom_tool_call_output"===t.type?x(ne(t.call_id),"string"==typeof t.output?t.output:JSON.stringify(t.output??"")):"reasoning"===t.type?h("reasoning"):h(ne(t.type)||"item")}if("compacted"===e.type)return y=!0,j(n);h(ne(e.type)||t1("render.record"))},S=e=>{let t=e.timestamp;if("user"===e.type&&e.message){let n=nt(e.message).content,r=nt(nt(e.toolUseResult).file);if(!0===e.isCompactSummary){let e="string"==typeof n?n:nn(n).filter(e=>"text"===e.type).map(e=>ne(e.text)).join(" ");e.trim()&&((e,t)=>{for(let e=l.length-1;e>=0;e-=1){let n=l[e];if("compact"===n.kind){n.summary=t;return}if("svc"!==n.kind&&"note"!==n.kind)break}l.push({kind:"compact",ts:e,summary:t})})(t,e.trim());return}if("string"==typeof n)g(t,n);else for(let e of nn(n))if("text"===e.type)g(t,ne(e.text));else if("image"===e.type)d(e,r);else if("tool_result"===e.type){let t=nn(e.content);for(let e of t)"image"===e.type&&d(e,r);let n="string"==typeof e.content?e.content:t.filter(e=>"image"!==e.type).map(e=>ne(e.text)).join(" ");x(ne(e.tool_use_id),n,!0===e.is_error)}return}if("assistant"===e.type&&e.message){for(let n of nn(nt(e.message).content))if("text"===n.type&&ne(n.text).trim())f(t,ne(n.text));else if("thinking"===n.type&&ne(n.thinking).trim())l.push({kind:"think",text:ne(n.thinking).replace(/\s+/g," ").trim()});else if("tool_use"===n.type&&"SendMessage"===ne(n.name)){let e=nt(n.input),r=e.message;if("string"==typeof r){let{cleaned:i,cites:a}=p(r),o=tW.test(i)?t0(i,t):null,c={kind:"tmsg",ts:t,dir:"out",peer:String(e.to??""),summary:String(e.summary??""),text:o?"":i};for(let e of(l.push(c),o&&l.push(o),a))l.push(e);ne(n.id)&&s.set(ne(n.id),c)}else h(`SendMessage → ${String(e.to??"")} \xb7 ${ne(nt(r).type)||t1("render.protocol")}`)}else if("tool_use"===n.type){let e=nt(n.input),r=String(e.command??e.file_path??e.prompt??JSON.stringify(e));m(t,ne(n.name)+": "+r.slice(0,160),ne(n.id),"tool")}return}if("system"===e.type&&"compact_boundary"===e.subtype){let n=nt(e.compactMetadata);return j(t,{trigger:ne(n.trigger)||void 0,preTokens:t2(n.preTokens)})}h(ne(e.type)||t1("render.record"))},C=null,A=()=>{if(!C)return;let e=C.join("\n").trim();if(C=null,!e)return;let t=e=>{for(let t of e.split("\n"))t.trim()&&l.push({kind:"raw",text:tG(t),err:/error|failed|traceback|exception/i.test(t)})};u(null,e,t)||t(e)},$=e=>{let t=e.replace(/\x1b\][^\x07]*(\x07|\x1b\\)/g,"").replace(/\x1b\[[0-9;?]*[A-Za-z]/g,"");if(C)if(!/^\[codex\]/.test(t))return void C.push(t);else A();if(/Assistant message$/.test(t))return;let n=t.match(/^\[([^\]]+)\]\s*(.*)$/),r=n?.[1]??null,s=n?.[2]??t;if(!(!s||/^Assistant message captured/.test(s))){if(!n&&(tW.test(t)||t.startsWith("<oai-mem-citation>"))){C=[t];return}if(/^Running command: /.test(s))return m(r,s.replace(/^Running command: /,"").replace(/^\/usr\/bin\/zsh -lc /,""));if(/^Command (completed|failed)/.test(s)){let e=[...i.values()].at(-1);e&&ni(e,/^Command failed/.test(s)?s+"\n"+t1("render.jobLogNote"):s,/^Command failed/.test(s));return}return/^Applying \d+ file/.test(s)?l.push({kind:"edit",files:s}):n&&!/^(Running|Command|Applying)/.test(s)?f(r,s):void(!c(t)&&l.push({kind:"raw",text:tG(t),err:/error|failed|traceback|exception/i.test(t)}))}};for(let n of t)if(!r||n.toLowerCase().includes(r))if("claude"===e.fmt||"codex"===e.fmt)try{let t=JSON.parse(n);t&&"object"==typeof t&&!Array.isArray(t)&&("claude"===e.fmt?S(t):N(t))}catch{$(n)}else $(n);return A(),{items:function(e,t){let n=[],r=0;for(;r<e.length;){if("cmd"!==e[r].kind){n.push(e[r]),r+=1;continue}let s=r,l=[];for(;s<e.length;){let t=e[s];if("cmd"===t.kind)l.push(t);else if("think"!==t.kind)break;s+=1}let a=s===e.length;if(l.length>=4&&!(t&&a)){let e={},t=0,a=0;for(let n of l){var i;let r=(i=n.call.cmd,i.match(/^([A-Za-z][\w.]*): /)?.[1]??"cmd");e[r]=(e[r]??0)+1,"ok"===n.call.status?t+=1:"err"===n.call.status&&(a+=1)}n.push({kind:"cmd-group",ids:l.map(e=>e.id),calls:l.map(e=>e.call),t0:l[0]?.ts,t1:l.at(-1)?.ts,byTool:e,okCount:t,errCount:a,hasErr:a>0}),r=s}else n.push(e[r]),r+=1}return n}(l,"live"===e.activity),hiddenServiceCount:a}}(e,w.lines,i,s.toLowerCase()):{items:[],hiddenServiceCount:0},[e?.path,e?.engine,e?.fmt,e?.activity,w.lines,i,s,f]),B=Math.max(0,H.items.length-C),W=B?H.items.slice(-C):H.items;(0,l.useEffect)(()=>{let t=w.tickTime?.toLocaleTimeString("uk"===p()?"uk-UA":"en-US",{hour12:!1})??"";w.error?a(w.error):e?a(`${(w.size/1024).toFixed(0)} kB${t?" \xb7 "+t:""}`):a("")},[w.error,w.size,w.tickTime,e,a]),(0,l.useLayoutEffect)(()=>{let e=v.current,t=j.current;e&&t&&(j.current=null,e.scrollTop=t.top+(e.scrollHeight-t.height))},[w.prependGen,C]),(0,l.useLayoutEffect)(()=>{let t=H.items.length,n=w.prependGen!==L.current;L.current=w.prependGen;let r=t-_.current;if(_.current=t,e&&t&&q.current!==e.path){q.current=e.path;let t=nq.get(e.path);if(!b&&t&&t.fromBottom>0&&v.current){let e=v.current;O.current=Date.now(),e.scrollTop=Math.max(0,e.scrollHeight-e.clientHeight-t.fromBottom);return}}b?U():!n&&r>0&&T(e=>e+r)},[H.items,b,w.prependGen]),(0,l.useEffect)(()=>{let e=v.current,t=k.current;if(!e||!t)return;let n=new ResizeObserver(()=>{I.current&&U()});return n.observe(t),n.observe(e),()=>n.disconnect()},[]);let K=()=>{let e=v.current;e&&(j.current={top:e.scrollTop,height:e.scrollHeight}),B?A(e=>e+S):w.hasMore&&w.loadOlder().then(()=>A(e=>e+S))},Y=B>0||w.hasMore,J=H.items.at(-1),Q=J?.kind==="cmd"&&"run"===J.call.status?{icon:tu.A,label:m("feed.running",{tool:J.call.cmd.split(/[\s:]/,1)[0]||m("feed.tool")})}:J?.kind==="think"?{icon:ta.A,label:m("feed.thinking")}:{icon:ta.A,label:m("feed.working")},G=u?"left-1/2 -translate-x-1/2":"right-3";return(0,r.jsxs)("div",{className:"relative flex min-h-0 flex-1 flex-col",children:[e&&H.items.length?b?"live"===e.activity?(0,r.jsxs)("div",{className:`pointer-events-none absolute bottom-2 ${G} 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 ${E?"scale-125":"scale-100"}`,children:[(0,r.jsx)(tH.A,{className:"h-3 w-3","aria-hidden":!0})," ",m("feed.liveTail")]}):null:(0,r.jsxs)("button",{className:`absolute bottom-2 ${G} 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":m("feed.backToLive"),onClick:()=>{U(),F(!0,!0)},children:[(0,r.jsx)(e1.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",$?m("feed.newCount",{count:$}):m("feed.down")]}):null,(0,r.jsx)("div",{ref:v,className:u?"min-h-0 flex-1 overflow-y-auto py-3":"min-h-0 flex-1 overflow-y-auto py-6",onScroll:t=>{let n=t.currentTarget,r=n.scrollTop+n.clientHeight>=n.scrollHeight-50,i=Date.now()-O.current<300;r&&!I.current?F(!0,!0):!r&&I.current&&(i?U():F(!1)),e&&!i&&nF(e.path,I.current,Math.max(0,n.scrollHeight-n.clientHeight-n.scrollTop)),n.scrollTop<120&&Y&&!w.loadingOlder&&!w.loading&&K()},children:(0,r.jsx)("div",{ref:k,className:u?"px-3 pb-4 text-[13px]":"mx-auto w-full max-w-[1060px] px-6 pb-16",children:e?(0,r.jsxs)(r.Fragment,{children:[u&&Y?(0,r.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:w.loadingOlder,onClick:K,children:w.loadingOlder?m("common.loading"):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(e9.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",m("feed.showEarlier")]})}):null,!u&&Y&&H.items.length?(0,r.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:w.loadingOlder,onClick:K,children:w.loadingOlder?m("common.loading"):B?m("feed.showEarlierHidden",{count:B}):m("feed.loadEarlier")}):null,u||Y||!H.items.length?null:(0,r.jsx)("div",{className:"mb-3 text-center text-[11px] text-dim",children:m("feed.startOfConvo")}),u?null:(0,r.jsx)(nz,{file:e,files:t,onSelect:n}),H.items.length?(0,r.jsxs)(r.Fragment,{children:[W.map((e,t)=>{let n=t+H.items.length-W.length;return u?(0,r.jsx)("div",{className:"feed-cv",children:(0,r.jsx)(nM,{item:e})},n):(0,r.jsx)(nM,{item:e},n)}),e.pendingQuestion||e.waitingInput?(0,r.jsx)(nI,{file:e},e.pendingQuestion?.toolUseId??"waiting"):null,e.pendingQuestion||e.waitingInput||!M?null:(0,r.jsx)("div",{className:"my-4 rounded-[8px] border border-line bg-chip px-4 py-3 text-[13px] font-semibold text-dim",children:M}),"live"===e.activity?(0,r.jsx)(nU,{icon:Q.icon,label:Q.label}):null,"recent"===e.activity&&eu(e)?(0,r.jsxs)("div",{className:"mt-2 flex items-center gap-1.5 text-[11.5px] font-semibold text-[#b8860b]",children:[(0,r.jsx)("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-[#d29a2f]","aria-hidden":!0})," ",m("feed.finishedTurn")]}):"recent"===e.activity&&y(e)&&"running"!==e.proc?(0,r.jsxs)("div",{className:"mt-2 flex items-center gap-1 text-[11.5px] font-semibold text-accent",children:[(0,r.jsx)(eX.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",m("feed.returnedResult")]}):null]}):(0,r.jsxs)("div",{className:"mt-[14vh] text-center text-dim",children:[w.loading?m("common.loadingCap"):0===w.size?m("feed.noOutput"):H.hiddenServiceCount?m("feed.onlyService",{count:H.hiddenServiceCount}):m("feed.empty"),!w.loading&&(e.cmdDesc||e.cmd)?(0,r.jsxs)("div",{className:"mx-auto mt-3 max-w-[560px]",children:[e.cmdDesc?(0,r.jsx)("div",{className:"text-[12.5px] font-semibold text-ink",children:e.cmdDesc}):null,e.cmd?(0,r.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:e.cmd}):null]}):null]}),H.items.length?null:e.pendingQuestion||e.waitingInput?(0,r.jsx)(nI,{file:e},e.pendingQuestion?.toolUseId??"waiting"):null]}):(0,r.jsx)("div",{className:"mt-[20vh] text-center text-dim",children:m("feed.pickLog")})})})]})}let nB=()=>"uk"===p()?"uk-UA":"en-US",nW={completed:"✓",in_progress:"▸",pending:"○"};function nK({plan:e}){let t,{t:n}=h(),i=e.total?Math.round(e.done/e.total*100):0;return(0,r.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:(t=e.steps.map(e=>`${nW[e.status]} ${e.text}`),[x(p(),"plan.agentPlan"),...t].join("\n")),"aria-label":n("plan.stepsAria",{done:e.done,total:e.total})+(e.current?n("plan.nowSuffix",{current:e.current}):""),children:[e.done,"/",e.total,(0,r.jsx)("span",{className:"h-1 w-6 overflow-hidden rounded-full bg-accent/20","aria-hidden":!0,children:(0,r.jsx)("span",{className:"block h-full rounded-full bg-accent",style:{width:`${i}%`}})})]})}let nY={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 nJ({ctx:e}){var t;let{t:n}=h();return(0,r.jsxs)("span",{className:`inline-flex shrink-0 items-center rounded-full px-1.5 py-0.5 font-mono text-[9.5px] font-semibold ${(t=e.pct)>=90?"bg-[#fbeaea] text-err":t>=70?"bg-[#fff7e6] text-[#b07d18]":"bg-chip text-dim"}`,title:n("plan.ctxTitle",{pct:e.pct,used:e.usedTokens.toLocaleString(nB()),window:e.windowTokens.toLocaleString(nB())}),"aria-label":n("plan.ctxAria",{pct:e.pct}),children:["ctx ",e.pct,"%"]})}function nQ({goal:e}){let t,n,{t:i}=h(),s=nY[e.status];return(0,r.jsx)("span",{className:`inline-flex shrink-0 items-center rounded-full px-1.5 py-0.5 text-[9.5px] font-semibold ${s.className}`,title:(t=p(),n=[e.objective??x(t,"plan.noObjective")],null!==e.tokensUsed&&n.push(x(t,"plan.tokens",{n:e.tokensUsed.toLocaleString(nB())})),null!==e.timeUsedSeconds&&n.push(x(t,"plan.time",{n:Math.round(e.timeUsedSeconds/60)})),n.join("\n")),"aria-label":i("plan.goalAria",{status:i(s.labelKey)})+(e.objective?` — ${e.objective.slice(0,120)}`:""),children:i(s.labelKey)})}let nX=()=>void 0,nG={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 nV(e,t){return"сесія"===t?e("kind.session"):"субагент"===t?e("kind.subagent"):"джоба"===t?e("kind.job"):"фон"===t?e("kind.background"):t}function nZ({file:e}){let{t}=h(),[n,i]=(0,l.useState)(()=>Date.now());(0,l.useEffect)(()=>{let e=setInterval(()=>i(Date.now()),1e4);return()=>clearInterval(e)},[]);let s=n/1e3-e.mtime,a=("live"===e.activity||"recent"===e.activity)&&s>180;return(0,r.jsx)("span",{className:`shrink-0 font-mono text-[9.5px] tabular-nums ${a?"font-semibold text-[#b3831d]":"text-dim"}`,title:t(a?"branch.lastActivityQuiet":"branch.lastActivity",{age:Q(e.mtime)}),children:Q(e.mtime)})}function n0({file:e,files:t,tasks:n,onSelect:i,isRoot:a,onClose:o,dragHandle:c,noComposer:d,banner:u,onToggleExpand:p,expanded:f}){let{t:m}=h(),x=(0,l.useRef)(null),g=ec(e),w=ex(e),v=nG[w];return(0,l.useEffect)(()=>{if(!f&&x.current){var t,n;return t=e.path,n=x.current,eg.set(t,n),()=>{eg.get(t)===n&&eg.delete(t)}}},[e.path,f]),(0,l.useEffect)(()=>{if(!d&&!f&&x.current){var t;return t=x.current,t_.set(e.path,{el:t,file:e}),()=>{t_.get(e.path)?.el===t&&t_.delete(e.path)}}},[e,d,f]),(0,r.jsx)("div",{className:`relative flex min-h-0 min-w-0 flex-1 ${v.glow?"pane-attention":""}`,style:v.glow?{"--pane-glow":v.glow}:void 0,children:(0,r.jsxs)("section",{ref:x,"data-pan-ignore":!0,"data-link-path":e.path,className:`relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden rounded-[10px] border bg-panel shadow-card ${a?"border-t-4":"border-t-2"} ${v.section}`,style:"done"===w?{borderTopColor:"#c9c9d1"}:eo(e),children:[(0,r.jsxs)("header",{className:`flex h-10 shrink-0 items-center gap-1.5 border-b border-line px-2.5 ${v.header} ${c?"cursor-grab active:cursor-grabbing":""}`,...c,children:[(0,r.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${G(e.activity)}`,title:m(`branch.${w}`)}),(0,r.jsx)(nZ,{file:e}),e.model?(0,r.jsx)("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 font-mono text-[9.5px] font-semibold",style:{backgroundColor:es(e).soft,color:es(e).color},title:[g.label,el(e)].filter(Boolean).join(" \xb7 "),children:e.model}):(0,r.jsx)("span",{className:"inline-flex shrink-0 items-center rounded-full px-2 py-0.5 text-[10px] font-bold",style:g.style,children:g.label}),e.ctx?(0,r.jsx)(nJ,{ctx:e.ctx}):null,e.worktree?(0,r.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:e.worktree}),children:[(0,r.jsx)(eQ.A,{className:"h-2.5 w-2.5","aria-hidden":!0})," ",e.worktree]}):null,e.plan?(0,r.jsx)(nK,{plan:e.plan}):null,e.goal?(0,r.jsx)(nQ,{goal:e.goal}):null,a?null:(0,r.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-0.5 text-[10px] text-dim",title:m(e.handoff?"branch.handoffTitle":"branch.branchTitle"),children:[(0,r.jsx)(eX.A,{className:"h-3 w-3","aria-hidden":!0})," ",e.handoff?m("kind.handoff"):nV(m,e.kind)]}),(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12px] font-semibold",title:b(e.title),children:b(e.title,90)}),(0,r.jsx)(nL,{file:e,compact:!0}),p?(0,r.jsx)("button",{className:"inline-flex shrink-0 items-center rounded-[8px] border border-line bg-bg px-1.5 py-0.5 text-dim hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":f?m("branch.collapseFull"):m("branch.expandFull",{title:b(e.title,60)}),title:f?m("branch.collapseFull"):m("branch.expandFull",{title:b(e.title,60)}),onClick:p,children:f?(0,r.jsx)(eG.A,{className:"h-3 w-3","aria-hidden":!0}):(0,r.jsx)(eV.A,{className:"h-3 w-3","aria-hidden":!0})}):null,(0,r.jsx)(tF,{file:e,onDeleted:o}),o?(0,r.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:b(e.title,60)}),onClick:o,children:(0,r.jsx)(s.A,{className:"h-3 w-3","aria-hidden":!0})}):null]}),u??null,n.length?(0,r.jsx)(tU,{className:"shrink-0 border-b border-line bg-[#fbfbfd]",enter:"fade",children:n.map(e=>(0,r.jsx)("div",{"data-flip-key":e.path,children:(0,r.jsx)(n1,{file:e,files:t,onSelect:i})},e.path))}):null,(0,r.jsx)(nH,{file:e,files:t,onSelect:i,showSvc:!1,lineFilter:"",onStatus:nX,paused:!1,follow:!0,setFollow:nX,compact:!0}),d?null:(0,r.jsx)(tP,{file:e})]})})}function n1({file:e,files:t,onSelect:n}){let{t:i}=h(),[s,a]=(0,l.useState)(!1),o=b(e.cmdDesc||e.title,80);return(0,r.jsxs)("div",{className:"border-t border-line first:border-t-0",children:[(0,r.jsxs)("div",{className:"flex h-7 items-center gap-1.5 pl-2 pr-2.5",children:[(0,r.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":s,"aria-label":i("branch.toggleBackground",{action:i(s?"branch.collapse":"branch.expand"),title:o}),onClick:()=>a(e=>!e),children:[(0,r.jsx)(e8.A,{className:`h-3.5 w-3.5 shrink-0 text-dim transition-transform ${s?"rotate-90":""}`,"aria-hidden":!0}),(0,r.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${G(e.activity)}`}),(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-semibold",title:b(e.title),children:o})]}),(0,r.jsx)(nL,{file:e,compact:!0})]}),s?(0,r.jsx)("div",{className:"flex h-[220px] flex-col border-t border-dashed border-line bg-bg/60",children:(0,r.jsx)(nH,{file:e,files:t,onSelect:n,showSvc:!1,lineFilter:"",onStatus:nX,paused:!1,follow:!0,setFollow:nX,compact:!0})}):null]})}let n5=[{key:"claude",label:"Claude"},{key:"codex",label:"Codex"}],n2=(e,t)=>`llvDraftPane:${e}:${t}`;function n3(e,t){return sessionStorage.getItem(n2(e,t))??""}function n4(e,t,n){n?sessionStorage.setItem(n2(e,t),n):sessionStorage.removeItem(n2(e,t))}function n6({draftId:e,project:t,files:n,onClose:i,onSpawned:a}){let{t:o}=h(),[c]=(0,l.useState)(()=>n3(e,"src")),d=c?n.find(e=>e.path===c)??null:null,[u,p]=(0,l.useState)(()=>{let t=n3(e,"engine");return"codex"===t||"claude"===t?t:d?.engine==="codex"?"codex":"claude"}),[f,m]=(0,l.useState)(()=>n3(e,"cwd")),[x,g]=(0,l.useState)([]),[w,v]=(0,l.useState)(()=>(function(e){try{let t=JSON.parse(n3(e,"boot")||"null");return t&&"number"==typeof t.at&&"string"==typeof t.prompt?t:null}catch{return null}})(e)),[k,y]=(0,l.useState)(!1),j=(0,l.useRef)(null),N=tT({initialText:()=>n3(e,"text")||(c?o("draft.readPrompt",{src:c}):""),persistText:t=>n4(e,"text",t),submit:e=>M(e),disabled:!!w}),{text:S,setText:C,setStatus:A,busy:$,setBusy:T,voiceSending:E,attachments:D}=N;(0,l.useEffect)(()=>{let n=!1;return fetch("/api/spawn?project="+encodeURIComponent(t)+(c?"&src="+encodeURIComponent(c):"")).then(e=>e.json()).then(t=>{n||(Array.isArray(t.dirs)&&g(t.dirs),m(n=>{let r="string"==typeof t.cwd?t.cwd:"",i=n||r||t.dirs?.[0]||"";return i!==n&&n4(e,"cwd",i),i}))}).catch(()=>{}),()=>{n=!0}},[t,e,c]),(0,l.useEffect)(()=>{if(!w)return;let e=j.current,t=w.path?n.find(e=>e.path===w.path):n.find(t=>"codex"===t.engine&&"codex-sessions"===t.root&&(c&&t.parent===c||!t.parent)&&t.mtime>=w.at/1e3-30&&(!e||!e.has(t.path)));t&&a(t)},[n,w,a,c]),(0,l.useEffect)(()=>{if(!w)return;let e=w.at+9e4-Date.now();if(e<=0)return void y(!0);let t=window.setTimeout(()=>y(!0),e);return()=>window.clearTimeout(t)},[w]);let M=async t=>{let r=t??S;if(!$&&!E&&!w){if(!f.trim())return void A({kind:"err",text:o("draft.needDir")});if(r.trim()||D.images.length){T(!0),A(null);try{var i;let t=await fetch("/api/spawn",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({engine:u,cwd:f.trim(),prompt:r,images:D.images.map(e=>({base64:e.base64,mime:e.mime})),...c?{src:c}:{}})}),s=await t.json();if(!t.ok||!s.ok)return void A({kind:"err",text:s.error??o("draft.launchFailed")});j.current=new Set(n.map(e=>e.path)),i={at:Date.now(),target:s.target??"",path:s.path??null,prompt:r.trim()},v(i),n4(e,"boot",i?JSON.stringify(i):""),C(""),D.clear()}catch{A({kind:"err",text:o("common.serverUnavailable")})}finally{T(!1)}}}},R=V[u]??Z,P=N.fieldsDisabled,I="draft-dirs-"+e;return(0,r.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:R.color},"aria-label":o("draft.paneAria"),children:[(0,r.jsxs)("header",{className:"flex h-10 shrink-0 items-center gap-1.5 border-b border-line px-2.5",style:{backgroundColor:R.soft},children:[(0,r.jsx)("span",{className:"h-2 w-2 shrink-0 rounded-full bg-[#c9c9d1]",title:o("draft.notStarted")}),(0,r.jsx)("div",{className:"flex shrink-0 items-center gap-1",role:"radiogroup","aria-label":o("draft.engineAria"),children:n5.map(({key:t,label:n})=>{let i=u===t,s=V[t]??Z;return(0,r.jsx)("button",{type:"button",role:"radio","aria-checked":i,disabled:P,onClick:()=>{p(t),n4(e,"engine",t)},style:i?{backgroundColor:"#fff",color:s.color,borderColor:s.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 ${i?"":"border-transparent bg-transparent text-dim hover:text-ink"}`,children:n},t)})}),(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12px] font-semibold text-dim",title:d?b(d.title):void 0,children:c?o("draft.handoffLabel",{title:d?b(d.title,60):o("draft.conversation")}):o("draft.newConvo")}),(0,r.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":o("draft.dismiss"),onClick:i,children:(0,r.jsx)(s.A,{className:"h-3 w-3","aria-hidden":!0})})]}),(0,r.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,r.jsx)("span",{className:"shrink-0 text-[10px] font-semibold text-dim",children:o("draft.directory")}),(0,r.jsx)("input",{value:f,disabled:P,onChange:t=>{var n;m(n=t.target.value),n4(e,"cwd",n)},list:I,placeholder:"/home/…/Projects/…","aria-label":o("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,r.jsx)("datalist",{id:I,children:x.map(e=>(0,r.jsx)("option",{value:e},e))})]}),(0,r.jsx)("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto px-4 py-4",children:w?(0,r.jsxs)("div",{className:"flex flex-1 flex-col justify-end gap-3",children:[(0,r.jsx)("div",{className:"flex justify-end",children:(0,r.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:w.prompt||o("draft.imagesOnly")})}),(0,r.jsxs)("div",{className:"flex items-center gap-2 text-[11.5px] font-semibold text-dim",children:[(0,r.jsx)(tg.A,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}),(0,r.jsx)("span",{children:o("draft.launched",{target:w.target})})]}),k?(0,r.jsx)("div",{className:"text-[11px] text-dim",children:o("draft.slow",{target:w.target})}):null]}):(0,r.jsxs)("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 text-center",children:[(0,r.jsx)("span",{className:"rounded-full px-3 py-1 text-[13px] font-bold",style:{backgroundColor:R.soft,color:R.color},children:"claude"===u?"Claude":"Codex"}),(0,r.jsx)("div",{className:"max-w-[360px] text-[12px] text-dim",children:c?o("draft.hintRelay"):o("draft.hintNew")}),c?(0,r.jsx)("div",{className:"max-w-[420px] truncate font-mono text-[10px] text-dim",title:c,children:c}):null]})}),(0,r.jsx)("form",{onSubmit:e=>{e.preventDefault(),M()},className:"flex shrink-0 flex-col gap-1.5 border-t border-line bg-[#fbfbfd] px-2.5 py-2","aria-label":o("draft.promptAria"),children:(0,r.jsx)(tD,{composer:N,placeholder:o("draft.placeholder"),textareaAriaLabel:o("draft.promptTextAria"),imageAriaLabel:o("draft.addImages"),sendLabelIdle:o("composer.launchAgent"),sendLabelRecording:o("draft.stopAndLaunch"),sendIdleClassName:"hover:opacity-90",sendIdleStyle:{backgroundColor:R.color,borderColor:R.color},leftSlot:(0,r.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:o("draft.newWindowTitle"),children:[(0,r.jsx)(tl.A,{className:"h-3 w-3 shrink-0","aria-hidden":!0})," ",o("draft.newAgent")]})})})]})}let n8=(e,t)=>`llvWfDraft:${e}:${t}`;function n9(e,t){return sessionStorage.getItem(n8(e,t))??""}function n7(e,t,n){n?sessionStorage.setItem(n8(e,t),n):sessionStorage.removeItem(n8(e,t))}function re({draftId:e,project:t,onClose:n,onLaunched:i}){let{t:a}=h(),[o,c]=(0,l.useState)([]),[d,u]=(0,l.useState)(()=>n9(e,"template")),[p,f]=(0,l.useState)(()=>n9(e,"dir")),[m,x]=(0,l.useState)(()=>n9(e,"task")),[b,g]=(0,l.useState)(()=>"manual"===n9(e,"mode")),[w,v]=(0,l.useState)([]),[k,y]=(0,l.useState)(!1),[j,N]=(0,l.useState)(null);(0,l.useEffect)(()=>{let n=!1;return fetch("/api/workflows").then(e=>e.json()).then(t=>{!n&&Array.isArray(t.templates)&&(c(t.templates),u(n=>{let r=n&&t.templates.some(e=>e.name===n)?n:t.templates[0]?.name??"";return r!==n&&n7(e,"template",r),r}))}).catch(()=>{}),fetch("/api/spawn?project="+encodeURIComponent(t)).then(e=>e.json()).then(t=>{!n&&Array.isArray(t.dirs)&&(v(t.dirs),f(n=>{let r=n||t.dirs?.[0]||"";return r!==n&&n7(e,"dir",r),r}))}).catch(()=>{}),()=>{n=!0}},[t,e]);let S=o.find(e=>e.name===d)??null,C=async()=>{if(!k){if(!p.trim())return void N(a("wfDraft.needDir"));if(!m.trim())return void N(a("wfDraft.needTask"));y(!0),N(null);try{let e=await fetch("/api/workflows",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({template:d,task:m.trim(),repoDir:p.trim(),mode:b?"manual":"auto"})}),t=await e.json();if(!e.ok||!t.ok)return void N(t.error??a("wfDraft.launchFailed"));window.dispatchEvent(new Event(e_)),i()}catch{N(a("common.serverUnavailable"))}finally{y(!1)}}},A="wf-draft-dirs-"+e;return(0,r.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 border-t-accent bg-panel shadow-card","aria-label":a("wfDraft.paneAria"),children:[(0,r.jsxs)("header",{className:"flex h-10 shrink-0 items-center gap-2 border-b border-line bg-[#ecebfb] px-2.5",children:[(0,r.jsx)("span",{className:"h-2 w-2 shrink-0 rounded-full bg-[#c9c9d1]",title:a("wfDraft.notStarted")}),(0,r.jsx)("span",{className:"shrink-0 text-[10.5px] font-bold tracking-[0.08em] text-accent",children:a("wfStrip.workflow")}),(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12px] font-semibold text-dim",children:a("wfDraft.newWorkflow")}),(0,r.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":a("wfDraft.dismiss"),onClick:n,children:(0,r.jsx)(s.A,{className:"h-3 w-3","aria-hidden":!0})})]}),(0,r.jsxs)("div",{className:"flex shrink-0 flex-col gap-1.5 border-b border-line bg-[#fbfbfd] px-2.5 py-2",children:[(0,r.jsxs)("label",{className:"flex items-center gap-1.5",children:[(0,r.jsx)("span",{className:"w-[72px] shrink-0 text-[10px] font-semibold text-dim",children:a("wfDraft.template")}),(0,r.jsx)("select",{value:d,disabled:k,onChange:t=>{var n;u(n=t.target.value),n7(e,"template",n)},"aria-label":a("wfDraft.templateAria"),className:"min-w-0 flex-1 rounded-[6px] border border-line bg-panel px-2 py-1 text-[11.5px] text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60",children:o.map(e=>(0,r.jsx)("option",{value:e.name,children:e.name},e.name))})]}),(0,r.jsxs)("label",{className:"flex items-center gap-1.5",children:[(0,r.jsx)("span",{className:"w-[72px] shrink-0 text-[10px] font-semibold text-dim",children:a("wfDraft.repo")}),(0,r.jsx)("input",{value:p,disabled:k,onChange:t=>{var n;f(n=t.target.value),n7(e,"dir",n)},list:A,placeholder:"/home/…/Projects/…","aria-label":a("wfDraft.repoAria"),className:"min-w-0 flex-1 rounded-[6px] border border-line bg-panel px-2 py-1 font-mono text-[11px] text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60"}),(0,r.jsx)("datalist",{id:A,children:w.map(e=>(0,r.jsx)("option",{value:e},e))})]}),(0,r.jsxs)("label",{className:"flex items-center gap-1.5 text-[10.5px] font-semibold text-dim",children:[(0,r.jsx)("input",{type:"checkbox",checked:b,disabled:k,onChange:t=>{var n;g(n=t.target.checked),n7(e,"mode",n?"manual":"")},className:"accent-[#5a51e0]"}),a("wfDraft.manualMode")]})]}),(0,r.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto px-4 py-3",children:[S?(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5","aria-label":a("wfStrip.stagesAria"),children:[S.stages.map((e,t)=>(0,r.jsxs)("span",{className:"flex items-center gap-1.5",children:[t>0?(0,r.jsx)("span",{className:"text-[10px] font-bold text-[#c9c9d1]","aria-hidden":!0,children:"→"}):null,(0,r.jsx)("span",{className:"inline-flex h-6 max-w-[200px] items-center truncate rounded-full bg-chip px-2 text-[10.5px] font-bold text-[#555]",children:"review-loop"===e.kind?`${a("wfStrip.reviewStage")} \xb7 ${e.reviewer.engine}${e.reviewer.effort?" "+e.reviewer.effort:""}`:`${e.scope.split(/[.:\n]/)[0]} \xb7 ${e.agent.engine}${e.agent.model?" "+e.agent.model:""}${e.agent.effort?" "+e.agent.effort:""}`})]},t)),(0,r.jsxs)("span",{className:"inline-flex h-6 items-center rounded-full bg-chip px-2 text-[10.5px] font-bold text-[#555]",children:["→ ","merge"===S.finish?a("wfDraft.finishMerge"):"PR"]})]}):(0,r.jsx)("div",{className:"text-[12px] text-dim",children:a("wfDraft.hint")}),(0,r.jsx)("textarea",{value:m,disabled:k,onChange:t=>{var n;x(n=t.target.value),n7(e,"task",n)},placeholder:a("wfDraft.taskPlaceholder"),"aria-label":a("wfDraft.taskAria"),className:"min-h-[160px] flex-1 resize-none rounded-[8px] border border-line bg-panel px-2.5 py-2 text-[12.5px] leading-snug text-ink placeholder:text-dim/70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60"})]}),(0,r.jsxs)("div",{className:"flex shrink-0 items-center gap-2 border-t border-line bg-[#fbfbfd] px-2.5 py-2",children:[j?(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11px] font-semibold text-err",title:j,children:j}):(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate text-[10.5px] text-dim",children:a("wfDraft.footerHint")}),(0,r.jsxs)("button",{className:"inline-flex shrink-0 items-center gap-1.5 rounded-full border border-accent bg-accent px-3.5 py-1.5 text-[11.5px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",disabled:k,onClick:()=>void C(),children:[k?(0,r.jsx)(tg.A,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):null,k?a("wfDraft.launching"):a("wfDraft.launch")]})]})]})}var rt=n(2749),rn=n(1275);function rr({wf:e}){var t;let{t:n}=h(),[i,a]=(0,l.useState)(!1),[o,c]=(0,l.useState)(null),d=async t=>{if(i)return;a(!0),c(null);let n=await eq(e.id,{action:t});n&&c(n),a(!1)},u=ez.has(e.state),p="closed"===e.state||"approved"===e.state,f=("implementing"===e.state||"reviewing"===e.state)&&!!e.stageRuns[e.stageIndex]?.doneAt,m=t=>{let r=e.template.stages[t];return r?"review-loop"===r.kind?n("wfStrip.reviewStage"):r.scope.split(/[.:\n]/)[0]?.trim()||`S${t+1}`:`S${t+1}`};return(0,r.jsxs)("div",{"data-scheme-ui":!0,className:`pointer-events-auto flex min-h-11 w-full items-center gap-3 rounded-[14px] border bg-panel/95 px-4 py-1 shadow-[0_2px_10px_rgb(20_20_30/0.08)] ${u?"border-[#e0ae45]/70":"border-line"}`,children:[(0,r.jsxs)("span",{className:"flex min-w-0 max-w-[46%] shrink-0 items-center gap-2",children:[(0,r.jsx)("span",{className:`h-2.5 w-2.5 shrink-0 rounded-full ${"approved"===e.state?"bg-ok":"needs_decision"===e.state?"bg-err":"paused"===e.state?"bg-[#e0ae45]":eO.has(e.state)?"bg-ok animate-pulse":"bg-[#9a9aa4]"}`,"aria-hidden":!0}),(0,r.jsx)("span",{className:"shrink-0 text-[10.5px] font-bold tracking-[0.08em] text-dim",children:n("wfStrip.workflow")}),(0,r.jsx)("span",{className:"shrink-0 text-[12px] font-bold",children:e.name}),(0,r.jsx)("span",{className:"shrink-0 text-[11.5px] font-semibold text-dim",children:(t=e.state,n(`wfState.${t}`))}),e.stateDetail?(0,r.jsx)("span",{className:"min-w-0 truncate text-[11.5px] font-semibold text-err",title:e.stateDetail,children:e.stateDetail}):null]}),(0,r.jsx)("span",{className:"no-scrollbar flex min-w-0 flex-1 items-center justify-center gap-1.5 overflow-x-auto","aria-label":n("wfStrip.stagesAria"),children:e.template.stages.map((t,n)=>{let i,s=(i=e.stageRuns[n],i?.doneAt?{color:"#1a8a3e",soft:"#e7f4ea",pulse:!1}:n===e.stageIndex&&eO.has(e.state)&&"provisioning"!==e.state?{color:"#5a51e0",soft:"#ecebfb",pulse:!0}:{color:"#8b8b95",soft:"#efeff3",pulse:!1}),l=e.stageRuns[n];return(0,r.jsxs)("span",{className:"flex shrink-0 items-center gap-1.5",children:[n>0?(0,r.jsx)("span",{className:"text-[10px] font-bold text-[#c9c9d1]","aria-hidden":!0,children:"→"}):null,(0,r.jsxs)("span",{className:`inline-flex h-6 max-w-[180px] items-center gap-1 truncate rounded-full px-2 text-[10.5px] font-bold ${s.pulse?"animate-pulse":""}`,style:{backgroundColor:s.soft,color:s.color},title:l?.doneNote??m(n),children:[l?.doneAt?"✓ ":"",m(n)]})]},n)})}),(0,r.jsxs)("span",{className:"flex shrink-0 items-center gap-1.5",children:[o?(0,r.jsx)("span",{className:"max-w-[220px] truncate text-[10.5px] font-semibold text-err",title:o,children:o}):null,i?(0,r.jsx)(rt.A,{className:"h-3.5 w-3.5 shrink-0 animate-spin text-dim","aria-hidden":!0}):null,e.prUrl?(0,r.jsxs)("a",{className:"inline-flex h-6 shrink-0 items-center gap-1 rounded-full border border-ok/40 bg-[#eef8f0] px-2.5 text-[10.5px] font-bold text-ok hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",href:e.prUrl,target:"_blank",rel:"noreferrer",children:[(0,r.jsx)(rn.A,{className:"h-3 w-3","aria-hidden":!0})," PR"]}):null,f?(0,r.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:i,onClick:()=>void d("advance"),children:n("wfStrip.advance")}):null,"needs_decision"===e.state?(0,r.jsxs)(r.Fragment,{children:[(0,r.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:i,onClick:()=>void d("retry-stage"),children:n("wfStrip.retryStage")}),(0,r.jsx)("button",{className:"shrink-0 rounded-full border border-line bg-bg px-2.5 py-1 text-[10.5px] font-bold text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:i,onClick:()=>void d("advance"),children:n("wfStrip.skipStage")})]}):null,p?null:"paused"===e.state?(0,r.jsx)(tj,{label:n("wfStrip.resume"),children:(0,r.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:i,"aria-label":n("wfStrip.resume"),onClick:()=>void d("resume"),children:(0,r.jsx)(tl.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})}):(0,r.jsx)(tj,{label:n("wfStrip.pause"),children:(0,r.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:i,"aria-label":n("wfStrip.pause"),onClick:()=>void d("pause"),children:(0,r.jsx)(nR.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})}),(0,r.jsx)(tj,{label:n("wfStrip.close"),children:(0,r.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:i,"aria-label":n("wfStrip.close"),onClick:()=>void d("close"),children:(0,r.jsx)(s.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})})]})]})}let ri={inbox:{color:"#e0ae45",soft:"#fdf3dd"},assigned:{color:"#5a51e0",soft:"#efeefc"},blocked:{color:"#d97757",soft:"#faeee9"},done:{color:"#1a8a3e",soft:"#e7f4ea"}},rs=["inbox","assigned","blocked","done"];function rl(e){return e.split(/\r?\n/,1)[0]?.trim()??""}function ra(e,t){return("done"===e.status)-("done"===t.status)||t.updatedAt.localeCompare(e.updatedAt)}function ro({tasks:e,project:t,onOpenTask:n,onClose:i}){let{t:a}=h(),[o,c]=(0,l.useState)("project"),d=(0,l.useMemo)(()=>("project"===o?e.filter(e=>e.project===t):[...e]).sort(ra),[e,t,o]);return(0,r.jsxs)("aside",{className:"flex w-[280px] shrink-0 flex-col border-l border-line bg-panel","aria-label":a("tasks.panelTitle"),children:[(0,r.jsxs)("div",{className:"flex h-9 shrink-0 items-center gap-1.5 border-b border-line px-2.5",children:[(0,r.jsx)("span",{className:"text-[12px] font-bold",children:a("tasks.panelTitle")}),(0,r.jsx)("div",{className:"ml-1 flex items-center rounded-full border border-line p-0.5",children:["project","all"].map(e=>(0,r.jsx)("button",{type:"button","aria-pressed":o===e,className:`rounded-full px-2 py-0.5 text-[10px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${o===e?"bg-accent/10 text-accent":"text-dim hover:text-ink"}`,onClick:()=>c(e),children:"project"===e?a("tasks.panelThisProject"):a("tasks.panelAll")},e))}),(0,r.jsx)("button",{type:"button",className:"ml-auto inline-flex shrink-0 items-center rounded-[8px] border border-line bg-bg px-1.5 py-0.5 text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":a("tasks.panelClose"),onClick:i,children:(0,r.jsx)(s.A,{className:"h-3 w-3","aria-hidden":!0})})]}),(0,r.jsx)("div",{className:"flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto p-1.5",children:d.length?d.map(e=>{let t=ri[e.status];return(0,r.jsxs)("button",{type:"button",className:`flex w-full min-w-0 flex-col gap-0.5 rounded-[8px] border border-line bg-panel px-2 py-1.5 text-left shadow-card hover:border-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${"done"===e.status?"opacity-60":""}`,title:e.text,onClick:()=>n(e),children:[(0,r.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,r.jsx)("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 text-[9px] font-bold",style:{backgroundColor:t.soft,color:t.color},children:a(`tasks.status.${e.status}`)}),(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-semibold",children:rl(e.text)||a("tasks.untitled")})]}),(0,r.jsxs)("span",{className:"flex items-center gap-2 pl-0.5 text-[10px] text-dim",children:["all"===o?(0,r.jsx)("span",{className:"min-w-0 max-w-[110px] truncate",children:e.project}):null,e.assignments.length?(0,r.jsxs)("span",{children:["⤷ ",e.assignments.length]}):null,(0,r.jsx)("span",{children:Q(new Date(e.updatedAt).getTime()/1e3)})]})]},e.id)}):(0,r.jsx)("div",{className:"px-2 py-3 text-center text-[11px] text-dim",children:a("tasks.panelEmpty")})})]})}let rc=0,rd=new Set;function ru(e,t){let n={id:++rc,kind:e,text:t};for(let e of rd)e(n)}function rp(e,t){let n=p(),r=e.results.length,i=x(n,"tasks.sendOk",{delivered:e.delivered,total:r});if(!e.failed)return{kind:"ok",text:i};let s=new Map(t.map(e=>[e.path,e])),l=e.results.filter(e=>!e.ok).map(e=>{let t=s.get(e.path);return x(n,"tasks.sendFailPart",{title:t?b(t.title,40):e.path.split("/").pop()??e.path,error:e.error??""})});return{kind:"err",text:`${i}; ${l.join("; ")}`}}function rf(){let[e,t]=(0,l.useState)([]);return((0,l.useEffect)(()=>{let e=e=>{t(t=>[...t.slice(-3),e]),window.setTimeout(()=>t(t=>t.filter(t=>t.id!==e.id)),6e3)};return rd.add(e),()=>{rd.delete(e)}},[]),e.length)?(0,r.jsx)("div",{className:"pointer-events-none absolute inset-x-0 bottom-14 z-50 flex flex-col items-center gap-1.5 px-3",children:e.map(e=>(0,r.jsxs)("div",{className:`pointer-events-auto flex max-w-[560px] items-start gap-2 rounded-[10px] border px-3 py-2 text-[11.5px] font-semibold shadow-[0_10px_36px_rgb(20_20_30/0.18)] ${"ok"===e.kind?"border-ok/40 bg-[#eef8f0] text-[#1c6b30]":"border-err/40 bg-[#fdf0f0] text-[#8f2525]"}`,children:[(0,r.jsx)("span",{className:"min-w-0 break-words",children:e.text}),(0,r.jsx)("button",{type:"button",className:"mt-0.5 shrink-0 rounded p-0.5 opacity-60 hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":x(p(),"viewer.closeNotification"),onClick:()=>t(t=>t.filter(t=>t.id!==e.id)),children:(0,r.jsx)(s.A,{className:"h-3 w-3","aria-hidden":!0})})]},e.id))}):null}var rm=n(8780);async function rx(e,t,n){try{let r=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({pid:e.pid??void 0,path:e.path,text:t,images:n})}),i=await r.json().catch(()=>null);if(!r.ok||!i?.ok)return i?.error??x(p(),"common.failedSend");return null}catch{return x(p(),"common.serverUnavailable")}}function rh({files:e,project:t,checked:n,onChange:i,maxHeight:s=240}){let{t:a}=h(),o=(0,l.useMemo)(()=>e.filter(e=>S(e)===t&&(k(e)||j(e))).sort((e,t)=>t.mtime-e.mtime),[e,t]),c=(0,l.useMemo)(()=>$(e),[e]),d=(0,l.useMemo)(()=>new Set(o.map(e=>e.path)),[o]);return o.length?(0,r.jsx)("div",{className:"flex flex-col gap-0.5 overflow-y-auto",style:{maxHeight:s},children:o.map(e=>{let t=ec(e),s=T(e,c).filter(e=>d.has(e.path)).length;return(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsxs)("label",{className:"flex h-7 min-w-0 flex-1 cursor-pointer items-center gap-1.5 rounded-[6px] px-1.5 hover:bg-bg",children:[(0,r.jsx)("input",{type:"checkbox",checked:n.has(e.path),onChange:()=>{var t;let r;return t=e.path,void((r=new Set(n)).has(t)?r.delete(t):r.add(t),i(r))},className:"accent-accent"}),(0,r.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${G(e.activity)}`}),(0,r.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:t.style,children:t.label}),(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11px] font-semibold",title:b(e.title),children:b(e.title,46)})]}),s?(0,r.jsxs)("button",{type:"button",className:"inline-flex h-6 shrink-0 items-center gap-0.5 rounded-[6px] px-1 text-[10px] font-semibold text-dim hover:bg-bg hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:a("tasks.pickerAllChildren"),onClick:()=>(e=>{let t=new Set(n);for(let n of(t.add(e.path),T(e,c)))d.has(n.path)&&t.add(n.path);i(t)})(e),children:[(0,r.jsx)(eX.A,{className:"h-3 w-3","aria-hidden":!0})," ",s]}):null]},e.path)})}):(0,r.jsx)("div",{className:"px-1.5 py-2 text-[11px] text-dim",children:a("tasks.pickerEmpty")})}function rb({value:e,onPick:t}){let{t:n}=h();return(0,r.jsx)("div",{className:"flex flex-wrap items-center gap-1",children:rs.map(i=>{let s=ri[i],l=i===e;return(0,r.jsx)("button",{type:"button","aria-pressed":l,className:"rounded-full border px-2 py-0.5 text-[10.5px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",style:l?{backgroundColor:s.soft,color:s.color,borderColor:s.color}:{borderColor:"transparent",color:"#8b8b95"},onClick:()=>t(i),children:n(`tasks.status.${i}`)},i)})})}function rg({project:e,files:t,onCreated:n}){let{t:i}=h(),[s,a]=(0,l.useState)(()=>new Set),o=tT({initialText:()=>sessionStorage.getItem("llvTaskSheetDraft:"+e)??"",persistText:t=>{t?sessionStorage.setItem("llvTaskSheetDraft:"+e,t):sessionStorage.removeItem("llvTaskSheetDraft:"+e)},submit:e=>v(e)}),{text:c,setText:d,setStatus:u,busy:f,setBusy:m,voiceSending:g,attachments:w}=o,v=async r=>{let l=r??c;if(!f&&!g){if(!l.trim())return void u({kind:"err",text:i("tasks.composerNeedsText")});m(!0),u(null);try{let r=await eT({project:e,text:l,pos:{x:120,y:120}});if("error"in r)return void u({kind:"err",text:r.error});let i=[...s];if(i.length){let e=await eP(r.task.id,i);if("error"in e)ru("err",e.error);else{let n=rp(e,t);ru(n.kind,n.text);let r=w.images.map(e=>({base64:e.base64,mime:e.mime}));if(r.length){let n=new Map(t.map(e=>[e.path,e])),i=e.results.filter(e=>e.ok).map(e=>{var t;let r,i,s;return n.get(e.path)??(r=(t=e.path).includes("/.codex/sessions/")?"codex-sessions":t.includes("/.claude/projects/")?"claude-projects":/\/tmp\/claude-\d+\//.test(t)?"claude-tasks":"codex-jobs",i=t.endsWith(".jsonl")?"claude-projects"===r?"claude":"codex":"plain",s=r.startsWith("codex")?"codex":"claude-tasks"===r?"shell":"claude",{path:t,root:r,fmt:i,engine:s,kind:"",title:b(t.split("/").pop()||t,120),project:"",worktree:void 0,mtime:Date.now()/1e3,size:0,activity:"idle",proc:null,pid:null,model:null,pendingQuestion:null,waitingInput:null,parent:null,name:t})}),s=[];for(let e of i)s.push(await rx(e,"",r));if(s.some(e=>null!==e)){let e=function(e,t){let n=p(),r=t.filter(e=>null===e).length,i=x(n,"tasks.sendOk",{delivered:r,total:e.length});if(r===e.length)return{kind:"ok",text:i};let s=e.map((e,n)=>({file:e,error:t[n]})).filter(e=>e.error).map(e=>x(n,"tasks.sendFailPart",{title:b(e.file.title,40),error:e.error??""}));return{kind:"err",text:`${i}; ${s.join("; ")}`}}(i,s);ru(e.kind,e.text)}}}}d(""),w.clear(),n(r.task)}finally{m(!1)}}};return(0,r.jsxs)("form",{onSubmit:e=>{e.preventDefault(),v()},className:"flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto p-3",children:[(0,r.jsx)("div",{className:"flex flex-col gap-1.5",children:(0,r.jsx)(tD,{composer:o,placeholder:i("tasks.newPlaceholder"),textareaAriaLabel:i("tasks.editAria"),imageAriaLabel:i("composer.addImages"),sendLabelIdle:i("tasks.sheetCreate"),sendLabelRecording:i("composer.stopAndSend"),sendIdleClassName:"border-accent bg-accent hover:opacity-90",leftSlot:(0,r.jsx)("span",{className:"inline-flex min-w-0 items-center gap-1 rounded-full bg-chip px-1.5 py-1 text-[9.5px] font-semibold text-[#555]",children:i("tasks.sheetTargets",{count:s.size})})})}),(0,r.jsxs)("div",{className:"flex flex-col gap-1 rounded-[10px] border border-line bg-panel p-1.5",children:[(0,r.jsx)("div",{className:"px-1 text-[10.5px] font-bold text-dim",children:i("tasks.pickerTitle")}),(0,r.jsx)(rh,{files:t,project:e,checked:s,onChange:a,maxHeight:9999})]})]})}function rw({task:e,files:t,onDeleted:n}){let{t:i}=h(),[s,a]=(0,l.useState)(e.text),[o,c]=(0,l.useState)(()=>new Set),[d,u]=(0,l.useState)(!1),[p,f]=(0,l.useState)(!1);(0,l.useEffect)(()=>{if(!p)return;let e=window.setTimeout(()=>f(!1),4e3);return()=>window.clearTimeout(e)},[p]);let m=t$({onError:e=>ru("err",e),onUnclaimedText:e=>a(t=>t?t.trimEnd()+" "+e:e),onLiveCommit:e=>a(t=>t?t.trimEnd()+" "+e:e)}),x=async()=>{if(s===e.text)return null;if(!s.trim())return i("tasks.emptyTextBlocked");let t=await eM(e.id,{text:s});return t&&ru("err",t),t},g=async()=>{let n=[...o];if(n.length&&!d){if(!s.trim())return void ru("err",i("tasks.emptyTextBlocked"));u(!0);try{if(await x()!==null)return;let r=await eP(e.id,n);if("error"in r)ru("err",r.error);else{let e=rp(r,t);ru(e.kind,e.text),c(new Set)}}finally{u(!1)}}},w=new Map(t.map(e=>[e.path,e]));return(0,r.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto p-3",children:[(0,r.jsxs)("div",{className:"flex flex-col gap-1.5 rounded-[10px] border border-line bg-panel p-2",children:[(0,r.jsx)("textarea",{value:m.liveText?(s?s.trimEnd()+" ":"")+m.liveText:s,readOnly:!!m.liveText,onChange:e=>a(e.target.value),onBlur:()=>void x(),rows:Math.min(14,Math.max(4,s.split("\n").length+1)),"aria-label":i("tasks.editAria"),maxLength:6e3,className:"w-full resize-none rounded-[8px] border border-line bg-panel px-2.5 py-1.5 text-[12.5px] leading-[18px] text-[#222] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40"}),(0,r.jsxs)("div",{className:"flex items-center justify-between gap-1.5",children:[(0,r.jsx)(rb,{value:e.status,onPick:t=>{t!==e.status&&eM(e.id,{status:t}).then(e=>{e&&ru("err",e)})}}),(0,r.jsx)(tE,{...m,onText:e=>a(t=>t?t.trimEnd()+" "+e:e)})]})]}),e.assignments.length?(0,r.jsxs)("div",{className:"flex flex-col gap-1 rounded-[10px] border border-line bg-panel p-2",children:[(0,r.jsx)("div",{className:"text-[10.5px] font-bold text-dim",children:i("tasks.sheetAssignments")}),e.assignments.map((n,l)=>{let a=n.path?w.get(n.path)??null:null,o="failed"===n.state,c=a?ec(a):null,d=n.path?a?b(a.title,44):n.path.split("/").pop()??n.path:i("tasks.spawning");return(0,r.jsxs)("div",{className:`flex h-7 items-center gap-1.5 rounded-[6px] px-1.5 ${o?"bg-[#faeee9] text-[#a04a2e]":a?"bg-bg":"bg-bg opacity-60"}`,title:o?i("tasks.chipFailedTitle",{error:n.error??""}):void 0,children:[a?(0,r.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${G(a.activity)}`}):null,c?(0,r.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:c.style,children:c.label}):null,(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11px] font-semibold",children:d}),o?(0,r.jsx)("span",{"aria-hidden":!0,children:"⚠"}):null,n.path&&(o||!a)?(0,r.jsx)("button",{type:"button",className:"shrink-0 rounded px-1 text-[10px] font-bold text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>{(async()=>{if(!s.trim())return ru("err",i("tasks.emptyTextBlocked"));if(await x()!==null)return;let r=await eP(e.id,[n.path]);if("error"in r)ru("err",r.error);else{let e=rp(r,t);ru(e.kind,e.text)}})()},children:i("tasks.retry")}):null]},(n.path??"spawning")+l)})]}):null,(0,r.jsxs)("div",{className:"flex flex-col gap-1 rounded-[10px] border border-line bg-panel p-1.5",children:[(0,r.jsx)("div",{className:"px-1 text-[10.5px] font-bold text-dim",children:i("tasks.pickerTitle")}),(0,r.jsx)(rh,{files:t,project:e.project,checked:o,onChange:c,maxHeight:9999}),(0,r.jsxs)("button",{type:"button",disabled:!o.size||d,className:"mt-1 inline-flex h-8 items-center justify-center gap-1.5 rounded-[8px] border border-accent bg-accent text-[11.5px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",onClick:()=>void g(),children:[d?(0,r.jsx)(tg.A,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):(0,r.jsx)(nP.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),i("tasks.pickerSend",{count:o.size})]})]}),(0,r.jsxs)("button",{type:"button",className:`inline-flex h-8 items-center justify-center gap-1.5 rounded-[8px] border text-[11.5px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${p?"border-err bg-err text-white":"border-line bg-panel text-dim hover:border-err/40 hover:text-err"}`,onClick:()=>{p?eR(e.id).then(e=>{e?ru("err",e):n()}):f(!0)},children:[(0,r.jsx)(td.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),p?i("tasks.deleteConfirm"):i("tasks.delete")]})]})}function rv({project:e,tasks:t,files:n,initialView:i,onClose:a}){let{t:o}=h(),[c,d]=(0,l.useState)(i),u=(0,l.useMemo)(()=>[...t].sort((e,t)=>("done"===e.status)-("done"===t.status)||t.updatedAt.localeCompare(e.updatedAt)),[t]),p="object"==typeof c?t.find(e=>e.id===c.taskId)??null:null;return(0,r.jsxs)("div",{className:"fixed inset-0 z-[60] flex flex-col bg-bg pb-[env(safe-area-inset-bottom)]",children:[(0,r.jsxs)("div",{className:"flex h-10 shrink-0 items-center gap-2 border-b border-line bg-panel px-3",children:["list"!==c?(0,r.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":o("tasks.sheetBack"),onClick:()=>d("list"),children:(0,r.jsx)(rm.A,{className:"h-4 w-4","aria-hidden":!0})}):null,(0,r.jsx)("span",{className:"shrink-0 text-[13px] font-bold",children:"new"===c?o("tasks.sheetNew"):p?rl(p.text)||o("tasks.untitled"):o("tasks.panelTitle")}),(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] text-dim",children:e}),(0,r.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":o("common.close"),onClick:a,children:(0,r.jsx)(s.A,{className:"h-4 w-4","aria-hidden":!0})})]}),"list"===c?(0,r.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-1 overflow-y-auto p-2",children:[(0,r.jsxs)("button",{type:"button",className:"flex h-9 shrink-0 items-center justify-center gap-1 rounded-[10px] border border-dashed border-accent/50 text-[12px] font-bold text-accent hover:bg-accent/5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>d("new"),children:["+ ",o("tasks.sheetNew")]}),u.map(e=>{let t=ri[e.status];return(0,r.jsxs)("button",{type:"button",className:`flex w-full min-w-0 flex-col gap-0.5 rounded-[10px] border border-line bg-panel px-2.5 py-2 text-left shadow-card focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${"done"===e.status?"opacity-60":""}`,onClick:()=>d({taskId:e.id}),children:[(0,r.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,r.jsx)("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 text-[9px] font-bold",style:{backgroundColor:t.soft,color:t.color},children:o(`tasks.status.${e.status}`)}),(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12.5px] font-semibold",children:rl(e.text)||o("tasks.untitled")})]}),(0,r.jsxs)("span",{className:"flex items-center gap-2 pl-0.5 text-[10.5px] text-dim",children:[e.assignments.length?(0,r.jsxs)("span",{children:["⤷ ",e.assignments.length]}):null,(0,r.jsx)("span",{children:Q(new Date(e.updatedAt).getTime()/1e3)})]})]},e.id)}),u.length?null:(0,r.jsx)("div",{className:"px-2 py-4 text-center text-[11.5px] text-dim",children:o("tasks.sheetEmpty")})]}):"new"===c?(0,r.jsx)(rg,{project:e,files:n,onCreated:e=>d({taskId:e.id})}):p?(0,r.jsx)(rw,{task:p,files:n,onDeleted:()=>d("list")},p.id):(0,r.jsx)("div",{className:"flex flex-1 items-center justify-center text-[12px] text-dim",children:o("tasks.sheetGone")})]})}var rk=n(3665),ry=n(1012),rj=n(715);function rN({verdict:e,error:t,className:n="h-3 w-3"}){return"APPROVE"===e?(0,r.jsx)(e6.A,{className:n,strokeWidth:3,"aria-hidden":!0}):"REQUEST_CHANGES"===e?(0,r.jsx)(s.A,{className:n,strokeWidth:3,"aria-hidden":!0}):"COMMENT"===e?(0,r.jsx)(rk.A,{className:n,strokeWidth:2.5,"aria-hidden":!0}):t?(0,r.jsx)(ry.A,{className:n,"aria-hidden":!0}):(0,r.jsx)(rj.A,{className:n,"aria-hidden":!0})}function rS(e,t){return t.error?e("roundDeck.roundAborted",{n:t.n}):t.verdict?e("roundDeck.roundVerdict",{n:t.n,verdict:`${K[t.verdict]} ${t.verdict}`}):e("roundDeck.roundInProgress",{n:t.n})}function rC({round:e,depth:t,pulse:n,onPull:i}){let{t:s}=h(),l=Y(e.verdict);return(0,r.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 ${n?"deck-tab-live border-ok/50":"border-line hover:border-accent/45"}`,style:{height:36,bottom:-(30*t)-10,zIndex:10-t,transform:`scale(${1-.035*t}) translateZ(${-(34*t)}px)`},title:e.error?`${rS(s,e)}: ${e.error}`:rS(s,e),onClick:i,children:[(0,r.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:l.soft,color:l.color},children:["R",e.n," ",(0,r.jsx)(rN,{verdict:e.verdict,error:!!e.error,className:"h-2.5 w-2.5"})]}),(0,r.jsxs)("span",{className:"min-w-0 flex-1 truncate text-[10.5px] font-semibold text-dim",children:[e.error?s("roundDeck.aborted"):e.verdict?e.verdict:s("roundDeck.reviewInProgress"),null!=e.findingsCount&&e.findingsCount>0?` \xb7 ${s("roundDeck.findings",{count:e.findingsCount})}`:""]}),n?(0,r.jsx)("span",{className:"h-1.5 w-1.5 shrink-0 animate-pulse rounded-full bg-ok","aria-hidden":!0}):null]})}function rA({flow:e,rounds:t,files:n,onSelect:i,focusRound:s}){let{t:a}=h(),o=t.length?t[t.length-1]:null,[c,d]=(0,l.useState)(null),[u,p]=(0,l.useState)(null);null!=s&&s!==u&&(p(s),d(Math.round(s)));let[f,m]=(0,l.useState)(null);o&&o.round.n!==f&&(m(o.round.n),null!=c&&o.round.n>c&&null===o.round.verdict&&d(null));let x=(0,l.useMemo)(()=>t.find(e=>e.round.n===c)??o,[t,c,o]);if(!x)return(0,r.jsx)("div",{className:"flex h-full items-center justify-center rounded-[10px] border border-dashed border-[#c9c9d1] bg-panel/60",children:(0,r.jsx)("span",{className:"text-[12px] font-semibold text-dim",children:a("roundDeck.waitingFirst")})});let b=t.filter(e=>e.round.n!==x.round.n).reverse(),g=b.slice(0,5),w=b.length-g.length,v=Y(x.round.verdict),k=null!==x.round.verdict||!!x.round.error,y=o&&x.round.n!==o.round.n&&null===o.round.verdict&&!o.round.error?o:null;return(0,r.jsxs)("div",{className:"deck-3d relative h-full",style:{paddingBottom:30*Math.min(b.length,5+ +!!w)},children:[(0,r.jsx)("div",{className:"scheme-enter relative z-[11] flex h-full flex-col",children:x.file?(0,r.jsx)(n0,{file:x.file,files:n,tasks:[],onSelect:i,isRoot:!1,noComposer:"headless"===e.reviewerMode||k,banner:(0,r.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:v.soft,color:v.color},children:[rS(a,x.round),null!=x.round.findingsCount&&x.round.findingsCount>0?(0,r.jsxs)("span",{className:"font-semibold opacity-80",children:["\xb7 ",a("roundDeck.findings",{count:x.round.findingsCount})]}):null,x.round.readyNote?(0,r.jsxs)("span",{className:"min-w-0 flex-1 truncate font-semibold opacity-70",title:x.round.readyNote,children:["\xb7 ",x.round.readyNote]}):null]})}):(0,r.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,r.jsx)("span",{className:"text-[12px] font-semibold text-dim",children:rS(a,x.round)}),(0,r.jsx)("span",{className:"text-[11px] text-dim",children:x.round.error?x.round.error:a("roundDeck.spawningReviewer")})]})},x.round.n),g.map((e,t)=>(0,r.jsx)(rC,{round:e.round,depth:t,pulse:y?.round.n===e.round.n,onPull:()=>d(e.round.n)},e.round.n)),w>0?(0,r.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*g.length)-8,zIndex:10-g.length},"aria-hidden":!0,children:a("roundDeck.moreRounds",{count:w})}):null]})}var r$=n(8617);function rT(e){return("claude-projects"===e.root||"codex-sessions"===e.root)&&e.path.endsWith(".jsonl")}function rE({file:e,onHandoff:t}){let{t:n}=h(),i=function(e){let{t}=h();return tO({exclude:e.path,onDragStart:void 0,onDrop:n=>{var r,i;let s,l;return r=n.file.path,i=t("link.handoffContext",{title:b(e.title,80),path:e.path,ask:""}).trimEnd()+"\n\n",s="llvDraft:"+r,l=sessionStorage.getItem(s)??"",sessionStorage.setItem(s,l.trim()?l.replace(/\s*$/,"")+"\n\n"+i:i),window.dispatchEvent(new CustomEvent(tR,{detail:{path:r}})),t("link.dropped",{title:b(n.file.title,48)})}})}(e);return(0,r.jsxs)("div",{"data-scheme-ui":!0,className:"group absolute -bottom-11 left-2 z-[2]",children:[(0,r.jsxs)("button",{type:"button","aria-label":n("handoff.aria"),title:n("handoff.title"),onPointerDown:i.onPillPointerDown,onClick:()=>{i.consumeClick()||t()},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,r.jsx)(r$.A,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),(0,r.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:n("handoff.label")}),(0,r.jsx)(e1.A,{className:"hidden h-3.5 w-3.5 shrink-0 group-hover:block group-focus-within:block","aria-hidden":!0})]}),i.overlay]})}function rD(e,t,n,r=[],i=[]){let s=new Map(n.map(e=>[e.path,e])),l=$(n),a=[],o=[],c=[],d=[],u=[],p=O(r),f=q(r),m=100,x=[],h=new Map;for(let e of i){let t=n3(e,"src");if(!t)continue;let n=h.get(t);n?n.push(e):h.set(t,[e])}let b=new Set,g=e=>({file:e,branches:l.get(e.path)?.length??0}),w=(e,t,n,r,i)=>{let l=(e,m,w,v)=>{let k=0===v?780:680;a.push({file:e.file,tasks:e.tasks,under:r.get(e.file.path)??[],x:m,y:w,w:600,h:k,isRoot:e.file.path===i});let y=p.get(e.file.path),j=k;if(y){var N;let e,t,n=(N=m+600+170,e=y.rounds.map(e=>({round:e,file:e.reviewerPath?s.get(e.reviewerPath)??null:null})),t={key:"deck::"+y.id,flow:y,rounds:e,x:N,y:w,w:600,h:k+30*Math.min(Math.max(y.rounds.length-1,0),6)},d.push(t),t);u.push({key:"loop::"+y.id,flow:y,x1:m+600,x2:n.x,y:w}),j=Math.max(j,n.h)}let S=w+j+130,C=t.get(e.file.path)??[],A=m+64;for(let e of C)o.push({to:e.file.path,x1:m+40,y1:w+k,x2:A+300,y2:S,color:ea(e.file),live:"live"===e.file.activity}),A+=l(e,A,S,v+1)+48;let $=n.get(e.file.path)?.filter(e=>!f.has(e.path));for(let t of($?.length&&(c.push({key:e.file.path+"::stack",parent:e.file.path,items:$.map(g),x:A,y:S,w:360,h:16+58*Math.min($.length,8)-6}),o.push({to:e.file.path+"::stack",x1:m+40,y1:w+k,x2:A+180,y2:S,color:"#9a9aa4",live:!1,dashed:!0}),A+=408),h.get(e.file.path)??[]))b.add(t),x.push({key:"draft::"+t,id:t,src:e.file.path,x:A,y:S,w:600,h:680}),o.push({to:"draft::"+t,x1:m+40,y1:w+k,x2:A+300,y2:S,color:"#5a51e0",live:!1,dashed:!0}),A+=648;let T=A-48-(m+64);return Math.max(T>0?Math.max(600,64+T):600,y?1370:600)};return l(e,m,100,0)};for(let t of e){let e=t.columns;if(!e.length)continue;let n=e[0].file.path,r=new Set(e.map(e=>e.file.path)),i=e=>{let t=e.parent,i=new Set([e.path]);for(;t&&!i.has(t)&&!r.has(t);)i.add(t),t=s.get(t)?.parent??null;return t&&r.has(t)&&t!==e.path?t:n},l=new Map;for(let t of e){if(t.file.path===n)continue;let e=i(t.file),r=l.get(e);r?r.push(t):l.set(e,[t])}let a=new Map,o=[];for(let e of[...t.returnable,...t.finished])if(!f.has(e.path))if(j(e)){let t=i(e),n=a.get(t);n?n.push(e):a.set(t,[e])}else o.push(e);let c=new Map([[n,o]]);m+=w(e[0],l,a,c,t.key)+150}for(let e of t){let t=(function(e,t){if(!e)return[];let n=$(t),r=[],i=new Set([e.path]),s=(e,t)=>{for(let l of(n.get(e.path)??[]).filter(e=>!i.has(e.path)).sort((e,t)=>v(e)-v(t)||t.mtime-e.mtime))i.add(l.path),r.push({file:l,depth:t}),s(l,t+1)};return s(e,1),r})(e,n).map(e=>e.file).filter(e=>!f.has(e.path)),r=t.filter(e=>j(e)),i=t.filter(e=>!j(e));m+=w({file:e,tasks:[]},new Map,new Map(r.length?[[e.path,r]]:[]),new Map([[e.path,i]]),e.parent?"":e.path)+150}for(let e of i)b.has(e)||(x.push({key:"draft::"+e,id:e,x:m,y:100,w:600,h:780}),m+=750);let k=0;for(let e of a)k=Math.max(k,e.y+e.h);for(let e of c)k=Math.max(k,e.y+e.h);for(let e of d)k=Math.max(k,e.y+e.h);for(let e of x)k=Math.max(k,e.y+e.h);return{nodes:a,edges:o,stacks:c,decks:d,loops:u,drafts:x,byPath:new Map([...a.map(e=>[e.file.path,e]),...x.map(e=>[e.key,e]),...c.map(e=>[e.key,e]),...d.map(e=>[e.key,e])]),width:Math.max(m-150+100,800),height:k+100+140}}var rM=n(1906),rR=n(1285),rP=n(6900),rI=n(2879),r_=n(5367),rL=n(1834),rz=n(5085),rO=n(4890),rq=n(2298);async function rF(e,t,n){let r=[];for(let i of e){try{let e=await t(i);r.push(e.ok?{path:i,ok:!0}:{path:i,ok:!1,error:e.error})}catch(e){r.push({path:i,ok:!1,error:e instanceof Error?e.message:String(e)})}n?.(r,e[r.length]??null)}return r}function rU(e){return null!==e.file.pid}function rH(e){return e.isRoot}function rB(e){let t=0;for(let n of e.text.split(/\r?\n/))t+=Math.max(1,Math.ceil(n.length/34));return Math.max(64,6+(Math.min(17*t,340)+20)+(e.assignments.length?26*e.assignments.length+6:0))}function rW(e){return{x:e.pos.x,y:e.pos.y,w:260,h:rB(e)}}function rK(e){return{x:e.x+e.w/2,y:e.y+e.h/2}}function rY(e,t){let{x:n,y:r}=rK(e),i=t.x-n,s=t.y-r;if(!i&&!s)return{x:n,y:r};let l=Math.min(i?e.w/2/Math.abs(i):1/0,s?e.h/2/Math.abs(s):1/0,1);return{x:n+i*l,y:r+s*l}}let rJ={implementer:{engine:"claude",model:null,effort:null},reviewer:{engine:"codex",model:null,effort:"xhigh"}};async function rQ(e,t){let n=await fetch(e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t)});if(n.ok)return{ok:!0};let r=await n.json().catch(()=>null);return{ok:!1,error:r?.error??`HTTP ${n.status}`}}function rX({icon:e,label:t,disabled:n,confirming:i,confirmLabel:s,onClick:l}){return(0,r.jsxs)("button",{className:`inline-flex h-7 items-center gap-1 whitespace-nowrap rounded-full border px-2.5 text-[11px] font-semibold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40 ${i?"border-err bg-err text-white":"border-line bg-bg text-dim hover:border-accent/45 hover:text-accent"}`,disabled:n,onClick:l,children:[e,i?s:t]})}let rG=(0,l.memo)(function({project:e,nodes:t,flowsByImpl:n,onRemove:i,onFit:a,onExit:o}){let{t:c}=h(),[d,u]=(0,l.useState)(null),[p,f]=(0,l.useState)(!0),[m,x]=(0,l.useState)(null),[g,w]=(0,l.useState)(null),[v,k]=(0,l.useState)(!1),y=(0,l.useRef)(null),j=(0,l.useRef)(t);(0,l.useLayoutEffect)(()=>{j.current=t},[t]),(0,l.useEffect)(()=>{if(!g)return;let e=window.setTimeout(()=>w(null),4e3);return()=>window.clearTimeout(e)},[g]);let N=async(e,n,r)=>{var i,s;if(d||!n.length)return[];u(e),w(null);let l=new Map(m?.titles??[]);for(let e of t)l.set(e.file.path,b(e.file.title,60));let a=(i=()=>new Set(j.current.map(e=>e.file.path)),s=c("bulk.nodeGone"),e=>i().has(e)?r(e):Promise.resolve({ok:!1,error:s}));y.current={action:e,runner:a},x({action:e,items:[],current:n[0]??null,titles:l});try{return await rF(n,a,(t,n)=>x({action:e,items:[...t],current:n,titles:l}))}finally{u(null)}},S=tT({initialText:()=>"",persistText:()=>{},submit:async n=>{let r=(n??S.textRef.current).trim(),i=S.attachments.images.map(e=>({base64:e.base64,mime:e.mime}));if((r||i.length)&&!d){S.setBusy(!0);try{let n=new Map(t.map(e=>[e.file.path,e]));if(p){if(!r)return void S.setStatus({kind:"err",text:c("tasks.composerNeedsText")});let t=await eT({project:e,text:r,pos:(()=>{let e=j.current;if(!e.length)return{x:120,y:120};let t=0,n=0;for(let r of e)t+=r.x+r.w/2,n+=r.y+r.h/2;return{x:Math.round(t/e.length-130),y:Math.round(n/e.length-60)}})()});if("error"in t)return void S.setStatus({kind:"err",text:t.error});let s=t.task.id,l=await N("message",[...n.keys()],async e=>{let t=await eP(s,[e]);if("error"in t)return{ok:!1,error:t.error};let r=t.results[0];if(!r?.ok)return{ok:!1,error:r?.error??c("common.failedSend")};if(i.length){let t=n.get(e);return rQ("/api/tmux",{pid:t?.file.pid??void 0,path:e,text:"",images:i})}return{ok:!0}});(!n.size||l.length&&l.every(e=>e.ok))&&(S.setText(""),S.attachments.clear());return}let s=await N("message",[...n.keys()],e=>{let t=n.get(e);return rQ("/api/tmux",{pid:t?.file.pid??void 0,path:e,text:r,images:i})});s.length&&s.every(e=>e.ok)&&(S.setText(""),S.attachments.clear())}finally{S.setBusy(!1)}}},disabled:null!==d}),C=t.filter(rU),A=t.filter(rH),$=t.filter(e=>F(e.file,n)),T=m?.items.filter(e=>!e.ok).length??0;return(0,r.jsxs)("div",{"data-scheme-ui":!0,className:"absolute bottom-3 left-1/2 z-40 flex w-[640px] max-w-[94%] -translate-x-1/2 flex-col gap-1.5 rounded-[12px] border border-line bg-panel/95 p-2.5 shadow-[0_10px_36px_rgb(20_20_30/0.18)]",children:[v?(0,r.jsx)(rV,{count:$.length,disabled:null!==d,onStart:e=>{k(!1),N("flow",$.map(e=>e.file.path),t=>rQ("/api/flows",{implementerPath:t,...e}))},onClose:()=>k(!1)}):null,(0,r.jsx)("form",{onSubmit:e=>{e.preventDefault(),S.submit()},className:"flex flex-col gap-1.5",children:(0,r.jsx)(tD,{composer:S,placeholder:c("bulk.placeholder"),textareaAriaLabel:c("bulk.textAria"),imageAriaLabel:c("composer.addImages"),sendLabelIdle:c("bulk.sendAll",{count:t.length}),sendLabelRecording:c("composer.stopAndSend"),sendTitleRecording:c("composer.stopAndSendTitle"),sendIdleClassName:"border-accent bg-accent hover:opacity-90",leftSlot:(0,r.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5",children:[(0,r.jsx)("span",{className:"inline-flex min-w-0 items-center gap-1 rounded-full bg-chip px-2 py-1 text-[10px] font-bold text-[#555]",children:c("bulk.selectedCount",{count:t.length})}),(0,r.jsxs)("button",{type:"button",role:"switch","aria-checked":p,title:c("tasks.composerToggleTitle"),onClick:()=>f(e=>!e),className:`inline-flex h-6 shrink-0 items-center gap-1 rounded-full border px-2 text-[10px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${p?"border-accent bg-accent/10 text-accent":"border-line bg-panel text-dim hover:text-ink"}`,children:[(0,r.jsx)("span",{className:`h-1.5 w-1.5 rounded-full ${p?"bg-accent":"bg-[#c9c9d1]"}`,"aria-hidden":!0}),c("tasks.composerToggle")]})]})})}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,r.jsx)(rX,{icon:(0,r.jsx)(r_.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),label:`${c("bulk.interrupt")} ${C.length}/${t.length}`,disabled:null!==d||!C.length,onClick:()=>void N("interrupt",C.map(e=>e.file.path),e=>rQ("/api/tmux",{action:"interrupt",path:e}))}),(0,r.jsx)(rX,{icon:(0,r.jsx)(to.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),label:`${c("bulk.stop")} ${A.length}/${t.length}`,confirming:"kill"===g,confirmLabel:c("bulk.stopConfirm",{count:A.length}),disabled:null!==d||!A.length,onClick:()=>{"kill"!==g?w("kill"):N("kill",A.map(e=>e.file.path),e=>rQ("/api/tmux",{action:"kill",path:e}))}}),(0,r.jsx)(rX,{icon:(0,r.jsx)(td.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),label:`${c("bulk.remove")} ${t.length}`,confirming:"remove"===g,confirmLabel:c("bulk.removeConfirm",{count:t.length}),disabled:null!==d||!t.length,onClick:()=>{if("remove"!==g)return void w("remove");for(let e of t)i(e.file.path);w(null)}}),(0,r.jsx)(rX,{icon:(0,r.jsx)(rL.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),label:`${c("bulk.flow")} ${$.length}/${t.length}`,disabled:null!==d||!$.length,onClick:()=>k(e=>!e)}),(0,r.jsx)(rX,{icon:(0,r.jsx)(rz.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),label:c("bulk.fit"),disabled:!t.length,onClick:a}),(0,r.jsx)("button",{className:"ml-auto inline-flex h-7 w-7 items-center justify-center rounded-full text-dim hover:bg-bg hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":c("bulk.exit"),title:c("bulk.exit"),onClick:o,children:(0,r.jsx)(s.A,{className:"h-4 w-4","aria-hidden":!0})})]}),m?(0,r.jsxs)("div",{className:"flex max-h-[140px] flex-col gap-0.5 overflow-y-auto rounded-[8px] border border-line bg-bg/60 p-1.5",children:[m.items.map(e=>(0,r.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5 text-[11px]",children:[e.ok?(0,r.jsx)(e7.A,{className:"h-3.5 w-3.5 shrink-0 text-ok","aria-hidden":!0}):(0,r.jsx)(rO.A,{className:"h-3.5 w-3.5 shrink-0 text-err","aria-hidden":!0}),(0,r.jsx)("span",{className:"min-w-0 shrink-0 truncate font-semibold",style:{maxWidth:"40%"},children:m.titles.get(e.path)??e.path}),e.error?(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate text-err",children:e.error}):null]},e.path)),m.current?(0,r.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5 text-[11px] text-dim",children:[(0,r.jsx)(tg.A,{className:"h-3.5 w-3.5 shrink-0 animate-spin","aria-hidden":!0}),(0,r.jsx)("span",{className:"min-w-0 truncate font-semibold",children:m.titles.get(m.current)??m.current})]}):null,!d&&T?(0,r.jsxs)("button",{className:"mt-1 inline-flex h-6 items-center gap-1 self-start rounded-full border border-line bg-panel px-2 text-[10.5px] font-semibold text-dim hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>{let e=m?.items.filter(e=>!e.ok).map(e=>e.path)??[],t=y.current;e.length&&t&&N(t.action,e,t.runner)},children:[(0,r.jsx)(rq.A,{className:"h-3 w-3","aria-hidden":!0}),c("bulk.retryFailed",{count:T})]}):null]}):null]})});function rV({count:e,disabled:t,onStart:n,onClose:i}){let{t:s}=h(),[a,o]=(0,l.useState)([]),[c,d]=(0,l.useState)(null),[u,p]=(0,l.useState)("auto"),[f,m]=(0,l.useState)(5);return(0,l.useEffect)(()=>{let e=!1;return fetch("/api/flows").then(e=>e.json()).then(t=>{!e&&Array.isArray(t.presets)&&t.presets.length&&(o(t.presets),d(e=>e??t.presets[0].name))}).catch(()=>{}),()=>{e=!0}},[]),(0,r.jsxs)("div",{className:"absolute bottom-[calc(100%+8px)] left-1/2 flex w-[420px] max-w-[94%] -translate-x-1/2 flex-col gap-2 rounded-[12px] border border-line bg-panel p-2.5 shadow-[0_10px_36px_rgb(20_20_30/0.18)]",onKeyDown:e=>{"Escape"===e.key&&i()},children:[(0,r.jsx)("span",{className:"text-[12px] font-bold",children:s("bulk.flowTitle",{count:e})}),(0,r.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[(0,r.jsxs)("label",{className:"col-span-3 flex flex-col gap-1 text-[10.5px] font-semibold text-dim",children:[s("flowDialog.preset"),(0,r.jsx)("select",{value:c??"",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:e=>d(e.target.value||null),children:a.length?a.map(e=>(0,r.jsx)("option",{value:e.name,children:e.name},e.name)):(0,r.jsx)("option",{value:"",children:s("flowDialog.effortDefault")})})]}),(0,r.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-dim",children:[s("flowDialog.transitions"),(0,r.jsxs)("select",{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:e=>p(e.target.value),children:[(0,r.jsx)("option",{value:"auto",children:s("flowDialog.auto")}),(0,r.jsx)("option",{value:"manual",children:s("flowDialog.manual")})]})]}),(0,r.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-dim",children:[s("flowDialog.roundLimit"),(0,r.jsx)("input",{type:"number",min:1,max:20,value:f,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:e=>m(Math.max(1,Math.min(20,Number(e.target.value)||5)))})]}),(0,r.jsxs)("div",{className:"flex items-end justify-end gap-1.5",children:[(0,r.jsx)("button",{className:"h-8 rounded-[8px] border border-line bg-bg px-2 text-[11px] font-semibold text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:i,children:s("common.cancel")}),(0,r.jsx)("button",{className:"h-8 rounded-[8px] border border-accent bg-accent px-2.5 text-[11.5px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",disabled:t||!e,onClick:()=>n({...c?{preset:c}:{roles:rJ},baseMode:"head",mode:u,reviewerMode:"headless",roundLimit:f}),children:s("bulk.flowStart",{count:e})})]})]})]})}function rZ(e,t){return e.filter(e=>e.x<=t.x+t.w&&e.x+e.w>=t.x&&e.y<=t.y+t.h&&e.y+e.h>=t.y).map(e=>e.file.path)}function r0({layout:e,tasks:t=[],cam:n,vp:i,onJump:s}){let{t:a}=h(),o=(0,l.useRef)(null),c=(0,l.useRef)(!1),d=Math.min(216/e.width,148/e.height),u=(216-e.width*d)/2,p=(148-e.height*d)/2,f=e=>{let t=o.current?.getBoundingClientRect();t&&s((e.clientX-t.left-u)/d,(e.clientY-t.top-p)/d)};return(0,r.jsx)("div",{ref:o,"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:a("minimap.title"),onPointerDown:e=>{e.stopPropagation(),c.current=!0,f(e);try{e.currentTarget.setPointerCapture(e.pointerId)}catch{}},onPointerMove:e=>{c.current&&f(e)},onPointerUp:e=>{c.current=!1;try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}},onPointerCancel:()=>{c.current=!1},children:(0,r.jsx)("svg",{width:216,height:148,"aria-hidden":!0,children:(0,r.jsxs)("g",{transform:`translate(${u} ${p}) scale(${d})`,children:[e.stacks.map(e=>(0,r.jsx)("rect",{x:e.x,y:e.y,width:e.w,height:e.h,rx:18,fill:"#c9c9d1",opacity:.45},e.key)),e.drafts.map(e=>(0,r.jsx)("rect",{x:e.x,y:e.y,width:e.w,height:e.h,rx:18,fill:"#9a9aa4",opacity:.3},e.key)),e.decks.map(e=>(0,r.jsx)("rect",{x:e.x,y:e.y,width:e.w,height:e.h,rx:18,fill:"#5a51e0",opacity:.3},e.key)),e.nodes.map(e=>(0,r.jsx)("rect",{x:e.x,y:e.y,width:e.w,height:e.h,rx:18,fill:ea(e.file),opacity:"live"===e.file.activity?.85:.35},e.file.path)),t.map(e=>(0,r.jsx)("circle",{cx:e.pos.x+130,cy:e.pos.y+rB(e)/2,r:3/d,fill:ri[e.status].color,opacity:"done"===e.status?.5:.95},e.id)),(0,r.jsx)("rect",{x:-n.x/n.z,y:-n.y/n.z,width:i.w/n.z,height:i.h/n.z,fill:"rgba(90,81,224,0.08)",stroke:"#5a51e0",strokeWidth:2.5/d})]})})})}var r1=n(9707);let r5=["low","medium","high","xhigh"],r2={implementer:{engine:"claude",model:null,effort:null},reviewer:{engine:"codex",model:null,effort:"xhigh"}};function r3({label:e,role:t,onChange:n}){let{t:i}=h();return(0,r.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,r.jsx)("span",{className:"w-[86px] shrink-0 text-[10.5px] font-semibold text-dim",children:e}),(0,r.jsxs)("select",{value:t.engine,"aria-label":i("flowDialog.engine",{label:e}),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:e=>n({...t,engine:e.target.value,effort:null}),children:[(0,r.jsx)("option",{value:"claude",children:"Claude"}),(0,r.jsx)("option",{value:"codex",children:"Codex"})]}),(0,r.jsx)("input",{value:t.model??"",placeholder:i("flowDialog.modelPlaceholder"),"aria-label":i("flowDialog.model",{label:e}),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:e=>n({...t,model:e.target.value.trim()||null})}),"codex"===t.engine?(0,r.jsxs)("select",{value:t.effort??"","aria-label":`Reasoning effort: ${e}`,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:e=>n({...t,effort:e.target.value||null}),children:[(0,r.jsx)("option",{value:"",children:i("flowDialog.effortDefault")}),r5.map(e=>(0,r.jsx)("option",{value:e,children:e},e))]}):null]})}function r4({file:e,onClose:t}){let{t:n}=h(),[i,s]=(0,l.useState)([]),[a,o]=(0,l.useState)(null),[c,d]=(0,l.useState)(r2),[u,p]=(0,l.useState)(!1),[f,m]=(0,l.useState)("head"),[x,b]=(0,l.useState)("auto"),[g,w]=(0,l.useState)("headless"),[v,k]=(0,l.useState)(5),[y,j]=(0,l.useState)(!1),[N,S]=(0,l.useState)(null);(0,l.useEffect)(()=>{let e=!1;return fetch("/api/flows").then(e=>e.json()).then(t=>{!e&&Array.isArray(t.presets)&&t.presets.length&&(s(t.presets),o(e=>e??t.presets[0].name),d({implementer:t.presets[0].implementer,reviewer:t.presets[0].reviewer}))}).catch(()=>{}),()=>{e=!0}},[]);let C=async()=>{if(!y){j(!0),S(null);try{let r=await fetch("/api/flows",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({implementerPath:e.path,...u||!a?{roles:c}:{preset:a},baseMode:f,mode:x,reviewerMode:g,roundLimit:v})});if(!r.ok){let e=await r.json().catch(()=>null);S(e?.error??n("flowDialog.createFailed",{status:r.status}));return}t()}catch{S(n("common.serverUnavailable"))}finally{j(!1)}}};return(0,r.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:e=>{"Escape"===e.key&&t()},children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"text-[12.5px] font-bold",children:n("flowDialog.title")}),(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate text-[10.5px] text-dim",children:n("flowDialog.subtitle")})]}),i.length?(0,r.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-dim",children:[n("flowDialog.preset"),(0,r.jsx)("select",{value:a??"",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:e=>{var t;let n;return o(t=e.target.value),void((n=i.find(e=>e.name===t))&&d({implementer:n.implementer,reviewer:n.reviewer}))},children:i.map(e=>(0,r.jsx)("option",{value:e.name,children:e.name},e.name))})]}):null,(0,r.jsx)("button",{className:"self-start text-[10.5px] font-semibold text-dim hover:text-accent focus-visible:outline-none","aria-expanded":u,onClick:()=>p(e=>!e),children:u?n("flowDialog.rolesManualOpen"):n("flowDialog.rolesManual")}),u?(0,r.jsxs)("div",{className:"flex flex-col gap-1.5 rounded-[10px] border border-dashed border-line bg-bg/50 p-2",children:[(0,r.jsx)(r3,{label:n("flowDialog.implementer"),role:c.implementer,onChange:e=>d(t=>({...t,implementer:e}))}),(0,r.jsx)(r3,{label:n("flowDialog.reviewer"),role:c.reviewer,onChange:e=>d(t=>({...t,reviewer:e}))})]}):null,(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,r.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-dim",children:[n("flowDialog.diffBase"),(0,r.jsxs)("select",{value:f,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:e=>m(e.target.value),children:[(0,r.jsx)("option",{value:"head",children:n("flowDialog.fromHead")}),(0,r.jsx)("option",{value:"merge-base",children:n("flowDialog.fromMergeBase")})]})]}),(0,r.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-dim",children:[n("flowDialog.reviewer"),(0,r.jsxs)("select",{value:g,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:e=>w(e.target.value),children:[(0,r.jsx)("option",{value:"headless",children:n("flowDialog.headless")}),(0,r.jsx)("option",{value:"pane",children:n("flowDialog.tmuxPane")})]})]}),(0,r.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-dim",children:[n("flowDialog.transitions"),(0,r.jsxs)("select",{value:x,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:e=>b(e.target.value),children:[(0,r.jsx)("option",{value:"auto",children:n("flowDialog.auto")}),(0,r.jsx)("option",{value:"manual",children:n("flowDialog.manual")})]})]}),(0,r.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-dim",children:[n("flowDialog.roundLimit"),(0,r.jsx)("input",{type:"number",min:1,max:20,value:v,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:e=>k(Math.max(1,Math.min(20,Number(e.target.value)||5)))})]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[N?(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate text-[10.5px] font-semibold text-err",children:N}):(0,r.jsx)("span",{className:"flex-1"}),(0,r.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:t,children:n("common.cancel")}),(0,r.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:y,onClick:()=>void C(),children:y?n("flowDialog.creating"):n("flowDialog.start")})]})]})}var r6=n(529);let r8={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"}},r9=new Set(["spawning","reviewing","relaying","fixing"]),r7=[1,2,3,4,5,0];function ie({flow:e,onFocusRound:t}){let{t:n}=h(),[i,a]=(0,l.useState)(!1),[o,c]=(0,l.useState)(null),[d,u]=(0,l.useState)(""),p=async(t,n)=>{if(i)return;a(!0),c(null);let r=await J(e.id,{action:t,...n});r?c(r):n?.note!==void 0&&u(""),a(!1)},f=r8[e.state],m=H.has(e.state),x="closed"===e.state||"approved"===e.state,b="waiting_ready"===e.state||"needs_decision"===e.state;return(0,r.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)] ${m?"border-[#e0ae45]/70":"border-line"}`,children:[(0,r.jsxs)("span",{className:"flex min-w-0 max-w-[38%] shrink-0 items-center gap-2",children:[(0,r.jsx)("span",{className:`h-2.5 w-2.5 shrink-0 rounded-full ${"approved"===e.state?"bg-ok":"needs_decision"===e.state?"bg-err":"paused"===e.state?"bg-[#e0ae45]":r9.has(e.state)?"bg-ok animate-pulse":"bg-[#9a9aa4]"}`,"aria-hidden":!0}),(0,r.jsx)("span",{className:"shrink-0 text-[10.5px] font-bold tracking-[0.08em] text-dim",children:n("flowStrip.flow")}),(0,r.jsx)("span",{className:"shrink-0 text-[12px] font-bold",children:U(n,e.state)}),e.stateDetail?(0,r.jsx)("span",{className:"min-w-0 truncate text-[11.5px] font-semibold text-dim",title:e.stateDetail,children:e.stateDetail}):null]}),(0,r.jsx)("span",{className:"no-scrollbar flex min-w-0 flex-1 items-center justify-center gap-1.5 overflow-x-auto","aria-label":n("flowStrip.roundsAria"),children:e.rounds.map((e,i)=>{let s=Y(e.verdict),l=null===e.verdict&&!e.error;return(0,r.jsxs)("span",{className:"flex shrink-0 items-center gap-1.5",children:[i>0?(0,r.jsx)("span",{className:"text-[10px] font-bold text-[#c9c9d1]","aria-hidden":!0,children:"→"}):null,(0,r.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 ${l?"animate-pulse":""}`,style:{backgroundColor:s.soft,color:s.color},title:e.error?n("flowStrip.roundError",{n:e.n,error:e.error}):e.verdict?n("flowStrip.roundVerdict",{n:e.n,verdict:e.verdict})+(null!=e.findingsCount?` \xb7 ${n("roundDeck.findings",{count:e.findingsCount})}`:""):n("flowStrip.roundInProgress",{n:e.n}),onClick:()=>t?.(e.n),children:["R",e.n,(0,r.jsx)(rN,{verdict:e.verdict,error:!!e.error}),null!=e.findingsCount&&e.findingsCount>0?(0,r.jsx)("span",{children:e.findingsCount}):null]})]},e.n)})}),(0,r.jsxs)("span",{className:"flex shrink-0 items-center gap-1.5",children:[o?(0,r.jsx)("span",{className:"max-w-[220px] truncate text-[10.5px] font-semibold text-err",title:o,children:o}):null,i?(0,r.jsx)(rt.A,{className:"h-3.5 w-3.5 shrink-0 animate-spin text-dim","aria-hidden":!0}):null,b?(0,r.jsx)(tj,{label:n("flowStrip.noteTitle"),children:(0,r.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:d,placeholder:n("flowStrip.notePlaceholder"),onChange:e=>u(e.target.value),onKeyDown:e=>{"Enter"===e.key&&f&&p(f.action,{note:d})}})}):null,"reviewing"===e.state?(0,r.jsx)(tj,{label:n("flowStrip.stopReviewerTitle"),children:(0,r.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:i,onClick:()=>void p("cancel-round"),children:[(0,r.jsx)(to.A,{className:"h-3 w-3","aria-hidden":!0})," ",n("flowStrip.stopReviewer")]})}):null,f?(0,r.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:i,onClick:()=>void p(f.action,b?{note:d}:void 0),children:n(f.labelKey)}):null,x?null:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(tj,{label:n("flowStrip.limitTitle"),children:(0,r.jsxs)("span",{className:"flex shrink-0 items-center gap-0.5 rounded-full border border-line bg-bg p-0.5",children:[r7.map(t=>{let s=e.roundLimit===t,l=0!==t&&t<e.rounds.length;return(0,r.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 ${s?"bg-accent text-white":"text-dim hover:bg-panel hover:text-ink"}`,disabled:i||l,"aria-label":0===t?n("flowStrip.limitUnlimitedAria"):n("flowStrip.limitAria",{count:t}),"aria-pressed":s,onClick:()=>void p("set-round-limit",{rounds:t}),children:0===t?(0,r.jsx)(r6.A,{className:"h-3 w-3","aria-hidden":!0}):t},t)}),r7.includes(e.roundLimit)?null:(0,r.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:e.roundLimit})]})}),(0,r.jsx)(tj,{label:"auto"===e.mode?n("flowStrip.autoTitle"):n("flowStrip.manualTitle"),children:(0,r.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"===e.mode?"border-ok/40 bg-[#eef8f0] text-ok":"border-line bg-bg text-dim hover:text-ink"}`,disabled:i,onClick:()=>void p("set-mode",{mode:"auto"===e.mode?"manual":"auto"}),children:"auto"===e.mode?n("flowDialog.auto"):n("flowStrip.manualShort")})}),"paused"===e.state?(0,r.jsx)(tj,{label:n("flowStrip.resume"),children:(0,r.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:i,"aria-label":n("flowStrip.resume"),onClick:()=>void p("resume"),children:(0,r.jsx)(tl.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})}):(0,r.jsx)(tj,{label:n("flowStrip.pause"),children:(0,r.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:i,"aria-label":n("flowStrip.pause"),onClick:()=>void p("pause"),children:(0,r.jsx)(nR.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})})]}),(0,r.jsx)(tj,{label:n("flowStrip.close"),children:(0,r.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:i,"aria-label":n("flowStrip.close"),onClick:()=>void p("close"),children:(0,r.jsx)(s.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})})]})]})}function it({role:e,active:t}){let{t:n}=h();return(0,r.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 ${t?"border-ok/50 bg-[#eef8f0]":"border-line bg-panel"}`,children:[(0,r.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${t?"animate-pulse bg-ok":"bg-[#c2c2cb]"}`,"aria-hidden":!0}),(0,r.jsx)("span",{className:`text-[10px] font-bold tracking-[0.06em] ${t?"text-ok":"text-ink"}`,children:n("implementer"===e?"scheme.roleImplementer":"scheme.roleReviewer")}),(0,r.jsx)("span",{className:`text-[10px] font-semibold ${t?"text-ok":"text-dim"}`,children:n(t?"scheme.roleWorking":"scheme.roleWaiting")})]})}let ir="cubic-bezier(.22,.8,.36,1)",ii=`transform 380ms ${ir}`,is=(0,l.memo)(function({edges:e,width:t,height:n}){return(0,r.jsx)("svg",{width:t,height:n,className:"absolute left-0 top-0","aria-hidden":!0,children:e.map(e=>{let t=Math.max(36,(e.y2-e.y1)*.5),n=`M ${e.x1} ${e.y1} C ${e.x1} ${e.y1+t}, ${e.x2} ${e.y2-t}, ${e.x2} ${e.y2-7}`,i=`M ${e.x2-5} ${e.y2-9} L ${e.x2+5} ${e.y2-9} L ${e.x2} ${e.y2-1} Z`;return(0,r.jsxs)("g",{opacity:e.live?.9:.5,children:[(0,r.jsx)("path",{d:n,style:{d:`path("${n}")`,transition:`d 380ms ${ir}`},fill:"none",stroke:e.color,strokeWidth:2.5,strokeLinecap:"round",strokeDasharray:e.dashed?"5 7":void 0}),(0,r.jsx)("circle",{cx:e.x1,cy:e.y1,r:3.5,fill:e.color,style:{cx:`${e.x1}px`,cy:`${e.y1}px`,transition:`cx 380ms ${ir}, cy 380ms ${ir}`}}),(0,r.jsx)("path",{d:i,style:{d:`path("${i}")`,transition:`d 380ms ${ir}`},fill:e.color})]},e.to)})})}),il=(0,l.memo)(function({loops:e,width:t,height:n}){return e.length?(0,r.jsx)("svg",{width:t,height:n,className:"absolute left-0 top-0","aria-hidden":!0,children:e.map(e=>{var t,n;let i="spawn_pending"===(t=e.flow).state||"spawning"===t.state||"reviewing"===t.state?"forward":"relay_pending"===t.state||"relaying"===t.state||"fixing"===t.state||"waiting_ready"===t.state&&t.rounds.length?"back":null,s="approved"===(n=e.flow).state?"#1a8a3e":B.has(n.state)?"#5a51e0":H.has(n.state)?"#e0ae45":"#9a9aa4",l=e.y+150,a=e.y+330,o=(e.x1+e.x2)/2,c=(l+a)/2,d=`M ${e.x1} ${l} C ${e.x1+52} ${l-56}, ${e.x2-52} ${l-56}, ${e.x2-7} ${l}`,u=`M ${e.x2} ${a} C ${e.x2-52} ${a+56}, ${e.x1+52} ${a+56}, ${e.x1+7} ${a}`,p=`M ${e.x2-9} ${l-5} L ${e.x2-9} ${l+5} L ${e.x2-1} ${l} Z`,f=`M ${e.x1+9} ${a-5} L ${e.x1+9} ${a+5} L ${e.x1+1} ${a} Z`,m=(e,t)=>({d:e,fill:"none",stroke:t?"#5a51e0":"#c9c9d1",strokeWidth:t?3:2.5,strokeLinecap:"round",className:t?"loop-arc-live":void 0,style:{d:`path("${e}")`,transition:`d 380ms ${ir}`}}),x=e=>({d:`path("${e}")`,transition:`d 380ms ${ir}`});return(0,r.jsxs)("g",{children:[(0,r.jsx)("path",{...m(d,"forward"===i)}),(0,r.jsx)("path",{d:p,style:x(p),fill:"forward"===i?"#5a51e0":"#c9c9d1"}),(0,r.jsx)("path",{...m(u,"back"===i)}),(0,r.jsx)("path",{d:f,style:x(f),fill:"back"===i?"#5a51e0":"#c9c9d1"}),(0,r.jsx)("circle",{cx:o,cy:c,r:17,fill:"#ffffff",stroke:s,strokeWidth:2,style:{cx:`${o}px`,cy:`${c}px`,transition:`cx 380ms ${ir}, cy 380ms ${ir}`}}),(0,r.jsx)("text",{x:o,y:c+6,textAnchor:"middle",fontSize:17,fontWeight:700,fill:s,style:{x:`${o}px`,y:`${c+6}px`,transition:`x 380ms ${ir}, y 380ms ${ir}`},children:"⟳"})]},e.key)})}):null});function ia({file:e,onSelect:t}){let n=ec(e);return(0,r.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:b(e.title),onClick:()=>t(e),children:[(0,r.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${G(e.activity)}`}),(0,r.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:n.style,children:n.label}),(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-semibold",children:b(e.cmdDesc||e.title,80)}),(0,r.jsx)("span",{className:"shrink-0 text-[10.5px] text-dim",children:Q(e.mtime)})]})}function io({file:e}){let t=ec(e);return(0,r.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,r.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,r.jsx)("span",{className:`h-[0.6em] w-[0.6em] shrink-0 rounded-full ${G(e.activity)}`}),(0,r.jsx)("span",{className:"shrink-0 rounded-full px-[0.45em] font-bold",style:{...t.style,fontSize:"0.72em"},children:t.label}),(0,r.jsx)("span",{className:"line-clamp-2 min-w-0 font-bold",children:b(e.title,70)})]})})}let ic=()=>void 0,id=e=>e?" opacity-35":"";function iu({node:e,ringed:t,dimmed:n,flow:i}){let{t:s}=h(),l=ec(e.file);return(0,r.jsxs)("div",{"data-scheme-node":e.file.path,className:`scheme-enter absolute${id(n)}`,style:{transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,transition:ii},children:[i?(0,r.jsx)("div",{className:"absolute -top-[60px] left-0 z-[4]",style:{width:1370},children:(0,r.jsx)(ie,{flow:i,onFocusRound:ic})}):null,e.under.length?(0,r.jsxs)(r.Fragment,{children:[(0,r.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,r.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,r.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 ${t?"ring-2 ring-accent/60 ring-offset-2 ring-offset-bg":""}`,style:eo(e.file),children:[(0,r.jsxs)("div",{className:"flex shrink-0 items-center gap-2 border-b border-line px-3 py-2.5",children:[(0,r.jsx)("span",{className:`h-2.5 w-2.5 shrink-0 rounded-full ${G(e.file.activity)}`}),(0,r.jsx)("span",{className:"shrink-0 rounded-full px-2 py-0.5 text-[11px] font-bold",style:l.style,children:l.label}),e.file.model?(0,r.jsx)("span",{className:"min-w-0 truncate font-mono text-[11px] text-dim",children:e.file.model}):null,(0,r.jsx)("span",{className:"ml-auto shrink-0 text-[11px] text-dim",children:Q(e.file.mtime)})]}),(0,r.jsx)("div",{className:"min-w-0 flex-1 px-3 py-2.5 text-[14px] font-semibold leading-snug",children:(0,r.jsx)("span",{className:"line-clamp-5",children:b(e.file.title,180)})}),e.under.length?(0,r.jsxs)("div",{className:"shrink-0 px-3 pb-2.5 text-[11px] font-semibold text-dim",children:[e.under.length," ",s("scheme.underneath")]}):null]}),i?(0,r.jsx)(it,{role:"implementer",active:"implementer"===W(i)}):null,(0,r.jsx)(io,{file:e.file})]})}function ip({draft:e,ringed:t,dimmed:n}){let{t:i}=h();return(0,r.jsx)("div",{"data-scheme-node":e.key,className:`scheme-enter absolute${id(n)}`,style:{transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,transition:ii},children:(0,r.jsx)("div",{className:`flex h-full items-center justify-center rounded-[10px] border border-dashed border-line bg-panel/70 ${t?"ring-2 ring-accent/60 ring-offset-2 ring-offset-bg":""}`,children:(0,r.jsxs)("span",{className:"flex items-center gap-1.5 text-[13px] font-semibold text-dim",children:[(0,r.jsx)("span",{className:"text-[15px] leading-none text-accent",children:"+"})," ",i("mobile.agent")]})})})}function im({deck:e,dimmed:t}){let{t:n}=h(),i=e.rounds.at(-1)??null,s=i?.round??null,l=Y(s?.verdict??null);return(0,r.jsxs)("div",{"data-scheme-node":e.key,className:`scheme-enter absolute${id(t)}`,style:{transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,transition:ii},children:[(0,r.jsx)("div",{className:"flex h-full flex-col overflow-hidden rounded-[10px] border border-line bg-panel shadow-card",children:s?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5 border-b border-line px-3 py-2.5",style:{backgroundColor:l.soft,color:l.color},children:[(0,r.jsxs)("span",{className:"flex shrink-0 items-center gap-1 text-[12px] font-bold",children:["R",s.n," ",(0,r.jsx)(rN,{verdict:s.verdict,error:!!s.error,className:"h-3.5 w-3.5"})]}),(0,r.jsx)("span",{className:"min-w-0 truncate text-[11px] font-semibold",children:s.error?n("roundDeck.aborted"):s.verdict??n("roundDeck.reviewInProgress")})]}),(0,r.jsx)("div",{className:"min-w-0 flex-1 px-3 py-2.5 text-[13px] font-semibold leading-snug",children:(0,r.jsx)("span",{className:"line-clamp-4",children:i?.file?b(i.file.title,140):n("roundDeck.spawningReviewer")})}),e.rounds.length>1?(0,r.jsx)("div",{className:"shrink-0 px-3 pb-2.5 text-[11px] font-semibold text-dim",children:n("roundDeck.moreRounds",{count:e.rounds.length-1})}):null]}):(0,r.jsx)("div",{className:"flex flex-1 items-center justify-center text-[12px] font-semibold text-dim",children:n("roundDeck.waitingFirst")})}),(0,r.jsx)(it,{role:"reviewer",active:"reviewer"===W(e.flow)})]})}function ix({stack:e,dimmed:t,onSelect:n}){let{t:i}=h();return(0,r.jsx)("div",{"data-scheme-node":e.key,className:`scheme-enter absolute${id(t)}`,style:{transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,transition:ii},children:(0,r.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:e.items.map(({file:e,branches:t})=>{let s=ec(e);return(0,r.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:b(e.title),onClick:()=>n(e),children:[(0,r.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,r.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${G(e.activity)}`}),(0,r.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:s.style,children:s.label}),(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-semibold",children:b(e.title,70)})]}),(0,r.jsxs)("span",{className:"flex items-center gap-2 pl-3 text-[10.5px] text-dim",children:[(0,r.jsx)("span",{children:nV(i,e.kind)}),(0,r.jsx)("span",{children:Q(e.mtime)}),t?(0,r.jsxs)("span",{children:["⤷ ",t]}):null]})]},e.path)})})})}function ih({node:e,files:t,ringed:n,marked:i,dimmed:s,flow:a,canFlow:o,onSelect:c,onClose:d,onFocusRound:u,onHandoff:p,onExpand:f}){let{t:m}=h(),[x,b]=(0,l.useState)(!1),[g,w]=(0,l.useState)(!1);return(0,r.jsxs)("div",{"data-scheme-node":e.file.path,"data-lasso-selected":i?"true":void 0,className:`scheme-enter absolute ${x||g?"z-20":""}${id(s)}`,style:{transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,transition:ii},children:[i?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"absolute -right-2.5 -top-2.5 z-[5] flex h-6 w-6 items-center justify-center rounded-full border-2 border-bg bg-accent text-white shadow-card",children:(0,r.jsx)(e6.A,{className:"h-3.5 w-3.5","aria-hidden":!0})}),(0,r.jsx)("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 z-[4] rounded-[10px] bg-accent/[0.06]"})]}):null,a?(0,r.jsx)("div",{className:"absolute -top-[60px] left-0 z-[4]",style:{width:1370},children:(0,r.jsx)(ie,{flow:a,onFocusRound:e=>u(a.id,e)})}):o?(0,r.jsx)("div",{className:"absolute -top-11 left-0 z-[4]",children:(0,r.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":g,title:m("scheme.flowTitle"),onClick:()=>w(e=>!e),children:[(0,r.jsx)("span",{className:"text-[13px] leading-none text-accent",children:"⟳"})," ",m("scheme.flow")]})}):null,g?(0,r.jsx)("div",{className:"absolute left-0 top-[-8px] z-40 -translate-y-full",children:(0,r.jsx)(r4,{file:e.file,onClose:()=>w(!1)})}):null,e.under.length?(0,r.jsxs)(r.Fragment,{children:[(0,r.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,r.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,r.jsx)("div",{className:`relative z-[1] flex h-full ${n?"rounded-[10px] ring-2 ring-accent/60 ring-offset-2 ring-offset-bg":""}`,children:(0,r.jsx)(n0,{file:e.file,tasks:e.tasks,files:t,onSelect:c,isRoot:e.isRoot,onClose:()=>d(e.file.path),onToggleExpand:()=>f(e.file.path)})}),a?(0,r.jsx)(it,{role:"implementer",active:"implementer"===W(a)}):null,(0,r.jsx)(io,{file:e.file}),p&&rT(e.file)?(0,r.jsx)(rE,{file:e.file,onHandoff:()=>p(e.file)}):null,e.under.length?(0,r.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":x,title:m("scheme.collapsedTitle"),onClick:()=>b(e=>!e),children:[(0,r.jsx)(r1.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),e.under.length," ",m("scheme.underneath"),(0,r.jsx)(e8.A,{className:`h-3 w-3 transition-transform ${x?"rotate-90":""}`,"aria-hidden":!0})]}):null,x?(0,r.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:e.under.map(e=>(0,r.jsx)(ia,{file:e,onSelect:c},e.path))}):null]})}function ib({draft:e,project:t,files:n,ringed:i,dimmed:s,onDraftClose:l,onDraftSpawned:a}){return(0,r.jsx)("div",{"data-scheme-node":e.key,className:`scheme-enter absolute${id(s)}`,style:{transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,transition:ii},children:(0,r.jsx)("div",{className:`flex h-full ${i?"rounded-[10px] ring-2 ring-accent/60 ring-offset-2 ring-offset-bg":""}`,children:eL(e.id)?(0,r.jsx)(re,{draftId:e.id,project:t,onClose:()=>l(e.id),onLaunched:()=>l(e.id)}):(0,r.jsx)(n6,{draftId:e.id,project:t,files:n,onClose:()=>l(e.id),onSpawned:t=>a(e.id,t)})})})}function ig({deck:e,files:t,focus:n,dimmed:i,onSelect:s}){let l=n&&n.flowId===e.flow.id?n.round+n.nonce/1e3:null;return(0,r.jsxs)("div",{"data-scheme-node":e.key,className:`scheme-enter absolute${id(i)}`,style:{transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,transition:ii},children:[(0,r.jsx)(rA,{flow:e.flow,rounds:e.rounds,files:t,onSelect:s,focusRound:l}),(0,r.jsx)(it,{role:"reviewer",active:"reviewer"===W(e.flow)})]})}let iw=(0,l.memo)(function({layout:e,project:t,files:n,interactive:i,lite:s,selected:l,multi:a,session:o,focus:c,attentionPaths:d,flowsByImpl:u,deckFocus:p,onSelect:f,onClose:m,onFocusRound:x,onDraftClose:h,onDraftSpawned:b,onHandoff:g,onExpand:w}){let v=e=>null!==d&&!e.rounds.some(e=>e.file&&d.has(e.file.path));return(0,r.jsxs)("div",{className:`${i?"":"pointer-events-none select-none"} ${o?"scheme-session":""}`.trim()||void 0,children:[e.stacks.map(e=>(0,r.jsx)(ix,{stack:e,dimmed:null!==d&&!e.items.some(e=>d.has(e.file.path)),onSelect:f},e.key)),e.decks.map(e=>s?(0,r.jsx)(im,{deck:e,dimmed:v(e)},e.key):(0,r.jsx)(ig,{deck:e,files:n,focus:p,dimmed:v(e),onSelect:f},e.key)),e.drafts.map(e=>s?(0,r.jsx)(ip,{draft:e,ringed:l===e.key||c===e.key,dimmed:null!==d},e.key):(0,r.jsx)(ib,{draft:e,project:t,files:n,ringed:l===e.key||c===e.key,dimmed:null!==d,onDraftClose:h,onDraftSpawned:b},e.key)),e.nodes.map(e=>s?(0,r.jsx)(iu,{node:e,ringed:l===e.file.path||c===e.file.path,dimmed:null!==d&&!d.has(e.file.path),flow:u.get(e.file.path)??null},e.file.path):(0,r.jsx)(ih,{node:e,files:n,ringed:o?a.has(e.file.path):l===e.file.path||c===e.file.path,marked:o&&a.has(e.file.path),dimmed:null!==d&&!d.has(e.file.path),flow:u.get(e.file.path)??null,canFlow:F(e.file,u),onSelect:f,onClose:m,onFocusRound:x,onHandoff:g,onExpand:w},e.file.path))]})}),iv="#d97757",ik=(0,l.memo)(function({edges:e,width:t,height:n,onRetry:i}){return e.length?(0,r.jsx)("svg",{width:t,height:n,className:"pointer-events-none absolute left-0 top-0 z-[2]",children:e.map(e=>{let t=e.failed?iv:ri[e.status].color,n=(e.x1+e.x2)/2,s=`M ${e.x1} ${e.y1} C ${n} ${e.y1}, ${n} ${e.y2}, ${e.x2} ${e.y2}`,l=(e.x1+e.x2)/2,a=(e.y1+e.y2)/2;return(0,r.jsxs)("g",{opacity:e.failed?.95:.65,children:[(0,r.jsx)("path",{d:s,style:{d:`path("${s}")`,transition:`d 380ms ${ir}`},fill:"none",stroke:t,strokeWidth:2.5,strokeLinecap:"round",strokeDasharray:"5 7"}),(0,r.jsx)("circle",{cx:e.x2,cy:e.y2,r:4,fill:t,style:{cx:`${e.x2}px`,cy:`${e.y2}px`,transition:`cx 380ms ${ir}, cy 380ms ${ir}`}}),e.failed?(0,r.jsxs)("g",{className:"pointer-events-auto cursor-pointer",role:"button","aria-label":`retry ${e.path}`,onClick:()=>i(e.taskId,e.path),children:[(0,r.jsx)("title",{children:e.error??""}),(0,r.jsx)("path",{d:s,fill:"none",stroke:"transparent",strokeWidth:22,style:{pointerEvents:"stroke"}}),(0,r.jsx)("circle",{cx:l,cy:a,r:11,fill:"#fff",stroke:iv,strokeWidth:2,style:{cx:`${l}px`,cy:`${a}px`,transition:`cx 380ms ${ir}, cy 380ms ${ir}`}}),(0,r.jsx)("text",{x:l,y:a+4.5,textAnchor:"middle",fontSize:13,fontWeight:700,fill:iv,style:{x:`${l}px`,y:`${a+4.5}px`,transition:`x 380ms ${ir}, y 380ms ${ir}`},children:"⚠"})]}):null]},e.key)})}):null});var iy=n(9804);function ij({task:e,assignment:t,file:n,onRetry:i}){let{t:s}=h();if(!t.path)return(0,r.jsxs)("span",{className:"flex h-6 items-center gap-1.5 rounded-[6px] bg-white/55 px-1.5 text-[10.5px] font-semibold text-dim",children:[(0,r.jsx)(tg.A,{className:"h-3 w-3 shrink-0 animate-spin","aria-hidden":!0}),s("tasks.spawning")]});let l=!n,a="failed"===t.state,o=n?ec(n):null,c=n?b(n.title,40):t.path.split("/").pop()??t.path,d=(0,r.jsxs)(r.Fragment,{children:[n?(0,r.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${G(n.activity)}`}):null,o?(0,r.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:o.style,children:o.label}):null,(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate text-[10.5px] font-semibold",children:c}),a?(0,r.jsx)("span",{"aria-hidden":!0,children:"⚠"}):null]});return a||l?(0,r.jsx)("button",{type:"button",className:`flex h-6 w-full min-w-0 items-center gap-1.5 rounded-[6px] px-1.5 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${a?"bg-[#faeee9] text-[#a04a2e] hover:bg-[#f6ded2]":"bg-white/45 text-dim opacity-70 hover:opacity-100"}`,title:a?s("tasks.chipFailedTitle",{error:t.error??""}):`${s("tasks.deadChip")} \xb7 ${s("tasks.retry")}`,onClick:()=>i(e,t.path),children:d}):(0,r.jsx)("span",{className:"flex h-6 w-full min-w-0 items-center gap-1.5 rounded-[6px] bg-white/55 px-1.5",title:n?b(n.title):void 0,children:d})}function iN({task:e,files:t,project:n,onSend:i,onClose:s}){let{t:a}=h(),[o,c]=(0,l.useState)(()=>new Set);return(0,r.jsxs)("div",{"data-task-pop":!0,className:"absolute left-0 top-full z-30 mt-1 flex w-[280px] flex-col rounded-[10px] border border-line bg-panel p-1.5 shadow-[0_10px_36px_rgb(20_20_30/0.18)]",children:[(0,r.jsx)("div",{className:"px-1 pb-1 text-[10.5px] font-bold text-dim",children:a("tasks.pickerTitle")}),(0,r.jsx)(rh,{files:t,project:n,checked:o,onChange:c}),(0,r.jsxs)("div",{className:"mt-1 flex items-center justify-end gap-1 border-t border-line pt-1.5",children:[(0,r.jsx)("button",{type:"button",className:"rounded-[8px] px-2 py-1 text-[11px] font-semibold text-dim hover:bg-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:s,children:a("common.cancel")}),(0,r.jsx)("button",{type:"button",disabled:!o.size,className:"rounded-[8px] border border-accent bg-accent px-2.5 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",onClick:()=>{i(e,[...o]),s()},children:a("tasks.pickerSend",{count:o.size})})]})]})}function iS({task:e,onSpawn:t,onClose:n}){let{t:i}=h(),[s,a]=(0,l.useState)("claude"),[o,c]=(0,l.useState)(""),[d,u]=(0,l.useState)([]),[p,f]=(0,l.useState)(!1),[m,x]=(0,l.useState)(null);(0,l.useEffect)(()=>{let t=!1,n=e.assignments.find(e=>e.path)?.path;return fetch("/api/spawn?project="+encodeURIComponent(e.project)+(n?"&src="+encodeURIComponent(n):"")).then(e=>e.json()).then(e=>{t||(Array.isArray(e.dirs)&&u(e.dirs),c(t=>t||("string"==typeof e.cwd?e.cwd:"")||e.dirs?.[0]||""))}).catch(()=>{}),()=>{t=!0}},[e.project,e.assignments]);let b=async()=>{if(p||!o.trim())return;f(!0),x(null);let r=await t(e,s,o.trim());f(!1),r?x(r):n()},g="task-spawn-dirs-"+e.id;return(0,r.jsxs)("div",{"data-task-pop":!0,className:"absolute left-0 top-full z-30 mt-1 flex w-[280px] flex-col gap-1.5 rounded-[10px] border border-line bg-panel p-2 shadow-[0_10px_36px_rgb(20_20_30/0.18)]",children:[(0,r.jsx)("div",{className:"flex items-center gap-1",role:"radiogroup","aria-label":i("draft.engineAria"),children:["claude","codex"].map(e=>(0,r.jsx)("button",{type:"button",role:"radio","aria-checked":s===e,disabled:p,onClick:()=>a(e),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 ${s===e?"border-accent bg-accent/10 text-accent":"border-transparent text-dim hover:text-ink"}`,children:"claude"===e?"Claude":"Codex"},e))}),(0,r.jsx)("input",{value:o,disabled:p,onChange:e=>c(e.target.value),list:g,placeholder:"/home/…/Projects/…","aria-label":i("draft.dirAria"),className:"min-w-0 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,r.jsx)("datalist",{id:g,children:d.map(e=>(0,r.jsx)("option",{value:e},e))}),m?(0,r.jsx)("span",{className:"text-[10.5px] font-semibold text-err",children:m}):null,(0,r.jsxs)("div",{className:"flex items-center justify-end gap-1",children:[(0,r.jsx)("button",{type:"button",className:"rounded-[8px] px-2 py-1 text-[11px] font-semibold text-dim hover:bg-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:n,children:i("common.cancel")}),(0,r.jsxs)("button",{type:"button",disabled:p||!o.trim(),className:"inline-flex items-center gap-1 rounded-[8px] border border-accent bg-accent px-2.5 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",onClick:()=>void b(),children:[p?(0,r.jsx)(tg.A,{className:"h-3 w-3 animate-spin","aria-hidden":!0}):(0,r.jsx)(iy.A,{className:"h-3 w-3","aria-hidden":!0}),i("tasks.spawnGo")]})]})]})}let iC=(0,l.memo)(function({task:e,files:t,camRef:n,handlers:i}){let{t:s}=h(),[a,o]=(0,l.useState)(null),c=(0,l.useRef)(null),[d,u]=(0,l.useState)(null),[p,f]=(0,l.useState)(!1),[m,x]=(0,l.useState)(""),[g,w]=(0,l.useState)(!1),[v,k]=(0,l.useState)(null),[y,j]=(0,l.useState)(!1),N=(0,l.useRef)(null);(0,l.useEffect)(()=>{if(!y)return;let e=window.setTimeout(()=>j(!1),4e3);return()=>window.clearTimeout(e)},[y]),(0,l.useEffect)(()=>{if(!p)return;let t=window.setTimeout(()=>{m.trim()&&m!==e.text&&i.patch(e.id,{text:m})},900);return()=>window.clearTimeout(t)},[p,m,e.id,e.text,i]);let S=()=>{if(f(!1),!m.trim()){m!==e.text&&(w(!0),ru("err",s("tasks.emptyTextBlocked")));return}w(!1),m!==e.text&&i.patch(e.id,{text:m})},C=()=>(p?!m.trim():!!g)&&(ru("err",s("tasks.emptyTextBlocked")),!0),A=(e,t)=>{C()||i.send(e,t)},$=async(e,t,n)=>C()?s("tasks.emptyTextBlocked"):i.spawn(e,t,n),T=a??(d&&d.seen===e.updatedAt?d:e.pos),E=ri[e.status],D=rl(e.text)||s("tasks.untitled"),M=e.text.includes("\n")?e.text.slice(e.text.indexOf("\n")+1):"",R=new Map(t.map(e=>[e.path,e])),P=p||null!==a||null!==v,I=tO({onDrop:t=>C()?null:(i.send(e,[t.file.path]),s("tasks.linkSent",{title:b(t.file.title,48)})),onMiss:()=>k("spawn")});return(0,r.jsxs)("div",{"data-scheme-task":e.id,className:`group absolute pb-9 ${P?"z-30":"z-[4]"}`,style:{transform:`translate(${T.x}px, ${T.y}px)`,width:260,transition:a?void 0:`transform 380ms ${ir}`},onPointerDown:e=>{if(0===e.button&&!p&&!e.target.closest("button, a, input, textarea, select, [data-task-pop]")){c.current={sx:e.clientX,sy:e.clientY,ox:T.x,oy:T.y,moved:!1};try{e.currentTarget.setPointerCapture(e.pointerId)}catch{}}},onPointerMove:e=>{let t=c.current;if(!t)return;let r=e.clientX-t.sx,i=e.clientY-t.sy;if(!t.moved&&4>Math.hypot(r,i))return;t.moved=!0;let s=n.current?.z??1;o({x:t.ox+r/s,y:t.oy+i/s})},onPointerUp:t=>{let r=c.current;if(c.current=null,r){if(r.moved){let s=n.current?.z??1,l={x:Math.round(r.ox+(t.clientX-r.sx)/s),y:Math.round(r.oy+(t.clientY-r.sy)/s)};o(null),u({...l,seen:e.updatedAt}),i.patch(e.id,{pos:l}).then(e=>{e&&u(null)});return}t.target.closest("[data-task-body]")&&(p||((n.current?.z??1)<.55&&i.center(rW(e)),x(e.text),f(!0),requestAnimationFrame(()=>{let e=N.current;e&&(e.focus(),e.setSelectionRange(e.value.length,e.value.length))})))}},children:[(0,r.jsxs)("div",{className:`flex flex-col overflow-hidden rounded-[8px] border border-line border-t-4 shadow-card ${"done"===e.status?"opacity-60 saturate-50":""} ${p?"ring-2 ring-accent/50":""}`,style:{borderTopColor:E.color,backgroundColor:E.soft},children:[p?(0,r.jsx)("textarea",{ref:N,value:m,onChange:e=>x(e.target.value),onBlur:S,onKeyDown:e=>{"Escape"===e.key&&(e.preventDefault(),S())},"aria-label":s("tasks.editAria"),rows:Math.min(16,Math.max(3,m.split("\n").length+1)),className:"w-full resize-none bg-transparent px-3 py-2 text-[12.5px] leading-[17px] text-[#26262c] placeholder:text-dim focus-visible:outline-none",maxLength:6e3}):(0,r.jsxs)("div",{"data-task-body":!0,className:"cursor-text overflow-y-auto px-3 py-2",style:{maxHeight:340},children:[(0,r.jsx)("div",{className:"whitespace-pre-wrap break-words text-[12.5px] font-bold leading-[17px] text-[#26262c]",children:D}),M.trim()?(0,r.jsx)("div",{className:"whitespace-pre-wrap break-words text-[12.5px] leading-[17px] text-[#3a3a42]",children:M}):null]}),e.assignments.length?(0,r.jsx)("div",{className:"flex flex-col gap-1 px-2 pb-2",children:e.assignments.map((t,n)=>(0,r.jsx)(ij,{task:e,assignment:t,file:t.path?R.get(t.path)??null:null,onRetry:(e,t)=>A(e,[t])},(t.path??"spawning")+"::"+n))}):null]}),(0,r.jsxs)("div",{className:`absolute left-0 top-full flex -translate-y-8 items-center gap-1 ${P?"":"pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100"} transition-opacity`,children:[(0,r.jsxs)("button",{type:"button",className:"inline-flex h-7 touch-none items-center gap-1 rounded-full border border-line bg-panel px-2 text-[10.5px] font-semibold text-dim shadow-card hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:s("tasks.sendTitle"),onPointerDown:I.onPillPointerDown,onClick:()=>{if(I.consumeClick())return;let t=i.selectionPaths();t.length?A(e,t):k(e=>"send"===e?null:"send")},children:[(0,r.jsx)(nP.A,{className:"h-3 w-3","aria-hidden":!0})," ",s("tasks.send")]}),(0,r.jsx)("button",{type:"button",className:"inline-flex h-7 items-center rounded-full border px-2 text-[10.5px] font-bold shadow-card focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",style:{backgroundColor:"#fff",color:E.color,borderColor:E.color},title:s("tasks.statusTitle",{label:s(`tasks.status.${e.status}`)}),onClick:()=>{var t;let n;i.patch(e.id,{status:(t=e.status,n=rs.indexOf(t),rs[(n+1)%rs.length])})},children:s(`tasks.status.${e.status}`)}),(0,r.jsxs)("button",{type:"button",className:`inline-flex h-7 items-center gap-1 rounded-full border px-2 text-[10.5px] font-semibold shadow-card focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${y?"border-err bg-err text-white":"border-line bg-panel text-dim hover:border-err/40 hover:text-err"}`,"aria-label":s("tasks.deleteAria",{title:D}),title:y?s("tasks.deleteConfirm"):s("tasks.delete"),onClick:()=>{y?(j(!1),i.remove(e.id)):j(!0)},children:[(0,r.jsx)(td.A,{className:"h-3 w-3","aria-hidden":!0}),y?s("tasks.deleteConfirm"):null]})]}),"send"===v?(0,r.jsx)(iN,{task:e,files:t,project:e.project,onSend:A,onClose:()=>k(null)}):null,"spawn"===v?(0,r.jsx)(iS,{task:e,onSpawn:$,onClose:()=>k(null)}):null,I.overlay]})});function iA({pos:e,onCommit:t,onCancel:n}){let{t:i}=h(),[s,a]=(0,l.useState)(""),o=(0,l.useRef)(null);(0,l.useEffect)(()=>{o.current?.focus()},[]);let c=()=>{s.trim()?t(s):n()};return(0,r.jsx)("div",{"data-scheme-task":"new",className:"absolute z-30",style:{transform:`translate(${e.x}px, ${e.y}px)`,width:260},children:(0,r.jsx)("div",{className:"flex flex-col overflow-hidden rounded-[8px] border border-line border-t-4 shadow-card ring-2 ring-accent/50",style:{borderTopColor:ri.inbox.color,backgroundColor:ri.inbox.soft},children:(0,r.jsx)("textarea",{ref:o,value:s,onChange:e=>a(e.target.value),onBlur:c,onKeyDown:e=>{"Escape"===e.key&&(e.preventDefault(),c())},placeholder:i("tasks.newPlaceholder"),"aria-label":i("tasks.editAria"),rows:4,className:"w-full resize-none bg-transparent px-3 py-2 text-[12.5px] leading-[17px] text-[#26262c] placeholder:text-dim focus-visible:outline-none",maxLength:6e3})})})}function i$({task:e}){let{t}=h(),n=ri[e.status];return(0,r.jsx)("div",{"data-scheme-task":e.id,className:`absolute overflow-hidden rounded-[8px] border border-line border-t-4 shadow-card ${"done"===e.status?"opacity-60 saturate-50":""}`,style:{transform:`translate(${e.pos.x}px, ${e.pos.y}px)`,width:260,height:rB(e),borderTopColor:n.color,backgroundColor:n.soft},children:(0,r.jsx)("div",{className:"px-3 py-2 text-[12.5px] font-bold leading-[17px] text-[#26262c]",children:(0,r.jsx)("span",{className:"line-clamp-4 whitespace-pre-wrap break-words",children:rl(e.text)||t("tasks.untitled")})})})}let iT=(0,l.memo)(function({tasks:e,files:t,interactive:n,lite:i,camRef:s,handlers:l,pending:a,onCreate:o,onCreateCancel:c}){return(0,r.jsxs)("div",{className:n?void 0:"pointer-events-none select-none",children:[e.map(e=>i?(0,r.jsx)(i$,{task:e},e.id):(0,r.jsx)(iC,{task:e,files:t,camRef:s,handlers:l},e.id)),a&&!i?(0,r.jsx)(iA,{pos:a,onCommit:o,onCancel:c}):null]})}),iE="llvSchemeMode",iD=(e,t)=>Math.hypot(e.x-t.x,e.y-t.y),iM=new Set;function iR({active:e,title:t,onClick:n,children:i}){return(0,r.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 ${e?"bg-accent/10 text-accent":"text-dim hover:bg-bg hover:text-ink"}`,title:t,"aria-label":t,"aria-pressed":e,onClick:n,children:i})}function iP({project:e,groups:t,manual:n,files:i,flows:s,tasks:a,drafts:o,focus:c,ring:d,attentionPaths:u,onSelect:f,onNodePick:m,onClose:g,onDraftClose:w,onDraftSpawned:v,onHandoff:k}){let{t:y}=h(),j=!!m,[N,S]=(0,l.useState)(null),[C,A]=(0,l.useState)(iM),[$,T]=(0,l.useState)(!1);(0,l.useEffect)(()=>{c&&S(c)},[c]);let E=(0,l.useMemo)(()=>rD(t,n,i,s,o),[t,n,i,s,o]);(0,l.useEffect)(()=>{A(e=>(function(e,t){let n=new Set(t.map(e=>e.file.path));for(let t of e)if(!n.has(t))return new Set([...e].filter(e=>n.has(e)));return e})(e,E.nodes))},[E]);let D=!j&&($||C.size>0),M=(0,l.useCallback)(()=>{A(iM),T(!1)},[]),R=(0,l.useCallback)(e=>{A(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),P=(0,l.useRef)(N);(0,l.useEffect)(()=>{P.current=N},[N]);let I=(0,l.useCallback)((e,t)=>{if(null===e){S(null),M();return}if(t&&E.byPath.has(e)&&E.nodes.some(t=>t.file.path===e)){S(null),A(t=>{let n=new Set(t),r=P.current;return r&&r!==e&&E.nodes.some(e=>e.file.path===r)&&n.add(r),n.has(e)?n.delete(e):n.add(e),n});return}S(e)},[E,M]),_=(0,l.useMemo)(()=>O(s),[s]),[L,z]=(0,l.useState)(null);(0,l.useEffect)(()=>{z(null)},[e]);let q=L?E.nodes.find(e=>e.file.path===L)??null:null,F=null!==q;(0,l.useEffect)(()=>{if(!F)return;let e=e=>{if("Escape"!==e.key)return;let t=e.target;t&&(["INPUT","TEXTAREA","SELECT"].includes(t.tagName)||t.isContentEditable)||(e.preventDefault(),e.stopPropagation(),z(null))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[F]);let[U,H]=(0,l.useState)(null),B=(0,l.useCallback)((e,t)=>{H(n=>({flowId:e,round:t,nonce:(n?.nonce??0)+1}))},[]),W=d??c,K=(0,l.useRef)(f),Y=(0,l.useRef)(m),J=(0,l.useRef)(g),Q=(0,l.useRef)(w),X=(0,l.useRef)(v),G=(0,l.useRef)(k);(0,l.useEffect)(()=>{K.current=f,Y.current=m,J.current=g,Q.current=w,X.current=v,G.current=k});let V=(0,l.useCallback)(e=>{let t=Y.current;t?t(e.path):K.current(e)},[]),Z=(0,l.useCallback)(e=>J.current(e),[]),ee=(0,l.useCallback)(e=>Q.current(e),[]),et=(0,l.useCallback)((e,t)=>X.current(e,t),[]),en=(0,l.useCallback)(e=>G.current?.(e),[]),er=(0,l.useCallback)(e=>z(e),[]),ei=(0,l.useCallback)(e=>{z(null),K.current(e)},[]),es=(0,l.useRef)(D);(0,l.useEffect)(()=>{es.current=D},[D]);let el=(0,l.useRef)(!1),ea=(0,l.useCallback)((e,t)=>{if(el.current)return el.current=!1,!0;if(!es.current)return S(null),!0;let n=rZ(E.nodes,{x:e,y:t,w:0,h:0});return n.length?R(n[0]):M(),!0},[E,R,M]),eo=(0,l.useRef)(()=>!1),[ec,ed]=(0,l.useState)([]),[eu,ep]=(0,l.useState)(null);(0,l.useEffect)(()=>{let t=new Set(a.map(e=>e.id));ed(n=>{let r=n.filter(n=>!t.has(n.id)&&n.project===e);return r.length===n.length?n:r})},[a,e]);let ef=(0,l.useMemo)(()=>{let t=new Set(a.map(e=>e.id)),n=ec.filter(n=>!t.has(n.id)&&n.project===e);return n.length?[...a,...n]:a},[a,ec,e]),em=(0,l.useMemo)(()=>new Map(ef.map(e=>["task::"+e.id,rW(e)])),[ef]),ex=(0,l.useMemo)(()=>(function(e,t){let n=[];for(let r of e){let e=rW(r),i=rK(e);for(let s of r.assignments){if(!s.path)continue;let l=t.get(s.path);if(!l)continue;let a=rY(e,rK(l)),o=rY(l,i);n.push({key:r.id+"::"+s.path,taskId:r.id,path:s.path,x1:a.x,y1:a.y,x2:o.x,y2:o.y,status:r.status,failed:"failed"===s.state,error:s.error})}}return n})(ef,function(e){let t=new Map,n=({x:e,y:t,w:n,h:r})=>({x:e,y:t,w:n,h:r});for(let r of e.stacks)for(let e of r.items)t.set(e.file.path,n(r));for(let r of e.decks)for(let e of r.rounds){let i=e.file?.path??e.round.reviewerPath;i&&t.set(i,n(r))}for(let r of e.nodes)for(let e of r.under)t.set(e.path,n(r));for(let r of e.nodes)t.set(r.file.path,n(r));return t}(E)),[ef,E]),eh=(0,l.useCallback)((e,t)=>{ep({x:Math.round(e-130),y:Math.round(t-14)})},[]),{cam:eb,vp:eg,viewportRef:ew,handLike:ev,taskTool:ek,setTaskTool:ey,centerOn:ej,panning:eN,glide:eS,setMode:eC,onPointerDown:eA,onPointerMove:e$,onDoubleClick:eE,onClick:eD,zoomCenter:e_,zoomTo:eL,fit:ez,fitRect:eO,jump:eq}=function({project:e,layout:t,mapMode:n,focus:r,onNodePick:i,setSelected:s,onBackgroundDown:a,onWorldTap:o,taskRects:c,onPlaceTask:d}){let u=(0,l.useRef)(null),p=(0,l.useRef)(null),[f,m]=(0,l.useState)({x:0,y:0,z:.5}),[x,h]=(0,l.useState)("select"),[b,g]=(0,l.useState)(!1),[w,v]=(0,l.useState)(!1),[k,y]=(0,l.useState)(!1),[j,N]=(0,l.useState)(!1),[S,C]=(0,l.useState)({w:1,h:1}),A=(0,l.useRef)(null),$=(0,l.useRef)(new Map),T=(0,l.useRef)(null),E=(0,l.useRef)(x),D=(0,l.useRef)(w),M=(0,l.useRef)(b),R=(0,l.useRef)(d),P=(0,l.useRef)(null),I=(0,l.useRef)(null);(0,l.useEffect)(()=>{E.current=x},[x]),(0,l.useEffect)(()=>{D.current=w},[w]),(0,l.useEffect)(()=>{M.current=b},[b]),(0,l.useEffect)(()=>{R.current=d}),(0,l.useEffect)(()=>{let e=localStorage.getItem(iE);"hand"===e||"select"===e?h(e):window.matchMedia("(pointer: coarse)").matches&&h("hand")},[]);let _=(0,l.useCallback)(e=>{g(!1),h(e),localStorage.setItem(iE,e)},[]);(0,l.useEffect)(()=>{let e=u.current;if(!e)return;let t=new ResizeObserver(()=>{let t=e.getBoundingClientRect();C({w:Math.max(1,t.width),h:Math.max(1,t.height)})});return t.observe(e),()=>t.disconnect()},[]);let L=(0,l.useCallback)(e=>{let n=Math.min(Math.max(e.x,120-t.width*e.z),S.w-120),r=Math.min(Math.max(e.y,120-t.height*e.z),S.h-120);return n===e.x&&r===e.y?e:{...e,x:n,y:r}},[t.width,t.height,S]),z=(0,l.useRef)([]),O=(0,l.useRef)(null),q=(0,l.useCallback)(e=>{z.current.push(e),null==O.current&&(O.current=requestAnimationFrame(()=>{O.current=null;let e=z.current;z.current=[],m(t=>e.reduce((e,t)=>t(e),t))}))},[]);(0,l.useEffect)(()=>()=>{null!=O.current&&cancelAnimationFrame(O.current)},[]);let F=(0,l.useCallback)((e,t,n)=>{q(r=>{let i=Math.min(1.6,Math.max(.12,r.z*n));if(i===r.z)return r;let s=i/r.z;return L({z:i,x:e-(e-r.x)*s,y:t-(t-r.y)*s})})},[L,q]),U=(0,l.useCallback)(e=>{let t=u.current?.getBoundingClientRect();t&&F(t.width/2,t.height/2,e)},[F]),H=(0,l.useCallback)(e=>{let t=u.current?.getBoundingClientRect();t&&m(n=>{let r=Math.min(1.6,Math.max(.12,e));if(r===n.z)return n;let i=r/n.z,s=t.width/2,l=t.height/2;return L({z:r,x:s-(s-n.x)*i,y:l-(l-n.y)*i})})},[L]),B=(0,l.useCallback)(()=>{let e=u.current?.getBoundingClientRect();if(!e||!t.nodes.length&&!t.drafts.length)return null;let n=Math.min(1.6,Math.max(.12,Math.min((e.width-48)/t.width,(e.height-48)/t.height,1)));return{z:n,x:(e.width-t.width*n)/2,y:(e.height-t.height*n)/2}},[t]),W=(0,l.useCallback)(e=>{N(!0),m(e),P.current&&window.clearTimeout(P.current),P.current=window.setTimeout(()=>N(!1),500)},[]);(0,l.useEffect)(()=>()=>{P.current&&window.clearTimeout(P.current)},[]);let K=(0,l.useCallback)(()=>{let e=B();e&&W(e)},[B,W]),Y=(0,l.useCallback)(e=>{let t=u.current?.getBoundingClientRect();if(!t||e.w<=0||e.h<=0)return;let n=Math.min(1.6,Math.max(.12,Math.min((t.width-48)/e.w,(t.height-48)/e.h,1)));W(L({z:n,x:(t.width-e.w*n)/2-e.x*n,y:(t.height-e.h*n)/2-e.y*n}))},[W,L]),J=(0,l.useCallback)((e,t)=>{let n=u.current?.getBoundingClientRect();n&&W(r=>{let i=Math.min(1.6,Math.max(r.z,t));return{z:i,x:n.width/2-(e.x+e.w/2)*i,y:Math.min(n.height/2-e.y*i,.08*n.height-(e.y-40)*i)}})},[W]);(0,l.useEffect)(()=>{if(I.current===e||!t.nodes.length&&!t.drafts.length)return;if(I.current=e,!n)try{let t=sessionStorage.getItem("llvCam:"+e);if(t){let e=JSON.parse(t);if(Number.isFinite(e.x)&&Number.isFinite(e.y)&&Number.isFinite(e.z)&&e.z>=.12&&e.z<=1.6)return void m(e)}}catch{}let r=B();r&&m(r)},[e,t,B,n]),(0,l.useEffect)(()=>{if(n||I.current!==e)return;let t=window.setTimeout(()=>sessionStorage.setItem("llvCam:"+e,JSON.stringify(f)),300);return()=>window.clearTimeout(t)},[f,e,n]);let Q=(0,l.useRef)(null);(0,l.useEffect)(()=>{if(!r){Q.current=null;return}if(Q.current===r)return;let e=t.byPath.get(r)??c?.get(r);e&&(Q.current=r,J(e,.55))},[r,t,c,J]),(0,l.useEffect)(()=>{let e=u.current;if(!e)return;let t=t=>{if(t.target.closest("[data-scheme-ui]"))return;let n=e.getBoundingClientRect();if(t.ctrlKey||t.metaKey){t.preventDefault(),F(t.clientX-n.left,t.clientY-n.top,Math.exp(-(.0022*t.deltaY)));return}if("select"===E.current&&!D.current){for(let n=t.target;n&&n!==e;n=n.parentElement)if(n.scrollHeight>n.clientHeight+1){let e=getComputedStyle(n).overflowY;if("auto"===e||"scroll"===e)return}}t.preventDefault();let r=t.shiftKey&&!t.deltaX?t.deltaY:t.deltaX,i=t.shiftKey&&!t.deltaX?0:t.deltaY;q(e=>L({...e,x:e.x-r,y:e.y-i}))};return e.addEventListener("wheel",t,{passive:!1}),()=>e.removeEventListener("wheel",t)},[F,L,q]),(0,l.useEffect)(()=>{let e=e=>{var t;if(!((t=e.target)&&t.tagName&&(["INPUT","TEXTAREA","SELECT","BUTTON"].includes(t.tagName)||t.isContentEditable))){if(" "===e.key){e.preventDefault(),e.repeat||v(!0);return}if(!e.metaKey&&!e.ctrlKey&&!e.altKey){if("h"===e.key||"H"===e.key)_("hand");else if("v"===e.key||"V"===e.key)_("select");else if("t"===e.key||"T"===e.key)R.current&&g(!0);else if("Escape"===e.key)M.current?g(!1):s(null);else if("0"===e.key)K();else if("1"===e.key)H(1);else if("+"===e.key||"="===e.key)U(1.25);else if("-"===e.key)U(.8);else if(e.key.startsWith("Arrow")){e.preventDefault();let t="ArrowLeft"===e.key?160:"ArrowRight"===e.key?-160:0,n="ArrowUp"===e.key?160:"ArrowDown"===e.key?-160:0;m(e=>L({...e,x:e.x+t,y:e.y+n}))}}}},t=e=>{" "===e.key&&v(!1)};return window.addEventListener("keydown",e),window.addEventListener("keyup",t),()=>{window.removeEventListener("keydown",e),window.removeEventListener("keyup",t)}},[K,U,H,_,L,s]);let X=e=>{let t=u.current?.getBoundingClientRect();return t?{x:e.clientX-t.left,y:e.clientY-t.top}:{x:e.clientX,y:e.clientY}},G=e=>{A.current={sx:e.clientX,sy:e.clientY,cx:f.x,cy:f.y},y(!0);try{u.current?.setPointerCapture(e.pointerId)}catch{}};(0,l.useEffect)(()=>{let e=e=>{$.current.delete(e.pointerId),$.current.size<2&&(T.current=null),A.current=null,y(!1)};return window.addEventListener("pointerup",e),window.addEventListener("pointercancel",e),()=>{window.removeEventListener("pointerup",e),window.removeEventListener("pointercancel",e)}},[]);let V=n||"hand"===x||w,Z=(0,l.useCallback)((e,t)=>m(n=>L({...n,x:S.w/2-e*n.z,y:S.h/2-t*n.z})),[S,L]);return{cam:f,vp:S,viewportRef:u,mode:x,setMode:_,handLike:V,taskTool:b,setTaskTool:g,centerOn:J,panning:k,glide:j,onPointerDown:e=>{let t=e.target;if(!t.closest("[data-scheme-ui]")){if(n&&e.isPrimary&&(p.current={x:e.clientX,y:e.clientY}),"touch"===e.pointerType&&($.current.set(e.pointerId,X(e)),2===$.current.size)){let[e,t]=[...$.current.values()];T.current={d:iD(e,t),cx:(e.x+t.x)/2,cy:(e.y+t.y)/2},A.current=null,y(!1);return}if(1===e.button){e.preventDefault(),G(e);return}if(0===e.button){if(b&&!n&&R.current){let t=u.current?.getBoundingClientRect();if(t){e.preventDefault(),R.current((e.clientX-t.left-f.x)/f.z,(e.clientY-t.top-f.y)/f.z),g(!1),_("select");return}}if(!(n||"hand"===x||w)){if(t.closest("[data-scheme-task]"))return;let n=t.closest("[data-scheme-node]");if(n)return void s(n.getAttribute("data-scheme-node"),e.shiftKey||e.ctrlKey||e.metaKey);o&&e.isPrimary&&(p.current={x:e.clientX,y:e.clientY});let r=a?.(e)??!1;if(r&&"touch"!==e.pointerType||!r&&(s(null),t.closest("button, a, input, textarea, select")))return}G(e)}}},onPointerMove:e=>{if("touch"===e.pointerType&&$.current.has(e.pointerId)){$.current.set(e.pointerId,X(e));let t=T.current;if(t&&$.current.size>=2){let[e,n]=[...$.current.values()],r=iD(e,n),i=(e.x+n.x)/2,s=(e.y+n.y)/2,l=t.d>0?r/t.d:1;q(e=>{let n=Math.min(1.6,Math.max(.12,e.z*l)),r=n/e.z;return L({z:n,x:i-(t.cx-e.x)*r,y:s-(t.cy-e.y)*r})}),T.current={d:r,cx:i,cy:s};return}}let t=A.current;if(!t)return;let n=e.clientX-t.sx,r=e.clientY-t.sy;q(e=>L({...e,x:t.cx+n,y:t.cy+r}))},onDoubleClick:e=>{let n=e.target;if(n.closest("[data-scheme-ui]"))return;let r=n.closest("[data-scheme-node]");if(!r)return void K();if("hand"!==x&&!w)return;let i=t.byPath.get(r.getAttribute("data-scheme-node")??"");i&&J(i,.9)},onClick:e=>{if(!i&&!o)return;let n=p.current;if(p.current=null,!n||Math.hypot(e.clientX-n.x,e.clientY-n.y)>9||e.target.closest("[data-scheme-ui]"))return;let r=u.current?.getBoundingClientRect();if(!r)return;let s=(e.clientX-r.left-f.x)/f.z,l=(e.clientY-r.top-f.y)/f.z;if(o?.(s,l)||!i)return;let a=((e,n)=>{let r=t=>e>=t.x&&e<=t.x+t.w&&n>=t.y&&n<=t.y+t.h;if(c){for(let[e,t]of c)if(r(t))return e}for(let e of t.nodes)if(r(e))return e.file.path;for(let e of t.drafts)if(r(e))return e.key;for(let e of t.stacks)if(r(e))return function(e,t){let n=Math.floor((t-e.y-8)/58);return e.items[Math.max(0,Math.min(n,e.items.length-1))]?.file??null}(e,n)?.path??null;for(let e of t.decks)if(r(e))return e.key;return null})(s,l);a&&i(a)},zoomCenter:U,zoomTo:H,fit:K,fitRect:Y,jump:Z}}({project:e,layout:E,mapMode:j,focus:c,onNodePick:m,setSelected:I,onBackgroundDown:j?void 0:e=>(el.current=!1,eo.current(e)),onWorldTap:j?void 0:ea,taskRects:em,onPlaceTask:j?void 0:eh}),{marquee:eF,onBackgroundDown:eU}=function({viewportRef:e,cam:t,layout:n,enabled:r,session:i,onCommit:s}){let[a,o]=(0,l.useState)(null),c=(0,l.useRef)(null),d=(0,l.useRef)(t),u=(0,l.useRef)(n),p=(0,l.useRef)(s);(0,l.useEffect)(()=>{d.current=t,u.current=n,p.current=s});let f=(0,l.useCallback)(t=>{let n=e.current?.getBoundingClientRect();return n?{x:t.clientX-n.left,y:t.clientY-n.top}:{x:t.clientX,y:t.clientY}},[e]);return(0,l.useEffect)(()=>{let e=e=>{var t,n,r,i,s;let l=c.current;if(!l)return;let a=f(e);if(!l.active&&4>Math.hypot(a.x-l.sx,a.y-l.sy))return;l.active=!0;let p=(t=l.sx,n=l.sy,{x:Math.min(t,r=a.x),y:Math.min(n,i=a.y),w:Math.abs(r-t),h:Math.abs(i-n)}),m=rZ(u.current.nodes,(s=d.current,{x:(p.x-s.x)/s.z,y:(p.y-s.y)/s.z,w:p.w/s.z,h:p.h/s.z}));o({rect:p,candidates:m,additive:l.additive})},t=e=>{let t=c.current;c.current=null,t?.active&&o(t=>(e&&t&&p.current(t.candidates,t.additive),null))},n=()=>t(!0),r=()=>t(!1),i=e=>{"Escape"===e.key&&c.current?.active&&t(!1)};return window.addEventListener("pointermove",e),window.addEventListener("pointerup",n),window.addEventListener("pointercancel",r),window.addEventListener("keydown",i),()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",n),window.removeEventListener("pointercancel",r),window.removeEventListener("keydown",i)}},[f]),{marquee:a,onBackgroundDown:(0,l.useCallback)(e=>{if(!r)return!1;if("touch"===e.pointerType)return i;if(!e.isPrimary||0!==e.button)return!1;let t=f(e);return c.current={sx:t.x,sy:t.y,additive:e.shiftKey,active:!1},!0},[r,i,f])}}({viewportRef:ew,cam:eb,layout:E,enabled:!j,session:D,onCommit:(0,l.useCallback)((e,t)=>{el.current=!0,S(null),A(n=>{if(!t)return e.length?new Set(e):iM;if(!e.length)return n;let r=new Set(n);for(let t of e)r.add(t);return r})},[])});(0,l.useEffect)(()=>{eo.current=eU},[eU]);let eH=(0,l.useMemo)(()=>E.nodes.filter(e=>C.has(e.file.path)),[E,C]),eB=(0,l.useMemo)(()=>(function(e,t){let n=1/0,r=1/0,i=-1/0,s=-1/0,l=!1;for(let a of e)t.has(a.file.path)&&(l=!0,n=Math.min(n,a.x),r=Math.min(r,a.y),i=Math.max(i,a.x+a.w),s=Math.max(s,a.y+a.h));return l?{x:n,y:r,w:i-n,h:s-r}:null})(E.nodes,C),[E,C]),eW=(0,l.useRef)(eB);(0,l.useEffect)(()=>{eW.current=eB},[eB]);let eK=(0,l.useCallback)(()=>{eW.current&&eO(eW.current)},[eO]),eY=(0,l.useRef)(eb);(0,l.useEffect)(()=>{eY.current=eb},[eb]);let eJ=(0,l.useRef)(i),eQ=(0,l.useRef)(C),eX=(0,l.useRef)(E);(0,l.useEffect)(()=>{eJ.current=i,eQ.current=C,eX.current=E});let eG=(0,l.useCallback)(async(e,t)=>{let n=await eP(e,t);if("error"in n)return void ru("err",n.error);let r=rp(n,eJ.current);ru(r.kind,r.text)},[]),eZ=(0,l.useCallback)((e,t)=>void eG(e,[t]),[eG]),e0=(0,l.useMemo)(()=>({patch:async(e,t)=>{let n=await eM(e,t);return n&&ru("err",n),n},remove:e=>{ed(t=>t.some(t=>t.id===e)?t.filter(t=>t.id!==e):t),eR(e).then(e=>{e&&ru("err",e)})},send:(e,t)=>void eG(e.id,t),spawn:async(e,t,n)=>{let r=await eI(e.id,{engine:t,cwd:n});return"error"in r?r.error:(ru("ok",x(p(),"tasks.spawnOk",{target:r.target})),null)},center:e=>ej(e,.75),selectionPaths:()=>{let e=new Set(eX.current.nodes.map(e=>e.file.path)),t=[...eQ.current].filter(t=>e.has(t));if(t.length)return t;let n=P.current;return n&&e.has(n)?[n]:[]}}),[eG,ej]),e1=(0,l.useCallback)(t=>{eu&&eT({project:e,text:t,pos:eu}).then(e=>{"error"in e?ru("err",e.error):(ed(t=>[...t,e.task]),ep(null))})},[e,eu]),e5=(0,l.useCallback)(()=>ep(null),[]),e2=24*eb.z;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{ref:ew,className:`relative min-h-0 flex-1 overflow-hidden ${eN?"cursor-grabbing select-none":ek?"cursor-crosshair":ev?"cursor-grab":""} ${ev?"touch-none":""}`,onPointerDown:eA,onPointerMove:e$,onDoubleClick:eE,onClick:eD,children:[(0,r.jsx)("div",{"aria-hidden":!0,className:"pointer-events-none absolute",style:{inset:-e2,backgroundImage:"radial-gradient(rgba(28,28,34,0.09) 1px, transparent 1px)",backgroundSize:`${e2}px ${e2}px`,transform:`translate(${(eb.x%e2+e2)%e2}px, ${(eb.y%e2+e2)%e2}px)`,willChange:"transform"}}),(0,r.jsxs)("div",{className:`absolute left-0 top-0 ${eN?"scheme-panning":""}`,style:{width:E.width,height:E.height,transform:`translate(${eb.x}px, ${eb.y}px) scale(${eb.z})`,transformOrigin:"0 0",transition:eS?`transform .45s ${ir}`:void 0,willChange:"transform","--inv-z":String(1/eb.z),"--label-o":eb.z<.45?"1":"0"},children:[(0,r.jsx)(is,{edges:E.edges,width:E.width,height:E.height}),(0,r.jsx)(il,{loops:E.loops,width:E.width,height:E.height}),(0,r.jsx)(iw,{layout:E,project:e,files:i,interactive:!ev&&!D,lite:j,selected:N,multi:C,session:D,focus:W,attentionPaths:u??null,flowsByImpl:_,deckFocus:U,onSelect:V,onClose:Z,onFocusRound:B,onDraftClose:ee,onDraftSpawned:et,onHandoff:k?en:void 0,onExpand:er}),(0,r.jsx)(ik,{edges:ex,width:E.width,height:E.height,onRetry:eZ}),(0,r.jsx)(iT,{tasks:ef,files:i,interactive:!ev&&!D,lite:j,camRef:eY,handlers:e0,pending:eu,onCreate:e1,onCreateCancel:e5}),D&&eB?(0,r.jsx)("div",{"aria-hidden":!0,className:"pointer-events-none absolute z-[6] rounded-[14px] border-2 border-dashed border-accent/60",style:{left:eB.x-14,top:eB.y-14,width:eB.w+28,height:eB.h+28},children:(0,r.jsx)("span",{className:"absolute -top-3 left-4 rounded-full border border-accent/50 bg-panel px-2 py-0.5 font-bold text-accent",style:{fontSize:"calc(11px * min(var(--inv-z, 1), 2.6))"},children:y("bulk.selectedCount",{count:C.size})})}):null]},e),eF?(0,r.jsxs)("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 z-30",children:[(0,r.jsx)("div",{className:"absolute rounded-[4px] border border-accent/70 bg-accent/10",style:{left:eF.rect.x,top:eF.rect.y,width:eF.rect.w,height:eF.rect.h}}),eF.candidates.map(e=>{let t=E.byPath.get(e);return t?(0,r.jsx)("div",{className:"absolute rounded-[10px] border-2 border-accent/70",style:{left:t.x*eb.z+eb.x,top:t.y*eb.z+eb.y,width:t.w*eb.z,height:t.h*eb.z}},e):null})]}):null,(0,r.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:[j?null:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(iR,{active:ev&&!ek,title:y("scheme.handTool"),onClick:()=>eC("hand"),children:(0,r.jsx)(rM.A,{className:"h-4 w-4","aria-hidden":!0})}),(0,r.jsx)(iR,{active:!ev&&!D&&!ek,title:y("scheme.selectTool"),onClick:()=>eC("select"),children:(0,r.jsx)(rR.A,{className:"h-4 w-4","aria-hidden":!0})}),(0,r.jsx)(iR,{active:D,title:y("scheme.lassoTool"),onClick:()=>{D?M():(eC("select"),T(!0))},children:(0,r.jsx)(rP.A,{className:"h-4 w-4","aria-hidden":!0})}),(0,r.jsx)(iR,{active:ek,title:y("tasks.tool"),onClick:()=>ey(!ek),children:(0,r.jsx)(rI.A,{className:"h-4 w-4","aria-hidden":!0})}),(0,r.jsx)("div",{className:"mx-0.5 h-5 w-px bg-line","aria-hidden":!0})]}),(0,r.jsx)(iR,{title:y("scheme.zoomOut"),onClick:()=>e_(.8),children:(0,r.jsx)(ns.A,{className:"h-4 w-4","aria-hidden":!0})}),(0,r.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:y("scheme.zoom100"),onClick:()=>eL(1),children:[Math.round(100*eb.z),"%"]}),(0,r.jsx)(iR,{title:y("scheme.zoomIn"),onClick:()=>e_(1.25),children:(0,r.jsx)(nl.A,{className:"h-4 w-4","aria-hidden":!0})}),(0,r.jsx)(iR,{title:y("scheme.fit"),onClick:ez,children:(0,r.jsx)(eV.A,{className:"h-4 w-4","aria-hidden":!0})})]}),D?(0,r.jsx)(rG,{project:e,nodes:eH,flowsByImpl:_,onRemove:Z,onFit:eK,onExit:M}):null,(0,r.jsx)(r0,{layout:E,tasks:ef,cam:eb,vp:eg,onJump:eq})]}),q?(0,r.jsx)("div",{className:"fixed inset-0 z-40 flex flex-col bg-bg p-3",role:"dialog","aria-modal":"true","aria-label":b(q.file.title,90),children:(0,r.jsx)(n0,{file:q.file,files:i,tasks:q.tasks,onSelect:ei,isRoot:q.isRoot,expanded:!0,onToggleExpand:()=>z(null)})}):null]})}let iI={waiting:5,stalled:4,live:3,returned:2,done:1};function i_({project:e,groups:t,manual:n,files:i,flows:a,tasks:o,drafts:c,focus:d,onSelect:u,onClose:p,onDraftClose:f,onDraftSpawned:m,onHandoff:x}){let{t:b}=h(),[g,w]=(0,l.useState)(null),[v,k]=(0,l.useState)(!1),[y,j]=(0,l.useState)(null),N=(0,l.useRef)(null),S=(0,l.useRef)(null),C=(0,l.useMemo)(()=>rD(t,n,i,a,c),[t,n,i,a,c]),A=(0,l.useMemo)(()=>[...C.nodes.map(e=>({key:e.file.path,file:e.file,isRoot:e.isRoot,kind:"node"})),...C.decks.map(e=>({key:e.key,file:null,isRoot:!1,kind:"deck"})),...C.drafts.map(e=>({key:e.key,file:null,isRoot:!0,kind:"draft"}))],[C]),$=(0,l.useMemo)(()=>new Map(A.map(e=>[e.key,e])),[A]);(0,l.useEffect)(()=>{w(sessionStorage.getItem("llvFocus:"+e)),k(!1)},[e]),(0,l.useEffect)(()=>{d&&(w(d),k(!1))},[d]);let T=(0,l.useMemo)(()=>{if(g&&$.has(g))return g;let e=null,t=-1;for(let n of A){if(!n.file)continue;let r=1e12*iI[ex(n.file)]+n.file.mtime;r>t&&(t=r,e=n)}return(e??A[0])?.key??null},[g,$,A]);(0,l.useEffect)(()=>{g&&$.has(g)?sessionStorage.setItem("llvFocus:"+e,g):!g&&T&&sessionStorage.setItem("llvFocus:"+e,T)},[g,$,T,e]),(0,l.useEffect)(()=>{S.current?.scrollIntoView({block:"nearest",inline:"nearest"})},[T]);let E=(0,l.useMemo)(()=>C.nodes.find(e=>e.file.path===T)??null,[C,T]),D=(0,l.useMemo)(()=>C.decks.find(e=>e.key===T)??null,[C,T]),M=(0,l.useMemo)(()=>C.drafts.find(e=>e.key===T)??null,[C,T]),R=(0,l.useCallback)(e=>{if(!A.length)return;let t=A.findIndex(e=>e.key===T),n=A[Math.min(A.length-1,Math.max(0,(-1===t?0:t)+e))];n&&n.key!==T&&w(n.key)},[A,T]),P=(0,l.useCallback)(e=>{if(k(!1),e.startsWith("task::"))return void j({taskId:e.slice(6)});if($.has(e))return void w(e);let t=i.find(t=>t.path===e);t&&u(t)},[$,i,u]);return(0,r.jsxs)("div",{className:"relative flex min-h-0 min-w-0 flex-1 flex-col",children:[A.length>1?(0,r.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:A.map(e=>(0,r.jsx)(iL,{entry:e,active:e.key===T,chipRef:e.key===T?S:void 0,onClick:()=>w(e.key)},e.key))}):null,(0,r.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:[E?(0,r.jsxs)("div",{className:"relative flex min-h-0 flex-1",children:[(0,r.jsx)(n0,{file:E.file,tasks:E.tasks,files:i,onSelect:u,isRoot:E.isRoot,onClose:()=>p(E.file.path),dragHandle:{onTouchStart:e=>{let t=e.touches[0];t&&(N.current={x:t.clientX,y:t.clientY})},onTouchEnd:e=>{let t=N.current;N.current=null;let n=e.changedTouches[0];if(!t||!n)return;let r=n.clientX-t.x,i=n.clientY-t.y;56>Math.abs(r)||Math.abs(r)<2*Math.abs(i)||R(r<0?1:-1)}}}),x&&rT(E.file)?(0,r.jsx)(rE,{file:E.file,onHandoff:()=>x(E.file)}):null]},E.file.path):D?(0,r.jsx)("div",{className:"relative min-h-0 flex-1",children:(0,r.jsx)(rA,{flow:D.flow,rounds:D.rounds,files:i,onSelect:u,focusRound:null})},D.key):M?eL(M.id)?(0,r.jsx)(re,{draftId:M.id,project:e,onClose:()=>f(M.id),onLaunched:()=>f(M.id)},M.key):(0,r.jsx)(n6,{draftId:M.id,project:e,files:i,onClose:()=>f(M.id),onSpawned:e=>m(M.id,e)},M.key):(0,r.jsx)("div",{className:"flex flex-1 items-center justify-center text-center text-[13px] text-dim",children:b("mobile.noConvos")}),(0,r.jsx)(iz,{layout:C,tasks:o,current:T,onOpen:()=>k(!0)}),(0,r.jsxs)("button",{type:"button",className:"absolute bottom-[168px] right-4 z-30 inline-flex h-9 items-center gap-1 rounded-full border border-line bg-panel/95 px-2.5 text-[11px] font-bold text-ink shadow-card focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":b("tasks.panelToggleAria"),onClick:()=>j("list"),children:[(0,r.jsx)(eJ.A,{className:"h-4 w-4 text-accent","aria-hidden":!0}),o.filter(e=>"done"!==e.status).length||null]})]}),v?(0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex flex-col bg-bg pb-[env(safe-area-inset-bottom)]",children:[(0,r.jsxs)("div",{className:"flex h-10 shrink-0 items-center gap-2 border-b border-line bg-panel px-3",children:[(0,r.jsx)("span",{className:"shrink-0 text-[13px] font-bold",children:b("mobile.map")}),(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] text-dim",children:e}),(0,r.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":b("mobile.closeMap"),onClick:()=>k(!1),children:(0,r.jsx)(s.A,{className:"h-4 w-4","aria-hidden":!0})})]}),(0,r.jsx)(iP,{project:e,groups:t,manual:n,files:i,flows:a,tasks:o,drafts:c,focus:null,ring:T,onSelect:u,onClose:p,onDraftClose:f,onDraftSpawned:m,onNodePick:P}),(0,r.jsx)("div",{className:"shrink-0 border-t border-line bg-panel px-3 py-1.5 text-center text-[11px] text-dim",children:b("mobile.tapNode")})]}):null,y?(0,r.jsx)(rv,{project:e,tasks:o,files:i,initialView:y,onClose:()=>j(null)}):null]})}function iL({entry:e,active:t,chipRef:n,onClick:i}){let{t:s}=h();if(!e.file){let l="deck"===e.kind;return(0,r.jsxs)("button",{ref:n,type:"button",className:`flex h-7 shrink-0 items-center gap-1 rounded-full border px-2.5 text-[11px] font-semibold ${t?"border-accent/60 bg-accent/10 text-ink":"border-dashed border-line bg-bg text-dim"}`,onClick:i,children:[(0,r.jsx)("span",{className:"text-[13px] leading-none text-accent",children:l?"R":"+"})," ",s(l?"scheme.flow":"mobile.agent")]})}let l=e.file,a=ex(l),o="waiting"===a||"stalled"===a,c=ec(l),d=b(l.title,60);return(0,r.jsxs)("button",{ref:n,type:"button",className:`flex h-7 shrink-0 items-center gap-1.5 rounded-full border px-2.5 text-[11px] font-semibold ${t?"border-accent/60 bg-accent/10 text-ink":o?"border-[#e0ae45]/60 bg-[#fff7e6] text-[#8a5a00]":"border-line bg-bg text-dim"}`,title:d,onClick:i,children:[(0,r.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${G(l.activity)}`}),e.isRoot?null:(0,r.jsx)("span",{"aria-hidden":!0,children:"⤷"}),t?(0,r.jsx)("span",{className:"max-w-[52vw] truncate",children:d}):(0,r.jsxs)("span",{children:[o?"⏸ ":"",c.label]})]})}function iz({layout:e,tasks:t,current:n,onOpen:i}){let{t:s}=h(),l=Math.min(96/e.width,64/e.height),a=(96-e.width*l)/2,o=(64-e.height*l)/2;return(0,r.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":s("mobile.openMap"),onClick:i,children:(0,r.jsx)("svg",{width:96,height:64,"aria-hidden":!0,children:(0,r.jsxs)("g",{transform:`translate(${a} ${o}) scale(${l})`,children:[e.stacks.map(e=>(0,r.jsx)("rect",{x:e.x,y:e.y,width:e.w,height:e.h,rx:24,fill:"#c9c9d1",opacity:.45},e.key)),e.drafts.map(e=>(0,r.jsx)("rect",{x:e.x,y:e.y,width:e.w,height:e.h,rx:24,fill:"#9a9aa4",opacity:.3,stroke:e.key===n?"#5a51e0":void 0,strokeWidth:e.key===n?5/l:void 0},e.key)),e.decks.map(e=>(0,r.jsx)("rect",{x:e.x,y:e.y,width:e.w,height:e.h,rx:24,fill:"#5a51e0",opacity:.35,stroke:e.key===n?"#5a51e0":void 0,strokeWidth:e.key===n?5/l:void 0},e.key)),e.nodes.map(e=>(0,r.jsx)("rect",{x:e.x,y:e.y,width:e.w,height:e.h,rx:24,fill:ea(e.file),opacity:"live"===e.file.activity?.85:.35,stroke:e.file.path===n?"#5a51e0":void 0,strokeWidth:e.file.path===n?5/l:void 0},e.file.path)),t.map(e=>(0,r.jsx)("circle",{cx:e.pos.x+130,cy:e.pos.y+rB(e)/2,r:3/l,fill:ri[e.status].color,opacity:"done"===e.status?.5:.95},e.id))]})})})}let iO="llvArchived";function iq(e){try{window.localStorage.setItem(iO,JSON.stringify([...e]))}catch{}}function iF({data:e,onOpen:t}){let{t:n}=h(),i=e.waiting.length,s=(0,l.useRef)(i),[a,o]=(0,l.useState)(!1);return(0,l.useEffect)(()=>{if(i>s.current){o(!0);let e=window.setTimeout(()=>o(!1),900);return s.current=i,()=>window.clearTimeout(e)}s.current=i},[i]),(0,r.jsxs)("div",{className:"group absolute bottom-3 right-3 z-20",children:[e.livePreview.length?(0,r.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:e.livePreview.map(e=>(0,r.jsxs)("div",{className:"flex min-w-0 gap-1.5 py-0.5 text-[10.5px]",children:[(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate font-semibold",children:e.title}),(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate text-dim",children:e.statusLine||n("status.working")})]},e.file.path))}):null,(0,r.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 ${a?"scale-110 border-[#e0ae45]/70":""} motion-reduce:transition-none`,"aria-label":n("corner.openSwitchboard"),onClick:t,children:[(0,r.jsx)("span",{className:`h-2 w-2 rounded-full ${e.working.length?"animate-pulse bg-ok":"bg-dim"}`}),(0,r.jsx)("span",{children:e.working.length}),(0,r.jsx)("span",{className:i?"text-[#b8860b]":"text-dim",children:n("corner.waitingCount",{count:i})})]})]})}function iU({file:e,title:t,project:n,currentProject:i,descendants:l,statusLine:a,size:o,tone:c,onOpen:d,onArchive:u}){let{t:p}=h(),f=ec(e),m="large"===o;return(0,r.jsxs)("article",{className:`group relative flex ${m?"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"===c?"border-ok/40 bg-[#f3fbf5] shadow-[0_0_0_3px_rgba(26,138,62,0.12)]":"stalled"===c?"border-err/35 bg-[#fff5f5]":"waiting"===c?"border-[#e0ae45]/45 bg-[#fff9ed]":"border-line bg-panel"}`,role:"button",tabIndex:0,"aria-label":p("switchCard.openColumn",{title:b(t,80)}),onClick:()=>d(e),onKeyDown:t=>{"Enter"===t.key&&d(e)},children:["live"===e.activity?null:(0,r.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":p("switchCard.remove"),onClick:t=>{t.stopPropagation(),u(e)},onKeyDown:e=>e.stopPropagation(),children:(0,r.jsx)(s.A,{className:"h-3 w-3","aria-hidden":!0})}),(0,r.jsxs)("div",{className:"relative flex min-w-0 items-center gap-1.5",children:[(0,r.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${G(e.activity)}`}),e.model?(0,r.jsx)("span",{className:"min-w-0 truncate rounded-full px-1.5 py-0.5 font-mono text-[9px] font-semibold",style:{backgroundColor:es(e).soft,color:es(e).color},title:[f.label,el(e)].filter(Boolean).join(" \xb7 "),children:e.model}):(0,r.jsx)("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 text-[9.5px] font-bold",style:f.style,children:f.label}),(0,r.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 ${n===i?"text-dim":"text-ink"}`,title:n,children:n})]}),(0,r.jsx)("div",{className:`relative mt-2 min-w-0 ${m?"text-[14px]":"text-[12.5px]"} font-bold leading-snug`,title:t,children:(0,r.jsx)("span",{className:"line-clamp-2",children:t})}),(0,r.jsxs)("div",{className:"relative mt-auto flex min-w-0 items-center gap-2 text-[10.5px] font-semibold text-dim",children:[(0,r.jsx)("span",{className:"shrink-0",children:Q(e.mtime)}),e.ctx?(0,r.jsx)(nJ,{ctx:e.ctx}):null,l?(0,r.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-0.5",children:[(0,r.jsx)(eX.A,{className:"h-3 w-3","aria-hidden":!0})," ",l]}):null]}),a?(0,r.jsx)("div",{className:`relative mt-1 min-w-0 truncate ${m?"text-[11.5px]":"text-[10.5px]"} font-semibold text-ink/75`,children:a}):null,e.pid&&"running"===e.proc?(0,r.jsx)("div",{className:"relative mt-2",onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:(0,r.jsx)(nL,{file:e,compact:!0})}):null]})}function iH({title:e,items:t,size:n,currentProject:i,onOpenFile:s,onArchive:l}){return t.length?(0,r.jsxs)("section",{className:"shrink-0",children:[(0,r.jsxs)("div",{className:"mb-2 flex items-baseline gap-2",children:[(0,r.jsx)("h2",{className:"text-[13px] font-bold",children:e}),(0,r.jsx)("span",{className:"text-[11px] font-semibold text-dim",children:t.length})]}),(0,r.jsx)(tU,{className:"flex flex-wrap gap-2.5",enter:"fade",children:t.map(e=>(0,r.jsx)("div",{"data-flip-key":e.file.path,children:(0,r.jsx)(iU,{file:e.file,title:e.title,project:e.project,currentProject:i,descendants:e.descendants,statusLine:e.statusLine,size:n,tone:"working"===e.kind?"working":"waiting"===e.kind&&"stalled"===e.file.activity?"stalled":"waiting"===e.kind?"waiting":"quiet",onOpen:s,onArchive:l})},e.file.path))})]}):null}function iB({files:e,flows:t,project:n,onOpenFile:i}){let{t:a}=h(),[o,c]=(0,l.useState)(!1),[d,u]=(0,l.useState)(""),[p,f]=(0,l.useState)(!1),[m,x]=(0,l.useState)(!1),[g,w]=(0,l.useState)(0),v=(0,l.useRef)(null),k=function(e,t){let[n,r]=(0,l.useState)([]),[i,s]=(0,l.useState)(!1);return(0,l.useEffect)(()=>{if(!t||!e)return;let n=!0;s(!0);let i=async()=>{try{let t=await fetch(`/api/timeline?project=${encodeURIComponent(e)}`),i=await t.json();n&&Array.isArray(i.events)&&r(i.events)}catch{}finally{n&&s(!1)}};i();let l=setInterval(i,7e3);return()=>{n=!1,clearInterval(l)}},[e,t]),{events:n,loading:i}}(n,o),{archivedPaths:y,archive:j,unarchive:N}=function(e){let[t,n]=(0,l.useState)(()=>new Set),r=(0,l.useRef)(t);return(0,l.useEffect)(()=>{let e=function(){try{let e=window.localStorage.getItem(iO),t=e?JSON.parse(e):[];return new Set(Array.isArray(t)?t.filter(e=>"string"==typeof e):[])}catch{return new Set}}();r.current=e,n(e)},[]),(0,l.useEffect)(()=>{let t=r.current;if(!t.size)return;let i=new Set(t);for(let t of e)"live"===t.activity&&i.delete(t.path);i.size!==t.size&&(r.current=i,n(i),iq(i))},[e]),{archivedPaths:t,archive:(0,l.useCallback)(e=>{n(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),r.current=n,iq(n),n})},[]),unarchive:(0,l.useCallback)(e=>{n(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),r.current=n,iq(n),n})},[])}}(e),C=ep(e,k.events,d,g,y,t),A=ep(e,[],"",g,y,t),$=(0,l.useMemo)(()=>e.filter(e=>y.has(e.path)).map(e=>({file:e,title:b(e.title),project:S(e)})).sort((e,t)=>t.file.mtime-e.file.mtime),[e,y]);(0,l.useEffect)(()=>{let e=()=>w(Date.now()/1e3);e();let t=window.setInterval(e,3e4);return()=>window.clearInterval(t)},[]),(0,l.useEffect)(()=>{if(!o)return;let e=e=>{"Escape"===e.key&&c(!1)};return window.addEventListener("keydown",e),window.setTimeout(()=>v.current?.focus(),0),()=>window.removeEventListener("keydown",e)},[o]);let T=e=>{i(e),c(!1)},E=e=>j(e.path);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(iF,{data:A,onOpen:()=>c(!0)}),o?(0,r.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-ink/28 p-[2.5vh]",onMouseDown:()=>c(!1),children:(0,r.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":a("switch.aria"),onMouseDown:e=>e.stopPropagation(),children:[(0,r.jsxs)("header",{className:"flex h-14 shrink-0 items-center gap-3 border-b border-line bg-panel px-4",children:[(0,r.jsx)("div",{className:"text-[15px] font-bold",children:a("switch.title")}),(0,r.jsx)("input",{ref:v,value:d,onChange:e=>u(e.target.value),placeholder:a("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"}),k.loading?(0,r.jsx)("span",{className:"text-[11px] font-semibold text-dim",children:a("switch.updating")}):null,(0,r.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":a("switch.close"),onClick:()=>c(!1),children:(0,r.jsx)(s.A,{className:"h-4 w-4","aria-hidden":!0})})]}),(0,r.jsxs)("div",{className:"min-h-0 flex-1 space-y-5 overflow-y-auto px-4 py-4",children:[(0,r.jsx)(iH,{title:a("switch.waiting"),items:C.waiting,size:"large",currentProject:n,onOpenFile:T,onArchive:E}),(0,r.jsx)(iH,{title:a("switch.working"),items:C.working,size:"large",currentProject:n,onOpenFile:T,onArchive:E}),(0,r.jsx)(iH,{title:a("switch.recent"),items:C.recent,size:"small",currentProject:n,onOpenFile:T,onArchive:E}),(0,r.jsxs)("section",{className:"shrink-0",children:[(0,r.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":p,onClick:()=>f(e=>!e),children:[(0,r.jsx)("span",{children:a("switch.older")}),(0,r.jsx)("span",{className:"text-dim",children:C.older.length})]}),p?(0,r.jsx)("div",{className:"mt-2",children:(0,r.jsx)(iH,{title:"",items:C.older,size:"small",currentProject:n,onOpenFile:T,onArchive:E})}):null]}),C.waiting.length||C.working.length||C.recent.length||C.older.length?null:(0,r.jsx)("div",{className:"pt-[18vh] text-center text-[13px] font-semibold text-dim",children:a("common.nothingFound")}),$.length?(0,r.jsxs)("section",{className:"shrink-0",children:[(0,r.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":m,onClick:()=>x(e=>!e),children:[(0,r.jsx)("span",{children:a("switch.hidden",{count:$.length})}),(0,r.jsx)("span",{children:m?a("switch.hide"):a("common.show")})]}),m?(0,r.jsx)("div",{className:"mt-2 space-y-1",children:$.map(e=>(0,r.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,r.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e.title}),(0,r.jsx)("span",{className:"shrink-0 truncate text-[10.5px]",children:e.project}),(0,r.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:()=>N(e.file.path),children:a("switch.restore")})]},e.file.path))}):null]}):null]})]})}):null]})}function iW(){location.hash="#p="+encodeURIComponent(g)}function iK({files:e,onOpen:t}){let{t:n}=h();return(0,r.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto px-4 py-5",children:(0,r.jsxs)("div",{className:"mx-auto w-full max-w-[760px]",children:[(0,r.jsx)("div",{className:"text-[13.5px] font-semibold text-dim",children:n("trash.title")}),(0,r.jsx)("div",{className:"mb-3 mt-0.5 text-[12px] text-dim",children:n("trash.hint")}),(0,r.jsx)("div",{className:"space-y-1.5",children:e.map(e=>(0,r.jsx)(iY,{file:e,onOpen:t},e.path))})]})})}function iY({file:e,onOpen:t}){let{t:n}=h(),[i,s]=(0,l.useState)(!1),a=ec(e);return i?(0,r.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,r.jsx)(td.A,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),(0,r.jsx)("span",{className:"min-w-0 truncate",children:b(e.title,80)}),(0,r.jsx)("span",{className:"shrink-0",children:n("trash.deletedFromDisk")})]}):(0,r.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,r.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":n("trash.open",{title:b(e.title,60)}),onClick:()=>t(e),children:[(0,r.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${G(e.activity)}`}),(0,r.jsx)("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 text-[9.5px] font-bold",style:a.style,children:a.label}),(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12.5px] font-semibold",title:e.path,children:b(e.title,90)}),(0,r.jsx)("span",{className:"shrink-0 text-[10.5px] font-semibold text-dim",children:Q(e.mtime)}),(0,r.jsxs)("span",{className:"shrink-0 text-[10.5px] text-dim",children:[(e.size/1024).toFixed(0)," ",n("common.kb")]})]}),(0,r.jsx)(tF,{file:e,onDeleted:()=>s(!0)})]})}function iJ({files:e,onArchive:t}){let{t:n}=h();return!e.length||e.some(e=>"running"===e.proc||"live"===e.activity)?null:(0,r.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:()=>{t(),iW()},children:[(0,r.jsx)(eZ.A,{className:"h-3 w-3","aria-hidden":!0})," ",n("trash.toArchive")]})}function iQ({files:e}){let{t}=h(),[n,i]=(0,l.useState)(!1),[s,a]=(0,l.useState)(!1),[o,c]=(0,l.useState)("");if((0,l.useEffect)(()=>{if(!n)return;let e=window.setTimeout(()=>i(!1),6e3);return()=>window.clearTimeout(e)},[n]),!e.length||e.some(e=>"running"===e.proc||"live"===e.activity))return null;let d=async()=>{a(!0),c("");let n=0;for(let t of e)try{let e=await fetch(`/api/log?path=${encodeURIComponent(t.path)}`,{method:"DELETE"}),r=await e.json();e.ok&&r.ok||(n+=1)}catch{n+=1}(a(!1),i(!1),n)?c(t("trash.notDeleted",{failed:n,total:e.length})):iW()};return n?(0,r.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,r.jsx)("span",{className:"px-0.5 font-semibold text-err",children:t("trash.confirmDelete",{count:e.length})}),(0,r.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:s,onClick:d,children:s?t("trash.deleting"):t("trash.confirmYes")}),(0,r.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:()=>i(!1),children:t("common.cancel")})]}):(0,r.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1.5",children:[(0,r.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":t("trash.deleteProject"),title:t("trash.deleteProject"),onClick:()=>i(!0),children:(0,r.jsx)(td.A,{className:"h-3 w-3","aria-hidden":!0})}),o?(0,r.jsx)("span",{className:"max-w-[180px] truncate text-[10.5px] font-semibold text-err",children:o}):null]})}var iX=n(4614),iG=n(8980);function iV(){let{t:e}=h(),[t,n]=(0,l.useState)(!0);return(0,l.useEffect)(()=>n(eb()),[]),(0,r.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:e(t?"sound.on":"sound.off"),"aria-label":e(t?"sound.mute":"sound.unmute"),"aria-pressed":t,onClick:()=>{let e=!t;n(e);try{localStorage.setItem(eh,e?"on":"off")}catch{}e&&ey("returned",0)},children:t?(0,r.jsx)(iX.A,{className:"h-3.5 w-3.5","aria-hidden":!0}):(0,r.jsx)(iG.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})}function iZ({items:e,onSelect:t}){let{t:n}=h(),[i,s]=(0,l.useState)(!1);return(0,r.jsxs)("div",{className:"shrink-0 border-t border-line bg-panel",children:[(0,r.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":i,onClick:()=>s(e=>!e),children:[(0,r.jsx)(e8.A,{className:`h-3.5 w-3.5 transition-transform ${i?"rotate-90":""}`,"aria-hidden":!0}),n("tree.quiet"),(0,r.jsx)("span",{className:"font-semibold normal-case tracking-normal",children:e.length})]}),i?(0,r.jsx)(tU,{className:"flex max-h-44 flex-wrap items-start gap-1.5 overflow-y-auto px-3 pb-2.5",children:e.map(e=>{let n=ec(e),i=b(e.cmdDesc||e.title,70);return(0,r.jsxs)("button",{"data-flip-key":e.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:b(e.title),onClick:()=>t(e),children:[(0,r.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${G(e.activity)}`}),(0,r.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px]",style:n.style,children:n.label}),(0,r.jsx)("span",{className:"truncate",children:i}),(0,r.jsx)("span",{className:"shrink-0 font-normal text-dim",children:Q(e.mtime)})]},e.path)})}):null]})}let i0=e=>`llvCols:${e}`,i1=e=>`llvDrafts:${e}`;function i5(e){try{let t=JSON.parse(localStorage.getItem(i0(e))??"{}");return{manual:t.manual??[],hidden:t.hidden??[]}}catch{return{manual:[],hidden:[]}}}function i2(e,t){let n=i5(e);n.manual.includes(t)||n.manual.push(t),n.hidden=n.hidden.filter(e=>e!==t),localStorage.setItem(i0(e),JSON.stringify(n))}function i3(e){location.hash="#p="+encodeURIComponent(e)}function i4({files:e,flows:t,workflows:n,tasks:i,project:s,openNonce:a,focusRequest:o,attentionPaths:c,archived:d,onArchive:u,onUnarchive:p,onMenu:f}){let{t:m}=h(),x=eB(),b=(0,l.useRef)(null),g=(0,l.useRef)(null),[w,y]=(0,l.useState)({manual:[],hidden:[]}),[j,N]=(0,l.useState)([]),[C,A]=(0,l.useState)(null),[E,M]=(0,l.useState)(!1),[R,P]=(0,l.useState)([]),I=(0,l.useRef)(w);(0,l.useEffect)(()=>{let e=i5(s);I.current=e,y(e),N(function(e){try{let t=JSON.parse(sessionStorage.getItem(i1(e))??"[]");return Array.isArray(t)?t.filter(e=>"string"==typeof e):[]}catch{return[]}}(s))},[s,a]),(0,l.useEffect)(()=>{M("1"===localStorage.getItem("llvTaskPanel"))},[]);let _=()=>{M(e=>(localStorage.setItem("llvTaskPanel",e?"0":"1"),!e))};(0,l.useEffect)(()=>()=>{b.current&&window.clearTimeout(b.current)},[]);let L=e=>{I.current=e,y(e),localStorage.setItem(i0(s),JSON.stringify(e))},z=(0,l.useMemo)(()=>{let n=q(t);return n.size?e.filter(e=>!n.has(e.path)):e},[e,t]),O=(0,l.useMemo)(()=>{let t;return t=new Set(e.filter(e=>e.project===s).map(e=>e.path)),n.filter(e=>"closed"!==e.state&&(!!(e.project===s||e.stageRuns.some(e=>e.agentPath&&t.has(e.agentPath)))||!!(e.fixerPath&&t.has(e.fixerPath))))},[n,s,e]),F=(0,l.useMemo)(()=>D(z,s),[z,s]),U=(0,l.useMemo)(()=>new Set(F.map(e=>e.key)),[F]),H=(0,l.useMemo)(()=>(function(e,t,n){let r=$(e),i=[];for(let s of e){if(S(s)!==t||!k(s)||n.has(s.path))continue;let e=T(s,r);if(!e.length)continue;let l=s.mtime,a=v(s);for(let t of e)l=Math.max(l,t.mtime),a=Math.min(a,v(t));i.push({root:s,branchCount:e.length,smt:l,band:a})}return i.sort((e,t)=>e.band-t.band||t.smt-e.smt)})(z,s,U),[z,s,U]),B=(0,l.useMemo)(()=>{let e;return e=$(z),z.filter(t=>!(S(t)!==s||t.parent||U.has(t.path)||e.get(t.path)?.length)&&"live"!==t.activity).sort((e,t)=>v(e)-v(t)||t.mtime-e.mtime)},[z,s,U]),W=(0,l.useMemo)(()=>new Set(F.flatMap(e=>e.columns.map(e=>e.file.path))),[F]),K=(0,l.useMemo)(()=>new Set(w.hidden),[w.hidden]),Y=(0,l.useMemo)(()=>i.filter(e=>e.project===s),[i,s]),J=(0,l.useMemo)(()=>{let e=new Map(z.map(e=>[e.path,e]));return w.manual.map(t=>e.get(t)).filter(e=>void 0!==e&&S(e)===s&&!W.has(e.path)&&!K.has(e.path))},[w.manual,z,s,W,K]),Q=(0,l.useMemo)(()=>{let e=new Map(z.map(e=>[e.path,e])),t=new Set(J.map(e=>e.path)),n=R.map(t=>e.get(t)).filter(e=>void 0!==e&&S(e)===s&&!t.has(e.path)&&(!W.has(e.path)||K.has(e.path)));return n.length?[...J,...n]:J},[R,z,s,W,K,J]),X=(0,l.useMemo)(()=>F.reduce((e,t)=>e+t.columns.reduce((e,t)=>e+ +("live"===t.file.activity)+t.tasks.filter(e=>"live"===e.activity).length,0),0),[F]),G=F.filter(e=>!e.orphanTask).length,V=e=>{A(e),b.current&&window.clearTimeout(b.current),b.current=window.setTimeout(()=>A(null),1800)};(0,l.useEffect)(()=>{P([])},[s]),(0,l.useEffect)(()=>{o&&(g.current=o.path,P(e=>e.includes(o.path)?e:[...e,o.path]))},[o]),(0,l.useEffect)(()=>{let e=g.current;e&&(g.current=null,V(e))}),(0,l.useEffect)(()=>{let e=sessionStorage.getItem("llvTaskFocus");e&&Y.some(t=>t.id===e)&&(sessionStorage.removeItem("llvTaskFocus"),V("task::"+e))});let Z=e=>{N(e),sessionStorage.setItem(i1(s),JSON.stringify(e))},ee=()=>"function"==typeof crypto.randomUUID?crypto.randomUUID():Date.now().toString(36)+Math.random().toString(36).slice(2,10),et=()=>{let e=ee();Z([...j,e]),g.current="draft::"+e},en=e=>{let t=j.find(t=>n3(t,"src")===e.path);if(t)return void V("draft::"+t);let n=ee();n4(n,"src",e.path),Z([...j,n]),g.current="draft::"+n},er=e=>{if(eL(e))for(let t of["template","dir","task","mode"])sessionStorage.removeItem(n8(e,t));else for(let t of["engine","cwd","text","boot","src"])sessionStorage.removeItem(n2(e,t));Z(j.filter(t=>t!==e))},ei=(e,t)=>{er(e),el(t)},es=e=>{fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"kill",path:e})}).catch(()=>{}),L({manual:w.manual.filter(t=>t!==e),hidden:W.has(e)?[...new Set([...w.hidden,e])]:w.hidden}),P(t=>t.includes(e)?t.filter(t=>t!==e):t)};(0,l.useEffect)(()=>{let e=I.current,t=[...W].filter(t=>!e.manual.includes(t)&&!e.hidden.includes(t));if(!t.length)return;let n={...e,manual:[...e.manual,...t].slice(-40)};I.current=n,y(n),localStorage.setItem(i0(s),JSON.stringify(n))},[W,s]);let el=e=>{let t=S(e);if(t!==s){i2(t,e.path),i3(t);return}if(W.has(e.path)&&!K.has(e.path)||J.some(t=>t.path===e.path))return void V(e.path);let n=w.hidden.filter(t=>t!==e.path);L({manual:W.has(e.path)?w.manual:[...new Set([...w.manual,e.path])],hidden:n}),g.current=e.path},ea=[];X?ea.push(`${m("dash.branchesLive",{count:X})} \xb7 ${m("dash.trees",{count:G})}`):G&&ea.push(m("dash.recentConvos",{count:G})),H.length&&ea.push(m("dash.quietTrees",{count:H.length}));let eo=F.map(e=>({...e,columns:e.columns.filter(e=>!K.has(e.file.path))})).filter(e=>e.columns.length),ec=eo.filter(e=>e.orphanTask).map(e=>e.columns[0].file),ed=eo.filter(e=>!e.orphanTask),eu=ed.length>0||Q.length>0||j.length>0||Y.length>0,ep=(0,l.useMemo)(()=>e.filter(e=>S(e)===s).sort((e,t)=>t.mtime-e.mtime),[e,s]);return(0,r.jsxs)("div",{className:"relative flex min-h-0 min-w-0 flex-1 flex-col",children:[(0,r.jsxs)("div",{className:"flex h-10 shrink-0 items-center gap-2.5 border-b border-line bg-panel px-4",children:[f?(0,r.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":m("dash.openProjects"),onClick:f,children:(0,r.jsx)(eW.A,{className:"h-4 w-4","aria-hidden":!0})}):null,(0,r.jsx)("h1",{className:"truncate text-[13.5px] font-bold",children:s}),(0,r.jsx)("span",{className:"truncate text-[11.5px] text-dim",children:ea.length?ea.join(" \xb7 "):m("common.nothingRunning")}),(0,r.jsx)(iV,{}),d?(0,r.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:()=>p(s),children:[(0,r.jsx)(e0.A,{className:"h-3 w-3","aria-hidden":!0})," ",m("dash.unarchive")]}):(0,r.jsx)(iJ,{files:ep,onArchive:()=>u(s)}),(0,r.jsx)(iQ,{files:ep}),x?(0,r.jsxs)("button",{type:"button",onClick:et,"aria-label":m("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,r.jsx)("span",{className:"text-[13px] leading-none text-accent",children:"+"})," ",m("dash.agent")]}):(0,r.jsxs)("button",{type:"button",onClick:_,"aria-pressed":E,"aria-label":m("tasks.panelToggleAria"),className:`ml-auto flex shrink-0 items-center gap-1 rounded-[8px] border px-2.5 py-1 text-[11.5px] font-bold shadow-card focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${E?"border-accent/45 bg-accent/10 text-accent":"border-line bg-panel text-ink hover:border-accent/45 hover:text-accent"}`,children:[(0,r.jsx)(eJ.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",m("tasks.panelTitle"),Y.filter(e=>"done"!==e.status).length?(0,r.jsx)("span",{className:"rounded-full bg-accent/10 px-1.5 text-[10px] font-bold text-accent",children:Y.filter(e=>"done"!==e.status).length}):null]}),(0,r.jsxs)("button",{type:"button",onClick:()=>{let e="wf-"+ee();Z([...j,e]),g.current="draft::"+e},"aria-label":m("dash.newWorkflow"),className:"flex shrink-0 items-center gap-1 rounded-[8px] border border-line bg-panel px-2.5 py-1 text-[11.5px] font-bold text-ink shadow-card hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[(0,r.jsx)("span",{className:"text-[13px] leading-none text-accent",children:"+"})," ",m("dash.workflow")]})]}),O.length?(0,r.jsx)("div",{className:"flex shrink-0 flex-col gap-1.5 border-b border-line bg-[#fbfbfd] px-3 py-1.5",children:O.map(e=>(0,r.jsx)(rr,{wf:e},e.id))}):null,ec.length?(0,r.jsx)("div",{className:"shrink-0 border-b border-line bg-[#fbfbfd]",children:ec.map(t=>(0,r.jsx)("div",{className:`border-l-4 ${"live"===t.activity?"border-l-ok bg-[#f2faf4]":"border-l-[#9a9aa4]"}`,children:(0,r.jsx)(n1,{file:t,files:e,onSelect:el})},t.path))}):null,x?eu?(0,r.jsx)(i_,{project:s,groups:ed,manual:Q,files:e,flows:t,tasks:Y,drafts:j,focus:C,onSelect:el,onClose:es,onDraftClose:er,onDraftSpawned:ei,onHandoff:en}):ep.length?(0,r.jsx)(iK,{files:ep,onOpen:el}):(0,r.jsx)("div",{className:"flex flex-1 items-center justify-center px-4 py-5 text-center",children:(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-[13.5px] font-semibold text-dim",children:m("dash.emptyTitle")}),(0,r.jsx)("div",{className:"mt-0.5 text-[12px] text-dim",children:m("dash.emptyHint")})]})}):(0,r.jsxs)("div",{className:"flex min-h-0 min-w-0 flex-1",children:[(0,r.jsxs)("div",{className:"relative flex min-h-0 min-w-0 flex-1 flex-col",children:[eu?(0,r.jsx)(iP,{project:s,groups:ed,manual:Q,files:e,flows:t,tasks:Y,drafts:j,focus:C,attentionPaths:c,onSelect:el,onClose:es,onDraftClose:er,onDraftSpawned:ei,onHandoff:en}):ep.length?(0,r.jsx)(iK,{files:ep,onOpen:el}):(0,r.jsx)("div",{className:"flex flex-1 items-center justify-center px-4 py-5 text-center",children:(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-[13.5px] font-semibold text-dim",children:m("dash.emptyTitle")}),(0,r.jsx)("div",{className:"mt-0.5 text-[12px] text-dim",children:m("dash.emptyHint")})]})}),(0,r.jsx)("div",{className:"pointer-events-none absolute bottom-4 left-4 z-30 flex items-center gap-2",children:(0,r.jsxs)("button",{type:"button",onClick:et,"aria-label":m("dash.newConvo"),className:"pointer-events-auto flex shrink-0 items-center gap-1 rounded-[8px] border border-line bg-panel px-3 py-1.5 text-[11.5px] font-bold text-ink shadow-card hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[(0,r.jsx)("span",{className:"text-[13px] leading-none text-accent",children:"+"})," ",m("dash.agent")]})})]}),E?(0,r.jsx)(ro,{tasks:i,project:s,onOpenTask:e=>{if(e.project!==s){sessionStorage.setItem("llvTaskFocus",e.id),i3(e.project);return}V("task::"+e.id)},onClose:_}):null]}),x?null:(0,r.jsx)(iB,{files:e,flows:t,project:s,onOpenFile:el}),B.length?(0,r.jsx)(iZ,{items:B,onSelect:el}):null,(0,r.jsx)(rf,{})]})}var i6=n(908),i8=n(9314);function i9(){let{t:e}=h(),[t,i]=(0,l.useState)(!1),[s,a]=(0,l.useState)({status:"idle"}),[o,c]=(0,l.useState)(null),[d,u]=(0,l.useState)(!1),p=(0,l.useRef)(null);(0,l.useEffect)(()=>{if(!t||"idle"!==s.status)return;let e=!1;return fetch("/api/access").then(e=>e.json()).then(t=>{e||a(t.tailnetUrl?{status:"ready",url:t.tailnetUrl}:{status:"unavailable"})}).catch(()=>{e||a({status:"error"})}),()=>{e=!0}},[t,s.status]),(0,l.useEffect)(()=>{if("ready"!==s.status)return;let e=!1,t=s.url;return n.e(768).then(n.t.bind(n,768,19)).then(({toDataURL:e})=>e(t,{margin:1,width:220})).then(n=>{e||c({url:t,dataUrl:n})}).catch(()=>{}),()=>{e=!0}},[s]);let f="ready"===s.status&&o&&o.url===s.url?o.dataUrl:null;(0,l.useEffect)(()=>{if(!t)return;let e=e=>{"Escape"===e.key&&i(!1)},n=e=>{p.current&&!p.current.contains(e.target)&&i(!1)};return window.addEventListener("keydown",e),window.addEventListener("pointerdown",n),()=>{window.removeEventListener("keydown",e),window.removeEventListener("pointerdown",n)}},[t]);let m=(0,l.useCallback)(()=>{"ready"===s.status&&navigator.clipboard.writeText(s.url).then(()=>{u(!0),window.setTimeout(()=>u(!1),2e3)}).catch(()=>{})},[s]);return(0,r.jsxs)("div",{ref:p,className:"relative ml-auto shrink-0",children:[(0,r.jsx)("button",{type:"button","aria-expanded":t,"aria-label":e("qr.showAria"),onClick:()=>{t||a({status:"idle"}),i(!t)},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,r.jsx)(i6.A,{className:"h-4 w-4","aria-hidden":!0})}),t?(0,r.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"===s.status?(0,r.jsx)("span",{className:"text-[12px] text-ink",children:e("common.loading")}):"error"===s.status?(0,r.jsx)("span",{className:"text-[12px] font-semibold text-err",children:e("qr.failed")}):"unavailable"===s.status?(0,r.jsxs)("span",{className:"text-[12px] leading-relaxed text-ink",children:[e("qr.startHint"),(0,r.jsx)("code",{className:"break-all rounded bg-chip px-1 py-0.5 font-mono text-[11px]",children:"bunx agent-log-viewer --tailscale"})]}):(0,r.jsxs)(r.Fragment,{children:[f?(0,r.jsx)("img",{src:f,alt:e("qr.alt"),className:"mx-auto h-[220px] w-[220px]"}):(0,r.jsx)("span",{className:"text-[12px] text-ink",children:e("qr.generating")}),(0,r.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,r.jsx)("input",{readOnly:!0,value:s.url,"aria-label":e("qr.linkAria"),onFocus:e=>e.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,r.jsx)("button",{type:"button","aria-label":e("qr.copy"),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:d?(0,r.jsx)(e6.A,{className:"h-3.5 w-3.5","aria-hidden":!0}):(0,r.jsx)(i8.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),(0,r.jsx)("span",{className:"text-[10.5px] text-dim",children:e("qr.scanHint")})]})}):null]})}function i7(){let{locale:e,t,setLocale:n}=h(),i="en"===e?"uk":"en";return(0,r.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:t("lang.aria"),"aria-label":t("lang.aria"),onClick:()=>n(i),children:e.toUpperCase()})}let se=(e=p())=>"uk"===e?"uk-UA":"en-US";function st({label:e,window:t,engineColor:n,now:i}){var s,l;let a,o,c,d,{t:u}=h();if(!t)return null;let f=Math.max(0,Math.min(100,100-t.usedPercent)),m=f<=10?"#c62828":f<=30?"#d29a2f":n;return(0,r.jsxs)("div",{className:"mt-1.5",children:[(0,r.jsxs)("div",{className:"flex items-baseline justify-between",children:[(0,r.jsx)("span",{className:"text-[11px] font-semibold text-ink",children:e}),(0,r.jsxs)("span",{className:"text-[11px] text-dim",children:[u("limits.left")," ",(0,r.jsxs)("span",{className:`font-bold tabular-nums ${f<=30?"":"text-ink"}`,style:f<=30?{color:m}:void 0,children:[Math.round(f),"%"]})]})]}),(0,r.jsx)("div",{className:"mt-1 h-[4px] overflow-hidden rounded-full bg-chip",children:(0,r.jsx)("div",{className:"h-full rounded-full transition-[width] duration-700 ease-out",style:{width:Math.max(f,1.5)+"%",backgroundColor:m}})}),t.resetsAt?(0,r.jsx)("div",{className:"mt-[3px] text-[10px] leading-none text-dim",children:u("limits.reset",{eta:(s=t.resetsAt,a=p(),(o=s-i)<=60?x(a,"limits.now"):o<5400?x(a,"limits.inMin",{n:Math.round(o/60)}):o<129600?x(a,"limits.inHour",{n:Math.round(o/3600)}):x(a,"limits.inDay",{n:Math.round(o/86400)})),at:(l=t.resetsAt,d=(c=new Date(1e3*l)).toLocaleTimeString(se(),{hour:"2-digit",minute:"2-digit",hour12:!1}),l-i<86400?d:c.toLocaleDateString(se(),{day:"numeric",month:"short"})+" "+d)})}):null]})}function sn({label:e,engine:t,limits:n,now:i,staleHint:s}){let{t:l}=h();if(!n||!n.session&&!n.weekly)return null;let a=V[t]??Z,o=n.capturedAt&&i-n.capturedAt>1200?Q(n.capturedAt):null;return(0,r.jsxs)("div",{className:`mt-2.5 first:mt-0 ${s?"opacity-60":""}`,children:[(0,r.jsxs)("div",{className:"flex items-baseline gap-1.5",children:[(0,r.jsx)("span",{className:"text-[11.5px] font-bold",style:{color:a.color},children:e}),n.plan?(0,r.jsx)("span",{className:"truncate text-[10px] text-dim",children:n.plan}):null,s?(0,r.jsx)("span",{className:"truncate text-[10px] text-dim",children:s}):null,o?(0,r.jsx)("span",{className:"h-1.5 w-1.5 shrink-0 self-center rounded-full bg-[#d29a2f]",title:l("limits.stale",{stale:o})}):null]}),(0,r.jsx)(st,{label:l("limits.5h"),window:n.session,engineColor:a.color,now:i}),(0,r.jsx)(st,{label:l("limits.week"),window:n.weekly,engineColor:a.color,now:i})]})}function sr(){let{locale:e}=h(),[t,n]=(0,l.useState)(null);if((0,l.useEffect)(()=>{let e=!0,t=async()=>{try{let t=await fetch("/api/limits");if(!t.ok)return;let r=await t.json();e&&n(e=>{var t;return{data:(t=e?.data??null,r.claude||r.codex||!t?{claude:r.claude??t?.claude??null,codex:r.codex??t?.codex??null,staleSince:r.staleSince??null}:{...t,staleSince:r.staleSince??t.staleSince??null}),at:Date.now()/1e3}})}catch{}};t();let r=setInterval(t,6e4);return()=>{e=!1,clearInterval(r)}},[]),!t||!t.data.claude&&!t.data.codex)return null;let i=function(e,t){if(!e)return null;let n=new Date(e);return Number.isNaN(n.getTime())?null:x(t,"limits.asOf",{time:n.toLocaleTimeString(se(t),{hour:"2-digit",minute:"2-digit",hour12:!1})})}(t.data.staleSince,e);return(0,r.jsxs)("div",{className:"shrink-0 border-t border-line px-3.5 pb-3 pt-2.5",children:[(0,r.jsx)(sn,{label:"Claude",engine:"claude",limits:t.data.claude,now:t.at,staleHint:i}),(0,r.jsx)(sn,{label:"Codex",engine:"codex",limits:t.data.codex,now:t.at,staleHint:i})]})}var si=n(5298),ss=n(4526);function sl(){let{t:e}=h(),[t,n]=(0,l.useState)(!1),[i,s]=(0,l.useState)(!1);(0,l.useEffect)(()=>{let e="serviceWorker"in navigator&&"PushManager"in window&&window.isSecureContext;queueMicrotask(()=>s(e)),e&&navigator.serviceWorker.getRegistration("/question-push-sw.js").then(e=>e?.pushManager.getSubscription().then(e=>n(null!==e)))},[]);let a=async()=>{if(!i||"default"===Notification.permission&&"granted"!==await Notification.requestPermission()||"granted"!==Notification.permission)return;let e=await navigator.serviceWorker.register("/question-push-sw.js"),t=await e.pushManager.getSubscription();if(t){await t.unsubscribe(),n(!1);return}let r=await (await fetch("/api/push")).json(),s=await e.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:function(e){let t=atob((e+"=".repeat((4-e.length%4)%4)).replace(/-/g,"+").replace(/_/g,"/")),n=new Uint8Array(t.length);for(let e=0;e<t.length;e+=1)n[e]=t.charCodeAt(e);return n.buffer.slice(0)}(r.publicKey)});await fetch("/api/push",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(s)}),n(!0)};return(0,r.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:e(i?t?"push.enabled":"push.enable":"push.needsHttps"),"aria-label":e(i?t?"push.disable":"push.enable":"push.needsHttps"),"aria-pressed":t,disabled:!i,onClick:a,children:t?(0,r.jsx)(si.A,{className:"h-3.5 w-3.5","aria-hidden":!0}):(0,r.jsx)(ss.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})}function sa({files:e,workflows:t,archivedProjects:n,selected:i,now:s,onSelect:a}){let{t:o}=h(),[c,d]=(0,l.useState)(""),[u,p]=(0,l.useState)(!1),f=(0,l.useMemo)(()=>A(e,s,t),[e,s,t]),m=(0,l.useMemo)(()=>{let e=c.trim().toLowerCase();return e?f.filter(t=>t.project.toLowerCase().includes(e)):f},[f,c]),x=(0,l.useMemo)(()=>m.filter(e=>!n.has(e.project)),[m,n]),b=(0,l.useMemo)(()=>m.filter(e=>n.has(e.project)),[m,n]),w=(0,l.useMemo)(()=>f.reduce((e,t)=>e+t.liveCount,0),[f]),v=(0,l.useMemo)(()=>f.reduce((e,t)=>e+t.attentionCount,0),[f]);return(0,r.jsxs)("aside",{className:"flex w-[248px] shrink-0 flex-col border-r border-line bg-panel",children:[(0,r.jsxs)("header",{className:"flex h-10 shrink-0 items-center gap-2 border-b border-line px-4 text-[13.5px] font-bold",children:[o("rail.title"),w?(0,r.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,r.jsx)("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-ok"}),w]}):null,v?(0,r.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:["⏸ ",v]}):null,(0,r.jsx)(i7,{}),(0,r.jsx)(i9,{}),(0,r.jsx)(sl,{})]}),(0,r.jsx)("div",{className:"px-2.5 pb-1 pt-2.5",children:(0,r.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:o("rail.filter"),value:c,onChange:e=>d(e.target.value)})}),(0,r.jsxs)("nav",{className:"flex-1 overflow-y-auto px-2 pb-3 pt-1","aria-label":o("rail.projects"),children:[(0,r.jsx)(so,{label:o("rail.overview"),live:0,attention:0,total:null,age:"",active:i===g,hasLive:!1,onClick:()=>a(g)}),(0,r.jsx)("div",{className:"mx-2.5 my-1.5 border-t border-line"}),(0,r.jsx)(tU,{children:x.map(e=>(0,r.jsx)("div",{"data-flip-key":e.project,children:(0,r.jsx)(so,{label:e.project,live:e.liveCount,attention:e.attentionCount,total:e.conversations,age:Q(e.smt),active:i===e.project,hasLive:e.liveCount>0,onClick:()=>a(e.project)})},e.project))}),b.length?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"mx-2.5 my-1.5 border-t border-line"}),(0,r.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":u,onClick:()=>p(e=>!e),children:[(0,r.jsx)(e8.A,{className:`h-3 w-3 shrink-0 transition-transform ${u?"rotate-90":""}`,"aria-hidden":!0}),(0,r.jsx)(eZ.A,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),o("rail.archive"),(0,r.jsx)("span",{className:"font-semibold",children:b.length})]}),u?b.map(e=>(0,r.jsx)(so,{label:e.project,live:e.liveCount,attention:e.attentionCount,total:e.conversations,age:Q(e.smt),active:i===e.project,hasLive:e.liveCount>0,onClick:()=>a(e.project)},e.project)):null]}):null,x.length||b.length?null:(0,r.jsx)("div",{className:"px-3 py-4 text-center text-[12px] text-dim",children:o("common.nothingFound")})]}),(0,r.jsx)(sr,{})]})}function so({label:e,live:t,attention:n,total:i,age:s,active:l,hasLive:a,onClick:o}){return(0,r.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",l?"border-line bg-bg shadow-card":"border-transparent hover:bg-bg"].join(" "),"aria-current":l?"page":void 0,onClick:o,children:[(0,r.jsx)("span",{className:["h-2 w-2 shrink-0 rounded-full",a?"animate-pulse bg-ok":"bg-[#d6d6dd]"].join(" ")}),(0,r.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,r.jsx)("span",{className:`block truncate text-[13px] ${l?"font-bold":"font-semibold"}`,children:e}),s?(0,r.jsx)("span",{className:"block text-[10.5px] text-dim",children:s}):null]}),t>0?(0,r.jsx)("span",{className:"shrink-0 rounded-full bg-[#e5f6ea] px-1.5 py-0.5 text-[10.5px] font-bold text-ok",children:t}):null,n>0?(0,r.jsxs)("span",{className:"shrink-0 rounded-full bg-[#fff1ca] px-1.5 py-0.5 text-[10.5px] font-bold text-[#8a5a00]",children:["⏸ ",n]}):null,null!==i?(0,r.jsx)("span",{className:"shrink-0 text-[11px] font-semibold text-dim",children:i}):null]})}let sc="llvProject";function sd(){let e=location.hash.match(/^#f=(.+)$/);if(e){let t=(e[1]??"").replace(/#question$/,"");try{return{filePath:decodeURIComponent(t),project:null}}catch{return{filePath:t,project:null}}}let t=location.hash.match(/^#p=(.+)$/);if(t)try{return{filePath:null,project:decodeURIComponent(t[1])}}catch{return{filePath:null,project:t[1]}}return{filePath:null,project:null}}function su(){let e,t,{t:n}=h(),{files:a,flows:o,workflows:c,tasks:d}=function(){let[e,t]=(0,l.useState)(eF);return(0,l.useEffect)(()=>{let e=!0,n="",r=async()=>{try{let r=await fetch("/api/files"),i=await r.text();if(!e||i===n)return;n=i;let s=JSON.parse(i);Array.isArray(s)?t({files:s,flows:[],workflows:[],tasks:[]}):t({files:s.files??[],flows:s.flows??[],workflows:s.workflows??[],tasks:s.tasks??[]})}catch{}};r();let i=setInterval(r,1e4),s=()=>void r();return window.addEventListener(R,s),window.addEventListener(e_,s),window.addEventListener(eC,s),()=>{e=!1,clearInterval(i),window.removeEventListener(R,s),window.removeEventListener(e_,s),window.removeEventListener(eC,s)}},[]),e}(),u=(e=(0,l.useSyncExternalStore)(L,()=>I,()=>z),(0,l.useMemo)(()=>o.some(t=>e.has(t.id)&&"closed"!==t.state)?o.map(t=>e.has(t.id)&&"closed"!==t.state?{...t,state:"closed",closedAt:t.closedAt??new Date().toISOString()}:t):o,[o,e]));t=(0,l.useRef)(null),(0,l.useEffect)(()=>{let e;return e=()=>{let e=ev();e&&"running"!==e.state&&e.resume().catch(()=>void 0)},window.addEventListener("pointerdown",e,{passive:!0}),window.addEventListener("keydown",e),()=>{window.removeEventListener("pointerdown",e),window.removeEventListener("keydown",e)}},[]),(0,l.useEffect)(()=>{if(!a.length)return;let e=new Map;for(let t of a)N(t)||e.set(t.path,ex(t));let n=t.current;if(t.current=e,!n)return;let r=0;for(let[t,i]of e){let e=a.find(e=>e.path===t),s=e?.pendingQuestion||e?.waitingInput?"question":ej[i];if(!s)continue;let l=n.get(t);("live"===l||void 0===l)&&ey(s,function(e){let t=eg.get(e);if(!t)return 0;let n=t.getBoundingClientRect();return n.width?Math.max(-1,Math.min(1,(n.left+n.width/2)/window.innerWidth*2-1)):0}(t),220*r++)}},[a]);let{archivedProjects:p,archiveProject:f,unarchiveProject:m}=function(e){let[t,n]=(0,l.useState)(()=>new Set),r=(0,l.useRef)(t);return(0,l.useEffect)(()=>{let e=function(){try{let e=window.localStorage.getItem(eN),t=e?JSON.parse(e):[];return new Set(Array.isArray(t)?t.filter(e=>"string"==typeof e):[])}catch{return new Set}}();r.current=e,n(e)},[]),(0,l.useEffect)(()=>{let t=r.current;if(!t.size)return;let i=new Set(t);for(let t of e)"live"===t.activity&&i.delete(S(t));i.size!==t.size&&(r.current=i,n(i),eS(i))},[e]),{archivedProjects:t,archiveProject:(0,l.useCallback)(e=>{n(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),r.current=n,eS(n),n})},[]),unarchiveProject:(0,l.useCallback)(e=>{n(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),r.current=n,eS(n),n})},[])}}(a),x=eB(),[w,v]=(0,l.useState)(!1),[k,y]=(0,l.useState)(g),[j,C]=(0,l.useState)(null),[A,$]=(0,l.useState)(null),T=(0,l.useRef)(null),[E,D]=(0,l.useState)(0);(0,l.useEffect)(()=>{let e=sd();e.filePath&&C(e.filePath);let t=e.project??localStorage.getItem(sc);t&&y(t)},[]),(0,l.useEffect)(()=>{let e=()=>{let e=sd();e.filePath?C(e.filePath):e.project&&y(e.project)};return window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)},[]);let P=(0,l.useCallback)(e=>{y(e),localStorage.setItem(sc,e),e!==g?history.replaceState(null,"","#p="+encodeURIComponent(e)):history.replaceState(null,"",location.pathname),v(!1)},[]);(0,l.useEffect)(()=>{if(!w)return;let e=e=>{"Escape"===e.key&&v(!1)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[w]);let _=(0,l.useCallback)(e=>{let t=S(e);i2(t,e.path),P(t),D(e=>e+1)},[P]);(0,l.useEffect)(()=>{if(!j||0===a.length)return;let e=a.find(e=>e.path===j);e&&_(e),C(null)},[j,a,_]);let[O,q]=(0,l.useState)(()=>Date.now()/1e3),F=(0,l.useMemo)(()=>(function(e,t=Date.now()/1e3){let n=[];for(let r of e){let e=M(r,t);if(null===e)continue;let i=r.pendingQuestion||r.waitingInput?"blocked":"stalled",s=r.pendingQuestion?function(e){let t=Date.parse(e);return Number.isFinite(t)?t/1e3:null}(r.pendingQuestion.askedAt)??r.mtime:r.waitingInput?r.waitingInput.since:r.mtime;n.push({id:e,file:r,project:S(r),tier:i,since:s})}return n.sort((e,t)=>(e.tier===t.tier?0:"blocked"===e.tier?-1:1)||e.since-t.since||e.id.localeCompare(t.id))})(a,O),[a,O]);(0,l.useEffect)(()=>{let e=a.filter(e=>"stalled"===e.activity).map(e=>e.mtime+7200).filter(e=>e>O);if(!e.length)return;let t=Math.max(0,(Math.min(...e)-Date.now()/1e3)*1e3)+500,n=window.setTimeout(()=>q(Date.now()/1e3),t);return()=>window.clearTimeout(n)},[a,O]);let[U,H]=(0,l.useState)(!1),B=(0,l.useRef)(null);(0,l.useEffect)(()=>{document.title=F.length?`(${F.length}) Agent Log Viewer`:"Agent Log Viewer"},[F.length]),(0,l.useEffect)(()=>{if(!U)return;let e=e=>{B.current?.contains(e.target)||H(!1)},t=e=>{"Escape"===e.key&&H(!1)};return window.addEventListener("pointerdown",e),window.addEventListener("keydown",t),()=>{window.removeEventListener("pointerdown",e),window.removeEventListener("keydown",t)}},[U]);let[W,K]=(0,l.useState)(!1);(0,l.useEffect)(()=>{x&&K(!1)},[x]),(0,l.useEffect)(()=>{F.length||(H(!1),K(!1))},[F.length]);let[Y,J]=(0,l.useState)(null),X=(0,l.useCallback)(e=>{J(t=>({path:e,nonce:(t?.nonce??0)+1}))},[]),G=(0,l.useRef)(null),V=(0,l.useMemo)(()=>F.map(e=>e.file.path).sort().join("\n"),[F]),Z=(0,l.useMemo)(()=>W?new Set(V.split("\n").filter(Boolean)):null,[W,V]),ee=(0,l.useMemo)(()=>k===g?[]:F.filter(e=>e.project===k),[F,k]);(0,l.useEffect)(()=>{if(x)return;let e=e=>{var t;if(!((t=e.target)&&t.tagName&&(["INPUT","TEXTAREA","SELECT","BUTTON"].includes(t.tagName)||t.isContentEditable))&&!e.metaKey&&!e.ctrlKey&&!e.altKey){if("n"===e.key||"N"===e.key){let t=function(e,t,n){if(!e.length)return null;let r=null===t?-1:e.findIndex(e=>e.id===t);return -1===r?1===n?e[0]:e[e.length-1]:e[(r+n+e.length)%e.length]}(ee,G.current,e.shiftKey?-1:1);if(!t)return;e.preventDefault(),G.current=t.id,X(t.file.path)}else if("f"===e.key||"F"===e.key){if(!F.length)return;e.preventDefault(),K(e=>!e)}}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[x,ee,F.length,X]);let et=(0,l.useCallback)(e=>{H(!1),e.project!==k&&P(e.project),G.current=e.id,X(e.file.path)},[k,P,X]);(0,l.useEffect)(()=>{let e=a.map(e=>({file:e,id:e.pendingQuestion||e.waitingInput?M(e):null})).filter(e=>null!==e.id);if(null===T.current){T.current=new Set(e.map(e=>e.id));return}let t=e.find(e=>!T.current.has(e.id));for(let t of e)T.current.add(t.id);t&&queueMicrotask(()=>$(t.file.path))},[a]);let en=A?a.find(e=>e.path===A):null;return(0,r.jsxs)("div",{className:"flex h-full",children:[x?null:(0,r.jsx)(sa,{files:a,workflows:c,archivedProjects:p,selected:k,now:O,onSelect:P}),x&&w?(0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex",children:[(0,r.jsx)(sa,{files:a,workflows:c,archivedProjects:p,selected:k,now:O,onSelect:P}),(0,r.jsx)("button",{type:"button",className:"min-w-0 flex-1 bg-ink/35","aria-label":n("viewer.closeProjects"),onClick:()=>v(!1)})]}):null,(0,r.jsxs)("main",{className:"flex min-w-0 flex-1 flex-col",children:[(0,r.jsxs)("div",{className:"pointer-events-none fixed right-4 top-4 z-50 flex flex-col items-end gap-2",children:[F.length?(0,r.jsxs)("div",{ref:B,className:"pointer-events-auto relative",children:[(0,r.jsxs)("div",{className:"flex items-center overflow-hidden rounded-full border border-[#e0ae45]/45 bg-[#fff9ed] shadow-card",children:[(0,r.jsx)("button",{type:"button",className:"px-3 py-1 text-[12px] font-bold text-[#8a5a00] hover:bg-[#e0ae45]/15 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent/40","aria-expanded":U,title:n("attention.openQueue"),onClick:()=>H(e=>!e),children:n("attention.badge",{count:F.length})}),x?null:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"h-4 w-px shrink-0 bg-[#e0ae45]/45","aria-hidden":!0}),(0,r.jsx)("button",{type:"button",className:`px-2 py-1.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent/40 ${W?"bg-[#e0ae45]/30 text-[#8a5a00]":"text-[#b8860b]/70 hover:bg-[#e0ae45]/15 hover:text-[#8a5a00]"}`,"aria-pressed":W,title:W?n("attention.filterOff"):n("attention.filterOn"),"aria-label":W?n("attention.filterOff"):n("attention.filterOn"),onClick:()=>K(e=>!e),children:(0,r.jsx)(i.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})]}),U?(0,r.jsxs)("div",{className:"absolute right-0 top-[calc(100%+6px)] max-h-[60vh] w-[340px] max-w-[calc(100vw-2rem)] overflow-y-auto rounded-[10px] border border-line bg-panel p-1.5 shadow-card",children:[(0,r.jsx)("div",{className:"px-2.5 pb-1 pt-1.5 text-[10.5px] font-bold uppercase tracking-wide text-dim",children:n("attention.popoverTitle")}),F.map(e=>(0,r.jsxs)("button",{type:"button",className:"flex w-full min-w-0 flex-col gap-0.5 rounded-[8px] px-2.5 py-2 text-left hover:bg-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>et(e),children:[(0,r.jsxs)("span",{className:"flex w-full min-w-0 items-center gap-1.5",children:[(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12px] font-semibold text-ink",children:b(e.file.title,90)}),(0,r.jsx)("span",{className:"shrink-0 rounded-full border border-line bg-bg px-1.5 text-[10px] font-semibold text-dim",children:e.project}),(0,r.jsx)("span",{className:"shrink-0 text-[10.5px] text-dim",children:Q(e.since)})]}),(0,r.jsx)("span",{className:`w-full truncate text-[11px] ${"stalled"===e.tier?"text-[#b8860b]":"text-dim"}`,children:function(e,t){let n=t.file.pendingQuestion;if(n){if("plan"===n.kind)return e("status.awaitingPlan");let t=n.questions?.[0];return t?.header||t?.question.split("\n")[0]||e("status.awaitingAnswer")}let r=t.file.waitingInput;return r?r.menu?.question.split("\n")[0]||r.screenTail||e("status.awaitingTerminal"):e("status.stalled")}(n,e)})]},e.id))]}):null]}):null,en?(0,r.jsxs)("div",{className:"pointer-events-auto flex max-w-[360px] gap-2 rounded-[8px] border border-[#e0ae45]/45 bg-[#fff9ed] px-4 py-3 text-[13px] font-semibold text-ink shadow-card",children:[(0,r.jsxs)("button",{className:"min-w-0 flex-1 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>{_(en),$(null)},children:[(0,r.jsx)("span",{className:"block text-[11px] font-bold text-[#8a5a00]",children:n("viewer.agentWaiting")}),(0,r.jsx)("span",{className:"line-clamp-2",children:en.title})]}),(0,r.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":n("viewer.closeNotification"),onClick:()=>$(null),children:(0,r.jsx)(s.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}):null]}),k===g?(0,r.jsx)(eY,{files:a,workflows:c,archivedProjects:p,now:O,onSelectProject:P,onSelectFile:_,onMenu:x?()=>v(!0):void 0}):(0,r.jsx)(i4,{files:a,flows:u,workflows:c,tasks:d,project:k,openNonce:E,focusRequest:Y,attentionPaths:Z,archived:p.has(k),onArchive:f,onUnarchive:m,onMenu:x?()=>v(!0):void 0})]})]})}},9097:(e,t,n)=>{Promise.resolve().then(n.bind(n,6381))}},e=>{e.O(0,[680,441,794,358],()=>e(e.s=9097)),_N_E=e.O()}]);
|