agent-log-viewer 0.2.0 → 0.3.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 +10 -6
- package/dist/standalone/.next/build-manifest.json +2 -2
- package/dist/standalone/.next/routes-manifest.json +30 -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/answer/route.js +1 -1
- package/dist/standalone/.next/server/app/api/files/route.js +1 -1
- package/dist/standalone/.next/server/app/api/flows/[id]/route.js +1 -1
- package/dist/standalone/.next/server/app/api/flows/route.js +1 -1
- package/dist/standalone/.next/server/app/api/inbox/route.js +1 -1
- package/dist/standalone/.next/server/app/api/limits/route.js +1 -1
- package/dist/standalone/.next/server/app/api/log/route.js +1 -1
- package/dist/standalone/.next/server/app/api/proc/route.js +1 -1
- package/dist/standalone/.next/server/app/api/push/route.js +1 -1
- package/dist/standalone/.next/server/app/api/spawn/route.js +1 -1
- package/dist/standalone/.next/server/app/api/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 +2 -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/tmux/route.js +1 -1
- package/dist/standalone/.next/server/app/api/transcribe/route.js +1 -1
- package/dist/standalone/.next/server/app/api/transcribe/token/route.js +1 -1
- 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 +10 -6
- package/dist/standalone/.next/server/chunks/871.js +1 -1
- package/dist/standalone/.next/server/functions-config-manifest.json +4 -0
- 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/static/chunks/258-a0398b569708ffc3.js +1 -0
- package/dist/standalone/.next/static/chunks/app/_global-error/page-f4e3cd62c5cbfd22.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/access/route-f4e3cd62c5cbfd22.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/answer/route-f4e3cd62c5cbfd22.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/files/route-f4e3cd62c5cbfd22.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/flows/[id]/route-f4e3cd62c5cbfd22.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/flows/route-f4e3cd62c5cbfd22.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/inbox/route-f4e3cd62c5cbfd22.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/limits/route-f4e3cd62c5cbfd22.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/log/route-f4e3cd62c5cbfd22.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/proc/route-f4e3cd62c5cbfd22.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/push/route-f4e3cd62c5cbfd22.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/spawn/route-f4e3cd62c5cbfd22.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/tasks/[id]/route-f4e3cd62c5cbfd22.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/tasks/[id]/send/route-f4e3cd62c5cbfd22.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/tasks/[id]/spawn/route-f4e3cd62c5cbfd22.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/tasks/route-f4e3cd62c5cbfd22.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/timeline/route-f4e3cd62c5cbfd22.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/tmux/route-f4e3cd62c5cbfd22.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/transcribe/route-f4e3cd62c5cbfd22.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/transcribe/token/route-f4e3cd62c5cbfd22.js +1 -0
- package/dist/standalone/.next/static/chunks/app/page-cd0f70a472e144bd.js +2 -0
- package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/app-error-f4e3cd62c5cbfd22.js +1 -0
- package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/forbidden-f4e3cd62c5cbfd22.js +1 -0
- package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/not-found-f4e3cd62c5cbfd22.js +1 -0
- package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/unauthorized-f4e3cd62c5cbfd22.js +1 -0
- package/dist/standalone/.next/static/css/3f6c482d54e91e64.css +1 -0
- package/dist/standalone/.next/static/dxjlPz3fKtXT-7BfdVO_q/_buildManifest.js +1 -0
- package/dist/standalone/package.json +1 -1
- package/package.json +1 -1
- 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/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/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 → dxjlPz3fKtXT-7BfdVO_q}/_ssgManifest.js +0 -0
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[974],{5039:(e,t,n)=>{Promise.resolve().then(n.bind(n,9996))},9996:(e,t,n)=>{"use strict";n.d(t,{Viewer:()=>r4});var r=n(5155),i=n(9005),l=n(2115);let s={en:{"common.serverUnavailable":"server unavailable","common.loading":"loading…","common.loadingCap":"Loading…","common.cancel":"Cancel","common.show":"show","common.showAll":"show all","common.collapse":"collapse","common.yes":"Yes","common.no":"No","common.send":"Send","common.sending":"sending…","common.sent":"sent","common.close":"Close","common.failedSend":"couldn't send","common.failedDelete":"couldn't delete","common.nothingFound":"Nothing found","common.nothingRunning":"nothing is running right now","common.kb":"kB","common.chars":"{n} chars","lang.aria":"Interface language","util.effortTitle":"Reasoning effort: {effort}","time.agoSec":"{n}s ago","time.agoMin":"{n}m ago","time.agoHour":"{n}h ago","time.agoDay":"{n}d ago","kind.session":"session","kind.subagent":"subagent","kind.job":"job","kind.background":"background","kind.handoff":"handoff","rail.title":"Agent logs","rail.filter":"Filter projects…","rail.projects":"Projects","rail.overview":"Overview","rail.archive":"Archive","dash.branchesLive":{one:"{count} branch running",other:"{count} branches running"},"dash.trees":{one:"{count} tree",other:"{count} trees"},"dash.recentConvos":{one:"{count} recent conversation",other:"{count} recent conversations"},"dash.quietTrees":{one:"{count} quiet tree",other:"{count} quiet trees"},"dash.openProjects":"Open project list","dash.unarchive":"Restore from archive","dash.newConvo":"New conversation with an agent","dash.agent":"Agent","dash.emptyTitle":"The scheme is empty for now","dash.emptyHint":"Open the switchboard in the bottom-right corner and click a conversation — it will appear here","trash.title":"The scheme is empty, but the project has records","trash.hint":"Clicking a row opens the conversation as a node; the trash icon deletes its file from disk permanently.","trash.deletedFromDisk":"\xb7 deleted from disk","trash.open":"Open {title}","trash.toArchive":"Archive","trash.notDeleted":"{failed} of {total} not deleted","trash.confirmDelete":{one:"Delete {count} project file from disk?",other:"Delete {count} project files from disk?"},"trash.deleting":"deleting…","trash.confirmYes":"Yes, delete","trash.deleteProject":"Delete project from disk","switch.aria":"Agent switchboard","switch.title":"Switchboard","switch.search":"Search by name or project","switch.updating":"updating…","switch.close":"Close switchboard","switch.waiting":"Waiting for you","switch.working":"Working","switch.recent":"Recent","switch.older":"Older","switch.hidden":"Hidden ({count})","switch.hide":"hide","switch.restore":"restore","switchCard.openColumn":"Open {title} as a column","switchCard.remove":"Remove from switchboard","composer.imagesCount":{one:"{count} image",other:"{count} images"},"composer.spawned":"launched agent in tmux {target}","composer.sentPaths":"sent {count} path(s)","composer.failedInterrupt":"couldn't interrupt","composer.escapeSent":"sent Escape — agent interrupted","composer.spawnAria":"Launch an agent with a prompt in tmux","composer.sendAria":"Send a message to the agent in tmux {target}","composer.queueAria":"Queue of sent messages","composer.removeFromQueue":"Remove from queue","composer.placeholderRelay":"type — I'll relay through the root session…","composer.placeholderSpawn":"prompt — the agent will start in tmux…","composer.placeholderSend":"message the agent…","composer.textAria":"Text for the agent","composer.titleRelay":"relayed through the branch's root session","composer.titleSpawnResumed":"new tmux window with the resumed agent","composer.root":"root","composer.interruptAria":"Interrupt the agent (Escape)","composer.interruptTitle":"send Escape to the agent pane","composer.compactAria":"Compact the agent's context (/compact)","composer.compactTitle":"send /compact — the agent condenses its context; a band appears in the feed when done","composer.compactConfirm":"Compact?","composer.compactConfirmTitle":"Click again to send /compact","composer.compactSent":"compaction started — the band will appear in the feed once it's done","composer.failedCompact":"couldn't start compaction","composer.addImages":"Add images","composer.stopAndSend":"Stop recording and send","composer.launchAgent":"Launch the agent","composer.sendToAgent":"Send to the agent","composer.stopAndSendTitle":"stop recording and send","draft.readPrompt":"Read the agent conversation in file {src} and continue from there: ","draft.needDir":"specify a working directory","draft.launchFailed":"couldn't launch","draft.paneAria":"Draft of a new agent conversation","draft.notStarted":"agent not started yet","draft.engineAria":"Agent engine","draft.handoffLabel":"handoff: {title}","draft.newConvo":"new conversation","draft.conversation":"conversation","draft.dismiss":"Dismiss the draft conversation","draft.directory":"directory","draft.dirAria":"Agent working directory","draft.imagesOnly":"(images)","draft.launched":"agent launched in tmux {target} — waiting for the conversation to appear here…","draft.slow":"Taking a while. Check tmux window {target} — the panel will pick up the transcript as soon as it appears.","draft.hintRelay":"The new agent will first read the parent conversation's transcript and pick up from there. Add to the prompt what to do next — the branch will appear on the scheme alongside.","draft.hintNew":"Choose an engine and a directory, write the first prompt — the agent will start in tmux, and the conversation will continue in this same panel.","draft.promptAria":"First prompt for the new agent","draft.placeholder":"first prompt — the agent will start in tmux…","draft.promptTextAria":"First prompt text","draft.newWindowTitle":"new tmux window with a fresh agent","draft.newAgent":"new agent","draft.addImages":"Add images to the prompt","draft.stopAndLaunch":"Stop recording and launch the agent","link.handoffContext":"You've been handed another agent's context — the conversation \xab{title}\xbb. Its transcript: {path} — read that file first for full context, then carry out the request below.\n\n{ask}","link.dropped":"context is in the composer of \xab{title}\xbb — type the ask and send","handoff.aria":"Hand the conversation to a new agent — a draft appears below","handoff.title":"click — draft a new agent with this context \xb7 drag — link to an existing one","handoff.label":"hand off to agent","qr.showAria":"Show a QR code for phone login","qr.failed":"couldn't get the link","qr.startHint":"Start the viewer with Tailscale access: ","qr.alt":"QR code for phone login","qr.generating":"generating QR…","qr.linkAria":"Phone login link","qr.copy":"Copy link","qr.scanHint":"scan from a phone on the same tailnet","push.enabled":"Push notifications enabled","push.enable":"Enable push notifications","push.disable":"Disable push notifications","push.needsHttps":"Push requires HTTPS","sound.on":"Sound notifications on","sound.off":"Sound notifications off","sound.mute":"Mute sound notifications","sound.unmute":"Enable sound notifications","mic.stopRecognize":"Stop recording and transcribe","mic.cancel":"Cancel recording","mic.recognizing":"Transcribing…","mic.dictate":"Dictate","mic.dictateHint":"dictate (up to 2 min)","delFile.confirm":"Delete from disk?","delFile.aria":"Delete the conversation from disk","img.readFailed":"couldn't read the image","img.readAborted":"image reading aborted","img.unsupported":"unsupported image format: {name}","img.unknownFile":"unknown file","img.tooLarge":"{name}: too large (10 MB limit)","img.image":"image","img.error":"image error","img.previewAlt":"image preview {n}","img.removeAria":"Remove image {n}","img.toFilePaths":"as file paths","question.sec":"{n} s","question.min":"{n} min","question.hour":"{n} h","question.waiting":"waiting for a reply","question.sentToPane":"Sent to the pane: {text}","question.keysHint":"keys into the pane \xb7 or the composer below","question.pane":"Pane {target}","question.alreadyAnswered":"answer already recorded","question.openFailed":"couldn't open the session","question.opened":"opened {target}","question.answered":"Answered: {text}","question.answeredElsewhere":"Answered elsewhere: {text}","question.noPane":"tmux pane unavailable","question.openSession":"open session","question.rejectComment":"Rejection comment…","question.approved":"approved","question.rejected":"rejected","question.approve":"Approve","question.reject":"Reject","question.ownAnswer":"Your own answer…","inbox.deleted":"deleted from disk","inbox.fileGone":"the file is no longer on disk","inbox.confirmDelete":"Delete the file from disk?","inbox.deleteAria":"Delete {name} from disk","inbox.deleteFromDisk":"delete from disk","inbox.attachedAlt":"attached image {name}","lightbox.zoomOut":"Zoom out","lightbox.resetZoom":"Reset zoom","lightbox.zoomIn":"Zoom in","feed.agentEnded":"agent finished","feed.running":"running {tool}…","feed.tool":"tool","feed.thinking":"thinking…","feed.working":"working…","feed.liveTail":"live tail","feed.backToLive":"Back to the live tail","feed.newCount":"{count} new","feed.down":"down","feed.pickLog":"Pick a log on the left — the feed updates itself","feed.showEarlier":"show earlier","feed.showEarlierHidden":"show earlier (hidden {count})","feed.loadEarlier":"load earlier from the file","feed.startOfConvo":"start of the conversation","feed.finishedTurn":"finished the turn — waiting for a reply","feed.returnedResult":"returned with a result","feed.noOutput":"No output yet — the file is empty for now","feed.onlyService":"Only service records are present ({count}).","feed.empty":"Empty (no rows to show)","render.system":"system","render.executing":"executing…","render.error":"error","render.teammate":"teammate","render.left":"{peer}: left{at}","render.codexSessionCreated":"Codex session created","render.taskStarted":"Task started","render.taskComplete":"Task completed","render.compacted":"context compacted","render.compactAuto":"auto","render.compactManual":"manual","render.compactPre":"{n}k tokens before","render.compactSummary":"conversation summary","render.patch":"patch","render.stdinSession":"stdin → session {id}","render.record":"record","render.protocol":"protocol","render.jobLogNote":"(this is a job log: it has no command stdout; the full output is in the Codex rollout session in the left list)","render.image":"image","render.dataKb":"{n} kB of data","render.commands":{one:"{count} command",other:"{count} commands"},"render.noFindings":"no findings","render.moreFindings":"{count} more findings in raw","render.memoryCitations":"memory citations ({count})","render.noCitations":"no citation entries","render.moreEntries":"{count} more entries in raw","render.truncated":"truncated","render.shutdownRequest":"shutdown request","render.shutdownResponse":"shutdown response","render.planRequest":"plan approval request","render.planVerdict":"plan verdict","render.approved":"approved","render.rejected":"rejected","render.from":"from {from}","render.structured":"structured message","render.showJson":"show JSON","render.noOutputInLog":"(output is absent from this log file — the full output is in the Codex rollout session)","render.filesChanged":"files changed","render.toDir":"to","render.fromDir":"from","render.delivered":"delivered","render.notDelivered":"not delivered","render.reasoning":"agent reasoning","flowDialog.engine":"Engine: {label}","flowDialog.modelPlaceholder":"model (default)","flowDialog.model":"Model: {label}","flowDialog.effortDefault":"effort: default","flowDialog.createFailed":"couldn't create the flow ({status})","flowDialog.title":"Start a flow","flowDialog.subtitle":"implement → review \xb7 this conversation becomes the implementer","flowDialog.preset":"preset","flowDialog.rolesManualOpen":"▾ roles manually","flowDialog.rolesManual":"▸ roles manually (model / effort)","flowDialog.implementer":"implementer","flowDialog.reviewer":"reviewer","flowDialog.diffBase":"diff base","flowDialog.fromHead":"from current HEAD","flowDialog.fromMergeBase":"from merge-base with main","flowDialog.headless":"headless (no pane)","flowDialog.tmuxPane":"tmux pane","flowDialog.transitions":"transitions","flowDialog.auto":"auto","flowDialog.manual":"manual (gate every step)","flowDialog.roundLimit":"round limit","flowDialog.creating":"creating…","flowDialog.start":"▶ Start","flowStrip.startReview":"Start review","flowStrip.spawnReviewer":"Spawn reviewer","flowStrip.relayNotes":"Relay notes","flowStrip.retryRound":"Retry round","flowStrip.anotherRound":"Another round","flowStrip.flow":"FLOW","flowStrip.roundsAria":"Review rounds","flowStrip.roundError":"Round {n}: {error}","flowStrip.roundVerdict":"Round {n}: {verdict}","flowStrip.roundInProgress":"Round {n}: in progress","flowStrip.addRoundsTitle":"Add more rounds to the limit","flowStrip.plus2":"+2 rounds","flowStrip.limitTitle":"Round limit: reviews before the loop parks (∞ — unlimited)","flowStrip.limitAria":"Set the round limit to {count}","flowStrip.limitUnlimitedAria":"Unlimited rounds","flowStrip.stopReviewer":"Stop","flowStrip.stopReviewerTitle":"Stop the running reviewer; the round lands in “needs decision”","flowStrip.notePlaceholder":"note for the reviewer…","flowStrip.noteTitle":"Sent to the next reviewer as the round's ready note","flowStrip.autoTitle":"Auto: transitions run themselves. Click — manual.","flowStrip.manualTitle":"Manual: every transition waits for a click. Click — auto.","flowStrip.manualShort":"manual","flowStrip.resume":"Resume flow","flowStrip.pause":"Pause","flowStrip.close":"Close flow","roundDeck.roundAborted":"Round {n} \xb7 aborted","roundDeck.roundVerdict":"Round {n} \xb7 {verdict}","roundDeck.roundInProgress":"Round {n} \xb7 in progress","roundDeck.aborted":"aborted","roundDeck.reviewInProgress":"review in progress","roundDeck.waitingFirst":"waiting for the first review round…","roundDeck.spawningReviewer":"launching the reviewer — the transcript will appear shortly…","roundDeck.moreRounds":"{count} more round(s) — click the chips on the flow strip","roundDeck.findings":{one:"{count} finding",other:"{count} findings"},"flowState.waiting_ready":"waiting for READY","flowState.spawn_pending":"ready to spawn the reviewer","flowState.spawning":"spawning the reviewer","flowState.reviewing":"reviewing","flowState.relay_pending":"verdict ready — relay?","flowState.relaying":"relaying notes","flowState.fixing":"fixing","flowState.approved":"approved","flowState.done_comment":"done with comments","flowState.needs_decision":"needs a decision","flowState.paused":"paused","flowState.closed":"closed","flowModel.failed":"failed ({status})","scheme.flowTitle":"Run the implement → review cycle for this conversation","scheme.flow":"Flow","scheme.collapsedTitle":"Collapsed branches and tasks of this conversation","scheme.underneath":"underneath","scheme.handTool":"Hand — drag the canvas (H, or hold Space)","scheme.selectTool":"Select — click and work with conversations (V)","scheme.zoomOut":"Zoom out (−)","scheme.zoom100":"Zoom 100% (1)","scheme.zoomIn":"Zoom in (+)","scheme.fit":"Fit all (0, or double-click the background)","scheme.roleImplementer":"Implementer","scheme.roleReviewer":"Reviewer","scheme.roleWorking":"working","scheme.roleWaiting":"waiting","minimap.title":"Minimap — click or drag to navigate","plan.agentPlan":"Agent plan:","plan.stepsAria":"Plan: {done} of {total} steps","plan.nowSuffix":", now: {current}","plan.goal":"goal","plan.goalDone":"goal ✓","plan.goalBlocked":"goal ✖","plan.noObjective":"(objective not recorded in the transcript tail)","plan.tokens":"tokens: {n}","plan.time":"time: {n} min","plan.ctxTitle":"Context window: {pct}% used\n{used} of {window} tokens","plan.ctxAria":"Context: {pct} percent of the window used","plan.goalAria":"Session goal: {status}","limits.now":"now","limits.inMin":"in {n}m","limits.inHour":"in {n}h","limits.inDay":"in {n}d","limits.asOf":"as of {time}","limits.left":"left","limits.reset":"reset {eta} \xb7 {at}","limits.stale":"data is stale: {stale}","limits.5h":"5h","limits.week":"Week","status.awaitingPlan":"awaiting plan approval","status.awaitingAnswer":"awaiting an answer to a question","status.awaitingTerminal":"awaiting a reply in the terminal","status.working":"working…","status.returnedResult":"returned with a result","status.stalled":"interrupted or awaiting permission","status.finishedTurn":"finished the turn — waiting for a reply","status.flow":"flow: {label}","dictation.failed":"couldn't transcribe","dictation.silence":"silence — nothing recognized","dictation.unsupported":"recording is not supported in this browser","dictation.liveError":"live transcription error","dictation.connectionLost":"transcription connection dropped","dictation.noMic":"no microphone access","overview.branchesLiveIn":{one:"{count} branch running in {projects}",other:"{count} branches running in {projects}"},"overview.projects":{one:"{count} project",other:"{count} projects"},"overview.archived":"\xb7 {count} archived","overview.moreLive":"{count} more live","overview.quiet":"quiet \xb7 last activity {age}","overview.empty":"No logs yet","branch.live":"working","branch.waiting":"finished the turn — waiting for a reply","branch.returned":"returned with a result","branch.stalled":"interrupted or awaiting permission","branch.done":"done — safe to remove","branch.worktree":"Worktree {name}","branch.lastActivity":"Last activity: {age}","branch.lastActivityQuiet":"Marked active, but the transcript is quiet: last activity {age}","branch.handoffTitle":"agent spawned by this conversation's handoff","branch.branchTitle":"branch of this conversation","branch.removeColumn":"Remove column {title}","branch.toggleBackground":"{action} background task {title}","branch.collapse":"Collapse","branch.expand":"Expand","tree.quiet":"Quiet conversations and tasks","corner.waitingCount":"\xb7 {count} waiting","corner.openSwitchboard":"Open the agent switchboard","task.working":", working","task.interrupted":", interrupted","task.finished":", finished","task.interruptedBadge":"interrupted","task.finishedBadge":"finished","task.stopFailed":"couldn't stop","task.signalSent":"sent {signal} to PID {pid}","task.confirmKill":"Really kill PID {pid}?","task.killPid":"Kill {pid}","task.confirmKillYes":"Yes, kill","task.stopAria":"Stop process PID {pid}","task.kill":"Kill","task.jobLogHint":"This is a short job log (service events only). Codex's real work is in the full session:","task.openCodexSession":"Open Codex session ({size} kB{activity})","task.rolloutMissing":"This is a short job log. The full Codex rollout session hasn't appeared in the list yet","task.backgroundCommand":"Background command","task.commandNotFound":"The command that started this background task wasn't found in the session transcripts","viewer.closeProjects":"Close the project list","viewer.agentWaiting":"Agent is waiting for a reply","viewer.closeNotification":"Close the notification","mobile.noConvos":"No conversations yet","mobile.map":"Map","mobile.closeMap":"Close the map","mobile.tapNode":"Tap a node — the conversation opens full-screen","mobile.agent":"agent","mobile.openMap":"Open the project map"},uk:{"common.serverUnavailable":"сервер недоступний","common.loading":"завантаження…","common.loadingCap":"Завантаження…","common.cancel":"Скасувати","common.show":"показати","common.showAll":"показати все","common.collapse":"згорнути","common.yes":"Так","common.no":"Ні","common.send":"Надіслати","common.sending":"надсилаю…","common.sent":"надіслано","common.close":"Закрити","common.failedSend":"не вдалося надіслати","common.failedDelete":"не вдалося видалити","common.nothingFound":"Нічого не знайдено","common.nothingRunning":"зараз нічого не працює","common.kb":"кБ","common.chars":"{n} симв.","lang.aria":"Мова інтерфейсу","util.effortTitle":"Зусилля міркування: {effort}","time.agoSec":"{n} с тому","time.agoMin":"{n} хв тому","time.agoHour":"{n} год тому","time.agoDay":"{n} д тому","kind.session":"сесія","kind.subagent":"субагент","kind.job":"джоба","kind.background":"фон","kind.handoff":"хендофф","rail.title":"Логи агентів","rail.filter":"Фільтр проєктів…","rail.projects":"Проєкти","rail.overview":"Огляд","rail.archive":"Архів","dash.branchesLive":{one:"{count} гілка працює",few:"{count} гілки працюють",many:"{count} гілок працюють",other:"{count} гілок працюють"},"dash.trees":{one:"{count} дерево",few:"{count} дерева",many:"{count} дерев",other:"{count} дерев"},"dash.recentConvos":{one:"{count} нещодавня розмова",few:"{count} нещодавні розмови",many:"{count} нещодавніх розмов",other:"{count} нещодавніх розмов"},"dash.quietTrees":{one:"{count} тихе дерево",few:"{count} тихі дерева",many:"{count} тихих дерев",other:"{count} тихих дерев"},"dash.openProjects":"Відкрити список проєктів","dash.unarchive":"Повернути з архіву","dash.newConvo":"Нова розмова з агентом","dash.agent":"Агент","dash.emptyTitle":"На схемі поки порожньо","dash.emptyHint":"Відкрий пульт у правому нижньому куті і клікни розмову — вона з'явиться тут","trash.title":"На схемі порожньо, але в проєкті є записи","trash.hint":"Клік по рядку відкриває розмову нодою; смітник видаляє її файл з диска назавжди.","trash.deletedFromDisk":"\xb7 видалено з диска","trash.open":"Відкрити {title}","trash.toArchive":"В архів","trash.notDeleted":"не видалено {failed} з {total}","trash.confirmDelete":{one:"Видалити з диска {count} файл проєкту?",few:"Видалити з диска {count} файли проєкту?",many:"Видалити з диска {count} файлів проєкту?",other:"Видалити з диска {count} файлів проєкту?"},"trash.deleting":"видаляю…","trash.confirmYes":"Так, видалити","trash.deleteProject":"Видалити проєкт з диска","switch.aria":"Пульт агентів","switch.title":"Пульт","switch.search":"Пошук за назвою або проєктом","switch.updating":"оновлення…","switch.close":"Закрити пульт","switch.waiting":"Чекає тебе","switch.working":"Працюють","switch.recent":"Нещодавні","switch.older":"Старіше","switch.hidden":"Приховані ({count})","switch.hide":"сховати","switch.restore":"повернути","switchCard.openColumn":"Відкрити колонкою {title}","switchCard.remove":"Прибрати з пульта","composer.imagesCount":{one:"{count} картинка",few:"{count} картинки",many:"{count} картинок",other:"{count} картинок"},"composer.spawned":"запущено агента в tmux {target}","composer.sentPaths":"надіслано {count} шлях(и)","composer.failedInterrupt":"не вдалося перервати","composer.escapeSent":"надіслано Escape — агент перервано","composer.spawnAria":"Запустити агента з промптом у tmux","composer.sendAria":"Надіслати повідомлення агенту в tmux {target}","composer.queueAria":"Черга надісланих повідомлень","composer.removeFromQueue":"Прибрати з черги","composer.placeholderRelay":"написати — передам через кореневу сесію…","composer.placeholderSpawn":"промпт — агент запуститься в tmux…","composer.placeholderSend":"написати агенту…","composer.textAria":"Текст для агента","composer.titleRelay":"передасться через кореневу сесію гілки","composer.titleSpawnResumed":"нове tmux-вікно з відновленим агентом","composer.root":"корінь","composer.interruptAria":"Перервати агента (Escape)","composer.interruptTitle":"надіслати Escape у пейн агента","composer.compactAria":"Стиснути контекст агента (/compact)","composer.compactTitle":"надіслати /compact — агент стисне контекст; після завершення у стрічці з'явиться позначка","composer.compactConfirm":"Точно?","composer.compactConfirmTitle":"Натисни ще раз, щоб надіслати /compact","composer.compactSent":"стискання почалось — позначка з'явиться у стрічці, щойно завершиться","composer.failedCompact":"не вдалося запустити стискання","composer.addImages":"Додати картинки","composer.stopAndSend":"Зупинити запис і надіслати","composer.launchAgent":"Запустити агента","composer.sendToAgent":"Надіслати агенту","composer.stopAndSendTitle":"зупинити запис і надіслати","draft.readPrompt":"Прочитай розмову агента у файлі {src} і продовж роботу звідти: ","draft.needDir":"вкажи робочу директорію","draft.launchFailed":"не вдалося запустити","draft.paneAria":"Чернетка нової розмови з агентом","draft.notStarted":"агент ще не запущений","draft.engineAria":"Двигун агента","draft.handoffLabel":"хендофф: {title}","draft.newConvo":"нова розмова","draft.conversation":"розмова","draft.dismiss":"Прибрати чернетку розмови","draft.directory":"директорія","draft.dirAria":"Робоча директорія агента","draft.imagesOnly":"(картинки)","draft.launched":"агент запущений у tmux {target} — чекаю, поки розмова з'явиться тут…","draft.slow":"Щось довго. Перевір вікно tmux {target} — щойно транскрипт з'явиться, панель підхопить його сама.","draft.hintRelay":"Новий агент спершу прочитає транскрипт батьківської розмови і продовжить з того місця. Допиши в промпт, що зробити далі, — гілка з'явиться на схемі поруч.","draft.hintNew":"Обери двигун і директорію, напиши перший промпт — агент запуститься в tmux, і розмова продовжиться в цій самій панелі.","draft.promptAria":"Перший промпт для нового агента","draft.placeholder":"перший промпт — агент запуститься в tmux…","draft.promptTextAria":"Текст першого промпта","draft.newWindowTitle":"нове tmux-вікно зі свіжим агентом","draft.newAgent":"новий агент","draft.addImages":"Додати картинки до промпта","draft.stopAndLaunch":"Зупинити запис і запустити агента","link.handoffContext":"Тобі передали контекст іншого агента — розмову \xab{title}\xbb. Її транскрипт: {path} — спочатку прочитай цей файл, щоб мати повний контекст, а тоді виконай прохання нижче.\n\n{ask}","link.dropped":"контекст у промпті \xab{title}\xbb — допиши прохання і надішли","handoff.aria":"Перекинути розмову новому агентові — чернетка з'явиться нижче","handoff.title":"клік — чернетка нового агента з цим контекстом \xb7 потягни — звʼязати з наявним","handoff.label":"перекинути агенту","qr.showAria":"Показати QR для входу з телефона","qr.failed":"не вдалося отримати посилання","qr.startHint":"Запустіть viewer з доступом через Tailscale: ","qr.alt":"QR код для входу з телефона","qr.generating":"генерую QR…","qr.linkAria":"Посилання для входу з телефона","qr.copy":"Копіювати посилання","qr.scanHint":"скануй з телефона в тому ж tailnet","push.enabled":"Push-сповіщення увімкнено","push.enable":"Увімкнути push-сповіщення","push.disable":"Вимкнути push-сповіщення","push.needsHttps":"Push потребує HTTPS","sound.on":"Звукові сповіщення увімкнено","sound.off":"Звукові сповіщення вимкнено","sound.mute":"Вимкнути звукові сповіщення","sound.unmute":"Увімкнути звукові сповіщення","mic.stopRecognize":"Зупинити запис і розпізнати","mic.cancel":"Скасувати запис","mic.recognizing":"Розпізнаю…","mic.dictate":"Надиктувати","mic.dictateHint":"надиктувати (до 2 хв)","delFile.confirm":"Видалити з диска?","delFile.aria":"Видалити розмову з диска","img.readFailed":"не вдалося прочитати картинку","img.readAborted":"читання картинки перервано","img.unsupported":"непідтримуваний формат картинки: {name}","img.unknownFile":"невідомий файл","img.tooLarge":"{name}: завелика (ліміт 10 МБ)","img.image":"картинка","img.error":"помилка картинки","img.previewAlt":"прев'ю картинки {n}","img.removeAria":"Прибрати картинку {n}","img.toFilePaths":"шляхами до файлів","question.sec":"{n} с","question.min":"{n} хв","question.hour":"{n} год","question.waiting":"чекає на відповідь","question.sentToPane":"Надіслано в пейн: {text}","question.keysHint":"клавіші в пейн \xb7 або композер нижче","question.pane":"Пейн {target}","question.alreadyAnswered":"відповідь уже записана","question.openFailed":"не вдалося відкрити сесію","question.opened":"відкрито {target}","question.answered":"Відповідено: {text}","question.answeredElsewhere":"Відповідено в іншому місці: {text}","question.noPane":"tmux-пейн недоступний","question.openSession":"відкрити сесію","question.rejectComment":"Коментар до відхилення…","question.approved":"затверджено","question.rejected":"відхилено","question.approve":"Затвердити","question.reject":"Відхилити","question.ownAnswer":"Своя відповідь…","inbox.deleted":"видалено з диска","inbox.fileGone":"файла вже немає на диску","inbox.confirmDelete":"Видалити файл з диска?","inbox.deleteAria":"Видалити {name} з диска","inbox.deleteFromDisk":"видалити з диска","inbox.attachedAlt":"вкладена картинка {name}","lightbox.zoomOut":"Зменшити","lightbox.resetZoom":"Скинути масштаб","lightbox.zoomIn":"Збільшити","feed.agentEnded":"агент завершився","feed.running":"виконує {tool}…","feed.tool":"інструмент","feed.thinking":"думає…","feed.working":"працює…","feed.liveTail":"живий хвіст","feed.backToLive":"Повернутись до живого хвоста","feed.newCount":"{count} нових","feed.down":"вниз","feed.pickLog":"Вибери лог зліва — стрічка оновлюється сама","feed.showEarlier":"показати раніше","feed.showEarlierHidden":"показати раніше (сховано {count})","feed.loadEarlier":"завантажити раніше з файлу","feed.startOfConvo":"початок розмови","feed.finishedTurn":"закінчив хід — чекає відповіді","feed.returnedResult":"повернувся з результатом","feed.noOutput":"Ще без виводу — файл поки порожній","feed.onlyService":"Є лише службові записи ({count}).","feed.empty":"Порожньо (немає рядків для показу)","render.system":"системне","render.executing":"виконується…","render.error":"помилка","render.teammate":"тімейт","render.left":"{peer}: звільнився{at}","render.codexSessionCreated":"Сесія Codex створена","render.taskStarted":"Задача стартувала","render.taskComplete":"Задачу завершено","render.compacted":"контекст стиснуто","render.compactAuto":"авто","render.compactManual":"вручну","render.compactPre":"{n}k токенів до","render.compactSummary":"підсумок розмови","render.patch":"патч","render.stdinSession":"stdin → сесія {id}","render.record":"запис","render.protocol":"протокол","render.jobLogNote":"(це джоб-лог: він не містить stdout команд; повний вивід — у rollout-сесії Codex у списку зліва)","render.image":"зображення","render.dataKb":"даних {n} КБ","render.commands":{one:"{count} команда",few:"{count} команди",many:"{count} команд",other:"{count} команд"},"render.noFindings":"без findings","render.moreFindings":"ще {count} findings у raw","render.memoryCitations":"цитати пам'яті ({count})","render.noCitations":"без citation entries","render.moreEntries":"ще {count} entries у raw","render.truncated":"обрізано","render.shutdownRequest":"запит на завершення","render.shutdownResponse":"відповідь на завершення","render.planRequest":"запит на затвердження плану","render.planVerdict":"вердикт по плану","render.approved":"схвалено","render.rejected":"відхилено","render.from":"від {from}","render.structured":"структуроване повідомлення","render.showJson":"показати JSON","render.noOutputInLog":"(вивід у цьому лог-файлі відсутній — повний є в rollout-сесії Codex)","render.filesChanged":"файли змінені","render.toDir":"до","render.fromDir":"від","render.delivered":"доставлено","render.notDelivered":"не доставлено","render.reasoning":"міркування агента","flowDialog.engine":"Двигун: {label}","flowDialog.modelPlaceholder":"модель (дефолт)","flowDialog.model":"Модель: {label}","flowDialog.effortDefault":"effort: дефолт","flowDialog.createFailed":"не вдалося створити флоу ({status})","flowDialog.title":"Запустити флоу","flowDialog.subtitle":"implement → review \xb7 ця розмова стає виконавцем","flowDialog.preset":"пресет","flowDialog.rolesManualOpen":"▾ ролі вручну","flowDialog.rolesManual":"▸ ролі вручну (модель / effort)","flowDialog.implementer":"виконавець","flowDialog.reviewer":"ревʼюер","flowDialog.diffBase":"база діфу","flowDialog.fromHead":"від поточного HEAD","flowDialog.fromMergeBase":"від merge-base з main","flowDialog.headless":"headless (без панелі)","flowDialog.tmuxPane":"tmux-панель","flowDialog.transitions":"переходи","flowDialog.auto":"авто","flowDialog.manual":"вручну (гейт на кожен крок)","flowDialog.roundLimit":"ліміт раундів","flowDialog.creating":"створюю…","flowDialog.start":"▶ Запустити","flowStrip.startReview":"Почати ревью","flowStrip.spawnReviewer":"Заспавнити ревʼюера","flowStrip.relayNotes":"Передати зауваження","flowStrip.retryRound":"Повторити раунд","flowStrip.anotherRound":"Ще коло","flowStrip.flow":"ФЛОУ","flowStrip.roundsAria":"Раунди ревью","flowStrip.roundError":"Раунд {n}: {error}","flowStrip.roundVerdict":"Раунд {n}: {verdict}","flowStrip.roundInProgress":"Раунд {n}: триває","flowStrip.addRoundsTitle":"Додати ще раунди до ліміту","flowStrip.plus2":"+2 раунди","flowStrip.limitTitle":"Ліміт раундів: скільки ревью до зупинки (∞ — без ліміту)","flowStrip.limitAria":"Встановити ліміт раундів: {count}","flowStrip.limitUnlimitedAria":"Без ліміту раундів","flowStrip.stopReviewer":"Стоп","flowStrip.stopReviewerTitle":"Зупинити поточного ревʼюера; раунд перейде в \xabпотрібне рішення\xbb","flowStrip.notePlaceholder":"нотатка ревʼюеру…","flowStrip.noteTitle":"Піде наступному ревʼюеру як ready-нотатка раунду","flowStrip.autoTitle":"Авто: переходи самі. Клік — вручну.","flowStrip.manualTitle":"Вручну: кожен перехід чекає кліку. Клік — авто.","flowStrip.manualShort":"вручну","flowStrip.resume":"Продовжити флоу","flowStrip.pause":"Пауза","flowStrip.close":"Закрити флоу","roundDeck.roundAborted":"Раунд {n} \xb7 перервано","roundDeck.roundVerdict":"Раунд {n} \xb7 {verdict}","roundDeck.roundInProgress":"Раунд {n} \xb7 триває","roundDeck.aborted":"перервано","roundDeck.reviewInProgress":"ревью триває","roundDeck.waitingFirst":"чекаю на перший раунд ревью…","roundDeck.spawningReviewer":"запускаю ревʼюера — транскрипт зʼявиться за мить…","roundDeck.moreRounds":"ще {count} раунд(и) — клікни чипи на стрічці флоу","roundDeck.findings":{one:"{count} знахідка",few:"{count} знахідки",many:"{count} знахідок",other:"{count} знахідок"},"flowState.waiting_ready":"чекає READY","flowState.spawn_pending":"готовий спавнити ревʼюера","flowState.spawning":"запускаю ревʼюера","flowState.reviewing":"ревью","flowState.relay_pending":"вердикт є — передати?","flowState.relaying":"передаю зауваження","flowState.fixing":"фікси","flowState.approved":"затверджено","flowState.done_comment":"готово із зауваженнями","flowState.needs_decision":"потребує рішення","flowState.paused":"пауза","flowState.closed":"закрито","flowModel.failed":"не вдалося ({status})","scheme.flowTitle":"Запустити цикл implement → review для цієї розмови","scheme.flow":"Флоу","scheme.collapsedTitle":"Згорнуті гілки й задачі цієї розмови","scheme.underneath":"під сподом","scheme.handTool":"Рука — тягнути полотно (H, або тримай Space)","scheme.selectTool":"Виділення — клік і робота з розмовами (V)","scheme.zoomOut":"Віддалити (−)","scheme.zoom100":"Масштаб 100% (1)","scheme.zoomIn":"Наблизити (+)","scheme.fit":"Вписати все (0, або подвійний клік по фону)","scheme.roleImplementer":"Імплементер","scheme.roleReviewer":"Ревʼюер","scheme.roleWorking":"працює","scheme.roleWaiting":"чекає","minimap.title":"Мінімапа — клікни або тягни, щоб перейти","plan.agentPlan":"План агента:","plan.stepsAria":"План: {done} з {total} кроків","plan.nowSuffix":", зараз: {current}","plan.goal":"ціль","plan.goalDone":"ціль ✓","plan.goalBlocked":"ціль ✖","plan.noObjective":"(objective не записаний у хвості транскрипта)","plan.tokens":"токенів: {n}","plan.time":"часу: {n} хв","plan.ctxTitle":"Контекстне вікно: використано {pct}%\n{used} з {window} токенів","plan.ctxAria":"Контекст: використано {pct} відсотків вікна","plan.goalAria":"Ціль сесії: {status}","limits.now":"зараз","limits.inMin":"через {n} хв","limits.inHour":"через {n} год","limits.inDay":"через {n} д","limits.asOf":"станом на {time}","limits.left":"лишилось","limits.reset":"скид {eta} \xb7 {at}","limits.stale":"дані застарілі: {stale}","limits.5h":"5 год","limits.week":"Тиждень","status.awaitingPlan":"чекає затвердження плану","status.awaitingAnswer":"чекає відповіді на питання","status.awaitingTerminal":"чекає на відповідь у терміналі","status.working":"працює…","status.returnedResult":"повернувся з результатом","status.stalled":"перервано або чекає дозволу","status.finishedTurn":"закінчив хід — чекає відповіді","status.flow":"флоу: {label}","dictation.failed":"не вдалося розпізнати","dictation.silence":"тиша — нічого не розпізналось","dictation.unsupported":"запис не підтримується в цьому браузері","dictation.liveError":"помилка live-транскрипції","dictation.connectionLost":"зʼєднання з транскрипцією обірвалось","dictation.noMic":"немає доступу до мікрофона","overview.branchesLiveIn":{one:"{count} гілка працює у {projects}",few:"{count} гілки працюють у {projects}",many:"{count} гілок працюють у {projects}",other:"{count} гілок працюють у {projects}"},"overview.projects":{one:"{count} проєкті",few:"{count} проєктах",many:"{count} проєктах",other:"{count} проєктах"},"overview.archived":"\xb7 {count} в архіві","overview.moreLive":"ще {count} live","overview.quiet":"тихо \xb7 остання активність {age}","overview.empty":"Логів поки нема","branch.live":"працює","branch.waiting":"закінчив хід — чекає відповіді","branch.returned":"повернувся з результатом","branch.stalled":"перервано або чекає дозволу","branch.done":"завершено — можна прибрати","branch.worktree":"Ворк-дерево {name}","branch.lastActivity":"Остання активність: {age}","branch.lastActivityQuiet":"Позначений активним, але транскрипт мовчить: остання активність {age}","branch.handoffTitle":"агент, породжений хендоффом цієї розмови","branch.branchTitle":"гілка цієї розмови","branch.removeColumn":"Прибрати колонку {title}","branch.toggleBackground":"{action} фонову задачу {title}","branch.collapse":"Згорнути","branch.expand":"Розгорнути","tree.quiet":"Тихі розмови й задачі","corner.waitingCount":"\xb7 {count} чекають","corner.openSwitchboard":"Відкрити пульт агентів","task.working":", працює","task.interrupted":", перервано","task.finished":", закінчив","task.interruptedBadge":"перервано","task.finishedBadge":"завершено","task.stopFailed":"помилка зупинки","task.signalSent":"надіслано {signal} PID {pid}","task.confirmKill":"Точно вбити PID {pid}?","task.killPid":"Вбити {pid}","task.confirmKillYes":"Так, вбити","task.stopAria":"Зупинити процес PID {pid}","task.kill":"Вбити","task.jobLogHint":"Це короткий джоб-лог (лише службові події). Реальна робота Codex — у повній сесії:","task.openCodexSession":"Відкрити сесію Codex ({size} kB{activity})","task.rolloutMissing":"Це короткий джоб-лог. Повна rollout-сесія Codex ще не з'явилась у списку","task.backgroundCommand":"Фонова команда","task.commandNotFound":"Команду, що запустила цю фонову задачу, не знайдено у транскриптах сесії","viewer.closeProjects":"Закрити список проєктів","viewer.agentWaiting":"Агент чекає відповіді","viewer.closeNotification":"Закрити сповіщення","mobile.noConvos":"Розмов поки нема","mobile.map":"Карта","mobile.closeMap":"Закрити карту","mobile.tapNode":"Тапни вузол — розмова відкриється на весь екран","mobile.agent":"агент","mobile.openMap":"Відкрити карту проєкту"}},a="llv_lang",o="en",c=!1,d=new Set;function u(){return c||(c=!0,o=function(){try{let e=window.localStorage.getItem(a);if("en"===e||"uk"===e)return e}catch{}return("u">typeof navigator?navigator.language:"").toLowerCase().startsWith("uk")?"uk":"en"}(),document.documentElement.lang=o),o}function p(e){if(c=!0,e!==o){o=e;try{window.localStorage.setItem(a,e)}catch{}for(let t of("u">typeof document&&(document.documentElement.lang=e),d))t()}}function m(e){return d.add(e),()=>d.delete(e)}function f(e,t,n){var r;let i,l=s[e][t]??s.en[t]??t;if("string"==typeof l)i=l;else{let t="number"==typeof n?.count?n.count:0;i=l[new Intl.PluralRules("uk"===e?"uk-UA":"en-US").select(t)]??l.other??l.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,u,()=>"en");return{locale:e,t:(t,n)=>f(e,t,n),setLocale:p}}function x(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__",b=e=>Math.floor(e/300);function w(e){return"live"===e.activity?0:"recent"===e.activity?1:"stalled"===e.activity?2:3}function v(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 k(e){return"shell"===e.engine||"codex-jobs"===e.root}function N(e){return e.project||"інше"}function S(e){let t=new Map;for(let n of e){let e=N(n),r=t.get(e);r||(r={project:e,liveCount:0,attentionCount:0,conversations:0,smt:0},t.set(e,r)),"live"===n.activity&&(r.liveCount+=1),(n.pendingQuestion||n.waitingInput)&&(r.attentionCount+=1),v(n)&&(r.conversations+=1),r.smt=Math.max(r.smt,n.mtime)}return[...t.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:b(t.smt)-b(e.smt)||e.project.localeCompare(t.project)})}function C(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 A(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){return!k(e)&&("live"===e.activity||"recent"===e.activity&&j(e))}function M(e,t){let n=new Map(e.map(e=>[e.path,e])),r=C(e),i=new Map,l=new Map;for(let r of e)if(N(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);k(e)?l.set(e.path,e):i.set(e.path,e);continue}"recent"===r.activity&&v(r)&&i.set(r.path,r)}let s=[...i.values()].map(e=>(function(e,t,n){let r=A(e,t),i=r.filter($).sort((e,t)=>("live"!==e.activity)-("live"!==t.activity)||b(t.mtime)-b(e.mtime)||e.path.localeCompare(t.path)),l=r.filter(e=>k(e)&&"live"===e.activity).sort((e,t)=>b(t.mtime)-b(e.mtime)||e.path.localeCompare(t.path)),s=[e,...i].map(e=>({file:e,tasks:[]})),a=new Map(s.map(e=>[e.file.path,e]));for(let e of l)(e.parent&&a.get(e.parent)||s[0]).tasks.push(e);let o=new Set([...a.keys(),...l.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)),m=Math.max(...s.map(e=>e.file.mtime),...l.map(e=>e.mtime));return{key:e.path,columns:s,returnable:d,finished:p,smt:m,orphanTask:!1}})(e,r,n));for(let e of l.values())s.push({key:e.path,columns:[{file:e,tasks:[]}],returnable:[],finished:[],smt:e.mtime,orphanTask:!0});return s.sort((e,t)=>e.orphanTask!==t.orphanTask?e.orphanTask?1:-1:b(t.smt)-b(e.smt)||e.key.localeCompare(t.key))}let E="llv:flows-changed",R=new Set,D=R,T=new Set;function P(e){return T.add(e),()=>T.delete(e)}let I=new Set;function _(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 L(e,t){return e(`flowState.${t}`)}let O=new Set(["spawn_pending","relay_pending","needs_decision","paused","approved"]),z=new Set(["spawning","reviewing","relaying","fixing"]);function F(e){return"spawning"===e.state||"reviewing"===e.state?"reviewer":"waiting_ready"===e.state||"relaying"===e.state||"fixing"===e.state?"implementer":null}let U={APPROVE:"✓",REQUEST_CHANGES:"✖",COMMENT:"◆"};function H(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 B(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(!R.has(e))for(let t of(R.add(e),D=new Set(R),T))t()}(e),window.dispatchEvent(new Event(E)),null;let r=await n.json().catch(()=>null);return r?.error??f(u(),"flowModel.failed",{status:n.status})}catch{return f(u(),"common.serverUnavailable")}}function W(e){let t=u(),n=Date.now()/1e3-e;return n<90?f(t,"time.agoSec",{n:Math.round(n)}):n<5400?f(t,"time.agoMin",{n:Math.round(n/60)}):n<129600?f(t,"time.agoHour",{n:Math.round(n/3600)}):f(t,"time.agoDay",{n:Math.round(n/86400)})}function Y(e){if("string"!=typeof e&&"number"!=typeof e)return"";let t=new Date(e),n="uk"===u()?"uk-UA":"en-US";return Number.isNaN(t.getTime())?"":t.toLocaleTimeString(n,{hour12:!1})}function J(e){return"live"===e?"animate-pulse bg-ok":"recent"===e?"bg-[#d29a2f]":"stalled"===e?"bg-err":"bg-[#c9c9d1]"}let K={codex:{color:"#2f6fd0",soft:"#e8f0fb"},claude:{color:"#d97757",soft:"#faeee9"}},Q={color:"#9a9aa4",soft:"#ececf1"},X=[[/fable|mythos/,{color:"#c2410c",soft:"#fbeade"}],[/opus/,{color:"#8a5ad6",soft:"#f1ebfb"}],[/sonnet/,{color:"#e0913f",soft:"#fbf1e4"}],[/haiku/,{color:"#d9a58c",soft:"#f9f1ec"}]],V=[[/spark/,{color:"#5ea3e4",soft:"#ecf4fd"}],[/mini|nano/,{color:"#7fb1e8",soft:"#eff6fd"}],[/codex/,{color:"#1d55ab",soft:"#e4edfa"}]];function G(e){let t=K[e.engine];if(!t)return Q;let n=(e.model??"").toLowerCase();for(let[t,r]of"codex"===e.engine?V:X)if(t.test(n))return r;return t}let Z={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 ee(e,t,n){let[r,i,l]=function(e){let t=parseInt(e.slice(1),16),n=(t>>16&255)/255,r=(t>>8&255)/255,i=(255&t)/255,l=Math.max(n,r,i),s=Math.min(n,r,i),a=(l+s)/2,o=l-s;if(0===o)return[0,0,100*a];let c=o/(1-Math.abs(2*a-1));return[60*(l===n?((r-i)/o+6)%6:l===r?(i-n)/o+2:(n-r)/o+4),100*c,100*a]}(e),s=e=>Math.min(100,Math.max(0,e));return`hsl(${Math.round(r)} ${Math.round(s(i+n))}% ${Math.round(s(l+t))}%)`}function et(e){let t=G(e),n=Z[e.effort??""];return n?{color:ee(t.color,n.dl,n.ds),soft:ee(t.soft,Math.round(n.dl/3),Math.round(n.ds/2))}:t}function en(e){return e.effort?f(u(),"util.effortTitle",{effort:e.effort}):void 0}function er(e){return G(e).color}function ei(e){return{borderTopColor:G(e).color}}function el(e){let t={codex:"Codex",claude:"Claude",shell:"Bash"}[e.engine]??e.engine,n=K[e.engine]??Q;return{label:t,style:{backgroundColor:n.soft,color:n.color}}}function es(e,t){return Math.floor(t.smt/300)-Math.floor(e.smt/300)||e.file.path.localeCompare(t.file.path)}function ea(e){return y(e)&&"running"!==e.proc}function eo(e,t=Date.now()/1e3){return!!e.pendingQuestion||!!e.waitingInput||("stalled"===e.activity?!ea(e)&&t-e.mtime<=7200:"recent"===e.activity&&("claude"===e.engine||"codex"===e.engine)&&v(e)&&!y(e))}function ec(e,t,n,r,i=ed,s=eu){let{locale:a}=h();return(0,l.useMemo)(()=>{let l=(e,t)=>f(a,e,t),o=function(e){let t=C(e),n=new Map;for(let r of e)n.set(r.path,A(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=_(s),u=q(s),p=n.trim().toLowerCase(),m=e.filter(e=>!i.has(e.path)&&!u.has(e.path)&&(v(e)||"live"===e.activity||"stalled"===e.activity||"recent"===e.activity&&!k(e))).map(e=>{let t=N(e),n=x(e.title),i=r-e.mtime,s=d.get(e.path),a=e.pendingQuestion||e.waitingInput?"waiting":"live"===e.activity?"working":eo(e,r)?"waiting":i<=86400?"recent":"older",u=function(e,t,n){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 r=n.get(t.path);return r?`${r.label} \xb7 ${W(r.ts)}`:"live"===t.activity?e("status.working"):ea(t)?e("status.returnedResult"):"stalled"===t.activity?e("status.stalled"):eo(t)?e("status.finishedTurn"):""}(l,e,c);return s&&(O.has(s.state)?a="waiting":("reviewing"===s.state||"relaying"===s.state||"spawning"===s.state)&&(a="working"),u=`${l("status.flow",{label:L(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)),h=(e,t)=>t.smt-e.smt||e.file.path.localeCompare(t.file.path),g=m.filter(e=>"waiting"===e.kind).sort(h),b=m.filter(e=>"working"===e.kind).sort(h);return{waiting:g,working:b,recent:m.filter(e=>"recent"===e.kind).sort(es),older:m.filter(e=>"older"===e.kind).sort(es),livePreview:b.slice(0,3)}},[e,t,n,r,i,s,a])}let ed=new Set,eu=[];function ep(e,t=Date.now()/1e3){return e.pendingQuestion||e.waitingInput?"waiting":"live"===e.activity?"live":"recent"===e.activity&&j(e)&&"running"!==e.proc?"returned":eo(e,t)?"stalled"===e.activity?"stalled":"waiting":"done"}let em="llvSound";function ef(){try{return"off"!==localStorage.getItem(em)}catch{return!0}}let eh=new Map,ex=null;function eg(){if(!ex){let e=window.AudioContext??window.webkitAudioContext;if(!e)return null;ex=new e}return ex}let eb={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 ew(e,t,n=0){if(!ef())return;let r=eg();if(!r)return;if("running"!==r.state)return void r.resume().catch(()=>void 0);let i=r.currentTime+.02+n/1e3,l=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),l=e}for(let t of eb[e])!function(e,t,n,r){let i=r+n.at,l=e.createOscillator();l.type="sine",l.frequency.value=n.freq;let s=e.createGain();s.gain.setValueAtTime(0,i),s.gain.linearRampToValueAtTime(.07,i+.012),s.gain.exponentialRampToValueAtTime(4e-4,i+n.dur),l.connect(s).connect(t),l.start(i),l.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,l,t,i)}let ev={waiting:"waiting",returned:"returned",stalled:"stalled"},ey="llvArchivedProjects";function ej(e){try{window.localStorage.setItem(ey,JSON.stringify([...e]))}catch{}}let ek={files:[],flows:[]},eN="(max-width: 767px)";function eS(e){let t=window.matchMedia(eN);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}function eC(){return(0,l.useSyncExternalStore)(eS,()=>window.matchMedia(eN).matches,()=>!1)}var eA=n(6304);let e$=[[1920,4],[1440,3],[1024,2]];function eM({files:e,archivedProjects:t,onSelectProject:n,onSelectFile:i,onMenu:s}){let{t:a}=h(),o=function(){let[e,t]=(0,l.useState)(3);return(0,l.useEffect)(()=>{let e=()=>t(function(){for(let[e,t]of e$)if(window.innerWidth>=e)return t;return 1}());return window.addEventListener("resize",e),e(),()=>window.removeEventListener("resize",e)},[]),e}(),c=(0,l.useMemo)(()=>S(e),[e]),d=(0,l.useMemo)(()=>c.filter(e=>!t.has(e.project)),[c,t]),u=c.length-d.length,p=(0,l.useMemo)(()=>d.reduce((e,t)=>e+t.liveCount,0),[d]),m=d.filter(e=>e.liveCount>0).length,f=(0,l.useMemo)(()=>d.map(t=>{let n=M(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=>N(e)===t.project).sort((e,t)=>t.mtime-e.mtime)[0];return{summary:t,liveBranches:r,moreLive:n.length-r.length,latest:i}}),[e,d]);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:[s?(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":a("dash.openProjects"),onClick:s,children:(0,r.jsx)(eA.A,{className:"h-4 w-4","aria-hidden":!0})}):null,(0,r.jsx)("h1",{className:"text-[13.5px] font-bold",children:a("rail.overview")}),(0,r.jsxs)("span",{className:"text-[11.5px] text-dim",children:[p?a("overview.branchesLiveIn",{count:p,projects:a("overview.projects",{count:m})}):a("common.nothingRunning"),u?` ${a("overview.archived",{count:u})}`:""]})]}),(0,r.jsxs)("div",{className:"grid flex-1 auto-rows-min gap-2.5 overflow-y-auto p-3",style:{gridTemplateColumns:`repeat(${o}, minmax(0, 1fr))`},children:[f.map(({summary:e,liveBranches:t,moreLive:l,latest:s})=>(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:()=>n(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=el(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:x(e.title),onClick:t=>{t.stopPropagation(),i(e)},onKeyDown:t=>{"Enter"===t.key&&(t.stopPropagation(),i(e))},children:[(0,r.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${J(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:x(e.title,70)})]},e.path)}),l>0?(0,r.jsx)("span",{className:"px-1 text-[10.5px] font-semibold text-dim",children:a("overview.moreLive",{count:l})}):null]}):(0,r.jsx)("span",{className:"text-[11px] text-dim",children:a("overview.quiet",{age:s?W(s.mtime):"—"})})]},e.project)),d.length?null:(0,r.jsx)("div",{className:"col-span-full mt-[20vh] text-center text-dim",children:a("overview.empty")})]})]})}var eE=n(5480),eR=n(6408),eD=n(2159),eT=n(7218),eP=n(9805),eI=n(467),e_=n(99),eq=n(7381),eL=n(5045),eO=n(4577),ez=n(6721),eF=n(4088),eU=n(4962),eH=n(5222),eB=n(4885),eW=n(6210),eY=n(5796),eJ=n(4551),eK=n(5688),eQ=n(6619),eX=n(6851),eV=n(852),eG=n(4179),eZ=n(5738),e0=n(7990),e1=n(6449),e5=n(8910),e2=n(7979),e3=n(5561),e4=n(966),e6=n(2750),e8=n(2571);let e9={shell:ez.A,tool:e0.A,"cmd-group":e1.A,codex:eH.A,claude:eX.A,image:eW.A,blob:e5.A,note:e2.A,citation:e3.A,message:eY.A,shutdown:e4.A,plan:e6.A,compact:eB.A};function e7({name:e,className:t}){let n=e9[e];return(0,r.jsx)(n,{className:t??"h-3.5 w-3.5","aria-hidden":!0})}var te=n(8747),tt=n(7650);function tn({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 tr={"image/png":"png","image/jpeg":"jpg","image/jpg":"jpg","image/gif":"gif","image/webp":"webp"};function ti(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>{let i=String(r.result),l=i.indexOf(",");l<0?n(Error(f(u(),"img.readFailed"))):t({base64:i.slice(l+1),mime:e.type||"image/png",preview:i})},r.onerror=()=>n(r.error??Error(f(u(),"img.readFailed"))),r.onabort=()=>n(Error(f(u(),"img.readAborted"))),r.readAsDataURL(e)})}function tl({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,l)=>(0,r.jsxs)("div",{className:"group/img relative",children:[(0,r.jsx)("img",{src:e.preview,alt:n("img.previewAlt",{n:l+1}),className:"h-10 w-10 rounded border border-line object-cover"}),(0,r.jsx)("button",{type:"button",onClick:()=>t(l),"aria-label":n("img.removeAria",{n:l+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)(i.A,{className:"h-2.5 w-2.5","aria-hidden":!0})})]},l)),(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)(eI.A,{className:"h-3 w-3","aria-hidden":!0})," ",n("img.toFilePaths")]})]}):null}function ts({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)(eW.A,{className:"h-4 w-4","aria-hidden":!0})})]})}function ta({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),[p,m]=(0,l.useState)(!1),[x,g]=(0,l.useState)(null),b=(0,l.useRef)(null),w=function(e){let[t,n]=(0,l.useState)([]),r=t=>{if(!t.length)return;let r=[];for(let n of t){if(null===(tr[n.type]??null)){e.onError(f(u(),"img.unsupported",{name:n.name||n.type||f(u(),"img.unknownFile")}));continue}if(n.size>0xa00000){e.onError(f(u(),"img.tooLarge",{name:n.name||f(u(),"img.image")}));continue}r.push(n)}if(!r.length)return;let i=r.length<t.length;Promise.all(r.map(ti)).then(t=>{n(e=>[...e,...t]),i||e.onAdded?.()}).catch(t=>{e.onError(t instanceof Error?t.message:f(u(),"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=>g({kind:"err",text:e}),onAdded:()=>g(null)}),v=e=>{o(t=>t?t.trimEnd()+" "+e:e),g(null),b.current?.focus()},y=function({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)([]),m=(0,l.useRef)(null),f=(0,l.useRef)(!1),x=(0,l.useRef)(null),g=(0,l.useRef)(null),b=(0,l.useRef)(null),w=(0,l.useRef)(null),v=(0,l.useRef)(!1),y=(0,l.useRef)(!0),j=()=>{null!==x.current&&(clearInterval(x.current),x.current=null)},k=()=>{let e=b.current;b.current=null,e&&(cancelAnimationFrame(e.raf),e.ctx.close().catch(()=>void 0))},N=()=>{let e=m.current;if(m.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=>{j(),k(),N(),d(""),s("idle");let n=w.current;if(w.current=null,f.current)return void n?.(null);let r=e.partial.trim();n?n(r):r&&t(r)};(0,l.useEffect)(()=>()=>{y.current=!1,j(),k(),f.current=!0,N();let e=u.current;e&&"inactive"!==e.state&&e.stop(),e?.stream.getTracks().forEach(e=>e.stop())},[]);let C=async()=>{j(),k();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,f.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||m.current)return;v.current=!0;let t=null,i=!0;try{if(t=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1}}),!y.current)return;f.current=!1,d("");let l=await A();if(!y.current||f.current)return;if(!(null!==l&&((t,i)=>{let l;try{l=new AudioContext({sampleRate:16e3})}catch{return!1}let s=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?${s.toString()}`),o=l.createScriptProcessor(4096,1,1),c={ws:a,ctx:l,processor:o,stream:t,preOpenQueue:[],partial:""};m.current=c;let u=l.createMediaStreamSource(t);return o.onaudioprocess=e=>{if(m.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(l.destination),a.addEventListener("open",()=>{if(m.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(m.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",()=>{m.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(!b.current)return;b.current.raf=requestAnimationFrame(i),n.getByteFrequencyData(r);let e=g.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),l=Math.max(n+1,Math.floor((e+1)*i)),s=0;for(let e=n;e<l;e+=1)s+=t[e]??0;let a=s/(l-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)};b.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():m.current&&S(m.current)),t})},1e3)}catch{y.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:g,start:$,stop:()=>new Promise(e=>{let t=m.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:()=>{f.current=!0,u.current?.state==="recording"?u.current.stop():m.current&&S(m.current)}}}({onError:e=>g({kind:"err",text:e}),onUnclaimedText:v,onLiveCommit:v}),j=y.liveText?(i?i.trimEnd()+" ":"")+y.liveText:i;(0,l.useLayoutEffect)(()=>{let e=b.current;e&&(e.style.height="0px",e.style.height=Math.min(e.scrollHeight+2,160)+"px")},[j]);let k=async()=>{if(!c&&!p){m(!0);try{let e=await y.stop();if(null===e)return;let t=e?a.current?a.current.trimEnd()+" "+e:e:a.current;o(t),await n(t)}finally{m(!1)}}},N="rec"===y.phase,S="busy"===y.phase,C=c||p||r,A=!C&&!S&&(N||!!i.trim()||w.images.length>0);return{text:i,textRef:a,setText:o,setTextState:s,displayText:j,inputRef:b,status:x,setStatus:g,busy:c,setBusy:d,voiceSending:p,dictation:y,attachments:w,insertSpoken:v,stopAndSend:k,submit:n,dictationRecording:N,dictationBusy:S,fieldsDisabled:C,canSend:A}}function to({phase:e,elapsed:t,canvasRef:n,start:l,stop:s,discard:a,onText:o,busy:c=!1}){let{t:d}=h(),u=()=>{c||("idle"===e?l():"rec"===e&&s().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)(i.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)(e8.A,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):(0,r.jsx)(eK.A,{className:"h-4 w-4","aria-hidden":!0})})}function tc({composer:e,placeholder:t,textareaAriaLabel:n,imageAriaLabel:i,leftSlot:l,sendLabelIdle:s,sendLabelRecording:a,sendTitleRecording:o,sendIdleClassName:c,sendIdleStyle:d}){let{displayText:u,inputRef:p,dictation:m,setText:f,attachments:h,voiceSending:x,insertSpoken:g,stopAndSend:b,submit:w,fieldsDisabled:v,canSend:y,dictationRecording:j,busy:k,status:N}=e;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("textarea",{ref:p,value:u,rows:1,readOnly:!!m.liveText,onChange:e=>f(e.target.value),onPaste:h.handlePaste,onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||e.nativeEvent.isComposing||(e.preventDefault(),"rec"===m.phase?b():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:[l,(0,r.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5",children:[(0,r.jsx)(to,{...m,busy:x,onText:g}),(0,r.jsx)(tn,{label:i,children:(0,r.jsx)(ts,{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:h.addFiles})}),(0,r.jsx)(tn,{label:j?o??a:s,children:(0,r.jsx)("button",{type:j?"button":"submit",onClick:j?()=>void b():void 0,disabled:!y,"aria-label":j?a:s,style:j?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 ${j?"border-err bg-err hover:opacity-90":c}`,children:k||x?(0,r.jsx)(e8.A,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):(0,r.jsx)(eQ.A,{className:"h-4 w-4","aria-hidden":!0})})})]})]}),(0,r.jsx)(tl,{images:h.images,onRemove:h.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 td(e){return"claude-projects"===e.root?"сесія"===e.kind||"субагент"===e.kind:"codex-sessions"===e.root}let tu="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 l=await fetch(`/api/tmux?${i.toString()}`);if(!l.ok)return;let s=await l.json();n&&r(s.target??null)}catch{}};i();let l=setInterval(i,5e3);return()=>{n=!1,clearInterval(l)}},[e,t]),null!==e||t?n:null}(e.pid,td(e)?e.path:void 0),s=ta({initialText:()=>sessionStorage.getItem("llvDraft:"+e.path)??"",persistText:t=>{t?sessionStorage.setItem("llvDraft:"+e.path,t):sessionStorage.removeItem("llvDraft:"+e.path)},submit:e=>R(e)}),{text:a,textRef:o,setText:c,setTextState:d,inputRef:p,setStatus:m,busy:f,setBusy:x,voiceSending:g,attachments:b}=s,[w,v]=(0,l.useState)(!1),[y,j]=(0,l.useState)(!1),[k,N]=(0,l.useState)(!1),[S,C]=(0,l.useState)([]);(0,l.useEffect)(()=>{if(!k)return;let e=window.setTimeout(()=>N(!1),4e3);return()=>window.clearTimeout(e)},[k]),(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=p.current;e&&(e.focus(),e.setSelectionRange(e.value.length,e.value.length))})};return window.addEventListener(tu,t),()=>window.removeEventListener(tu,t)},[e.path,p,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=td(e);if(null===n&&!A)return null;let $=null===n,M=$&&"claude-projects"===e.root&&"субагент"===e.kind,E=t=>{C(t),sessionStorage.setItem("llvSent:"+e.path,JSON.stringify(t))},R=async n=>{let r=n??a;if(!f&&!g&&(r.trim()||b.images.length)){x(!0),m(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:b.images.map(e=>({base64:e.base64,mime:e.mime}))})}),i=await n.json();if(!n.ok||!i.ok)return void m({kind:"err",text:i.error??t("common.failedSend")});let l=b.images.length,s={id:Date.now(),text:r.trim()||(l?t("composer.imagesCount",{count:l}):""),at:Date.now(),via:i.spawned?"spawn":"pane"};E([...S,s].slice(-8)),c(""),b.clear(),m({kind:"ok",text:i.spawned?t("composer.spawned",{target:i.target??""}):i.imagePaths?.length?t("composer.sentPaths",{count:i.imagePaths.length}):t("common.sent")}),p.current?.focus()}catch{m({kind:"err",text:t("common.serverUnavailable")})}finally{x(!1)}}},D=async()=>{if(!w){v(!0),m(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 m({kind:"err",text:r.error??t("composer.failedInterrupt")});m({kind:"ok",text:t("composer.escapeSent")})}catch{m({kind:"err",text:t("common.serverUnavailable")})}finally{v(!1)}}},T=async()=>{if(!y){j(!0),m(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 m({kind:"err",text:r.error??t("composer.failedCompact")});m({kind:"ok",text:t("composer.compactSent")})}catch{m({kind:"err",text:t("common.serverUnavailable")})}finally{j(!1)}}};return(0,r.jsxs)("form",{onSubmit:e=>{e.preventDefault(),R()},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)(eQ.A,{className:"h-2.5 w-2.5","aria-hidden":!0}):(0,r.jsx)(eI.A,{className:"h-2.5 w-2.5","aria-hidden":!0}),new Date(e.at).toLocaleTimeString("uk"===u()?"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)(i.A,{className:"h-3 w-3","aria-hidden":!0})})]},e.id))}):null,(0,r.jsx)(tc,{composer:s,placeholder:M?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:M?t("composer.titleRelay"):$?t("composer.titleSpawnResumed"):`tmux ${n}`,children:M?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(e_.A,{className:"h-3 w-3 shrink-0","aria-hidden":!0})," ",t("composer.root")]}):$?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(eQ.A,{className:"h-3 w-3 shrink-0","aria-hidden":!0})," resume"]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(eG.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)(tn,{label:t("composer.interruptTitle"),children:(0,r.jsx)("button",{type:"button","aria-label":t("composer.interruptAria"),disabled:w,onClick:()=>void D(),className:"inline-flex shrink-0 items-center justify-center rounded-[8px] border border-line bg-panel p-2 text-dim hover:border-err/40 hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-50",children:w?(0,r.jsx)(e8.A,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):(0,r.jsx)(eV.A,{className:"h-4 w-4",fill:"currentColor","aria-hidden":!0})})}),(0,r.jsx)(tn,{label:k?t("composer.compactConfirmTitle"):t("composer.compactTitle"),children:(0,r.jsx)("button",{type:"button","aria-label":k?t("composer.compactConfirmTitle"):t("composer.compactAria"),disabled:y,onClick:()=>{k?(N(!1),T()):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 ${k?"border-[#0d9488] bg-[#e3f4f0] text-[#0b7c72]":"border-line bg-panel text-dim hover:border-[#0d9488]/50 hover:text-[#0b7c72]"}`,children:y?(0,r.jsx)(e8.A,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):k?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(eO.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)(eB.A,{className:"h-4 w-4","aria-hidden":!0})})})]})]})})]})}let tm="#0d9488",tf=new Map;function th(){for(let e of document.querySelectorAll("[data-link-hover]"))e.removeAttribute("data-link-hover")}function tx(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 tg({drop:e}){let{t}=h(),n=Math.max(8,Math.min(e.to.x+14,window.innerWidth-288)),i=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:n,top:i,backgroundColor:tm},children:[(0,r.jsx)(te.A,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),(0,r.jsx)("span",{className:"truncate",children:t("link.dropped",{title:x(e.file.title,48)})})]})}function tb({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)(eZ.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 tw({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 l=e.current;if(!l)return;let s="u">typeof matchMedia&&matchMedia("(prefers-reduced-motion: reduce)").matches,a=l.getBoundingClientRect(),o=[...l.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(),m={x:p.left-a.left+l.scrollLeft,y:p.top-a.top+l.scrollTop},f=n.current.get(o);if(c.set(o,m),s||i.current||void 0!==e.dataset.flipSkip)continue;if(!f){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 h=f.x-m.x+(d.left-p.left),x=f.y-m.y+(d.top-p.top);if(2>Math.abs(h)&&2>Math.abs(x))continue;let g=e.animate([{transform:`translate(${h}px, ${x}px)`},{transform:"translate(0px, 0px)"}],{duration:280,easing:"cubic-bezier(0.22, 0.72, 0.3, 1)"});r.current.set(e,g),g.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 tv=n(4760);let ty=e=>new TextEncoder().encode(e).length,tj=/^\s*(?:VERDICT:\s*)?(REQUEST_CHANGES|APPROVE|COMMENT)\b/m,tk=/^\s*(\d+)[.)]\s+(.*)$/,tN=/(?:\[(P[0-3])\]|\b(Critical|High|Medium|Low|Info|P[0-3])\b)/i,tS=/((?:\.{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,tC=/\[([^\]]+)\]\(([^)\s]+)\)/,tA=/([\w.-]*(?:api[_-]?key|access[_-]?token|refresh[_-]?token|authorization|bearer|secret|password|passwd|pwd|token))\b(\s*[:=]\s*)(["']?)[^\s"',}]+/gi;function t$(e){return e.replace(tA,(e,t,n,r)=>`${t}${n}${r}[redacted]`)}function tM(e){let t=t$(e);return{raw:t.slice(0,24e3),truncated:t.length>24e3}}function tE(e){let t=e.match(/^(.*?):(\d+(?:-\d+)?)$/);return t?{target:t[1]??e,line:t[2]}:{target:e}}function tR(e,t){let n=e.match(tj)?.[1];if(!n)return null;let r=[],i=[],l=null,s=()=>{let e,t,n,i=l?.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(tN)?.[1]??i.match(tN)?.[2]??"Info"),t=function(e){let t=e.match(tC);if(t){let e=tE((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(tS);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(tN);if(n&&void 0!==n.index){let e=t.slice(n.index+n[0].length).replace(/^[\s.:–—-]+/,"");e&&(t=e)}return t.replace(tC,"$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:tM(i).raw})),l=null};for(let t of e.split("\n")){let e=t.trimEnd(),n=e.match(tk);if(n){s(),l=n[2]??"";continue}let a=e.trim();if(null!==l){a?l=`${l}
|
|
2
|
-
${a}`:s();continue}!(!a||tj.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)}s();let a=r.filter(e=>tN.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:tM(e).raw}:null}let tD=(e,t)=>f(u(),e,t),tT=/<oai-mem-citation>\s*<citation_entries>([\s\S]*?)<\/citation_entries>\s*<rollout_ids>([\s\S]*?)<\/rollout_ids>\s*<\/oai-mem-citation>/g;function tP(e){return"number"==typeof e&&Number.isFinite(e)?e:void 0}let tI=/<(teammate-message|agent-message)\b([^>]*)>([\s\S]*?)<\/\1>/g,t_=/\S*\/\.claude\/viewer-inbox\/([A-Za-z0-9._-]+\.(?:png|jpe?g|gif|webp))/gi;function tq(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(t_,(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 tL=/^\s*(?:<[a-zA-Z][\w:-]*|Caveat: The messages below|\[Request interrupted|This came from another Claude session|# AGENTS\.md instructions)/;function tO(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||tD("render.system"))}function tz(e,t){return e.match(RegExp(`${t}="([^"]*)"`))?.[1]??""}function tF(e){return"string"==typeof e?e:""}function tU(e){return e&&"object"==typeof e&&!Array.isArray(e)?e:{}}function tH(e){return Array.isArray(e)?e.filter(e=>e&&"object"==typeof e&&!Array.isArray(e)):[]}function tB(e,t,n){let r=t.split("\n").map(e=>e.trim()).filter(Boolean).map(e=>{let t=e.match(/\|note=\[(.*)\]$/)?.[1],n=tE(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)),l=tM(e);return{kind:"mem-citation",entries:r,rolloutIds:i,raw:l.raw,truncated:l.truncated}}function tW(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(),l=!0===n||void 0!==r&&"0"!==r;return e.status=l?"err":"ok",e.label=l?r&&"0"!==r?"exit "+r:tD("render.error"):"ok",e.open||=l,i&&(e.output=(e.output+"\n"+t$(i)).trim().slice(-(l?6e4:12e3))),e}var tY=n(6565),tJ=n(2125);function tK({src:e,alt:t,caption:n,onClose:s}){let{t:a}=h(),[o,c]=(0,l.useState)(1),[d,u]=(0,l.useState)(0),[p,m]=(0,l.useState)(0),[f,x]=(0,l.useState)(!1),g=(0,l.useRef)(null);(0,l.useEffect)(()=>{let e=e=>{"Escape"===e.key&&s()};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}},[s]);let b=(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),m(n-(n-p)*i)},w=()=>{c(1),u(0),m(0)};return(0,tt.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:s,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:()=>b(1/1.4),children:(0,r.jsx)(tY.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:()=>b(1.4),children:(0,r.jsx)(tJ.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:s,children:(0,r.jsx)(i.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;b(e.deltaY<0?1.18:1/1.18,n,r)},onPointerDown:e=>{e.currentTarget.setPointerCapture(e.pointerId),g.current={x:e.clientX,y:e.clientY,tx:d,ty:p},x(!0)},onPointerMove:e=>{g.current&&(u(g.current.tx+(e.clientX-g.current.x)),m(g.current.ty+(e.clientY-g.current.y)))},onPointerUp:()=>{g.current=null,x(!1)},onPointerCancel:()=>{g.current=null,x(!1)},onDoubleClick:()=>1===o?b(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 ${f?"":"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 tQ({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),[m,f]=(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)}`,g=async()=>{p(!0),f("");try{let e=await fetch(x,{method:"DELETE"}),t=await e.json();if(!e.ok||!t.ok)return void f(t.error??n("common.failedDelete"));o("deleted")}catch{f(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)(e7,{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)(e7,{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:g,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)(eZ.A,{className:"h-3 w-3","aria-hidden":!0})," ",n("inbox.deleteFromDisk")]}),m?(0,r.jsx)("span",{className:"shrink-0 font-semibold text-err",children:m}):null]})]}),"full"===i?(0,r.jsx)(tK,{src:x,alt:n("inbox.attachedAlt",{name:e}),caption:t,onClose:()=>s("thumb")}):null]})}let tX=/(`[^`]+`|\*\*[^*]+\*\*|\[[^\]]+\]\([^)\s]+\)|https?:\/\/[^\s<>"')\]]+)/g;function tV({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 tG(e){return e.split(tX).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)(tV,{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),l=n.length>72?n.slice(0,69)+"…":n;return(0,r.jsxs)("span",{children:[(0,r.jsx)(tV,{href:n,label:l}),i]},t)}return e})}let tZ=/^\s*\|.*\|\s*$/,t0=/^:?-{1,}:?$/;function t1({rows:e}){let t=e.map(e=>e.trim().replace(/^\|/,"").replace(/\|$/,"").split("|").map(e=>e.trim())),n=t.length>1&&t[1].every(e=>t0.test(e)),i=n?t[0]:null,l=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:tG(e)},t))})}):null,(0,r.jsx)("tbody",{children:l.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:tG(e)},t))},t))})]})})}function t5(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 l=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:l},`c${e}`));continue}if(tZ.test(t[i])){let e=i;for(;i<t.length&&tZ.test(t[i]);)i++;"\n"===n[n.length-1]&&n.pop(),n.push((0,r.jsx)(t1,{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:tG(s[1])},i)):a?n.push((0,r.jsx)("span",{className:"border-l-2 border-line pl-2 text-dim",children:tG(a[1])},i)):n.push((0,r.jsx)(l.Fragment,{children:tG(e)},i)),++i<t.length&&n.push("\n")}return n}function t2({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:tD("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)(e7,{name:"blob",className:"h-4 w-4"})}),(0,r.jsx)("span",{className:"font-semibold",children:tD("render.dataKb",{n:s})}),(0,r.jsx)("span",{className:"ml-1 text-[12px] font-semibold text-accent",children:tD("common.show")})]})}let t3=/(?:\/\.codex\/sessions\/|\/\.claude\/projects\/|\/\.claude\/plugins\/data\/codex-openai-codex\/state\/|^\/tmp\/claude-\d+\/)/;function t4({status:e,className:t}){let n=t??"h-3.5 w-3.5";return"ok"===e?(0,r.jsx)(eO.A,{className:n,"aria-hidden":!0}):"err"===e?(0,r.jsx)(i.A,{className:n,"aria-hidden":!0}):(0,r.jsx)(e8.A,{className:`${n} animate-spin`,"aria-hidden":!0})}function t6({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 t3.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 t8({item:e}){let t=Object.entries(e.byTool).map(([e,t])=>`${e} \xd7${t}`).join(" \xb7 "),n=Y(e.t0),l=Y(e.t1),s=n&&l&&n!==l?`${n}–${l}`:n||l;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)(e7,{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:[tD("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)(eO.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)(i.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),e.errCount]}):null]}),s?(0,r.jsx)("span",{className:"ml-auto shrink-0 text-[11px] text-dim",children:s}):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)(e7,{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)(t4,{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 t9({item:e}){let t=[e.trigger?tD("auto"===e.trigger?"render.compactAuto":"render.compactManual"):"",e.preTokens?tD("render.compactPre",{n:Math.round(e.preTokens/1e3)}):"",Y(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)(e7,{name:"compact",className:"h-3.5 w-3.5"}),tD("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:[tD("render.compactSummary")," \xb7 ",tD("common.show")]}),(0,r.jsx)("span",{className:"hidden group-open/cmp:inline",children:tD("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 t7({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}`:tD("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)(e7,{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," ",tD("common.kb")]}),(0,r.jsx)("span",{className:"ml-1 text-[12px] font-semibold text-accent",children:tD("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:`${tD("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:tD("common.collapse")}),"full"===a?(0,r.jsx)(tK,{src:u,alt:`${tD("render.image")} ${d}`,caption:`${d} \xb7 ${c} ${tD("common.kb")}`,onClose:()=>o("thumb")}):null]})}function ne({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)(e7,{name:"citation",className:"h-4 w-4"})}),(0,r.jsx)("span",{className:"text-[13px] font-semibold",children:tD("render.memoryCitations",{count:e.entries.length})}),(0,r.jsx)("span",{className:"ml-auto text-[11px] font-semibold text-accent group-open:hidden",children:tD("common.show")}),(0,r.jsx)("span",{className:"ml-auto hidden text-[11px] font-semibold text-accent group-open:inline",children:tD("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)(t6,{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:tD("render.noCitations")}),e.entries.length>t.length?(0,r.jsx)("div",{className:"mt-1.5 text-[12px] text-dim",children:tD("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 "+tD("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 nt={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 nn(e){return"string"==typeof e&&e.length?e:void 0}function nr({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?tD("render.approved"):tD("render.rejected")})}function ni({payload:e}){let t=nn(e.from),n=nn(e.requestId),i=Y(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:tD("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 nl({payload:e}){let t=nn(e.type),n=t?nt[t]:void 0;if(!n)return(0,r.jsxs)("div",{className:"text-[13px]",children:[(0,r.jsx)("div",{className:"text-dim",children:tD("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:tD("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,l=nn(e.reason)??nn(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)(e7,{name:n.icon,className:"h-3.5 w-3.5"}),tD(n.labelKey)]}),void 0!==i?(0,r.jsx)(nr,{approve:i}):null]}),l?(0,r.jsx)("div",{className:"mt-1.5 whitespace-pre-wrap break-words",children:t5(l)}):null,(0,r.jsx)(ni,{payload:e})]})}function ns({verdict:e}){let t="REQUEST_CHANGES"===e?eq.A:"APPROVE"===e?eU.A:eJ.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 na({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)(eH.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)(ns,{verdict:e.verdict})}):null,(0,r.jsx)("span",{className:"text-[11px] text-dim",children:n?`${n} finding${1===n?"":"s"}`:tD("render.noFindings")}),Y(e.ts)?(0,r.jsx)("span",{className:"ml-auto text-[11px] text-dim",children:Y(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:t5(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)(t6,{file:e.file,line:e.line}):null]}),(0,r.jsx)("div",{className:"mt-1.5 whitespace-pre-wrap break-words text-[13px]",children:tG(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:t5(e.body)})]}):null]},t)})}):null,e.findings.length>i.length?(0,r.jsx)("div",{className:"mt-2 text-[12px] text-dim",children:tD("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 no({label:e,text:t}){let n=t.length>=2048?`${(t.length/1024).toFixed(1)} ${tD("common.kb")}`:tD("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)(e7,{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:[tD("render.system")," \xb7 ",n]}),(0,r.jsx)("span",{className:"text-accent group-open:hidden",children:tD("common.show")}),(0,r.jsx)("span",{className:"hidden text-dim group-open:inline",children:tD("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 nc=(0,l.memo)(function({item:e}){if("image"===e.kind)return(0,r.jsx)(t7,{media:e.media,data:e.data,w:e.w,h:e.h,bytes:e.bytes});if("inbox-image"===e.kind)return(0,r.jsx)(tQ,{name:e.name,path:e.path});if("blob"===e.kind)return(0,r.jsx)(t2,{bytes:e.bytes,text:e.text});if("sysmsg"===e.kind)return(0,r.jsx)(no,{label:e.label,text:e.text});if("compact"===e.kind)return(0,r.jsx)(t9,{item:e});if("review"===e.kind)return(0,r.jsx)(na,{item:e});if("mem-citation"===e.kind)return(0,r.jsx)(ne,{item:e});if("prose"===e.kind){let t="codex"===e.engine?"bg-codex":"bg-claude",n="codex"===e.engine?eH.A:eX.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:[Y(e.ts)?(0,r.jsx)("div",{className:"mb-0.5 text-[11px] text-dim",children:Y(e.ts)}):null,t5(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:["(",tD("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:[tD("common.collapse")," ",(0,r.jsx)(eF.A,{className:"h-3 w-3","aria-hidden":!0})]})]}),t5(e.text)]}):t5(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)(e7,{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)(t4,{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"+tD("render.noOutputInLog"))})]})}if("cmd-group"===e.kind)return(0,r.jsx)(t8,{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)(e7,{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:tD("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)(eY.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?tD("render.toDir"):tD("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)(eO.A,{className:"h-3 w-3","aria-hidden":!0}):(0,r.jsx)(i.A,{className:"h-3 w-3","aria-hidden":!0}),"ok"===e.delivery?tD("render.delivered"):tD("render.notDelivered")]}):null,Y(e.ts)?(0,r.jsx)("span",{className:"ml-auto shrink-0 text-[11px] text-dim",children:Y(e.ts)}):null]}),(0,r.jsx)("div",{className:"px-3.5 pb-2.5 pt-1",children:t?(0,r.jsx)(nl,{payload:t}):(0,r.jsxs)(r.Fragment,{children:[e.summary?(0,r.jsx)("div",{className:"text-[13px] font-bold",children:tG(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:tD("common.showAll")})]}),(0,r.jsxs)("span",{className:"hidden items-center gap-1 text-[11px] font-semibold text-dim group-open/tmsg:inline-flex",children:[tD("common.collapse")," ",(0,r.jsx)(eF.A,{className:"h-3 w-3","aria-hidden":!0})]})]}),t5(e.text)]}):(0,r.jsx)("div",{className:"mt-0.5 whitespace-pre-wrap break-words text-[13px]",children:t5(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)(eY.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:tD("render.reasoning"),children:[(0,r.jsx)(eL.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:t5(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:tG(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 nd=n(9267),nu=n(9383);function np({file:e}){let{t}=h(),n=e.pendingQuestion,[s,a]=(0,l.useState)("pending"),[o,c]=(0,l.useState)(""),[d,u]=(0,l.useState)({}),[p,m]=(0,l.useState)(""),[f,x]=(0,l.useState)(""),[g,b]=(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,i="delivering"===s,l=async(r,i)=>{a("delivering"),c("");try{let l=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}:{}})}),s=await l.json();if(!l.ok||!s.ok){a("failed"),c(s.error??t("common.failedSend"));return}a("answered"),c(i)}catch{a("failed"),c(t("common.serverUnavailable"))}};return"answered"===s?(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)(nd.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:i||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:i,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"===s?(0,r.jsxs)("div",{className:"mt-2 inline-flex items-center gap-1.5 text-[12px] font-semibold text-dim",children:[(0,r.jsx)(e8.A,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0})," ",t("common.sending")]}):null,"failed"===s?(0,r.jsx)("div",{className:"mt-2 text-[12px] font-semibold text-err",children:o}):null]})}let y=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})}),l=await i.json();if(!i.ok||!l.ok){if(409===i.status&&(l.superseded||l.answer)){a("superseded"),c(l.answer??l.error??t("question.alreadyAnswered"));return}a("failed"),c(l.error??t("common.failedSend"));return}a("answered"),c(l.answer??r)}catch{a("failed"),c(t("common.serverUnavailable"))}},j=(e=d)=>n.questions?.map((t,n)=>e[n]??[])??[],k=n.questions?.length??0,N=k>1||(n.questions?.some(e=>e.multiSelect)??!1),S=n.questions?.every((e,t)=>(d[t]??[]).length>0)??!1,C=async()=>{b(!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{b(!1)}},A="delivering"===s||!w;return"answered"===s?(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"===s?(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)(nd.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:g,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)(nd.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:f,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:()=>y({approve:!0},t("question.approved")),children:[(0,r.jsx)(eO.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:()=>y({approve:!1,text:f},t("question.rejected")),children:[(0,r.jsx)(i.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 l=(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 ${l?"border-accent/45 bg-accent/10":n.recommended?"border-[#e0ae45]/45 bg-[#fff5dc]":"border-line bg-bg"}`,disabled:A,onClick:()=>{var r;let l={...d,[t]:[i]};r=e.multiSelect,u(e=>{let n=e[t]??[],l=r?n.includes(i)?n.filter(e=>e!==i):[...n,i]:[i];return{...e,[t]:l}}),e.multiSelect||1!==k||y({answers:j(l)},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:l?"✓":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)),k<=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=>m(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:()=>y({text:p},p),children:[(0,r.jsx)(nu.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:()=>y({answers:j()},v),children:[(0,r.jsx)(nu.A,{className:"h-4 w-4","aria-hidden":!0})," ",t("common.send")]}):null]}),"delivering"===s?(0,r.jsxs)("div",{className:"mt-3 inline-flex items-center gap-1.5 text-[12px] font-semibold text-dim",children:[(0,r.jsx)(e8.A,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0})," ",t("common.sending")]}):null,"failed"===s?(0,r.jsx)("div",{className:"mt-3 text-[12px] font-semibold text-err",children:o}):null]})}function nm({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)(eQ.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 nf({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 m=(0,r.jsx)(nm,{file:e}),f=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:[m,"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:f,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 nh({file:e,files:t,onSelect:n}){let{t:i}=h();if("codex-jobs"===e.root){let l=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)(nm,{file:e})}),l?(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(l),children:[(0,r.jsx)(eH.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",i("task.openCodexSession",{size:(l.size/1024).toFixed(0),activity:"live"===l.activity?i("task.working"):"stalled"===l.activity?i("task.interrupted"):"recent"===l.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)(nm,{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 nx=window.matchMedia("(pointer: coarse)").matches?500:2500,ng=new Map;function nb(e,t,n){ng.size>300&&!ng.has(e)&&ng.clear(),ng.set(e,{magnet:t,fromBottom:n})}function nw({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 nv({file:e,files:t,onSelect:n,showSvc:i,lineFilter:s,onStatus:a,paused:o,follow:c,setFollow:d,compact:p=!1}){let{locale:m,t:x}=h(),[g,b]=(0,l.useState)(()=>e?ng.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),[p,m]=(0,l.useState)(null),[h,x]=(0,l.useState)(null),[g,b]=(0,l.useState)(!1),[w,v]=(0,l.useState)(!1),[y,j]=(0,l.useState)(!1),[k,N]=(0,l.useState)(0),S=(0,l.useRef)(0),C=(0,l.useRef)(0),A=(0,l.useRef)(""),$=(0,l.useRef)(!0),M=(0,l.useRef)(0),E=(0,l.useRef)(!1),R=(0,l.useRef)(!1);(0,l.useEffect)(()=>{r.current=n},[n]),(0,l.useEffect)(()=>{E.current=g||t},[g,t]);let D=()=>{S.current=0,C.current=0,A.current="",$.current=!0,v(!1)},T=(0,l.useCallback)(()=>{s([]),D()},[]);return(0,l.useEffect)(()=>{M.current+=1,D(),s([]),o(e?.size??0),m(null),d(!!e)},[e?.path]),(0,l.useEffect)(()=>{if(!e)return;let t=!0,n=M.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!==M.current)return;if("error"in l&&l.error){m(l.error),d(!1);return}if(S.current>l.size&&(D(),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?ty(e.slice(0,t+1)):ty(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),m(null),l.data&&x(new Date),d(!1)}catch{t&&n===M.current&&(m(f(u(),"common.serverUnavailable")),d(!1))}};i();let l=setInterval(i,1200);return()=>{t=!1,clearInterval(l)}},[e?.path]),{lines:i,size:a,loading:c,error:p,tickTime:h,paused:g,setPaused:b,clear:T,hasMore:w,loadingOlder:y,loadOlder:(0,l.useCallback)(async()=>{if(!e||R.current||C.current<=0)return 0;R.current=!0,j(!0);let t=M.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}`),l=await i.json();if(t!==M.current||"error"in l&&l.error)return 0;if(n=l.data+n,r=l.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+ty(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{R.current=!1,j(!1)}},[e?.path]),prependGen:k}}(e,o,g&&p?nx:0),v=(0,l.useRef)(null),j=(0,l.useRef)(null),k=(0,l.useRef)(null),N=p?300:1500,S=p?500:1500,[C,A]=(0,l.useState)(N),[$,M]=(0,l.useState)(0),[E,R]=(0,l.useState)(!1),[D,T]=(0,l.useState)(null),P=(0,l.useRef)(!1),I=(0,l.useRef)(g),_=(0,l.useRef)(0),q=(0,l.useRef)(0),L=(0,l.useRef)(null),O=(0,l.useRef)(0),z=(0,l.useRef)(null),F=(t,n=!1)=>{I.current=t,b(t),d(t),t&&M(0),e&&nb(e.path,t,ng.get(e.path)?.fromBottom??0),n&&(R(!0),L.current&&window.clearTimeout(L.current),L.current=window.setTimeout(()=>R(!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=ng.get(e.path)?.magnet??!0;t!==I.current&&(I.current=t,b(t))},[e?.path]),(0,l.useEffect)(()=>{c!==I.current&&(I.current=c,b(c),c&&M(0))},[c]),(0,l.useEffect)(()=>()=>{L.current&&window.clearTimeout(L.current)},[]),(0,l.useEffect)(()=>{P.current=!1,queueMicrotask(()=>T(null))},[e?.path]),(0,l.useEffect)(()=>{if(e){if(e.pendingQuestion){P.current=!0,queueMicrotask(()=>T(null));return}P.current&&e.proc&&"running"!==e.proc&&(queueMicrotask(()=>T(f(m,"feed.agentEnded"))),P.current=!1)}},[e?.pendingQuestion?.toolUseId,e?.proc,e,m]);let H=(0,l.useMemo)(()=>e?function(e,t,n,r){let i=new Map,l=new Map,s=[],a=0,o="",c=e=>!!(!(e.length<=2e4)&&(e.match(/\s/g)?.length??0)/e.length<.02)&&(s.push({kind:"blob",bytes:e.length,text:t$(e).slice(0,2e5)}),!0),d=(e,t)=>{let n=tU(e.source),r=tF(n.data)||tF(t.base64);if(!r)return;let i=tF(n.media_type)||tF(t.type),l=i.startsWith("image/")?i:"image/png",a=tU(t.dimensions);s.push({kind:"image",media:l,data:r,w:tP(a.originalWidth),h:tP(a.originalHeight),bytes:tP(t.originalSize)})},u=(e,t,n)=>{tT.lastIndex=0;let r=tT.test(t);if(tT.lastIndex=0,!r){let n=tR(t.trim(),e);return!!n&&(s.push(n),!0)}let i=!1,l=0,a=t=>{let r=t.trim();if(!r)return;let l=tR(r,e);l?(s.push(l),i=!0):n(r)};for(let e of t.matchAll(tT)){let n=e[0],r=e.index??0;a(t.slice(l,r)),s.push(tB(n,e[1]??"",e[2]??"")),i=!0,l=r+n.length}return a(t.slice(l)),i},p=e=>{let t=[];return tT.lastIndex=0,{cleaned:e.replace(tT,(e,n,r)=>(t.push(tB(e,n,r)),"")).trim(),cites:t}},m=(t,n)=>{if(!n.trim()||n===o||(o=n,c(n)))return;let r="codex"===e.engine?"codex":"claude";u(t,n,e=>s.push({kind:"prose",ts:t,text:e,engine:r}))||s.push({kind:"prose",ts:t,text:n,engine:r})},f=(e,t,n,r)=>{let l=n||"plain-"+s.length+"-"+String(e??""),a=function(e,t="shell"){let n=t$(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 l=i.match(/^([\w./-]+(?:\s+-)?)\s*<<\s*['"]?(\w+)['"]?/);return l&&(i=`${l[1].trim()} \xabheredoc\xbb`),(r+(i=i.replace(/\s+/g," ").trim())).slice(0,160)}(n),icon:t,output:"",status:"run",label:tD("render.executing"),open:!1}}(t,r);return i.set(l,a),s.push({kind:"cmd",id:l,call:a,ts:e}),a},h=(e,t,r)=>{if(!e)return;let a=l.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}!tW(i.get(e),t,r)&&t&&n&&s.push({kind:"svc",text:"output: "+t$(t).slice(0,200)})},x=e=>{n?s.push({kind:"svc",text:e.slice(0,300)}):a+=1},g=e=>{s.push({kind:"note",text:e})},b=(e,t)=>{let n=t.replace(tI,(t,n,r,i)=>{let l=tz(r,"teammate_id")||tz(r,"from")||tD("render.teammate"),a=tz(r,"summary"),o=i.trim();if(o.startsWith("{"))try{let e=JSON.parse(o);if("idle_notification"===e.type){let t=Y(e.timestamp);return s.push({kind:"tnote",text:tD("render.left",{peer:l,at:t?" \xb7 "+t:""})}),""}}catch{}let{cleaned:c,cites:d}=p(o),u=tj.test(c)?tR(c,e):null;for(let t of(s.push({kind:"tmsg",ts:e,dir:"in",peer:l,summary:a,text:u?"":c}),u&&s.push(u),d))s.push(t);return""}).replace(/Another Claude session sent a message:\s*/g,"").trim();if(!n||c(n))return;if(tL.test(n))return void s.push({kind:"sysmsg",label:tO(n),text:n});let{cleaned:r,images:i}=tq(n);for(let t of(r&&!u(e,r,t=>s.push({kind:"user",ts:e,text:t}))&&s.push({kind:"user",ts:e,text:r}),i))s.push({kind:"inbox-image",name:t.name,path:t.path})},w=null,v=(e,t)=>{if(w&&w.text===t&&w.at===s.length)return;let{cleaned:n,images:r}=tq(t);for(let t of(n&&s.push({kind:"user",ts:e,text:n}),r))s.push({kind:"inbox-image",name:t.name,path:t.path});w={text:t,at:s.length}},y=(e,t)=>{w&&w.text===e&&w.at===s.length||(s.push({kind:"sysmsg",label:tO(e,t),text:e}),w={text:e,at:s.length})},j=!1,k=(e,t)=>{s.push({kind:"compact",ts:e,trigger:t?.trigger,preTokens:t?.preTokens})},N=e=>{let t=tU(e.payload),n=e.timestamp;if("session_meta"===e.type)return g(`${tD("render.codexSessionCreated")} \xb7 ${tF(t.model)} \xb7 ${tF(t.cwd)}`);if("event_msg"===e.type){if("agent_message"===t.type&&t.message)return m(n,tF(t.message));if("user_message"===t.type&&t.message){let e=tF(t.message);return tL.test(e)?y(e):v(n,e)}return"task_started"===t.type?g(tD("render.taskStarted")+(n?" \xb7 "+Y(n):"")):"task_complete"===t.type?g(tD("render.taskComplete")+(n?" \xb7 "+Y(n):"")):"context_compacted"===t.type?j?void(j=!1):k(n):x(tF(t.type)||"event")}if("response_item"===e.type){if("message"===t.type){let e=tH(t.content).map(e=>tF(e.text)||tF(e.input_text)).join(" ").trim();return e?"assistant"===t.role?m(n,e):"user"!==t.role||tL.test(e)?y(e,tF(t.role)):v(n,e):x("message "+tF(t.role))}if("function_call"===t.type){let e={};try{e=JSON.parse(tF(t.arguments)||"{}")}catch{e={}}let r=tF(t.name);if("exec_command"===r||"shell"===r)return f(n,String(e.cmd??e.command??"").replace(/^\/usr\/bin\/zsh -lc /,""),tF(t.call_id));if("apply_patch"===r){let t=String(e.input??"").match(/(Add|Update|Delete) File: [^\n]+/g);s.push({kind:"edit",files:t?t.join(", ").replace(/(Add|Update|Delete) File: /g,""):tD("render.patch")});return}return"write_stdin"===r?x(tD("render.stdinSession",{id:String(e.session_id??"")})):f(n,r+" "+JSON.stringify(e).slice(0,120),tF(t.call_id),"tool")}if("function_call_output"===t.type)return h(tF(t.call_id),"string"==typeof t.output?t.output:JSON.stringify(t.output??""));if("custom_tool_call"===t.type&&"apply_patch"===tF(t.name)){let e=tF(t.input).match(/(Add|Update|Delete) File: [^\n]+/g);s.push({kind:"edit",files:e?e.join(", ").replace(/(Add|Update|Delete) File: /g,""):tD("render.patch")});return}return"custom_tool_call_output"===t.type?h(tF(t.call_id),"string"==typeof t.output?t.output:JSON.stringify(t.output??"")):"reasoning"===t.type?x("reasoning"):x(tF(t.type)||"item")}if("compacted"===e.type)return j=!0,k(n);x(tF(e.type)||tD("render.record"))},S=e=>{let t=e.timestamp;if("user"===e.type&&e.message){let n=tU(e.message).content,r=tU(tU(e.toolUseResult).file);if(!0===e.isCompactSummary){let e="string"==typeof n?n:tH(n).filter(e=>"text"===e.type).map(e=>tF(e.text)).join(" ");e.trim()&&((e,t)=>{for(let e=s.length-1;e>=0;e-=1){let n=s[e];if("compact"===n.kind){n.summary=t;return}if("svc"!==n.kind&&"note"!==n.kind)break}s.push({kind:"compact",ts:e,summary:t})})(t,e.trim());return}if("string"==typeof n)b(t,n);else for(let e of tH(n))if("text"===e.type)b(t,tF(e.text));else if("image"===e.type)d(e,r);else if("tool_result"===e.type){let t=tH(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=>tF(e.text)).join(" ");h(tF(e.tool_use_id),n,!0===e.is_error)}return}if("assistant"===e.type&&e.message){for(let n of tH(tU(e.message).content))if("text"===n.type&&tF(n.text).trim())m(t,tF(n.text));else if("thinking"===n.type&&tF(n.thinking).trim())s.push({kind:"think",text:tF(n.thinking).replace(/\s+/g," ").trim()});else if("tool_use"===n.type&&"SendMessage"===tF(n.name)){let e=tU(n.input),r=e.message;if("string"==typeof r){let{cleaned:i,cites:a}=p(r),o=tj.test(i)?tR(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(s.push(c),o&&s.push(o),a))s.push(e);tF(n.id)&&l.set(tF(n.id),c)}else x(`SendMessage → ${String(e.to??"")} \xb7 ${tF(tU(r).type)||tD("render.protocol")}`)}else if("tool_use"===n.type){let e=tU(n.input),r=String(e.command??e.file_path??e.prompt??JSON.stringify(e));f(t,tF(n.name)+": "+r.slice(0,160),tF(n.id),"tool")}return}if("system"===e.type&&"compact_boundary"===e.subtype){let n=tU(e.compactMetadata);return k(t,{trigger:tF(n.trigger)||void 0,preTokens:tP(n.preTokens)})}x(tF(e.type)||tD("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()&&s.push({kind:"raw",text:t$(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,l=n?.[2]??t;if(!(!l||/^Assistant message captured/.test(l))){if(!n&&(tj.test(t)||t.startsWith("<oai-mem-citation>"))){C=[t];return}if(/^Running command: /.test(l))return f(r,l.replace(/^Running command: /,"").replace(/^\/usr\/bin\/zsh -lc /,""));if(/^Command (completed|failed)/.test(l)){let e=[...i.values()].at(-1);e&&tW(e,/^Command failed/.test(l)?l+"\n"+tD("render.jobLogNote"):l,/^Command failed/.test(l));return}return/^Applying \d+ file/.test(l)?s.push({kind:"edit",files:l}):n&&!/^(Running|Command|Applying)/.test(l)?m(r,l):void(!c(t)&&s.push({kind:"raw",text:t$(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 l=r,s=[];for(;l<e.length;){let t=e[l];if("cmd"===t.kind)s.push(t);else if("think"!==t.kind)break;l+=1}let a=l===e.length;if(s.length>=4&&!(t&&a)){let e={},t=0,a=0;for(let n of s){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:s.map(e=>e.id),calls:s.map(e=>e.call),t0:s[0]?.ts,t1:s.at(-1)?.ts,byTool:e,okCount:t,errCount:a,hasErr:a>0}),r=l}else n.push(e[r]),r+=1}return n}(s,"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,m]),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"===u()?"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=k.current;e&&t&&(k.current=null,e.scrollTop=t.top+(e.scrollHeight-t.height))},[w.prependGen,C]),(0,l.useLayoutEffect)(()=>{let t=H.items.length,n=w.prependGen!==q.current;q.current=w.prependGen;let r=t-_.current;if(_.current=t,e&&t&&z.current!==e.path){z.current=e.path;let t=ng.get(e.path);if(!g&&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}}g?U():!n&&r>0&&M(e=>e+r)},[H.items,g,w.prependGen]),(0,l.useEffect)(()=>{let e=v.current,t=j.current;if(!e||!t)return;let n=new ResizeObserver(()=>{I.current&&U()});return n.observe(t),n.observe(e),()=>n.disconnect()},[]);let J=()=>{let e=v.current;e&&(k.current={top:e.scrollTop,height:e.scrollHeight}),B?A(e=>e+S):w.hasMore&&w.loadOlder().then(()=>A(e=>e+S))},K=B>0||w.hasMore,Q=H.items.at(-1),X=Q?.kind==="cmd"&&"run"===Q.call.status?{icon:e0.A,label:x("feed.running",{tool:Q.call.cmd.split(/[\s:]/,1)[0]||x("feed.tool")})}:Q?.kind==="think"?{icon:eX.A,label:x("feed.thinking")}:{icon:eX.A,label:x("feed.working")},V=p?"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?g?"live"===e.activity?(0,r.jsxs)("div",{className:`pointer-events-none absolute bottom-2 ${V} 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)(tv.A,{className:"h-3 w-3","aria-hidden":!0})," ",x("feed.liveTail")]}):null:(0,r.jsxs)("button",{className:`absolute bottom-2 ${V} 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":x("feed.backToLive"),onClick:()=>{U(),F(!0,!0)},children:[(0,r.jsx)(eP.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",$?x("feed.newCount",{count:$}):x("feed.down")]}):null,(0,r.jsx)("div",{ref:v,className:p?"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&&nb(e.path,I.current,Math.max(0,n.scrollHeight-n.clientHeight-n.scrollTop)),n.scrollTop<120&&K&&!w.loadingOlder&&!w.loading&&J()},children:(0,r.jsx)("div",{ref:j,className:p?"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:[p&&K?(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:J,children:w.loadingOlder?x("common.loading"):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(eF.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",x("feed.showEarlier")]})}):null,!p&&K&&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:J,children:w.loadingOlder?x("common.loading"):B?x("feed.showEarlierHidden",{count:B}):x("feed.loadEarlier")}):null,p||K||!H.items.length?null:(0,r.jsx)("div",{className:"mb-3 text-center text-[11px] text-dim",children:x("feed.startOfConvo")}),p?null:(0,r.jsx)(nh,{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 p?(0,r.jsx)("div",{className:"feed-cv",children:(0,r.jsx)(nc,{item:e})},n):(0,r.jsx)(nc,{item:e},n)}),e.pendingQuestion||e.waitingInput?(0,r.jsx)(np,{file:e},e.pendingQuestion?.toolUseId??"waiting"):null,e.pendingQuestion||e.waitingInput||!D?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:D}),"live"===e.activity?(0,r.jsx)(nw,{icon:X.icon,label:X.label}):null,"recent"===e.activity&&eo(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})," ",x("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)(eR.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",x("feed.returnedResult")]}):null]}):(0,r.jsxs)("div",{className:"mt-[14vh] text-center text-dim",children:[w.loading?x("common.loadingCap"):0===w.size?x("feed.noOutput"):H.hiddenServiceCount?x("feed.onlyService",{count:H.hiddenServiceCount}):x("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)(np,{file:e},e.pendingQuestion?.toolUseId??"waiting"):null]}):(0,r.jsx)("div",{className:"mt-[20vh] text-center text-dim",children:x("feed.pickLog")})})})]})}let ny=()=>"uk"===u()?"uk-UA":"en-US",nj={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=>`${nj[e.status]} ${e.text}`),[f(u(),"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 nN={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 nS({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(ny()),window:e.windowTokens.toLocaleString(ny())}),"aria-label":n("plan.ctxAria",{pct:e.pct}),children:["ctx ",e.pct,"%"]})}function nC({goal:e}){let t,n,{t:i}=h(),l=nN[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 ${l.className}`,title:(t=u(),n=[e.objective??f(t,"plan.noObjective")],null!==e.tokensUsed&&n.push(f(t,"plan.tokens",{n:e.tokensUsed.toLocaleString(ny())})),null!==e.timeUsedSeconds&&n.push(f(t,"plan.time",{n:Math.round(e.timeUsedSeconds/60)})),n.join("\n")),"aria-label":i("plan.goalAria",{status:i(l.labelKey)})+(e.objective?` — ${e.objective.slice(0,120)}`:""),children:i(l.labelKey)})}let nA=()=>void 0,n$={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 nM(e,t){return"сесія"===t?e("kind.session"):"субагент"===t?e("kind.subagent"):"джоба"===t?e("kind.job"):"фон"===t?e("kind.background"):t}function nE({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:W(e.mtime)}),children:W(e.mtime)})}function nR({file:e,files:t,tasks:n,onSelect:s,isRoot:a,onClose:o,dragHandle:c,noComposer:d,banner:u}){let{t:p}=h(),m=(0,l.useRef)(null),f=el(e),g=ep(e),b=n$[g];return(0,l.useEffect)(()=>{if(m.current){var t,n;return t=e.path,n=m.current,eh.set(t,n),()=>{eh.get(t)===n&&eh.delete(t)}}},[e.path]),(0,l.useEffect)(()=>{if(!d&&m.current){var t;return t=m.current,tf.set(e.path,{el:t,file:e}),()=>{tf.get(e.path)?.el===t&&tf.delete(e.path)}}},[e,d]),(0,r.jsx)("div",{className:`relative flex min-h-0 min-w-0 flex-1 ${b.glow?"pane-attention":""}`,style:b.glow?{"--pane-glow":b.glow}:void 0,children:(0,r.jsxs)("section",{ref:m,"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"} ${b.section}`,style:"done"===g?{borderTopColor:"#c9c9d1"}:ei(e),children:[(0,r.jsxs)("header",{className:`flex h-10 shrink-0 items-center gap-1.5 border-b border-line px-2.5 ${b.header} ${c?"cursor-grab active:cursor-grabbing":""}`,...c,children:[(0,r.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${J(e.activity)}`,title:p(`branch.${g}`)}),(0,r.jsx)(nE,{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:et(e).soft,color:et(e).color},title:[f.label,en(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:f.style,children:f.label}),e.ctx?(0,r.jsx)(nS,{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:p("branch.worktree",{name:e.worktree}),children:[(0,r.jsx)(eE.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)(nC,{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:p(e.handoff?"branch.handoffTitle":"branch.branchTitle"),children:[(0,r.jsx)(eR.A,{className:"h-3 w-3","aria-hidden":!0})," ",e.handoff?p("kind.handoff"):nM(p,e.kind)]}),(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12px] font-semibold",title:x(e.title),children:x(e.title,90)}),(0,r.jsx)(nf,{file:e,compact:!0}),(0,r.jsx)(tb,{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":p("branch.removeColumn",{title:x(e.title,60)}),onClick:o,children:(0,r.jsx)(i.A,{className:"h-3 w-3","aria-hidden":!0})}):null]}),u??null,n.length?(0,r.jsx)(tw,{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)(nD,{file:e,files:t,onSelect:s})},e.path))}):null,(0,r.jsx)(nv,{file:e,files:t,onSelect:s,showSvc:!1,lineFilter:"",onStatus:nA,paused:!1,follow:!0,setFollow:nA,compact:!0}),d?null:(0,r.jsx)(tp,{file:e})]})})}function nD({file:e,files:t,onSelect:n}){let{t:i}=h(),[s,a]=(0,l.useState)(!1),o=x(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)(ez.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 ${J(e.activity)}`}),(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-semibold",title:x(e.title),children:o})]}),(0,r.jsx)(nf,{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)(nv,{file:e,files:t,onSelect:n,showSvc:!1,lineFilter:"",onStatus:nA,paused:!1,follow:!0,setFollow:nA,compact:!0})}):null]})}let nT=[{key:"claude",label:"Claude"},{key:"codex",label:"Codex"}],nP=(e,t)=>`llvDraftPane:${e}:${t}`;function nI(e,t){return sessionStorage.getItem(nP(e,t))??""}function n_(e,t,n){n?sessionStorage.setItem(nP(e,t),n):sessionStorage.removeItem(nP(e,t))}function nq({draftId:e,project:t,files:n,onClose:s,onSpawned:a}){let{t:o}=h(),[c]=(0,l.useState)(()=>nI(e,"src")),d=c?n.find(e=>e.path===c)??null:null,[u,p]=(0,l.useState)(()=>{let t=nI(e,"engine");return"codex"===t||"claude"===t?t:d?.engine==="codex"?"codex":"claude"}),[m,f]=(0,l.useState)(()=>nI(e,"cwd")),[g,b]=(0,l.useState)([]),[w,v]=(0,l.useState)(()=>(function(e){try{let t=JSON.parse(nI(e,"boot")||"null");return t&&"number"==typeof t.at&&"string"==typeof t.prompt?t:null}catch{return null}})(e)),[y,j]=(0,l.useState)(!1),k=(0,l.useRef)(null),N=ta({initialText:()=>nI(e,"text")||(c?o("draft.readPrompt",{src:c}):""),persistText:t=>n_(e,"text",t),submit:e=>D(e),disabled:!!w}),{text:S,setText:C,setStatus:A,busy:$,setBusy:M,voiceSending:E,attachments:R}=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)&&b(t.dirs),f(n=>{let r="string"==typeof t.cwd?t.cwd:"",i=n||r||t.dirs?.[0]||"";return i!==n&&n_(e,"cwd",i),i}))}).catch(()=>{}),()=>{n=!0}},[t,e,c]),(0,l.useEffect)(()=>{if(!w)return;let e=k.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 j(!0);let t=window.setTimeout(()=>j(!0),e);return()=>window.clearTimeout(t)},[w]);let D=async t=>{let r=t??S;if(!$&&!E&&!w){if(!m.trim())return void A({kind:"err",text:o("draft.needDir")});if(r.trim()||R.images.length){M(!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:m.trim(),prompt:r,images:R.images.map(e=>({base64:e.base64,mime:e.mime})),...c?{src:c}:{}})}),l=await t.json();if(!t.ok||!l.ok)return void A({kind:"err",text:l.error??o("draft.launchFailed")});k.current=new Set(n.map(e=>e.path)),i={at:Date.now(),target:l.target??"",path:l.path??null,prompt:r.trim()},v(i),n_(e,"boot",i?JSON.stringify(i):""),C(""),R.clear()}catch{A({kind:"err",text:o("common.serverUnavailable")})}finally{M(!1)}}}},T=K[u]??Q,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:T.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:T.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:nT.map(({key:t,label:n})=>{let i=u===t,l=K[t]??Q;return(0,r.jsx)("button",{type:"button",role:"radio","aria-checked":i,disabled:P,onClick:()=>{p(t),n_(e,"engine",t)},style:i?{backgroundColor:"#fff",color:l.color,borderColor:l.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?x(d.title):void 0,children:c?o("draft.handoffLabel",{title:d?x(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:s,children:(0,r.jsx)(i.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:m,disabled:P,onChange:t=>{var n;f(n=t.target.value),n_(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:g.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)(e8.A,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}),(0,r.jsx)("span",{children:o("draft.launched",{target:w.target})})]}),y?(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:T.soft,color:T.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(),D()},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)(tc,{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:T.color,borderColor:T.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)(eQ.A,{className:"h-3 w-3 shrink-0","aria-hidden":!0})," ",o("draft.newAgent")]})})})]})}var nL=n(3665),nO=n(1012),nz=n(715);function nF({verdict:e,error:t,className:n="h-3 w-3"}){return"APPROVE"===e?(0,r.jsx)(eO.A,{className:n,strokeWidth:3,"aria-hidden":!0}):"REQUEST_CHANGES"===e?(0,r.jsx)(i.A,{className:n,strokeWidth:3,"aria-hidden":!0}):"COMMENT"===e?(0,r.jsx)(nL.A,{className:n,strokeWidth:2.5,"aria-hidden":!0}):t?(0,r.jsx)(nO.A,{className:n,"aria-hidden":!0}):(0,r.jsx)(nz.A,{className:n,"aria-hidden":!0})}function nU(e,t){return t.error?e("roundDeck.roundAborted",{n:t.n}):t.verdict?e("roundDeck.roundVerdict",{n:t.n,verdict:`${U[t.verdict]} ${t.verdict}`}):e("roundDeck.roundInProgress",{n:t.n})}function nH({round:e,depth:t,pulse:n,onPull:i}){let{t:l}=h(),s=H(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?`${nU(l,e)}: ${e.error}`:nU(l,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:s.soft,color:s.color},children:["R",e.n," ",(0,r.jsx)(nF,{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?l("roundDeck.aborted"):e.verdict?e.verdict:l("roundDeck.reviewInProgress"),null!=e.findingsCount&&e.findingsCount>0?` \xb7 ${l("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 nB({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[m,f]=(0,l.useState)(null);o&&o.round.n!==m&&(f(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 g=t.filter(e=>e.round.n!==x.round.n).reverse(),b=g.slice(0,5),w=g.length-b.length,v=H(x.round.verdict),y=null!==x.round.verdict||!!x.round.error,j=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(g.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)(nR,{file:x.file,files:n,tasks:[],onSelect:i,isRoot:!1,noComposer:"headless"===e.reviewerMode||y,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:[nU(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:nU(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),b.map((e,t)=>(0,r.jsx)(nH,{round:e.round,depth:t,pulse:j?.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*b.length)-8,zIndex:10-b.length},"aria-hidden":!0,children:a("roundDeck.moreRounds",{count:w})}):null]})}var nW=n(8617);function nY(e){return("claude-projects"===e.root||"codex-sessions"===e.root)&&e.path.endsWith(".jsonl")}function nJ({file:e,onHandoff:t}){let{t:n}=h(),i=function(e){let{t}=h(),[n,i]=(0,l.useState)(!1),[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),m=(0,l.useRef)(null),f="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="",th()},[]),(0,l.useEffect)(()=>{if(!o)return;let e=window.setTimeout(()=>{th(),c(null)},1600);return()=>window.clearTimeout(e)},[o]),{onPillPointerDown:n=>{if("mouse"===n.pointerType&&0!==n.button||d.current)return;let r=n.currentTarget.getBoundingClientRect(),l=t=>{let n=d.current;if(!n)return;if(n.lastX=t.clientX,n.lastY=t.clientY,!n.active){if(7>Math.hypot(t.clientX-n.startX,t.clientY-n.startY))return;n.active=!0,u.current=!0,p.current=!0,document.body.style.cursor="crosshair",th(),c(null),a({x:n.anchorX,y:n.anchorY}),i(!0)}m.current?.setAttribute("d",tx(n.anchorX,n.anchorY,t.clientX,t.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 l=tf.get(i);return l&&l.el===r?l:null}(t.clientX,t.clientY,e.path);r?.el!==n.hover?.el&&(n.hover?.el.removeAttribute("data-link-hover"),r?.el.setAttribute("data-link-hover","1"),n.hover=r)},s=n=>{var r,l;let s,a,o=d.current;d.current=null,o?.detach(),u.current=!1,document.body.style.cursor="",o?.active&&(i(!1),o.hover?(r=o.hover.file.path,l=t("link.handoffContext",{title:x(e.title,80),path:e.path,ask:""}).trimEnd()+"\n\n",s="llvDraft:"+r,a=sessionStorage.getItem(s)??"",sessionStorage.setItem(s,a.trim()?a.replace(/\s*$/,"")+"\n\n"+l:l),window.dispatchEvent(new CustomEvent(tu,{detail:{path:r}})),c({file:o.hover.file,from:{x:o.anchorX,y:o.anchorY},to:{x:n.clientX,y:n.clientY}})):th())};d.current={startX:n.clientX,startY:n.clientY,anchorX:r.right,anchorY:r.top+r.height/2,lastX:n.clientX,lastY:n.clientY,active:!1,hover:null,detach:()=>{window.removeEventListener("pointermove",l),window.removeEventListener("pointerup",s),window.removeEventListener("pointercancel",s)}},window.addEventListener("pointermove",l),window.addEventListener("pointerup",s),window.addEventListener("pointercancel",s)},consumeClick:()=>{let e=p.current;return p.current=!1,e},draggingRef:u,overlay:n||o?(0,tt.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:f,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:tm})})}),(0,r.jsx)("path",{ref:e=>{m.current=e;let t=d.current;e&&t?.active&&e.setAttribute("d",tx(t.anchorX,t.anchorY,t.lastX,t.lastY))},d:o?tx(o.from.x,o.from.y,o.to.x,o.to.y):void 0,fill:"none",stroke:tm,strokeWidth:2.5,strokeLinecap:"round",markerEnd:`url(#${f})`}),(0,r.jsx)("circle",{cx:o?o.from.x:s?.x??0,cy:o?o.from.y:s?.y??0,r:4,fill:tm})]}),o?(0,r.jsx)(tg,{drop:o}):null]}),document.body):null}}(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)(nW.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)(eP.A,{className:"hidden h-3.5 w-3.5 shrink-0 group-hover:block group-focus-within:block","aria-hidden":!0})]}),i.overlay]})}function nK(e,t,n,r=[],i=[]){let l=new Map(n.map(e=>[e.path,e])),s=C(n),a=[],o=[],c=[],d=[],u=[],p=_(r),m=q(r),f=100,h=[],x=new Map;for(let e of i){let t=nI(e,"src");if(!t)continue;let n=x.get(t);n?n.push(e):x.set(t,[e])}let g=new Set,b=e=>({file:e,branches:s.get(e.path)?.length??0}),v=(e,t,n,r,i)=>{let s=(e,f,w,v)=>{let y=0===v?780:680;a.push({file:e.file,tasks:e.tasks,under:r.get(e.file.path)??[],x:f,y:w,w:600,h:y,isRoot:e.file.path===i});let j=p.get(e.file.path),k=y;if(j){var N;let e,t,n=(N=f+600+170,e=j.rounds.map(e=>({round:e,file:e.reviewerPath?l.get(e.reviewerPath)??null:null})),t={key:"deck::"+j.id,flow:j,rounds:e,x:N,y:w,w:600,h:y+30*Math.min(Math.max(j.rounds.length-1,0),6)},d.push(t),t);u.push({key:"loop::"+j.id,flow:j,x1:f+600,x2:n.x,y:w}),k=Math.max(k,n.h)}let S=w+k+130,C=t.get(e.file.path)??[],A=f+64;for(let e of C)o.push({to:e.file.path,x1:f+40,y1:w+y,x2:A+300,y2:S,color:er(e.file),live:"live"===e.file.activity}),A+=s(e,A,S,v+1)+48;let $=n.get(e.file.path)?.filter(e=>!m.has(e.path));for(let t of($?.length&&(c.push({key:e.file.path+"::stack",parent:e.file.path,items:$.map(b),x:A,y:S,w:360,h:16+58*Math.min($.length,8)-6}),o.push({to:e.file.path+"::stack",x1:f+40,y1:w+y,x2:A+180,y2:S,color:"#9a9aa4",live:!1,dashed:!0}),A+=408),x.get(e.file.path)??[]))g.add(t),h.push({key:"draft::"+t,id:t,src:e.file.path,x:A,y:S,w:600,h:680}),o.push({to:"draft::"+t,x1:f+40,y1:w+y,x2:A+300,y2:S,color:"#5a51e0",live:!1,dashed:!0}),A+=648;let M=A-48-(f+64);return Math.max(M>0?Math.max(600,64+M):600,j?1370:600)};return s(e,f,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=l.get(t)?.parent??null;return t&&r.has(t)&&t!==e.path?t:n},s=new Map;for(let t of e){if(t.file.path===n)continue;let e=i(t.file),r=s.get(e);r?r.push(t):s.set(e,[t])}let a=new Map,o=[];for(let e of[...t.returnable,...t.finished])if(!m.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]]);f+=v(e[0],s,a,c,t.key)+150}for(let e of t){let t=(function(e,t){if(!e)return[];let n=C(t),r=[],i=new Set([e.path]),l=(e,t)=>{for(let s of(n.get(e.path)??[]).filter(e=>!i.has(e.path)).sort((e,t)=>w(e)-w(t)||t.mtime-e.mtime))i.add(s.path),r.push({file:s,depth:t}),l(s,t+1)};return l(e,1),r})(e,n).map(e=>e.file).filter(e=>!m.has(e.path)),r=t.filter(e=>j(e)),i=t.filter(e=>!j(e));f+=v({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)g.has(e)||(h.push({key:"draft::"+e,id:e,x:f,y:100,w:600,h:780}),f+=750);let y=0;for(let e of a)y=Math.max(y,e.y+e.h);for(let e of c)y=Math.max(y,e.y+e.h);for(let e of d)y=Math.max(y,e.y+e.h);for(let e of h)y=Math.max(y,e.y+e.h);return{nodes:a,edges:o,stacks:c,decks:d,loops:u,drafts:h,byPath:new Map([...a.map(e=>[e.file.path,e]),...h.map(e=>[e.key,e])]),width:Math.max(f-150+100,800),height:y+100+140}}var nQ=n(1906),nX=n(1285),nV=n(8962);function nG({layout:e,cam:t,vp:n,onJump:i}){let{t:s}=h(),a=(0,l.useRef)(null),o=(0,l.useRef)(!1),c=Math.min(216/e.width,148/e.height),d=(216-e.width*c)/2,u=(148-e.height*c)/2,p=e=>{let t=a.current?.getBoundingClientRect();t&&i((e.clientX-t.left-d)/c,(e.clientY-t.top-u)/c)};return(0,r.jsx)("div",{ref:a,"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:s("minimap.title"),onPointerDown:e=>{e.stopPropagation(),o.current=!0,p(e);try{e.currentTarget.setPointerCapture(e.pointerId)}catch{}},onPointerMove:e=>{o.current&&p(e)},onPointerUp:e=>{o.current=!1;try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}},onPointerCancel:()=>{o.current=!1},children:(0,r.jsx)("svg",{width:216,height:148,"aria-hidden":!0,children:(0,r.jsxs)("g",{transform:`translate(${d} ${u}) scale(${c})`,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:er(e.file),opacity:"live"===e.file.activity?.85:.35},e.file.path)),(0,r.jsx)("rect",{x:-t.x/t.z,y:-t.y/t.z,width:n.w/t.z,height:n.h/t.z,fill:"rgba(90,81,224,0.08)",stroke:"#5a51e0",strokeWidth:2.5/c})]})})})}var nZ=n(9707);let n0=["low","medium","high","xhigh"],n1={implementer:{engine:"claude",model:null,effort:null},reviewer:{engine:"codex",model:null,effort:"xhigh"}};function n5({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")}),n0.map(e=>(0,r.jsx)("option",{value:e,children:e},e))]}):null]})}function n2({file:e,onClose:t}){let{t:n}=h(),[i,s]=(0,l.useState)([]),[a,o]=(0,l.useState)(null),[c,d]=(0,l.useState)(n1),[u,p]=(0,l.useState)(!1),[m,f]=(0,l.useState)("head"),[x,g]=(0,l.useState)("auto"),[b,w]=(0,l.useState)("headless"),[v,y]=(0,l.useState)(5),[j,k]=(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(!j){k(!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:m,mode:x,reviewerMode:b,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{k(!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)(n5,{label:n("flowDialog.implementer"),role:c.implementer,onChange:e=>d(t=>({...t,implementer:e}))}),(0,r.jsx)(n5,{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:m,className:"h-8 rounded-[8px] border border-line bg-bg px-2 text-[11.5px] font-normal text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:e=>f(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:b,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=>g(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=>y(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:j,onClick:()=>void C(),children:j?n("flowDialog.creating"):n("flowDialog.start")})]})]})}var n3=n(2749),n4=n(529);let n6={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"}},n8=new Set(["spawning","reviewing","relaying","fixing"]),n9=[1,2,3,4,5,0];function n7({flow:e,onFocusRound:t}){let{t:n}=h(),[s,a]=(0,l.useState)(!1),[o,c]=(0,l.useState)(null),[d,u]=(0,l.useState)(""),p=async(t,n)=>{if(s)return;a(!0),c(null);let r=await B(e.id,{action:t,...n});r?c(r):n?.note!==void 0&&u(""),a(!1)},m=n6[e.state],f=O.has(e.state),x="closed"===e.state||"approved"===e.state,g="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)] ${f?"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]":n8.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:L(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 l=H(e.verdict),s=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 ${s?"animate-pulse":""}`,style:{backgroundColor:l.soft,color:l.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)(nF,{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,s?(0,r.jsx)(n3.A,{className:"h-3.5 w-3.5 shrink-0 animate-spin text-dim","aria-hidden":!0}):null,g?(0,r.jsx)(tn,{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&&m&&p(m.action,{note:d})}})}):null,"reviewing"===e.state?(0,r.jsx)(tn,{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:s,onClick:()=>void p("cancel-round"),children:[(0,r.jsx)(eV.A,{className:"h-3 w-3","aria-hidden":!0})," ",n("flowStrip.stopReviewer")]})}):null,m?(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:s,onClick:()=>void p(m.action,g?{note:d}:void 0),children:n(m.labelKey)}):null,x?null:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(tn,{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:[n9.map(t=>{let i=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 ${i?"bg-accent text-white":"text-dim hover:bg-panel hover:text-ink"}`,disabled:s||l,"aria-label":0===t?n("flowStrip.limitUnlimitedAria"):n("flowStrip.limitAria",{count:t}),"aria-pressed":i,onClick:()=>void p("set-round-limit",{rounds:t}),children:0===t?(0,r.jsx)(n4.A,{className:"h-3 w-3","aria-hidden":!0}):t},t)}),n9.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)(tn,{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:s,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)(tn,{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:s,"aria-label":n("flowStrip.resume"),onClick:()=>void p("resume"),children:(0,r.jsx)(eQ.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})}):(0,r.jsx)(tn,{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:s,"aria-label":n("flowStrip.pause"),onClick:()=>void p("pause"),children:(0,r.jsx)(nd.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})})]}),(0,r.jsx)(tn,{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:s,"aria-label":n("flowStrip.close"),onClick:()=>void p("close"),children:(0,r.jsx)(i.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})})]})]})}function re({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 rt="cubic-bezier(.22,.8,.36,1)",rn=`transform 380ms ${rt}`,rr=(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 ${rt}`},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 ${rt}, cy 380ms ${rt}`}}),(0,r.jsx)("path",{d:i,style:{d:`path("${i}")`,transition:`d 380ms ${rt}`},fill:e.color})]},e.to)})})}),ri=(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,l="approved"===(n=e.flow).state?"#1a8a3e":z.has(n.state)?"#5a51e0":O.has(n.state)?"#e0ae45":"#9a9aa4",s=e.y+150,a=e.y+330,o=(e.x1+e.x2)/2,c=(s+a)/2,d=`M ${e.x1} ${s} C ${e.x1+52} ${s-56}, ${e.x2-52} ${s-56}, ${e.x2-7} ${s}`,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} ${s-5} L ${e.x2-9} ${s+5} L ${e.x2-1} ${s} Z`,m=`M ${e.x1+9} ${a-5} L ${e.x1+9} ${a+5} L ${e.x1+1} ${a} Z`,f=(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 ${rt}`}}),h=e=>({d:`path("${e}")`,transition:`d 380ms ${rt}`});return(0,r.jsxs)("g",{children:[(0,r.jsx)("path",{...f(d,"forward"===i)}),(0,r.jsx)("path",{d:p,style:h(p),fill:"forward"===i?"#5a51e0":"#c9c9d1"}),(0,r.jsx)("path",{...f(u,"back"===i)}),(0,r.jsx)("path",{d:m,style:h(m),fill:"back"===i?"#5a51e0":"#c9c9d1"}),(0,r.jsx)("circle",{cx:o,cy:c,r:17,fill:"#ffffff",stroke:l,strokeWidth:2,style:{cx:`${o}px`,cy:`${c}px`,transition:`cx 380ms ${rt}, cy 380ms ${rt}`}}),(0,r.jsx)("text",{x:o,y:c+6,textAnchor:"middle",fontSize:17,fontWeight:700,fill:l,style:{x:`${o}px`,y:`${c+6}px`,transition:`x 380ms ${rt}, y 380ms ${rt}`},children:"⟳"})]},e.key)})}):null});function rl({file:e,onSelect:t}){let n=el(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:x(e.title),onClick:()=>t(e),children:[(0,r.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${J(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:x(e.cmdDesc||e.title,80)}),(0,r.jsx)("span",{className:"shrink-0 text-[10.5px] text-dim",children:W(e.mtime)})]})}function rs({file:e}){let t=el(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 ${J(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:x(e.title,70)})]})})}let ra=()=>void 0;function ro({node:e,ringed:t,flow:n}){let{t:i}=h(),l=el(e.file);return(0,r.jsxs)("div",{"data-scheme-node":e.file.path,className:"scheme-enter absolute",style:{transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,transition:rn},children:[n?(0,r.jsx)("div",{className:"absolute -top-[60px] left-0 z-[4]",style:{width:1370},children:(0,r.jsx)(n7,{flow:n,onFocusRound:ra})}):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:ei(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 ${J(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:W(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:x(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," ",i("scheme.underneath")]}):null]}),n?(0,r.jsx)(re,{role:"implementer",active:"implementer"===F(n)}):null,(0,r.jsx)(rs,{file:e.file})]})}function rc({draft:e,ringed:t}){let{t:n}=h();return(0,r.jsx)("div",{"data-scheme-node":e.key,className:"scheme-enter absolute",style:{transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,transition:rn},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:"+"})," ",n("mobile.agent")]})})})}function rd({deck:e}){let{t}=h(),n=e.rounds.at(-1)??null,i=n?.round??null,l=H(i?.verdict??null);return(0,r.jsxs)("div",{"data-scheme-node":e.key,className:"scheme-enter absolute",style:{transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,transition:rn},children:[(0,r.jsx)("div",{className:"flex h-full flex-col overflow-hidden rounded-[10px] border border-line bg-panel shadow-card",children:i?(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",i.n," ",(0,r.jsx)(nF,{verdict:i.verdict,error:!!i.error,className:"h-3.5 w-3.5"})]}),(0,r.jsx)("span",{className:"min-w-0 truncate text-[11px] font-semibold",children:i.error?t("roundDeck.aborted"):i.verdict??t("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:n?.file?x(n.file.title,140):t("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:t("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:t("roundDeck.waitingFirst")})}),(0,r.jsx)(re,{role:"reviewer",active:"reviewer"===F(e.flow)})]})}function ru({stack:e,onSelect:t}){let{t:n}=h();return(0,r.jsx)("div",{"data-scheme-node":e.key,className:"scheme-enter absolute",style:{transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,transition:rn},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:i})=>{let l=el(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:x(e.title),onClick:()=>t(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 ${J(e.activity)}`}),(0,r.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:l.style,children:l.label}),(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-semibold",children:x(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:nM(n,e.kind)}),(0,r.jsx)("span",{children:W(e.mtime)}),i?(0,r.jsxs)("span",{children:["⤷ ",i]}):null]})]},e.path)})})})}function rp({node:e,files:t,ringed:n,flow:i,canFlow:s,onSelect:a,onClose:o,onFocusRound:c,onHandoff:d}){let{t:u}=h(),[p,m]=(0,l.useState)(!1),[f,x]=(0,l.useState)(!1);return(0,r.jsxs)("div",{"data-scheme-node":e.file.path,className:`scheme-enter absolute ${p||f?"z-20":""}`,style:{transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,transition:rn},children:[i?(0,r.jsx)("div",{className:"absolute -top-[60px] left-0 z-[4]",style:{width:1370},children:(0,r.jsx)(n7,{flow:i,onFocusRound:e=>c(i.id,e)})}):s?(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":f,title:u("scheme.flowTitle"),onClick:()=>x(e=>!e),children:[(0,r.jsx)("span",{className:"text-[13px] leading-none text-accent",children:"⟳"})," ",u("scheme.flow")]})}):null,f?(0,r.jsx)("div",{className:"absolute left-0 top-[-8px] z-40 -translate-y-full",children:(0,r.jsx)(n2,{file:e.file,onClose:()=>x(!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)(nR,{file:e.file,tasks:e.tasks,files:t,onSelect:a,isRoot:e.isRoot,onClose:()=>o(e.file.path)})}),i?(0,r.jsx)(re,{role:"implementer",active:"implementer"===F(i)}):null,(0,r.jsx)(rs,{file:e.file}),d&&nY(e.file)?(0,r.jsx)(nJ,{file:e.file,onHandoff:()=>d(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":p,title:u("scheme.collapsedTitle"),onClick:()=>m(e=>!e),children:[(0,r.jsx)(nZ.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),e.under.length," ",u("scheme.underneath"),(0,r.jsx)(ez.A,{className:`h-3 w-3 transition-transform ${p?"rotate-90":""}`,"aria-hidden":!0})]}):null,p?(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)(rl,{file:e,onSelect:a},e.path))}):null]})}function rm({draft:e,project:t,files:n,ringed:i,onDraftClose:l,onDraftSpawned:s}){return(0,r.jsx)("div",{"data-scheme-node":e.key,className:"scheme-enter absolute",style:{transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,transition:rn},children:(0,r.jsx)("div",{className:`flex h-full ${i?"rounded-[10px] ring-2 ring-accent/60 ring-offset-2 ring-offset-bg":""}`,children:(0,r.jsx)(nq,{draftId:e.id,project:t,files:n,onClose:()=>l(e.id),onSpawned:t=>s(e.id,t)})})})}function rf({deck:e,files:t,focus:n,onSelect:i}){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",style:{transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,transition:rn},children:[(0,r.jsx)(nB,{flow:e.flow,rounds:e.rounds,files:t,onSelect:i,focusRound:l}),(0,r.jsx)(re,{role:"reviewer",active:"reviewer"===F(e.flow)})]})}let rh=(0,l.memo)(function({layout:e,project:t,files:n,interactive:i,lite:l,selected:s,focus:a,flowsByImpl:o,deckFocus:c,onSelect:d,onClose:u,onFocusRound:p,onDraftClose:m,onDraftSpawned:f,onHandoff:h}){return(0,r.jsxs)("div",{className:i?void 0:"pointer-events-none select-none",children:[e.stacks.map(e=>(0,r.jsx)(ru,{stack:e,onSelect:d},e.key)),e.decks.map(e=>l?(0,r.jsx)(rd,{deck:e},e.key):(0,r.jsx)(rf,{deck:e,files:n,focus:c,onSelect:d},e.key)),e.drafts.map(e=>l?(0,r.jsx)(rc,{draft:e,ringed:s===e.key||a===e.key},e.key):(0,r.jsx)(rm,{draft:e,project:t,files:n,ringed:s===e.key||a===e.key,onDraftClose:m,onDraftSpawned:f},e.key)),e.nodes.map(e=>{var t;return l?(0,r.jsx)(ro,{node:e,ringed:s===e.file.path||a===e.file.path,flow:o.get(e.file.path)??null},e.file.path):(0,r.jsx)(rp,{node:e,files:n,ringed:s===e.file.path||a===e.file.path,flow:o.get(e.file.path)??null,canFlow:(t=e.file,!o.has(t.path)&&("claude"===t.engine||"codex"===t.engine)&&v(t)),onSelect:d,onClose:u,onFocusRound:p,onHandoff:h},e.file.path)})]})}),rx="llvSchemeMode",rg=(e,t)=>Math.hypot(e.x-t.x,e.y-t.y);function rb({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 rw({project:e,groups:t,manual:n,files:i,flows:s,drafts:a,focus:o,ring:c,onSelect:d,onNodePick:u,onClose:p,onDraftClose:m,onDraftSpawned:f,onHandoff:x}){let{t:g}=h(),b=!!u,[w,v]=(0,l.useState)(null),y=(0,l.useMemo)(()=>nK(t,n,i,s,a),[t,n,i,s,a]),j=(0,l.useMemo)(()=>_(s),[s]),[k,N]=(0,l.useState)(null),S=(0,l.useCallback)((e,t)=>{N(n=>({flowId:e,round:t,nonce:(n?.nonce??0)+1}))},[]),C=c??o,A=(0,l.useRef)(d),$=(0,l.useRef)(u),M=(0,l.useRef)(p),E=(0,l.useRef)(m),R=(0,l.useRef)(f),D=(0,l.useRef)(x);(0,l.useEffect)(()=>{A.current=d,$.current=u,M.current=p,E.current=m,R.current=f,D.current=x});let T=(0,l.useCallback)(e=>{let t=$.current;t?t(e.path):A.current(e)},[]),P=(0,l.useCallback)(e=>M.current(e),[]),I=(0,l.useCallback)(e=>E.current(e),[]),q=(0,l.useCallback)((e,t)=>R.current(e,t),[]),L=(0,l.useCallback)(e=>D.current?.(e),[]),{cam:O,vp:z,viewportRef:F,handLike:U,panning:H,glide:B,setMode:W,onPointerDown:Y,onPointerMove:J,onDoubleClick:K,onClick:Q,zoomCenter:X,zoomTo:V,fit:G,jump:Z}=function({project:e,layout:t,mapMode:n,focus:r,onNodePick:i,setSelected:s}){let a=(0,l.useRef)(null),o=(0,l.useRef)(null),[c,d]=(0,l.useState)({x:0,y:0,z:.5}),[u,p]=(0,l.useState)("select"),[m,f]=(0,l.useState)(!1),[h,x]=(0,l.useState)(!1),[g,b]=(0,l.useState)(!1),[w,v]=(0,l.useState)({w:1,h:1}),y=(0,l.useRef)(null),j=(0,l.useRef)(new Map),k=(0,l.useRef)(null),N=(0,l.useRef)(u),S=(0,l.useRef)(m),C=(0,l.useRef)(null),A=(0,l.useRef)(null);(0,l.useEffect)(()=>{N.current=u},[u]),(0,l.useEffect)(()=>{S.current=m},[m]),(0,l.useEffect)(()=>{let e=localStorage.getItem(rx);"hand"===e||"select"===e?p(e):window.matchMedia("(pointer: coarse)").matches&&p("hand")},[]);let $=(0,l.useCallback)(e=>{p(e),localStorage.setItem(rx,e)},[]);(0,l.useEffect)(()=>{let e=a.current;if(!e)return;let t=new ResizeObserver(()=>{let t=e.getBoundingClientRect();v({w:Math.max(1,t.width),h:Math.max(1,t.height)})});return t.observe(e),()=>t.disconnect()},[]);let M=(0,l.useCallback)(e=>{let n=Math.min(Math.max(e.x,120-t.width*e.z),w.w-120),r=Math.min(Math.max(e.y,120-t.height*e.z),w.h-120);return n===e.x&&r===e.y?e:{...e,x:n,y:r}},[t.width,t.height,w]),E=(0,l.useRef)([]),R=(0,l.useRef)(null),D=(0,l.useCallback)(e=>{E.current.push(e),null==R.current&&(R.current=requestAnimationFrame(()=>{R.current=null;let e=E.current;E.current=[],d(t=>e.reduce((e,t)=>t(e),t))}))},[]);(0,l.useEffect)(()=>()=>{null!=R.current&&cancelAnimationFrame(R.current)},[]);let T=(0,l.useCallback)((e,t,n)=>{D(r=>{let i=Math.min(1.6,Math.max(.12,r.z*n));if(i===r.z)return r;let l=i/r.z;return M({z:i,x:e-(e-r.x)*l,y:t-(t-r.y)*l})})},[M,D]),P=(0,l.useCallback)(e=>{let t=a.current?.getBoundingClientRect();t&&T(t.width/2,t.height/2,e)},[T]),I=(0,l.useCallback)(e=>{let t=a.current?.getBoundingClientRect();t&&d(n=>{let r=Math.min(1.6,Math.max(.12,e));if(r===n.z)return n;let i=r/n.z,l=t.width/2,s=t.height/2;return M({z:r,x:l-(l-n.x)*i,y:s-(s-n.y)*i})})},[M]),_=(0,l.useCallback)(()=>{let e=a.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]),q=(0,l.useCallback)(e=>{b(!0),d(e),C.current&&window.clearTimeout(C.current),C.current=window.setTimeout(()=>b(!1),500)},[]);(0,l.useEffect)(()=>()=>{C.current&&window.clearTimeout(C.current)},[]);let L=(0,l.useCallback)(()=>{let e=_();e&&q(e)},[_,q]),O=(0,l.useCallback)((e,t)=>{let n=a.current?.getBoundingClientRect();n&&q(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)}})},[q]);(0,l.useEffect)(()=>{if(A.current===e||!t.nodes.length&&!t.drafts.length)return;if(A.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 d(e)}}catch{}let r=_();r&&d(r)},[e,t,_,n]),(0,l.useEffect)(()=>{if(n||A.current!==e)return;let t=window.setTimeout(()=>sessionStorage.setItem("llvCam:"+e,JSON.stringify(c)),300);return()=>window.clearTimeout(t)},[c,e,n]);let z=(0,l.useRef)(null);(0,l.useEffect)(()=>{if(!r){z.current=null;return}if(z.current===r)return;let e=t.byPath.get(r);e&&(z.current=r,O(e,.55))},[r,t,O]),(0,l.useEffect)(()=>{let e=a.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(),T(t.clientX-n.left,t.clientY-n.top,Math.exp(-(.0022*t.deltaY)));return}if("select"===N.current&&!S.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;D(e=>M({...e,x:e.x-r,y:e.y-i}))};return e.addEventListener("wheel",t,{passive:!1}),()=>e.removeEventListener("wheel",t)},[T,M,D]),(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||f(!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("Escape"===e.key)s(null);else if("0"===e.key)L();else if("1"===e.key)I(1);else if("+"===e.key||"="===e.key)P(1.25);else if("-"===e.key)P(.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;d(e=>M({...e,x:e.x+t,y:e.y+n}))}}}},t=e=>{" "===e.key&&f(!1)};return window.addEventListener("keydown",e),window.addEventListener("keyup",t),()=>{window.removeEventListener("keydown",e),window.removeEventListener("keyup",t)}},[L,P,I,$,M,s]);let F=e=>{let t=a.current?.getBoundingClientRect();return t?{x:e.clientX-t.left,y:e.clientY-t.top}:{x:e.clientX,y:e.clientY}},U=e=>{y.current={sx:e.clientX,sy:e.clientY,cx:c.x,cy:c.y},x(!0);try{a.current?.setPointerCapture(e.pointerId)}catch{}};(0,l.useEffect)(()=>{let e=e=>{j.current.delete(e.pointerId),j.current.size<2&&(k.current=null),y.current=null,x(!1)};return window.addEventListener("pointerup",e),window.addEventListener("pointercancel",e),()=>{window.removeEventListener("pointerup",e),window.removeEventListener("pointercancel",e)}},[]);let H=n||"hand"===u||m,B=(0,l.useCallback)((e,t)=>d(n=>M({...n,x:w.w/2-e*n.z,y:w.h/2-t*n.z})),[w,M]);return{cam:c,vp:w,viewportRef:a,mode:u,setMode:$,handLike:H,panning:h,glide:g,onPointerDown:e=>{let t=e.target;if(!t.closest("[data-scheme-ui]")){if(n&&e.isPrimary&&(o.current={x:e.clientX,y:e.clientY}),"touch"===e.pointerType&&(j.current.set(e.pointerId,F(e)),2===j.current.size)){let[e,t]=[...j.current.values()];k.current={d:rg(e,t),cx:(e.x+t.x)/2,cy:(e.y+t.y)/2},y.current=null,x(!1);return}if(1===e.button){e.preventDefault(),U(e);return}if(0===e.button){if(!(n||"hand"===u||m)){let e=t.closest("[data-scheme-node]");if(e)return void s(e.getAttribute("data-scheme-node"));if(s(null),t.closest("button, a, input, textarea, select"))return}U(e)}}},onPointerMove:e=>{if("touch"===e.pointerType&&j.current.has(e.pointerId)){j.current.set(e.pointerId,F(e));let t=k.current;if(t&&j.current.size>=2){let[e,n]=[...j.current.values()],r=rg(e,n),i=(e.x+n.x)/2,l=(e.y+n.y)/2,s=t.d>0?r/t.d:1;D(e=>{let n=Math.min(1.6,Math.max(.12,e.z*s)),r=n/e.z;return M({z:n,x:i-(t.cx-e.x)*r,y:l-(t.cy-e.y)*r})}),k.current={d:r,cx:i,cy:l};return}}let t=y.current;if(!t)return;let n=e.clientX-t.sx,r=e.clientY-t.sy;D(e=>M({...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 L();if("hand"!==u&&!m)return;let i=t.byPath.get(r.getAttribute("data-scheme-node")??"");i&&O(i,.9)},onClick:e=>{if(!i)return;let n=o.current;if(o.current=null,!n||Math.hypot(e.clientX-n.x,e.clientY-n.y)>9||e.target.closest("[data-scheme-ui]"))return;let r=a.current?.getBoundingClientRect();if(!r)return;let l=((e,n)=>{let r=t=>e>=t.x&&e<=t.x+t.w&&n>=t.y&&n<=t.y+t.h;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})((e.clientX-r.left-c.x)/c.z,(e.clientY-r.top-c.y)/c.z);l&&i(l)},zoomCenter:P,zoomTo:I,fit:L,jump:B}}({project:e,layout:y,mapMode:b,focus:o,onNodePick:u,setSelected:v}),ee=24*O.z;return(0,r.jsxs)("div",{ref:F,className:`relative min-h-0 flex-1 overflow-hidden ${H?"cursor-grabbing select-none":U?"cursor-grab":""} ${U?"touch-none":""}`,onPointerDown:Y,onPointerMove:J,onDoubleClick:K,onClick:Q,children:[(0,r.jsx)("div",{"aria-hidden":!0,className:"pointer-events-none absolute",style:{inset:-ee,backgroundImage:"radial-gradient(rgba(28,28,34,0.09) 1px, transparent 1px)",backgroundSize:`${ee}px ${ee}px`,transform:`translate(${(O.x%ee+ee)%ee}px, ${(O.y%ee+ee)%ee}px)`,willChange:"transform"}}),(0,r.jsxs)("div",{className:`absolute left-0 top-0 ${H?"scheme-panning":""}`,style:{width:y.width,height:y.height,transform:`translate(${O.x}px, ${O.y}px) scale(${O.z})`,transformOrigin:"0 0",transition:B?`transform .45s ${rt}`:void 0,willChange:"transform","--inv-z":String(1/O.z),"--label-o":O.z<.45?"1":"0"},children:[(0,r.jsx)(rr,{edges:y.edges,width:y.width,height:y.height}),(0,r.jsx)(ri,{loops:y.loops,width:y.width,height:y.height}),(0,r.jsx)(rh,{layout:y,project:e,files:i,interactive:!U,lite:b,selected:w,focus:C,flowsByImpl:j,deckFocus:k,onSelect:T,onClose:P,onFocusRound:S,onDraftClose:I,onDraftSpawned:q,onHandoff:x?L:void 0})]},e),(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:[b?null:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(rb,{active:U,title:g("scheme.handTool"),onClick:()=>W("hand"),children:(0,r.jsx)(nQ.A,{className:"h-4 w-4","aria-hidden":!0})}),(0,r.jsx)(rb,{active:!U,title:g("scheme.selectTool"),onClick:()=>W("select"),children:(0,r.jsx)(nX.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)(rb,{title:g("scheme.zoomOut"),onClick:()=>X(.8),children:(0,r.jsx)(tY.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:g("scheme.zoom100"),onClick:()=>V(1),children:[Math.round(100*O.z),"%"]}),(0,r.jsx)(rb,{title:g("scheme.zoomIn"),onClick:()=>X(1.25),children:(0,r.jsx)(tJ.A,{className:"h-4 w-4","aria-hidden":!0})}),(0,r.jsx)(rb,{title:g("scheme.fit"),onClick:G,children:(0,r.jsx)(nV.A,{className:"h-4 w-4","aria-hidden":!0})})]}),(0,r.jsx)(nG,{layout:y,cam:O,vp:z,onJump:Z})]})}let rv={waiting:5,stalled:4,live:3,returned:2,done:1};function ry({project:e,groups:t,manual:n,files:s,flows:a,drafts:o,focus:c,onSelect:d,onClose:u,onDraftClose:p,onDraftSpawned:m,onHandoff:f}){let{t:x}=h(),[g,b]=(0,l.useState)(null),[w,v]=(0,l.useState)(!1),y=(0,l.useRef)(null),j=(0,l.useRef)(null),k=(0,l.useMemo)(()=>nK(t,n,s,a,o),[t,n,s,a,o]),N=(0,l.useMemo)(()=>[...k.nodes.map(e=>({key:e.file.path,file:e.file,isRoot:e.isRoot,kind:"node"})),...k.decks.map(e=>({key:e.key,file:null,isRoot:!1,kind:"deck"})),...k.drafts.map(e=>({key:e.key,file:null,isRoot:!0,kind:"draft"}))],[k]),S=(0,l.useMemo)(()=>new Map(N.map(e=>[e.key,e])),[N]);(0,l.useEffect)(()=>{b(sessionStorage.getItem("llvFocus:"+e)),v(!1)},[e]),(0,l.useEffect)(()=>{c&&(b(c),v(!1))},[c]);let C=(0,l.useMemo)(()=>{if(g&&S.has(g))return g;let e=null,t=-1;for(let n of N){if(!n.file)continue;let r=1e12*rv[ep(n.file)]+n.file.mtime;r>t&&(t=r,e=n)}return(e??N[0])?.key??null},[g,S,N]);(0,l.useEffect)(()=>{g&&S.has(g)?sessionStorage.setItem("llvFocus:"+e,g):!g&&C&&sessionStorage.setItem("llvFocus:"+e,C)},[g,S,C,e]),(0,l.useEffect)(()=>{j.current?.scrollIntoView({block:"nearest",inline:"nearest"})},[C]);let A=(0,l.useMemo)(()=>k.nodes.find(e=>e.file.path===C)??null,[k,C]),$=(0,l.useMemo)(()=>k.decks.find(e=>e.key===C)??null,[k,C]),M=(0,l.useMemo)(()=>k.drafts.find(e=>e.key===C)??null,[k,C]),E=(0,l.useCallback)(e=>{if(!N.length)return;let t=N.findIndex(e=>e.key===C),n=N[Math.min(N.length-1,Math.max(0,(-1===t?0:t)+e))];n&&n.key!==C&&b(n.key)},[N,C]),R=(0,l.useCallback)(e=>{if(v(!1),S.has(e))return void b(e);let t=s.find(t=>t.path===e);t&&d(t)},[S,s,d]);return(0,r.jsxs)("div",{className:"relative flex min-h-0 min-w-0 flex-1 flex-col",children:[N.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:N.map(e=>(0,r.jsx)(rj,{entry:e,active:e.key===C,chipRef:e.key===C?j:void 0,onClick:()=>b(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:[A?(0,r.jsxs)("div",{className:"relative flex min-h-0 flex-1",children:[(0,r.jsx)(nR,{file:A.file,tasks:A.tasks,files:s,onSelect:d,isRoot:A.isRoot,onClose:()=>u(A.file.path),dragHandle:{onTouchStart:e=>{let t=e.touches[0];t&&(y.current={x:t.clientX,y:t.clientY})},onTouchEnd:e=>{let t=y.current;y.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)||E(r<0?1:-1)}}}),f&&nY(A.file)?(0,r.jsx)(nJ,{file:A.file,onHandoff:()=>f(A.file)}):null]},A.file.path):$?(0,r.jsx)("div",{className:"relative min-h-0 flex-1",children:(0,r.jsx)(nB,{flow:$.flow,rounds:$.rounds,files:s,onSelect:d,focusRound:null})},$.key):M?(0,r.jsx)(nq,{draftId:M.id,project:e,files:s,onClose:()=>p(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:x("mobile.noConvos")}),(0,r.jsx)(rk,{layout:k,current:C,onOpen:()=>v(!0)})]}),w?(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:x("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":x("mobile.closeMap"),onClick:()=>v(!1),children:(0,r.jsx)(i.A,{className:"h-4 w-4","aria-hidden":!0})})]}),(0,r.jsx)(rw,{project:e,groups:t,manual:n,files:s,flows:a,drafts:o,focus:null,ring:C,onSelect:d,onClose:u,onDraftClose:p,onDraftSpawned:m,onNodePick:R}),(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:x("mobile.tapNode")})]}):null]})}function rj({entry:e,active:t,chipRef:n,onClick:i}){let{t:l}=h();if(!e.file){let s="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:s?"R":"+"})," ",l(s?"scheme.flow":"mobile.agent")]})}let s=e.file,a=ep(s),o="waiting"===a||"stalled"===a,c=el(s),d=x(s.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 ${J(s.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 rk({layout:e,current:t,onOpen:n}){let{t:i}=h(),l=Math.min(96/e.width,64/e.height),s=(96-e.width*l)/2,a=(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":i("mobile.openMap"),onClick:n,children:(0,r.jsx)("svg",{width:96,height:64,"aria-hidden":!0,children:(0,r.jsxs)("g",{transform:`translate(${s} ${a}) 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===t?"#5a51e0":void 0,strokeWidth:e.key===t?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===t?"#5a51e0":void 0,strokeWidth:e.key===t?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:er(e.file),opacity:"live"===e.file.activity?.85:.35,stroke:e.file.path===t?"#5a51e0":void 0,strokeWidth:e.file.path===t?5/l:void 0},e.file.path))]})})})}let rN="llvArchived";function rS(e){try{window.localStorage.setItem(rN,JSON.stringify([...e]))}catch{}}function rC({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 rA({file:e,title:t,project:n,currentProject:l,descendants:s,statusLine:a,size:o,tone:c,onOpen:d,onArchive:u}){let{t:p}=h(),m=el(e),f="large"===o;return(0,r.jsxs)("article",{className:`group relative flex ${f?"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:x(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)(i.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 ${J(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:et(e).soft,color:et(e).color},title:[m.label,en(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:m.style,children:m.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===l?"text-dim":"text-ink"}`,title:n,children:n})]}),(0,r.jsx)("div",{className:`relative mt-2 min-w-0 ${f?"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:W(e.mtime)}),e.ctx?(0,r.jsx)(nS,{ctx:e.ctx}):null,s?(0,r.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-0.5",children:[(0,r.jsx)(eR.A,{className:"h-3 w-3","aria-hidden":!0})," ",s]}):null]}),a?(0,r.jsx)("div",{className:`relative mt-1 min-w-0 truncate ${f?"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)(nf,{file:e,compact:!0})}):null]})}function r$({title:e,items:t,size:n,currentProject:i,onOpenFile:l,onArchive:s}){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)(tw,{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)(rA,{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:l,onArchive:s})},e.file.path))})]}):null}function rM({files:e,flows:t,project:n,onOpenFile:s}){let{t:a}=h(),[o,c]=(0,l.useState)(!1),[d,u]=(0,l.useState)(""),[p,m]=(0,l.useState)(!1),[f,g]=(0,l.useState)(!1),[b,w]=(0,l.useState)(0),v=(0,l.useRef)(null),y=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:j,archive:k,unarchive:S}=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(rN),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),rS(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,rS(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,rS(n),n})},[])}}(e),C=ec(e,y.events,d,b,j,t),A=ec(e,[],"",b,j,t),$=(0,l.useMemo)(()=>e.filter(e=>j.has(e.path)).map(e=>({file:e,title:x(e.title),project:N(e)})).sort((e,t)=>t.file.mtime-e.file.mtime),[e,j]);(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 M=e=>{s(e),c(!1)},E=e=>k(e.path);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(rC,{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"}),y.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)(i.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)(r$,{title:a("switch.waiting"),items:C.waiting,size:"large",currentProject:n,onOpenFile:M,onArchive:E}),(0,r.jsx)(r$,{title:a("switch.working"),items:C.working,size:"large",currentProject:n,onOpenFile:M,onArchive:E}),(0,r.jsx)(r$,{title:a("switch.recent"),items:C.recent,size:"small",currentProject:n,onOpenFile:M,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:()=>m(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)(r$,{title:"",items:C.older,size:"small",currentProject:n,onOpenFile:M,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":f,onClick:()=>g(e=>!e),children:[(0,r.jsx)("span",{children:a("switch.hidden",{count:$.length})}),(0,r.jsx)("span",{children:f?a("switch.hide"):a("common.show")})]}),f?(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:()=>S(e.file.path),children:a("switch.restore")})]},e.file.path))}):null]}):null]})]})}):null]})}function rE(){location.hash="#p="+encodeURIComponent(g)}function rR({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)(rD,{file:e,onOpen:t},e.path))})]})})}function rD({file:e,onOpen:t}){let{t:n}=h(),[i,s]=(0,l.useState)(!1),a=el(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)(eZ.A,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),(0,r.jsx)("span",{className:"min-w-0 truncate",children:x(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:x(e.title,60)}),onClick:()=>t(e),children:[(0,r.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${J(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:x(e.title,90)}),(0,r.jsx)("span",{className:"shrink-0 text-[10.5px] font-semibold text-dim",children:W(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)(tb,{file:e,onDeleted:()=>s(!0)})]})}function rT({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(),rE()},children:[(0,r.jsx)(eD.A,{className:"h-3 w-3","aria-hidden":!0})," ",n("trash.toArchive")]})}function rP({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})):rE()};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)(eZ.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 rI=n(4614),r_=n(8980);function rq(){let{t:e}=h(),[t,n]=(0,l.useState)(!0);return(0,l.useEffect)(()=>n(ef()),[]),(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(em,e?"on":"off")}catch{}e&&ew("returned",0)},children:t?(0,r.jsx)(rI.A,{className:"h-3.5 w-3.5","aria-hidden":!0}):(0,r.jsx)(r_.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})}function rL({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)(ez.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)(tw,{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=el(e),i=x(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:x(e.title),onClick:()=>t(e),children:[(0,r.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${J(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:W(e.mtime)})]},e.path)})}):null]})}let rO=e=>`llvCols:${e}`,rz=e=>`llvDrafts:${e}`;function rF(e){try{let t=JSON.parse(localStorage.getItem(rO(e))??"{}");return{manual:t.manual??[],hidden:t.hidden??[]}}catch{return{manual:[],hidden:[]}}}function rU(e,t){let n=rF(e);n.manual.includes(t)||n.manual.push(t),n.hidden=n.hidden.filter(e=>e!==t),localStorage.setItem(rO(e),JSON.stringify(n))}function rH({files:e,flows:t,project:n,openNonce:i,archived:s,onArchive:a,onUnarchive:o,onMenu:c}){let{t:d}=h(),u=eC(),p=(0,l.useRef)(null),m=(0,l.useRef)(null),[f,x]=(0,l.useState)({manual:[],hidden:[]}),[g,b]=(0,l.useState)([]),[y,j]=(0,l.useState)(null),k=(0,l.useRef)(f);(0,l.useEffect)(()=>{let e=rF(n);k.current=e,x(e),b(function(e){try{let t=JSON.parse(sessionStorage.getItem(rz(e))??"[]");return Array.isArray(t)?t.filter(e=>"string"==typeof e):[]}catch{return[]}}(n))},[n,i]),(0,l.useEffect)(()=>()=>{p.current&&window.clearTimeout(p.current)},[]);let S=e=>{k.current=e,x(e),localStorage.setItem(rO(n),JSON.stringify(e))},$=(0,l.useMemo)(()=>{let n=q(t);return n.size?e.filter(e=>!n.has(e.path)):e},[e,t]),E=(0,l.useMemo)(()=>M($,n),[$,n]),R=(0,l.useMemo)(()=>new Set(E.map(e=>e.key)),[E]),D=(0,l.useMemo)(()=>(function(e,t,n){let r=C(e),i=[];for(let l of e){if(N(l)!==t||!v(l)||n.has(l.path))continue;let e=A(l,r);if(!e.length)continue;let s=l.mtime,a=w(l);for(let t of e)s=Math.max(s,t.mtime),a=Math.min(a,w(t));i.push({root:l,branchCount:e.length,smt:s,band:a})}return i.sort((e,t)=>e.band-t.band||t.smt-e.smt)})($,n,R),[$,n,R]),T=(0,l.useMemo)(()=>{let e;return e=C($),$.filter(t=>!(N(t)!==n||t.parent||R.has(t.path)||e.get(t.path)?.length)&&"live"!==t.activity).sort((e,t)=>w(e)-w(t)||t.mtime-e.mtime)},[$,n,R]),P=(0,l.useMemo)(()=>new Set(E.flatMap(e=>e.columns.map(e=>e.file.path))),[E]),I=(0,l.useMemo)(()=>new Set(f.hidden),[f.hidden]),_=(0,l.useMemo)(()=>{let e=new Map($.map(e=>[e.path,e]));return f.manual.map(t=>e.get(t)).filter(e=>void 0!==e&&N(e)===n&&!P.has(e.path)&&!I.has(e.path))},[f.manual,$,n,P,I]),L=(0,l.useMemo)(()=>E.reduce((e,t)=>e+t.columns.reduce((e,t)=>e+ +("live"===t.file.activity)+t.tasks.filter(e=>"live"===e.activity).length,0),0),[E]),O=E.filter(e=>!e.orphanTask).length,z=e=>{j(e),p.current&&window.clearTimeout(p.current),p.current=window.setTimeout(()=>j(null),1800)};(0,l.useEffect)(()=>{let e=m.current;e&&(m.current=null,z(e))});let F=e=>{b(e),sessionStorage.setItem(rz(n),JSON.stringify(e))},U=()=>"function"==typeof crypto.randomUUID?crypto.randomUUID():Date.now().toString(36)+Math.random().toString(36).slice(2,10),H=e=>{let t=g.find(t=>nI(t,"src")===e.path);if(t)return void z("draft::"+t);let n=U();n_(n,"src",e.path),F([...g,n]),m.current="draft::"+n},B=e=>{for(let t of["engine","cwd","text","boot","src"])sessionStorage.removeItem(nP(e,t));F(g.filter(t=>t!==e))},W=(e,t)=>{B(e),J(t)},Y=e=>{fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"kill",path:e})}).catch(()=>{}),S({manual:f.manual.filter(t=>t!==e),hidden:P.has(e)?[...new Set([...f.hidden,e])]:f.hidden})};(0,l.useEffect)(()=>{let e=k.current,t=[...P].filter(t=>!e.manual.includes(t)&&!e.hidden.includes(t));if(!t.length)return;let r={...e,manual:[...e.manual,...t].slice(-40)};k.current=r,x(r),localStorage.setItem(rO(n),JSON.stringify(r))},[P,n]);let J=e=>{let t=N(e);if(t!==n){rU(t,e.path),location.hash="#p="+encodeURIComponent(t);return}if(P.has(e.path)&&!I.has(e.path)||_.some(t=>t.path===e.path))return void z(e.path);let r=f.hidden.filter(t=>t!==e.path);S({manual:P.has(e.path)?f.manual:[...new Set([...f.manual,e.path])],hidden:r}),m.current=e.path},K=[];L?K.push(`${d("dash.branchesLive",{count:L})} \xb7 ${d("dash.trees",{count:O})}`):O&&K.push(d("dash.recentConvos",{count:O})),D.length&&K.push(d("dash.quietTrees",{count:D.length}));let Q=E.map(e=>({...e,columns:e.columns.filter(e=>!I.has(e.file.path))})).filter(e=>e.columns.length),X=Q.filter(e=>e.orphanTask).map(e=>e.columns[0].file),V=Q.filter(e=>!e.orphanTask),G=V.length>0||_.length>0||g.length>0,Z=(0,l.useMemo)(()=>e.filter(e=>N(e)===n).sort((e,t)=>t.mtime-e.mtime),[e,n]);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:[c?(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":d("dash.openProjects"),onClick:c,children:(0,r.jsx)(eA.A,{className:"h-4 w-4","aria-hidden":!0})}):null,(0,r.jsx)("h1",{className:"truncate text-[13.5px] font-bold",children:n}),(0,r.jsx)("span",{className:"truncate text-[11.5px] text-dim",children:K.length?K.join(" \xb7 "):d("common.nothingRunning")}),(0,r.jsx)(rq,{}),s?(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:()=>o(n),children:[(0,r.jsx)(eT.A,{className:"h-3 w-3","aria-hidden":!0})," ",d("dash.unarchive")]}):(0,r.jsx)(rT,{files:Z,onArchive:()=>a(n)}),(0,r.jsx)(rP,{files:Z}),(0,r.jsxs)("button",{type:"button",onClick:()=>{let e=U();F([...g,e]),m.current="draft::"+e},"aria-label":d("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:"+"})," ",d("dash.agent")]})]}),X.length?(0,r.jsx)("div",{className:"shrink-0 border-b border-line bg-[#fbfbfd]",children:X.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)(nD,{file:t,files:e,onSelect:J})},t.path))}):null,G?u?(0,r.jsx)(ry,{project:n,groups:V,manual:_,files:e,flows:t,drafts:g,focus:y,onSelect:J,onClose:Y,onDraftClose:B,onDraftSpawned:W,onHandoff:H}):(0,r.jsx)(rw,{project:n,groups:V,manual:_,files:e,flows:t,drafts:g,focus:y,onSelect:J,onClose:Y,onDraftClose:B,onDraftSpawned:W,onHandoff:H}):Z.length?(0,r.jsx)(rR,{files:Z,onOpen:J}):(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:d("dash.emptyTitle")}),(0,r.jsx)("div",{className:"mt-0.5 text-[12px] text-dim",children:d("dash.emptyHint")})]})}),u?null:(0,r.jsx)(rM,{files:e,flows:t,project:n,onOpenFile:J}),T.length?(0,r.jsx)(rL,{items:T,onSelect:J}):null]})}var rB=n(908),rW=n(9314);function rY(){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 m="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 f=(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)(rB.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:[m?(0,r.jsx)("img",{src:m,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:f,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)(eO.A,{className:"h-3.5 w-3.5","aria-hidden":!0}):(0,r.jsx)(rW.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 rJ(){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 rK=(e=u())=>"uk"===e?"uk-UA":"en-US";function rQ({label:e,window:t,engineColor:n,now:i}){var l,s;let a,o,c,d,{t:p}=h();if(!t)return null;let m=Math.max(0,Math.min(100,100-t.usedPercent)),x=m<=10?"#c62828":m<=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:[p("limits.left")," ",(0,r.jsxs)("span",{className:`font-bold tabular-nums ${m<=30?"":"text-ink"}`,style:m<=30?{color:x}:void 0,children:[Math.round(m),"%"]})]})]}),(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(m,1.5)+"%",backgroundColor:x}})}),t.resetsAt?(0,r.jsx)("div",{className:"mt-[3px] text-[10px] leading-none text-dim",children:p("limits.reset",{eta:(l=t.resetsAt,a=u(),(o=l-i)<=60?f(a,"limits.now"):o<5400?f(a,"limits.inMin",{n:Math.round(o/60)}):o<129600?f(a,"limits.inHour",{n:Math.round(o/3600)}):f(a,"limits.inDay",{n:Math.round(o/86400)})),at:(s=t.resetsAt,d=(c=new Date(1e3*s)).toLocaleTimeString(rK(),{hour:"2-digit",minute:"2-digit",hour12:!1}),s-i<86400?d:c.toLocaleDateString(rK(),{day:"numeric",month:"short"})+" "+d)})}):null]})}function rX({label:e,engine:t,limits:n,now:i,staleHint:l}){let{t:s}=h();if(!n||!n.session&&!n.weekly)return null;let a=K[t]??Q,o=n.capturedAt&&i-n.capturedAt>1200?W(n.capturedAt):null;return(0,r.jsxs)("div",{className:`mt-2.5 first:mt-0 ${l?"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,l?(0,r.jsx)("span",{className:"truncate text-[10px] text-dim",children:l}):null,o?(0,r.jsx)("span",{className:"h-1.5 w-1.5 shrink-0 self-center rounded-full bg-[#d29a2f]",title:s("limits.stale",{stale:o})}):null]}),(0,r.jsx)(rQ,{label:s("limits.5h"),window:n.session,engineColor:a.color,now:i}),(0,r.jsx)(rQ,{label:s("limits.week"),window:n.weekly,engineColor:a.color,now:i})]})}function rV(){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:f(t,"limits.asOf",{time:n.toLocaleTimeString(rK(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)(rX,{label:"Claude",engine:"claude",limits:t.data.claude,now:t.at,staleHint:i}),(0,r.jsx)(rX,{label:"Codex",engine:"codex",limits:t.data.codex,now:t.at,staleHint:i})]})}var rG=n(5298),rZ=n(4526);function r0(){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(),l=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(l)}),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)(rG.A,{className:"h-3.5 w-3.5","aria-hidden":!0}):(0,r.jsx)(rZ.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})}function r1({files:e,archivedProjects:t,selected:n,onSelect:i}){let{t:s}=h(),[a,o]=(0,l.useState)(""),[c,d]=(0,l.useState)(!1),u=(0,l.useMemo)(()=>S(e),[e]),p=(0,l.useMemo)(()=>{let e=a.trim().toLowerCase();return e?u.filter(t=>t.project.toLowerCase().includes(e)):u},[u,a]),m=(0,l.useMemo)(()=>p.filter(e=>!t.has(e.project)),[p,t]),f=(0,l.useMemo)(()=>p.filter(e=>t.has(e.project)),[p,t]),x=(0,l.useMemo)(()=>u.reduce((e,t)=>e+t.liveCount,0),[u]),b=(0,l.useMemo)(()=>u.reduce((e,t)=>e+t.attentionCount,0),[u]);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:[s("rail.title"),x?(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"}),x]}):null,b?(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:["⏸ ",b]}):null,(0,r.jsx)(rJ,{}),(0,r.jsx)(rY,{}),(0,r.jsx)(r0,{})]}),(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:s("rail.filter"),value:a,onChange:e=>o(e.target.value)})}),(0,r.jsxs)("nav",{className:"flex-1 overflow-y-auto px-2 pb-3 pt-1","aria-label":s("rail.projects"),children:[(0,r.jsx)(r5,{label:s("rail.overview"),live:0,attention:0,total:null,age:"",active:n===g,hasLive:!1,onClick:()=>i(g)}),(0,r.jsx)("div",{className:"mx-2.5 my-1.5 border-t border-line"}),(0,r.jsx)(tw,{children:m.map(e=>(0,r.jsx)("div",{"data-flip-key":e.project,children:(0,r.jsx)(r5,{label:e.project,live:e.liveCount,attention:e.attentionCount,total:e.conversations,age:W(e.smt),active:n===e.project,hasLive:e.liveCount>0,onClick:()=>i(e.project)})},e.project))}),f.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":c,onClick:()=>d(e=>!e),children:[(0,r.jsx)(ez.A,{className:`h-3 w-3 shrink-0 transition-transform ${c?"rotate-90":""}`,"aria-hidden":!0}),(0,r.jsx)(eD.A,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),s("rail.archive"),(0,r.jsx)("span",{className:"font-semibold",children:f.length})]}),c?f.map(e=>(0,r.jsx)(r5,{label:e.project,live:e.liveCount,attention:e.attentionCount,total:e.conversations,age:W(e.smt),active:n===e.project,hasLive:e.liveCount>0,onClick:()=>i(e.project)},e.project)):null]}):null,m.length||f.length?null:(0,r.jsx)("div",{className:"px-3 py-4 text-center text-[12px] text-dim",children:s("common.nothingFound")})]}),(0,r.jsx)(rV,{})]})}function r5({label:e,live:t,attention:n,total:i,age:l,active:s,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",s?"border-line bg-bg shadow-card":"border-transparent hover:bg-bg"].join(" "),"aria-current":s?"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] ${s?"font-bold":"font-semibold"}`,children:e}),l?(0,r.jsx)("span",{className:"block text-[10.5px] text-dim",children:l}):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 r2="llvProject";function r3(){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 r4(){let e,t,{t:n}=h(),{files:s,flows:a}=function(){let[e,t]=(0,l.useState)(ek);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 l=JSON.parse(i);Array.isArray(l)?t({files:l,flows:[]}):t({files:l.files??[],flows:l.flows??[]})}catch{}};r();let i=setInterval(r,1e4),l=()=>void r();return window.addEventListener(E,l),()=>{e=!1,clearInterval(i),window.removeEventListener(E,l)}},[]),e}(),o=(e=(0,l.useSyncExternalStore)(P,()=>D,()=>I),(0,l.useMemo)(()=>a.some(t=>e.has(t.id)&&"closed"!==t.state)?a.map(t=>e.has(t.id)&&"closed"!==t.state?{...t,state:"closed",closedAt:t.closedAt??new Date().toISOString()}:t):a,[a,e]));t=(0,l.useRef)(null),(0,l.useEffect)(()=>{let e;return e=()=>{let e=eg();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(!s.length)return;let e=new Map;for(let t of s)k(t)||e.set(t.path,ep(t));let n=t.current;if(t.current=e,!n)return;let r=0;for(let[t,i]of e){let e=s.find(e=>e.path===t),l=e?.pendingQuestion||e?.waitingInput?"question":ev[i];if(!l)continue;let a=n.get(t);("live"===a||void 0===a)&&ew(l,function(e){let t=eh.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++)}},[s]);let{archivedProjects:c,archiveProject:d,unarchiveProject:u}=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(ey),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(N(t));i.size!==t.size&&(r.current=i,n(i),ej(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,ej(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,ej(n),n})},[])}}(s),p=eC(),[m,f]=(0,l.useState)(!1),[x,b]=(0,l.useState)(g),[w,v]=(0,l.useState)(null),[y,j]=(0,l.useState)(null),S=(0,l.useRef)(null),[C,A]=(0,l.useState)(0);(0,l.useEffect)(()=>{let e=r3();e.filePath&&v(e.filePath);let t=e.project??localStorage.getItem(r2);t&&b(t)},[]),(0,l.useEffect)(()=>{let e=()=>{let e=r3();e.filePath?v(e.filePath):e.project&&b(e.project)};return window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)},[]);let $=(0,l.useCallback)(e=>{b(e),localStorage.setItem(r2,e),e!==g?history.replaceState(null,"","#p="+encodeURIComponent(e)):history.replaceState(null,"",location.pathname),f(!1)},[]);(0,l.useEffect)(()=>{if(!m)return;let e=e=>{"Escape"===e.key&&f(!1)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[m]);let M=(0,l.useCallback)(e=>{let t=N(e);rU(t,e.path),$(t),A(e=>e+1)},[$]);(0,l.useEffect)(()=>{if(!w||0===s.length)return;let e=s.find(e=>e.path===w);e&&M(e),v(null)},[w,s,M]),(0,l.useEffect)(()=>{let e=s.filter(e=>e.pendingQuestion||e.waitingInput).length;document.title=e?`(${e}) Agent Log Viewer`:"Agent Log Viewer"},[s]),(0,l.useEffect)(()=>{let e=s.map(e=>({file:e,id:e.pendingQuestion?.toolUseId??(e.waitingInput?`${e.path}:waiting:${Math.floor(e.waitingInput.since)}`:null)})).filter(e=>null!==e.id);if(null===S.current){S.current=new Set(e.map(e=>e.id));return}let t=e.find(e=>!S.current.has(e.id));for(let t of e)S.current.add(t.id);t&&queueMicrotask(()=>j(t.file.path))},[s]);let R=y?s.find(e=>e.path===y):null;return(0,r.jsxs)("div",{className:"flex h-full",children:[p?null:(0,r.jsx)(r1,{files:s,archivedProjects:c,selected:x,onSelect:$}),p&&m?(0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex",children:[(0,r.jsx)(r1,{files:s,archivedProjects:c,selected:x,onSelect:$}),(0,r.jsx)("button",{type:"button",className:"min-w-0 flex-1 bg-ink/35","aria-label":n("viewer.closeProjects"),onClick:()=>f(!1)})]}):null,(0,r.jsxs)("main",{className:"flex min-w-0 flex-1 flex-col",children:[R?(0,r.jsxs)("div",{className:"fixed right-4 top-4 z-50 flex max-w-[360px] gap-2 rounded-[8px] border border-[#e0ae45]/45 bg-[#fff9ed] px-4 py-3 text-[13px] font-semibold text-ink shadow-card",children:[(0,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:()=>{M(R),j(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:R.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:()=>j(null),children:(0,r.jsx)(i.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}):null,x===g?(0,r.jsx)(eM,{files:s,archivedProjects:c,onSelectProject:$,onSelectFile:M,onMenu:p?()=>f(!0):void 0}):(0,r.jsx)(rH,{files:s,flows:o,project:x,openNonce:C,archived:c.has(x),onArchive:d,onUnarchive:u,onMenu:p?()=>f(!0):void 0})]})]})}}},e=>{e.O(0,[159,441,794,358],()=>e(e.s=5039)),_N_E=e.O()}]);
|