@muyichengshayu/promptx 0.1.43 → 0.1.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/apps/runner/src/index.js +5 -0
- package/apps/runner/src/runManager.js +20 -0
- package/apps/server/src/index.js +46 -14
- package/apps/server/src/workspaceFiles.js +9 -0
- package/apps/web/dist/assets/CodexSessionManagerDialog-Da3ExvJ6.js +1 -0
- package/apps/web/dist/assets/TaskDiffReviewDialog-DjUU465b.js +2 -0
- package/apps/web/dist/assets/TaskDiffReviewDialog-Np_9C-g7.css +1 -0
- package/apps/web/dist/assets/WorkbenchSettingsDialog-Dp35iSLy.js +1 -0
- package/apps/web/dist/assets/WorkbenchView-CICtaY88.js +47 -0
- package/apps/web/dist/assets/WorkbenchView-CVt59HvL.css +1 -0
- package/apps/web/dist/assets/index-CWazC5a3.css +1 -0
- package/apps/web/dist/assets/index-d30njJCo.js +2 -0
- package/apps/web/dist/assets/{vendor-markdown-BENmzbO1.js → vendor-markdown-9aQhqbjm.js} +1 -1
- package/apps/web/dist/assets/{vendor-misc-DxKJ95A9.js → vendor-misc-u-M8sNMf.js} +1 -1
- package/apps/web/dist/assets/{vendor-router-iukOUtEP.js → vendor-router-Dn8q3tJM.js} +1 -1
- package/apps/web/dist/assets/{vendor-shiki-core-DIyrqeBY.js → vendor-shiki-core-1BqeTDsZ.js} +4 -4
- package/apps/web/dist/assets/vendor-shiki-lang-bash-zsQu0xn-.js +1 -0
- package/apps/web/dist/assets/vendor-shiki-lang-c-BDF8vgks.js +1 -0
- package/apps/web/dist/assets/vendor-shiki-lang-cpp-DyDAaXl6.js +1 -0
- package/apps/web/dist/assets/vendor-shiki-lang-csharp-BWfTXJXw.js +1 -0
- package/apps/web/dist/assets/vendor-shiki-lang-css-DbAm1fUO.js +1 -0
- package/apps/web/dist/assets/vendor-shiki-lang-diff-DmGC1G26.js +1 -0
- package/apps/web/dist/assets/vendor-shiki-lang-dockerfile-3x-8396r.js +1 -0
- package/apps/web/dist/assets/vendor-shiki-lang-dotenv--IVOlX2Q.js +1 -0
- package/apps/web/dist/assets/vendor-shiki-lang-fish-Bpv3hhJP.js +1 -0
- package/apps/web/dist/assets/vendor-shiki-lang-go-CIGC59jP.js +1 -0
- package/apps/web/dist/assets/vendor-shiki-lang-html-Bt_TLLZN.js +1 -0
- package/apps/web/dist/assets/vendor-shiki-lang-ini-BIllfys4.js +1 -0
- package/apps/web/dist/assets/vendor-shiki-lang-java-CXxu9crF.js +1 -0
- package/apps/web/dist/assets/vendor-shiki-lang-javascript-Cha7GNZm.js +1 -0
- package/apps/web/dist/assets/vendor-shiki-lang-json-CCZCjDUh.js +1 -0
- package/apps/web/dist/assets/vendor-shiki-lang-less-DAToytC5.js +1 -0
- package/apps/web/dist/assets/vendor-shiki-lang-markdown-C6lwMXFp.js +1 -0
- package/apps/web/dist/assets/vendor-shiki-lang-powershell-lrpuM0ez.js +1 -0
- package/apps/web/dist/assets/vendor-shiki-lang-python-Bi9rmtY7.js +1 -0
- package/apps/web/dist/assets/vendor-shiki-lang-rust-GTGDbY6A.js +1 -0
- package/apps/web/dist/assets/vendor-shiki-lang-sass-DFtHupN8.js +1 -0
- package/apps/web/dist/assets/vendor-shiki-lang-scss-BrfBNyyi.js +1 -0
- package/apps/web/dist/assets/vendor-shiki-lang-sql-H6--iFN-.js +1 -0
- package/apps/web/dist/assets/vendor-shiki-lang-toml-aTteTWYL.js +1 -0
- package/apps/web/dist/assets/vendor-shiki-lang-tsx-DoKZm6AV.js +1 -0
- package/apps/web/dist/assets/vendor-shiki-lang-typescript-B5awnqri.js +1 -0
- package/apps/web/dist/assets/vendor-shiki-lang-vue-CnrgQ7Z5.js +1 -0
- package/apps/web/dist/assets/vendor-shiki-lang-xml-Bv-TNPJt.js +1 -0
- package/apps/web/dist/assets/vendor-shiki-lang-yaml-DpxUxQ6M.js +1 -0
- package/apps/web/dist/assets/vendor-shiki-theme-github-dark-default-DBX58552.js +1 -0
- package/apps/web/dist/assets/vendor-shiki-theme-github-light-RLAvZv0q.js +1 -0
- package/apps/web/dist/assets/{vendor-tiptap-COqMdKic.js → vendor-tiptap-rwYdQb1L.js} +1 -1
- package/apps/web/dist/assets/{vendor-ui-DTqxu3Qf.js → vendor-ui-C5E3MVzU.js} +1 -1
- package/apps/web/dist/index.html +4 -4
- package/package.json +1 -1
- package/scripts/service.mjs +107 -14
- package/apps/web/dist/assets/CodexSessionManagerDialog-DxrPimh4.js +0 -1
- package/apps/web/dist/assets/TaskDiffReviewDialog-D4rUvNG6.js +0 -2
- package/apps/web/dist/assets/TaskDiffReviewDialog-Dvg4WGbp.css +0 -1
- package/apps/web/dist/assets/WorkbenchSettingsDialog-ClVb-_Av.js +0 -1
- package/apps/web/dist/assets/WorkbenchView-D0SJDU9Q.js +0 -47
- package/apps/web/dist/assets/WorkbenchView-DHfai3aW.css +0 -1
- package/apps/web/dist/assets/index-CsDHhm4n.js +0 -2
- package/apps/web/dist/assets/index-qxA1pzRS.css +0 -1
- package/apps/web/dist/assets/vendor-shiki-lang-bash-DziaAEzp.js +0 -1
- package/apps/web/dist/assets/vendor-shiki-lang-c-DxZVXGej.js +0 -1
- package/apps/web/dist/assets/vendor-shiki-lang-cpp-C0nFeuYF.js +0 -1
- package/apps/web/dist/assets/vendor-shiki-lang-css-5_xDM_L5.js +0 -1
- package/apps/web/dist/assets/vendor-shiki-lang-diff-DV4GsN7t.js +0 -1
- package/apps/web/dist/assets/vendor-shiki-lang-dockerfile-C-v4Vs5o.js +0 -1
- package/apps/web/dist/assets/vendor-shiki-lang-fish-BJ5QHV1v.js +0 -1
- package/apps/web/dist/assets/vendor-shiki-lang-go-BNuwOTVZ.js +0 -1
- package/apps/web/dist/assets/vendor-shiki-lang-html-CUvSKgQ6.js +0 -1
- package/apps/web/dist/assets/vendor-shiki-lang-java-BgscQPPM.js +0 -1
- package/apps/web/dist/assets/vendor-shiki-lang-javascript-BAicPUAA.js +0 -1
- package/apps/web/dist/assets/vendor-shiki-lang-json-C_GpujJu.js +0 -1
- package/apps/web/dist/assets/vendor-shiki-lang-markdown-Isb_iOaL.js +0 -1
- package/apps/web/dist/assets/vendor-shiki-lang-powershell-xNYeLH7k.js +0 -1
- package/apps/web/dist/assets/vendor-shiki-lang-python-ByInZN1m.js +0 -1
- package/apps/web/dist/assets/vendor-shiki-lang-rust-DTGgkwhP.js +0 -1
- package/apps/web/dist/assets/vendor-shiki-lang-sql-paI0NZrg.js +0 -1
- package/apps/web/dist/assets/vendor-shiki-lang-tsx-BXEzAsy_.js +0 -1
- package/apps/web/dist/assets/vendor-shiki-lang-typescript-CPG3q_60.js +0 -1
- package/apps/web/dist/assets/vendor-shiki-lang-vue-BoIQS9wF.js +0 -1
- package/apps/web/dist/assets/vendor-shiki-lang-xml-DzGGQ07l.js +0 -1
- package/apps/web/dist/assets/vendor-shiki-lang-yaml-DuPzWjyg.js +0 -1
- package/apps/web/dist/assets/vendor-shiki-theme-github-dark-default-DxFCgFpQ.js +0 -1
- package/apps/web/dist/assets/vendor-shiki-theme-github-light-CcI-1qo0.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.45
|
|
4
|
+
|
|
5
|
+
- 新增工作台“通用设置”:可配置 `Enter 发送 / Shift+Enter 发送 / 仅按钮发送` 三种发送行为,设置保存在本地,刷新后仍可延续;同时修复回车发送时编辑器会先插入一行空白再发送的问题。
|
|
6
|
+
- 继续统一代码相关阅读区的排版与字体:补齐 `font-mono` 到 `Geist Mono` 的全站映射,源码查看左侧列表、右侧代码预览以及代码变更弹窗统一收口到 `12px`,并上调源码右侧代码行高,减少“这里 11px、那里 13px”带来的割裂感。
|
|
7
|
+
- 加固 Windows 下的 `promptx stop`:服务停止改为优先停 `runner` 再停 `server`,Windows 上增加 `taskkill /T` 进程树回收、强杀后二次确认和超时错误返回;同时为 `server / runner` 补齐 `SIGTERM / SIGINT / SIGBREAK` 优雅退出链路,减少“有时 stop 不掉”的情况。
|
|
8
|
+
|
|
9
|
+
## 0.1.44
|
|
10
|
+
|
|
11
|
+
- 修复源码相关搜索列表的路径截断:源码查看、目录选择与 `@` 文件选择器里的搜索结果,文件名与完整路径都改为优先完整展示,不再因为单行省略而看不清长路径。
|
|
12
|
+
- 补齐常用样式 / 配置文件的语言识别与高亮:新增 `SCSS / Sass / Less / TOML / INI / .env / C#` 的源码预览与回复代码块语言映射,解决 `.scss` 等文件明明是代码却仍按纯文本展示的问题。
|
|
13
|
+
- 为上述语言识别补充前后端回归测试,并再次确认前端构建无大包告警,保证这轮补丁发布足够稳定。
|
|
14
|
+
|
|
3
15
|
## 0.1.43
|
|
4
16
|
|
|
5
17
|
- 继续完善项目源码查看:左侧目录树、路径搜索、内容搜索、`@` 文件选择器与代码变更文件列表统一为同一套选中 / hover / 间距 / 图标 / 副文本视觉语言,深浅主题下的状态反馈更一致。
|
package/apps/runner/src/index.js
CHANGED
|
@@ -114,6 +114,11 @@ process.once('SIGINT', () => {
|
|
|
114
114
|
process.once('SIGTERM', () => {
|
|
115
115
|
shutdown().finally(() => process.exit(0))
|
|
116
116
|
})
|
|
117
|
+
if (process.platform === 'win32') {
|
|
118
|
+
process.once('SIGBREAK', () => {
|
|
119
|
+
shutdown().finally(() => process.exit(0))
|
|
120
|
+
})
|
|
121
|
+
}
|
|
117
122
|
|
|
118
123
|
async function syncConfigFromServer() {
|
|
119
124
|
try {
|
|
@@ -20,6 +20,7 @@ const DEFAULT_STOP_TIMEOUT_MS = Math.max(1000, Number(process.env.PROMPTX_RUNNER
|
|
|
20
20
|
const STOP_TIMEOUT_BUFFER_MS = Math.max(500, Number(process.env.PROMPTX_RUNNER_STOP_TIMEOUT_BUFFER_MS) || 2000)
|
|
21
21
|
const DEFAULT_MAX_CONCURRENT_RUNS = Math.max(1, Number(process.env.PROMPTX_RUNNER_MAX_CONCURRENT_RUNS) || 3)
|
|
22
22
|
const RUNNER_ID = String(process.env.PROMPTX_RUNNER_ID || 'local-runner').trim() || 'local-runner'
|
|
23
|
+
const DISPOSE_POLL_INTERVAL_MS = Math.max(50, Number(process.env.PROMPTX_RUNNER_DISPOSE_POLL_MS) || 100)
|
|
23
24
|
|
|
24
25
|
function nowIso() {
|
|
25
26
|
return new Date().toISOString()
|
|
@@ -111,6 +112,13 @@ function classifyStoppedErrorReason(context = {}) {
|
|
|
111
112
|
return 'user_requested_after_error'
|
|
112
113
|
}
|
|
113
114
|
|
|
115
|
+
function sleep(ms) {
|
|
116
|
+
return new Promise((resolve) => {
|
|
117
|
+
const timer = setTimeout(resolve, Math.max(0, Number(ms) || 0))
|
|
118
|
+
timer.unref?.()
|
|
119
|
+
})
|
|
120
|
+
}
|
|
121
|
+
|
|
114
122
|
export function createRunManager(options = {}) {
|
|
115
123
|
const serverClient = options.serverClient
|
|
116
124
|
const logger = options.logger || console
|
|
@@ -743,6 +751,18 @@ export function createRunManager(options = {}) {
|
|
|
743
751
|
this.stopRun(context.runId, { forceAfterMs: 1000 }).catch(() => null)
|
|
744
752
|
)
|
|
745
753
|
)
|
|
754
|
+
|
|
755
|
+
const deadline = Date.now() + DEFAULT_STOP_TIMEOUT_MS + STOP_TIMEOUT_BUFFER_MS
|
|
756
|
+
while (activeRuns.size && Date.now() < deadline) {
|
|
757
|
+
await sleep(DISPOSE_POLL_INTERVAL_MS)
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
if (activeRuns.size) {
|
|
761
|
+
logger.warn?.({
|
|
762
|
+
activeRunCount: activeRuns.size,
|
|
763
|
+
runIds: [...activeRuns.keys()],
|
|
764
|
+
}, 'runner dispose timed out before all active runs settled')
|
|
765
|
+
}
|
|
746
766
|
},
|
|
747
767
|
}
|
|
748
768
|
}
|
package/apps/server/src/index.js
CHANGED
|
@@ -21,13 +21,14 @@ import {
|
|
|
21
21
|
updateTaskNotificationDelivery,
|
|
22
22
|
updateTask,
|
|
23
23
|
} from './repository.js'
|
|
24
|
-
import {
|
|
25
|
-
getWorkspaceGitDiffStatusSummaryByCwd,
|
|
26
|
-
} from './gitDiff.js'
|
|
27
|
-
import {
|
|
28
|
-
getGitDiffWorkerDiagnostics,
|
|
29
|
-
getTaskGitDiffReviewInSubprocess,
|
|
30
|
-
|
|
24
|
+
import {
|
|
25
|
+
getWorkspaceGitDiffStatusSummaryByCwd,
|
|
26
|
+
} from './gitDiff.js'
|
|
27
|
+
import {
|
|
28
|
+
getGitDiffWorkerDiagnostics,
|
|
29
|
+
getTaskGitDiffReviewInSubprocess,
|
|
30
|
+
stopGitDiffWorker,
|
|
31
|
+
} from './gitDiffClient.js'
|
|
31
32
|
import {
|
|
32
33
|
createPromptxCodexSession,
|
|
33
34
|
deletePromptxCodexSession,
|
|
@@ -440,13 +441,44 @@ app.setErrorHandler((error, request, reply) => {
|
|
|
440
441
|
: { messageKey: 'errors.unexpectedServerError', message: error.message || '发生了意外错误。' })
|
|
441
442
|
reply.code(error.statusCode || 500).send(payload)
|
|
442
443
|
})
|
|
443
|
-
|
|
444
|
-
purgeExpiredContent(true)
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
444
|
+
|
|
445
|
+
purgeExpiredContent(true)
|
|
446
|
+
|
|
447
|
+
let shutdownPromise = null
|
|
448
|
+
|
|
449
|
+
async function shutdown() {
|
|
450
|
+
if (shutdownPromise) {
|
|
451
|
+
return shutdownPromise
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
shutdownPromise = (async () => {
|
|
455
|
+
relayClient.stop()
|
|
456
|
+
taskAutomationService.stop()
|
|
457
|
+
runRecoveryService.stop()
|
|
458
|
+
maintenanceService.stop()
|
|
459
|
+
stopGitDiffWorker()
|
|
460
|
+
await app.close().catch(() => {})
|
|
461
|
+
})()
|
|
462
|
+
|
|
463
|
+
return shutdownPromise
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
process.once('SIGINT', () => {
|
|
467
|
+
shutdown().finally(() => process.exit(0))
|
|
468
|
+
})
|
|
469
|
+
process.once('SIGTERM', () => {
|
|
470
|
+
shutdown().finally(() => process.exit(0))
|
|
471
|
+
})
|
|
472
|
+
if (process.platform === 'win32') {
|
|
473
|
+
process.once('SIGBREAK', () => {
|
|
474
|
+
shutdown().finally(() => process.exit(0))
|
|
475
|
+
})
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
app.listen({ port, host }).then(() => {
|
|
479
|
+
app.log.info(`server running at http://${host}:${port}`)
|
|
480
|
+
buildServerAccessUrls(host, port).forEach((message) => {
|
|
481
|
+
app.log.info(message)
|
|
450
482
|
})
|
|
451
483
|
runRecoveryService.start()
|
|
452
484
|
taskAutomationService.start()
|
|
@@ -65,6 +65,7 @@ const TEXT_FILE_EXTENSIONS = new Set([
|
|
|
65
65
|
'.js',
|
|
66
66
|
'.json',
|
|
67
67
|
'.jsx',
|
|
68
|
+
'.less',
|
|
68
69
|
'.log',
|
|
69
70
|
'.md',
|
|
70
71
|
'.mjs',
|
|
@@ -72,6 +73,8 @@ const TEXT_FILE_EXTENSIONS = new Set([
|
|
|
72
73
|
'.py',
|
|
73
74
|
'.rb',
|
|
74
75
|
'.rs',
|
|
76
|
+
'.sass',
|
|
77
|
+
'.scss',
|
|
75
78
|
'.sh',
|
|
76
79
|
'.sql',
|
|
77
80
|
'.svg',
|
|
@@ -106,22 +109,28 @@ const LANGUAGE_BY_EXTENSION = new Map([
|
|
|
106
109
|
['.csh', 'bash'],
|
|
107
110
|
['.css', 'css'],
|
|
108
111
|
['.diff', 'diff'],
|
|
112
|
+
['.env', 'dotenv'],
|
|
109
113
|
['.fish', 'fish'],
|
|
110
114
|
['.go', 'go'],
|
|
111
115
|
['.h', 'c'],
|
|
112
116
|
['.html', 'html'],
|
|
117
|
+
['.ini', 'ini'],
|
|
113
118
|
['.java', 'java'],
|
|
114
119
|
['.js', 'javascript'],
|
|
115
120
|
['.json', 'json'],
|
|
116
121
|
['.jsx', 'react'],
|
|
122
|
+
['.less', 'less'],
|
|
117
123
|
['.md', 'markdown'],
|
|
118
124
|
['.mjs', 'javascript'],
|
|
119
125
|
['.ps1', 'powershell'],
|
|
120
126
|
['.py', 'python'],
|
|
121
127
|
['.rs', 'rust'],
|
|
128
|
+
['.sass', 'sass'],
|
|
129
|
+
['.scss', 'scss'],
|
|
122
130
|
['.sh', 'bash'],
|
|
123
131
|
['.sql', 'sql'],
|
|
124
132
|
['.svg', 'svg'],
|
|
133
|
+
['.toml', 'toml'],
|
|
125
134
|
['.ts', 'typescript'],
|
|
126
135
|
['.tsx', 'react'],
|
|
127
136
|
['.txt', 'text'],
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{u as De,f as dt,e as ut}from"./index-d30njJCo.js";import{A as ct,n as Je,j as He,d as pt,W as Ye,c as st,k as ft,s as gt,m as vt,o as Ze,_ as mt,b as ht,p as et}from"./WorkbenchView-CICtaY88.js";import{w as me,n as re,ak as lt,aD as p,aI as he,aJ as xe,aF as n,aQ as d,u as l,aG as k,aW as xt,aU as yt,aX as bt,aE as m,aR as Te,aS as Ke,aL as A,aN as C,aV as wt,aK as St,b as _,c as S,aZ as it,r as kt}from"./vendor-misc-u-M8sNMf.js";import{c as $t,L as Ge,F as ze,e as _t,b as ot,M as Ct,o as Mt,x as jt,P as It,i as tt,E as Pt,N as Rt,n as Tt,r as Dt,O as Et}from"./vendor-ui-C5E3MVzU.js";import"./vendor-router-Dn8q3tJM.js";import"./vendor-markdown-9aQhqbjm.js";import"./vendor-tiptap-rwYdQb1L.js";function At(o=[]){return(Array.isArray(o)&&o.length?o:ct).filter($=>$&&typeof $=="object").map($=>{const f=Je($.value);return{...$,value:f,label:String($.label||He(f)).trim()||He(f),enabled:$.enabled!==!1,available:$.available!==!1}})}function Xe(o=[]){return At(o).filter(R=>R.enabled&&R.available)}async function Lt(){const o=await pt("/api/meta",{cache:"no-store"});return Xe(o==null?void 0:o.agentEngineOptions)}const Ft={class:"theme-heading inline-flex items-center gap-2 text-sm font-medium"},Bt={class:"theme-muted-text mt-1 text-xs leading-5"},Nt={class:"theme-divider mt-4 rounded-sm border border-dashed px-3 py-2"},Ot={class:"flex items-start gap-2 text-xs leading-5"},Ut={class:"theme-muted-text shrink-0"},zt={class:"min-w-0 break-all font-mono text-[var(--theme-textPrimary)]"},Ht={class:"theme-muted-text mt-4 block text-xs"},Kt={class:"theme-input-shell mt-1 flex h-10 items-center gap-2 rounded-sm border px-3 transition focus-within:ring-2"},Vt=["placeholder"],qt={class:"theme-content-panel mt-3 min-h-0 flex-1 overflow-y-auto p-2"},Wt={key:0,class:"theme-status-danger rounded-sm border border-dashed px-3 py-3 text-xs"},Qt={key:1,class:"theme-status-danger rounded-sm border border-dashed px-3 py-3 text-xs"},Gt={key:2,class:"theme-empty-state flex items-center justify-center gap-2 px-3 py-8 text-sm"},Jt={key:3,class:"theme-empty-state flex items-center justify-center gap-2 px-3 py-8 text-sm"},Xt={key:4,class:"theme-empty-state px-3 py-8 text-sm"},Yt={key:5,class:"theme-empty-state px-3 py-8 text-sm"},Zt={key:6,class:"theme-empty-state px-3 py-8 text-sm"},en={key:7,class:"space-y-1"},tn=["onClick"],nn={class:"min-w-0 flex-1"},an=["innerHTML"],sn=["innerHTML"],ln={key:0,class:"theme-muted-text px-1 pt-2 text-xs"},on={key:8,class:"space-y-1"},rn={class:"flex items-start gap-1.5"},dn=["onClick"],un=["onClick"],cn={class:"min-w-0 flex-1"},pn={key:0,class:"theme-list-item-subtitle theme-list-item-subtitle--mono break-all"},fn={class:"theme-divider flex flex-col-reverse gap-2 border-t border-dashed px-4 py-4 sm:flex-row sm:items-center sm:justify-end sm:px-5"},gn={class:"flex flex-col-reverse gap-2 sm:flex-row sm:items-center"},vn=["disabled"],mn=["disabled"],hn={__name:"CodexDirectoryPickerDialog",props:{open:{type:Boolean,default:!1},initialPath:{type:String,default:""},suggestions:{type:Array,default:()=>[]}},emits:["close","select"],setup(o,{emit:R}){const $=o,f=R,{t:v}=De(),M=_(""),c=_(null),x=_(!1),y=_(""),r=_(!1),g=_(""),L=_([]),Q=_(!1),E=_(""),I=_(""),K=_(null);let F=null,N=0,O=null;const V=new Map,ee=S(()=>$e(c.value?[c.value]:[])),q=S(()=>String(E.value||"").trim()),ae=S(()=>q.value.length>=Ye),P=S(()=>!!q.value),J=S(()=>P.value?L.value:ee.value),b=S(()=>J.value.map(e=>{const s=T((e==null?void 0:e.path)||""),a=e!=null&&e.expanded?1:0,u=e!=null&&e.loading?1:0;return`${s}:${a}:${u}`}).join("|")),ye=S(()=>P.value&&!ae.value&&!r.value&&!g.value),Ve=S(()=>P.value&&ae.value&&!r.value&&!g.value&&!L.value.length),de=S(()=>!P.value&&!x.value&&!y.value&&!ee.value.length);function se(e=""){const s=String(e||"").trim();return/^[a-z]:[\\/]/i.test(s)||s.includes("\\")}function T(e=""){const s=String(e||"").trim();if(!s)return"";const a=se(s);let u=s.replace(/\\/g,"/");return u.length>1&&!/^[a-z]:\/?$/i.test(u)&&u!=="/"&&(u=u.replace(/\/+$/,"")),a?u.toLowerCase():u}function X(e="",s=""){const a=T(e),u=T(s);return!a||!u?!1:a===u||a.startsWith(`${u}/`)}function j(e="",s=""){const a=String(e||"").trim(),u=String(s||"").trim();return a?u?se(a)?/^[a-z]:\\?$/i.test(a)?`${a.replace(/[\\/]+$/,"")}\\${u}`:`${a.replace(/[\\/]+$/,"")}\\${u}`:a==="/"?`/${u}`:`${a.replace(/\/+$/,"")}/${u}`:a:u}function qe(e="",s=""){const a=T(e),u=T(s);if(!a||!u||!X(u,a))return[];const B=u===a?"":u.slice(a.length).replace(/^\//,"");return B?B.split("/").filter(Boolean):[]}function ue(e=""){const s=String(e||"").trim();if(!s||T(s)===T(M.value))return"";const a=se(s),u=s.replace(/\\/g,"/");if(a){const Z=u.replace(/\/+$/,""),t=Z.lastIndexOf("/");if(t<=2)return"";const i=Z.slice(0,t).replace(/\//g,"\\");return X(i,M.value)?i:""}const B=u.replace(/\/+$/,""),G=B.lastIndexOf("/");if(G<=0)return"";const ve=B.slice(0,G)||"/";return X(ve,M.value)?ve:""}function be(e){return(e==null?void 0:e.name)||(e==null?void 0:e.path)||v("directoryPicker.unnamedDirectory")}function we(e=""){const s=String(e||"").trim();return s?s.split(/[\\/]/).filter(Boolean).at(-1)||s:"Home"}function oe(e=""){return String(e||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Ee(e="",s=""){const a=String(e||""),u=String(s||"").trim().toLowerCase();if(!a||!u)return null;const B=a.toLowerCase(),G=B.indexOf(u);if(G>=0)return{start:G,end:G+u.length};const ve=u.split(/[\\/\s_.-]+/).filter(Boolean).sort((Z,t)=>t.length-Z.length);for(const Z of ve){if(Z.length<2)continue;const t=B.indexOf(Z);if(t>=0)return{start:t,end:t+Z.length}}return null}function Se(e="",s=""){const a=String(e||""),u=Ee(a,s);return u?`${oe(a.slice(0,u.start))}<mark class="theme-search-highlight">${oe(a.slice(u.start,u.end))}</mark>${oe(a.slice(u.end))}`:oe(a)}function Ae(e){return Se(be(e),E.value)}function Le(e){return Se((e==null?void 0:e.path)||"",E.value)}function ke(e,s=0){return{...e,depth:s,expanded:!1,loaded:!1,loading:!1,children:[]}}function $e(e=[],s=[]){return e.forEach(a=>{s.push(a),a.expanded&&a.children.length&&$e(a.children,s)}),s}function te(){c.value&&(c.value={...c.value})}function U(){F&&(window.clearTimeout(F),F=null),O&&(O.abort(),O=null)}function ne(e,s=c.value?[c.value]:[]){const a=T(e);if(!a)return null;for(const u of s){if(T(u.path)===a)return u;if(u.children.length){const B=ne(e,u.children);if(B)return B}}return null}function z(e){I.value=String((e==null?void 0:e.path)||"").trim()}function Y(e=""){return T(e)}function ce(e,s){const a=Y(e);if(a){if(s){V.set(a,s);return}V.delete(a)}}function le(){var s;const e=V.get(Y(I.value));(s=e==null?void 0:e.scrollIntoView)==null||s.call(e,{block:"nearest"})}function _e(){re(()=>{var e,s;(s=(e=K.value)==null?void 0:e.focus)==null||s.call(e)})}function Ce(){const e=J.value;if(!e.length){I.value="";return}const s=Y(I.value);s&&e.some(a=>Y((a==null?void 0:a.path)||"")===s)||z(e[0])}function pe(){const e=J.value;if(!e.length)return-1;const s=Y(I.value),a=e.findIndex(u=>Y((u==null?void 0:u.path)||"")===s);return a>=0?a:0}function ie(){const e=J.value,s=pe();return s<0||!e.length?null:e[s]||null}function W(e=1){const s=J.value;if(!s.length)return!1;const a=pe(),u=a<0?0:(a+e+s.length)%s.length;return z(s[u]),re(le),!0}async function fe(){if(P.value)return!1;const e=ie();if(!e||!e.hasChildren)return!1;if(!e.expanded)return await Pe(e),!0;const s=J.value,a=pe(),u=s[a+1];return u&&ue(u.path)===e.path?(z(u),re(le),!0):!1}function Me(){if(P.value)return!1;const e=ie();if(!e)return!1;if(e.expanded&&e.hasChildren)return e.expanded=!1,te(),z(e),!0;const s=ue(e.path);if(!s)return!1;const a=ne(s);return a?(z(a),re(le),!0):!1}function ge(e){var s,a,u;if((s=e==null?void 0:e.preventDefault)==null||s.call(e),q.value){(a=e==null?void 0:e.stopPropagation)==null||a.call(e),E.value="";return}(u=e==null?void 0:e.stopPropagation)==null||u.call(e),f("close")}function Fe(e){const s=String((e==null?void 0:e.key)||"");if(["ArrowDown","ArrowUp","ArrowLeft","ArrowRight","Enter","Escape"].includes(s)&&!(P.value&&(s==="ArrowLeft"||s==="ArrowRight"))){if(s==="ArrowDown"){e.preventDefault(),W(1);return}if(s==="ArrowUp"){e.preventDefault(),W(-1);return}if(s==="Escape"){ge(e);return}if(P.value){if(s==="Enter"){e.preventDefault();const a=ie();a&&Re(a)}return}if(s==="ArrowRight"){e.preventDefault(),fe();return}if(s==="ArrowLeft"){e.preventDefault(),Me();return}s==="Enter"&&(e.preventDefault(),Ue())}}async function je(e,s={}){if(!(!e||e.loading)&&!(e.loaded&&!s.force)){e.loading=!0,y.value="",te();try{const a=await Ze({path:e.path,limit:240});e.children=(a.items||[]).map(u=>ke(u,e.depth+1)),e.loaded=!0}catch(a){y.value=a.message||v("directoryPicker.loadFailed")}finally{e.loading=!1,te()}}}async function We(){x.value=!0,y.value="";try{const e=await Ze({limit:240});M.value=String(e.path||""),c.value=ke({name:we(e.path||""),path:String(e.path||""),type:"directory",hasChildren:!0,isHomeRoot:!0},0),c.value.children=(e.items||[]).map(s=>ke(s,1)),c.value.loaded=!0,c.value.expanded=!0,z(c.value)}catch(e){y.value=e.message||v("directoryPicker.treeLoadFailed"),c.value=null,M.value=""}finally{x.value=!1}}async function Ie(e=""){const s=String(e||"").trim();if(!s||!M.value||!X(s,M.value))return;let a=c.value;if(!a)return;z(a);const u=qe(M.value,s);for(const B of u){await je(a),a.expanded=!0,te();const G=ne(j(a.path,B),a.children);if(!G)break;a=G,z(a)}}async function Qe(){E.value="",L.value=[],g.value="",Q.value=!1,I.value="",await We();const e=String($.initialPath||"").trim();e&&X(e,M.value)&&await Ie(e)}async function Pe(e){if(e!=null&&e.path&&(z(e),!!e.hasChildren)){if(!e.loaded){e.expanded=!0,te(),await je(e);return}e.expanded=!e.expanded,te()}}function Be(e){e!=null&&e.path&&z(e)}async function Ne(){const e=String(E.value||"").trim();N+=1;const s=N;if(U(),!$.open||!e||!M.value||!ae.value){r.value=!1,g.value="",L.value=[],Q.value=!1;return}r.value=!0,g.value="",O=new AbortController;try{const a=await gt(e,{path:M.value,limit:80,signal:O.signal});if(s!==N)return;L.value=Array.isArray(a.items)?a.items:[],Q.value=!!a.truncated}catch(a){if(vt(a)||s!==N)return;g.value=a.message||v("directoryPicker.searchFailed"),L.value=[],Q.value=!1}finally{s===N&&(O=null),s===N&&(r.value=!1)}}function Oe(){if(U(),!String(E.value||"").trim()||!ae.value){r.value=!1,g.value="",L.value=[],Q.value=!1;return}r.value=!0,g.value="",F=window.setTimeout(()=>{F=null,Ne()},ft)}async function Re(e){e!=null&&e.path&&(await Ie(e.path),E.value="")}function Ue(){I.value&&(f("select",I.value),f("close"))}return me(E,()=>{Oe()}),me(b,()=>{Ce(),re(le)},{immediate:!0}),me(()=>$.open,e=>{if(e){Qe().catch(()=>{}),_e();return}U()}),lt(()=>{U()}),(e,s)=>(p(),he(st,{open:o.open,"stack-level":1,"panel-class":"settings-dialog-panel h-full max-w-4xl sm:h-auto sm:max-h-[86vh]","header-class":"settings-dialog-header px-5 py-4","body-class":"settings-dialog-body flex min-h-0 flex-1 flex-col overflow-hidden px-4 py-4 sm:px-5","close-disabled":x.value||r.value,"close-on-backdrop":!(x.value||r.value),"close-on-escape":!(x.value||r.value),onClose:s[2]||(s[2]=a=>f("close"))},{title:xe(()=>[n("div",null,[n("div",Ft,[k(l(ze),{class:"h-4 w-4"}),n("span",null,d(l(v)("directoryPicker.title")),1)]),n("p",Bt,d(l(v)("directoryPicker.intro")),1)])]),default:xe(()=>[n("div",{class:"flex min-h-0 flex-1 flex-col overflow-hidden",onKeydown:Fe},[n("div",Nt,[n("div",Ot,[n("span",Ut,d(l(v)("directoryPicker.currentSelection")),1),n("span",zt,d(I.value||l(v)("directoryPicker.selectionPlaceholder")),1)])]),n("label",Ht,[n("span",null,d(l(v)("directoryPicker.searchLabel")),1),n("div",Kt,[k(l($t),{class:"h-4 w-4 shrink-0 text-[var(--theme-textMuted)]"}),xt(n("input",{ref_key:"searchInputRef",ref:K,"onUpdate:modelValue":s[0]||(s[0]=a=>E.value=a),type:"text",placeholder:l(v)("directoryPicker.searchPlaceholder"),class:"min-w-0 flex-1 border-0 bg-transparent px-0 text-sm text-[var(--theme-textPrimary)] outline-none placeholder:text-[var(--theme-textMuted)]",onKeydown:yt(ge,["esc"])},null,40,Vt),[[bt,E.value]])])]),n("div",qt,[P.value&&g.value?(p(),m("div",Wt,d(g.value),1)):!P.value&&y.value?(p(),m("div",Qt,d(y.value),1)):P.value&&r.value?(p(),m("div",Gt,[k(l(Ge),{class:"h-4 w-4 animate-spin"}),n("span",null,d(l(v)("directoryPicker.searching")),1)])):!P.value&&x.value?(p(),m("div",Jt,[k(l(Ge),{class:"h-4 w-4 animate-spin"}),n("span",null,d(l(v)("directoryPicker.treeLoading")),1)])):ye.value?(p(),m("div",Xt,d(l(v)("directoryPicker.searchMinKeywordHint",{count:l(Ye)})),1)):Ve.value?(p(),m("div",Yt,d(l(v)("directoryPicker.noSearchResults")),1)):de.value?(p(),m("div",Zt,d(l(v)("directoryPicker.emptyTree")),1)):P.value?(p(),m("div",en,[(p(!0),m(Te,null,Ke(L.value,a=>(p(),m("button",{key:a.path,ref_for:!0,ref:u=>ce(a.path,u),type:"button",class:A(["theme-list-row focus:outline-none",T(I.value)===T(a.path)?"theme-list-item-active":"theme-list-item-hover"]),onClick:u=>Re(a)},[k(l(ze),{class:"theme-list-item-icon"}),n("div",nn,[n("div",null,[n("span",{class:"theme-list-item-title block break-all",innerHTML:Ae(a)},null,8,an)]),n("div",{class:"theme-list-item-subtitle theme-list-item-subtitle--mono break-all",innerHTML:Le(a)},null,8,sn)])],10,tn))),128)),Q.value?(p(),m("p",ln,d(l(v)("directoryPicker.truncatedHint")),1)):C("",!0)])):(p(),m("div",on,[(p(!0),m(Te,null,Ke(ee.value,a=>(p(),m("div",{key:a.path,ref_for:!0,ref:u=>ce(a.path,u),class:A(["theme-list-tree-item outline-none focus:outline-none focus-visible:outline-none",T(I.value)===T(a.path)?"theme-list-item-active":a.expanded?"theme-list-item-expanded":"theme-list-item-hover"]),style:wt({paddingLeft:`${a.depth*16+6}px`})},[n("div",rn,[n("button",{type:"button",class:A(["theme-icon-button h-5 w-5 shrink-0",a.hasChildren?"":"invisible pointer-events-none"]),onClick:St(u=>Pe(a),["stop"])},[a.loading?(p(),he(l(Ge),{key:0,class:"h-3.5 w-3.5 animate-spin"})):(p(),he(l(_t),{key:1,class:A(["h-3.5 w-3.5 transition",a.expanded?"rotate-90 text-[var(--theme-textPrimary)]":""])},null,8,["class"]))],10,dn),n("button",{type:"button",class:"flex min-w-0 flex-1 items-start gap-1.5 rounded-sm px-0.5 py-0.5 text-left",onClick:u=>Be(a)},[k(l(ze),{class:A(["h-4 w-4 shrink-0",T(I.value)===T(a.path)?"text-[var(--theme-textPrimary)]":"text-[var(--theme-textMuted)]"])},null,8,["class"]),n("div",cn,[n("div",{class:A(["theme-list-item-title truncate",a.isHomeRoot?"font-medium text-[var(--theme-textSecondary)]":"font-medium text-[var(--theme-textPrimary)]"])},d(be(a)),3),a.isHomeRoot?(p(),m("div",pn,d(a.path),1)):C("",!0)])],8,un)])],6))),128))]))])],32),n("div",fn,[n("div",gn,[n("button",{type:"button",class:"tool-button w-full px-3 py-2 text-xs sm:w-auto",disabled:x.value||r.value,onClick:s[1]||(s[1]=a=>f("close"))},d(l(v)("directoryPicker.cancel")),9,vn),n("button",{type:"button",class:"tool-button tool-button-primary inline-flex w-full items-center justify-center gap-2 px-3 py-2 text-xs sm:w-auto",disabled:x.value||r.value||!I.value,onClick:Ue},[k(l(ot),{class:"h-4 w-4"}),n("span",null,d(l(v)("directoryPicker.useCurrentDirectory")),1)],8,mn)])])]),_:1},8,["open","close-disabled","close-on-backdrop","close-on-escape"]))}},xn={class:"grid gap-4"},yn={class:"theme-muted-text block text-xs"},bn=["value","disabled"],wn={class:"theme-muted-text block text-xs"},Sn={class:"mt-1 flex gap-2"},kn=["value","disabled"],$n=["disabled"],_n={id:"codex-manager-workspace-suggestions"},Cn=["value"],Mn={key:0,class:"mt-2 text-[11px] leading-5 text-[var(--theme-warningText)]"},jn={key:1,class:"theme-muted-text mt-2 text-[11px] leading-5"},In={class:"theme-muted-text block text-xs"},Pn={class:"mt-1"},Rn={class:"flex items-center gap-2 text-sm"},Tn={key:0,class:"theme-muted-text rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]"},Dn=["disabled","onClick"],En={class:"flex items-center justify-between gap-3"},An={class:"min-w-0 flex-1 truncate"},Ln={key:0,class:"theme-muted-text rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]"},Fn={key:0,class:"theme-muted-text mt-2 text-[11px] leading-5"},Bn={class:"theme-muted-text block text-xs"},Nn={class:"mt-1 flex gap-2"},On=["value","disabled"],Un=["disabled"],zn={key:0,class:"theme-muted-text mt-2 text-[11px] leading-5"},Hn={key:1,class:"theme-muted-text mt-2 text-[11px] leading-5"},nt={__name:"CodexSessionManagerForm",props:{busy:{type:Boolean,default:!1},canEditEngine:{type:Boolean,default:!0},canEditCwd:{type:Boolean,default:!0},canEditSessionId:{type:Boolean,default:!0},cwd:{type:String,default:""},cwdReadonlyMessage:{type:String,default:""},duplicateCwdMessage:{type:String,default:""},engine:{type:String,default:"codex"},engineOptions:{type:Array,default:()=>[]},engineReadonlyMessage:{type:String,default:""},mobile:{type:Boolean,default:!1},sessionId:{type:String,default:""},sessionIdCopied:{type:Boolean,default:!1},sessionIdReadonlyMessage:{type:String,default:""},title:{type:String,default:""},workspaceSuggestions:{type:Array,default:()=>[]}},emits:["copy-session-id","open-directory-picker","update:cwd","update:engine","update:sessionId","update:title"],setup(o,{emit:R}){const $=o,f=R,{t:v}=De(),M=S(()=>{const x=String($.engine||"").trim();return $.engineOptions.find(y=>String((y==null?void 0:y.value)||"").trim()===x)||null}),c=S(()=>String($.sessionId||"").trim());return(x,y)=>(p(),m("div",xn,[n("label",yn,[n("span",null,d(l(v)("projectManager.projectTitleOptional")),1),n("input",{value:o.title,type:"text",maxlength:"140",placeholder:"",class:"tool-input mt-1",disabled:o.busy,onInput:y[0]||(y[0]=r=>f("update:title",r.target.value))},null,40,bn)]),n("label",wn,[n("span",null,d(l(v)("projectManager.workingDirectoryField")),1),n("div",Sn,[n("input",{value:o.cwd,type:"text",list:"codex-manager-workspace-suggestions",placeholder:"",class:A(["tool-input min-w-0 flex-1 disabled:cursor-not-allowed disabled:opacity-80",o.duplicateCwdMessage?"border-[var(--theme-warning)]":""]),disabled:o.busy||!o.canEditCwd,onInput:y[1]||(y[1]=r=>f("update:cwd",r.target.value))},null,42,kn),n("button",{type:"button",class:"tool-button inline-flex shrink-0 items-center gap-2 px-3 py-2 text-xs",disabled:o.busy||!o.canEditCwd,onClick:y[2]||(y[2]=r=>f("open-directory-picker"))},[k(l(ze),{class:"h-4 w-4"}),n("span",null,d(o.mobile?l(v)("projectManager.choose"):l(v)("projectManager.chooseDirectory")),1)],8,$n)]),n("datalist",_n,[(p(!0),m(Te,null,Ke(o.workspaceSuggestions,r=>(p(),m("option",{key:r,value:r},null,8,Cn))),128))]),o.duplicateCwdMessage?(p(),m("p",Mn,d(o.duplicateCwdMessage),1)):o.cwdReadonlyMessage?(p(),m("p",jn,d(o.cwdReadonlyMessage),1)):C("",!0)]),n("label",In,[n("span",null,d(l(v)("projectManager.engineField")),1),n("div",Pn,[k(mt,{"model-value":o.engine,options:o.engineOptions,disabled:o.busy||!o.canEditEngine,placeholder:l(v)("projectManager.selectEngine"),"empty-text":l(v)("projectManager.noEngines"),"get-option-value":r=>(r==null?void 0:r.value)||"","onUpdate:modelValue":y[3]||(y[3]=r=>f("update:engine",r))},{trigger:xe(({disabled:r})=>{var g;return[n("div",Rn,[n("span",{class:A(["min-w-0 flex-1 truncate",r?"theme-muted-text":"text-[var(--theme-textPrimary)]"])},d(((g=M.value)==null?void 0:g.label)||l(v)("projectManager.selectEngine")),3),M.value&&M.value.enabled===!1?(p(),m("span",Tn,d(l(v)("projectManager.comingSoon")),1)):C("",!0)])]}),option:xe(({option:r,selected:g,select:L})=>[n("button",{type:"button",class:A(["w-full rounded-sm border border-dashed px-3 py-2 text-left text-sm transition",g?"theme-filter-active":"theme-filter-idle"]),disabled:(r==null?void 0:r.enabled)===!1,onClick:L},[n("div",En,[n("span",An,d(r.label),1),(r==null?void 0:r.enabled)===!1?(p(),m("span",Ln,d(l(v)("projectManager.comingSoon")),1)):C("",!0)])],10,Dn)]),_:1},8,["model-value","options","disabled","placeholder","empty-text","get-option-value"])]),o.engineReadonlyMessage?(p(),m("p",Fn,d(o.engineReadonlyMessage),1)):C("",!0)]),n("label",Bn,[n("span",null,d(l(v)("projectManager.sessionId")),1),n("div",Nn,[n("input",{value:o.sessionId,type:"text",placeholder:"",class:"tool-input min-w-0 flex-1 disabled:cursor-not-allowed disabled:opacity-80",disabled:o.busy||!o.canEditSessionId,onInput:y[4]||(y[4]=r=>f("update:sessionId",r.target.value))},null,40,On),c.value?(p(),m("button",{key:0,type:"button",class:"tool-button inline-flex shrink-0 items-center gap-2 px-3 py-2 text-xs",disabled:o.busy,onClick:y[5]||(y[5]=r=>f("copy-session-id"))},[o.sessionIdCopied?(p(),he(l(ot),{key:0,class:"h-4 w-4"})):(p(),he(l(Ct),{key:1,class:"h-4 w-4"})),n("span",null,d(o.sessionIdCopied?l(v)("projectManager.sessionIdCopied"):l(v)("projectManager.copySessionId")),1)],8,Un)):C("",!0)]),o.sessionIdReadonlyMessage?(p(),m("p",zn,d(o.sessionIdReadonlyMessage),1)):(p(),m("p",Hn,d(l(v)("projectManager.sessionIdHint")),1))])]))}},Kn={class:"flex items-center justify-between gap-3"},Vn={class:"theme-heading text-sm font-medium"},qn={key:0,class:"theme-muted-text mt-1 text-xs"},Wn=["disabled"],Qn=["onClick"],Gn={key:0,class:"theme-selection-indicator absolute inset-y-3 left-0 w-1 rounded-full"},Jn={class:"flex w-full flex-col gap-2 text-left"},Xn={class:"theme-heading min-w-0 text-sm font-medium"},Yn=["title"],Zn=["title"],ea={class:"theme-muted-text flex flex-wrap items-center gap-x-2 gap-y-1 text-[11px] leading-5"},ta={key:0,"aria-hidden":"true"},na={key:1},aa={class:"flex flex-wrap items-center gap-2 pt-1"},sa={key:0,class:"h-1.5 w-1.5 rounded-full bg-current animate-pulse"},at={__name:"CodexSessionManagerList",props:{busy:{type:Boolean,default:!1},editingSessionId:{type:String,default:""},formatUpdatedAt:{type:Function,default:o=>o},getRuntimeStatusClass:{type:Function,default:()=>""},getRuntimeStatusLabel:{type:Function,default:()=>""},getThreadStatusClass:{type:Function,default:()=>""},getThreadStatusLabel:{type:Function,default:()=>""},hasSessions:{type:Boolean,default:!1},isCurrentSession:{type:Function,default:()=>!1},isSessionRunning:{type:Function,default:()=>!1},mode:{type:String,default:"edit"},mobile:{type:Boolean,default:!1},sessions:{type:Array,default:()=>[]}},emits:["create","select"],setup(o,{emit:R}){const $=o,f=R,{t:v}=De();function M(y){return $.mode==="edit"&&$.editingSessionId===y.id?"theme-card-selected":$.isSessionRunning(y.id)?"theme-card-warning":"theme-card-idle-strong"}function c(y){return $.isCurrentSession(y.id)?v("projectManager.current"):v("projectManager.regular")}function x(y){return $.isCurrentSession(y.id)?"theme-status-info":"theme-status-neutral"}return(y,r)=>(p(),m("div",{class:A(o.mobile?"flex h-full min-h-0 flex-col":"")},[n("div",Kn,[n("div",null,[n("div",Vn,d(l(v)("projectManager.projectList")),1),o.hasSessions?C("",!0):(p(),m("p",qn,d(l(v)("projectManager.noProjects")),1))]),n("button",{type:"button",class:"tool-button tool-button-primary inline-flex items-center gap-2 px-3 py-2 text-xs",disabled:o.busy,onClick:r[0]||(r[0]=g=>f("create"))},[k(l(Mt),{class:"h-4 w-4"}),n("span",null,d(l(v)("projectManager.create")),1)],8,Wn)]),n("div",{class:A(["mt-4 space-y-2",o.mobile?"min-h-0 flex-1 overflow-y-auto":"max-h-52 overflow-y-auto pr-1 sm:max-h-64 lg:max-h-[calc(88vh-11rem)]"])},[(p(!0),m(Te,null,Ke(o.sessions,g=>(p(),m("article",{key:g.id,class:A(["relative cursor-pointer rounded-sm border p-3 transition",M(g)]),onClick:L=>f("select",g.id)},[o.mode==="edit"&&o.editingSessionId===g.id?(p(),m("span",Gn)):C("",!0),n("div",Jn,[n("div",Xn,[n("span",{class:"block truncate",title:g.title||l(v)("projectManager.untitledProject")},d(g.title||l(v)("projectManager.untitledProject")),9,Yn)]),n("div",{class:"theme-muted-text break-all font-mono text-[11px] leading-5",title:g.cwd},d(g.cwd),9,Zn),n("div",ea,[n("span",null,d(l(He)(g.engine)),1),o.mobile?C("",!0):(p(),m("span",ta,"·")),o.mobile?C("",!0):(p(),m("span",na,d(o.formatUpdatedAt(g.updatedAt)),1))]),n("div",aa,[n("span",{class:A(["inline-flex shrink-0 whitespace-nowrap rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]",x(g)])},d(c(g)),3),n("span",{class:A(["inline-flex shrink-0 items-center gap-1 whitespace-nowrap rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]",o.getRuntimeStatusClass(g.id)])},[o.isSessionRunning(g.id)?(p(),m("span",sa)):C("",!0),it(" "+d(o.getRuntimeStatusLabel(g.id)),1)],2),n("span",{class:A(["inline-flex shrink-0 whitespace-nowrap rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]",o.getThreadStatusClass(g)])},d(o.getThreadStatusLabel(g)),3)])])],10,Qn))),128))],2)],2))}},la={class:"space-y-3"},ia={class:"dashed-panel px-3 py-3"},oa={class:"theme-muted-text text-[11px]"},ra={class:"mt-2 flex flex-wrap gap-2"},da={key:0,class:"h-1.5 w-1.5 rounded-full bg-current animate-pulse"},ua={key:0,class:"theme-status-info inline-flex items-center gap-1 rounded-sm border border-dashed px-2 py-1 text-xs"},ca={class:"dashed-panel px-3 py-3"},pa={class:"theme-muted-text text-[11px]"},fa={class:"mt-2 text-sm text-[var(--theme-textPrimary)]"},ga={class:"dashed-panel px-3 py-3"},va={class:"theme-muted-text text-[11px]"},ma={class:"mt-2 break-all font-mono text-xs leading-6 text-[var(--theme-textPrimary)]"},ha={class:"dashed-panel px-3 py-3"},xa={class:"theme-muted-text text-[11px]"},ya={class:"mt-2 text-sm text-[var(--theme-textPrimary)]"},ba={class:"dashed-panel px-3 py-3"},wa={class:"theme-muted-text inline-flex items-center gap-2 text-[11px]"},Sa={class:"mt-2 text-xs leading-6 text-[var(--theme-textSecondary)]"},ka={__name:"CodexSessionManagerStatus",props:{activeSession:{type:Object,default:null},formatUpdatedAt:{type:Function,default:o=>o},getRuntimeStatusClass:{type:Function,default:()=>""},getRuntimeStatusLabel:{type:Function,default:()=>""},getThreadStatusClass:{type:Function,default:()=>""},getThreadStatusLabel:{type:Function,default:()=>""},isCurrentSession:{type:Function,default:()=>!1},isSessionRunning:{type:Function,default:()=>!1}},setup(o){const{t:R}=De();return($,f)=>{var v,M,c,x,y,r,g;return p(),m("div",la,[n("div",ia,[n("div",oa,d(l(R)("projectManager.runtimeStatus")),1),n("div",ra,[n("span",{class:A(["inline-flex items-center gap-1 rounded-sm border border-dashed px-2 py-1 text-xs",o.getRuntimeStatusClass((v=o.activeSession)==null?void 0:v.id)])},[o.isSessionRunning((M=o.activeSession)==null?void 0:M.id)?(p(),m("span",da)):C("",!0),it(" "+d(o.getRuntimeStatusLabel((c=o.activeSession)==null?void 0:c.id)),1)],2),n("span",{class:A(["inline-flex items-center gap-1 rounded-sm border border-dashed px-2 py-1 text-xs",o.getThreadStatusClass(o.activeSession)])},d(o.getThreadStatusLabel(o.activeSession)),3),(x=o.activeSession)!=null&&x.id&&o.isCurrentSession(o.activeSession.id)?(p(),m("span",ua,d(l(R)("projectManager.currentProject")),1)):C("",!0)])]),n("div",ca,[n("div",pa,d(l(R)("projectManager.engine")),1),n("div",fa,d(l(He)((y=o.activeSession)==null?void 0:y.engine)),1)]),n("div",ga,[n("div",va,d(l(R)("projectManager.workingDirectory")),1),n("div",ma,d(((r=o.activeSession)==null?void 0:r.cwd)||l(R)("projectManager.notSet")),1)]),n("div",ha,[n("div",xa,d(l(R)("projectManager.updatedAt")),1),n("div",ya,d(o.formatUpdatedAt((g=o.activeSession)==null?void 0:g.updatedAt)),1)]),n("div",ba,[n("div",wa,[k(l(jt),{class:"h-3.5 w-3.5"}),n("span",null,d(l(R)("projectManager.note")),1)]),n("p",Sa,d(l(R)("projectManager.noteDescription")),1)])])}}},$a={class:"theme-heading inline-flex items-center gap-2 text-sm font-medium"},_a={key:0,class:"grid min-h-0 flex-1 gap-0 lg:grid-cols-[minmax(0,300px)_minmax(0,1fr)]"},Ca={class:"theme-divider theme-muted-panel border-b px-3 py-3 sm:px-4 sm:py-4 lg:border-b-0 lg:border-r"},Ma={class:"min-h-0 overflow-y-auto px-4 py-4 sm:px-5"},ja={class:"flex flex-wrap items-start justify-between gap-3"},Ia={class:"theme-heading inline-flex items-center gap-2 text-sm font-medium"},Pa={class:"mt-5"},Ra={key:0,class:"theme-danger-text mt-4 inline-flex items-center gap-2 text-sm"},Ta={class:"theme-divider mt-6 flex flex-col gap-3 border-t border-dashed pt-4 sm:flex-row sm:items-center sm:justify-between"},Da={class:"flex flex-wrap items-center gap-2"},Ea=["disabled"],Aa=["disabled"],La=["disabled"],Fa={class:"flex flex-col-reverse gap-2 sm:flex-row sm:flex-wrap sm:items-center"},Ba=["disabled"],Na=["disabled"],Oa=["disabled"],Ua={key:1,class:"flex min-h-0 flex-1 flex-col overflow-hidden"},za={key:0,class:"flex min-h-0 flex-1 flex-col overflow-hidden"},Ha={class:"min-h-0 flex-1 overflow-hidden px-3 py-3"},Ka={key:1,class:"flex min-h-0 flex-1 flex-col overflow-hidden"},Va={class:"theme-divider flex items-center gap-3 border-b px-4 py-3"},qa=["disabled"],Wa={class:"min-w-0 flex-1"},Qa={class:"theme-heading truncate text-sm font-medium"},Ga={key:0,class:"theme-muted-text mt-1 truncate text-xs"},Ja={class:"theme-divider border-b px-4 py-3"},Xa={class:"grid grid-cols-2 gap-2"},Ya=["disabled"],Za={class:"min-h-0 flex-1 overflow-y-auto px-4 py-4"},es={key:0},ts={key:0,class:"theme-danger-text mt-4 inline-flex items-center gap-2 text-sm"},ns={class:"theme-divider mt-6 flex flex-col gap-3 border-t border-dashed pt-4"},as=["disabled"],ss=["disabled"],ls=["disabled"],is=["disabled"],gs={__name:"CodexSessionManagerDialog",props:{open:{type:Boolean,default:!1},sessions:{type:Array,default:()=>[]},workspaces:{type:Array,default:()=>[]},selectedSessionId:{type:String,default:""},selectionLocked:{type:Boolean,default:!1},selectionLockReason:{type:String,default:""},loading:{type:Boolean,default:!1},sending:{type:Boolean,default:!1},onRefresh:{type:Function,default:null},onCreate:{type:Function,default:null},onUpdate:{type:Function,default:null},onDelete:{type:Function,default:null},onReset:{type:Function,default:null}},emits:["close","project-created","select-session","open-source-browser"],setup(o,{expose:R,emit:$}){const f=o,v=$,{locale:M,t:c}=De(),x=_("edit"),y=_(""),r=kt({title:"",engine:"codex",cwd:"",sessionId:""}),g=_(""),L=_(!1),Q=_(!1),E=_(!1),I=_(!1),K=_(!1),F=_(!1),N=_(!1),O=_(!1),{matches:V}=ht("(max-width: 767px)"),ee=_("list"),q=_("basic"),ae=_(Xe());let P=null;const J=S(()=>z(f.sessions)),b=S(()=>f.sessions.find(t=>t.id===y.value)||null),ye=S(()=>f.sessions.length>0),Ve=S(()=>f.sessions.find(t=>t.id===f.selectedSessionId)||null),de=S(()=>!!(b.value&&U(b.value.id))),se=S(()=>{var t;return!((t=b.value)!=null&&t.started)}),T=S(()=>{var t;return!((t=b.value)!=null&&t.started)}),X=S(()=>{var t;return!((t=b.value)!=null&&t.started)}),j=S(()=>f.loading||L.value||Q.value||E.value||I.value),qe=S(()=>String(r.sessionId||"").trim()),ue=S(()=>{var h,w;const t=new Set,i=[];return[r.cwd,(h=b.value)==null?void 0:h.cwd,(w=Ve.value)==null?void 0:w.cwd,...f.workspaces,...f.sessions.map(H=>H.cwd)].forEach(H=>{const D=String(H||"").trim();!D||t.has(D)||(t.add(D),i.push(D))}),i.slice(0,12)}),be=S(()=>ae.value),we=S(()=>{const t=te(r.cwd);return t?f.sessions.filter(i=>{var h;return i.id===((h=b.value)==null?void 0:h.id)?!1:te(i.cwd)===t}):[]}),oe=S(()=>{if(!we.value.length)return"";const t=we.value.slice(0,3).map(i=>{const h=i.title||c("projectManager.untitledProject");return M.value==="en-US"?`"${h}"`:`「${h}」`}).join(M.value==="en-US"?", ":"、");return c("projectManager.duplicateDirectory",{labels:t,count:we.value.length})}),Ee=S(()=>x.value!=="edit"||se.value?"":c("projectManager.cwdReadonly")),Se=S(()=>x.value!=="edit"||!b.value||T.value?"":c("projectManager.engineReadonly")),Ae=S(()=>x.value!=="edit"||!b.value||X.value?"":c("projectManager.sessionIdReadonly")),Le=S(()=>x.value==="create"?L.value?c("projectManager.creatingProject"):c("projectManager.createProject"):Q.value?c("projectManager.savingChanges"):c("projectManager.saveChanges")),ke=S(()=>{var t;return x.value==="create"?c("projectManager.newProject"):((t=b.value)==null?void 0:t.title)||c("projectManager.untitledProject")});function $e(t=""){const i=Date.parse(String(t||""));return Number.isFinite(i)?i:0}function te(t=""){const i=String(t||"").trim();if(!i)return"";const h=/^[a-z]:[\\/]/i.test(i)||i.includes("\\");let w=i.replace(/\\/g,"/");return w.length>1&&!/^[a-z]:\/$/i.test(w)&&(w=w.replace(/\/+$/,"")),h?w.toLowerCase():w}function U(t){var i;return!!((i=f.sessions.find(h=>h.id===t))!=null&&i.running)}function ne(t){return!!t&&t===f.selectedSessionId}function z(t=[]){return[...t].sort((i,h)=>{const w=Number(U(h.id))-Number(U(i.id));if(w)return w;const H=Number(ne(h.id))-Number(ne(i.id));if(H)return H;const D=$e(h.updatedAt)-$e(i.updatedAt);return D||ut(String(i.title||i.cwd||i.id),String(h.title||h.cwd||h.id))})}function Y(t){return U(t)?c("projectManager.running"):c("projectManager.idle")}function ce(t){return U(t)?"theme-status-warning":"theme-status-success"}function le(t){return t!=null&&t.started?c("projectManager.threadBound"):c("projectManager.notStarted")}function _e(t){return t!=null&&t.started?"theme-status-success":"theme-status-neutral"}function Ce(t=""){if(!t)return c("projectManager.unknown");const i=new Date(t);return Number.isNaN(i.getTime())?t:dt(i.toISOString(),{year:"numeric",month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"})}function pe(t){r.title=String((t==null?void 0:t.title)||""),r.engine=Je(t==null?void 0:t.engine),r.cwd=String((t==null?void 0:t.cwd)||""),r.sessionId=String((t==null?void 0:t.sessionId)||(t==null?void 0:t.engineSessionId)||(t==null?void 0:t.engineThreadId)||(t==null?void 0:t.codexThreadId)||"").trim()}function ie(){x.value="create",y.value="",g.value="",r.title="",r.engine="codex",r.cwd="",r.sessionId=""}function W(t){const i=f.sessions.find(h=>h.id===t);i&&(x.value="edit",y.value=i.id,g.value="",pe(i))}function fe(){var t;return f.selectedSessionId&&f.sessions.some(i=>i.id===f.selectedSessionId)?f.selectedSessionId:((t=J.value[0])==null?void 0:t.id)||""}function Me(t="basic"){ee.value="detail",q.value=t}function ge(){ee.value="list",q.value="basic"}function Fe(){ie(),V.value&&Me("basic")}function je(t){j.value||(W(t),V.value&&Me("basic"))}function We(t){r.cwd=String(t||"").trim()}async function Ie(){var i,h;const t=((i=b.value)==null?void 0:i.id)||fe();return!t||((!b.value||b.value.id!==t)&&(W(t),await re()),!((h=b.value)!=null&&h.cwd))?!1:(V.value&&Me("basic"),v("open-source-browser",b.value),v("close"),!0)}function Qe(){return K.value?(K.value=!1,!0):F.value?(F.value=!1,!0):N.value?(N.value=!1,!0):f.open?(v("close"),!0):!1}function Pe(t){r.title=String(t||"")}function Be(t){r.engine=Je(t)}function Ne(t){r.cwd=String(t||"")}function Oe(t){r.sessionId=String(t||"")}function Re(){g.value="",K.value=!1,F.value=!1,O.value=!1,q.value="basic",ee.value=V.value?"list":"detail";const t=fe();if(t){W(t);return}ie()}async function Ue(){if(!(j.value||typeof f.onRefresh!="function")){g.value="";try{await Promise.all([f.onRefresh(),e()])}catch(t){g.value=t.message}}}async function e(){try{ae.value=await Lt()}catch{ae.value=Xe()}}async function s(t){var h;if((h=navigator.clipboard)!=null&&h.writeText&&window.isSecureContext){await navigator.clipboard.writeText(t);return}const i=document.createElement("textarea");i.value=t,i.setAttribute("readonly","true"),i.style.position="fixed",i.style.opacity="0",i.style.pointerEvents="none",document.body.appendChild(i),i.select(),document.execCommand("copy"),document.body.removeChild(i)}async function a(){const t=qe.value;if(t)try{await s(t),O.value=!0,P&&clearTimeout(P),P=setTimeout(()=>{O.value=!1,P=null},1800)}catch(i){g.value=(i==null?void 0:i.message)||c("projectManager.copySessionIdFailed")}}async function u(){if(!j.value){g.value="";try{const t=B();if(!t)return;await G(t)}catch(t){g.value=t.message}}}function B(){if(x.value==="create"){const i=String(r.cwd||"").trim();return i?{type:"create",cwd:i,payload:{title:r.title,engine:r.engine,cwd:i,sessionId:String(r.sessionId||"").trim()}}:(g.value=c("projectManager.directoryRequired"),null)}if(!b.value)return g.value=c("projectManager.projectMissing"),null;const t={title:r.title,engine:r.engine};return se.value&&(t.cwd=r.cwd),X.value&&(t.sessionId=String(r.sessionId||"").trim()),{type:"update",sessionId:b.value.id,payload:t}}async function G(t){var i,h;if(t.type==="create"){L.value=!0;try{const w=await((i=f.onCreate)==null?void 0:i.call(f,t.payload));w!=null&&w.id&&(W(w.id),v("select-session",w.id),await re(),v("project-created",w),v("close"));return}finally{L.value=!1}}Q.value=!0;try{const w=await((h=f.onUpdate)==null?void 0:h.call(f,t.sessionId,t.payload));w!=null&&w.id&&W(w.id)}finally{Q.value=!1}}async function ve(){var i,h;if(!b.value||E.value)return;const t=b.value.id;g.value="",E.value=!0;try{const w=await((i=f.onDelete)==null?void 0:i.call(f,t));K.value=!1;const H=f.sessions.filter(rt=>rt.id!==t),D=(w==null?void 0:w.selectedSessionId)||((h=z(H)[0])==null?void 0:h.id)||"";v("select-session",D),D?(W(D),V.value&&ge()):(ie(),V.value&&ge())}catch(w){g.value=w.message}finally{E.value=!1}}async function Z(){var i;if(!b.value||I.value)return;const t=b.value.id;g.value="",I.value=!0;try{const h=await((i=f.onReset)==null?void 0:i.call(f,t));F.value=!1;const w=(h==null?void 0:h.session)||f.sessions.find(H=>H.id===t)||null;w!=null&&w.id&&W(w.id)}catch(h){g.value=h.message}finally{I.value=!1}}return me(()=>f.open,t=>{if(t){Re(),typeof f.onRefresh=="function"?Ue().catch(()=>{}):e().catch(()=>{});return}N.value=!1,K.value=!1,F.value=!1,O.value=!1,g.value=""},{immediate:!0}),me(V,t=>{t||(ee.value="detail")},{immediate:!0}),me(()=>f.sessions,()=>{if(!f.open)return;if(x.value==="create"){if(!!(String(r.title||"").trim()||String(r.cwd||"").trim())||!!String(r.sessionId||"").trim())return;const h=fe();h&&W(h);return}if(b.value){pe(b.value);return}const t=fe();if(t){W(t);return}ie()}),lt(()=>{P&&(clearTimeout(P),P=null)}),R({closeTopDialog:Qe}),(t,i)=>(p(),m(Te,null,[k(et,{open:F.value,title:l(c)("projectManager.confirmResetTitle"),description:b.value?l(c)("projectManager.confirmResetDescription",{title:b.value.title||l(c)("projectManager.untitledProject")}):"","confirm-text":l(c)("projectManager.confirmReset"),"cancel-text":l(c)("projectManager.keep"),loading:I.value,onCancel:i[0]||(i[0]=h=>F.value=!1),onConfirm:Z},null,8,["open","title","description","confirm-text","cancel-text","loading"]),k(et,{open:K.value,title:l(c)("projectManager.confirmDeleteTitle"),description:b.value?l(c)("projectManager.confirmDeleteDescription",{title:b.value.title||l(c)("projectManager.untitledProject")}):"","confirm-text":l(c)("projectManager.confirmDelete"),"cancel-text":l(c)("projectManager.keep"),loading:E.value,danger:"",onCancel:i[1]||(i[1]=h=>K.value=!1),onConfirm:ve},null,8,["open","title","description","confirm-text","cancel-text","loading"]),k(hn,{open:N.value,"initial-path":r.cwd,suggestions:ue.value,onClose:i[2]||(i[2]=h=>N.value=!1),onSelect:We},null,8,["open","initial-path","suggestions"]),k(st,{open:o.open,"panel-class":"settings-dialog-panel h-full max-w-5xl sm:h-auto sm:max-h-[88vh]","header-class":"settings-dialog-header px-5 py-4","body-class":"settings-dialog-body flex min-h-0 flex-1 overflow-hidden","close-disabled":j.value,"close-on-backdrop":!j.value,"close-on-escape":!j.value,onClose:i[12]||(i[12]=h=>v("close"))},{title:xe(()=>[n("div",$a,[k(l(Et),{class:"h-4 w-4"}),n("span",null,d(l(c)("projectManager.managingTitle")),1)])]),default:xe(()=>{var h,w,H;return[l(V)?(p(),m("div",Ua,[ee.value==="list"?(p(),m("div",za,[n("div",Ha,[k(at,{mobile:"",busy:j.value,"editing-session-id":y.value,"format-updated-at":Ce,"get-runtime-status-class":ce,"get-runtime-status-label":Y,"get-thread-status-class":_e,"get-thread-status-label":le,"has-sessions":ye.value,"is-current-session":ne,"is-session-running":U,mode:x.value,sessions:J.value,onCreate:Fe,onSelect:je},null,8,["busy","editing-session-id","has-sessions","mode","sessions"])])])):(p(),m("div",Ka,[n("div",Va,[n("button",{type:"button",class:"tool-button inline-flex items-center gap-1.5 px-3 py-2 text-xs",disabled:j.value,onClick:ge},[k(l(Dt),{class:"h-4 w-4"}),n("span",null,d(l(c)("projectManager.projectList")),1)],8,qa),n("div",Wa,[n("div",Qa,d(ke.value),1),x.value==="edit"&&((w=b.value)!=null&&w.cwd)?(p(),m("p",Ga,d(b.value.cwd),1)):C("",!0)])]),n("div",Ja,[n("div",Xa,[n("button",{type:"button",class:A(["tool-button px-3 py-2 text-sm",q.value==="basic"?"tool-button-accent-subtle":""]),onClick:i[7]||(i[7]=D=>q.value="basic")},d(l(c)("projectManager.basicInfo")),3),n("button",{type:"button",class:A(["tool-button px-3 py-2 text-sm",q.value==="status"?"tool-button-accent-subtle":""]),disabled:x.value==="create",onClick:i[8]||(i[8]=D=>q.value="status")},d(l(c)("projectManager.status")),11,Ya)])]),n("div",Za,[q.value==="basic"?(p(),m("div",es,[k(nt,{mobile:"",busy:j.value,"can-edit-engine":x.value!=="edit"||T.value,"can-edit-cwd":x.value!=="edit"||se.value,"can-edit-session-id":x.value!=="edit"||X.value,cwd:r.cwd,"cwd-readonly-message":Ee.value,"duplicate-cwd-message":oe.value,engine:r.engine,"engine-options":be.value,"engine-readonly-message":Se.value,"session-id":r.sessionId,"session-id-copied":O.value,"session-id-readonly-message":Ae.value,title:r.title,"workspace-suggestions":ue.value,onCopySessionId:a,onOpenDirectoryPicker:i[9]||(i[9]=D=>N.value=!0),"onUpdate:cwd":Ne,"onUpdate:engine":Be,"onUpdate:sessionId":Oe,"onUpdate:title":Pe},null,8,["busy","can-edit-engine","can-edit-cwd","can-edit-session-id","cwd","cwd-readonly-message","duplicate-cwd-message","engine","engine-options","engine-readonly-message","session-id","session-id-copied","session-id-readonly-message","title","workspace-suggestions"]),g.value?(p(),m("p",ts,[k(l(tt),{class:"h-4 w-4"}),n("span",null,d(g.value),1)])):C("",!0),n("div",ns,[n("button",{type:"button",class:"tool-button tool-button-primary w-full px-3 py-2 text-sm",disabled:j.value,onClick:u},d(Le.value),9,as),x.value==="edit"&&b.value?(p(),m("button",{key:0,type:"button",class:"tool-button w-full px-3 py-2 text-sm",disabled:j.value||!((H=b.value)!=null&&H.cwd),onClick:Ie},d(l(c)("projectManager.viewSource")),9,ss)):C("",!0),x.value==="edit"&&b.value?(p(),m("button",{key:1,type:"button",class:"tool-button w-full px-3 py-2 text-sm",disabled:j.value||de.value,onClick:i[10]||(i[10]=D=>F.value=!0)},d(I.value?l(c)("projectManager.resettingSession"):l(c)("projectManager.newSession")),9,ls)):C("",!0),x.value==="edit"&&b.value?(p(),m("button",{key:2,type:"button",class:"tool-button tool-button-danger-subtle w-full px-3 py-2 text-sm",disabled:j.value||de.value,onClick:i[11]||(i[11]=D=>K.value=!0)},d(E.value?l(c)("projectManager.deletingProject"):l(c)("projectManager.deleteProject")),9,is)):C("",!0)])])):(p(),he(ka,{key:1,"active-session":b.value,"format-updated-at":Ce,"get-runtime-status-class":ce,"get-runtime-status-label":Y,"get-thread-status-class":_e,"get-thread-status-label":le,"is-current-session":ne,"is-session-running":U},null,8,["active-session"]))])]))])):(p(),m("div",_a,[n("aside",Ca,[k(at,{busy:j.value,"editing-session-id":y.value,"format-updated-at":Ce,"get-runtime-status-class":ce,"get-runtime-status-label":Y,"get-thread-status-class":_e,"get-thread-status-label":le,"has-sessions":ye.value,"is-current-session":ne,"is-session-running":U,mode:x.value,sessions:J.value,onCreate:Fe,onSelect:je},null,8,["busy","editing-session-id","has-sessions","mode","sessions"])]),n("div",Ma,[n("div",ja,[n("div",null,[n("div",Ia,[k(l(It),{class:"h-4 w-4"}),n("span",null,d(x.value==="create"?l(c)("projectManager.createTitle"):l(c)("projectManager.editTitle")),1)])])]),n("div",Pa,[k(nt,{busy:j.value,"can-edit-engine":x.value!=="edit"||T.value,"can-edit-cwd":x.value!=="edit"||se.value,"can-edit-session-id":x.value!=="edit"||X.value,cwd:r.cwd,"cwd-readonly-message":Ee.value,"duplicate-cwd-message":oe.value,engine:r.engine,"engine-options":be.value,"engine-readonly-message":Se.value,"session-id":r.sessionId,"session-id-copied":O.value,"session-id-readonly-message":Ae.value,title:r.title,"workspace-suggestions":ue.value,onCopySessionId:a,onOpenDirectoryPicker:i[3]||(i[3]=D=>N.value=!0),"onUpdate:cwd":Ne,"onUpdate:engine":Be,"onUpdate:sessionId":Oe,"onUpdate:title":Pe},null,8,["busy","can-edit-engine","can-edit-cwd","can-edit-session-id","cwd","cwd-readonly-message","duplicate-cwd-message","engine","engine-options","engine-readonly-message","session-id","session-id-copied","session-id-readonly-message","title","workspace-suggestions"])]),g.value?(p(),m("p",Ra,[k(l(tt),{class:"h-4 w-4"}),n("span",null,d(g.value),1)])):C("",!0),n("div",Ta,[n("div",Da,[x.value==="edit"&&b.value?(p(),m("button",{key:0,type:"button",class:"tool-button inline-flex items-center gap-2 px-3 py-2 text-xs",disabled:j.value||!((h=b.value)!=null&&h.cwd),onClick:Ie},[k(l(Pt),{class:"h-4 w-4"}),n("span",null,d(l(c)("projectManager.viewSource")),1)],8,Ea)):C("",!0),x.value==="edit"&&b.value?(p(),m("button",{key:1,type:"button",class:"tool-button inline-flex items-center gap-2 px-3 py-2 text-xs",disabled:j.value||de.value,onClick:i[4]||(i[4]=D=>F.value=!0)},[k(l(Rt),{class:"h-4 w-4"}),n("span",null,d(I.value?l(c)("projectManager.resettingSession"):l(c)("projectManager.newSession")),1)],8,Aa)):C("",!0),x.value==="edit"&&b.value?(p(),m("button",{key:2,type:"button",class:"tool-button tool-button-danger-subtle inline-flex items-center gap-2 px-3 py-2 text-xs",disabled:j.value||de.value,onClick:i[5]||(i[5]=D=>K.value=!0)},[k(l(Tt),{class:"h-4 w-4"}),n("span",null,d(E.value?l(c)("projectManager.deletingProject"):l(c)("projectManager.deleteProject")),1)],8,La)):C("",!0)]),n("div",Fa,[n("button",{type:"button",class:"tool-button w-full px-3 py-2 text-xs sm:w-auto",disabled:j.value,onClick:i[6]||(i[6]=D=>v("close"))},d(l(c)("projectManager.close")),9,Ba),x.value==="create"&&ye.value?(p(),m("button",{key:0,type:"button",class:"tool-button w-full px-3 py-2 text-xs sm:w-auto",disabled:j.value,onClick:Re},d(l(c)("projectManager.backToList")),9,Na)):C("",!0),n("button",{type:"button",class:"tool-button tool-button-primary w-full px-3 py-2 text-xs sm:w-auto",disabled:j.value,onClick:u},d(Le.value),9,Oa)])])])]))]}),_:1},8,["open","close-disabled","close-on-backdrop","close-on-escape"])],64))}};export{gs as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{g as Ze,t as P,f as Ge,u as Re,a as et,b as tt}from"./index-d30njJCo.js";import{u as st,g as $e,l as at,r as nt,e as it,D as Te,a as lt,i as ot,b as rt,_ as ut,c as dt}from"./WorkbenchView-CICtaY88.js";import{w as z,c as V,b as H,n as qe,aD as g,aE as y,aF as a,aR as ne,aS as Se,aL as D,aQ as c,aG as $,u as t,aW as De,aX as ct,aN as J,aI as Ie,aJ as ue,f as ft,a$ as Me}from"./vendor-misc-u-M8sNMf.js";import{c as ht,j as Ne,C as Be,R as Ve,b as mt,i as vt,h as Ke,F as ze,z as Ee}from"./vendor-ui-C5E3MVzU.js";import"./vendor-router-Dn8q3tJM.js";import"./vendor-markdown-9aQhqbjm.js";import"./vendor-tiptap-rwYdQb1L.js";function se(e,i,r=""){const h=i==="run"?"run":i==="task"?"task":"workspace";return[String(e||"").trim(),h,String(r||"").trim()].join("::")}function gt(e="",i=""){return`${String(e||"").trim()}::${String(i||"").trim()}`}function pt(e=""){return`${String(e||"").trim()}::`}function Je(e){if(!e||typeof e!="object")return e;try{return JSON.parse(JSON.stringify(e))}catch{return e}}function we(e,i){const r=e.get(i);return r?(e.delete(i),e.set(i,r),Je(r)):null}function _e(e,i,r,h=0){for(e.delete(i),e.set(i,Je(r));h>0&&e.size>h;){const f=e.keys().next().value;if(typeof f>"u")break;e.delete(f)}}function ae(e=""){const i=String(e||"").trim().toUpperCase();return i==="A"||i==="D"?i:"M"}function xt(e=""){const i=String(e||"");if(!i)return[];const r=i.split(`
|
|
2
|
+
`),h=[];let f=0,R=0;return r.forEach((b,u)=>{const T=b.match(/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);if(T){f=Number(T[1]),R=Number(T[2]),h.push({id:`hunk-${u}`,kind:"hunk",oldNumber:"",newNumber:"",content:b});return}if(b.startsWith("+")&&!b.startsWith("+++")){h.push({id:`line-${u}`,kind:"add",oldNumber:"",newNumber:R,content:b}),R+=1;return}if(b.startsWith("-")&&!b.startsWith("---")){h.push({id:`line-${u}`,kind:"delete",oldNumber:f,newNumber:"",content:b}),f+=1;return}if(b.startsWith(" ")){h.push({id:`line-${u}`,kind:"context",oldNumber:f,newNumber:R,content:b}),f+=1,R+=1;return}h.push({id:`line-${u}`,kind:"meta",oldNumber:"",newNumber:"",content:b})}),h}function kt(e=""){const i=String(e||"").trim();if(!i)return"";const r=i.match(/^当前分支已从 (.+) 切换到 (.+)$/);return r?P("diffReview.warningBranchChanged",{from:r[1],to:r[2]}):i==="当前 HEAD 已不在基线 commit 的后续历史中,仓库可能经历了 reset、rebase 或切分支"?P("diffReview.warningHeadDetachedFromBaseline"):i}function We(e=""){const i=String(e||"").trim();if(!i)return"";const h=new Map([["二进制文件暂不支持在线 diff 预览。","diffReview.binaryPreviewUnavailable"],["文件内容较大,暂不展示具体 diff。","diffReview.fileTooLarge"],["diff 内容较长,暂不在页面内完整展示。","diffReview.diffTooLong"],["当前工作目录不是 Git 仓库,暂不支持代码变更审查。","diffReview.notGitRepo"],["任务不存在。","diffReview.taskNotFound"],["请选择一轮执行后再查看本轮代码变更。","diffReview.runRequired"],["没有找到对应的执行记录。","diffReview.runNotFound"],["这轮执行还没有建立代码变更基线,暂时无法查看本轮 diff。","diffReview.runBaselineMissing"],["当前任务还没有建立代码变更基线,请先让 Codex 执行一轮。","diffReview.taskBaselineMissing"],["这轮执行缺少结束快照,暂时无法准确还原本轮代码变更。","diffReview.runSnapshotMissing"],["原工作目录已不是有效的 Git 仓库,暂时无法读取代码变更。","diffReview.originalRepoInvalid"],["基线对应的 commit 已不存在,仓库可能被 reset、rebase 或切换到无关历史,暂时无法准确读取该范围的代码变更。","diffReview.baselineCommitMissing"]]).get(i);return h?P(h):i}function He(e=null){return!e||typeof e!="object"?e:{...e,reason:We(e.reason),warnings:Array.isArray(e.warnings)?e.warnings.map(i=>kt(i)).filter(Boolean):[],files:Array.isArray(e.files)?e.files.map(i=>({...i,message:We(i==null?void 0:i.message)})):[]}}function yt(e){const i=H("workspace"),r=H(""),h=H(""),f=H("all"),R=H(""),b=H([]),u=H(null),T=H(!1),A=H(!1),O=H(""),l=H(!1),w=H(null),S=H(0),L=new Map,j=st();let p=0,n=0,d="",F="",E="",W=-1;const U=new Map,B=new Map,G=new Map,ie=V(()=>b.value.filter(s=>s.completed)),de=V(()=>{var o;const s={all:0,A:0,M:0,D:0};return(((o=u.value)==null?void 0:o.files)||[]).forEach(m=>{const k=ae(m==null?void 0:m.status);s.all+=1,s[k]+=1}),s}),Z=V(()=>{var m;const s=((m=u.value)==null?void 0:m.files)||[],o=String(R.value||"").trim().toLowerCase();return s.filter(k=>f.value!=="all"&&ae(k==null?void 0:k.status)!==f.value?!1:o?String((k==null?void 0:k.path)||"").toLowerCase().includes(o):!0)}),ce=V(()=>{const s=Z.value;return s.find(o=>o.path===h.value)||s[0]||null}),re=V(()=>{var s;return xt(((s=ce.value)==null?void 0:s.patch)||"")}),q=V(()=>re.value.map((s,o)=>({...s,index:o})).filter(s=>s.kind==="hunk")),fe=V(()=>{var s,o;return A.value&&!((o=(s=u.value)==null?void 0:s.summary)!=null&&o.statsComplete)}),ee=V(()=>{var m;const s=((m=u.value)==null?void 0:m.baseline)||null;if(!(s!=null&&s.createdAt)&&!(s!=null&&s.headShort))return"";const o=[];return s.createdAt&&o.push(P("diffReview.baselineTime",{value:Ge(s.createdAt)})),s.branch&&o.push(P("diffReview.baselineBranch",{value:s.branch})),s.headShort&&o.push(P("diffReview.baselineCommit",{value:s.headShort})),s.currentHeadShort&&o.push(P("diffReview.currentHead",{value:s.currentHeadShort})),o.join(" · ")});function M(s){return(s==null?void 0:s.status)==="completed"?P("diffReview.completed"):(s==null?void 0:s.status)==="error"?P("diffReview.failed"):(s==null?void 0:s.status)==="interrupted"?P("diffReview.interrupted"):P("diffReview.stopped")}function C(s,o){if(s){if(o){L.set(s,o);return}L.delete(s)}}function he(s,o={}){const m=q.value;if(!m.length)return;const k=Math.min(Math.max(0,Number(s)||0),m.length-1),N=m[k],_=L.get(N.id);_&&(S.value=k,_.scrollIntoView({block:o.block||"center",behavior:o.behavior||"smooth"}))}function me(s=1){q.value.length&&he(S.value+s)}function K(s){return`${new Date((s==null?void 0:s.startedAt)||(s==null?void 0:s.createdAt)).toLocaleString(Ze())} · ${M(s)}`}function v(){const s=ie.value;if(!s.length){r.value="";return}s.some(o=>o.id===r.value)||(r.value=s[0].id)}function te(){const s=Z.value;if(!s.length){h.value="";return}s.some(o=>o.path===h.value)||(h.value=s[0].path)}function ve(s=""){return ae(s)==="A"?P("diffReview.added"):ae(s)==="D"?P("diffReview.deleted"):P("diffReview.modified")}function ge(s=""){return ae(s)==="A"?"theme-status-success":ae(s)==="D"?"theme-status-danger":"theme-status-warning"}function pe(s="all"){return s==="A"?P("diffReview.added"):s==="D"?P("diffReview.deleted"):s==="M"?P("diffReview.modified"):P("diffReview.all")}function xe(s="all"){return f.value===s?"theme-filter-active":"theme-filter-idle"}function x(s="context"){return s==="add"?"theme-patch-add":s==="delete"?"theme-patch-delete":s==="hunk"?"theme-patch-hunk":s==="meta"?"theme-patch-meta":"theme-patch-context"}function le(s,o=""){const m=String(o||"").trim();m&&Array.from(s.keys()).forEach(k=>{String(k||"").startsWith(m)&&s.delete(k)})}function Fe(){const s=pt(e.taskSlug);le(U,s),le(B,s),le(G,s)}async function Qe(){if(!e.taskSlug){b.value=[],r.value="",E="",W=-1;return}const s=j.getTaskRunSyncVersion(e.taskSlug);if(E===e.taskSlug&&W===s)return;const o=await at(e.taskSlug,{limit:20,events:"none"});b.value=o.items||[],E=e.taskSlug,W=s,v()}async function Ce(){if(!e.taskSlug||!e.active)return;const s=++p;T.value=!0,A.value=!1,O.value="";try{const o=i.value==="run"?"run":i.value==="task"?"task":"workspace";o==="run"&&await Qe();const m=se(e.taskSlug,o,o==="run"?r.value:"");if(o==="run"&&!r.value){u.value={supported:!1,reason:P("diffReview.noReviewRuns"),repoRoot:"",summary:{fileCount:0,additions:0,deletions:0,statsComplete:!0},files:[]},te();return}const k=we(U,m);if(k){u.value=k,d=m;const I=we(B,m);I?(u.value={...k,baseline:I.baseline||k.baseline||null,warnings:I.warnings||k.warnings||[],summary:I.summary||k.summary},F=m):F="",te(),ke().catch(()=>{}),I||Ae().catch(()=>{});return}const N=await $e(e.taskSlug,{scope:o,runId:o==="run"?r.value:"",includeStats:!1});if(s!==p)return;const _=He(N);u.value=_,_e(U,m,_,36),d=m,F="",te(),ke().catch(()=>{}),Ae().catch(()=>{})}catch(o){if(s!==p)return;O.value=o.message,u.value=null}finally{s===p&&(T.value=!1)}}async function Ae(){var N,_,I;if(!e.taskSlug||!e.active||!((N=u.value)!=null&&N.supported))return;const s=i.value==="run"?"run":i.value==="task"?"task":"workspace",o=s==="run"?r.value:"",m=se(e.taskSlug,s,o);if(F===m&&((I=(_=u.value)==null?void 0:_.summary)!=null&&I.statsComplete))return;const k=we(B,m);if(k){u.value={...u.value,baseline:k.baseline||u.value.baseline||null,warnings:k.warnings||u.value.warnings||[],summary:k.summary||u.value.summary},F=m,A.value=!1;return}A.value=!0;try{const X=await $e(e.taskSlug,{scope:s,runId:o,includeFiles:!1,includeStats:!0}),oe=se(e.taskSlug,i.value,i.value==="run"?r.value:"");if(m!==oe||!u.value)return;const Q=He(X);u.value={...u.value,baseline:Q.baseline||u.value.baseline||null,warnings:Q.warnings||u.value.warnings||[],summary:Q.summary||u.value.summary},_e(B,m,{baseline:Q.baseline||null,warnings:Q.warnings||[],summary:Q.summary||null},36),F=m}catch{}finally{const X=se(e.taskSlug,i.value,i.value==="run"?r.value:"");m===X&&(A.value=!1)}}async function ke(){var oe,Q,je;const s=String(h.value||"").trim();if(!e.taskSlug||!e.active||!s||l.value)return;const o=i.value==="run"?"run":i.value==="task"?"task":"workspace",m=o==="run"?r.value:"",k=se(e.taskSlug,o,m),N=(((oe=u.value)==null?void 0:oe.files)||[]).find(Y=>Y.path===s);if(!N||N.patchLoaded||N.binary||N.tooLarge||N.message)return;const _=gt(k,s),I=we(G,_);if(I&&((Q=u.value)!=null&&Q.files)){u.value={...u.value,files:u.value.files.map(Y=>Y.path===s?I:Y)};return}const X=++n;l.value=!0;try{const Y=await $e(e.taskSlug,{scope:o,runId:m,filePath:s});if(X!==n)return;const Ye=se(e.taskSlug,i.value,i.value==="run"?r.value:"");if(k!==Ye)return;const Le=He(Y),Pe=(Le.files||[]).find(be=>be.path===s);if(!Pe||!((je=u.value)!=null&&je.files))return;_e(G,_,Pe,120),u.value={...u.value,baseline:Le.baseline||u.value.baseline||null,warnings:Le.warnings||u.value.warnings||[],files:u.value.files.map(be=>be.path===s?Pe:be)}}catch(Y){O.value=Y.message}finally{X===n&&(l.value=!1,String(h.value||"").trim()!==s&&ke().catch(()=>{}))}}function ye({force:s=!1}={}){if(!e.taskSlug||!e.active)return;const o=se(e.taskSlug,i.value,i.value==="run"?r.value:"");!s&&o===d||Ce().catch(()=>{})}async function Xe(){!e.taskSlug||!e.active||T.value||(Fe(),d="",F="",E="",W=-1,await Ce())}return z(()=>[e.taskSlug,e.active,i.value,r.value],([s,o],m=[])=>{const k=m[0]||"";s!==k&&(h.value="",d="",b.value=[],r.value="",E="",W=-1,F=""),!(!s||!o)&&ye()},{immediate:!0}),z(()=>{var s,o;return[f.value,((o=(s=u.value)==null?void 0:s.files)==null?void 0:o.length)||0]},()=>{te()}),z(()=>[h.value,q.value.length],()=>{S.value=0,L.clear(),qe(()=>{var s,o;q.value.length?he(0,{behavior:"auto",block:"start"}):(o=(s=w.value)==null?void 0:s.scrollTo)==null||o.call(s,{top:0,behavior:"auto"})})}),z(()=>h.value,()=>{ke().catch(()=>{})},{immediate:!0}),z(()=>[e.preferredScope,e.preferredRunId,e.focusToken],([s,o,m],k=[])=>{const N=Number(k[2]||0),_=s==="run"?"run":s==="task"?"task":"workspace",I=_==="run"&&o?String(o||""):"",X=i.value!==_,oe=_==="run"&&I&&r.value!==I;i.value=_,I&&(r.value=I),_!=="run"&&(r.value=""),!X&&!oe&&e.active&&e.taskSlug&&m!==N&&(d="",ye())},{immediate:!0}),z(()=>j.readyVersion.value,()=>{!e.active||!e.taskSlug||(E="",W=-1,d="",F="",ye({force:!0}))}),z(()=>j.getTaskDiffSyncVersion(e.taskSlug),()=>{!e.active||!e.taskSlug||(E="",W=-1,F="",d="",ye({force:!0}))}),{activeHunkIndex:S,baselineMetaText:ee,diffPayload:u,diffScope:i,error:O,fileSearch:R,filteredFiles:Z,getFilterButtonClass:xe,getFilterLabel:pe,getPatchLineClass:x,getRunStatusLabel:M,getStatusClass:ge,getStatusLabel:ve,jumpToAdjacentHunk:me,loadDiff:Ce,loading:T,normalizeFileStatus:ae,patchLoading:l,patchViewportRef:w,runs:b,selectedFile:ce,selectedFilePath:h,selectedPatchHunks:q,selectedPatchLines:re,selectedRunId:r,setPatchLineRef:C,showSummarySkeleton:fe,statsLoading:A,statusCounts:de,statusFilter:f,terminalRuns:ie,formatRunOptionLabel:K,refreshDiff:Xe}}const bt={class:"mb-3 grid grid-cols-2 gap-2"},wt=["onClick"],St={class:"theme-input-shell mb-3 flex items-center gap-2 rounded-sm border px-3 py-2 text-xs text-[var(--theme-textMuted)]"},Rt=["placeholder"],Ft={key:0,class:"theme-empty-state theme-empty-state-strong mb-3 px-3 py-2 text-[11px]"},Ct={key:1,class:"theme-empty-state px-3 py-4 text-xs"},Lt={key:2,class:"theme-empty-state px-3 py-4 text-xs"},Pt={key:3,class:"space-y-1"},$t=["onClick","onKeydown"],Tt={class:"min-w-0 flex-1"},_t={class:"theme-list-item-title break-all"},Ht={class:"theme-list-item-meta mt-1"},Oe={__name:"TaskDiffFileList",props:{diffPayload:{type:Object,default:null},fileSearch:{type:String,default:""},autoFocusSelected:{type:Boolean,default:!1},filteredFiles:{type:Array,default:()=>[]},focusToken:{type:Number,default:0},getFilterButtonClass:{type:Function,default:()=>""},getFilterLabel:{type:Function,default:e=>e},getStatusClass:{type:Function,default:()=>""},getStatusLabel:{type:Function,default:e=>e},selectedFilePath:{type:String,default:""},showSummarySkeleton:{type:Boolean,default:!1},statusCounts:{type:Object,default:()=>({})},statusFilter:{type:String,default:"all"}},emits:["select-file","update:fileSearch","update:statusFilter"],setup(e,{emit:i}){const r=e,h=i,{t:f}=Re(),R=new Map,b=H(0),u=H(0),T=V({get:()=>r.fileSearch,set:p=>h("update:fileSearch",p)}),A=V({get:()=>r.statusFilter,set:p=>h("update:statusFilter",p)}),O=V(()=>{var p;return Array.isArray((p=r.diffPayload)==null?void 0:p.files)&&r.diffPayload.files.length>0});function l(p,n){if(n){R.set(p,n);return}R.delete(p)}function w(p){qe(()=>{var d,F;const n=R.get(p);(d=n==null?void 0:n.focus)==null||d.call(n),(F=n==null?void 0:n.scrollIntoView)==null||F.call(n,{block:"nearest",inline:"nearest"})})}function S(){!r.autoFocusSelected||!r.selectedFilePath||b.value===u.value||(u.value=b.value,w(r.selectedFilePath))}function L(p=1,n=""){const d=Array.isArray(r.filteredFiles)?r.filteredFiles:[];if(!d.length)return;const F=d.findIndex(G=>G.path===n),E=d.findIndex(G=>G.path===r.selectedFilePath),U=(Math.max(0,F>=0?F:E)+p+d.length)%d.length,B=d[U];B!=null&&B.path&&(h("select-file",B.path),w(B.path))}function j(p,n){const d=String((p==null?void 0:p.key)||"");if(d==="ArrowDown"){p.preventDefault(),L(1,n);return}if(d==="ArrowUp"){p.preventDefault(),L(-1,n);return}(d==="Enter"||d===" ")&&n&&(p.preventDefault(),h("select-file",n))}return z(()=>r.focusToken,p=>{b.value=p,S()},{immediate:!0}),z(()=>r.selectedFilePath,()=>{S()}),(p,n)=>(g(),y(ne,null,[a("div",bt,[(g(),y(ne,null,Se(["all","A","M","D"],d=>a("button",{key:d,type:"button",class:D(["inline-flex w-full items-center justify-center gap-1 whitespace-nowrap rounded-sm border px-2 py-1 text-[11px] transition",e.getFilterButtonClass(d)]),onClick:F=>A.value=d},c(e.getFilterLabel(d))+" "+c(e.statusCounts[d]||0),11,wt)),64))]),a("label",St,[$(t(ht),{class:"h-3.5 w-3.5 shrink-0"}),De(a("input",{"onUpdate:modelValue":n[0]||(n[0]=d=>T.value=d),type:"text",placeholder:t(f)("diffReview.searchFilePath"),class:"min-w-0 flex-1 bg-transparent text-xs text-[var(--theme-textPrimary)] outline-none placeholder:text-[var(--theme-textMuted)]"},null,8,Rt),[[ct,T.value]])]),e.showSummarySkeleton?(g(),y("div",Ft,c(t(f)("diffReview.statsPending")),1)):J("",!0),O.value?e.filteredFiles.length?(g(),y("div",Pt,[(g(!0),y(ne,null,Se(e.filteredFiles,d=>(g(),y("button",{key:d.path,ref_for:!0,ref:F=>l(d.path,F),type:"button",class:D(["theme-list-row focus:outline-none",d.path===e.selectedFilePath?"theme-list-item-active":"theme-list-item-hover"]),onClick:F=>h("select-file",d.path),onKeydown:F=>j(F,d.path)},[a("span",{class:D(["theme-list-item-badge",e.getStatusClass(d.status)])},c(e.getStatusLabel(d.status)),3),a("div",Tt,[a("div",_t,c(d.path),1),a("div",Ht,c(d.statsLoaded?`+${d.additions} / -${d.deletions}`:t(f)("diffReview.statsOnDemand")),1)])],42,$t))),128))])):(g(),y("div",Lt,c(t(f)("diffReview.noMatches")),1)):(g(),y("div",Ct,c(t(f)("diffReview.noChanges")),1))],64))}},Dt={key:0,class:"flex h-full min-h-0 flex-col overflow-hidden"},It={class:"theme-divider theme-secondary-text border-b px-4 py-3 text-[12px]"},At={class:"space-y-3 sm:hidden"},jt={class:"flex items-start gap-2"},Mt={class:"min-w-0 break-all font-medium text-[var(--theme-textPrimary)]"},Nt={class:"flex items-center justify-between gap-3"},Bt={class:"opacity-75"},Vt=["disabled"],zt={class:"min-w-[64px] text-center text-[12px] text-[var(--theme-textSecondary)]"},Et=["disabled"],Wt={class:"hidden items-center gap-3 sm:flex"},Ot={class:"flex min-w-0 flex-1 flex-wrap items-center gap-2"},Ut={class:"break-all font-medium text-[var(--theme-textPrimary)]"},Gt={class:"opacity-75"},qt=["disabled"],Kt={class:"min-w-[64px] text-center text-[12px] text-[var(--theme-textSecondary)]"},Jt=["disabled"],Qt={key:0,class:"theme-secondary-text flex-1 overflow-y-auto px-4 py-4 text-[12px]"},Xt={class:"theme-empty-state px-4 py-4"},Yt={key:1,class:"theme-muted-text flex-1 overflow-y-auto px-4 py-4 text-[12px]"},Zt={class:"task-diff-view min-w-max px-4 py-4 font-mono"},es={class:"task-diff-row__number select-none"},ts={class:"task-diff-row__number select-none"},ss=["innerHTML"],as={key:3,class:"theme-secondary-text flex-1 overflow-y-auto px-4 py-4 text-[12px]"},ns={class:"theme-empty-state px-4 py-4"},is={key:1,class:"theme-muted-text flex h-full items-center justify-center px-5 text-[12px]"},ls={__name:"TaskDiffPatchView",props:{activeHunkIndex:{type:Number,default:0},getPatchLineClass:{type:Function,default:()=>""},getStatusClass:{type:Function,default:()=>""},getStatusLabel:{type:Function,default:e=>e},jumpToAdjacentHunk:{type:Function,default:()=>{}},patchLoading:{type:Boolean,default:!1},selectedFile:{type:Object,default:null},selectedPatchHunks:{type:Array,default:()=>[]},selectedPatchLines:{type:Array,default:()=>[]},setPatchLineRef:{type:Function,default:()=>{}},setPatchViewportRef:{type:Function,default:()=>{}}},setup(e){const i=e,{t:r}=Re(),{isDark:h}=tt(),f=H([]),R=V(()=>{var l;return ot(((l=i.selectedFile)==null?void 0:l.path)||"")});function b(l){return(l==null?void 0:l.kind)==="add"?"+":(l==null?void 0:l.kind)==="delete"?"-":(l==null?void 0:l.kind)==="context"?" ":""}function u(l){const w=String((l==null?void 0:l.content)||"");return(l==null?void 0:l.kind)==="add"||(l==null?void 0:l.kind)==="delete"||(l==null?void 0:l.kind)==="context"?w.slice(1):w}function T(l=""){return String(l||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function A(l,w=""){if((l==null?void 0:l.kind)==="add"||(l==null?void 0:l.kind)==="delete"||(l==null?void 0:l.kind)==="context"){const S=b(l),L=`task-diff-line__prefix--${l.kind}`;return{...l,renderedHtml:`<span class="task-diff-line__prefix ${L}">${T(S||" ")}</span><span class="task-diff-line__body">${w||"​"}</span>`}}return{...l,renderedHtml:T(String((l==null?void 0:l.content)||""))}}async function O(){const l=Array.isArray(i.selectedPatchLines)?i.selectedPatchLines:[],w=[];l.forEach((n,d)=>{((n==null?void 0:n.kind)==="add"||(n==null?void 0:n.kind)==="delete"||(n==null?void 0:n.kind)==="context")&&w.push({lineIndex:d,body:u(n)})});const S=nt(w.map(n=>n.body));let L=0;if(f.value=l.map(n=>{if((n==null?void 0:n.kind)==="add"||(n==null?void 0:n.kind)==="delete"||(n==null?void 0:n.kind)==="context"){const d=S[L]||"​";return L+=1,A(n,d)}return A(n)}),!w.length||it(w.map(n=>n.body),Te))return;const j=await lt(w.map(n=>n.body),{isDark:h.value,language:R.value,maxHighlightLines:Te.maxLines,maxHighlightChars:Te.maxChars});let p=0;f.value=l.map(n=>{if((n==null?void 0:n.kind)==="add"||(n==null?void 0:n.kind)==="delete"||(n==null?void 0:n.kind)==="context"){const d=j[p]||"​";return p+=1,A(n,d)}return A(n)})}return z(()=>{var l;return[i.selectedPatchLines,(l=i.selectedFile)==null?void 0:l.path,h.value]},()=>{O()},{immediate:!0,deep:!0}),(l,w)=>e.selectedFile?(g(),y("div",Dt,[a("div",It,[a("div",At,[a("div",jt,[a("span",{class:D(["inline-flex shrink-0 rounded-sm border px-1.5 py-0.5 text-[12px]",e.getStatusClass(e.selectedFile.status)])},c(e.getStatusLabel(e.selectedFile.status)),3),a("span",Mt,c(e.selectedFile.path),1)]),a("div",Nt,[a("span",Bt,c(e.selectedFile.statsLoaded?`+${e.selectedFile.additions} / -${e.selectedFile.deletions}`:t(r)("diffReview.statsOnDemand")),1),a("div",{class:D(["inline-flex h-8 shrink-0 items-center gap-1 rounded-sm border px-1.5 py-1",e.selectedPatchHunks.length?"theme-inline-panel":"pointer-events-none invisible border-transparent"])},[a("button",{type:"button",class:"theme-icon-button h-6 w-6 disabled:opacity-50",disabled:e.activeHunkIndex<=0,onClick:w[0]||(w[0]=S=>e.jumpToAdjacentHunk(-1))},[$(t(Ne),{class:"h-4 w-4"})],8,Vt),a("span",zt,c(t(r)("diffReview.changeIndex",{current:Math.min(e.activeHunkIndex+1,e.selectedPatchHunks.length),total:e.selectedPatchHunks.length})),1),a("button",{type:"button",class:"theme-icon-button h-6 w-6 disabled:opacity-50",disabled:e.activeHunkIndex>=e.selectedPatchHunks.length-1,onClick:w[1]||(w[1]=S=>e.jumpToAdjacentHunk(1))},[$(t(Be),{class:"h-4 w-4"})],8,Et)],2)])]),a("div",Wt,[a("div",Ot,[a("span",{class:D(["inline-flex rounded-sm border px-1.5 py-0.5 text-[12px]",e.getStatusClass(e.selectedFile.status)])},c(e.getStatusLabel(e.selectedFile.status)),3),a("span",Ut,c(e.selectedFile.path),1),a("span",Gt,c(e.selectedFile.statsLoaded?`+${e.selectedFile.additions} / -${e.selectedFile.deletions}`:t(r)("diffReview.statsOnDemand")),1)]),a("div",{class:D(["inline-flex h-8 w-[132px] shrink-0 items-center gap-1 rounded-sm border px-1.5 py-1",e.selectedPatchHunks.length?"theme-inline-panel":"pointer-events-none invisible border-transparent"])},[a("button",{type:"button",class:"theme-icon-button h-6 w-6 disabled:opacity-50",disabled:e.activeHunkIndex<=0,onClick:w[2]||(w[2]=S=>e.jumpToAdjacentHunk(-1))},[$(t(Ne),{class:"h-4 w-4"})],8,qt),a("span",Kt,c(t(r)("diffReview.changeIndex",{current:Math.min(e.activeHunkIndex+1,e.selectedPatchHunks.length),total:e.selectedPatchHunks.length})),1),a("button",{type:"button",class:"theme-icon-button h-6 w-6 disabled:opacity-50",disabled:e.activeHunkIndex>=e.selectedPatchHunks.length-1,onClick:w[3]||(w[3]=S=>e.jumpToAdjacentHunk(1))},[$(t(Be),{class:"h-4 w-4"})],8,Jt)],2)])]),e.selectedFile.message?(g(),y("div",Qt,[a("div",Xt,c(e.selectedFile.message),1)])):e.patchLoading&&!e.selectedFile.patchLoaded?(g(),y("div",Yt,c(t(r)("diffReview.loadingFileDiff")),1)):e.selectedPatchLines.length?(g(),y("div",{key:2,ref:e.setPatchViewportRef,class:"flex-1 overflow-auto"},[a("div",Zt,[(g(!0),y(ne,null,Se(f.value,S=>{var L;return g(),y("div",{key:S.id,ref_for:!0,ref:j=>e.setPatchLineRef(S.id,j),class:D(["task-diff-row grid",[e.getPatchLineClass(S.kind),S.kind==="hunk"&&((L=e.selectedPatchHunks[e.activeHunkIndex])==null?void 0:L.id)===S.id?"ring-1 ring-inset ring-[var(--theme-warning)]":""]])},[a("span",es,c(S.oldNumber),1),a("span",ts,c(S.newNumber),1),a("pre",{class:D(["task-diff-line overflow-visible whitespace-pre px-3 py-0.5",S.kind==="meta"||S.kind==="hunk"?"task-diff-line--plain":""]),innerHTML:S.renderedHtml},null,10,ss)],2)}),128))])],512)):(g(),y("div",as,[a("div",ns,c(t(r)("diffReview.noFileDiffContent")),1)]))])):(g(),y("div",is,c(t(r)("diffReview.selectFile")),1))}},Ue=et(ls,[["__scopeId","data-v-d9d5559e"]]),os={class:"panel flex h-full min-h-0 flex-col overflow-hidden"},rs={class:"theme-divider border-b px-4 py-3"},us={class:"flex flex-col gap-2"},ds={class:"grid grid-cols-4 gap-2 sm:flex sm:flex-wrap sm:items-center"},cs={class:"sm:hidden"},fs={class:"hidden sm:inline"},hs={class:"sm:hidden"},ms={class:"hidden sm:inline"},vs=["disabled"],gs={class:"sm:hidden"},ps={class:"hidden sm:inline"},xs={class:"truncate text-xs text-[var(--theme-textPrimary)]"},ks={class:"theme-divider theme-muted-text border-b border-dashed px-3 py-2 text-[11px]"},ys=["onClick"],bs={class:"flex items-start gap-3"},ws={class:"min-w-0 flex-1"},Ss={class:"truncate text-xs font-medium text-[var(--theme-textPrimary)]"},Rs={class:"theme-muted-text mt-1 text-[11px]"},Fs={key:0,class:"theme-divider theme-danger-text border-b px-4 py-3 text-sm"},Cs={class:"inline-flex items-start gap-2"},Ls={class:"break-all"},Ps={key:1,class:"theme-muted-text flex flex-1 items-center justify-center px-5 text-sm"},$s={key:2,class:"flex flex-1 items-center justify-center px-5"},Ts={class:"theme-empty-state w-full max-w-xl px-4 py-5 text-sm text-[var(--theme-textSecondary)]"},_s={class:"theme-heading inline-flex items-center gap-2 font-medium"},Hs={class:"mt-2 break-all leading-7"},Ds={key:0,class:"mt-3 flex flex-wrap gap-2 text-xs"},Is={class:"theme-status-neutral inline-flex items-center gap-2 rounded-sm border border-dashed px-2.5 py-1.5"},As={class:"break-all"},js={key:0,class:"theme-status-success inline-flex items-center gap-2 rounded-sm border border-dashed px-2.5 py-1.5"},Ms={key:3,class:"flex min-h-0 flex-1 flex-col overflow-hidden"},Ns={class:"theme-divider theme-secondary-text border-b px-4 py-3 text-xs"},Bs={class:"flex flex-wrap items-center gap-2"},Vs={key:0,class:"theme-status-info inline-flex min-w-0 items-center gap-2 rounded-sm border border-dashed px-2.5 py-1.5"},zs={class:"min-w-0 break-all"},Es={class:"theme-status-success inline-flex items-center gap-2 rounded-sm border border-dashed px-2.5 py-1.5"},Ws={class:"text-[var(--theme-textPrimary)]"},Os={class:"font-medium text-[var(--theme-success)]"},Us={class:"font-medium text-[var(--theme-danger)]"},Gs={key:2,class:"opacity-75"},qs={key:0,class:"mt-2 break-all text-[11px] opacity-75"},Ks={key:1,class:"mt-2 flex flex-col gap-1"},Js={key:0,class:"flex min-h-0 flex-1 flex-col overflow-hidden"},Qs={class:"theme-divider border-b px-3 py-3"},Xs={class:"grid grid-cols-2 gap-2"},Ys=["disabled"],Zs={class:"theme-divider theme-muted-panel min-h-0 flex-1 overflow-y-auto p-3"},ea={class:"min-h-0 flex-1 overflow-hidden bg-[var(--theme-appPanelStrong)]"},ta={key:1,class:"grid min-h-0 flex-1 grid-cols-[320px_minmax(0,1fr)] overflow-hidden"},sa={class:"theme-divider theme-muted-panel min-h-0 overflow-y-auto border-r p-3"},aa={class:"min-h-0 overflow-hidden bg-[var(--theme-appPanelStrong)]"},na={__name:"TaskDiffReviewPanel",props:{taskSlug:{type:String,default:""},preferredScope:{type:String,default:"workspace"},preferredRunId:{type:String,default:""},focusToken:{type:Number,default:0},active:{type:Boolean,default:!1}},setup(e){const i=e,{activeHunkIndex:r,baselineMetaText:h,diffPayload:f,diffScope:R,error:b,fileSearch:u,filteredFiles:T,formatRunOptionLabel:A,getFilterButtonClass:O,getFilterLabel:l,getPatchLineClass:w,getRunStatusLabel:S,getStatusClass:L,getStatusLabel:j,jumpToAdjacentHunk:p,loading:n,patchLoading:d,patchViewportRef:F,refreshDiff:E,selectedFile:W,selectedFilePath:U,selectedPatchHunks:B,selectedPatchLines:G,selectedRunId:ie,setPatchLineRef:de,showSummarySkeleton:Z,statsLoading:ce,statusCounts:re,statusFilter:q,terminalRuns:fe}=yt(i),{matches:ee}=rt("(max-width: 767px)"),M=H("files"),{t:C}=Re();function he(K){U.value=K,ee.value&&(M.value="patch")}function me(K){F.value=K||null}return z(ee,K=>{K||(M.value="files")},{immediate:!0}),z(U,K=>{!K&&ee.value&&(M.value="files")}),z(R,()=>{ee.value&&(M.value="files")}),(K,v)=>{var te,ve,ge,pe,xe;return g(),y("section",os,[a("div",rs,[a("div",us,[a("div",ds,[a("button",{type:"button",class:D(["tool-button inline-flex items-center justify-center gap-2 px-3 py-2 text-xs",t(R)==="workspace"?"theme-filter-active":""]),onClick:v[0]||(v[0]=x=>R.value="workspace")},[a("span",cs,c(t(C)("diffReview.scopeCurrentShort")),1),a("span",fs,c(t(C)("diffReview.scopeCurrent")),1)],2),a("button",{type:"button",class:D(["tool-button inline-flex items-center justify-center gap-2 px-3 py-2 text-xs",t(R)==="task"?"theme-filter-active":""]),onClick:v[1]||(v[1]=x=>R.value="task")},[a("span",hs,c(t(C)("diffReview.scopeTaskShort")),1),a("span",ms,c(t(C)("diffReview.scopeTask")),1)],2),a("button",{type:"button",class:D(["tool-button inline-flex items-center justify-center gap-2 px-3 py-2 text-xs",t(R)==="run"?"theme-filter-active":""]),onClick:v[2]||(v[2]=x=>R.value="run")},[a("span",null,c(t(C)("diffReview.scopeRun")),1)],2),a("button",{type:"button",class:"tool-button tool-button-info-subtle inline-flex shrink-0 items-center justify-center gap-2 px-3 py-2 text-xs",disabled:t(n),onClick:v[3]||(v[3]=(...x)=>t(E)&&t(E)(...x))},[$(t(Ve),{class:D(["h-3.5 w-3.5 sm:hidden",t(n)?"animate-spin":""])},null,8,["class"]),a("span",gs,c(t(C)("diffReview.refresh")),1),$(t(Ve),{class:D(["hidden h-3.5 w-3.5 sm:inline-block",t(n)?"animate-spin":""])},null,8,["class"]),a("span",ps,c(t(n)?t(C)("diffReview.refreshing"):t(ce)?t(C)("diffReview.computing"):t(C)("diffReview.refresh")),1)],8,vs)]),t(R)==="run"?(g(),Ie(ut,{key:0,modelValue:t(ie),"onUpdate:modelValue":v[4]||(v[4]=x=>ft(ie)?ie.value=x:null),class:"min-w-0 sm:max-w-[360px]",options:t(fe),loading:t(n),"get-option-value":x=>(x==null?void 0:x.id)||"",placeholder:t(C)("diffReview.selectRun"),"empty-text":t(C)("diffReview.noRuns")},{trigger:ue(({selectedOption:x})=>[a("div",xs,c(x?t(A)(x):t(C)("diffReview.selectRun")),1)]),header:ue(()=>[a("div",ks,c(t(C)("diffReview.runCount",{count:t(fe).length})),1)]),option:ue(({option:x,selected:le,select:Fe})=>[a("button",{type:"button",class:D(["w-full rounded-sm border border-dashed px-3 py-2 text-left transition",le?"theme-filter-active":"theme-filter-idle"]),onClick:Fe},[a("div",bs,[a("div",ws,[a("div",Ss,c(t(Ge)(x.startedAt||x.createdAt)),1),a("div",Rs,c(t(S)(x)),1)]),le?(g(),Ie(t(mt),{key:0,class:"mt-0.5 h-4 w-4 shrink-0 text-[var(--theme-textSecondary)]"})):J("",!0)])],10,ys)]),_:1},8,["modelValue","options","loading","get-option-value","placeholder","empty-text"])):J("",!0)])]),t(b)?(g(),y("div",Fs,[a("div",Cs,[$(t(vt),{class:"mt-0.5 h-4 w-4 shrink-0"}),a("span",Ls,c(t(b)),1)])])):J("",!0),t(n)&&!t(f)?(g(),y("div",Ps,c(t(C)("diffReview.loading")),1)):t(f)&&!t(f).supported?(g(),y("div",$s,[a("div",Ts,[a("div",_s,[$(t(Ke),{class:"h-4 w-4"}),a("span",null,c(t(C)("diffReview.unavailableTitle")),1)]),a("p",Hs,c(t(f).reason||t(C)("diffReview.unavailableReason")),1),t(f).repoRoot?(g(),y("div",Ds,[a("div",Is,[$(t(ze),{class:"h-3.5 w-3.5 shrink-0"}),a("span",As,c(t(f).repoRoot),1)]),t(f).branch?(g(),y("div",js,[$(t(Ee),{class:"h-3.5 w-3.5 shrink-0"}),a("span",null,c(t(f).branch),1)])):J("",!0)])):J("",!0)])])):t(f)?(g(),y("div",Ms,[a("div",Ns,[a("div",Bs,[t(f).repoRoot?(g(),y("div",Vs,[$(t(ze),{class:"h-3.5 w-3.5 shrink-0"}),a("span",zs,c(t(f).repoRoot),1)])):J("",!0),a("div",Es,[$(t(Ee),{class:"h-3.5 w-3.5 shrink-0"}),a("span",null,c(t(f).branch||t(C)("diffReview.unknownBranch")),1),v[16]||(v[16]=a("span",{class:"opacity-50"},"•",-1)),a("span",Ws,c(t(C)("diffReview.fileCount",{count:((te=t(f).summary)==null?void 0:te.fileCount)||0})),1),(ve=t(f).summary)!=null&&ve.statsComplete?(g(),y(ne,{key:0},[v[12]||(v[12]=a("span",{class:"opacity-50"},"•",-1)),a("span",Os,"+"+c(((ge=t(f).summary)==null?void 0:ge.additions)||0),1),a("span",Us,"-"+c(((pe=t(f).summary)==null?void 0:pe.deletions)||0),1)],64)):t(Z)?(g(),y(ne,{key:1},[v[13]||(v[13]=a("span",{class:"opacity-50"},"•",-1)),v[14]||(v[14]=a("span",{class:"h-3 w-10 animate-pulse rounded bg-[var(--theme-successSoft)]"},null,-1)),v[15]||(v[15]=a("span",{class:"h-3 w-10 animate-pulse rounded bg-[var(--theme-dangerSoft)]"},null,-1))],64)):(g(),y("span",Gs,c(t(C)("diffReview.waitingStats")),1))])]),t(h)?(g(),y("p",qs,c(t(h)),1)):J("",!0),(xe=t(f).warnings)!=null&&xe.length?(g(),y("div",Ks,[(g(!0),y(ne,null,Se(t(f).warnings,x=>(g(),y("p",{key:x,class:"text-[11px] text-[var(--theme-warningText)]"},c(x),1))),128))])):J("",!0)]),t(ee)?(g(),y("div",Js,[a("div",Qs,[a("div",Xs,[a("button",{type:"button",class:D(["tool-button px-3 py-2 text-sm",M.value==="files"?"tool-button-accent-subtle":""]),onClick:v[5]||(v[5]=x=>M.value="files")},c(t(C)("diffReview.filesTab")),3),a("button",{type:"button",class:D(["tool-button px-3 py-2 text-sm",M.value==="patch"?"tool-button-accent-subtle":""]),disabled:!t(W),onClick:v[6]||(v[6]=x=>M.value="patch")},c(t(C)("diffReview.diffTab")),11,Ys)])]),De(a("div",Zs,[$(Oe,{"auto-focus-selected":e.active&&M.value==="files","diff-payload":t(f),"file-search":t(u),"focus-token":e.focusToken,"filtered-files":t(T),"get-filter-button-class":t(O),"get-filter-label":t(l),"get-status-class":t(L),"get-status-label":t(j),"selected-file-path":t(U),"show-summary-skeleton":t(Z),"status-counts":t(re),"status-filter":t(q),"onUpdate:fileSearch":v[7]||(v[7]=x=>u.value=x),"onUpdate:statusFilter":v[8]||(v[8]=x=>q.value=x),onSelectFile:he},null,8,["auto-focus-selected","diff-payload","file-search","focus-token","filtered-files","get-filter-button-class","get-filter-label","get-status-class","get-status-label","selected-file-path","show-summary-skeleton","status-counts","status-filter"])],512),[[Me,M.value==="files"]]),De(a("div",ea,[$(Ue,{"active-hunk-index":t(r),"get-patch-line-class":t(w),"get-status-class":t(L),"get-status-label":t(j),"jump-to-adjacent-hunk":t(p),"patch-loading":t(d),"selected-file":t(W),"selected-patch-hunks":t(B),"selected-patch-lines":t(G),"set-patch-line-ref":t(de),"set-patch-viewport-ref":me},null,8,["active-hunk-index","get-patch-line-class","get-status-class","get-status-label","jump-to-adjacent-hunk","patch-loading","selected-file","selected-patch-hunks","selected-patch-lines","set-patch-line-ref"])],512),[[Me,M.value==="patch"]])])):(g(),y("div",ta,[a("div",sa,[$(Oe,{"auto-focus-selected":e.active,"diff-payload":t(f),"file-search":t(u),"focus-token":e.focusToken,"filtered-files":t(T),"get-filter-button-class":t(O),"get-filter-label":t(l),"get-status-class":t(L),"get-status-label":t(j),"selected-file-path":t(U),"show-summary-skeleton":t(Z),"status-counts":t(re),"status-filter":t(q),"onUpdate:fileSearch":v[9]||(v[9]=x=>u.value=x),"onUpdate:statusFilter":v[10]||(v[10]=x=>q.value=x),onSelectFile:v[11]||(v[11]=x=>U.value=x)},null,8,["auto-focus-selected","diff-payload","file-search","focus-token","filtered-files","get-filter-button-class","get-filter-label","get-status-class","get-status-label","selected-file-path","show-summary-skeleton","status-counts","status-filter"])]),a("div",aa,[$(Ue,{"active-hunk-index":t(r),"get-patch-line-class":t(w),"get-status-class":t(L),"get-status-label":t(j),"jump-to-adjacent-hunk":t(p),"patch-loading":t(d),"selected-file":t(W),"selected-patch-hunks":t(B),"selected-patch-lines":t(G),"set-patch-line-ref":t(de),"set-patch-viewport-ref":me},null,8,["active-hunk-index","get-patch-line-class","get-status-class","get-status-label","jump-to-adjacent-hunk","patch-loading","selected-file","selected-patch-hunks","selected-patch-lines","set-patch-line-ref"])])]))])):J("",!0)])}}},ia={class:"theme-heading inline-flex items-center gap-2 text-sm font-medium"},ha={__name:"TaskDiffReviewDialog",props:{open:{type:Boolean,default:!1},taskSlug:{type:String,default:""},taskTitle:{type:String,default:""},preferredScope:{type:String,default:"task"},preferredRunId:{type:String,default:""},focusToken:{type:Number,default:0}},emits:["close"],setup(e,{emit:i}){const r=e,h=i,{t:f}=Re(),R=V(()=>{const b=String(r.taskTitle||"").trim();return b?f("diffReview.dialogTitleWithTask",{title:b}):f("diffReview.dialogTitle")});return(b,u)=>(g(),Ie(dt,{open:e.open,"stack-level":2,"panel-class":"settings-dialog-panel h-full sm:h-[90vh] sm:w-[90vw] sm:max-w-[90vw]","header-class":"settings-dialog-header px-5 py-4","body-class":"settings-dialog-body min-h-0 flex-1 overflow-hidden p-3 sm:p-4",onClose:u[0]||(u[0]=T=>h("close"))},{title:ue(()=>[a("div",ia,[$(t(Ke),{class:"h-4 w-4"}),a("span",null,c(R.value),1)])]),default:ue(()=>[$(na,{"task-slug":e.taskSlug,active:e.open,"preferred-scope":e.preferredScope,"preferred-run-id":e.preferredRunId,"focus-token":e.focusToken},null,8,["task-slug","active","preferred-scope","preferred-run-id","focus-token"])]),_:1},8,["open"]))}};export{ha as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.task-diff-row[data-v-d9d5559e]{grid-template-columns:3.1rem 3.1rem minmax(0,1fr)}.task-diff-view[data-v-d9d5559e]{font-size:var(--theme-codeViewFontSize);line-height:var(--theme-codeViewLineHeight)}.task-diff-row__number[data-v-d9d5559e]{border-right:1px solid var(--theme-borderMuted);color:color-mix(in srgb,var(--theme-textPrimary) 52%,transparent);font-size:var(--theme-codeViewGutterFontSize);font-variant-numeric:tabular-nums;padding:.125rem .5rem;text-align:right}.task-diff-line[data-v-d9d5559e]{color:inherit}.task-diff-line[data-v-d9d5559e] .task-diff-line__prefix{display:inline-block;font-weight:600;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:1ch}.task-diff-line[data-v-d9d5559e] .task-diff-line__prefix--add{color:var(--theme-successText)}.task-diff-line[data-v-d9d5559e] .task-diff-line__prefix--delete{color:var(--theme-dangerText)}.task-diff-line[data-v-d9d5559e] .task-diff-line__prefix--context{color:color-mix(in srgb,var(--theme-textPrimary) 35%,transparent)}.task-diff-line[data-v-d9d5559e] .task-diff-line__body{display:inline}.task-diff-line--plain[data-v-d9d5559e]{color:inherit}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{aD as l,aE as r,aF as e,aQ as a,u as i,aR as V,aS as O,aL as nt,aV as Nt,aI as N,aN as v,c as h,w as Qe,ak as $t,aJ as he,aG as B,aW as z,b2 as Ut,aY as Ft,aX as ke,b3 as It,b as m,r as ve}from"./vendor-misc-u-M8sNMf.js";import{d as J,f as Lt,_ as jt,c as Vt,h as Ot}from"./WorkbenchView-CICtaY88.js";import{u as at,b as qt,W as Xe,c as At,f as Ht,d as Ze}from"./index-d30njJCo.js";import{b as Kt,K as xe,D as et,E as Wt,g as zt,L as pe,H as tt,t as Jt,J as Gt,x as Yt}from"./vendor-ui-C5E3MVzU.js";import"./vendor-markdown-9aQhqbjm.js";import"./vendor-tiptap-rwYdQb1L.js";import"./vendor-router-Dn8q3tJM.js";function Qt(){return J("/api/relay/config",{cache:"no-store"})}function st($){return J("/api/relay/config",{method:"PUT",body:JSON.stringify($)})}function Xt(){return J("/api/relay/reconnect",{method:"POST"})}function Zt(){return J("/api/system/config",{cache:"no-store"})}function es($){return J("/api/system/config",{method:"PUT",body:JSON.stringify($)})}function ts(){return J("/api/diagnostics/runtime",{cache:"no-store"})}const ss={class:"space-y-4"},ns={class:"flex items-center justify-between gap-3"},as={class:"theme-heading text-sm font-medium"},is={class:"theme-toggle-current theme-badge-muted theme-muted-text rounded-sm border border-dashed px-2 py-1 text-[11px]"},os={class:"theme-muted-text theme-note-text mt-1"},ls={class:"space-y-4"},rs={class:"theme-muted-text px-1 text-[10px] font-medium uppercase tracking-[0.16em]"},cs=["onClick"],ds={class:"flex items-start gap-3"},us={class:"mt-0.5 flex items-center gap-1.5"},ms={class:"min-w-0 flex-1"},gs={class:"flex items-center justify-between gap-2"},hs={class:"truncate text-sm font-medium"},vs={class:"theme-muted-text theme-note-text mt-1"},xs={__name:"ThemeToggle",setup($){const{currentTheme:G,setTheme:Y,themes:ie}=qt(),{t:R}=at(),_e=h(()=>{const C=ie.value.filter(x=>x.mode==="light"),oe=ie.value.filter(x=>x.mode==="dark");return[{id:"light",label:R("theme.groupLight"),items:C},{id:"dark",label:R("theme.groupDark"),items:oe}].filter(x=>x.items.length)});function ye(C){Y(C)}function s(C){return R(`theme.description.${C.id}`,{},C.description)}return(C,oe)=>(l(),r("div",ss,[e("div",null,[e("div",ns,[e("div",as,a(i(R)("theme.heading")),1),e("div",is,a(i(R)("theme.currentTheme",{name:i(G).shortName})),1)]),e("div",os,a(i(R)("theme.helper")),1)]),e("div",ls,[(l(!0),r(V,null,O(_e.value,x=>(l(),r("section",{key:x.id,class:"space-y-1.5"},[e("div",rs,a(x.label),1),(l(!0),r(V,null,O(x.items,f=>(l(),r("button",{key:f.id,type:"button",class:nt(["theme-option theme-toggle-card w-full rounded-sm border px-3 py-2 text-left transition",f.id===i(G).id?"theme-option-active":"theme-option-idle"]),onClick:U=>ye(f.id)},[e("div",ds,[e("div",us,[(l(!0),r(V,null,O(f.swatches,(U,S)=>(l(),r("span",{key:`${f.id}-${S}`,class:"h-3 w-3 rounded-full border border-black/10",style:Nt({backgroundColor:U})},null,4))),128))]),e("div",ms,[e("div",gs,[e("span",hs,a(f.shortName),1),f.id===i(G).id?(l(),N(i(Kt),{key:0,class:"h-4 w-4 shrink-0"})):v("",!0)]),e("div",vs,a(s(f)),1)])])],10,cs))),128))]))),128))])]))}},ps={class:"theme-heading inline-flex items-center gap-2 text-sm font-medium"},_s={class:"settings-dialog-content min-h-0 flex-1 overflow-y-auto px-5 py-5"},ys={key:0,class:"space-y-4"},fs={class:"theme-heading inline-flex items-center gap-2 text-base font-medium"},bs={class:"settings-section-card space-y-4 px-4 py-4"},Ds={class:"theme-heading text-sm font-medium"},ks={class:"theme-muted-text mt-1 text-xs leading-5"},ws={class:"grid gap-3"},Cs=["value","onChange"],Rs={class:"min-w-0"},Ss={class:"text-sm font-medium text-[var(--theme-textPrimary)]"},Ts={class:"theme-muted-text mt-1 text-xs leading-5"},Es={key:1,class:"space-y-4"},Ps={class:"theme-heading text-base font-medium"},Ms={class:"theme-muted-text mt-1 text-xs leading-5"},Bs={class:"settings-section-card px-4 py-4"},Ns={class:"settings-section-card space-y-4 px-4 py-4"},$s={class:"theme-heading text-sm font-medium"},Us={class:"theme-muted-text mt-1 text-xs leading-5"},Fs={class:"block space-y-1.5"},Is={class:"theme-muted-text text-xs"},Ls={class:"truncate text-sm text-[var(--theme-textPrimary)]"},js=["onClick"],Vs={class:"flex items-center justify-between gap-3"},Os={class:"min-w-0"},qs={class:"truncate text-[var(--theme-textPrimary)]"},As={class:"theme-muted-text mt-1 truncate text-xs"},Hs={key:0,class:"theme-status-success rounded-sm border border-dashed px-2 py-0.5 text-[10px]"},Ks={class:"theme-muted-text theme-note-text"},Ws={key:2,class:"space-y-4"},zs={class:"flex items-start justify-between gap-3"},Js={class:"theme-heading inline-flex items-center gap-2 text-base font-medium"},Gs={class:"settings-section-card space-y-4 px-4 py-4"},Ys={class:"settings-form-card flex items-center justify-between gap-3 px-3 py-2"},Qs={class:"text-sm font-medium text-[var(--theme-textPrimary)]"},Xs={class:"theme-muted-text mt-1 text-xs"},Zs=["disabled"],en={class:"grid gap-4 sm:grid-cols-2"},tn={class:"space-y-1.5 sm:col-span-2"},sn={class:"theme-muted-text text-xs"},nn=["disabled"],an={class:"space-y-1.5"},on={class:"theme-muted-text text-xs"},ln=["disabled"],rn={class:"space-y-1.5"},cn={class:"theme-muted-text text-xs"},dn={class:"relative"},un=["type","placeholder","disabled"],mn=["disabled"],gn={class:"settings-form-footer flex flex-wrap items-center justify-between gap-3"},hn={class:"min-w-0 space-y-1"},vn={key:0,class:"theme-danger-text theme-note-text"},xn={key:1,class:"theme-status-warning theme-note-text"},pn={key:2,class:"theme-danger-text theme-note-text"},_n={key:3,class:"theme-status-success theme-note-text"},yn={key:4,class:"theme-danger-text theme-note-text"},fn={key:5,class:"theme-muted-text theme-note-text"},bn={key:6,class:"theme-muted-text theme-note-text"},Dn={key:7,class:"theme-muted-text theme-note-text"},kn={key:8,class:"theme-status-success theme-note-text"},wn={key:9,class:"theme-muted-text theme-note-text"},Cn={class:"flex flex-wrap items-center gap-2"},Rn=["disabled"],Sn=["disabled"],Tn=["disabled"],En={key:3,class:"space-y-4"},Pn={class:"theme-heading inline-flex items-center gap-2 text-base font-medium"},Mn={class:"theme-muted-text mt-1 text-xs leading-5"},Bn={class:"settings-section-card space-y-4 px-4 py-4"},Nn={class:"space-y-1.5"},$n={class:"theme-muted-text text-xs"},Un=["disabled"],Fn={class:"theme-muted-text text-xs leading-5"},In={class:"settings-form-footer flex flex-wrap items-center justify-between gap-3"},Ln={class:"min-w-0 space-y-1"},jn={key:0,class:"theme-status-warning theme-note-text"},Vn={key:1,class:"theme-danger-text theme-note-text"},On={key:2,class:"theme-status-success theme-note-text"},qn={key:3,class:"theme-muted-text theme-note-text"},An={class:"flex flex-wrap items-center gap-2"},Hn=["disabled"],Kn={class:"settings-section-card space-y-4 px-4 py-4"},Wn={class:"flex flex-wrap items-start justify-between gap-3"},zn={class:"theme-heading text-sm font-medium"},Jn={class:"theme-muted-text mt-1 text-xs leading-5"},Gn={class:"flex flex-wrap items-center gap-2"},Yn=["disabled"],Qn={class:"min-w-0 space-y-1"},Xn={key:0,class:"theme-danger-text theme-note-text"},Zn={key:1,class:"theme-status-success theme-note-text"},ea={key:2,class:"theme-muted-text theme-note-text"},ta={key:0,class:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4"},sa={class:"settings-form-card space-y-1 px-3 py-3"},na={class:"theme-heading text-lg font-medium"},aa={class:"theme-muted-text text-xs"},ia={class:"settings-form-card space-y-1 px-3 py-3"},oa={class:"theme-heading text-lg font-medium"},la={class:"theme-muted-text text-xs"},ra={class:"settings-form-card space-y-1 px-3 py-3"},ca={class:"theme-heading text-lg font-medium"},da={class:"theme-muted-text text-xs"},ua={class:"settings-form-card space-y-1 px-3 py-3"},ma={class:"theme-heading text-lg font-medium"},ga={class:"theme-muted-text text-xs"},ha={key:1,class:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4"},va={class:"settings-form-card space-y-1 px-3 py-3"},xa={class:"theme-heading text-lg font-medium"},pa={class:"theme-muted-text text-xs"},_a={class:"settings-form-card space-y-1 px-3 py-3"},ya={class:"theme-heading text-lg font-medium"},fa={class:"theme-muted-text text-xs"},ba={class:"settings-form-card space-y-1 px-3 py-3"},Da={class:"theme-heading text-lg font-medium"},ka={class:"theme-muted-text text-xs"},wa={class:"settings-form-card space-y-1 px-3 py-3"},Ca={class:"theme-heading text-lg font-medium"},Ra={class:"theme-muted-text text-xs"},Sa={key:2,class:"grid gap-3 sm:grid-cols-2 xl:grid-cols-3"},Ta={class:"settings-form-card space-y-1 px-3 py-3"},Ea={class:"theme-heading text-lg font-medium"},Pa={class:"theme-muted-text text-xs"},Ma={class:"settings-form-card space-y-1 px-3 py-3"},Ba={class:"theme-heading text-lg font-medium"},Na={class:"theme-muted-text text-xs"},$a={class:"settings-form-card space-y-1 px-3 py-3"},Ua={class:"theme-heading text-sm font-medium"},Fa={class:"theme-muted-text text-xs"},Ia={class:"grid gap-4 lg:grid-cols-2"},La={class:"settings-form-card space-y-3 px-3 py-3"},ja={class:"theme-heading text-sm font-medium"},Va={class:"space-y-2 text-xs"},Oa={class:"flex items-center justify-between gap-3"},qa={class:"truncate text-right text-[var(--theme-textPrimary)]"},Aa={class:"flex items-center justify-between gap-3"},Ha={class:"text-right text-[var(--theme-textPrimary)]"},Ka={class:"flex items-center justify-between gap-3"},Wa={class:"text-right text-[var(--theme-textPrimary)]"},za={class:"flex items-center justify-between gap-3"},Ja={class:"text-right text-[var(--theme-textPrimary)]"},Ga={class:"flex items-center justify-between gap-3"},Ya={class:"text-right text-[var(--theme-textPrimary)]"},Qa={class:"settings-form-card space-y-3 px-3 py-3"},Xa={class:"theme-heading text-sm font-medium"},Za={class:"space-y-2 text-xs"},ei={class:"theme-muted-text"},ti={class:"text-[var(--theme-textPrimary)]"},si={key:3,class:"settings-form-card space-y-3 px-3 py-3"},ni={class:"theme-heading text-sm font-medium"},ai={class:"grid gap-2 sm:grid-cols-2 xl:grid-cols-3 text-xs"},ii={class:"theme-muted-text"},oi={class:"text-[var(--theme-textPrimary)]"},li={key:4,class:"settings-form-card space-y-2 px-3 py-3"},ri={class:"theme-heading text-sm font-medium"},ci={class:"theme-muted-text text-xs leading-5"},di={class:"theme-muted-text text-xs leading-5"},ui={key:4,class:"space-y-4"},mi={class:"theme-heading inline-flex items-center gap-2 text-base font-medium"},gi={class:"theme-muted-text mt-1 text-xs leading-5"},hi={class:"settings-section-card space-y-3 px-4 py-4"},vi={class:"min-w-0"},xi={class:"text-sm font-medium text-[var(--theme-textPrimary)]"},pi={class:"theme-muted-text mt-1 text-xs leading-5"},_i={class:"flex flex-wrap items-center gap-2"},yi={class:"rounded-sm border border-dashed border-[var(--theme-borderDefault)] px-2.5 py-1 text-xs font-medium text-[var(--theme-textPrimary)]"},fi={class:"rounded-sm border border-dashed border-[var(--theme-borderDefault)] px-2.5 py-1 text-xs font-medium text-[var(--theme-textPrimary)]"},bi={class:"theme-muted-text theme-note-text"},Di={key:5,class:"space-y-4"},ki={class:"theme-heading text-base font-medium"},wi={class:"theme-muted-text mt-1 text-xs leading-5"},Ci={class:"settings-section-card px-4 py-4"},Ri={class:"flex items-center justify-between gap-3"},Si={class:"theme-heading text-sm font-medium"},Ti={class:"theme-muted-text mt-1 text-xs leading-5"},Ei={class:"theme-badge-strong rounded-sm border border-dashed px-2.5 py-1 text-xs font-medium"},Li={__name:"WorkbenchSettingsDialog",props:{open:{type:Boolean,default:!1}},emits:["close"],setup($,{emit:G}){const Y=$,ie=G,{locale:R,localeOptions:_e,setLocale:ye,t:s}=at(),{getPreference:C,setPreference:oe}=At(),x=m(""),f=m(!1),U=m(""),S=m(!1),F=m(!1),T=m(!1),_=m(""),D=m(""),le=m(!1),q=m(!1),A=m(""),Q=m(""),H=m(!1),X=m(""),k=m(null),u=m(null),y=m(!1),K=ve({runnerMaxConcurrentRuns:!1}),Z=m(!1),re=m(!1),ce=m(!1),de=m(!1),d=ve({enabled:!1,relayUrl:"",deviceId:"",deviceToken:""}),W=ve({runnerMaxConcurrentRuns:3}),fe=ve({sendBehavior:""}),w=m("general");let I=null,L=null,ue=null;const it=h(()=>[{id:"general",label:s("settingsDialog.general.sectionLabel"),description:s("settingsDialog.general.sectionDescription"),icon:xe},{id:"theme",label:s("theme.title"),description:s("theme.sectionDescription"),icon:Gt},{id:"relay",label:s("settingsDialog.relay.sectionLabel"),description:s("settingsDialog.relay.sectionDescription"),icon:et},{id:"system",label:s("settingsDialog.system.sectionLabel"),description:s("settingsDialog.system.sectionDescription"),icon:tt},{id:"shortcuts",label:s("settingsDialog.shortcuts.sectionLabel"),description:s("settingsDialog.shortcuts.sectionDescription"),icon:xe},{id:"about",label:s("settingsDialog.about.sectionLabel"),description:s("settingsDialog.about.sectionDescription"),icon:Yt}]),ot=h(()=>Ze.map(t=>({value:t.value,label:s(t.labelKey),description:s(t.descriptionKey)})));function lt(t=null,n=""){const o=String((t==null?void 0:t.messageKey)||"").trim();if(o){const g=s(o);if(g&&g!==o)return g}return String((t==null?void 0:t.message)||"").trim()||(n?s(n):"")}function me(t="",n=""){const o=String(t||"").trim();if(o){const g=`settingsDialog.relay.reason.${o}`,b=s(g);if(b!==g)return b}return String(n||"").trim()||s("common.notAvailable")}function rt(t=null){const n=String((t==null?void 0:t.type)||"").trim()||"unknown",o=`settingsDialog.relay.event.${n}`,g=s(o);return g!==o?g:n}function ct(t=null){const n=String((t==null?void 0:t.lastErrorKey)||"").trim(),o=t!=null&&t.lastErrorParams&&typeof t.lastErrorParams=="object"?t.lastErrorParams:{};return n==="connect_failed"?s("settingsDialog.relay.error.connect_failed"):n==="disconnected"?s("settingsDialog.relay.error.disconnected",{reason:me(o.reasonCode,t==null?void 0:t.lastCloseReason)}):n==="rejected"?s("settingsDialog.relay.error.rejected",{reason:me(o.reasonCode,t==null?void 0:t.lastCloseReason)}):n==="closed_with_code"?s("settingsDialog.relay.error.closedWithCode",{code:o.code||(t==null?void 0:t.lastCloseCode)||0}):String((t==null?void 0:t.lastError)||"").trim()}const dt=h(()=>{var t,n,o,g;return T.value?s("settingsDialog.relay.status.reconnecting"):F.value||Z.value?s("settingsDialog.relay.status.saving"):S.value?s("settingsDialog.relay.status.loading"):(t=u.value)!=null&&t.reconnectPaused?s("settingsDialog.relay.status.paused"):(n=u.value)!=null&&n.connected?s("settingsDialog.relay.status.connected"):(((o=u.value)==null?void 0:o.enabled)??d.enabled)&&Number(((g=u.value)==null?void 0:g.nextReconnectDelayMs)||0)>0?s("settingsDialog.relay.status.waitingReconnect"):d.enabled?s("settingsDialog.relay.status.disconnected"):s("settingsDialog.relay.status.disabled")}),ut=h(()=>{var t,n;return(t=u.value)!=null&&t.reconnectPaused?"theme-status-danger":(n=u.value)!=null&&n.connected?"theme-status-success":d.enabled?"theme-status-warning":"theme-status-neutral"}),mt=h(()=>[{id:"open-settings",label:s("settingsDialog.shortcuts.openSettingsTitle"),description:s("settingsDialog.shortcuts.openSettingsDescription"),mac:"⌘ ⇧ ,",windows:"Ctrl + Shift + ,"},{id:"open-project-manager",label:s("settingsDialog.shortcuts.openProjectManagerTitle"),description:s("settingsDialog.shortcuts.openProjectManagerDescription"),mac:"⌘ ⇧ K",windows:"Ctrl + Shift + K"},{id:"open-source-browser",label:s("settingsDialog.shortcuts.openSourceBrowserTitle"),description:s("settingsDialog.shortcuts.openSourceBrowserDescription"),mac:"⌘ ⇧ O",windows:"Ctrl + Shift + O"},{id:"open-diff-review",label:s("settingsDialog.shortcuts.openDiffReviewTitle"),description:s("settingsDialog.shortcuts.openDiffReviewDescription"),mac:"⌘ ⇧ D",windows:"Ctrl + Shift + D"},{id:"close-top-dialog",label:s("settingsDialog.shortcuts.closeTopDialogTitle"),description:s("settingsDialog.shortcuts.closeTopDialogDescription"),mac:"Esc",windows:"Esc"}]),gt=h(()=>{var t,n,o;return!y.value&&!_.value&&!D.value&&!((t=u.value)!=null&&t.lastError)&&!((n=u.value)!=null&&n.lastCloseReason)&&!((o=u.value)!=null&&o.lastConnectedAt)}),ht=h(()=>{const t=d.deviceToken?`${"*".repeat(Math.max(0,d.deviceToken.length-4))}${d.deviceToken.slice(-4)}`:"";return JSON.stringify({generatedAt:new Date().toISOString(),source:"local-settings",config:{enabled:d.enabled,relayUrl:d.relayUrl,deviceId:d.deviceId,deviceTokenMasked:t,managedByEnv:y.value},status:u.value||null},null,2)}),j=h(()=>{var t,n;return((n=(t=k.value)==null?void 0:t.runner)==null?void 0:n.runner)||null}),ee=h(()=>{var t,n;return!!((n=(t=k.value)==null?void 0:t.runner)!=null&&n.ok&&j.value)}),p=h(()=>{var t;return((t=j.value)==null?void 0:t.metrics)||null}),we=h(()=>{var t;return((t=k.value)==null?void 0:t.recovery)||null}),Ce=h(()=>{var t;return((t=k.value)==null?void 0:t.maintenance)||null}),vt=h(()=>{var t;return((t=k.value)==null?void 0:t.gitDiffWorker)||null}),xt=h(()=>JSON.stringify({generatedAt:new Date().toISOString(),source:"local-settings",config:{runner:{maxConcurrentRuns:W.runnerMaxConcurrentRuns,managedByEnv:K.runnerMaxConcurrentRuns}},diagnostics:k.value||null},null,2));function te(t){const n=String(t||"").trim();if(!n)return s("common.notAvailable");const o=new Date(n);return Number.isNaN(o.getTime())?n:Ht(o.toISOString(),{year:"numeric",month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"})}const pt=h(()=>{var t,n,o,g,b,E,P,M;return[{key:"queued_cancelled",label:s("settingsDialog.system.stopReasons.queued_cancelled"),value:Math.max(0,Number((n=(t=p.value)==null?void 0:t.stopReasons)==null?void 0:n.queued_cancelled)||0)},{key:"user_requested",label:s("settingsDialog.system.stopReasons.user_requested"),value:Math.max(0,Number((g=(o=p.value)==null?void 0:o.stopReasons)==null?void 0:g.user_requested)||0)},{key:"user_requested_after_error",label:s("settingsDialog.system.stopReasons.user_requested_after_error"),value:Math.max(0,Number((E=(b=p.value)==null?void 0:b.stopReasons)==null?void 0:E.user_requested_after_error)||0)},{key:"stop_timeout",label:s("settingsDialog.system.stopReasons.stop_timeout"),value:Math.max(0,Number((M=(P=p.value)==null?void 0:P.stopReasons)==null?void 0:M.stop_timeout)||0)}]}),_t=h(()=>{var t,n,o,g,b,E,P,M,ne,ae;return[{key:"runner_timeout_without_stop_request",label:s("settingsDialog.system.stopTimeoutPhases.runner_timeout_without_stop_request"),value:Math.max(0,Number((n=(t=p.value)==null?void 0:t.stopTimeoutPhases)==null?void 0:n.runner_timeout_without_stop_request)||0)},{key:"runner_timeout_before_cancel",label:s("settingsDialog.system.stopTimeoutPhases.runner_timeout_before_cancel"),value:Math.max(0,Number((g=(o=p.value)==null?void 0:o.stopTimeoutPhases)==null?void 0:g.runner_timeout_before_cancel)||0)},{key:"cli_not_exiting",label:s("settingsDialog.system.stopTimeoutPhases.cli_not_exiting"),value:Math.max(0,Number((E=(b=p.value)==null?void 0:b.stopTimeoutPhases)==null?void 0:E.cli_not_exiting)||0)},{key:"os_kill_slow",label:s("settingsDialog.system.stopTimeoutPhases.os_kill_slow"),value:Math.max(0,Number((M=(P=p.value)==null?void 0:P.stopTimeoutPhases)==null?void 0:M.os_kill_slow)||0)},{key:"runner_finalize_after_exit",label:s("settingsDialog.system.stopTimeoutPhases.runner_finalize_after_exit"),value:Math.max(0,Number((ae=(ne=p.value)==null?void 0:ne.stopTimeoutPhases)==null?void 0:ae.runner_finalize_after_exit)||0)}]}),yt=h(()=>_e.value.map(t=>({value:t.value,label:t.value==="zh-CN"?s("locale.zhHans"):s("locale.enUs"),englishLabel:t.englishLabel})));async function ft(){f.value=!0,U.value="";try{const t=await Ot(),n=String((t==null?void 0:t.version)||"").trim();x.value=n,n||(U.value=s("settingsDialog.about.versionPending"))}catch(t){x.value="",U.value=(t==null?void 0:t.message)||s("settingsDialog.about.versionLoadFailed")}finally{f.value=!1}}function be(t={}){d.enabled=!!(t!=null&&t.enabled),d.relayUrl=String((t==null?void 0:t.relayUrl)||""),d.deviceId=String((t==null?void 0:t.deviceId)||""),d.deviceToken=String((t==null?void 0:t.deviceToken)||"")}function Re(t={}){var n;W.runnerMaxConcurrentRuns=Math.max(1,Number((n=t==null?void 0:t.runner)==null?void 0:n.maxConcurrentRuns)||3)}function bt(){var t;fe.sendBehavior=String(C(Xe.SEND_BEHAVIOR)||((t=Ze[1])==null?void 0:t.value)||"")}async function Se(){S.value=!0,_.value="",D.value="";try{const t=await Qt();be((t==null?void 0:t.config)||{}),y.value=!!(t!=null&&t.managedByEnv),u.value=(t==null?void 0:t.relay)||null}catch(t){_.value=(t==null?void 0:t.message)||s("settingsDialog.relay.relayConfigLoadFailed"),u.value=null}finally{S.value=!1}}async function Dt(){var t,n;le.value=!0,A.value="",Q.value="";try{const o=await Zt();Re((o==null?void 0:o.config)||{}),K.runnerMaxConcurrentRuns=!!((n=(t=o==null?void 0:o.managedByEnv)==null?void 0:t.runner)!=null&&n.maxConcurrentRuns),se()}catch(o){A.value=(o==null?void 0:o.message)||s("settingsDialog.system.systemConfigLoadFailed")}finally{le.value=!1}}async function se(){H.value=!0,X.value="";try{k.value=await ts()}catch(t){X.value=(t==null?void 0:t.message)||s("settingsDialog.system.systemDiagnosticsLoadFailed")}finally{H.value=!1}}async function kt(){F.value=!0,_.value="",D.value="";try{const t=await st({enabled:d.enabled,relayUrl:d.relayUrl,deviceId:d.deviceId,deviceToken:d.deviceToken});be((t==null?void 0:t.config)||{}),y.value=!!(t!=null&&t.managedByEnv),u.value=(t==null?void 0:t.relay)||null,D.value=d.enabled?s("settingsDialog.relay.relayConfigSavedEnabled"):s("settingsDialog.relay.relayConfigSavedDisabled")}catch(t){_.value=(t==null?void 0:t.message)||s("settingsDialog.relay.relayConfigSaveFailed")}finally{F.value=!1}}async function wt(){T.value=!0,_.value="",D.value="";try{const t=await Xt();u.value=(t==null?void 0:t.relay)||null,D.value=s("settingsDialog.relay.relayReconnectTriggered"),setTimeout(()=>{Se()},1200)}catch(t){_.value=(t==null?void 0:t.message)||s("settingsDialog.relay.relayReconnectFailed")}finally{T.value=!1}}async function Ct(){var t,n;q.value=!0,A.value="",Q.value="";try{const o=await es({runner:{maxConcurrentRuns:W.runnerMaxConcurrentRuns}});Re((o==null?void 0:o.config)||{}),K.runnerMaxConcurrentRuns=!!((n=(t=o==null?void 0:o.managedByEnv)==null?void 0:t.runner)!=null&&n.maxConcurrentRuns),Q.value=s("settingsDialog.system.systemConfigSaved"),se()}catch(o){A.value=(o==null?void 0:o.message)||s("settingsDialog.system.systemConfigSaveFailed")}finally{q.value=!1}}function Rt(){return!!(String(d.relayUrl||"").trim()&&String(d.deviceId||"").trim()&&String(d.deviceToken||"").trim())}async function St(){var t;if(!y.value){if(_.value="",D.value="",d.enabled&&!Rt()){d.enabled=!1,_.value=s("settingsDialog.relay.relayFieldsRequired");return}Z.value=!0;try{const n=await st({enabled:d.enabled,relayUrl:d.relayUrl,deviceId:d.deviceId,deviceToken:d.deviceToken});be((n==null?void 0:n.config)||{}),y.value=!!(n!=null&&n.managedByEnv),u.value=(n==null?void 0:n.relay)||null,D.value=d.enabled?s("settingsDialog.relay.relayEnabledSaved"):s("settingsDialog.relay.relayConfigSavedDisabled")}catch(n){d.enabled=!!((t=u.value)!=null&&t.enabled),_.value=(n==null?void 0:n.message)||s("settingsDialog.relay.relayToggleFailed")}finally{Z.value=!1}}}async function Te(t){var o;if((o=navigator.clipboard)!=null&&o.writeText&&window.isSecureContext){await navigator.clipboard.writeText(t);return}const n=document.createElement("textarea");n.value=t,n.setAttribute("readonly","true"),n.style.position="fixed",n.style.opacity="0",n.style.pointerEvents="none",document.body.appendChild(n),n.select(),document.execCommand("copy"),document.body.removeChild(n)}async function Tt(){try{await Te(ht.value),ce.value=!0,I&&clearTimeout(I),I=setTimeout(()=>{ce.value=!1,I=null},2e3)}catch(t){_.value=(t==null?void 0:t.message)||s("settingsDialog.relay.relayDiagnosticsCopyFailed")}}async function Et(){try{await Te(xt.value),de.value=!0,L&&clearTimeout(L),L=setTimeout(()=>{de.value=!1,L=null},2e3)}catch(t){X.value=(t==null?void 0:t.message)||s("settingsDialog.system.systemDiagnosticsCopyFailed")}}function Pt(t){ye(t)}function De(){ue&&(clearInterval(ue),ue=null)}function Mt(){De(),!(!Y.open||w.value!=="system")&&(se(),ue=setInterval(()=>{se()},5e3))}return Qe(()=>Y.open,t=>{if(t){w.value="general",bt(),ft(),Se(),Dt();return}},{immediate:!0}),Qe([()=>Y.open,w],([t,n])=>{if(t&&n==="system"){Mt();return}De()},{immediate:!0}),$t(()=>{I&&(clearTimeout(I),I=null),L&&(clearTimeout(L),L=null),De()}),(t,n)=>(l(),N(Vt,{open:$.open,"stack-level":2,"panel-class":"settings-dialog-panel h-full max-w-5xl sm:h-[42rem] sm:max-h-[88vh]","header-class":"settings-dialog-header px-5 py-4","body-class":"settings-dialog-body min-h-0 flex flex-1 flex-col sm:flex-row",onClose:n[8]||(n[8]=o=>ie("close"))},{title:he(()=>[e("div",ps,[B(i(Jt),{class:"h-4 w-4"}),e("span",null,a(i(s)("common.settings")),1)])]),default:he(()=>{var o,g,b,E,P,M,ne,ae,Ee,Pe,Me,Be,Ne,$e,Ue,Fe,Ie,Le,je,Ve,Oe,qe,Ae,He,Ke,We,ze,Je,Ge,Ye;return[B(Lt,{modelValue:w.value,"onUpdate:modelValue":n[0]||(n[0]=c=>w.value=c),sections:it.value},null,8,["modelValue","sections"]),e("div",_s,[w.value==="general"?(l(),r("section",ys,[e("div",null,[e("div",fs,[B(i(xe),{class:"h-4 w-4"}),e("span",null,a(i(s)("settingsDialog.general.title")),1)])]),e("section",bs,[e("div",null,[e("div",Ds,a(i(s)("settingsDialog.general.sendBehavior.title")),1),e("p",ks,a(i(s)("settingsDialog.general.sendBehavior.description")),1)]),e("div",ws,[(l(!0),r(V,null,O(ot.value,c=>(l(),r("label",{key:c.value,class:"settings-form-card flex items-start gap-3 px-3 py-3"},[z(e("input",{"onUpdate:modelValue":n[1]||(n[1]=ge=>fe.sendBehavior=ge),value:c.value,type:"radio",name:"workbench-send-behavior",class:"mt-0.5 h-4 w-4",onChange:ge=>i(oe)(i(Xe).SEND_BEHAVIOR,c.value)},null,40,Cs),[[Ut,fe.sendBehavior]]),e("div",Rs,[e("div",Ss,a(c.label),1),e("p",Ts,a(c.description),1)])]))),128))])])])):w.value==="theme"?(l(),r("section",Es,[e("div",null,[e("div",Ps,a(i(s)("theme.title")),1),e("p",Ms,a(i(s)("theme.sectionDescription")),1)]),e("section",Bs,[B(xs)]),e("section",Ns,[e("div",null,[e("div",$s,a(i(s)("locale.title")),1),e("p",Us,a(i(s)("locale.description")),1)]),e("label",Fs,[e("span",Is,a(i(s)("locale.field")),1),B(jt,{"model-value":i(R),options:yt.value,"get-option-value":c=>c.value,"onUpdate:modelValue":Pt},{trigger:he(({selectedOption:c})=>[e("div",Ls,a((c==null?void 0:c.label)||i(s)("common.select")),1)]),option:he(({option:c,selected:ge,select:Bt})=>[e("button",{type:"button",class:"workbench-select-option theme-filter-idle w-full rounded-sm border border-dashed px-3 py-2 text-left text-sm",onClick:Pi=>Bt()},[e("div",Vs,[e("div",Os,[e("div",qs,a(c.label),1),e("div",As,a(c.englishLabel),1)]),ge?(l(),r("span",Hs,a(i(s)("common.enabled")),1)):v("",!0)])],8,js)]),_:1},8,["model-value","options","get-option-value"])]),e("p",Ks,a(i(s)("locale.immediateHint")),1)])])):w.value==="relay"?(l(),r("section",Ws,[e("div",zs,[e("div",null,[e("div",Js,[B(i(et),{class:"h-4 w-4"}),e("span",null,a(i(s)("settingsDialog.relay.title")),1)])]),e("span",{class:nt(["rounded-sm border border-dashed px-2.5 py-1 text-xs font-medium",ut.value])},a(dt.value),3)]),e("section",Gs,[e("label",Ys,[e("div",null,[e("div",Qs,a(i(s)("settingsDialog.relay.enableTitle")),1),e("p",Xs,a(i(s)("settingsDialog.relay.enableDescription")),1)]),z(e("input",{"onUpdate:modelValue":n[2]||(n[2]=c=>d.enabled=c),type:"checkbox",class:"h-4 w-4",disabled:y.value,onChange:St},null,40,Zs),[[Ft,d.enabled]])]),e("div",en,[e("label",tn,[e("span",sn,a(i(s)("settingsDialog.relay.relayUrl")),1),z(e("input",{"onUpdate:modelValue":n[3]||(n[3]=c=>d.relayUrl=c),type:"text",placeholder:"https://user1.promptx.example.com",class:"tool-input",disabled:y.value},null,8,nn),[[ke,d.relayUrl]])]),e("label",an,[e("span",on,a(i(s)("settingsDialog.relay.deviceId")),1),z(e("input",{"onUpdate:modelValue":n[4]||(n[4]=c=>d.deviceId=c),type:"text",placeholder:"my-macbook",class:"tool-input",disabled:y.value},null,8,ln),[[ke,d.deviceId]])]),e("label",rn,[e("span",cn,a(i(s)("settingsDialog.relay.deviceToken")),1),e("div",dn,[z(e("input",{"onUpdate:modelValue":n[5]||(n[5]=c=>d.deviceToken=c),type:re.value?"text":"password",placeholder:i(s)("settingsDialog.relay.deviceTokenPlaceholder"),class:"tool-input pr-10",disabled:y.value},null,8,un),[[It,d.deviceToken]]),e("button",{type:"button",class:"theme-icon-button absolute inset-y-1 right-1 flex h-auto w-8 items-center justify-center",disabled:y.value,onClick:n[6]||(n[6]=c=>re.value=!re.value)},[re.value?(l(),N(i(zt),{key:1,class:"h-4 w-4"})):(l(),N(i(Wt),{key:0,class:"h-4 w-4"}))],8,mn)])])]),e("div",gn,[e("div",hn,[(o=u.value)!=null&&o.reconnectPausedReason?(l(),r("p",vn,a(i(s)("settingsDialog.relay.pausedReconnect",{reason:me(u.value.reconnectPausedReasonCode,u.value.reconnectPausedReason)})),1)):v("",!0),y.value?(l(),r("p",xn,a(i(s)("settingsDialog.relay.managedByEnv")),1)):v("",!0),_.value?(l(),r("p",pn,a(_.value),1)):D.value?(l(),r("p",_n,a(D.value),1)):(g=u.value)!=null&&g.lastError?(l(),r("p",yn,a(i(s)("settingsDialog.relay.lastError",{value:ct(u.value)})),1)):(b=u.value)!=null&&b.lastCloseReason?(l(),r("p",fn,a(i(s)("settingsDialog.relay.lastClosed",{reason:me(u.value.lastCloseReasonCode,u.value.lastCloseReason),code:u.value.lastCloseCode})),1)):(E=u.value)!=null&&E.lastConnectedAt?(l(),r("p",bn,a(i(s)("settingsDialog.relay.lastConnected",{value:te(u.value.lastConnectedAt)})),1)):v("",!0),(M=(P=u.value)==null?void 0:P.recentEvents)!=null&&M.length?(l(),r("p",Dn,a(i(s)("settingsDialog.relay.recentEvent",{value:rt(u.value.recentEvents[0])})),1)):v("",!0),ce.value?(l(),r("p",kn,a(i(s)("settingsDialog.relay.copied")),1)):v("",!0),gt.value?(l(),r("p",wn,a(i(s)("settingsDialog.relay.defaultHint")),1)):v("",!0)]),e("div",Cn,[e("button",{type:"button",class:"tool-button inline-flex items-center gap-2 px-3 py-2 text-xs",disabled:S.value||F.value||Z.value||T.value||!(((ne=u.value)==null?void 0:ne.enabled)??d.enabled),onClick:wt},[T.value?(l(),N(i(pe),{key:0,class:"h-4 w-4 animate-spin"})):v("",!0),e("span",null,a(T.value?i(s)("settingsDialog.relay.reconnecting"):i(s)("settingsDialog.relay.reconnectNow")),1)],8,Rn),e("button",{type:"button",class:"tool-button inline-flex items-center gap-2 px-3 py-2 text-xs",disabled:S.value||T.value,onClick:Tt},[e("span",null,a(ce.value?i(s)("settingsDialog.relay.diagnosticsCopied"):i(s)("settingsDialog.relay.copyDiagnostics")),1)],8,Sn),e("button",{type:"button",class:"tool-button tool-button-primary inline-flex items-center gap-2 px-3 py-2 text-xs",disabled:S.value||F.value||Z.value||T.value||y.value,onClick:kt},[F.value?(l(),N(i(pe),{key:0,class:"h-4 w-4 animate-spin"})):v("",!0),e("span",null,a(F.value?i(s)("common.saving"):i(s)("settingsDialog.relay.saveConfig")),1)],8,Tn)])])])])):w.value==="system"?(l(),r("section",En,[e("div",null,[e("div",Pn,[B(i(tt),{class:"h-4 w-4"}),e("span",null,a(i(s)("settingsDialog.system.title")),1)]),e("p",Mn,a(i(s)("settingsDialog.system.intro")),1)]),e("section",Bn,[e("label",Nn,[e("span",$n,a(i(s)("settingsDialog.system.maxConcurrentRuns")),1),z(e("input",{"onUpdate:modelValue":n[7]||(n[7]=c=>W.runnerMaxConcurrentRuns=c),type:"number",min:"1",max:"16",step:"1",class:"tool-input",disabled:K.runnerMaxConcurrentRuns||le.value||q.value},null,8,Un),[[ke,W.runnerMaxConcurrentRuns,void 0,{number:!0}]]),e("p",Fn,a(i(s)("settingsDialog.system.maxConcurrentRunsHint")),1)]),e("div",In,[e("div",Ln,[K.runnerMaxConcurrentRuns?(l(),r("p",jn,a(i(s)("settingsDialog.system.managedByEnv")),1)):A.value?(l(),r("p",Vn,a(A.value),1)):Q.value?(l(),r("p",On,a(Q.value),1)):(l(),r("p",qn,a(i(s)("settingsDialog.system.diagnosticsHint")),1))]),e("div",An,[e("button",{type:"button",class:"tool-button tool-button-primary inline-flex items-center gap-2 px-3 py-2 text-xs",disabled:K.runnerMaxConcurrentRuns||le.value||q.value,onClick:Ct},[q.value?(l(),N(i(pe),{key:0,class:"h-4 w-4 animate-spin"})):v("",!0),e("span",null,a(q.value?i(s)("common.saving"):i(s)("settingsDialog.system.saveConfig")),1)],8,Hn)])])]),e("section",Kn,[e("div",Wn,[e("div",null,[e("div",zn,a(i(s)("settingsDialog.system.runtimeDiagnostics")),1),e("p",Jn,a(i(s)("settingsDialog.system.runtimeDiagnosticsHint")),1)]),e("div",Gn,[e("button",{type:"button",class:"tool-button inline-flex items-center gap-2 px-3 py-2 text-xs",disabled:H.value,onClick:se},[H.value?(l(),N(i(pe),{key:0,class:"h-4 w-4 animate-spin"})):v("",!0),e("span",null,a(H.value?i(s)("settingsDialog.system.refreshingDiagnostics"):i(s)("settingsDialog.system.refreshDiagnostics")),1)],8,Yn),e("button",{type:"button",class:"tool-button inline-flex items-center gap-2 px-3 py-2 text-xs",onClick:Et},[e("span",null,a(de.value?i(s)("settingsDialog.system.diagnosticsCopied"):i(s)("settingsDialog.system.copyDiagnostics")),1)])])]),e("div",Qn,[X.value?(l(),r("p",Xn,a(X.value),1)):de.value?(l(),r("p",Zn,a(i(s)("settingsDialog.system.diagnosticsCopiedHint")),1)):(l(),r("p",ea,a(i(s)("settingsDialog.system.diagnosticsHint")),1))]),ee.value?(l(),r("div",ta,[e("div",sa,[n[9]||(n[9]=e("div",{class:"theme-muted-text text-xs"},"active",-1)),e("div",na,a(((ae=j.value)==null?void 0:ae.activeRunCount)||0),1),e("p",aa,a(i(s)("settingsDialog.system.active")),1)]),e("div",ia,[n[10]||(n[10]=e("div",{class:"theme-muted-text text-xs"},"tracked",-1)),e("div",oa,a(((Ee=j.value)==null?void 0:Ee.trackedRunCount)||0),1),e("p",la,a(i(s)("settingsDialog.system.tracked")),1)]),e("div",ra,[n[11]||(n[11]=e("div",{class:"theme-muted-text text-xs"},"queued",-1)),e("div",ca,a(((Pe=j.value)==null?void 0:Pe.queuedRunCount)||0),1),e("p",da,a(i(s)("settingsDialog.system.queued")),1)]),e("div",ua,[n[12]||(n[12]=e("div",{class:"theme-muted-text text-xs"},"maxConcurrent",-1)),e("div",ma,a(((Be=(Me=j.value)==null?void 0:Me.config)==null?void 0:Be.maxConcurrentRuns)||W.runnerMaxConcurrentRuns),1),e("p",ga,a(i(s)("settingsDialog.system.maxConcurrent")),1)])])):v("",!0),ee.value?(l(),r("div",ha,[e("div",va,[n[13]||(n[13]=e("div",{class:"theme-muted-text text-xs"},"completed",-1)),e("div",xa,a(((Ne=p.value)==null?void 0:Ne.totalCompleted)||0),1),e("p",pa,a(i(s)("settingsDialog.system.completed")),1)]),e("div",_a,[n[14]||(n[14]=e("div",{class:"theme-muted-text text-xs"},"stopped",-1)),e("div",ya,a((($e=p.value)==null?void 0:$e.totalStopped)||0),1),e("p",fa,a(i(s)("settingsDialog.system.stopped")),1)]),e("div",ba,[n[15]||(n[15]=e("div",{class:"theme-muted-text text-xs"},"error",-1)),e("div",Da,a(((Ue=p.value)==null?void 0:Ue.totalErrored)||0),1),e("p",ka,a(i(s)("settingsDialog.system.error")),1)]),e("div",wa,[n[16]||(n[16]=e("div",{class:"theme-muted-text text-xs"},"stop_timeout",-1)),e("div",Ca,a(((Fe=p.value)==null?void 0:Fe.totalStopTimeout)||0),1),e("p",Ra,a(i(s)("settingsDialog.system.stopTimeout")),1)])])):v("",!0),ee.value?(l(),r("div",Sa,[e("div",Ta,[n[17]||(n[17]=e("div",{class:"theme-muted-text text-xs"},"event flush failures",-1)),e("div",Ea,a(((Ie=p.value)==null?void 0:Ie.eventFlushFailureCount)||0),1),e("p",Pa,a(i(s)("settingsDialog.system.eventWriteFailures")),1)]),e("div",Ma,[n[18]||(n[18]=e("div",{class:"theme-muted-text text-xs"},"recovered runs",-1)),e("div",Ba,a(((je=(Le=we.value)==null?void 0:Le.metrics)==null?void 0:je.totalRecovered)||0),1),e("p",Na,a(i(s)("settingsDialog.system.recoveredRuns")),1)]),e("div",$a,[n[19]||(n[19]=e("div",{class:"theme-muted-text text-xs"},"last cleanup",-1)),e("div",Ua,a(te((Oe=(Ve=Ce.value)==null?void 0:Ve.lastCleanup)==null?void 0:Oe.finishedAt)),1),e("p",Fa,a(i(s)("settingsDialog.system.lastMaintenanceAt")),1)])])):v("",!0),e("div",Ia,[e("div",La,[e("div",ja,a(i(s)("settingsDialog.system.baseStatus")),1),e("div",Va,[e("div",Oa,[n[20]||(n[20]=e("span",{class:"theme-muted-text"},"runner baseUrl",-1)),e("span",qa,a(((Ae=(qe=k.value)==null?void 0:qe.runner)==null?void 0:Ae.baseUrl)||"-"),1)]),e("div",Aa,[n[21]||(n[21]=e("span",{class:"theme-muted-text"},"runner startedAt",-1)),e("span",Ha,a(te((He=j.value)==null?void 0:He.startedAt)),1)]),e("div",Ka,[n[22]||(n[22]=e("span",{class:"theme-muted-text"},"last sweep",-1)),e("span",Wa,a(te((We=(Ke=we.value)==null?void 0:Ke.metrics)==null?void 0:We.lastSweepFinishedAt)),1)]),e("div",za,[n[23]||(n[23]=e("span",{class:"theme-muted-text"},"git diff worker",-1)),e("span",Ja,a(vt.value?i(s)("settingsDialog.system.available"):i(s)("settingsDialog.system.unknown")),1)]),e("div",Ga,[n[24]||(n[24]=e("span",{class:"theme-muted-text"},"db vacuum",-1)),e("span",Ya,a(te((ze=Ce.value)==null?void 0:ze.lastVacuumAt)),1)])])]),e("div",Qa,[e("div",Xa,a(i(s)("settingsDialog.system.stopReasonTitle")),1),e("div",Za,[(l(!0),r(V,null,O(pt.value,c=>(l(),r("div",{key:c.key,class:"flex items-center justify-between gap-3"},[e("span",ei,a(c.label),1),e("span",ti,a(c.value),1)]))),128))])])]),ee.value?(l(),r("div",si,[e("div",ni,a(i(s)("settingsDialog.system.stopTimeoutPhaseTitle")),1),e("div",ai,[(l(!0),r(V,null,O(_t.value,c=>(l(),r("div",{key:c.key,class:"flex items-center justify-between gap-3 rounded-sm border border-dashed border-[var(--theme-borderMuted)] px-2.5 py-2"},[e("span",ii,a(c.label),1),e("span",oi,a(c.value),1)]))),128))])])):v("",!0),!ee.value&&!H.value?(l(),r("div",li,[e("div",ri,a(i(s)("settingsDialog.system.runnerUnavailable")),1),e("p",ci,a(lt((Je=k.value)==null?void 0:Je.runner,"settingsDialog.system.runnerUnavailableDescription")),1),e("p",di," baseUrl: "+a(((Ye=(Ge=k.value)==null?void 0:Ge.runner)==null?void 0:Ye.baseUrl)||"-"),1)])):v("",!0)])])):w.value==="shortcuts"?(l(),r("section",ui,[e("div",null,[e("div",mi,[B(i(xe),{class:"h-4 w-4"}),e("span",null,a(i(s)("settingsDialog.shortcuts.title")),1)]),e("p",gi,a(i(s)("settingsDialog.shortcuts.intro")),1)]),e("section",hi,[(l(!0),r(V,null,O(mt.value,c=>(l(),r("div",{key:c.id,class:"settings-form-card flex flex-col justify-between gap-3 px-3 py-3 sm:flex-row sm:items-center"},[e("div",vi,[e("div",xi,a(c.label),1),e("p",pi,a(c.description),1)]),e("div",_i,[e("span",yi,a(c.mac),1),e("span",fi,a(c.windows),1)])]))),128)),e("p",bi,a(i(s)("settingsDialog.shortcuts.note")),1)])])):(l(),r("section",Di,[e("div",null,[e("div",ki,a(i(s)("settingsDialog.about.title")),1),e("p",wi,a(i(s)("settingsDialog.about.intro")),1)]),e("section",Ci,[e("div",Ri,[e("div",null,[e("div",Si,a(i(s)("settingsDialog.about.versionTitle")),1),e("p",Ti,a(U.value||i(s)("settingsDialog.about.versionDescription")),1)]),e("span",Ei,a(f.value?i(s)("common.loading"):x.value?`v${x.value}`:i(s)("common.unavailable")),1)])])]))])]}),_:1},8,["open"]))}};export{Li as default};
|