cuelo 0.10.270 → 0.10.271

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.
Files changed (89) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +59 -59
  3. package/.next/build-manifest.json +2 -2
  4. package/.next/prerender-manifest.json +3 -3
  5. package/.next/required-server-files.js +1 -1
  6. package/.next/required-server-files.json +1 -1
  7. package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  8. package/.next/server/app/_global-error.html +1 -1
  9. package/.next/server/app/_global-error.rsc +1 -1
  10. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  11. package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  12. package/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  13. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  14. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  15. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  16. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  17. package/.next/server/app/_not-found.html +1 -1
  18. package/.next/server/app/_not-found.rsc +2 -2
  19. package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  20. package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  21. package/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  22. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  23. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  24. package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  25. package/.next/server/app/api/updates/apply/route.js +1 -1
  26. package/.next/server/app/api/updates/route.js +1 -1
  27. package/.next/server/app/index.html +1 -1
  28. package/.next/server/app/index.rsc +4 -4
  29. package/.next/server/app/index.segments/__PAGE__.segment.rsc +3 -3
  30. package/.next/server/app/index.segments/_full.segment.rsc +4 -4
  31. package/.next/server/app/index.segments/_head.segment.rsc +1 -1
  32. package/.next/server/app/index.segments/_index.segment.rsc +2 -2
  33. package/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  34. package/.next/server/app/page.js +2 -2
  35. package/.next/server/app/page_client-reference-manifest.js +1 -1
  36. package/.next/server/app/recover/page_client-reference-manifest.js +1 -1
  37. package/.next/server/app/recover.html +1 -1
  38. package/.next/server/app/recover.rsc +2 -2
  39. package/.next/server/app/recover.segments/_full.segment.rsc +2 -2
  40. package/.next/server/app/recover.segments/_head.segment.rsc +1 -1
  41. package/.next/server/app/recover.segments/_index.segment.rsc +2 -2
  42. package/.next/server/app/recover.segments/_tree.segment.rsc +1 -1
  43. package/.next/server/app/recover.segments/recover/__PAGE__.segment.rsc +1 -1
  44. package/.next/server/app/recover.segments/recover.segment.rsc +1 -1
  45. package/.next/server/app-paths-manifest.json +59 -59
  46. package/.next/server/chunks/5228.js +1 -1
  47. package/.next/server/middleware-build-manifest.js +1 -1
  48. package/.next/server/pages/404.html +1 -1
  49. package/.next/server/pages/500.html +1 -1
  50. package/.next/server/server-reference-manifest.json +1 -1
  51. package/.next/static/chunks/app/{layout-660af3a046f672d8.js → layout-764f757adb47caeb.js} +1 -1
  52. package/.next/static/chunks/app/{page-c574a5897cebf943.js → page-5d203e0ee18b38f2.js} +2 -2
  53. package/.next/trace +113 -113
  54. package/.next/trace-build +1 -1
  55. package/Tools/CUELO_Setup/files/native-runtime-patch.js +1 -1
  56. package/Tools/OMP_Global_Config/agent/AGENTS.md +16 -16
  57. package/Tools/OMP_Global_Config/agent/RULES.md +11 -11
  58. package/Tools/OMP_Global_Config/agent/cuelo-plugins/vm-memory-guard/index.ts +2 -1
  59. package/Tools/OMP_Global_Config/agent/extensions/character-voice.ts +11 -11
  60. package/Tools/OMP_Global_Config/agent/extensions/jev-runtime.ts +2 -1
  61. package/Tools/OMP_Global_Config/agent/extensions/plugin-lab.ts +2 -1
  62. package/Tools/OMP_Global_Config/agent/extensions/test-session.ts +2 -1
  63. package/Tools/OMP_Global_Config/agent/extensions/tool-trial.ts +2 -1
  64. package/Tools/OMP_Global_Config/agent/prompt-copies/AGENTS.en.md +17 -17
  65. package/Tools/OMP_Global_Config/agent/prompt-copies/RULES.en.md +12 -12
  66. package/Tools/OMP_Global_Config/agent/rules/creation-tools.md +1 -1
  67. package/Tools/OMP_Global_Config/agent/rules/cross-review-procedure.md +1 -1
  68. package/Tools/OMP_Global_Config/agent/rules/deploy-ops.md +1 -1
  69. package/Tools/OMP_Global_Config/agent/rules/docs-handoff.md +1 -1
  70. package/Tools/OMP_Global_Config/agent/rules/frontend.md +1 -1
  71. package/Tools/OMP_Global_Config/agent/rules/legacy-encoding.md +1 -1
  72. package/Tools/OMP_Global_Config/agent/rules/meta-harness.md +1 -1
  73. package/Tools/OMP_Global_Config/agent/rules/omp-harness.md +1 -1
  74. package/Tools/OMP_Global_Config/agent/rules/rule-enforcement.md +18 -1
  75. package/Tools/OMP_Global_Config/agent/rules/subagent.md +1 -1
  76. package/Tools/OMP_Global_Config/agent/rules/surface-verification-procedure.md +1 -1
  77. package/Tools/OMP_Global_Config/agent/rules/task-guard.md +1 -1
  78. package/Tools/OMP_Global_Config/agent/rules/verdict.md +1 -1
  79. package/Tools/OMP_Global_Config/agent/rules/web6-consult.md +1 -1
  80. package/Tools/OMP_Global_Config/agent/rules/writing-review-procedure.md +1 -1
  81. package/Tools/OMP_Global_Config/agent/tools/artifact-search/index.ts +2 -1
  82. package/Tools/OMP_Global_Config/agent/tools/deploy-verify/index.ts +2 -1
  83. package/Tools/OMP_Global_Config/agent/tools/vm-build/index.ts +2 -1
  84. package/Tools/OMP_Global_Config/agent/tools/windows-build/index.ts +6 -1
  85. package/Tools/OMP_Global_Config/agent/tools/windows-control/index.ts +6 -1
  86. package/Tools/OMP_Global_Config/patches/apply-core-patch.mjs +15 -0
  87. package/package.json +1 -1
  88. /package/.next/static/{Eoqr1rqErsmRoYuZmVP1j → 4aFpEG7u-rkGYKLAbCnre}/_buildManifest.js +0 -0
  89. /package/.next/static/{Eoqr1rqErsmRoYuZmVP1j → 4aFpEG7u-rkGYKLAbCnre}/_ssgManifest.js +0 -0
@@ -1,4 +1,4 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8974],{2498:e=>{e.exports={view:"MemoryTraceView_view__62Ck_",body:"MemoryTraceView_body__gELit",message:"MemoryTraceView_message__pDO_k",errorText:"MemoryTraceView_errorText__GkoKJ",sectionTitle:"MemoryTraceView_sectionTitle__lmuuo",sectionCount:"MemoryTraceView_sectionCount__9yRSn",requests:"MemoryTraceView_requests__scPBk",requestScroller:"MemoryTraceView_requestScroller__4ALfU",requestList:"MemoryTraceView_requestList__rQ4G0",requestRow:"MemoryTraceView_requestRow__LZd3A",requestIndex:"MemoryTraceView_requestIndex__TacwG",requestTime:"MemoryTraceView_requestTime__fJjQF",noticeChip:"MemoryTraceView_noticeChip__gz9AO",requestPreview:"MemoryTraceView_requestPreview__HwG7v",miniRail:"MemoryTraceView_miniRail__84C2v",flow:"MemoryTraceView_flow__UCgmI",titleText:"MemoryTraceView_titleText__38Tl7",flowPreview:"MemoryTraceView_flowPreview__HjgKe",rail:"MemoryTraceView_rail__HlWbE",station:"MemoryTraceView_station__ulNBH",stationButton:"MemoryTraceView_stationButton__BztyW",stationStep:"MemoryTraceView_stationStep__CgFYZ",stationCount:"MemoryTraceView_stationCount__2_rrN",stationLabel:"MemoryTraceView_stationLabel__QGYpC",stationNote:"MemoryTraceView_stationNote__Jc30I",detail:"MemoryTraceView_detail__Rnn_d",stageEmpty:"MemoryTraceView_stageEmpty__x0H_J",group:"MemoryTraceView_group__1SCqK",bucket:"MemoryTraceView_bucket__Vmuau",groupTitle:"MemoryTraceView_groupTitle__6Q1oM",groupCode:"MemoryTraceView_groupCode__qgzOG",query:"MemoryTraceView_query__DK87N",items:"MemoryTraceView_items__D8Wz8",item:"MemoryTraceView_item__wyulb",idList:"MemoryTraceView_idList__mQArH",path:"MemoryTraceView_path__97O3u",itemHead:"MemoryTraceView_itemHead__B0bQo",memoryId:"MemoryTraceView_memoryId__5KjoX",itemMeta:"MemoryTraceView_itemMeta__wbj6K",itemText:"MemoryTraceView_itemText__O92R_",graph:"MemoryTraceView_graph__RHbn9",graphHead:"MemoryTraceView_graphHead__sEDhc",scopeSwitch:"MemoryTraceView_scopeSwitch__3HBI2",legend:"MemoryTraceView_legend__52_dq",legendMark:"MemoryTraceView_legendMark__hS7sK",legendTitle:"MemoryTraceView_legendTitle__z_lgW",legendMemory:"MemoryTraceView_legendMemory__mkYqP",graphCaption:"MemoryTraceView_graphCaption__ot7gW",captionKind:"MemoryTraceView_captionKind__e1fLD",graphFrame:"MemoryTraceView_graphFrame__SgiqG",graphSvg:"MemoryTraceView_graphSvg___JeWV",columnHeads:"MemoryTraceView_columnHeads__drsYb",edges:"MemoryTraceView_edges__4zMSL",node:"MemoryTraceView_node__ymwrL",hit:"MemoryTraceView_hit__HS6HS",mark:"MemoryTraceView_mark__WxCZl",arrow:"MemoryTraceView_arrow__oz9U4",nodeText:"MemoryTraceView_nodeText__Tp4ud",ring:"MemoryTraceView_ring___LM5n"}},2730:(e,t,n)=>{"use strict";function r(e,t,n,i={}){let s=n[e]?.[t]??n.en?.[t];return void 0===s?t:function(e,t={}){return e.replace(/\{([\w.-]+)\}/g,(e,n)=>{let r=t[n];return void 0===r?e:String(r)})}(s,i)}n.d(t,{u0:()=>r})},13004:e=>{e.exports={backdrop:"SettingsConfig_backdrop__i6KYG",window:"SettingsConfig_window__m7dcs",sidebar:"SettingsConfig_sidebar__vEMEr",brand:"SettingsConfig_brand__DlYlu",eyebrow:"SettingsConfig_eyebrow__uTa5R",title:"SettingsConfig_title__DWTnA",context:"SettingsConfig_context__N0fl0",searchWrap:"SettingsConfig_searchWrap___PWrc",searchIcon:"SettingsConfig_searchIcon__8_YYE",search:"SettingsConfig_search__DUhSs",nav:"SettingsConfig_nav__V8P9S",navLabel:"SettingsConfig_navLabel__M1wMP",navButton:"SettingsConfig_navButton__CUOqu",navIcon:"SettingsConfig_navIcon__Wagpr",closeRail:"SettingsConfig_closeRail__PW3pT",closeButton:"SettingsConfig_closeButton__5y_6F",content:"SettingsConfig_content__n_a5Z",scrollContent:"SettingsConfig_scrollContent__03BsO",contentHeader:"SettingsConfig_contentHeader__tNmzv",contentTitle:"SettingsConfig_contentTitle__oiHOO",contentDescription:"SettingsConfig_contentDescription___l2QU",reloadNotice:"SettingsConfig_reloadNotice__enzeE",settingsBody:"SettingsConfig_settingsBody__QRFVu",group:"SettingsConfig_group__JQ_dy",groupTitle:"SettingsConfig_groupTitle__0SrM9",settingRow:"SettingsConfig_settingRow__Jy73r",settingLabel:"SettingsConfig_settingLabel__n8vtU",settingDescription:"SettingsConfig_settingDescription__TGWfP",settingControl:"SettingsConfig_settingControl__oz5Gn",select:"SettingsConfig_select__A5aGy",textInput:"SettingsConfig_textInput___NjZ2",jsonEditor:"SettingsConfig_jsonEditor__yTYDb",numberInput:"SettingsConfig_numberInput__TVVeJ",switch:"SettingsConfig_switch__5UYqz",multiSelect:"SettingsConfig_multiSelect__PTjyr",choice:"SettingsConfig_choice__Os8WR",choiceToggle:"SettingsConfig_choiceToggle__lyl75",reorder:"SettingsConfig_reorder__JR6tX",error:"SettingsConfig_error__j6wEj",saveState:"SettingsConfig_saveState__1tIL4",themeGrid:"SettingsConfig_themeGrid__7Lw8A",themeCard:"SettingsConfig_themeCard__DQFsT",themePreview:"SettingsConfig_themePreview__QzqXK",themePreviewBar:"SettingsConfig_themePreviewBar__ZbchX",themePreviewPanel:"SettingsConfig_themePreviewPanel__YN9ty",themePreviewLine:"SettingsConfig_themePreviewLine__jP0qg",themeCardBody:"SettingsConfig_themeCardBody__xiOe6",themeCardHeader:"SettingsConfig_themeCardHeader__YPRN2",themeSlot:"SettingsConfig_themeSlot__vGn9a",themeActive:"SettingsConfig_themeActive__PNmdk",mcpLayout:"SettingsConfig_mcpLayout__ek_Fi",mcpList:"SettingsConfig_mcpList__gZ9_o",scopeTabs:"SettingsConfig_scopeTabs__9bybS",scopeButton:"SettingsConfig_scopeButton__d4XPe",serverRows:"SettingsConfig_serverRows__JSJy0",serverRow:"SettingsConfig_serverRow__6gJdE",serverSelect:"SettingsConfig_serverSelect__cuYFx",serverToggle:"SettingsConfig_serverToggle__X5N_o",serverName:"SettingsConfig_serverName__lbfcK",sourceBadge:"SettingsConfig_sourceBadge__XDE2u",serverListEmpty:"SettingsConfig_serverListEmpty___icit",statusDot:"SettingsConfig_statusDot__dVcD4",addServer:"SettingsConfig_addServer__g0ivB",mcpEditor:"SettingsConfig_mcpEditor__XGcLp",editorHeader:"SettingsConfig_editorHeader__qDvAk",readOnlyNotice:"SettingsConfig_readOnlyNotice__KNzML",editorActions:"SettingsConfig_editorActions__h9p7Y",linkButton:"SettingsConfig_linkButton__0DH3I",primaryButton:"SettingsConfig_primaryButton__Eocwv",dangerButton:"SettingsConfig_dangerButton__XF_f_",empty:"SettingsConfig_empty__erg3A",seg:"SettingsConfig_seg__XuRNt",panel:"SettingsConfig_panel__ZI0zy",btn:"SettingsConfig_btn__n6fBy",btnPrimary:"SettingsConfig_btnPrimary__iimPs",btnDanger:"SettingsConfig_btnDanger__1fFIU",btnQuiet:"SettingsConfig_btnQuiet__fNd0U",btnOk:"SettingsConfig_btnOk__EO_j1",field:"SettingsConfig_field__PVLX2",badge:"SettingsConfig_badge__8u4iQ",badgeWarn:"SettingsConfig_badgeWarn___hejU",badgeDanger:"SettingsConfig_badgeDanger__Ya7g_",badgeInfo:"SettingsConfig_badgeInfo__P8FR7",textDanger:"SettingsConfig_textDanger__5_0Vx",textOk:"SettingsConfig_textOk__XPaRs",textWarn:"SettingsConfig_textWarn__MxfZX",lamp:"SettingsConfig_lamp__spLQJ",lampOn:"SettingsConfig_lampOn__I5AtE",lampWarn:"SettingsConfig_lampWarn__gG1l4",lampDanger:"SettingsConfig_lampDanger__7BeCc",scrim:"SettingsConfig_scrim__i645I",sheet:"SettingsConfig_sheet__YV6De",listRowSel:"SettingsConfig_listRowSel__7RSLQ",bare:"SettingsConfig_bare__XoKXl",fieldBare:"SettingsConfig_fieldBare__jiy_X",navRow:"SettingsConfig_navRow__dSjxf"}},14755:(e,t,n)=>{"use strict";n.d(t,{C1:()=>s,IN:()=>i,getPresetFromTools:()=>l,xG:()=>o});let r=[],i=["read","bash","edit","write"],s=["read","bash","edit","write","grep","glob"],a=Object.fromEntries(s.map(e=>[e,!0]));function l(e){let t=e.filter(e=>e.active);if(0===t.length)return"none";let n=t.map(e=>e.name).filter(e=>!0===a[e]).sort().join(",");return n===[...i].sort().join(",")?"default":n===[...s].sort().join(",")?"full":"default"}function o(e){return"none"===e?[...r]:"full"===e?[...s]:[...i]}},21040:e=>{e.exports={view:"RoutineView_view__4busO",topbar:"RoutineView_topbar__YPacL",back:"RoutineView_back__ac5Vn",body:"RoutineView_body__01N2Q",crumb:"RoutineView_crumb__K1_0X",link:"RoutineView_link__whmc9",head:"RoutineView_head__WBrda",headActions:"RoutineView_headActions__KqC_W",sub:"RoutineView_sub__mh018",facts:"RoutineView_facts__Yyns3",strong:"RoutineView_strong__x6Fhg",subNote:"RoutineView_subNote__tAUYO",mono:"RoutineView_mono__ms2qU",button:"RoutineView_button__sbfYZ",badge:"RoutineView_badge__uMNRL",tabs:"RoutineView_tabs__iPnSQ",table:"RoutineView_table__3ihqX",title:"RoutineView_title__WPF5j",no:"RoutineView_no__Ck2vM",emptyCell:"RoutineView_emptyCell__o5V_C",empty:"RoutineView_empty__FoRja",foot:"RoutineView_foot__EmDj9",sync:"RoutineView_sync__Fek1M",notice:"RoutineView_notice__VvzFH",postHead:"RoutineView_postHead__ooMEu",postMeta:"RoutineView_postMeta___lo7j",postBody:"RoutineView_postBody__nwcmb",clamp:"RoutineView_clamp__Yuyn8",expand:"RoutineView_expand__Vz52y",details:"RoutineView_details__2K_Io",latest:"RoutineView_latest__kPOEy",latestMeta:"RoutineView_latestMeta__w3r03",latestTitle:"RoutineView_latestTitle__5uEQK",row:"RoutineView_row__YLKM0",rowLabel:"RoutineView_rowLabel__wAaNU",field:"RoutineView_field__B4jvA",narrow:"RoutineView_narrow__EazoW",hint:"RoutineView_hint__R9fMv",days:"RoutineView_days__lm_q_",check:"RoutineView_check__gT_Aa",formActions:"RoutineView_formActions__A9Djj",danger:"RoutineView_danger__Xi84r",error:"RoutineView_error__JNoxw",panel:"RoutineView_panel__jkMFt",panelList:"RoutineView_panelList__JrArr",panelBadges:"RoutineView_panelBadges__H18oU",count:"RoutineView_count__GICfE",wide:"RoutineView_wide__bJkXf",rowSchedule:"RoutineView_rowSchedule__Co8RM",visuallyHidden:"RoutineView_visuallyHidden__M_RPw",inline:"RoutineView_inline__ZaYAe",chips:"RoutineView_chips__hnVXc",chipRemove:"RoutineView_chipRemove__wNru7",host:"RoutineView_host__SV_7k",quickTask:"RoutineView_quickTask__lGWoT",taskInput:"RoutineView_taskInput__UR_81",draftFields:"RoutineView_draftFields__HI4Hd",draft:"RoutineView_draft__Ln1kY",composerActions:"RoutineView_composerActions__XMQnU",draftMeta:"RoutineView_draftMeta__DTAws",notificationRow:"RoutineView_notificationRow__MTYbi",replyMeta:"RoutineView_replyMeta__OP9hc",thread:"RoutineView_thread__BnuAt",pushSwitch:"RoutineView_pushSwitch__Qt8cO",notifications:"RoutineView_notifications__ceLqO",newControl:"RoutineView_newControl__1XRVc",formFields:"RoutineView_formFields__oGedO",replies:"RoutineView_replies__nBhKm",replyCount:"RoutineView_replyCount__H0Kvu",pending:"RoutineView_pending__nyyRW",switchTrack:"RoutineView_switchTrack__EhSX5"}},21340:()=>{},21443:e=>{e.exports={dialog:"CloudProjectPicker_dialog__Dx2Dt",form:"CloudProjectPicker_form__MpEsn",header:"CloudProjectPicker_header__UcYbB",sources:"CloudProjectPicker_sources__6cl_0",activeSource:"CloudProjectPicker_activeSource__NptfQ",body:"CloudProjectPicker_body__vKMBC",account:"CloudProjectPicker_account__gb9Qo",repositories:"CloudProjectPicker_repositories__WSBt6",secondary:"CloudProjectPicker_secondary__hlaFU",primary:"CloudProjectPicker_primary__voWx5",loginLink:"CloudProjectPicker_loginLink__Gu5XC",login:"CloudProjectPicker_login__c0qSl",codeRow:"CloudProjectPicker_codeRow__jo8vy",repositoryInput:"CloudProjectPicker_repositoryInput__HWhvu",list:"CloudProjectPicker_list__0BSYU",repo:"CloudProjectPicker_repo__L4VaW",repoHeading:"CloudProjectPicker_repoHeading__3Pnq1",repoDescription:"CloudProjectPicker_repoDescription__YzPtB",error:"CloudProjectPicker_error__dAVsm",progress:"CloudProjectPicker_progress__OwvG9",footer:"CloudProjectPicker_footer__mmrGI"}},29213:e=>{e.exports={view:"PluginLabPanel_view__Sot51",toolbar:"PluginLabPanel_toolbar__co_Uq",hint:"PluginLabPanel_hint__kb7Hq",body:"PluginLabPanel_body__T_QMu",message:"PluginLabPanel_message__QbEDh",errorText:"PluginLabPanel_errorText__EI47_",list:"PluginLabPanel_list__BnAn6",card:"PluginLabPanel_card__5479R",cardHead:"PluginLabPanel_cardHead__SCiZ3",titleBlock:"PluginLabPanel_titleBlock__zfcvo",titleLine:"PluginLabPanel_titleLine__OmG7U",name:"PluginLabPanel_name__t4Ea0",id:"PluginLabPanel_id__osclH",control:"PluginLabPanel_control___gzgN",switch:"PluginLabPanel_switch__m3agg",switchLabel:"PluginLabPanel_switchLabel__DGX6y",description:"PluginLabPanel_description__PfruO",enhancement:"PluginLabPanel_enhancement__TOHjM",enhancementHead:"PluginLabPanel_enhancementHead__sgewN",enhancementDate:"PluginLabPanel_enhancementDate__4YWB1",enhancementSummary:"PluginLabPanel_enhancementSummary__srTnj",tools:"PluginLabPanel_tools__raR8s",metaLabel:"PluginLabPanel_metaLabel__LY5ak",toolList:"PluginLabPanel_toolList___rd6_",tool:"PluginLabPanel_tool___AjRR",problem:"PluginLabPanel_problem__Sx4aQ",problemLabel:"PluginLabPanel_problemLabel__rBSUT",cardActions:"PluginLabPanel_cardActions__GI_Bb",stage:"PluginLabPanel_stage__1l0FR",frame:"PluginLabPanel_frame__sP_V0",status:"PluginLabPanel_status__BYiAs",lines:"PluginLabPanel_lines__ONctT",notice:"PluginLabPanel_notice__mn_vu"}},34817:e=>{e.exports={notice:"RepoSyncIndicator_notice__6q27O",body:"RepoSyncIndicator_body___uZUj",repo:"RepoSyncIndicator_repo__U0mga",actions:"RepoSyncIndicator_actions__OgFJN"}},40960:e=>{e.exports={active:"ComputerTakeoverControl_active__7430b"}},66592:e=>{e.exports={root:"TypedInterpreter_root__q_c0E",results:"TypedInterpreter_results__6j7HQ",turn:"TypedInterpreter_turn__BELhE",label:"TypedInterpreter_label__tFGb1",original:"TypedInterpreter_original__IxOOM",translation:"TypedInterpreter_translation__bR55x",composer:"TypedInterpreter_composer__IgxpT",direction:"TypedInterpreter_direction__8Chyz",field:"TypedInterpreter_field__6QmFe",submit:"TypedInterpreter_submit__tRKd5",error:"TypedInterpreter_error__h7BTN",modes:"TypedInterpreter_modes__Krr0C",toolbar:"TypedInterpreter_toolbar__L_2u0"}},80455:(e,t,n)=>{Promise.resolve().then(n.bind(n,89976)),Promise.resolve().then(n.bind(n,84183))},84183:(e,t,n)=>{"use strict";n.d(t,{I18nProvider:()=>p,s:()=>m});var r=n(95155),i=n(12115);let s=JSON.parse('{"resource.reset.use":"리셋 사용","resource.reset.unavailable":"지금은 사용 불가","resource.reset.summary":"사용할 리셋: {name}","resource.reset.covers":"초기화할 한도: {limits}","resource.reset.includedOverage":"포함된 초과 사용량","resource.reset.mismatch":"요청한 리셋: {requested}. 서버에서 사용한 리셋: {consumed}. 자동으로 다시 시도하지 않았습니다.","resource.reset.rejection":"리셋 사용 실패: {code}. {reason}","resource.reset.name.full":"전체 리셋","resource.reset.name.fable":"페이블 리셋","resource.reset.name.fiveHour":"5시간 리셋","resource.reset.name.generic":"리셋","resource.reset.window.fiveHour":"5시간","resource.reset.window.weekly":"주간","resource.reset.chip.nextUse":"다음 사용","savedPrompts.title":"저장된 프롬프트","savedPrompts.loading":"불러오는 중...","savedPrompts.empty":"저장된 프롬프트 없음","savedPrompts.save":"현재 입력을 프롬프트로 저장","savedPrompts.saved":"저장됨","savedPrompts.delete":"삭제","savedPrompts.confirmDelete":"삭제할까요?","savedPrompts.cancel":"취소","savedPrompts.hint":"텍스트 입력 후 //를 입력하여 저장하세요. 변수: {{project_name}} {{session_name}} {{cwd}} {{date}}","savedPrompts.error":"저장된 프롬프트 요청 실패: {error}","memoryTrace.refresh":"새로고침","memoryTrace.noSession":"세션을 고르면 기억을 찾은 과정이 보여요.","memoryTrace.loading":"세션 기록을 읽는 중…","memoryTrace.error":"기억 추적을 불러오지 못했어요. {error}","memoryTrace.retry":"다시 불러오기","memoryTrace.empty":"이 세션에는 기억\xb7지도 기록이 없어요","memoryTrace.requests":"기록 있는 요청 {count}개","memoryTrace.requestsLabel":"요청","memoryTrace.requestHeading":"요청 #{index}","memoryTrace.noPreview":"(글 없음)","memoryTrace.flowLabel":"요청 흐름","memoryTrace.stageRecall":"기억 불러옴","memoryTrace.stageJev":"JEV 대조","memoryTrace.stageDocmap":"지도 후보","memoryTrace.stageDocs":"연 문서","memoryTrace.stageLessons":"편집 전 교훈","memoryTrace.stageSaved":"새로 저장","memoryTrace.stageEmpty":"이 요청에서는 이 단계가 없었어요.","memoryTrace.openedSummary":"{opened}개 열어 봄 \xb7 {skipped}개 후보만","memoryTrace.opened":"열어 봄","memoryTrace.candidateOnly":"후보만","memoryTrace.fromMap":"지도 후보","memoryTrace.lines":"읽은 줄 {lines}","memoryTrace.autoRecall":"요청 전에 자동으로 불러옴","memoryTrace.explicitRecall":"작업 중 직접 찾음","memoryTrace.query":"질의","memoryTrace.noResults":"돌아온 기억이 없어요.","memoryTrace.noMemoryText":"이 기록에는 기억 글이 남아 있지 않아요.","memoryTrace.jevUnknown":"판정 불명 {count}개","memoryTrace.jevUnrelated":"무관 {count}개","memoryTrace.lessonFor":"편집 전에 띄운 기억","memoryTrace.savedAuto":"자동 저장","memoryTrace.graphLabel":"연결 그래프","memoryTrace.graphScope":"그래프 범위","memoryTrace.scopeRequest":"이 요청","memoryTrace.scopeSession":"세션 전체","memoryTrace.legendRequest":"요청","memoryTrace.legendMemory":"기억","memoryTrace.legendDoc":"지도 문서","memoryTrace.legendFile":"편집 파일","memoryTrace.graphEmpty":"이 범위에는 이어진 항목이 없어요.","memoryTrace.nodeLabel":"{kind}: {label}, 연결 {count}개","memoryTrace.edgeRecalled":"불러옴","memoryTrace.edgeLesson":"편집 전 교훈","memoryTrace.verdictLegend":"JEV 판정","memoryTrace.verdictApply":"적용 조건 일치","memoryTrace.verdictExcepted":"조건 불충족\xb7예외","memoryTrace.verdictConflict":"요청과 충돌","memoryTrace.verdictUnconfirmed":"조건 미확인","memoryTrace.verdictUnlisted":"무관\xb7판정 불명","memoryTrace.graphHint":"노드를 가리키거나 포커스하면 전체 글이 여기 나와요.","memoryTrace.legendDocEdited":"열고 편집한 파일","memoryTrace.noticeHarness":"하네스","memoryTrace.noticeResume":"자동 재개","cloudProjects.launch":"GitHub 저장소 열기","cloudProjects.title":"클라우드 프로젝트","cloudProjects.description":"GitHub 저장소를 가져와 이 서버에서 작업을 이어가세요.","cloudProjects.github":"GitHub 저장소","cloudProjects.serverFolder":"서버 폴더 열기","cloudProjects.account":"GitHub 연결","cloudProjects.connectTitle":"내 GitHub 저장소 연결","cloudProjects.connectHelp":"연결하면 비공개 저장소도 목록에서 선택할 수 있습니다.","cloudProjects.connected":"GitHub 연결됨","cloudProjects.refresh":"다시 확인","cloudProjects.waiting":"로그인 대기 중","cloudProjects.connect":"GitHub 연결","cloudProjects.deviceHelp":"아래 코드를 GitHub 로그인 화면에 입력하세요.","cloudProjects.copyCode":"코드 복사","cloudProjects.copied":"복사됨","cloudProjects.copyFailure":"코드를 복사하지 못했습니다. 코드를 선택해 직접 복사하세요.","cloudProjects.openLogin":"GitHub에서 로그인","cloudProjects.permissionHelp":"GitHub에서 계정과 요청 권한을 확인하고 승인하세요. 인증 토큰은 서버에만 저장됩니다.","cloudProjects.preparingCode":"로그인 코드를 준비하고 있습니다.","cloudProjects.repositories":"내 저장소","cloudProjects.search":"저장소 검색","cloudProjects.searchPlaceholder":"이름 또는 설명으로 찾기","cloudProjects.loading":"저장소를 불러오고 있습니다.","cloudProjects.private":"비공개","cloudProjects.public":"공개","cloudProjects.empty":"일치하는 저장소가 없습니다. 다른 이름으로 검색하거나 URL을 입력하세요.","cloudProjects.more":"더 보기","cloudProjects.urlLabel":"선택한 저장소 또는 GitHub URL","cloudProjects.publicHelp":"공개 저장소는 로그인 없이도 가져올 수 있습니다. 이미 가져온 저장소는 변경 없이 다시 엽니다.","cloudProjects.error":"작업을 완료하지 못했습니다.","cloudProjects.openingHelp":"저장소를 서버에 가져오고 있습니다. 크기에 따라 시간이 걸릴 수 있습니다.","cloudProjects.opening":"프로젝트 여는 중","cloudProjects.open":"프로젝트 열기","common.ok":"확인","common.language":"언어","common.models":"모델","common.skills":"스킬","common.plugins":"플러그인","common.settings":"설정","updates.available":"CUELO 업데이트 있음","updates.availableTitle":"CUELO {version} 릴리스가 나왔습니다","updates.dialogEyebrow":"CUELO 릴리스","updates.dialogTitle":"새 CUELO 버전","updates.current":"현재 CUELO {version}","updates.changelog":"변경 사항","updates.viewRelease":"릴리스 보기","updates.manual":"소스에서 실행 중이면 서버를 먼저 멈추고 아래 명령으로 갱신한 뒤 다시 시작하세요. 별도 --home 경로를 사용한다면 setup에도 같은 --home 옵션을 붙이세요.","updates.copyCommand":"명령어 복사","updates.commandCopied":"명령어 복사됨","updates.copyFailed":"명령어를 복사할 수 없습니다","updates.apply":"지금 업데이트","updates.applyBusy":"업데이트 중…","updates.applyConfirm":"CUELO {version}(으)로 업데이트하고 다시 시작할까요?\\n\\n업데이트하는 동안 서버가 잠시 멈추고 이 화면은 진행 상황을 보여 줍니다. 새 버전이 응답하면 자동으로 새로 고칩니다.","updates.applyConfirmBusy":"CUELO {version}(으)로 업데이트하고 다시 시작할까요?\\n\\n실행 중인 세션 {count}개가 중단되고 서버가 잠시 멈춥니다. 이 화면은 진행 상황을 보여 주며, 새 버전이 응답하면 자동으로 새로 고칩니다.","updates.unsupported":"이 설치 방식은 앱에서 바로 바꿀 수 없습니다. 아래 명령을 사용하세요.","updates.unsupportedReason":"감지 결과: {reason}","updates.phase.starting":"업데이트 준비 중","updates.phase.fetching":"새 버전 받는 중","updates.phase.installing":"패키지 설치 중","updates.phase.building":"빌드 중","updates.phase.restarting":"서버 다시 시작 중","updates.phase.done":"업데이트 완료","updates.phase.handed-off":"서비스 갱신으로 넘김","updates.phase.restart-required":"설치 완료 — CUELO를 직접 다시 시작하세요","updates.phase.failed":"업데이트 실패","updates.waitingForRestart":"서버가 다시 시작되기를 기다리고 있습니다. 새 버전이 응답하면 화면을 새로 고칩니다.","updates.handedOff":"WSL 서비스 갱신이 자체 대기 화면에서 진행됩니다. 끝나면 이 화면이 새로 고쳐집니다.","updates.logPath":"로그: {path}","updates.applyStartFailed":"업데이트를 시작하지 못했습니다: {reason}","sidebar.hide":"사이드바 숨기기","sidebar.show":"사이드바 표시","theme.light":"라이트 모드 (클릭하면 다크)","theme.dark":"다크 모드 (클릭하면 시스템)","theme.auto":"시스템 테마 (클릭하면 라이트)","theme.graphite":"흑연 테마 (배경화면)","theme.graphiteHint":"흑연색 화면에 지금 캐릭터 모드의 배경화면을 깝니다. 다크 모드에서만 적용되고 이 브라우저에만 저장됩니다.","history.full":"전체 기록","history.unsaved":"전체 기록은 세션 저장 후 사용할 수 있습니다","history.label":"전체 기록","title.generating":"생성 중...","title.updated":"제목 업데이트됨","title.failed":"생성 실패","title.generate":"제목 생성","title.unsaved":"제목 생성은 세션 저장 후 사용할 수 있습니다","title.noMessages":"세션 이름을 지정하기 전에 메시지를 보내세요","title.generateSession":"세션 제목 생성","system.prompt":"시스템 프롬프트","system.empty":"시스템 프롬프트가 비어 있습니다 (도구 비활성화됨)","system.load":"시스템 프롬프트를 불러오려면 메시지를 보내세요","system.label":"시스템","session.info":"세션 정보","session.name":"이름","session.file":"파일","session.inMemory":"메모리 내","session.id":"ID","session.user":"사용자","session.assistant":"어시스턴트","session.toolCalls":"도구 호출","session.toolResults":"도구 결과","session.total":"합계","session.input":"입력","session.output":"출력","session.cacheRead":"캐시 읽기","session.cacheWrite":"캐시 쓰기","session.cost":"비용","session.context":"컨텍스트","session.copy":"{value} 복사","session.copied":"복사됨","session.title":"세션 정보","session.load":"세션 정보를 불러오려면 메시지를 보내거나 /session을 실행하세요","session.infoSection":"세션 정보","session.messages":"메시지","session.tokens":"Token","session.copyFile":"파일 경로 복사","session.copyId":"세션 ID 복사","session.cacheHitRate":"평균 캐시 적중률","session.totalActive":"활동 시간","workspace.opening":"워크스페이스를 여는 중...","workspace.unable":"워크스페이스를 열 수 없습니다","workspace.selectSession":"사이드바에서 세션을 선택하세요","workspace.getStarted":"시작하기","workspace.selectProject":"사이드바에서 프로젝트 디렉터리를 선택하세요","workspace.addModels":"하단의 모델 버튼으로 모델을 추가하세요","workspace.stepProject":"사이드바에서 프로젝트 디렉터리를 선택하세요","workspace.stepModels":"하단의 모델 버튼으로 모델을 추가하세요","workspace.mainWorking":"작업중","workspace.mainWaiting":"대기중","workspace.mainIdle":"대기","workspace.mainAttention":"입력필요","files.hidePanel":"파일 패널 숨기기","files.showPanel":"파일 패널 표시","files.noneOpen":"열린 파일 없음","files.docs.noProject":"프로젝트를 선택하면 문서 바로가기가 보입니다.","files.docs.loading":"프로젝트 문서를 찾는 중…","files.docs.projectDenied":"이 프로젝트 폴더는 CUELO가 읽을 수 있는 폴더 밖에 있습니다.","files.docs.loadFailed":"프로젝트 문서를 불러오지 못했습니다: {error}","files.docs.projectDir":"프로젝트 폴더: {path}","files.docs.noneFound":"저장소 루트까지 HANDOFF.md가 없고, 이 폴더에 doc/README.md나 doc/history도 없습니다.","files.docs.current":"현재 상태","files.docs.map":"문서 지도","files.docs.records":"최근 기록","files.docs.missing":"{file} 없음","files.docs.denied":"{file}은(는) 읽기 허용 폴더 밖에 있습니다","layout.resizeSidebar":"사이드바 크기 조절","layout.resizeFilePanel":"파일 패널 크기 조절","layout.resizeHint":"드래그하여 크기를 조절합니다. 더블 클릭 또는 Enter 키로 초기화합니다.","sidebar.new":"새로 만들기","sidebar.newSessionTitle":"{path}에서 새 세션","sidebar.refresh":"새로고침","sidebar.projects":"프로젝트","subagents.title":"서브 Agent","subagents.running":"실행 중","subagents.finished":"완료됨","subagents.history":"기록","subagents.runningCount":"{count}개 실행 중","subagents.finishedCount":"{count}개 완료됨","subagents.failed":"실패","subagents.aborted":"중단됨","subagents.back":"서브 Agent 목록으로 돌아가기","subagents.retrying":"재시도 중 {attempt}/{max}","subagents.usingTool":"{tool} 사용 중","subagents.details":"서브 Agent 실행 상세","subagents.closeDetails":"서브 Agent 상세 닫기","subagents.noTask":"작업 설명 없음","subagents.tools":"도구 {count}개","subagents.tokens":"{count} Token","subagents.loadingTranscript":"실시간 기록을 불러오는 중…","subagents.noTranscript":"서브 Agent가 아직 기록 메시지를 작성하지 않았습니다.","subagents.transcriptUnavailable":"실시간 기록을 아직 사용할 수 없습니다. 서브 Agent가 실행되는 동안 재시도합니다.","sidebar.searchProjectsAndSessions":"프로젝트 및 세션 제목 검색…","sidebar.addProject":"사용자 지정 프로젝트 경로 추가","sidebar.projectActions":"프로젝트 작업","sidebar.projectAlias":"별칭","sidebar.projectAliasEdit":"별칭 편집","sidebar.projectHide":"숨기기","sidebar.projectUnhide":"숨김 해제","sidebar.projectShowHidden":"숨긴 프로젝트 표시","sidebar.temporaryProjects":"임시\xb7시스템 경로","sidebar.projectMoveUp":"위로 이동","sidebar.projectMoveDown":"아래로 이동","sidebar.projectMoveDisabledWhileFiltering":"프로젝트 순서를 변경하려면 검색 필터를 지우세요","sidebar.projectUpdateFailed":"프로젝트 변경 사항을 저장할 수 없습니다. 다시 시도하세요.","sidebar.expandProject":"프로젝트 펼치기","sidebar.collapseProject":"프로젝트 접기","sidebar.showMore":"더 보기","sidebar.showLess":"간략히 보기","sidebar.selectProject":"프로젝트 선택…","sidebar.filterProjects":"프로젝트 필터…","sidebar.noMatchingProjects":"일치하는 프로젝트 없음","sidebar.useDefaultDirectory":"기본 디렉터리 사용","sidebar.customPath":"사용자 지정 경로…","directoryPicker.selectDirectory":"디렉터리 선택","directoryPicker.goToParent":"상위 디렉터리로 이동","directoryPicker.directoryPath":"디렉터리 경로","directoryPicker.goToDirectory":"디렉터리로 이동","directoryPicker.go":"이동","directoryPicker.loadingDirectories":"디렉터리를 불러오는 중…","directoryPicker.noSubdirectories":"하위 디렉터리 없음","directoryPicker.openBeforeSelecting":"선택하기 전에 이 경로를 엽니다","directoryPicker.selectCurrentDirectory":"현재 디렉터리 선택","directoryPicker.selectThisFolder":"이 폴더 선택","directoryPicker.noDrives":"드라이브를 찾을 수 없음","sidebar.checking":"확인 중…","sidebar.open":"열기","sidebar.cancel":"취소","sidebar.openRepoRoot":"저장소 루트 열기","sidebar.openRepoRootTitle":"worktree를 관리하려면 저장소 루트를 여세요.","sidebar.gitRepoRootOnly":"Git 저장소 루트 전용","sidebar.gitRepoRootOnlyTitle":"worktree는 Git 저장소 루트에서만 사용할 수 있습니다.","sidebar.worktrees":"Worktree...","sidebar.checkingWorktrees":"이 디렉터리의 worktree를 확인합니다.","sidebar.filterWorktrees":"worktree 필터…","sidebar.noMatchingWorktrees":"일치하는 worktree 없음","sidebar.switchWorktree":"worktree 전환","sidebar.switchWorktreeTitle":"worktree 전환: {path}","sidebar.main":"main","sidebar.forceRemoveCheckout":"커밋되지 않은 변경 사항이 있습니다. 체크아웃을 강제로 제거할까요?","sidebar.force":"강제","sidebar.createWorktreeTitle":"Branch에 대한 worktree 체크아웃을 생성합니다","sidebar.newWorktree":"새 worktree…","sidebar.branchName":"Branch 이름","sidebar.creating":"생성 중…","sidebar.create":"생성","sidebar.loading":"불러오는 중...","sidebar.noSessions":"세션 없음","sidebar.agentRunning":"Agent 실행 중…","sidebar.newActivity":"새 활동","sidebar.newSessionActivity":"새 세션 활동","sidebar.deleteSession":"{title}을(를) 삭제할까요?","sidebar.rename":"이름 변경","sidebar.pin":"맨 위에 고정","sidebar.unpin":"고정 해제","sidebar.pinned":"고정됨","sidebar.delete":"삭제","sidebar.deleteWithShiftClick":"삭제 (Shift+클릭으로 확인 없이 삭제)","sidebar.clearProjectSessions":"세션 비우기","sidebar.clearPriorityList":"목록 비우기","navigator.resultsToCheck":"확인할 결과","navigator.resultsToCheckCount":"확인할 결과 {count}","navigator.resultsToCheckHint":"이 브라우저에서 마지막으로 연 뒤 새로 끝난 대화와, 답을 기다리는 대화","navigator.resultsToCheckEmpty":"확인할 결과가 없습니다.","navigator.acknowledgeResults":"모두 확인","navigator.acknowledgeResultsHint":"지금 확인할 결과로 보이는 대화를 모두 본 것으로 표시합니다. 답을 기다리는 대화는 남습니다.","sidebar.waitingForAnswer":"답 기다림","sidebar.waitingForAnswerHint":"질문이나 승인 요청에 답할 때까지 멈춰 있습니다","sidebar.newScratchSession":"새 세션","sidebar.newScratchSessionTitle":"프로젝트 없이 세션 시작 (홈 폴더의 날짜별 임시 폴더)","sidebar.newScratchSessionFailed":"임시 폴더를 만들지 못했습니다: {error}","sidebar.clearSessionsTitle":"세션 삭제 확인","sidebar.clearSessionsProjectBody":"{project} 프로젝트의 세션 {count}개를 영구 삭제합니다. 되돌릴 수 없습니다.","sidebar.clearSessionsPriorityBody":"우선순위 목록의 세션 {count}개를 영구 삭제합니다. 되돌릴 수 없습니다.","sidebar.clearSessionsRunningExcluded":"실행 중인 세션 {count}개는 삭제하지 않습니다.","sidebar.clearSessionsNone":"지금 삭제할 수 있는 세션이 없습니다.","sidebar.clearSessionsConfirm":"삭제","sidebar.clearSessionsCancel":"취소","sidebar.clearSessionsBusy":"삭제 중…","sidebar.clearSessionsFailed":"{count}개 세션을 삭제하지 못했습니다: {names}","sidebar.archive":"보관 (목록에서 숨김, 복원 가능)","sidebar.archived":"보관됨","sidebar.restore":"복원","sidebar.noArchivedSessions":"보관된 세션 없음","sidebar.expandForks":"Fork 펼치기","sidebar.collapseForks":"Fork 접기","sidebar.messagesCount":"메시지 {count}개","sidebar.worktreePath":"Worktree: {path}","sidebar.removeWorktreeTitle":"worktree 체크아웃 {path}을(를) 제거합니다. Branch는 유지됩니다","files.deleted":"삭제됨","files.insertPath":"채팅에 경로 삽입","files.mention":"멘션","chat.loadingSession":"세션 불러오는 중...","chat.runningTool":"도구 실행 중...","chat.runningNamedTool":"{name} 실행 중...","chat.runningTools":"{names} 실행 중...","chat.runningToolsMore":"{names} (+{count}) 실행 중...","chat.waitingModel":"모델 응답 대기 중...","todo.progress":"{percent}% \xb7 {total}개 중 {completed}개 완료 \xb7 {remaining}개 남음","todo.progressDone":"{percent}% \xb7 {total}개 중 {completed}개 완료","todo.allDone":"{count}개 모두 완료","todo.showCompleted":"완료 {count}개 보기","todo.hideCompleted":"완료 {count}개 접기","todo.ready":"지금 가능","todo.waiting":"선행 대기: {tasks}","chat.runningCommand":"명령 실행 중...","chat.thinking":"생각 중...","chat.contextUsageTitle":"컨텍스트 윈도우: {limit} Token 중 {used} 사용 ({percent})","chat.contextUsageWarning":"컨텍스트 윈도우가 거의 차고 있습니다","chat.contextUsageCritical":"컨텍스트 윈도우가 거의 가득 찼습니다","chat.processDetails":"프로세스 상세","chat.message":"메시지","chat.messages":"메시지","chat.toolCall":"도구 호출","chat.toolCalls":"도구 호출","chat.collapseProcess":"프로세스 상세 접기","chat.expandProcess":"프로세스 상세 펼치기","process.empty":"이 세션에는 아직 작업 과정 기록이 없습니다","process.turn":"턴","process.turns":"턴","chat.loadEarlier":"위로 스크롤하면 이전 메시지를 불러옵니다 ({count}개 숨김)","chat.extensionRequest":"확장 요청","chat.responseSending":"응답을 보내는 중...","chat.responseFailed":"응답이 Agent에 전달되지 않았습니다. 아직 기다리는 중이니 다시 시도하세요.","chat.cancel":"취소","chat.confirm":"확인","chat.submit":"제출","chat.agentQuestion":"Agent가 입력을 기다립니다","chat.agentQuestionHint":"옵션을 선택하거나 직접 응답을 입력하세요.","chat.askAutoSelectHint":"{seconds}초 동안 응답이 없으면 추천안으로 자동 선택합니다. 선택하거나 입력하면 대기 시간이 다시 시작됩니다.","chat.recommended":"추천","chat.customAnswer":"기타 응답 (선택)","chat.chatAboutThis":"이것에 대해 대화","chat.submitAnswer":"답변 제출","chat.agentFormHint":"양식을 채워 제출하세요.","chat.askFormAutoSubmitHint":"{seconds}초 동안 응답이 없으면 지금 입력된 값을 그대로 제출합니다. 입력하면 대기 시간이 다시 시작됩니다.","chat.formOther":"기타","chat.formOtherPlaceholder":"직접 입력","chat.formRequired":"필수","chat.formInvalid":"표시된 항목을 확인한 뒤 제출하세요.","chat.formImageUnavailable":"이미지를 불러오지 못했습니다","chat.formError.required":"필수 항목입니다","chat.formError.selectAtLeastOne":"하나 이상 선택하세요","chat.formError.enterNumber":"숫자를 입력하세요","chat.formError.min":"{value} 이상이어야 합니다","chat.formError.max":"{value} 이하여야 합니다","chat.formError.minLength":"{value}자 이상 입력하세요","chat.formError.maxLength":"{value}자 이하로 입력하세요","chat.formError.email":"이메일 주소를 입력하세요","chat.formError.url":"전체 URL을 입력하세요","chat.formError.pattern":"형식이 맞지 않습니다 ({pattern})","chat.planApproval":"계획 승인","chat.planFeedback":"추가 계획 수립을 위한 피드백 (선택)","chat.refinePlan":"계획 계속하기","chat.approvePlan":"승인 후 구현","chat.extensionInput":"확장 터미널 입력","chat.extensionPanel":"확장 패널","chat.close":"닫기","chat.queued":"대기 중 \xb7 {count}","chat.recall":"입력창으로 되돌리기","chat.recallTitle":"대기 중인 메시지를 모두 제거하고 편집할 수 있도록 입력창에 다시 넣습니다","chat.queueRemove":"이 대기 메시지만 취소","chat.retrying":"재시도 중 ({attempt}/{max})…","chat.recoveredError":"이 시도는 실패해 자동으로 다시 보냈습니다.","chat.recoveredErrorDetail":"오류 보기","chat.loadingCommands":"명령 불러오는 중...","chat.slashCommands":"슬래시 명령 \xb7 {label}","chat.tabEnter":"Tab / Enter","chat.noCommands":"명령이 없습니다","chat.match":"일치 1개","chat.matches":"일치 {count}개","chat.command":"명령 1개","chat.commands":"명령 {count}개","chat.loadingFiles":"파일 불러오는 중...","chat.files":"파일 \xb7 {label}{hint}","chat.searching":"검색 중…","chat.noMatchingFiles":"일치하는 파일 없음","chat.searchingAll":" \xb7 전체 파일 검색 중…","chat.indexTruncated":" \xb7 인덱스 일부 생략됨","chat.steerPlaceholder":"지금 지시하거나 후속 메시지를 대기열에 추가하세요...","chat.agentPlaceholder":"Agent 실행 중…","chat.messagePlaceholder":"메시지 입력… / 명령어 \xb7 @ 파일","chat.steer":"지시","chat.followUp":"후속 메시지","chat.send":"보내기","chat.attachImageLimit":"메시지 하나에 이미지를 최대 {count}개까지 첨부할 수 있습니다.","chat.attachImageTooLarge":"{name} 파일이 이미지당 {limit} 제한을 초과합니다.","chat.attachFile":"파일 첨부","chat.emptyProjectLabel":"작업 폴더","chat.emptyProjectHint":"첫 메시지를 보내면 이 폴더에서 새 세션이 시작됩니다.","chat.openSessionList":"세션 목록 열기","chat.attachments":"첨부 파일","chat.removeImage":"이미지 {index} 제거","chat.removeAttachment":"{name} 제거","chat.attachExtracting":"텍스트 추출 중","chat.attachExtractingWait":"첨부 파일 처리가 끝날 때까지 기다려 주세요","chat.attachLimit":"메시지 하나에 이미지를 제외한 첨부 파일을 최대 {count}개까지 넣을 수 있습니다.","chat.attachTooLarge":"{name} 파일이 문서당 {limit} 제한을 초과합니다.","chat.attachTotalTooLarge":"첨부 문서의 합계가 {limit} 제한을 초과합니다.","chat.attachTextTooLarge":"{name}에서 추출한 텍스트가 {limit}자 제한을 초과합니다.","chat.attachTooManyPages":"{name} 파일이 PDF {limit}페이지 제한을 초과합니다.","chat.attachNoPdfText":"{name}에서 추출할 수 있는 텍스트가 없습니다. 스캔 또는 이미지 전용 PDF에 필요한 OCR은 지원하지 않습니다.","chat.attachPasswordProtected":"{name}은(는) 암호로 보호되어 텍스트를 추출할 수 없습니다.","chat.attachExtractFailed":"{name}에서 텍스트를 추출하지 못했습니다.","chat.attachKindAudio":"음성","chat.attachKindFile":"파일","chat.attachUploading":"저장 중","chat.attachTranscribing":"받아쓰기 중","chat.attachTranscribeFailed":"받아쓰기 실패","chat.attachStoredTooLarge":"{name} 파일이 파일당 {limit} 제한을 초과합니다.","chat.attachUploadFailed":"{name} 파일을 저장하지 못했습니다: {error}","chat.attachTranscribePending":"선택 필요","chat.transcribeGroup":"음성 받아쓰기","chat.transcribeChecking":"길이 확인 중","chat.transcribeConfirmTitle":"{name} 받아쓰기를 시작할까요?","chat.transcribePlanSummary":"{duration} \xb7 받아쓰기 호출 약 {calls}회","chat.transcribeDurationUnknown":"길이 알 수 없음","chat.transcribeUsageNotice":"받아쓰기는 연결된 계정의 사용량에 포함됩니다. 시작을 누르기 전에는 아무것도 보내지 않습니다.","chat.transcribeStart":"받아쓰기 시작","chat.transcribeSkip":"받아쓰지 않기","chat.transcribeCancel":"받아쓰기 취소","chat.transcribeRunning":"{name} 받아쓰는 중","chat.transcribeRetry":"다시 시도","chat.transcribeAction":"받아쓰기","chat.transcribeSkipped":"{name}은(는) 받아쓰지 않고 저장된 파일 경로만 보냅니다.","chat.transcribeFailedRow":"{name} 받아쓰기 실패: {error}","chat.transcribeToolMissing":"음성 도구(ffmpeg)를 쓸 수 없어 이 음성을 받아쓰기용으로 준비하지 못했습니다.","chat.transcribePartialFailed":"{total}조각 중 {done}조각까지 처리하고 멈췄습니다. 일부 결과는 붙이지 않았습니다.","chat.transcribeTooLong":"받아쓴 내용이 다른 첨부와 합친 글자 수 제한을 넘습니다.","chat.transcribeFallbackTitle":"{name} 기본 받아쓰기에 실패했습니다. ChatGPT/Codex로 이어서 받아쓸까요?","chat.transcribeFallbackProgress":"{total}조각 중 {done}조각은 이미 받아써서 그대로 둡니다. 실패한 조각과 남은 조각만 보냅니다.","chat.transcribeFallbackUsageNotice":"ChatGPT/Codex는 기본 받아쓰기와 다른 제공자이며, 로그인한 계정의 사용량에 포함됩니다. ChatGPT/Codex로 받아쓰기를 누르기 전에는 아무것도 보내지 않습니다.","chat.transcribeFallbackStart":"ChatGPT/Codex로 받아쓰기","chat.transcribeFallbackExpired":"이 선택은 만료됐거나 이미 사용됐습니다. 아무것도 보내지 않았습니다. 다시 시도하면 기본 받아쓰기부터 시작합니다.","chat.attachmentSettingsNav":"첨부 파일","chat.attachmentSettingsTitle":"첨부 파일","chat.attachmentSettingsDescription":"대화에 첨부한 파일은 에이전트가 열 수 있도록 이 컴퓨터에 저장됩니다.","chat.attachmentSettingsLoadFailed":"첨부 설정을 불러오지 못했습니다","chat.attachmentUploadLimit":"파일당 업로드 한도(MB)","chat.attachmentUploadLimitHelp":"이보다 큰 파일은 보내기 전에 거절합니다. 메시지에 바로 읽어 넣는 텍스트는 따로 문서당 8MB, 합계 240,000자 한도를 지킵니다.","chat.attachmentUploadLimitInvalid":"1 이상의 정수(MB)를 입력하세요.","chat.attachmentAutoCleanup":"쓰이지 않는 첨부 자동 삭제","chat.attachmentAutoCleanupHelp":"대화\xb7분기\xb7보내지 않은 초안에서 쓰이는 첨부는 지우지 않습니다. 어디에서도 쓰이지 않는다고 확인된 때부터 {days}일이 지나면 삭제하고, 쓰임을 확인할 수 없는 파일은 남겨 둡니다.","chat.attachmentSettingsSaved":"저장했습니다","characterMode.nav":"캐릭터","characterMode.title":"캐릭터","characterMode.description":"화면에 보이는 캐릭터의 얼굴\xb7이름\xb7스티커\xb7완료 음성을 고릅니다.","characterMode.label":"캐릭터 세트","characterMode.default":"기본","characterMode.office":"사무실 모드","characterMode.help":"이 PC의 서버 전체에 적용됩니다. 사무실 모드에서는 이 PC 프로필에 등록된 캐릭터가 해당 자리의 얼굴\xb7이름\xb7말투\xb7스티커\xb7음성을 대신합니다. 등록되지 않은 자리는 그대로입니다.","characterMode.noRoster":"이 PC에는 사무실 캐릭터 세트가 없어 기본 캐릭터가 그대로 쓰입니다.","characterMode.saved":"저장했습니다","chat.steerTitle":"현재 실행을 중단하고 이 메시지를 바로 전달합니다","chat.followUpTitle":"Agent가 끝난 후 이 메시지를 전달하도록 대기열에 추가합니다","chat.filterModels":"모델 필터…","chat.noMatchingModels":"일치하는 모델 없음","chat.modelRoles":"역할","chat.allModels":"전체 모델","chat.mainPreset":"Main 프리셋","roles.title":"모델 역할","roles.description":"omp는 하나의 현재 모델이 아니라 역할별로 작업을 라우팅합니다. 각 역할에 모델을 지정하면 CUELO과 omp CLI 모두에서 사용됩니다.","roles.scope":"저장 위치","roles.scopeGlobal":"전역","roles.scopeProject":"이 프로젝트","roles.unset":"— 미설정 —","roles.needsProject":"모델 역할을 편집하려면 프로젝트를 여세요.","roles.source.global":"전역 설정에서","roles.source.project":"프로젝트 설정에서","roles.source.default":"omp 기본값","roles.thinking":"Thinking","roles.thinkingInherit":"설정된 기본 thinking 수준 사용","roles.harnessNote":"CUELO Maker\xb7도구 역할 자리는 지정하기 전에도 목록에 표시됩니다. 쓸 자리만 직접 모델을 고르세요. 저장해도 로그인하거나 모델을 시험 호출하지 않습니다.","roles.harnessUnset":"미설정","roles.harness.implSol":"Maker: 한정된 설계와 깊은 원인 추적, 재작업","roles.harness.implSonnet":"Maker: 일반 구현과 보통 UI","roles.harness.implOpus":"Maker: 어려운 UI/UX","roles.harness.implDeepSeek":"Maker: 명세가 확정된 반복 작업, Main이 직접 고를 때만 사용","roles.harness.makerHardUiOpus":"Maker: 어려운 UI/UX (HARD)","roles.harness.makerHardCodeOpus":"Maker: HARD 코드, Main이 직접 고를 때만 사용","roles.harness.makerHardCodeSonnet":"Maker: 방향이 정해진 구현과 보통 UI (HARD)","roles.harness.crossReviewOpenAI":"교차검수 \xb7 OpenAI 필수 검토 (openai / openai-codex)","roles.harness.crossReviewAnthropic":"교차검수 \xb7 Anthropic 필수 검토 (anthropic)","roles.harness.crossReviewAdvisory":"교차검수 \xb7 보조 검토, 기다리지 않음 (제공자 무관)","roles.harness.preflightAnthropic":"계획 자문: 공동 사전 점검","roles.harness.skim":"도구 \xb7 다중 파일 소스 읽기 (skim)","roles.harness.draft":"도구 \xb7 문서 초안 작성 (draft)","roles.harness.ocr":"도구 \xb7 이미지 글자 전사 (ocr)","roles.harness.interpreter":"도구 \xb7 한영 통역 (interpreter)","chat.moreControls":"실행 옵션","chat.collapseControls":"실행 옵션 닫기","chat.shell":"Shell","chat.outputLocal":"출력은 로컬에만 유지","chat.outputModel":"출력을 모델로 전송","chat.noTools":"도구 없음, 읽기 전용","chat.builtInTools":"코어: {tools} \xb7 그 외 등록된 도구는 계속 활성화됨","chat.allBuiltInTools":"코어: {tools} \xb7 그 외 등록된 도구는 계속 활성화됨","chat.changeReasoning":"추론 수준 변경: {level}","chat.changeReasoningLabel":"추론 수준 변경","chat.currentReasoning":"현재 추론 강도: {level}","chat.outputSpeed":"{rate} tok/s","chat.outputSpeedTitle":"마지막 답변의 출력 속도(초당 출력 토큰, 요청 시작부터 생성 끝까지 기준)","chat.outputSpeedLive":"~{rate} tok/s","chat.outputSpeedLiveTitle":"지금 답변의 출력 속도 추정(받은 글자를 토큰으로 어림, 요청 시작부터 지금까지 기준). 답변이 끝나면 실제 토큰 수로 바뀝니다","chat.fastModeActive":"Fast 켜짐 \xb7 이 모델에 적용 중. 우선 처리라 요금\xb7사용량이 더 들 수 있습니다. 누르면 끕니다","chat.fastModeInactive":"Fast 요청됨 \xb7 이 모델\xb7계정에는 적용되지 않음. 누르면 끕니다","chat.fastModeOff":"Fast 꺼짐 \xb7 누르면 우선 처리를 요청합니다(provider에 따라 요금\xb7사용량이 더 듭니다)","chat.fastModeUnknown":"Fast 상태 확인 전 \xb7 누르면 이 세션의 실제 상태를 읽고 바꿉니다","chat.fastModeBusy":"Fast 바꾸는 중","chat.changeToolPreset":"도구 프리셋 변경","chat.stopCompaction":"압축 중지","chat.compactContext":"컨텍스트 압축","chat.compacting":"압축 중…","chat.compact":"Compact","chat.stopAgent":"Agent 중지","chat.stop":"중지","chat.liveVoice":"라이브 음성","chat.liveStart":"라이브 음성 시작","chat.liveStop":"라이브 음성 종료","chat.liveConnecting":"연결 중","chat.liveOn":"통화 중","chat.liveWorking":"작업 수행 중","chat.liveUnsupported":"이 브라우저에서는 라이브 통화를 할 수 없습니다","chat.liveMicDenied":"마이크 권한이 거부됐습니다","chat.liveMicUnavailable":"사용할 수 있는 마이크가 없습니다","chat.liveAuthRequired":"라이브 음성을 쓰려면 Codex 로그인이 필요합니다","chat.liveUpstreamFailed":"Codex가 라이브 통화를 거부했습니다","chat.liveFailed":"라이브 통화를 시작하지 못했습니다","chat.liveNeedsSession":"먼저 폴더를 선택하세요 — 라이브 통화는 이 대화의 에이전트로 말합니다","chat.liveVoiceSettingsNav":"통화 음성","chat.liveVoiceSettingsTitle":"통화 음성","chat.liveVoiceSettingsDescription":"라이브 통화와 통역 통화에서 말할 Codex 목소리와 말 빠르기를 고릅니다. 선택은 다음 통화부터 적용됩니다.","chat.liveVoiceSpeakerGroup":"목소리","chat.liveVoiceCodexLabel":"Codex 목소리","chat.liveVoiceCodexHelp":"라이브 통화와 통역 통화에서 이 목소리로 말합니다.","chat.livePaceLabel":"말 빠르기","chat.livePaceHelp":"천천히를 고르면 또박또박 느리게 말합니다.","chat.livePaceNormal":"보통","chat.livePaceSlow":"천천히","chat.liveVoiceLoadFailed":"음성 설정을 불러오지 못했습니다","chat.disableSound":"완료 알림음 끄기","chat.enableSound":"완료 알림음 켜기","chat.thinkingAuto":"추론 강도 자동 선택","chat.thinkingAutoCapped":"자동 선택, 최대 {level}","chat.thinkingOff":"추론 끔","chat.thinkingMinimal":"최소 추론","chat.thinkingLow":"낮은 추론","chat.thinkingMedium":"중간 추론","chat.thinkingHigh":"높은 추론","chat.thinkingXhigh":"매우 높은 추론","chat.thinkingMax":"최대 추론","chat.builtIn":"기본 제공","chat.extensions":"확장","chat.customCommands":"사용자 지정 명령어","chat.mcpPrompts":"MCP 프롬프트","chat.prompts":"프롬프트","chat.fileCommands":"명령어 파일","chat.skills":"Skill","chat.dormant":"휴면","chat.commandCompact":"컨텍스트를 압축합니다. 선택적으로 지침을 지정할 수 있습니다","chat.commandReload":"확장, Skill, 프롬프트, 도구를 다시 불러옵니다","chat.commandName":"세션 표시 이름을 설정합니다","chat.commandSession":"세션의 메시지, Token, 비용 통계를 표시합니다","chat.commandCopy":"마지막 어시스턴트 메시지를 복사합니다","chat.goalLabel":"목표","chat.goalPaused":"일시정지됨","chat.goalBudgetLeft":"{left} 남음","chat.goalTokensUsed":"{used} 사용","chat.jumpToBottom":"맨 아래로 이동","chat.loadLater":"아래로 스크롤하면 이후 메시지를 불러옵니다 ({count}개 남음)","chat.jumpMissing":"이 메시지는 지금 대화 화면에 없습니다(다른 분기이거나 압축된 기록).","chat.questionRail":"내 질문","chat.searchPlaceholder":"대화에서 찾기","chat.searchNoResults":"결과 없음","chat.searchCount":"{index}/{total}","chat.searchPrevious":"이전 결과","chat.searchNext":"다음 결과","chat.searchClose":"찾기 닫기","chat.compactionLabel":"압축","chat.compactionProgress":"컨텍스트 압축 중 \xb7 {seconds}초","chat.compactionReason.manual":"수동","chat.compactionReason.threshold":"임계치","chat.compactionReason.overflow":"초과","chat.compactionReason.idle":"유휴","chat.compactionReason.incomplete":"미완료","chat.compactedFrom":"{tokens} 토큰에서 압축됨","chat.interruptedTitle":"지난 실행이 중단됐어요","chat.interruptedDetail":"서버나 PC가 꺼지는 등으로 실행 도중 멈췄습니다. 자동으로 이어지지 않으면 메시지를 보내 계속할 수 있어요.","chat.interruptedDismiss":"닫기","chat.frequentModels":"자주 쓰는 모델","chat.modelPickCount":"{count}회","palette.searchPlaceholder":"대화 내용 검색","palette.searchResults":"대화 검색 결과","palette.searching":"검색 중…","palette.searchFailed":"검색하지 못했습니다","palette.searchEmpty":"일치하는 메시지가 없습니다","palette.searchHits":"메시지 {count}개","palette.searchTruncated.time":"시간 한도로 세션 {total}개 중 {scanned}개까지만 검색","palette.searchTruncated.bytes":"크기 한도로 세션 {total}개 중 {scanned}개까지만 검색","palette.searchTruncated.results":"앞쪽 결과만 표시 중 \xb7 검색어를 좁혀 보세요","palette.searchCompacted":"압축된 기록의 {count}개는 제외","palette.searchRoleUser":"내 질문","palette.searchRoleAssistant":"답변","palette.wideChatOn":"넓은 대화 폭 사용","palette.wideChatOff":"기본 대화 폭 사용","palette.groupViews":"보기","palette.groupViewsHint":"인스펙터에서 열림","palette.groupShortcuts":"바로가기","palette.groupScreen":"화면","palette.hintMove":"이동","palette.hintOpen":"열기","palette.hintClose":"닫기","chat.compacted":"압축됨","chat.tokensSaved":"{saved} 절약","chat.filesWritten":"변경된 파일","chat.openWrittenFile":"{name} 열기","chat.lessonsSaved":"[교훈 저장] 이번 턴에 에이전트가 직접 저장했습니다.","chat.savedLesson":"교훈: {memory}","chat.savedSkill":"스킬 {action}: {name}","i18n.close":"닫기","i18n.copy":"복사","i18n.copied":"복사됨","i18n.cancel":"취소","i18n.save":"저장","i18n.saving":"저장 중…","i18n.saved":"저장됨","i18n.remove":"제거","i18n.removing":"제거 중…","i18n.delete":"삭제","i18n.loading":"불러오는 중...","i18n.search":"검색","i18n.refresh":"새로고침","i18n.update":"업데이트","i18n.updating":"업데이트 중...","restart.title":"CUELO 재시작 중","restart.body":"서버가 돌아오면 이 페이지가 자동으로 새로고침됩니다.","restart.slow":"재시작이 2분 넘게 끝나지 않았습니다. 서버 PC의 %USERPROFILE%\\\\.omp\\\\restart-ompweb.log에서 READY/FAILED를 확인하세요. 서버가 돌아오면 이 페이지는 그대로 새로고침됩니다.","restart.returnedTitle":"CUELO 재시작 완료","restart.returnedBody":"서버가 돌아와 이 탭을 같은 대화로 다시 연결했습니다.","restart.returnedDismiss":"재시작 알림 닫기","i18n.check":"확인","i18n.checking":"확인 중...","i18n.install":"설치","i18n.installing":"설치 중...","i18n.noResults":"결과 없음","i18n.searchProviders":"Provider 검색…","i18n.noProviders":"일치하는 Provider 없음","i18n.newModel":"새 모델","i18n.addProvider":"Provider 추가","i18n.selectProviderModel":"Provider 또는 모델을 선택하세요","i18n.visibleInPrompt":"모델 프롬프트에 표시됨 — 클릭하여 비활성화","i18n.hiddenFromPrompt":"모델 프롬프트에서 숨겨짐 — 클릭하여 활성화","i18n.dormant":"휴면","i18n.hiddenButInvocable":"모델에서 숨겨졌지만 수동 호출은 가능합니다","i18n.skillSearchPlaceholder":"예: react, testing, deploy","i18n.searching":"검색 중…","i18n.noSkills":"Skill을 찾을 수 없음","i18n.checkUpdates":"업데이트 확인","i18n.updates":"업데이트","i18n.noResolvedResources":"확인된 리소스 없음","i18n.enablePackage":"패키지 활성화","i18n.disablePackage":"패키지 비활성화","i18n.filtered":"필터링됨","i18n.openSessionToReload":"다시 불러오려면 세션을 여세요","i18n.notFound":"찾을 수 없음","i18n.noPlugins":"구성된 Plugin 없음","trust.resourcesNotLoaded":"제한 모드","trust.trustProject":"프로젝트 신뢰","computerTakeover.allow":"가로채기 허용","computerTakeover.active":"가로채기 허용 중","computerTakeover.allowHint":"이 세션에서만 화면 가로채기를 허용합니다. 끄거나 세션이 닫히면 다시 거부로 돌아갑니다.","computerTakeover.activeHint":"이 세션은 화면 가로채기가 허용된 상태입니다. 누르면 끕니다.","computerTakeover.shared":"서버와 같은 폴더에서 연 세션은 따로 허용할 수 없습니다.","computerTakeover.failed":"가로채기 설정을 바꾸지 못했습니다: {error}","trust.trusting":"신뢰 처리 중...","trust.cancel":"취소","trust.dialogTitle":"이 프로젝트를 신뢰하시겠습니까?","trust.dialogBody":"프로젝트 리소스는 로컬 코드를 실행할 수 있습니다. 내용을 알고 있는 프로젝트만 신뢰하세요.","trust.skillsNotLoaded":"이 프로젝트가 신뢰되지 않아 프로젝트 Skill이 로드되지 않았습니다.","trust.pluginsNotLoaded":"이 프로젝트가 신뢰되지 않아 프로젝트 Plugin이 로드되지 않았습니다.","trust.projectScopeUnavailable":"프로젝트 리소스가 로드되지 않은 동안에는 프로젝트 설치를 사용할 수 없습니다.","trust.pendingBadge":"제한 모드 \xb7 신뢰 예약됨","trust.scheduledTitle":"신뢰가 예약됐습니다","trust.scheduledBody":"이 프로젝트는 아직 제한 모드입니다. 이 프로젝트의 모든 세션이 지금 하는 작업을 마치면 신뢰가 적용되며, 실행 중인 작업은 중단되지 않습니다.","trust.cancelSchedule":"예약 취소","trust.close":"닫기","trust.applyFailed":"예약한 신뢰를 적용하지 못해 프로젝트는 계속 제한 모드입니다: {error}. 다시 시도하려면 다시 신뢰하세요.","trust.settingsNav":"프로젝트 신뢰","trust.settingsDescription":"자체 확장\xb7hook\xb7도구\xb7MCP 서버가 있는 프로젝트는 신뢰한 뒤에만 그 코드를 불러옵니다. 세션이 작업 중일 때 바꾼 설정은 그 프로젝트의 모든 세션이 idle이 되면 적용되며, 실행 중인 작업은 중단되지 않습니다.","trust.settingsEmpty":"아직 신뢰 결정이 필요한 프로젝트가 없습니다.","trust.loadFailed":"프로젝트 신뢰 상태를 불러오지 못했습니다: {error}","trust.stateTrusted":"신뢰됨","trust.stateRestricted":"제한 모드","trust.stateNotRequired":"신뢰가 필요한 프로젝트 코드 없음","trust.pendingGrant":"신뢰를 승인했지만 아직 적용 전입니다. 세션들이 작업을 마칠 때까지 제한 모드가 유지됩니다.","trust.pendingRevoke":"신뢰 해제는 이미 저장됐습니다. 실행 중인 세션 {count}개가 아직 프로젝트 코드를 쓰고 있으며, 지금 작업이 끝나면 제한 모드로 다시 시작합니다.","trust.runtime":"실행 세션 {sessions} \xb7 작업 중 {running} \xb7 프로젝트 코드 로드 {loaded}","trust.revoke":"신뢰 해제","trust.trustAgain":"다시 신뢰","trust.confirm":"확인","trust.working":"저장 중…","trust.confirmGrant":"이 프로젝트를 신뢰할까요? 프로젝트의 확장\xb7hook\xb7도구\xb7MCP 서버가 이 컴퓨터에서 실행될 수 있습니다.","trust.confirmTrustAgain":"해제를 되돌리는 것은 새 신뢰 승인입니다. 프로젝트의 확장\xb7hook\xb7도구\xb7MCP 서버가 이 컴퓨터에서 실행될 수 있습니다.","trust.confirmRevoke":"신뢰를 해제할까요? 새 세션은 바로 제한 모드로 시작하고, 실행 중인 세션은 지금 작업을 마친 뒤 적용됩니다.","trust.doneApplied":"적용했습니다. 이 프로젝트의 세션은 이제 이 설정으로 시작합니다.","trust.doneCancelled":"예약을 취소했습니다. 프로젝트는 계속 제한 모드입니다.","trust.refresh":"새로고침","i18n.creatingSession":"새 세션 생성 중…","i18n.creating":"생성 중…","i18n.subscription":"구독","i18n.subscriptions":"구독 목록","i18n.customEndpoint":"사용자 지정 엔드포인트 형식","i18n.noChanges":"변경 사항 없음","i18n.branches":"Branch 목록","i18n.noActiveSession":"활성 세션 없음","i18n.noBranches":"이 세션에는 Branch가 없습니다","i18n.source":"소스","i18n.preview":"미리보기","i18n.diff":"Diff","i18n.downloadFile":"파일 다운로드","i18n.liveSync":"실시간 동기화 활성","i18n.notWatching":"감시 안 함","i18n.fileViewMode":"파일 보기 모드","i18n.compareHead":"작업 트리를 HEAD와 비교","i18n.mentionSelectedLines":"선택한 줄 멘션","i18n.disableWrap":"자동 줄바꿈 끄기","i18n.enableWrap":"자동 줄바꿈 켜기","i18n.htmlPreview":"HTML 미리보기","i18n.previewFile":"{file} 미리보기","i18n.invalidMermaid":"잘못된 Mermaid 다이어그램","i18n.renderingMermaid":"Mermaid 다이어그램 렌더링 중","i18n.previewAfterStreaming":"스트리밍 완료 후 미리보기 가능","i18n.showMermaidSource":"Mermaid 소스 보기","i18n.previewMermaid":"Mermaid 다이어그램 미리보기","i18n.openMermaidViewer":"다이어그램 뷰어 열기","i18n.mermaidViewer":"Mermaid 다이어그램 뷰어","i18n.mermaidDiagram":"Mermaid 다이어그램","i18n.zoomOut":"축소","i18n.zoomIn":"확대","toolImage.dialogLabel":"확대한 이미지","toolImage.requestEdit":"이 화면 수정 요청","toolImage.requestEditHint":"이 이미지를 입력창에 붙입니다. 고칠 내용을 적어 보내세요.","toolImage.noComposer":"붙일 입력창이 없습니다. 대화를 열고 「이 화면 수정 요청」을 누르세요.","toolImage.loadFailed":"이미지를 가져오지 못했습니다. 「이 화면 수정 요청」을 다시 누르세요.","toolImage.markHint":"고칠 곳을 드래그해 표시하세요","toolImage.markLimit":"구역은 {count}개까지 표시할 수 있습니다","toolImage.clearMarks":"표시 지우기","toolImage.regionLabel":"구역 {n}","toolImage.locatorIntro":"첨부한 화면에 고칠 곳을 빨간 상자로 표시했습니다(구역 {range}). 구역별 확대 그림이 뒤에 이어집니다.","toolImage.locatorRegion":"구역 {n}: x={x}, y={y}, 폭 {w}, 높이 {h} (원본 {width}\xd7{height} 픽셀 기준)","files.pickElement":"요소 지정","files.pickElementHint":"미리보기에서 고칠 요소를 누르세요","files.pickedElement":"지정한 요소","files.requestElementEdit":"이 요소 수정 요청","files.clearPick":"지정 해제","files.pickLocatorElement":"요소: {selector}","files.pickLocatorText":"텍스트: \\"{text}\\"","files.pickLocatorPosition":"화면 위치: x={x}, y={y}, 폭 {w}, 높이 {h} (미리보기 {vw}\xd7{vh} 기준)","i18n.fitToWidth":"너비에 맞춤","models.discoveryFetching":"모델 가져오는 중…","models.discoveryFetch":"모델 가져오기…","models.discoveryFilterPlaceholder":"{count}개 모델 필터…","models.discoveryFilter":"업스트림 모델 필터","models.discoverySelectShown":"표시된 항목 선택","models.discoveryNoMatches":"일치하는 모델이 없습니다.","models.discoveryAdded":"추가됨","models.discoveryShowing":"전체 {total}개 중 처음 {shown}개 표시","models.discoveryFetched":"{count}개 모델을 가져왔습니다","models.discoveryAddSelected":"선택 항목 추가","models.discoveryAddSelectedCount":"선택 항목 추가 ({count})","models.catalogSource":"출처: models.dev ↗","models.catalogFilling":"세부 정보 채우는 중…","models.catalogFill":"모델 세부 정보 채우기","models.catalogFilled":"{count}개 필드가 채워졌습니다","models.catalogNoEmptyFields":"채울 빈 필드가 없습니다","models.catalogNoExactMatch":"models.dev에서 정확히 일치하는 항목 없음","models.catalogPriceProvider":"Provider {provider}와 가격 일치","models.catalogPriceBaseUrl":"Base URL이 {provider}와 가격 일치","models.catalogPriceConsensus":"{total}개 중 {support}개 레코드에서 가격 일치","models.catalogPriceUnreliable":"신뢰할 수 있는 가격을 찾지 못했습니다","models.catalogUndo":"실행 취소","models.navGroupRoles":"역할 배정","models.navGroupAccounts":"연결된 계정","models.navGroupCustom":"직접 추가한 제공자","models.backToList":"목록으로","i18n.testingModel":"모델 연결 테스트 중...","i18n.connected":"연결됨","i18n.failed":"실패","i18n.test":"테스트","i18n.testConnection":"모델 연결 테스트","i18n.provider":"제공자","i18n.model":"모델","i18n.providerName":"Provider 이름","i18n.rename":"이름 변경","i18n.default":"기본값","i18n.disabled":"비활성화됨","i18n.noResources":"리소스 없음","i18n.unknown":"알 수 없음","i18n.installedVersion":"설치됨 {version}","i18n.configuredVersion":"설정됨 {version}","i18n.extensions":"확장","i18n.prompts":"프롬프트","i18n.themes":"테마","i18n.resourceCount":"{count} {label}","i18n.extensionShort":"확장","i18n.skillShort":"Skill","i18n.promptShort":"프롬프트","i18n.themeShort":"테마","i18n.custom":"사용자 지정","i18n.clearAll":"모두 지우기","i18n.connectedSuccessfully":"연결에 성공했습니다.","i18n.notConnected":"연결 안 됨","i18n.configured":"설정됨","i18n.notConfigured":"설정 안 됨","i18n.openingBrowser":"브라우저를 여는 중…","i18n.submit":"제출","i18n.login":"로그인","i18n.relogin":"다시 로그인","i18n.deviceLogin":"기기 코드로 로그인","i18n.deviceLoginGuide":"아래 주소를 열어 로그인한 뒤 이 코드를 입력하세요. 이 서버의 localhost로 돌아올 필요가 없어서 원격 서버에서도 됩니다.","i18n.disconnect":"연결 해제","i18n.networkError":"네트워크 오류","i18n.continuing":"계속 진행 중…","i18n.skills":"Skill","i18n.plugins":"Plugin","i18n.addSkill":"Skill 추가","i18n.addPlugin":"Plugin 추가","i18n.selectSkill":"Skill 선택","i18n.selectPackage":"패키지 선택","i18n.updateAvailable":"업데이트 있음","i18n.upToDate":"최신 상태","i18n.automaticChecksUnavailable":"자동 확인 불가","i18n.checkFailed":"확인 실패","i18n.installed":"설치됨","i18n.status":"상태","i18n.version":"버전","i18n.package":"패키지","i18n.resources":"리소스","i18n.installedPath":"설치 경로","i18n.cwd":"CWD","i18n.resolvedResources":"확인된 리소스","i18n.reloadSession":"세션 다시 불러오기","i18n.reloadSessionHint":"열린 세션의 설정과 스킬을 다시 불러옵니다. Plugin은 해제되지 않으니, 해제하려면 CUELO를 재시작하세요.","i18n.reloading":"다시 불러오는 중...","i18n.packageRemoved":"패키지가 제거되었습니다.","i18n.packageInstalled":"패키지가 설치되었습니다.","i18n.packageUpdated":"패키지가 업데이트되었습니다.","i18n.packageDisabled":"패키지가 비활성화되었습니다.","i18n.packageDisabledRestartRequired":"비활성화 설정을 저장했습니다. 이미 불러온 Plugin은 CUELO를 재시작해야 멈춥니다. 세션 다시 불러오기로는 해제되지 않습니다.","i18n.packageEnabled":"패키지가 활성화되었습니다.","i18n.sessionReloaded":"세션을 다시 불러왔습니다.","i18n.thinking":"사고 과정","i18n.loadingThinking":"사고 과정 불러오는 중...","i18n.copyMessage":"메시지 복사","i18n.editFromHere":"여기서부터 편집","i18n.editFromHereTitle":"여기서부터 편집 — 이 세션 내에서 분기합니다","i18n.newSession":"새 세션","i18n.newSessionTitle":"새 세션 — 여기서부터 독립된 복사본을 만듭니다","i18n.estimatedTokens":"스트리밍 중 예상 Token 수","i18n.messageUsage":"사용량","i18n.messageUsageTitle":"이 메시지의 Token\xb7비용 보기","i18n.providerAnthropicSubscription":"Anthropic 구독","i18n.providerAnthropicApi":"Anthropic API","i18n.noOutput":"(출력 없음)","i18n.noSummary":"(요약 없음)","i18n.conversationCompacted":"대화가 압축됨","i18n.compactionDescription":"이 지점 이전의 대화 기록이 다음 요약으로 압축되었습니다:","i18n.fileContext":"파일 컨텍스트: {details}","i18n.readFiles":"읽은 파일","i18n.modifiedFiles":"수정된 파일","i18n.hiddenExtensionMessage":"숨겨진 확장 메시지","i18n.noMessage":"(메시지 없음)","i18n.showOriginalReply":"영어 원문 보기","i18n.hideOriginalReply":"영어 원문 접기","i18n.showInputTranslation":"영어 통역 보기","i18n.hideInputTranslation":"영어 통역 접기","i18n.showExtensionMessage":"확장 메시지 표시","i18n.collapse":"접기","i18n.expand":"펼치기","i18n.hideDetails":"세부 정보 숨기기","i18n.showDetails":"세부 정보 표시","i18n.thinkingUnavailable":"사고 내용을 사용할 수 없음","i18n.before":"이전","i18n.after":"이후","i18n.largeMessageReveal":"메시지 내용이 매우 큽니다 ({size}). 클릭하면 일반 텍스트로 표시합니다 — 페이지 반응성을 유지하기 위해 마크다운 렌더링은 비활성화됩니다.","i18n.sessionComplete":"세션 완료","i18n.taskFinished":"작업이 완료되었습니다.","i18n.attentionNeeded":"확인이 필요합니다","i18n.extensionInputNeeded":"확장이 입력을 기다립니다.","navigator.toolbar":"탐색 보기","navigator.priority":"우선순위","navigator.view":"{label} 보기","gpt6.boundBadge":"6PRO {handle}","gpt6.boundBadgeHint":"이 세션은 6 Pro 연결번호 {handle}에 묶여 있습니다.","usage.none":"사용량 —","usage.open":"사용량 자세히 보기: {rows}","usage.openMore":", 그 외 {count}개","usage.showMore":"나머지 {count}개 보기","usage.showLess":"접기","usage.accountBlocked":"자동 차단","usage.accountSpent":"계정 한도 소진","usage.limitSpent":"한도 소진","usage.bai":"B.AI 누적토큰","usage.baiEmpty":"기록 없음","usage.baiRange":"집계 {from}~{to}","usage.baiUnmeasured":"미측정","usage.title":"사용량","usage.reorder":"순서 편집","usage.reorderDone":"완료","usage.reorderGroup":"계정 표시 순서","usage.moveUp":"{account} 위로","usage.moveDown":"{account} 아래로","usage.moved":"{account}: {position}번째로 이동","usage.authExpired":"인증 만료","usage.authUnavailable":"사용 불가","usage.relogin":"재로그인","usage.reloginFor":"{account} 계정 재로그인","usage.authIssues":"계정 오류 {count}","relogin.title":"재로그인 대상","relogin.guide":"「{action}」을 누른 뒤 브라우저에서 이 계정으로 로그인하세요. 다른 계정으로 로그인하면 이 계정의 오류는 그대로 남습니다.","relogin.done":"로그인을 마쳤습니다.","relogin.checking":"{account} 상태를 확인하려고 사용량을 다시 읽는 중…","relogin.recovered":"{account} 계정 인증이 복구됐습니다.","relogin.stillFailing":"로그인은 끝났지만 {account} 계정은 아직 인증 오류입니다. 다른 계정으로 로그인했을 수 있습니다.","relogin.unknown":"사용량에서 {account} 계정을 찾지 못해 복구 여부를 확인하지 못했습니다.","efficiency.title":"효율","efficiency.governor":"실행 통제","efficiency.lab":"구성 비교","efficiency.refresh":"새로고침","efficiency.refreshing":"불러오는 중…","efficiency.noSession":"세션을 선택하면 실행 기록을 볼 수 있습니다.","efficiency.loadingRuns":"실행 목록을 불러오는 중…","efficiency.runsEmpty":"이 세션에 기록된 실행이 없습니다.","efficiency.runsError":"실행 목록을 불러오지 못했습니다.","efficiency.selectRun":"실행을 고르면 역할\xb7병목\xb7미측정 공백을 볼 수 있습니다.","efficiency.loadingDetail":"실행 상세를 불러오는 중…","efficiency.detailError":"실행 상세를 불러오지 못했습니다.","efficiency.noTitle":"제목 없는 요청","efficiency.elapsed":"경과","efficiency.busyTotal":"생성시간 합","efficiency.noSumNote":"경과와 생성시간 합은 나란히만 두고 더하지 않습니다.","efficiency.summarySection":"요약","efficiency.rolesSection":"역할","efficiency.rolesEmpty":"이 실행에서 요청을 처리한 역할이 없습니다.","efficiency.bottlenecksSection":"병목","efficiency.bottlenecksEmpty":"측정된 병목이 없습니다.","efficiency.toolsSection":"도구 호출","efficiency.unmeasuredGap":"원인 미측정 공백","efficiency.elapsedValue":"경과 {value}","efficiency.estimatedCostValue":"추정 {value}","efficiency.estimatedCost":"추정 비용","efficiency.untimedLowerBound":"소요시간이 기록되지 않은 요청 {value}건 — 생성시간은 하한입니다.","efficiency.bottleneckOrderNote":"관측된 크기가 큰 순서입니다. 막대는 1위 대비 길이이며 경과시간 대비가 아닙니다.","efficiency.untimedRuns":"소요시간 미기록 run","efficiency.untimedMedianLowerBound":"소요시간이 기록되지 않은 요청이 있는 run {value}건 — 생성시간 중앙값은 하한입니다.","efficiency.unpricedLowerBound":"가격 미기록 포함 — 하한","efficiency.mixedPairingNote":"혼합 구성: 요청별 모델\xb7추론 강도 조합과 순서는 확인되지 않았습니다. 같은 조건의 실행으로 단정할 수 없습니다.","efficiency.unmeasuredShort":"미측정","efficiency.effortLabel":"effort {value}","efficiency.requestsValue":"요청 {value}회","efficiency.toolCallsValue":"도구 호출 {value}회","efficiency.busyTime":"생성시간","efficiency.tokens":"토큰","efficiency.unpricedRequests":"가격 미기록 요청","efficiency.firstTokenAvg":"첫 응답 대기(평균)","efficiency.firstTokenPartial":"첫 응답 대기는 기록된 요청 {recorded}/{total}건의 평균입니다.","efficiency.outputTokens":"대화 출력 토큰","efficiency.helpersTitle":"보조 모델 호출","efficiency.helperCallsValue":"{count}회 \xb7 출력 {output} \xb7 합계 {tokens} \xb7 {cost}","efficiency.helpersIncludedNote":"보조 호출의 토큰\xb7비용은 위 토큰\xb7추정 비용 합계에 들어 있고, 요청 수\xb7첫 응답 대기\xb7대화 출력 토큰에서는 빠집니다.","efficiency.toolFailedValue":"실패 {value}","efficiency.toolNoMatchValue":"무일치 {value}","efficiency.toolCancelledValue":"중단 {value}","efficiency.unmeasuredGapValue":"원인 미측정 공백 {value}","efficiency.roleMain":"Main","efficiency.roleMaker":"Maker","efficiency.roleChecker":"Checker","efficiency.roleAdvisor":"Advisor","efficiency.roleUnattributed":"미배정","efficiency.purposePrimary":"Primary","efficiency.purposeRework":"Rework","efficiency.purposeReview":"Review","efficiency.outcomeCompleted":"완료","efficiency.outcomeError":"오류","efficiency.outcomeAborted":"중단됨","efficiency.outcomeInterrupted":"요청으로 끊김","efficiency.outcomeRunning":"실행 중","efficiency.folder":"폴더","efficiency.folderAll":"전체 폴더","efficiency.folderPlaceholder":"폴더로 걸러보기, Enter로 적용","efficiency.loadingExperiments":"구성 비교를 불러오는 중…","efficiency.experimentsEmpty":"비교할 구성이 기록되지 않았습니다.","efficiency.experimentsError":"구성 비교를 불러오지 못했습니다.","efficiency.difficultyNote":"작업 난이도는 보정되지 않음","efficiency.runsValue":"실행 {value}회","efficiency.medianElapsed":"경과 중앙값","efficiency.medianBusy":"생성시간 중앙값","efficiency.medianTokens":"토큰 중앙값","efficiency.medianEstimatedCost":"추정 비용 중앙값","efficiency.totalEstimatedCost":"추정 비용 합","efficiency.reworkRate":"재작업률","efficiency.errorRate":"오류율","efficiency.unpricedRuns":"가격 미기록 run","efficiency.scopeAttributed":"현재 역할 체계만","efficiency.scopeAll":"전체 기록","efficiency.scopeSessions":"집계 세션","efficiency.scopeRuns":"집계 run","efficiency.scopeExcludedRuns":"제외된 run","efficiency.harness":"하네스","efficiency.harnessValue":"하네스 {value}","efficiency.harnessUnknown":"unknown","efficiency.harnessAll":"모든 하네스","efficiency.groupByHarness":"하네스별로 나누기","efficiency.harnessNote":"하네스는 run 시작 시점에 설치돼 있던 CUELO 버전입니다. 이 PC의 업데이트 기록으로만 정하며, 기록이 없거나 기록 밖에서 바뀐 구간은 unknown입니다.","efficiency.sawSection":"모델이 본 것","efficiency.sawApproxNote":"세션 기록으로 다시 맞춘 근사치입니다. 요청마다 보낸 시스템 프롬프트와 컨텍스트 훅이 바꾼 내용은 기록에 남지 않습니다.","efficiency.sawOpen":"요청별로 보기","efficiency.sawLoading":"요청 기록을 읽는 중…","efficiency.sawError":"요청 기록을 읽지 못했습니다.","efficiency.sawEmpty":"이 run에는 모델 요청 기록이 없습니다.","efficiency.sawFilterEmpty":"주입이 있는 요청이 없습니다.","efficiency.sawRole":"대화 기록","efficiency.sawSummary":"요청 {turns}회 \xb7 주입 {injections}건 \xb7 도구 {tools}회 \xb7 실패 {failed}건","efficiency.sawOnlyInjected":"주입 있는 요청만","efficiency.sawTurnLabel":"요청 {index}","efficiency.sawBefore":"이 요청 전에 들어온 것","efficiency.sawTrailing":"마지막 요청 뒤에 들어온 것 (이 run의 모델 요청에는 들어가지 않음)","efficiency.sawShowFull":"전체 보기","efficiency.sawShowArgs":"인자 보기","efficiency.sawShowResult":"결과 보기","efficiency.sawHideFull":"접기","efficiency.sawTruncated":"앞 {value}자만 보입니다.","efficiency.sawMore":"{value}개 더 보기","efficiency.sawShown":"{total}개 중 {shown}개 표시","efficiency.sawHiddenFromChat":"채팅에는 안 보임","efficiency.sawNotSent":"모델에 안 보냄","efficiency.sawSecretsMasked":"비밀값처럼 보이는 문자열은 [REDACTED]로 가렸습니다.","efficiency.sawKindInjection":"주입","efficiency.sawKindDeveloper":"개발자 메시지","efficiency.sawKindUser":"사용자 메시지","efficiency.sawKindCompaction":"압축","efficiency.sawKindModel":"모델 변경","efficiency.sawKindEffort":"effort 변경","efficiency.sawKindPrompt":"시스템 프롬프트 바뀜","efficiency.sawKindRules":"규칙 주입","efficiency.sawKindMemory":"기억 회상","efficiency.sawCompactionValue":"{before} → {after} 토큰","efficiency.sawMemoryIds":"기억 {value}건 회상 (본문은 기록되지 않음)","efficiency.sawToolOk":"성공","efficiency.sawToolFailed":"실패","efficiency.sawToolNoMatch":"일치 없음","efficiency.sawToolCancelled":"중단","efficiency.sawToolMissing":"결과 없음","efficiency.sawResultChars":"결과 {value}자","efficiency.sawUsage":"입력 {input} \xb7 출력 {output} \xb7 캐시 읽기 {cacheRead}","efficiency.sawStop":"종료: {value}","efficiency.sawToolsChanged":"도구 목록 변경: +{added} −{removed}","efficiency.sawPreludeTitle":"시스템 프롬프트와 도구","efficiency.sawPreludeRecorded":"기록된 것","efficiency.sawPreludeTools":"마지막 요청에 켜진 도구 {value}개 (기록됨)","efficiency.sawPreludeDigest":"시스템 프롬프트 지문: {value}","efficiency.sawPreludeDigestNone":"이 run 시점의 시스템 프롬프트 지문이 기록에 없습니다.","efficiency.sawPreludeMemory":"기억 회상 블록 (시스템 프롬프트의 일부, 기록됨)","efficiency.sawPreludeReconstruct":"지금 설정으로 다시 만들기","efficiency.sawPreludeLoading":"다시 만드는 중…","efficiency.sawPreludeApprox":"지금 설정으로 다시 만든 것이며 보낸 그대로가 아닙니다.","efficiency.sawPreludeNotLoaded":"이 세션이 지금 열려 있지 않아 다시 만들 수 없습니다. 시스템 프롬프트 본문은 기록되지 않습니다.","efficiency.sawPreludeMatch":"지금 프롬프트의 지문이 이 run의 기록과 같습니다.","efficiency.sawPreludeMismatch":"지금 프롬프트의 지문이 이 run의 기록과 다릅니다. 그사이 바뀌었을 수 있습니다.","toolRun.running":"실행 중","toolRun.failed":"실패","toolRun.exitCode":"exit {code}","toolRun.diffStats":"{added}줄 추가, {removed}줄 삭제","toolRun.askTimedOut":"시간 안에 답이 없어 입력된 값이 제출되었습니다.","panel.expand":"패널 넓게 보기","panel.restore":"원래 크기로","panel.more":"더 보기","panel.liveSync":"실시간 반영","panel.subagentsCount":"기록 {count}건","panel.refresh":"기록 새로고침","panel.close":"패널 닫기","pluginLab.counts":"플러그인 {count}개","pluginLab.refresh":"목록 새로고침","pluginLab.create":"새 플러그인 만들기","pluginLab.createHint":"요청을 입력창에 넣습니다. 다듬어서 보내세요.","pluginLab.starter":"plugin-lab 스킬로 내 프로필에 쓸 플러그인을 하나 만들어 줘.\\n- 하려는 일: \\n- 필요한 도구: \\n- 패널에 보여 줄 내용(없으면 비워 둠): \\n저장소 정식 폴더에 바로 만들고 이번 턴에 리뷰, 버전, CI, 배포까지 끝내 줘.","pluginLab.loading":"플러그인 목록을 불러오는 중…","pluginLab.loadFailed":"플러그인 목록을 불러오지 못했습니다: {error}","pluginLab.retry":"다시 불러오기","pluginLab.empty":"아직 플러그인이 없습니다. 「새 플러그인 만들기」로 요청을 입력창에 넣어 보세요.","pluginLab.listLabel":"플러그인 목록","pluginLab.on":"켜짐","pluginLab.off":"꺼짐","pluginLab.toggleLabel":"{name} 사용","pluginLab.toggleFailed":"상태를 바꾸지 못했습니다: {error}","pluginLab.tools":"도구","pluginLab.enhancements":"보강 이력","pluginLab.enhancementDateHint":"기록 시각","pluginLab.showAllEnhancements":"전체 {count}개 보기","pluginLab.showFewerEnhancements":"접기","pluginLab.problem":"문제","pluginLab.openPanel":"패널 열기","pluginLab.openPanelLabel":"{name} 패널 열기","pluginLab.back":"플러그인 목록으로","pluginLab.panelSubtitle":"격리 실행 \xb7 lab:{id}","pluginLab.frameTitle":"{name} 패널","pluginLab.lines":"에이전트 데이터 {count}줄","pluginLab.noLines":"이 세션에서 받은 에이전트 데이터 없음","pluginLab.draftInserted":"패널이 만든 초안을 입력창에 넣었습니다. 확인하고 보내세요.","pluginLab.applyHint":"도구 변경은 새 세션이나 /reload 뒤에 적용됩니다.","pluginLab.noComposer":"대화를 열어야 입력창에 넣을 수 있습니다.","pluginLab.draftNotRecorded":"초안은 입력창에 넣었지만 사용 기록은 남기지 못했습니다.","pluginLab.saving":"바꾸는 중…","makerDetail.region":"{title} 기록","makerDetail.noFiles":"이 Maker는 파일을 바꾸지 않았습니다","makerDetail.noChecks":"검사 실행 없음","makerDetail.archiveUnobserved":"기록에 도구 결과가 없어 확인할 수 없습니다","makerDetail.unavailable":"이 시도와 정확히 맞는 실행 기록이 없어 상세를 열 수 없습니다","makerDetail.checkPassed":"통과","makerDetail.checkUnverified":"판정 미확인","makerDetail.checkFailed":"실패","makerDetail.checkUnobserved":"결과 미관측","dispatchLane.label":"Maker 시도","dispatchLane.runPhase":"{run}({phase})","dispatchLane.checks":"검사 {passed}/{total}","dispatchLane.checksUnobserved":"검사 미관측","dispatchLane.checksLoading":"검사 읽는 중","dispatchLane.attempt":"시도 {attempt}","dispatchLane.attemptUnknown":"시도","dispatchLane.verdict.accepted":"수용","dispatchLane.verdict.rework":"재작업","dispatchLane.verdict.held":"보류","dispatchLane.open":"자세히","dispatchLane.openLabel":"{title} 자세히 보기","dispatchLane.unavailable":"상세 없음","credits.heading":"API 크레딧","credits.estimateNote":"결제 화면 잔액은 표시된 시각에 직접 확인해 적어 둔 값이라 이후 사용량은 빠져 있습니다. 추정 사용량과 추정 잔액은 이 PC의 토큰 수에 공개 단가를 곱한 어림값이며 청구서 금액이 아닙니다.","credits.loading":"API 크레딧 불러오는 중…","credits.loadFailed":"API 크레딧을 불러오지 못했습니다: {reason}","credits.wallet.hive":"Hive","credits.scope.hive":"이 PC 기록","credits.since":"{date}부터","credits.sinceDefault":"최근 30일","credits.total":"총액","credits.spent":"추정 사용","credits.remaining":"추정 잔액","credits.meterLabel":"{wallet} 크레딧 사용","credits.usedPct":"사용 {pct}%","credits.enterPrompt":"총액과 시작일을 넣으면 추정 잔액을 계산합니다.","credits.enter":"크레딧 입력","credits.edit":"수정","credits.formLabel":"{wallet} 크레딧","credits.totalUsd":"총액(USD)","credits.startDate":"시작일","credits.save":"저장","credits.saving":"저장 중…","credits.cancel":"취소","credits.clear":"지우기","credits.saveFailed":"저장하지 못했습니다: {reason}","credits.invalid.total":"총액을 숫자로 넣어 주세요.","credits.error.invalid_total":"총액은 0보다 큰 숫자여야 합니다","credits.error.invalid_start_date":"시작일을 확인하세요","credits.error.start_date_in_future":"시작일이 미래입니다","credits.error.session_scan_failed":"세션 기록을 읽지 못했습니다","credits.error.session_scan_partial":"일부 세션 기록을 읽지 못해 추정 사용이 실제보다 적을 수 있습니다","credits.error.internal":"예상하지 못한 오류가 났습니다","credits.error.settings_unreadable":"크레딧 설정 파일을 읽지 못해 덮어쓰지 않았습니다","credits.walletError":"사용량을 읽지 못했습니다: {reason}","credits.settingsError":"크레딧 설정 파일을 읽지 못했습니다. 다시 입력해 주세요.","credits.tokens":"입력 {input} \xb7 출력 {output}","credits.cacheTokens":"캐시 {cache}","credits.requests":"{count}회","credits.priceUnknown":"단가 미상","credits.purpose.session":"대화\xb7에이전트","credits.purpose.memory":"기억","credits.purpose.korean-reply-translation":"답변 번역","credits.wallet.anthropic":"Anthropic API","credits.billingLink":"실제 잔액 보기","credits.billingLinkLabel":"{wallet} 결제 화면에서 실제 잔액 보기(새 탭)","credits.scope.anthropic":"이 PC 기록","credits.anthropic.note":"토큰이 기록된 API 키 요청만 집계하며 구독(OAuth) 요청과 토큰 없는 실패는 제외합니다. 금액은 공개 단가 기준 추정치이며 청구서나 잔액이 아닙니다.","credits.anthropic.noCoverage":"이 기간에 인증 방식이 기록된 요청이 없어 API 키 사용량을 알 수 없습니다.","credits.anthropic.coverageSince":"인증 방식 최초 기록: {date} (이후 모든 요청의 기록을 보장하지는 않습니다)","credits.anthropic.none":"이 기간에 기록된 API 키 요청이 없습니다.","credits.anthropic.oauthExcluded":"구독(OAuth) 제외","credits.anthropic.unattributedExcluded":"인증 미기록 제외","credits.category.input":"입력","credits.category.output":"출력","credits.category.cacheRead":"캐시 읽기","credits.category.cacheWrite":"캐시 쓰기","credits.balance.label":"결제 화면 잔액","credits.balance.source":"직접 기록","credits.balance.observed":"{time} 확인","credits.balance.age.now":"방금","credits.balance.age.minutes":"{count}분 전","credits.balance.age.hours":"{count}시간 전","credits.balance.age.days":"{count}일 전","credits.balance.none":"기록된 잔액 없음","credits.balance.record":"잔액 기록","credits.balance.edit":"잔액 변경","credits.balance.formLabel":"{wallet} 결제 화면 잔액","credits.balance.amount":"잔액(USD)","credits.balance.observedAt":"확인 시각","credits.balance.observedAtHint":"제공자 결제 화면에서 잔액을 확인한 시각입니다.","credits.invalid.amount":"잔액을 숫자로 넣어 주세요.","credits.invalid.observedAt":"확인 시각을 넣어 주세요.","credits.error.invalid_balance":"잔액은 0 이상의 숫자여야 합니다","credits.error.invalid_observed_at":"확인 시각을 확인하세요","credits.error.observed_at_in_future":"확인 시각이 지금보다 늦습니다","credits.error.routes_unreadable":"설정 파일을 읽지 못해 사용 중인 API를 확인할 수 없습니다","credits.wallet.exa":"Exa","credits.wallet.typesafe":"TypeSafe Jev","credits.route.hive":"모델 역할(기억\xb7skim 등)에 배정됨","credits.route.exa":"기본 웹 검색 경로","credits.route.typesafe":"기본 빠른 판정(Jev) 경로","credits.route.anthropic":"구독 주간 한도를 다 쓰면 쓰는 API 키 대체 경로","credits.evidence.lastPaidUse":"이 PC 마지막 유료 사용: {time}","credits.evidence.unverified":"일부 세션 기록을 읽지 못해 최근 유료 사용을 확인하지 못했습니다.","routines.tab":"루틴","routines.title":"루틴 갤러리","routines.back":"대화로","routines.panelIntro":"정한 시각에 새 세션이 돌고, 마지막 답이 루틴 게시판에 글로 올라옵니다.","routines.galleryIntro":"루틴 하나가 갤러리 하나입니다. 글은 공용 저장소에서 읽어 와서 집과 클라우드에서 똑같이 보입니다.","routines.galleryList":"갤러리 목록","routines.new":"새 루틴","routines.col.gallery":"갤러리","routines.col.schedule":"일정","routines.col.host":"실행 PC","routines.col.posts":"글","routines.col.latest":"최근 글","routines.col.no":"번호","routines.col.title":"제목","routines.col.author":"글쓴이","routines.col.date":"작성일","routines.off":"꺼짐","routines.on":"켜짐","routines.turnOff":"끄기","routines.turnOn":"켜기","routines.toggledOff":"「{name}」 루틴을 껐습니다. 다른 PC는 다음 동기화(5분 안) 때 받습니다.","routines.toggledOn":"「{name}」 루틴을 켰습니다. 다른 PC는 다음 동기화(5분 안) 때 받습니다.","routines.hostNote":"이 루틴은 {host}에서 돕니다. 켜고 끈 것은 다른 PC에 다음 동기화(5분 안) 때 닿습니다.","routines.enabledCount":"켜진 루틴 {on}개 / 전체 {total}개","routines.filter.all":"전체 {count}","routines.filter.on":"켜짐 {count}","routines.filter.off":"꺼짐 {count}","routines.col.state":"상태","routines.col.next":"다음 실행","routines.col.toggle":"켜고 끄기","routines.nextRun":"다음 실행 {time}","routines.lastRun":"마지막 실행 {time}, {result}","routines.lastRun.ok":"글 올림","routines.lastRun.quiet":"알릴 것 없음","routines.lastRun.failed":"실패","routines.lastRun.timeout":"시간 초과","routines.noRunYet":"아직 실행 기록 없음","routines.newPosts":"새 글 {count}","routines.newMark":"N","routines.newMarkLabel":"새 글","routines.markAllRead":"전체 읽음 표시","routines.expandPost":"글 전체 보기","routines.details":"자세히 보기","routines.detailsHide":"자세히 접기","routines.deletedElsewhere":"이 루틴은 지워졌습니다. 다른 PC에서 지웠을 수 있습니다.","routines.networkError":"요청을 보내지 못했습니다: {error}","routines.koreaTime":"한국 시각","routines.sched.weekly":"{days} {times}","routines.sched.hourlyOne":"매시 {minute}분","routines.sched.hourlyN":"{every}시간마다 {minute}분 ({start}시 {minute}분부터)","routines.sched.withDays":"{days} {rest}","routines.sched.once":"{date} {time} 한 번","routines.running":"실행 중","routines.status.failed":"실패","routines.status.timeout":"시간 초과","routines.tabAll":"전체글 {count}","routines.tabFailed":"실패 {count}","routines.runNow":"지금 실행","routines.runHere":"이 PC에서 지금 실행","routines.runHereHint":"지금 실행은 이 PC({host})에서 돌아갑니다","routines.runStarted":"이 PC에서 실행을 시작했습니다. 끝나면 글이 올라옵니다.","routines.settings":"설정","routines.everyDay":"매일","routines.weekdays":"평일","routines.day.0":"일","routines.day.1":"월","routines.day.2":"화","routines.day.3":"수","routines.day.4":"목","routines.day.5":"금","routines.day.6":"토","routines.metaHost":"실행 PC {host}","routines.metaCwd":"폴더 {cwd}","routines.noPosts":"아직 올라온 글이 없습니다.","routines.noPostsNext":"첫 글은 다음 실행({time}) 뒤에 올라옵니다.","routines.noPostsOff":"꺼져 있어 예약 실행이 없습니다. 지금 실행으로 한 편 올릴 수 있습니다.","routines.noFailed":"실패한 글이 없습니다.","routines.empty":"아직 루틴이 없습니다.","routines.emptyHint":"루틴을 만들면 정한 요일과 시각에 새 세션이 돌고, 그 답이 루틴 게시판에 글로 올라옵니다.","routines.setupTitle":"루틴 저장소를 찾지 못했습니다","routines.setupMissing":"{dir} 폴더가 없습니다.","routines.setupNotGit":"{dir} 폴더가 git 저장소가 아닙니다.","routines.setupBody":"루틴과 글은 이 저장소에 쌓이고 집과 클라우드가 함께 씁니다. 비공개 저장소를 그 경로에 clone하거나, 다른 경로라면 CUELO_ROUTINES_DIR로 지정한 뒤 다시 읽으세요.","routines.reload":"다시 읽기","routines.sync.ok":"동기화 {time}","routines.sync.never":"아직 동기화하지 않음","routines.sync.syncing":"동기화 중","routines.sync.pending":"보낼 커밋 {count}개","routines.sync.nothing":"보낼 커밋 없음","routines.sync.error":"동기화 오류: {error}","routines.openSession":"세션 열기","routines.postAuthor":"글쓴이 {host}","routines.loadFailed":"불러오지 못했습니다: {error}","routines.postMissing":"글을 찾지 못했습니다.","routines.form.newTitle":"새 루틴","routines.form.editTitle":"루틴 설정","routines.form.name":"이름","routines.form.days":"요일","routines.form.time":"시각","routines.form.host":"실행 PC","routines.form.hostHint":"이 PC는 {host}입니다. 예약 실행은 여기 적은 PC에서만 돌아갑니다.","routines.form.model":"루틴 Main 모델","routines.form.modelPlaceholder":"PC 기본값 사용","routines.form.modelHint":"선택 사항입니다. provider/model-id 형식으로 덮어쓸 수 있으며, 실행 호스트에 존재하는 모델이어야 합니다. 플러그인이 비활성화되면 이 값은 무시됩니다.","routines.form.cwd":"프로젝트 폴더","routines.form.cwdPlaceholder":"비우면 루틴 저장소의 이 루틴 폴더에서 실행","routines.form.cwdHint":"실행 PC 기준 경로입니다. 그 PC에 없으면 그 회차는 실패 글로 남습니다.","routines.form.prompt":"지시문","routines.form.enabled":"사용","routines.form.enabledLabel":"예약대로 실행","routines.form.enabledHint":"끄면 예약만 멈추고 글은 그대로 남습니다.","routines.form.cancel":"취소","routines.form.save":"저장","routines.form.saving":"저장 중…","routines.form.deleteText":"루틴을 지우면 이 갤러리의 글 {count}개도 함께 지워집니다. git 기록에는 남습니다.","routines.form.delete":"루틴 삭제","routines.form.deleteConfirm":"「{name}」 루틴과 글 {count}개를 지웁니다. git 기록에는 남습니다. 지울까요?","routines.form.daysRequired":"요일을 하나 이상 고르세요.","routines.form.timesRequired":"시각을 하나 이상 넣으세요.","routines.form.schedule":"일정","routines.form.kind.weekly":"요일과 시각","routines.form.kind.hourly":"몇 시간마다","routines.form.kind.once":"한 번","routines.form.times":"시각","routines.form.newTime":"더할 시각","routines.form.addTime":"시각 추가","routines.form.removeTime":"{time} 빼기","routines.form.interval":"간격","routines.form.everyHours":"실행 간격","routines.form.everyHoursOption":"{n}시간마다","routines.form.minute":"분","routines.form.startHour":"시작 시","routines.form.hourlyDaysHint":"요일을 모두 고르면 매일 돕니다.","routines.form.when":"언제","routines.form.date":"날짜","routines.form.onceHint":"그 시각에 한 번 돌고 나면 저절로 꺼집니다.","routines.form.quietHint":"알릴 것이 없는 회차는 세션이 답을 [알림 없음]으로 시작하고, 글을 올리지 않습니다.","inspector.label":"인스펙터","inspector.views":"인스펙터 보기","inspector.more":"다른 보기","inspector.hide":"인스펙터 닫기","inspector.show":"인스펙터 열기","inspector.turn":"이번 턴","inspector.noTurn":"아직 턴이 없습니다.","inspector.backToChat":"대화로 돌아가기","workbench.places":"장소","workbench.runningCount":"실행 중 {count}","workbench.needsInput":"입력 필요","workbench.needsInputCount":"입력 필요 {count}","navigator.group.input":"입력 필요","navigator.group.running":"실행 중","navigator.group.done":"끝남"}'),a=["en","ko"],l=new Map;function o(e){if(!e.id.trim())throw Error("Locale id must not be empty");if(l.has(e.id))throw Error(`Locale already registered: ${e.id}`);l.set(e.id,e)}function c(){return[...l.keys()]}o({id:"en",label:"English",messages:{"resource.reset.use":"Use reset","resource.reset.unavailable":"Unavailable now","resource.reset.summary":"Reset to use: {name}","resource.reset.covers":"Limits to clear: {limits}","resource.reset.includedOverage":"Included overage","resource.reset.mismatch":"Requested reset: {requested}. Server consumed reset: {consumed}. Did not retry automatically.","resource.reset.rejection":"Failed to use reset: {code}. {reason}","resource.reset.name.full":"Full reset","resource.reset.name.fable":"Fable reset","resource.reset.name.fiveHour":"5-hour reset","resource.reset.name.generic":"Reset","resource.reset.window.fiveHour":"5h","resource.reset.window.weekly":"Weekly","resource.reset.chip.nextUse":"Next use","savedPrompts.title":"Saved prompts","savedPrompts.loading":"Loading...","savedPrompts.empty":"No saved prompts","savedPrompts.save":"Save current input as prompt","savedPrompts.saved":"Saved","savedPrompts.delete":"Delete","savedPrompts.confirmDelete":"Delete?","savedPrompts.cancel":"Cancel","savedPrompts.hint":"Type text then // to save. Variables: {{project_name}} {{session_name}} {{cwd}} {{date}}","savedPrompts.error":"Saved prompt request failed: {error}","cloudProjects.launch":"Open GitHub repository","cloudProjects.title":"Cloud project","cloudProjects.description":"Bring a GitHub repository to this server and keep working.","cloudProjects.github":"GitHub repositories","cloudProjects.serverFolder":"Open server folder","cloudProjects.account":"GitHub connection","cloudProjects.connectTitle":"Connect your GitHub repositories","cloudProjects.connectHelp":"Sign in to select private repositories from your list.","cloudProjects.connected":"Connected to GitHub","cloudProjects.refresh":"Check again","cloudProjects.waiting":"Waiting for sign-in","cloudProjects.connect":"Connect GitHub","cloudProjects.deviceHelp":"Enter this code on the GitHub sign-in page.","cloudProjects.copyCode":"Copy code","cloudProjects.copied":"Copied","cloudProjects.copyFailure":"Could not copy the code. Select and copy it manually.","cloudProjects.openLogin":"Sign in on GitHub","cloudProjects.permissionHelp":"Check the account and requested permissions on GitHub before approving. Tokens stay on the server.","cloudProjects.preparingCode":"Preparing your sign-in code.","cloudProjects.repositories":"Your repositories","cloudProjects.search":"Find a repository","cloudProjects.searchPlaceholder":"Search by name or description","cloudProjects.loading":"Loading repositories.","cloudProjects.private":"Private","cloudProjects.public":"Public","cloudProjects.empty":"No matching repositories. Try another name or enter a URL.","cloudProjects.more":"Show more","cloudProjects.urlLabel":"Selected repository or GitHub URL","cloudProjects.publicHelp":"Public repositories do not require sign-in. Existing workspaces are reopened without changing your files.","cloudProjects.error":"Could not complete the operation.","cloudProjects.openingHelp":"Importing the repository to this server. Large repositories may take a while.","cloudProjects.opening":"Opening project","cloudProjects.open":"Open project","common.ok":"OK","common.language":"Language","common.models":"Models","common.skills":"Skills","common.plugins":"Plugins","common.settings":"Settings","updates.available":"CUELO update available","updates.availableTitle":"CUELO {version} is available","updates.dialogEyebrow":"CUELO release","updates.dialogTitle":"New CUELO version","updates.current":"Running CUELO {version}","updates.changelog":"Changelog","updates.viewRelease":"View release","updates.manual":"Running from source? Stop the server first, run this update command, then start it again. If you use a custom --home path, pass the same --home option to setup.","updates.copyCommand":"Copy command","updates.commandCopied":"Command copied","updates.copyFailed":"Unable to copy the command","updates.apply":"Update now","updates.applyBusy":"Updating…","updates.applyConfirm":"Update CUELO to {version} and restart?\n\nThe server stops for a moment while it updates, and this panel shows the progress. The page reloads by itself when the new version answers.","updates.applyConfirmBusy":"Update CUELO to {version} and restart?\n\n{count} running session(s) will be interrupted and the server stops for a moment. This panel shows the progress, and the page reloads by itself when the new version answers.","updates.unsupported":"This installation cannot be updated from the app. Use the command below.","updates.unsupportedReason":"Detected: {reason}","updates.phase.starting":"Preparing the update","updates.phase.fetching":"Fetching the new version","updates.phase.installing":"Installing the package","updates.phase.building":"Building","updates.phase.restarting":"Restarting the server","updates.phase.done":"Update complete","updates.phase.handed-off":"Handed off to the service update","updates.phase.restart-required":"Installed. Restart CUELO yourself.","updates.phase.failed":"Update failed","updates.waitingForRestart":"Waiting for the server to come back. The page reloads when the new version answers.","updates.handedOff":"The WSL service update runs in its own wait screen. This page reloads when it finishes.","updates.logPath":"Log: {path}","updates.applyStartFailed":"Could not start the update: {reason}","sidebar.hide":"Hide sidebar","sidebar.show":"Show sidebar","theme.light":"Light mode (click for dark)","theme.dark":"Dark mode (click for system)","theme.auto":"System theme (click for light)","theme.graphite":"Graphite theme (wallpaper)","theme.graphiteHint":"Graphite surfaces with a wallpaper for the current character mode. Dark mode only, saved in this browser.","history.full":"Full history","history.unsaved":"Full history is available after the session is saved","history.label":"Full history","title.generating":"Generating...","title.updated":"Title updated","title.failed":"Generation failed","title.generate":"Generate title","title.unsaved":"Title generation is available after the session is saved","title.noMessages":"Send a message before naming this session","title.generateSession":"Generate a session title","system.prompt":"System prompt","system.empty":"System prompt is empty (tools are disabled)","system.load":"Send a message to load the system prompt","system.label":"System","session.info":"Session info","session.name":"Name","session.file":"File","session.inMemory":"In-memory","session.id":"ID","session.user":"User","session.assistant":"Assistant","session.toolCalls":"Tool Calls","session.toolResults":"Tool Results","session.total":"Total","session.input":"Input","session.output":"Output","session.cacheRead":"Cache Read","session.cacheWrite":"Cache Write","session.cost":"Cost","session.context":"Context","session.cacheHitRate":"Avg cache hit rate","session.copy":"Copy {value}","session.copied":"Copied","session.title":"Session info","session.load":"Send a message or run /session to load session info","session.infoSection":"Session Info","session.messages":"Messages","session.tokens":"Tokens","session.totalActive":"Active Time","session.copyFile":"Copy file path","session.copyId":"Copy session ID","workspace.opening":"Opening workspace...","workspace.unable":"Unable to open workspace","workspace.selectSession":"Select a session from the sidebar","workspace.getStarted":"Get Started","workspace.selectProject":"Select a project directory from the sidebar","workspace.addModels":"Add models via the Models button at the bottom","workspace.stepProject":"Select a project directory from the sidebar","workspace.stepModels":"Add models via the Models button at the bottom","workspace.mainWorking":"Working","workspace.mainWaiting":"Waiting","workspace.mainIdle":"Idle","workspace.mainAttention":"Input needed","files.hidePanel":"Hide file panel","files.showPanel":"Show file panel","files.noneOpen":"No file open","files.docs.noProject":"Select a project to see its documents.","files.docs.loading":"Looking for project documents…","files.docs.projectDenied":"This project folder is outside the folders CUELO may read.","files.docs.loadFailed":"Could not load project documents: {error}","files.docs.projectDir":"Project folder: {path}","files.docs.noneFound":"No HANDOFF.md up to the repository root, and no doc/README.md or doc/history in this folder.","files.docs.current":"Current state","files.docs.map":"Document map","files.docs.records":"Recent records","files.docs.missing":"{file} not found","files.docs.denied":"{file} is outside the readable folders","layout.resizeSidebar":"Resize sidebar","layout.resizeFilePanel":"Resize file panel","layout.resizeHint":"Drag to resize. Double-click or press Enter to reset.","sidebar.new":"New","sidebar.newSessionTitle":"New session in {path}","sidebar.refresh":"Refresh","sidebar.projects":"Projects","subagents.title":"Subagents","subagents.running":"Running","subagents.finished":"Finished","subagents.history":"History","subagents.runningCount":"{count} running","subagents.finishedCount":"{count} finished","subagents.failed":"Failed","subagents.aborted":"Aborted","subagents.back":"Back to subagents","subagents.retrying":"Retrying {attempt}/{max}","subagents.usingTool":"Using {tool}","subagents.details":"Subagent execution details","subagents.closeDetails":"Close subagent details","subagents.noTask":"No task description","subagents.tools":"{count} tools","subagents.tokens":"{count} tokens","subagents.loadingTranscript":"Loading live transcript…","subagents.noTranscript":"The subagent has not written any transcript messages yet.","subagents.transcriptUnavailable":"Live transcript is not available yet. Retrying while the subagent runs.","sidebar.searchProjectsAndSessions":"Search projects and session titles…","sidebar.addProject":"Add custom project path","sidebar.projectActions":"Project actions","sidebar.projectAlias":"Alias","sidebar.projectAliasEdit":"Edit alias","sidebar.projectHide":"Hide","sidebar.projectUnhide":"Unhide","sidebar.projectShowHidden":"Show hidden projects","sidebar.temporaryProjects":"Temporary / system paths","sidebar.projectMoveUp":"Move up","sidebar.projectMoveDown":"Move down","sidebar.projectMoveDisabledWhileFiltering":"Clear the search filter to reorder projects","sidebar.projectUpdateFailed":"Unable to save project changes. Try again.","sidebar.expandProject":"Expand project","sidebar.collapseProject":"Collapse project","sidebar.showMore":"Show more","sidebar.showLess":"Show less","sidebar.selectProject":"Select project…","sidebar.filterProjects":"Filter projects…","sidebar.noMatchingProjects":"No matching projects","sidebar.useDefaultDirectory":"Use default directory","sidebar.customPath":"Custom path…","directoryPicker.selectDirectory":"Select directory","directoryPicker.goToParent":"Go to parent directory","directoryPicker.directoryPath":"Directory path","directoryPicker.goToDirectory":"Go to directory","directoryPicker.go":"Go","directoryPicker.loadingDirectories":"Loading directories…","directoryPicker.noSubdirectories":"No subdirectories","directoryPicker.openBeforeSelecting":"Open this path before selecting it","directoryPicker.selectCurrentDirectory":"Select current directory","directoryPicker.selectThisFolder":"Select this folder","directoryPicker.noDrives":"No drives found","sidebar.checking":"Checking…","sidebar.open":"Open","sidebar.cancel":"Cancel","sidebar.openRepoRoot":"Open repo root","sidebar.openRepoRootTitle":"Open the repository root to manage worktrees.","sidebar.gitRepoRootOnly":"Git repo root only","sidebar.gitRepoRootOnlyTitle":"Worktrees are available in Git repository roots.","sidebar.worktrees":"Worktrees...","sidebar.checkingWorktrees":"Checking worktrees for this directory.","sidebar.filterWorktrees":"Filter worktrees…","sidebar.noMatchingWorktrees":"No matching worktrees","sidebar.switchWorktree":"Switch worktree","sidebar.switchWorktreeTitle":"Switch worktree: {path}","sidebar.main":"main","sidebar.forceRemoveCheckout":"Uncommitted changes. Force remove checkout?","sidebar.force":"Force","sidebar.createWorktreeTitle":"Create a worktree checkout for a branch","sidebar.newWorktree":"New worktree…","sidebar.branchName":"branch name","sidebar.creating":"Creating…","sidebar.create":"Create","sidebar.loading":"Loading...","sidebar.noSessions":"No sessions found","sidebar.agentRunning":"Agent running…","sidebar.newActivity":"New activity","sidebar.newSessionActivity":"New session activity","sidebar.deleteSession":"Delete {title}?","sidebar.rename":"Rename","sidebar.pin":"Pin to top","sidebar.unpin":"Unpin","sidebar.pinned":"Pinned","sidebar.delete":"Delete","sidebar.deleteWithShiftClick":"Delete (Shift+click to delete without confirmation)","sidebar.clearProjectSessions":"Clear sessions","sidebar.clearPriorityList":"Clear list","navigator.resultsToCheck":"To review","navigator.resultsToCheckCount":"To review {count}","navigator.resultsToCheckHint":"Finished conversations with new activity since you last opened them in this browser, and conversations waiting for your answer","navigator.resultsToCheckEmpty":"Nothing to review.","navigator.acknowledgeResults":"Mark all reviewed","navigator.acknowledgeResultsHint":"Marks every conversation now listed to review as seen. Conversations waiting for your answer stay.","sidebar.waitingForAnswer":"Needs answer","sidebar.waitingForAnswerHint":"Paused until you answer its question or approval request","sidebar.newScratchSession":"New session","sidebar.newScratchSessionTitle":"Start a session without a project (in a dated scratch folder under your home)","sidebar.newScratchSessionFailed":"Could not create the scratch folder: {error}","sidebar.clearSessionsTitle":"Confirm session deletion","sidebar.clearSessionsProjectBody":"Permanently delete {count} session(s) in {project}. This cannot be undone.","sidebar.clearSessionsPriorityBody":"Permanently delete {count} session(s) in the priority list. This cannot be undone.","sidebar.clearSessionsRunningExcluded":"{count} running session(s) will be kept.","sidebar.clearSessionsNone":"No session can be deleted right now.","sidebar.clearSessionsConfirm":"Delete","sidebar.clearSessionsCancel":"Cancel","sidebar.clearSessionsBusy":"Deleting…","sidebar.clearSessionsFailed":"Could not delete {count} session(s): {names}","sidebar.archive":"Archive (hide from list, restorable)","sidebar.archived":"Archived","sidebar.restore":"Restore","sidebar.noArchivedSessions":"No archived sessions","sidebar.expandForks":"Expand forks","sidebar.collapseForks":"Collapse forks","sidebar.messagesCount":"{count} msgs","sidebar.worktreePath":"Worktree: {path}","sidebar.removeWorktreeTitle":"Remove worktree checkout {path}; the branch is kept","files.deleted":"Deleted","files.insertPath":"Insert path into chat","files.mention":"mention","chat.loadingSession":"Loading session...","chat.runningTool":"Running tool...","chat.runningNamedTool":"Running {name}...","chat.runningTools":"Running {names}...","chat.runningToolsMore":"Running {names} (+{count})...","chat.waitingModel":"Waiting for model...","todo.progress":"{percent}% \xb7 {completed} of {total} done \xb7 {remaining} remaining","todo.progressDone":"{percent}% \xb7 {completed} of {total} done","todo.allDone":"All {count} done","todo.showCompleted":"Show {count} completed","todo.hideCompleted":"Hide {count} completed","todo.ready":"Ready","todo.waiting":"Waiting for: {tasks}","chat.runningCommand":"Running command...","chat.thinking":"Thinking...","chat.contextUsageTitle":"Context window: {used} of {limit} tokens ({percent})","chat.contextUsageWarning":"Context window is getting full","chat.contextUsageCritical":"Context window is nearly full","chat.processDetails":"Process details","chat.message":"message","chat.messages":"messages","chat.toolCall":"tool call","chat.toolCalls":"tool calls","chat.collapseProcess":"Collapse process details","chat.expandProcess":"Expand process details","process.empty":"No process activity in this session yet","process.turn":"turn","process.turns":"turns","chat.filesWritten":"Files changed","chat.openWrittenFile":"Open {name}","chat.lessonsSaved":"[Lessons saved] The agent stored these itself during this turn.","chat.savedLesson":"Lesson: {memory}","chat.savedSkill":"Skill {action}: {name}","chat.loadEarlier":"Scroll up to load earlier messages ({count} hidden)","chat.extensionRequest":"extension request","chat.responseSending":"Sending your answer...","chat.responseFailed":"Your answer did not reach the agent. It is still waiting - try again.","chat.cancel":"Cancel","chat.confirm":"Confirm","chat.submit":"Submit","chat.agentQuestion":"Agent needs your input","chat.agentQuestionHint":"Choose an option or provide a custom response.","chat.askAutoSelectHint":"If there is no response for {seconds}s, the recommended option is selected automatically. Choosing or typing restarts the wait.","chat.recommended":"Recommended","chat.customAnswer":"Other response (optional)","chat.chatAboutThis":"Chat about this","chat.submitAnswer":"Submit answer","chat.agentFormHint":"Fill in the form and submit it.","chat.askFormAutoSubmitHint":"If you do not respond in {seconds}s, the values currently in the form are submitted. Editing restarts the wait.","chat.formOther":"Other","chat.formOtherPlaceholder":"Type your own answer","chat.formRequired":"Required","chat.formInvalid":"Check the marked fields before you submit.","chat.formImageUnavailable":"Image could not be loaded","chat.formError.required":"Required","chat.formError.selectAtLeastOne":"Select at least one","chat.formError.enterNumber":"Enter a number","chat.formError.min":"Must be at least {value}","chat.formError.max":"Must be at most {value}","chat.formError.minLength":"Needs at least {value} characters","chat.formError.maxLength":"At most {value} characters","chat.formError.email":"Enter an email address","chat.formError.url":"Enter a full URL","chat.formError.pattern":"Must match {pattern}","chat.planApproval":"Plan approval","chat.planFeedback":"Feedback for another planning pass (optional)","chat.refinePlan":"Continue planning","chat.approvePlan":"Approve and implement","chat.extensionInput":"Extension terminal input","chat.extensionPanel":"Extension panel","chat.close":"Close","chat.queued":"Queued \xb7 {count}","chat.recall":"Recall to input","chat.recallTitle":"Remove all queued messages and put them back into the input box for editing","chat.queueRemove":"Cancel this queued message only","chat.retrying":"Retrying ({attempt}/{max})…","chat.recoveredError":"This attempt failed and was retried automatically.","chat.recoveredErrorDetail":"Show error","chat.loadingCommands":"Loading commands...","chat.slashCommands":"Slash commands \xb7 {label}","chat.tabEnter":"Tab / Enter","chat.noCommands":"No commands found","chat.match":"1 match","chat.matches":"{count} matches","chat.command":"1 command","chat.commands":"{count} commands","chat.loadingFiles":"Loading files...","chat.files":"Files \xb7 {label}{hint}","chat.searching":"Searching…","chat.noMatchingFiles":"No matching files","chat.searchingAll":" \xb7 searching all files…","chat.indexTruncated":" \xb7 index truncated","chat.steerPlaceholder":"Steer now / queue follow-up...","chat.agentPlaceholder":"Agent is running…","chat.messagePlaceholder":"Message… / commands \xb7 @ files","chat.steer":"Steer","chat.followUp":"Follow-up","chat.send":"Send","chat.attachImageLimit":"A message can include at most {count} images.","chat.attachImageTooLarge":"{name} exceeds the {limit} per-image limit.","chat.attachFile":"Attach files","chat.emptyProjectLabel":"Project folder","chat.emptyProjectHint":"Your first message starts a new session in this folder.","chat.openSessionList":"Open session list","chat.attachments":"Attachments","chat.removeImage":"Remove image {index}","chat.removeAttachment":"Remove {name}","chat.attachExtracting":"Extracting text","chat.attachExtractingWait":"Wait for the attachments to finish processing","chat.attachLimit":"A message can include at most {count} non-image attachments.","chat.attachTooLarge":"{name} exceeds the {limit} per-document limit.","chat.attachTotalTooLarge":"Attached documents exceed the {limit} combined size limit.","chat.attachTextTooLarge":"{name} exceeds the {limit}-character extracted text limit.","chat.attachTooManyPages":"{name} exceeds the {limit}-page PDF limit.","chat.attachNoPdfText":"{name} has no extractable text. Scanned or image-only PDFs require OCR, which is not supported.","chat.attachPasswordProtected":"{name} is password-protected and cannot be extracted.","chat.attachExtractFailed":"Could not extract text from {name}.","chat.attachKindAudio":"Audio","chat.attachKindFile":"File","chat.attachUploading":"Saving","chat.attachTranscribing":"Transcribing","chat.attachTranscribeFailed":"Transcription failed","chat.attachStoredTooLarge":"{name} exceeds the {limit} per-file limit.","chat.attachUploadFailed":"Could not save {name}: {error}","chat.attachTranscribePending":"Needs your choice","chat.transcribeGroup":"Audio transcription","chat.transcribeChecking":"Checking length","chat.transcribeConfirmTitle":"Transcribe {name}?","chat.transcribePlanSummary":"{duration} \xb7 transcription calls: about {calls}","chat.transcribeDurationUnknown":"Length unknown","chat.transcribeUsageNotice":"Transcription counts toward the connected account's usage. Nothing is sent until you start.","chat.transcribeStart":"Start transcription","chat.transcribeSkip":"Don't transcribe","chat.transcribeCancel":"Cancel transcription","chat.transcribeRunning":"Transcribing {name}","chat.transcribeRetry":"Try again","chat.transcribeAction":"Transcribe","chat.transcribeSkipped":"{name} has no transcript; only the saved file path is sent.","chat.transcribeFailedRow":"{name}: transcription failed. {error}","chat.transcribeToolMissing":"The audio tool (ffmpeg) is not available, so this audio cannot be prepared for transcription.","chat.transcribePartialFailed":"Stopped after {done} of {total} parts; no partial transcript is attached.","chat.transcribeTooLong":"The transcript does not fit beside the other attachments.","chat.transcribeFallbackTitle":"Primary transcription failed for {name}. Continue with ChatGPT/Codex?","chat.transcribeFallbackProgress":"{done} of {total} parts already have a transcript, which stays; continuing sends only the failed part and the rest.","chat.transcribeFallbackUsageNotice":"ChatGPT/Codex is a separate provider; its transcription counts toward the signed-in account's usage. CUELO sends nothing until you continue.","chat.transcribeFallbackStart":"Continue with ChatGPT/Codex","chat.transcribeFallbackExpired":"This fallback choice expired or you already used it. CUELO sent nothing; try again to start over.","chat.attachmentSettingsNav":"Attachments","chat.attachmentSettingsTitle":"Attachments","chat.attachmentSettingsDescription":"Files you attach in chat are saved on this computer so the agent can open them.","chat.attachmentSettingsLoadFailed":"Could not load attachment settings","chat.attachmentUploadLimit":"Upload limit per file (MB)","chat.attachmentUploadLimitHelp":"Larger files are refused before they are sent. Text read straight into the message keeps its own limits: 8 MB per document and 240,000 characters in total.","chat.attachmentUploadLimitInvalid":"Enter a whole number of MB, 1 or more.","chat.attachmentAutoCleanup":"Delete unused attachments automatically","chat.attachmentAutoCleanupHelp":"Attachments used by a conversation, a branch, or an unsent draft are kept. A file is deleted {days} days after it is confirmed unused everywhere; a file whose use cannot be confirmed is kept.","chat.attachmentSettingsSaved":"Saved","characterMode.nav":"Characters","characterMode.title":"Characters","characterMode.description":"Choose the faces, names, stickers and completion voices you see on screen.","characterMode.label":"Character set","characterMode.default":"Default","characterMode.office":"Office mode","characterMode.help":"Applies to this whole PC server. In office mode, the characters registered in this PC's profile replace the face, name, voice, stickers and sounds of their seats. Seats without an entry stay as they are.","characterMode.noRoster":"This PC has no office character set, so the default characters stay in use.","characterMode.saved":"Saved","chat.steerTitle":"Interrupt the current run and inject this message now","chat.followUpTitle":"Queue this message after the agent finishes","chat.filterModels":"Filter models…","chat.noMatchingModels":"No matching models","chat.modelRoles":"Roles","chat.allModels":"All models","chat.mainPreset":"Main preset","roles.title":"Model roles","roles.description":"omp routes work by role, not by one current model. Assign a model to each role and both CUELO and the omp CLI use it.","roles.scope":"Save to","roles.scopeGlobal":"Global","roles.scopeProject":"This project","roles.unset":"— not set —","roles.needsProject":"Open a project to edit its model roles.","roles.source.global":"from global config","roles.source.project":"from project config","roles.source.default":"omp default","roles.thinking":"Thinking","roles.thinkingInherit":"Use the configured default thinking level","roles.harnessNote":"CUELO Maker and tool slots are listed even before you assign them. Pick your own model only for the slots you use; saving does not sign in or test the model.","roles.harnessUnset":"not set","roles.harness.implSol":"Maker: bounded design, deep diagnosis and rework","roles.harness.implSonnet":"Maker: general implementation and routine UI","roles.harness.implOpus":"Maker: difficult UI/UX","roles.harness.implDeepSeek":"Maker: fully specified repetitive work, explicit selection","roles.harness.makerHardUiOpus":"Maker: difficult UI/UX (HARD)","roles.harness.makerHardCodeOpus":"Maker: HARD code, explicit selection","roles.harness.makerHardCodeSonnet":"Maker: settled implementation and routine UI (HARD)","roles.harness.crossReviewOpenAI":"Cross-review \xb7 required OpenAI reviewer (openai / openai-codex)","roles.harness.crossReviewAnthropic":"Cross-review \xb7 required Anthropic reviewer (anthropic)","roles.harness.crossReviewAdvisory":"Cross-review \xb7 advisory reviewer, non-blocking (any provider)","roles.harness.preflightAnthropic":"Plan advice: joint preflight","roles.harness.skim":"Tool \xb7 multi-file source reading (skim)","roles.harness.draft":"Tool \xb7 document drafting (draft)","roles.harness.ocr":"Tool \xb7 image text transcription (ocr)","roles.harness.interpreter":"Tool \xb7 Korean–English interpreter (interpreter)","chat.moreControls":"Run options","chat.collapseControls":"Close run options","chat.shell":"Shell","chat.outputLocal":"output stays local","chat.outputModel":"output sent to model","chat.noTools":"No tools, read-only","chat.builtInTools":"Core: {tools} \xb7 other registered tools stay enabled","chat.allBuiltInTools":"Core: {tools} \xb7 other registered tools stay enabled","chat.changeReasoning":"Change reasoning level: {level}","chat.changeReasoningLabel":"Change reasoning level","chat.currentReasoning":"Current reasoning level: {level}","chat.outputSpeed":"{rate} tok/s","chat.outputSpeedTitle":"Output speed of the last answer (output tokens per second, from request start to the end of generation)","chat.outputSpeedLive":"~{rate} tok/s","chat.outputSpeedLiveTitle":"Estimated output speed of the answer in progress (received text approximated as tokens, from request start until now). Switches to the real token count when the answer ends","chat.fastModeActive":"Fast on \xb7 applied to this model. Priority service may cost more or use more quota. Click to turn off","chat.fastModeInactive":"Fast requested \xb7 not applied for this model or account. Click to turn off","chat.fastModeOff":"Fast off \xb7 click to request priority service (may cost more or use more quota, depending on the provider)","chat.fastModeUnknown":"Fast state not checked yet \xb7 click to read this session's actual state and change it","chat.fastModeBusy":"Changing Fast","chat.changeToolPreset":"Change tool preset","chat.stopCompaction":"Stop compaction","chat.compactContext":"Compact context","chat.compacting":"Compacting…","chat.compact":"Compact","chat.stopAgent":"Stop agent","chat.stop":"Stop","chat.liveVoice":"Live voice","chat.liveStart":"Start live voice","chat.liveStop":"End live voice","chat.liveConnecting":"Connecting","chat.liveOn":"Live","chat.liveWorking":"Working","chat.liveUnsupported":"This browser cannot make live calls","chat.liveMicDenied":"Microphone access was denied","chat.liveMicUnavailable":"No microphone is available","chat.liveAuthRequired":"Sign in to Codex to use live voice","chat.liveUpstreamFailed":"Codex refused the live call","chat.liveFailed":"The live call could not start","chat.liveNeedsSession":"Choose a folder first — a live call speaks as this conversation's agent","chat.liveVoiceSettingsNav":"Call voice","chat.liveVoiceSettingsTitle":"Call voice","chat.liveVoiceSettingsDescription":"Choose the Codex voice that speaks in live and interpreter calls and how fast it speaks. The choice applies from the next call.","chat.liveVoiceSpeakerGroup":"Voice","chat.liveVoiceCodexLabel":"Codex voice","chat.liveVoiceCodexHelp":"Speaks in live calls and interpreter calls.","chat.livePaceLabel":"Speaking pace","chat.livePaceHelp":"Slow makes the voice speak slowly and clearly.","chat.livePaceNormal":"Normal","chat.livePaceSlow":"Slow","chat.liveVoiceLoadFailed":"Could not load voice settings","chat.disableSound":"Disable completion sound","chat.enableSound":"Enable completion sound","chat.thinkingAuto":"Automatically select reasoning effort","chat.thinkingAutoCapped":"Automatic, at most {level}","chat.thinkingOff":"Reasoning off","chat.thinkingMinimal":"Minimal reasoning","chat.thinkingLow":"Low reasoning","chat.thinkingMedium":"Medium reasoning","chat.thinkingHigh":"High reasoning","chat.thinkingXhigh":"Extra-high reasoning","chat.thinkingMax":"Max reasoning","chat.builtIn":"Built-in","chat.extensions":"Extensions","chat.customCommands":"Custom commands","chat.mcpPrompts":"MCP prompts","chat.prompts":"Prompts","chat.fileCommands":"Command files","chat.skills":"Skills","chat.dormant":"dormant","chat.commandCompact":"Compress context, optionally with instructions","chat.commandReload":"Reload extensions, skills, prompts, and tools","chat.commandName":"Set the session display name","chat.commandSession":"Show session message, token, and cost stats","chat.commandCopy":"Copy the last assistant message","chat.goalLabel":"Goal","chat.goalPaused":"paused","chat.goalBudgetLeft":"{left} left","chat.goalTokensUsed":"{used} used","chat.jumpToBottom":"Jump to bottom","chat.loadLater":"Scroll down to load later messages ({count} below)","chat.jumpMissing":"That message is not in this conversation view (another branch or compacted history).","chat.questionRail":"Your questions","chat.searchPlaceholder":"Find in conversation","chat.searchNoResults":"No results","chat.searchCount":"{index}/{total}","chat.searchPrevious":"Previous match","chat.searchNext":"Next match","chat.searchClose":"Close find","chat.compactionLabel":"Compacting","chat.compactionProgress":"Compacting context \xb7 {seconds}s","chat.compactionReason.manual":"manual","chat.compactionReason.threshold":"threshold","chat.compactionReason.overflow":"overflow","chat.compactionReason.idle":"idle","chat.compactionReason.incomplete":"incomplete","chat.compactedFrom":"Compacted from {tokens} tokens","chat.interruptedTitle":"The last run was interrupted","chat.interruptedDetail":"The run stopped before it finished, for example when the server or PC went down. If it does not resume automatically, send a message to continue.","chat.interruptedDismiss":"Dismiss","chat.frequentModels":"Frequently used","chat.modelPickCount":"{count}\xd7","palette.searchPlaceholder":"Search conversations","palette.searchResults":"Conversation search results","palette.searching":"Searching…","palette.searchFailed":"Search failed","palette.searchEmpty":"No matching messages","palette.searchHits":"{count} messages","palette.searchTruncated.time":"stopped at the time limit after {scanned} of {total} sessions","palette.searchTruncated.bytes":"stopped at the size limit after {scanned} of {total} sessions","palette.searchTruncated.results":"showing the first results; refine the query for more","palette.searchCompacted":"{count} in compacted history not shown","palette.searchRoleUser":"You","palette.searchRoleAssistant":"Answer","palette.wideChatOn":"Use wide chat","palette.wideChatOff":"Use standard chat width","palette.groupViews":"Views","palette.groupViewsHint":"open in the inspector","palette.groupShortcuts":"Shortcuts","palette.groupScreen":"Screen","palette.hintMove":"move","palette.hintOpen":"open","palette.hintClose":"close","chat.compacted":"Compacted","chat.tokensSaved":"{saved} saved","i18n.close":"Close","i18n.copy":"Copy","i18n.copied":"Copied","i18n.cancel":"Cancel","i18n.save":"Save","i18n.saving":"Saving…","i18n.saved":"Saved","i18n.remove":"Remove","i18n.removing":"Removing…","i18n.delete":"Delete","i18n.loading":"Loading...","i18n.search":"Search","i18n.refresh":"Refresh","i18n.update":"Update","i18n.updating":"Updating...","restart.title":"CUELO is restarting","restart.body":"This page reloads automatically when the server is back.","restart.slow":"The restart is taking longer than two minutes. Check READY or FAILED in %USERPROFILE%\\.omp\\restart-ompweb.log on the server PC. This page still reloads when the server is back.","restart.returnedTitle":"CUELO restarted","restart.returnedBody":"The server is back and this tab reconnected to the same conversation.","restart.returnedDismiss":"Dismiss restart notice","i18n.check":"Check","i18n.checking":"Checking...","i18n.install":"Install","i18n.installing":"Installing...","i18n.noResults":"No results","i18n.searchProviders":"Search providers…","i18n.noProviders":"No providers match","i18n.newModel":"new model","i18n.addProvider":"Add provider","i18n.selectProviderModel":"Select a provider or model","i18n.visibleInPrompt":"Visible in model prompt — click to disable","i18n.hiddenFromPrompt":"Hidden from model prompt — click to enable","i18n.dormant":"Dormant","i18n.hiddenButInvocable":"Hidden from model, still manually invocable","i18n.skillSearchPlaceholder":"e.g. react, testing, deploy","i18n.searching":"Searching…","i18n.noSkills":"No skills found","i18n.checkUpdates":"Check updates","i18n.updates":"updates","i18n.noResolvedResources":"No resolved resources","i18n.enablePackage":"Enable package","i18n.disablePackage":"Disable package","i18n.filtered":"filtered","i18n.openSessionToReload":"Open a session to reload","i18n.notFound":"Not found","i18n.noPlugins":"No plugins configured","trust.resourcesNotLoaded":"Restricted mode","trust.trustProject":"Trust project","computerTakeover.allow":"Allow takeover","computerTakeover.active":"Takeover allowed","computerTakeover.allowHint":"Allow screen takeover for this session only. It goes back to refused when you turn it off or the session closes.","computerTakeover.activeHint":"Screen takeover is allowed in this session. Click to turn it off.","computerTakeover.shared":"A session opened in the server's own folder cannot be allowed separately.","computerTakeover.failed":"Could not change takeover: {error}","trust.trusting":"Trusting...","trust.cancel":"Cancel","trust.dialogTitle":"Trust this project?","trust.dialogBody":"Project resources can run local code. Trust only projects whose contents you know.","trust.skillsNotLoaded":"Project skills are not loaded because this project is not trusted.","trust.pluginsNotLoaded":"Project plugins are not loaded because this project is not trusted.","trust.projectScopeUnavailable":"Project installs are unavailable while project resources are not loaded.","trust.pendingBadge":"Restricted mode \xb7 trust scheduled","trust.scheduledTitle":"Trust scheduled","trust.scheduledBody":"This project is still in restricted mode. Trust applies once every session in this project has finished its current work; nothing that is running gets interrupted.","trust.cancelSchedule":"Cancel scheduled trust","trust.close":"Close","trust.applyFailed":"The scheduled trust was not applied, so the project is still restricted: {error}. Trust it again to retry.","trust.settingsNav":"Project trust","trust.settingsDescription":"A project that ships its own extensions, hooks, tools, or MCP servers loads that code only after you trust it. A change made while a session is working applies when every session in that project is idle — running work is never interrupted.","trust.settingsEmpty":"No project needs a trust decision yet.","trust.loadFailed":"Could not load project trust: {error}","trust.stateTrusted":"Trusted","trust.stateRestricted":"Restricted","trust.stateNotRequired":"No project code needs trust","trust.pendingGrant":"Trust approved but not applied yet. The project stays restricted until its sessions finish their work.","trust.pendingRevoke":"Trust is already revoked. {count} running session(s) still use the project code and restart restricted when their current work ends.","trust.runtime":"Live sessions {sessions} \xb7 running {running} \xb7 project code loaded {loaded}","trust.revoke":"Revoke trust","trust.trustAgain":"Trust again","trust.confirm":"Confirm","trust.working":"Saving…","trust.confirmGrant":"Trust this project? Its extensions, hooks, tools, and MCP servers can run on this machine.","trust.confirmTrustAgain":"Undoing a revoke is a new trust approval. Its extensions, hooks, tools, and MCP servers can run on this machine.","trust.confirmRevoke":"Revoke trust? New sessions start restricted right away; running sessions finish their current work first.","trust.doneApplied":"Applied. Sessions in this project now start with this setting.","trust.doneCancelled":"Scheduled trust cancelled. The project stays restricted.","trust.refresh":"Refresh","i18n.creatingSession":"Creating new session…","i18n.creating":"Creating…","i18n.subscription":"Subscription","i18n.subscriptions":"Subscriptions","i18n.customEndpoint":"Custom endpoint format","i18n.noChanges":"No changes","i18n.branches":"Branches","i18n.noActiveSession":"No active session","i18n.noBranches":"This session has no branches","i18n.source":"Source","i18n.preview":"Preview","i18n.diff":"Diff","i18n.downloadFile":"Download file","i18n.liveSync":"Live sync active","i18n.notWatching":"Not watching","i18n.fileViewMode":"File view mode","i18n.compareHead":"Compare working tree with HEAD","i18n.mentionSelectedLines":"Mention selected lines","i18n.disableWrap":"Disable word wrap","i18n.enableWrap":"Enable word wrap","i18n.htmlPreview":"HTML preview","i18n.previewFile":"Preview {file}","i18n.invalidMermaid":"Invalid Mermaid diagram","i18n.renderingMermaid":"Rendering Mermaid diagram","i18n.previewAfterStreaming":"Preview available after streaming","i18n.showMermaidSource":"Show Mermaid source","i18n.previewMermaid":"Preview Mermaid diagram","i18n.openMermaidViewer":"Open diagram viewer","i18n.mermaidViewer":"Mermaid diagram viewer","i18n.mermaidDiagram":"Mermaid diagram","i18n.zoomOut":"Zoom out","i18n.zoomIn":"Zoom in","toolImage.dialogLabel":"Enlarged image","toolImage.requestEdit":"Request changes to this screen","toolImage.requestEditHint":"Attach this image to the message box. Describe the change, then send.","toolImage.noComposer":"There is no message box to attach to. Open a conversation, then press Request changes to this screen.","toolImage.loadFailed":"Couldn't load the image. Press Request changes to this screen again.","toolImage.markHint":"Drag over the part to change","toolImage.markLimit":"You can mark up to {count} areas","toolImage.clearMarks":"Clear marks","toolImage.regionLabel":"Area {n}","toolImage.locatorIntro":"The parts to change are marked with red boxes on the attached screen (areas {range}). A close-up of each area follows.","toolImage.locatorRegion":"Area {n}: x={x}, y={y}, width {w}, height {h} (original {width}\xd7{height} pixels)","files.pickElement":"Pick element","files.pickElementHint":"Click the element to change in the preview","files.pickedElement":"Picked element","files.requestElementEdit":"Request changes to this element","files.clearPick":"Clear selection","files.pickLocatorElement":"Element: {selector}","files.pickLocatorText":'Text: "{text}"',"files.pickLocatorPosition":"Position: x={x}, y={y}, width {w}, height {h} ({vw}\xd7{vh} preview)","i18n.fitToWidth":"Fit to width","models.discoveryFetching":"Importing models…","models.discoveryFetch":"Import models…","models.discoveryFilterPlaceholder":"Filter {count} models…","models.discoveryFilter":"Filter upstream models","models.discoverySelectShown":"Select shown","models.discoveryNoMatches":"No matching models.","models.discoveryAdded":"added","models.discoveryShowing":"Showing first {shown} of {total}","models.discoveryFetched":"{count} models fetched","models.discoveryAddSelected":"Add selected","models.discoveryAddSelectedCount":"Add selected ({count})","models.catalogSource":"source: models.dev ↗","models.catalogFilling":"Filling details…","models.catalogFill":"Fill model details","models.catalogFilled":"{count} fields filled","models.catalogNoEmptyFields":"No empty fields to fill","models.catalogNoExactMatch":"No exact models.dev match","models.catalogPriceProvider":"Price matched Provider {provider}","models.catalogPriceBaseUrl":"Price matched Base URL to {provider}","models.catalogPriceConsensus":"Price agreed by {support}/{total} records","models.catalogPriceUnreliable":"No reliable price found","models.catalogUndo":"Undo","models.navGroupRoles":"Role assignments","models.navGroupAccounts":"Connected accounts","models.navGroupCustom":"Custom providers","models.backToList":"Back to list","i18n.testingModel":"Testing model connection...","i18n.connected":"Connected","i18n.failed":"Failed","i18n.test":"Test","i18n.testConnection":"Test model connection","i18n.provider":"Provider","i18n.model":"Model","i18n.providerName":"Provider name","i18n.rename":"Rename","i18n.default":"Default","i18n.disabled":"Disabled","i18n.noResources":"No resources","i18n.unknown":"Unknown","i18n.installedVersion":"installed {version}","i18n.configuredVersion":"configured {version}","i18n.extensions":"Extensions","i18n.prompts":"Prompts","i18n.themes":"Themes","i18n.resourceCount":"{count} {label}","i18n.extensionShort":"ext","i18n.skillShort":"skills","i18n.promptShort":"prompts","i18n.themeShort":"themes","i18n.custom":"Custom","i18n.clearAll":"clear all","i18n.connectedSuccessfully":"Connected successfully.","i18n.notConnected":"not connected","i18n.configured":"configured","i18n.notConfigured":"not configured","i18n.openingBrowser":"Opening browser…","i18n.submit":"Submit","i18n.login":"Login","i18n.relogin":"Re-login","i18n.deviceLogin":"Log in with device code","i18n.deviceLoginGuide":"Open the page below, sign in, and enter this code. Nothing has to reach this server's localhost, so it also works on a remote server.","i18n.disconnect":"Disconnect","i18n.networkError":"Network error","i18n.continuing":"Continuing…","i18n.skills":"Skills","i18n.plugins":"Plugins","i18n.addSkill":"Add skill","i18n.addPlugin":"Add plugin","i18n.selectSkill":"Select a skill","i18n.selectPackage":"Select a package","i18n.updateAvailable":"Update available","i18n.upToDate":"Up to date","i18n.automaticChecksUnavailable":"Automatic checks unavailable","i18n.checkFailed":"Check failed","i18n.installed":"Installed","i18n.status":"Status","i18n.version":"Version","i18n.package":"Package","i18n.resources":"Resources","i18n.installedPath":"Installed path","i18n.cwd":"CWD","i18n.resolvedResources":"Resolved Resources","i18n.reloadSession":"Reload session","i18n.reloadSessionHint":"Reloads settings and skills for the open session. It does not unload plugins; restart CUELO for that.","i18n.reloading":"Reloading...","i18n.packageRemoved":"Package removed.","i18n.packageInstalled":"Package installed.","i18n.packageUpdated":"Package updated.","i18n.packageDisabled":"Package disabled.","i18n.packageDisabledRestartRequired":"Disabled setting saved. The plugin already loaded keeps running until CUELO restarts; reloading the session does not unload it.","i18n.packageEnabled":"Package enabled.","i18n.sessionReloaded":"Session reloaded.","i18n.thinking":"Thinking","i18n.largeMessageReveal":"Message content is very large ({size}). Click to view as plain text — markdown rendering is disabled to keep the page responsive.","i18n.loadingThinking":"Loading thinking...","i18n.copyMessage":"Copy message","i18n.editFromHere":"Edit from here","i18n.editFromHereTitle":"Edit from here — branches within this session","i18n.newSession":"New session","i18n.newSessionTitle":"New session — creates an independent copy from here","i18n.estimatedTokens":"Estimated token count while streaming","i18n.messageUsage":"Usage","i18n.messageUsageTitle":"Show this message's tokens and cost","i18n.providerAnthropicSubscription":"Anthropic subscription","i18n.providerAnthropicApi":"Anthropic API","i18n.noOutput":"(no output)","i18n.noSummary":"(no summary)","i18n.conversationCompacted":"Conversation compacted","i18n.compactionDescription":"The conversation history before this point was compacted into the following summary:","i18n.fileContext":"File context: {details}","i18n.readFiles":"Read files","i18n.modifiedFiles":"Modified files","i18n.hiddenExtensionMessage":"hidden extension message","i18n.noMessage":"(no message)","i18n.showOriginalReply":"Show English original","i18n.hideOriginalReply":"Hide English original","i18n.showInputTranslation":"Show English translation","i18n.hideInputTranslation":"Hide English translation","i18n.showExtensionMessage":"Show extension message","i18n.collapse":"Collapse","i18n.expand":"Expand","i18n.hideDetails":"Hide details","i18n.showDetails":"Show details","i18n.thinkingUnavailable":"Thinking content unavailable","i18n.before":"Before","i18n.after":"After","i18n.sessionComplete":"Session complete","i18n.taskFinished":"Task finished.","i18n.attentionNeeded":"Pi needs your attention","i18n.extensionInputNeeded":"An extension is waiting for your input.","navigator.toolbar":"Navigator views","navigator.priority":"Priority","navigator.view":"{label} navigator","gpt6.boundBadge":"6PRO {handle}","gpt6.boundBadgeHint":"This session is bound to 6 Pro connection number {handle}.","usage.none":"Usage —","usage.open":"Open usage details: {rows}","usage.openMore":", and {count} more","usage.showMore":"Show {count} more","usage.showLess":"Show less","usage.accountBlocked":"auto-blocked","usage.accountSpent":"account limit used up","usage.limitSpent":"limit used up","usage.bai":"B.AI tokens","usage.baiEmpty":"none recorded","usage.baiRange":"aggregated {from}–{to}","usage.baiUnmeasured":"not measured","usage.title":"Usage","usage.reorder":"Reorder","usage.reorderDone":"Done","usage.reorderGroup":"Account display order","usage.moveUp":"Move {account} up","usage.moveDown":"Move {account} down","usage.moved":"{account} moved to position {position}","usage.authExpired":"sign-in expired","usage.authUnavailable":"unavailable","usage.relogin":"Sign in again","usage.reloginFor":"Sign in again as {account}","usage.authIssues":"Account issues: {count}","relogin.title":"Account to sign in again","relogin.guide":"Press {action} and finish in the browser with this account. Signing in with a different account leaves this one failing.","relogin.done":"Sign-in finished.","relogin.checking":"Re-reading usage to check {account}…","relogin.recovered":"{account} is signed in again.","relogin.stillFailing":"Sign-in finished, but {account} still reports an auth error. You may have signed in with a different account.","relogin.unknown":"Could not find {account} in usage, so recovery is not confirmed.","efficiency.title":"Efficiency","efficiency.governor":"Run control","efficiency.lab":"Experiment Lab","efficiency.refresh":"Refresh","efficiency.refreshing":"Loading…","efficiency.noSession":"Select a session to see its runs.","efficiency.loadingRuns":"Loading runs…","efficiency.runsEmpty":"No runs recorded in this session.","efficiency.runsError":"Could not load runs.","efficiency.selectRun":"Select a run to see roles, bottlenecks, and unmeasured gaps.","efficiency.loadingDetail":"Loading run detail…","efficiency.detailError":"Could not load the run detail.","efficiency.noTitle":"Untitled request","efficiency.elapsed":"Elapsed","efficiency.busyTotal":"Generation time total","efficiency.noSumNote":"Elapsed and generation total are shown side by side, never added.","efficiency.summarySection":"Summary","efficiency.rolesSection":"Roles","efficiency.rolesEmpty":"No role recorded a request in this run.","efficiency.bottlenecksSection":"Bottlenecks","efficiency.bottlenecksEmpty":"No bottleneck measured.","efficiency.toolsSection":"Tool calls","efficiency.unmeasuredGap":"Unmeasured gap","efficiency.elapsedValue":"Elapsed {value}","efficiency.estimatedCostValue":"Est. {value}","efficiency.estimatedCost":"Est. cost","efficiency.untimedLowerBound":"{value} request(s) have no recorded duration — generation time is a lower bound.","efficiency.bottleneckOrderNote":"Largest observed items, longest first. Bar length is relative to the top item, not to elapsed time.","efficiency.untimedRuns":"Runs missing duration","efficiency.untimedMedianLowerBound":"{value} run(s) contain requests with no recorded duration — the median generation time is a lower bound.","efficiency.unpricedLowerBound":"Includes unpriced records — lower bound","efficiency.mixedPairingNote":"Mixed configuration: which model and reasoning effort each request used, and in what order, could not be determined. These runs cannot be assumed to share the same conditions.","efficiency.unmeasuredShort":"Unmeasured","efficiency.effortLabel":"Effort {value}","efficiency.requestsValue":"{value} requests","efficiency.toolCallsValue":"{value} tool calls","efficiency.busyTime":"Generation time","efficiency.tokens":"Tokens","efficiency.unpricedRequests":"Unpriced requests","efficiency.firstTokenAvg":"Wait for first token (avg)","efficiency.firstTokenPartial":"First-token wait is averaged over {recorded}/{total} requests that recorded it.","efficiency.outputTokens":"Conversation output tokens","efficiency.helpersTitle":"Auxiliary model calls","efficiency.helperCallsValue":"{count} calls \xb7 output {output} \xb7 total {tokens} \xb7 {cost}","efficiency.helpersIncludedNote":"Auxiliary call tokens and cost are included in the token and estimated cost totals above, and excluded from request count, first-token wait, and conversation output tokens.","efficiency.toolFailedValue":"failed {value}","efficiency.toolNoMatchValue":"no match {value}","efficiency.toolCancelledValue":"cancelled {value}","efficiency.unmeasuredGapValue":"Unmeasured gap {value}","efficiency.roleMain":"Main","efficiency.roleMaker":"Maker","efficiency.roleChecker":"Checker","efficiency.roleAdvisor":"Advisor","efficiency.roleUnattributed":"Unattributed","efficiency.purposePrimary":"Primary","efficiency.purposeRework":"Rework","efficiency.purposeReview":"Review","efficiency.outcomeCompleted":"Completed","efficiency.outcomeError":"Error","efficiency.outcomeAborted":"Aborted","efficiency.outcomeInterrupted":"Interrupted","efficiency.outcomeRunning":"Running","efficiency.folder":"Folder","efficiency.folderAll":"All folders","efficiency.folderPlaceholder":"Filter by folder, Enter to apply","efficiency.loadingExperiments":"Loading config comparison…","efficiency.experimentsEmpty":"No config recorded for comparison.","efficiency.experimentsError":"Could not load the config comparison.","efficiency.difficultyNote":"Task difficulty is not normalized.","efficiency.runsValue":"{value} runs","efficiency.medianElapsed":"Median elapsed","efficiency.medianBusy":"Median generation","efficiency.medianTokens":"Median tokens","efficiency.medianEstimatedCost":"Median est. cost","efficiency.totalEstimatedCost":"Total est. cost","efficiency.reworkRate":"Rework rate","efficiency.errorRate":"Error rate","efficiency.unpricedRuns":"Unpriced runs","efficiency.scopeAttributed":"Current roles only","efficiency.scopeAll":"All runs","efficiency.scopeSessions":"Sessions counted","efficiency.scopeRuns":"Runs counted","efficiency.scopeExcludedRuns":"Runs excluded","efficiency.harness":"Harness","efficiency.harnessValue":"Harness {value}","efficiency.harnessUnknown":"unknown","efficiency.harnessAll":"All harnesses","efficiency.groupByHarness":"Split by harness","efficiency.harnessNote":"Harness is the CUELO version installed when the run started. It comes only from this PC's update records; runs without a record, or in a span changed outside the records, are unknown.","efficiency.sawSection":"What the model saw","efficiency.sawApproxNote":"Approximate, rebuilt from the session log. The system prompt sent with each request and context-hook rewrites are not recorded.","efficiency.sawOpen":"Show requests","efficiency.sawLoading":"Loading requests…","efficiency.sawError":"Could not load requests.","efficiency.sawEmpty":"No model requests are recorded for this run.","efficiency.sawFilterEmpty":"No requests with injections.","efficiency.sawRole":"Transcript","efficiency.sawSummary":"{turns} requests \xb7 {injections} injected \xb7 {tools} tool calls \xb7 {failed} failed","efficiency.sawOnlyInjected":"Only requests with injections","efficiency.sawTurnLabel":"Request {index}","efficiency.sawBefore":"Arrived before this request","efficiency.sawTrailing":"Arrived after the last request (not part of any model request in this run)","efficiency.sawShowFull":"Show full text","efficiency.sawShowArgs":"Show arguments","efficiency.sawShowResult":"Show result","efficiency.sawHideFull":"Collapse","efficiency.sawTruncated":"Showing the first {value} characters.","efficiency.sawMore":"Load {value} more","efficiency.sawShown":"Showing {shown} of {total}","efficiency.sawHiddenFromChat":"Hidden in chat","efficiency.sawNotSent":"Not sent to the model","efficiency.sawSecretsMasked":"Strings that look like secrets are replaced with [REDACTED].","efficiency.sawKindInjection":"Injected","efficiency.sawKindDeveloper":"Developer message","efficiency.sawKindUser":"User message","efficiency.sawKindCompaction":"Compaction","efficiency.sawKindModel":"Model change","efficiency.sawKindEffort":"Effort change","efficiency.sawKindPrompt":"System prompt changed","efficiency.sawKindRules":"Rules injected","efficiency.sawKindMemory":"Memory recall","efficiency.sawCompactionValue":"{before} → {after} tokens","efficiency.sawMemoryIds":"{value} memories recalled (text not recorded)","efficiency.sawToolOk":"OK","efficiency.sawToolFailed":"Failed","efficiency.sawToolNoMatch":"No match","efficiency.sawToolCancelled":"Cancelled","efficiency.sawToolMissing":"No result","efficiency.sawResultChars":"result {value} chars","efficiency.sawUsage":"in {input} \xb7 out {output} \xb7 cache read {cacheRead}","efficiency.sawStop":"stop: {value}","efficiency.sawToolsChanged":"Tool list changed: +{added} −{removed}","efficiency.sawPreludeTitle":"System prompt and tools","efficiency.sawPreludeRecorded":"Recorded","efficiency.sawPreludeTools":"{value} tools active in the last request (recorded)","efficiency.sawPreludeDigest":"System prompt fingerprint: {value}","efficiency.sawPreludeDigestNone":"No system prompt fingerprint is recorded for this run.","efficiency.sawPreludeMemory":"Memory recall block (part of the system prompt, recorded)","efficiency.sawPreludeReconstruct":"Rebuild from current settings","efficiency.sawPreludeLoading":"Rebuilding…","efficiency.sawPreludeApprox":"Rebuilt now from the current configuration, not as sent.","efficiency.sawPreludeNotLoaded":"This session is not loaded right now, so it cannot be rebuilt. The system prompt text is not recorded.","efficiency.sawPreludeMatch":"The current prompt's fingerprint matches this run's record.","efficiency.sawPreludeMismatch":"The current prompt's fingerprint differs from this run's record; it may have changed since.","toolRun.running":"Running","toolRun.failed":"Failed","toolRun.exitCode":"exit {code}","toolRun.diffStats":"{added} lines added, {removed} lines removed","toolRun.askTimedOut":"No answer before the timeout. The form's current values were submitted.","panel.expand":"Widen panel","panel.restore":"Restore size","panel.more":"More","panel.liveSync":"Live updates","panel.subagentsCount":"{count} records","panel.refresh":"Refresh records","panel.close":"Close panel","pluginLab.counts":"{count} plugins","pluginLab.refresh":"Refresh list","pluginLab.create":"New plugin","pluginLab.createHint":"Puts a request into the message box. Edit it, then send.","pluginLab.starter":"Use the plugin-lab skill to build a plugin for my profile.\n- What it should do: \n- Tools it needs: \n- What its panel shows (leave empty for none): \nWrite it straight into the repository's formal plugin folder and ship it through review, version, CI and deploy in this turn.","pluginLab.loading":"Loading plugins…","pluginLab.loadFailed":"Could not load plugins: {error}","pluginLab.retry":"Load again","pluginLab.empty":"No plugins yet. Use “New plugin” to put a request into the message box.","pluginLab.listLabel":"Plugins","pluginLab.on":"On","pluginLab.off":"Off","pluginLab.toggleLabel":"Use {name}","pluginLab.toggleFailed":"Could not change the state: {error}","pluginLab.tools":"Tools","pluginLab.enhancements":"Enhancements","pluginLab.enhancementDateHint":"Recorded date","pluginLab.showAllEnhancements":"Show all {count}","pluginLab.showFewerEnhancements":"Show fewer","pluginLab.problem":"Problem","pluginLab.openPanel":"Open panel","pluginLab.openPanelLabel":"Open the {name} panel","pluginLab.back":"Back to plugins","pluginLab.panelSubtitle":"Sandboxed \xb7 lab:{id}","pluginLab.frameTitle":"{name} panel","pluginLab.lines":"{count} lines of agent data","pluginLab.noLines":"No agent data in this session","pluginLab.draftInserted":"The panel's draft is in the message box. Check it, then send.","pluginLab.applyHint":"Tool changes apply in a new session or after /reload.","pluginLab.noComposer":"Open a conversation to use the message box.","pluginLab.draftNotRecorded":"The draft is in the message box, but its use was not recorded.","pluginLab.saving":"Changing…","makerDetail.region":"{title} record","makerDetail.noFiles":"This Maker changed no files","makerDetail.noChecks":"No checks were run","makerDetail.archiveUnobserved":"The record holds no tool results, so this cannot be confirmed","makerDetail.unavailable":"No run record matches this attempt exactly, so its detail cannot be opened","makerDetail.checkPassed":"passed","makerDetail.checkUnverified":"verdict not confirmed","makerDetail.checkFailed":"failed","makerDetail.checkUnobserved":"result not observed","dispatchLane.label":"Maker attempts","dispatchLane.runPhase":"{run} ({phase})","dispatchLane.checks":"checks {passed}/{total}","dispatchLane.checksUnobserved":"checks not observed","dispatchLane.checksLoading":"reading checks","dispatchLane.attempt":"attempt {attempt}","dispatchLane.attemptUnknown":"attempt","dispatchLane.verdict.accepted":"accepted","dispatchLane.verdict.rework":"rework","dispatchLane.verdict.held":"held","dispatchLane.open":"Details","dispatchLane.openLabel":"Open details for {title}","dispatchLane.unavailable":"No detail","credits.heading":"API credits","credits.estimateNote":"The billing-page balance is what you read on the provider's billing page at the shown time. Later usage is not included. Estimated spend and balance multiply this PC's token counts by published prices and are not a bill.","credits.loading":"Loading API credits…","credits.loadFailed":"Could not load API credits: {reason}","credits.wallet.hive":"Hive","credits.scope.hive":"This PC's records","credits.since":"since {date}","credits.sinceDefault":"last 30 days","credits.total":"Total","credits.spent":"Est. spent","credits.remaining":"Est. left","credits.meterLabel":"{wallet} credit used","credits.usedPct":"{pct}% used","credits.enterPrompt":"Enter the total and start date to see an estimated balance.","credits.enter":"Enter credit","credits.edit":"Edit","credits.formLabel":"{wallet} credit","credits.totalUsd":"Total (USD)","credits.startDate":"Start date","credits.save":"Save","credits.saving":"Saving…","credits.cancel":"Cancel","credits.clear":"Remove","credits.saveFailed":"Not saved: {reason}","credits.invalid.total":"Enter the total as a number.","credits.error.invalid_total":"the total must be a number above 0","credits.error.invalid_start_date":"check the start date","credits.error.start_date_in_future":"the start date is in the future","credits.error.session_scan_failed":"session records could not be read","credits.error.session_scan_partial":"some session records could not be read, so the spent amount is a minimum","credits.error.internal":"an unexpected error occurred","credits.error.settings_unreadable":"the credit settings file could not be read, so it was not overwritten","credits.walletError":"Usage not read: {reason}","credits.settingsError":"The credit settings file could not be read. Enter the credits again.","credits.tokens":"in {input} \xb7 out {output}","credits.cacheTokens":"cache {cache}","credits.requests":"{count} calls","credits.priceUnknown":"price unknown","credits.purpose.session":"Chat \xb7 agents","credits.purpose.memory":"Memory","credits.purpose.korean-reply-translation":"Reply translation","credits.wallet.anthropic":"Anthropic API","credits.billingLink":"Actual balance","credits.billingLinkLabel":"See the actual {wallet} balance on its billing page (opens in a new tab)","credits.scope.anthropic":"This PC's records","credits.anthropic.note":"Counts only API-key responses with recorded tokens; excludes subscription (OAuth) requests and failed attempts without tokens. Amounts are estimates at published prices, not a bill or balance.","credits.anthropic.noCoverage":"No requests in this window have a recorded credential kind, so API-key usage is unknown.","credits.anthropic.coverageSince":"First recorded credential in window: {date} (this PC may not have recorded every later request)","credits.anthropic.none":"No recorded API-key requests in this window.","credits.anthropic.oauthExcluded":"Subscription (OAuth) excluded","credits.anthropic.unattributedExcluded":"Unrecorded credential excluded","credits.category.input":"Input","credits.category.output":"Output","credits.category.cacheRead":"Cache read","credits.category.cacheWrite":"Cache write","credits.balance.label":"Billing-page balance","credits.balance.source":"Manual record","credits.balance.observed":"Checked {time}","credits.balance.age.now":"Just now","credits.balance.age.minutes":"{count}m ago","credits.balance.age.hours":"{count}h ago","credits.balance.age.days":"{count}d ago","credits.balance.none":"No recorded balance","credits.balance.record":"Record balance","credits.balance.edit":"Edit balance","credits.balance.formLabel":"{wallet} billing-page balance","credits.balance.amount":"Balance (USD)","credits.balance.observedAt":"Checked at","credits.balance.observedAtHint":"When you saw the balance on the billing page.","credits.invalid.amount":"Enter a valid balance number.","credits.invalid.observedAt":"Enter a valid time.","credits.error.invalid_balance":"the balance must be 0 or more","credits.error.invalid_observed_at":"check the time","credits.error.observed_at_in_future":"the time is later than now","credits.error.routes_unreadable":"the settings file could not be read, so the APIs in use are unknown","credits.wallet.exa":"Exa","credits.wallet.typesafe":"TypeSafe Jev","credits.route.hive":"Assigned to model roles (memory, skim, etc.)","credits.route.exa":"Default web search path","credits.route.typesafe":"Default quick judgement (Jev) path","credits.route.anthropic":"API key fallback when the subscription's weekly allowance runs out","credits.evidence.lastPaidUse":"Last paid use on this PC: {time}","credits.evidence.unverified":"Some session logs could not be read, so recent paid use is unconfirmed.","memoryTrace.refresh":"Refresh","memoryTrace.noSession":"Select a session to see how it looked up memories.","memoryTrace.loading":"Reading the session log…","memoryTrace.error":"Could not load the memory trace. {error}","memoryTrace.retry":"Load again","memoryTrace.empty":"This session has no memory or doc-map records.","memoryTrace.requests":"{count} requests with records","memoryTrace.requestsLabel":"Requests","memoryTrace.requestHeading":"Request #{index}","memoryTrace.noPreview":"(no text)","memoryTrace.flowLabel":"Request flow","memoryTrace.stageRecall":"Recalled","memoryTrace.stageJev":"JEV check","memoryTrace.stageDocmap":"Map candidates","memoryTrace.stageDocs":"Docs opened","memoryTrace.stageLessons":"Pre-edit lessons","memoryTrace.stageSaved":"Saved","memoryTrace.stageEmpty":"This step did not happen in this request.","memoryTrace.openedSummary":"{opened} opened \xb7 {skipped} not opened","memoryTrace.opened":"Opened","memoryTrace.candidateOnly":"Candidate only","memoryTrace.fromMap":"Map candidate","memoryTrace.lines":"Lines {lines}","memoryTrace.autoRecall":"Recalled before the request","memoryTrace.explicitRecall":"Looked up during the work","memoryTrace.query":"Query","memoryTrace.noResults":"No memories came back.","memoryTrace.noMemoryText":"This log keeps no text for this memory.","memoryTrace.jevUnknown":"{count} undecided","memoryTrace.jevUnrelated":"{count} unrelated","memoryTrace.lessonFor":"Memories shown before editing","memoryTrace.savedAuto":"Auto-saved","memoryTrace.graphLabel":"Link graph","memoryTrace.graphScope":"Graph scope","memoryTrace.scopeRequest":"This request","memoryTrace.scopeSession":"Whole session","memoryTrace.legendRequest":"Request","memoryTrace.legendMemory":"Memory","memoryTrace.legendDoc":"Map doc","memoryTrace.legendFile":"Edited file","memoryTrace.graphEmpty":"Nothing is linked in this scope.","memoryTrace.nodeLabel":"{kind}: {label}, {count} links","memoryTrace.edgeRecalled":"Recalled","memoryTrace.edgeLesson":"Pre-edit lesson","memoryTrace.verdictLegend":"JEV verdict","memoryTrace.verdictApply":"Applies","memoryTrace.verdictExcepted":"Condition not met or exception","memoryTrace.verdictConflict":"Conflicts with the request","memoryTrace.verdictUnconfirmed":"Condition unconfirmed","memoryTrace.verdictUnlisted":"Unrelated or undecided","memoryTrace.graphHint":"Point at or focus a node to read its full text here.","memoryTrace.legendDocEdited":"Opened and edited","memoryTrace.noticeHarness":"Harness","memoryTrace.noticeResume":"Auto-resume","routines.tab":"Routines","routines.title":"Routine boards","routines.back":"Back to chat","routines.panelIntro":"At the set time a new session runs, and its final answer is posted to that routine's board.","routines.galleryIntro":"Each routine has its own board. Posts come from the shared repository, so every PC shows the same boards.","routines.galleryList":"All boards","routines.new":"New routine","routines.col.gallery":"Board","routines.col.schedule":"Schedule","routines.col.host":"Runs on","routines.col.posts":"Posts","routines.col.latest":"Latest","routines.col.no":"No.","routines.col.title":"Title","routines.col.author":"Author","routines.col.date":"Date","routines.off":"Off","routines.on":"On","routines.turnOff":"Turn off","routines.turnOn":"Turn on","routines.toggledOff":'Turned off "{name}". Other PCs pick this up on their next sync, within about 5 minutes.',"routines.toggledOn":'Turned on "{name}". Other PCs pick this up on their next sync, within about 5 minutes.',"routines.hostNote":"This routine runs on {host}. Turning it on or off reaches other PCs on their next sync, within about 5 minutes.","routines.enabledCount":"{on} of {total} routines on","routines.filter.all":"All {count}","routines.filter.on":"On {count}","routines.filter.off":"Off {count}","routines.col.state":"State","routines.col.next":"Next run","routines.col.toggle":"Turn on or off","routines.nextRun":"Next run {time}","routines.lastRun":"Last run {time}, {result}","routines.lastRun.ok":"posted","routines.lastRun.quiet":"nothing to report","routines.lastRun.failed":"failed","routines.lastRun.timeout":"timed out","routines.noRunYet":"No runs yet","routines.newPosts":"{count} new","routines.newMark":"N","routines.newMarkLabel":"New post","routines.markAllRead":"Mark all read","routines.expandPost":"Show the whole post","routines.details":"Show details","routines.detailsHide":"Hide details","routines.deletedElsewhere":"This routine was deleted, possibly on another PC.","routines.networkError":"Request failed: {error}","routines.koreaTime":"Korea time","routines.sched.weekly":"{days} {times}","routines.sched.hourlyOne":"Every hour at :{minute}","routines.sched.hourlyN":"Every {every} hours at :{minute} (from {start}:{minute})","routines.sched.withDays":"{days}, {rest}","routines.sched.once":"Once on {date} {time}","routines.running":"Running","routines.status.failed":"Failed","routines.status.timeout":"Timed out","routines.tabAll":"All {count}","routines.tabFailed":"Failed {count}","routines.runNow":"Run now","routines.runHere":"Run now on this PC","routines.runHereHint":"Run now uses this PC ({host})","routines.runStarted":"Started on this PC. The post appears when the run finishes.","routines.settings":"Settings","routines.everyDay":"Every day","routines.weekdays":"Weekdays","routines.day.0":"Sun","routines.day.1":"Mon","routines.day.2":"Tue","routines.day.3":"Wed","routines.day.4":"Thu","routines.day.5":"Fri","routines.day.6":"Sat","routines.metaHost":"Runs on {host}","routines.metaCwd":"Folder {cwd}","routines.noPosts":"No posts yet.","routines.noPostsNext":"The first post appears after the next run ({time}).","routines.noPostsOff":"This routine is off, so nothing is scheduled. Run now posts one right away.","routines.noFailed":"No failed posts.","routines.empty":"No routines yet.","routines.emptyHint":"Create a routine and a new session runs on the days and time you pick. Its answer is posted to the routine's board.","routines.setupTitle":"Routine repository not found","routines.setupMissing":"The folder {dir} does not exist.","routines.setupNotGit":"The folder {dir} is not a git repository.","routines.setupBody":"Routines and their posts live in this repository, shared by home and cloud. Clone the private repository to that path, or set CUELO_ROUTINES_DIR to another path, then reload.","routines.reload":"Reload","routines.sync.ok":"Synced {time}","routines.sync.never":"Not synced yet","routines.sync.syncing":"Syncing","routines.sync.pending":"{count} commits to push","routines.sync.nothing":"Nothing to push","routines.sync.error":"Sync error: {error}","routines.openSession":"Open session","routines.postAuthor":"By {host}","routines.loadFailed":"Could not load: {error}","routines.postMissing":"Post not found.","routines.form.newTitle":"New routine","routines.form.editTitle":"Routine settings","routines.form.name":"Name","routines.form.days":"Days","routines.form.time":"Time","routines.form.host":"Runs on","routines.form.hostHint":"This PC is {host}. Scheduled runs happen only on the PC named here.","routines.form.model":"Routine Main model","routines.form.modelPlaceholder":"Use PC default","routines.form.modelHint":"Optional. Override as provider/model-id; the model must be available on the executing host. Ignored when the plugin is disabled.","routines.form.cwd":"Project folder","routines.form.cwdPlaceholder":"Leave empty to run in this routine's folder in the repository","routines.form.cwdHint":"A path on the PC that runs it. If that folder is missing there, the run is posted as failed.","routines.form.prompt":"Instructions","routines.form.enabled":"Active","routines.form.enabledLabel":"Run on schedule","routines.form.enabledHint":"Turning this off only stops the schedule. Posts stay.","routines.form.cancel":"Cancel","routines.form.save":"Save","routines.form.saving":"Saving…","routines.form.deleteText":"Deleting the routine also removes its {count} posts. They stay in git history.","routines.form.delete":"Delete routine","routines.form.deleteConfirm":'Delete the routine "{name}" and its {count} posts? They stay in git history.',"routines.form.daysRequired":"Pick at least one day.","routines.form.timesRequired":"Add at least one time.","routines.form.schedule":"Schedule","routines.form.kind.weekly":"Days and times","routines.form.kind.hourly":"Every few hours","routines.form.kind.once":"Once","routines.form.times":"Times","routines.form.newTime":"Time to add","routines.form.addTime":"Add time","routines.form.removeTime":"Remove {time}","routines.form.interval":"Interval","routines.form.everyHours":"Hours between runs","routines.form.everyHoursOption":"Every {n} h","routines.form.minute":"Minute","routines.form.startHour":"Start hour","routines.form.hourlyDaysHint":"Pick every day to run daily.","routines.form.when":"When","routines.form.date":"Date","routines.form.onceHint":"It runs once at that time and then turns itself off.","routines.form.quietHint":"If a run has nothing to report, the session starts its answer with [알림 없음] and no post is made.","inspector.label":"Inspector","inspector.views":"Inspector views","inspector.more":"More views","inspector.hide":"Hide inspector","inspector.show":"Show inspector","inspector.turn":"This turn","inspector.noTurn":"No turn yet.","inspector.backToChat":"Back to the conversation","workbench.places":"Places","workbench.runningCount":"{count} running","workbench.needsInput":"Needs input","workbench.needsInputCount":"{count} need input","navigator.group.input":"Needs input","navigator.group.running":"Running","navigator.group.done":"Finished"}}),o({id:"ko",label:"한국어",messages:s});var d=n(2730);let u="pi-locale",h=(0,i.createContext)(null);function p({children:e}){let[t,n]=(0,i.useState)("en"),[s,o]=(0,i.useState)(!1),m=(0,i.useMemo)(()=>c().map(e=>l.get(e)).filter(e=>!!e),[]),f=(0,i.useMemo)(()=>Object.fromEntries(c().flatMap(e=>{let t=l.get(e);return t?[[e,t.messages]]:[]})),[]);(0,i.useEffect)(()=>{let e=function(){var e;let t=null;try{t=window.localStorage.getItem(u)}catch{}let n=window.navigator.languages.length?window.navigator.languages:[window.navigator.language];return"string"==typeof(e=t)&&a.includes(e)?e:function(e){for(let t of e){let e=t.toLowerCase();if("en"===e||e.startsWith("en-"))return"en";if("ko"===e||e.startsWith("ko-"))break}return"ko"}(n)}();n(e),document.documentElement.lang=e,o(!0)},[]);let g=(0,i.useCallback)(e=>{if(l.get(e)){n(e),document.documentElement.lang=e;try{window.localStorage.setItem(u,e)}catch{}}},[]),x=(0,i.useCallback)((e,n)=>(0,d.u0)(t,e,f,n),[t,f]),v=(0,i.useMemo)(()=>({locale:s?t:"en",setLocale:g,t:x,supportedLocales:m}),[s,t,g,x,m]);return(0,r.jsx)(h.Provider,{value:v,children:e})}function m(){let e=(0,i.useContext)(h);if(!e)throw Error("useI18n must be used inside I18nProvider");return e}},89976:(e,t,n)=>{"use strict";n.d(t,{AppShell:()=>w6});var r=n(95155),i=n(12115),s=n(47650),a=n(73321),l=n(16871),o=n(66919),c=n(81886);let d=["chat","process","subagents","files","resource","sidechat","efficiency","plugins","memory"];Object.freeze({rail:60,transcript:560,composer:384,navigator:240,deck:372});let u=Object.freeze({navigator:860,deck:1232}),h=Object.freeze({activeView:"chat",transientLayer:null,deckExpanded:!1}),p=Object.fromEntries(d.map(e=>[e,!0]));function m(e){return"string"==typeof e&&!0===p[e]?e:h.activeView}function f(e,t){switch(t.type){case"select-view":{let n,r=m(t.view);return{activeView:r,transientLayer:null,deckExpanded:(n=!0===e.deckExpanded,"chat"!==r&&n)}}case"open-layer":{let n,r=m(e.activeView);return{activeView:r,transientLayer:t.layer,deckExpanded:(n=!0===e.deckExpanded,"chat"!==r&&n)}}case"toggle-layer":{let n,r=m(e.activeView);return{activeView:r,transientLayer:e.transientLayer===t.layer?null:t.layer,deckExpanded:(n=!0===e.deckExpanded,"chat"!==r&&n)}}case"close-layer":{let t,n=m(e.activeView);return{activeView:n,transientLayer:null,deckExpanded:(t=!0===e.deckExpanded,"chat"!==n&&t)}}case"set-deck-expanded":{let n,r=m(e.activeView);return{activeView:r,transientLayer:e.transientLayer,deckExpanded:(n=t.expanded,"chat"!==r&&n)}}}}function g(e){let t=Number.isFinite(e)?Math.max(0,e):0;return{availableWidth:t,navigator:t>=u.navigator?"pinned":"drawer",deck:t>=u.deck?"pinned":"view-stack"}}let x=null,v=!1,y=-1/0;function b(e,t=Date.now()){v=e,e||(y=t)}let w=["projects","priority"],k="omp-web:navigator-mode",j="omp-prio-on",S=["omp-relay-session-","omp-cwd-","ompscope_"],C="omp-web:session-opened-at";function N(e,t){if(e)try{let t=JSON.parse(e);if(t&&"object"==typeof t&&"number"==typeof t.since&&Number.isFinite(t.since)){let e={};if(t.opened&&"object"==typeof t.opened)for(let[n,r]of Object.entries(t.opened))"number"==typeof r&&Number.isFinite(r)&&(e[n]=r);return{since:t.since,opened:e}}}catch{}return{since:t,opened:{}}}function T(e,t){let n=null;for(let[r,i]of Object.entries(t.opened))(e.opened[r]??-1/0)>=i||((n??={...e.opened})[r]=i);return!n&&t.since>=e.since?e:{since:Math.min(e.since,t.since),opened:n??e.opened}}function I(e){let t=Date.parse(e.modified);return Number.isFinite(t)?t:null}function M(e,t,n){let r=Math.max(n,I(t)??0);return(e.opened[t.id]??-1/0)>=r?e:{since:e.since,opened:{...e.opened,[t.id]:r}}}let E=new Set;function R(e,t){let n=null;for(let r of t)Object.hasOwn(e.opened,r)&&(n??={...e.opened},delete n[r]);return n?{since:e.since,opened:n}:e}function $(e){let t=e.trim().replace(/\\/g,"/");return"/"===(t=t.startsWith("//")?`//${t.slice(2).replace(/\/{2,}/g,"/")}`:t.replace(/\/{2,}/g,"/"))||/^[a-zA-Z]:\/$/.test(t)||(t=t.replace(/\/+$/,"")),/^[a-zA-Z]:\//.test(t)||t.startsWith("//")?t.toLowerCase():t}function L(e){let t=new Map;for(let n of e){let e=n.projectRoot??n.cwd;if(!e)continue;let r=$(e),i=t.get(r);(!i||n.modified>i.modified)&&t.set(r,{project:e,modified:n.modified})}return[...t.values()].sort((e,t)=>t.modified.localeCompare(e.modified)).map(e=>e.project)}function P(e,t){let n=new Map;for(let e of t)"number"==typeof e.order&&Number.isFinite(e.order)&&n.set($(e.key),e.order);let r=[...e],i=new Set(e.map($));for(let e of t){let t=$(e.key);!t||i.has(t)||(r.push(e.path??e.key),i.add(t))}return r.map((e,t)=>({project:e,defaultIndex:t,order:n.get($(e))})).sort((e,t)=>{let n=void 0!==e.order,r=void 0!==t.order;return n!==r?n?-1:1:n&&r&&e.order!==t.order?e.order-t.order:e.defaultIndex-t.defaultIndex}).map(({project:e})=>e)}let A=/^<skill name="([^"\n]+)" location="([^"\n]+)">\nReferences are relative to [^\n]+\.\n\n([\s\S]*)\n<\/skill>(?:\n\n([\s\S]+))?$/;function _(e){let t=e.match(A);if(!t)return null;let[,n,,,r]=t;return r?`/skill:${n} ${r}`:`/skill:${n}`}var F=n(84183);let O=`(max-width: ${u.navigator-1}px)`;function z(e){return{subscribe(t){if(!window.matchMedia)return()=>{};let n=window.matchMedia(e);return n.addEventListener("change",t),()=>n.removeEventListener("change",t)},getSnapshot:()=>!!window.matchMedia&&window.matchMedia(e).matches}}let D=z("(max-width: 640px)"),W=z(O);function H(){return!1}function U(){return(0,i.useSyncExternalStore)(D.subscribe,D.getSnapshot,H)}var B=n(13004),q=n.n(B);async function V(e){let t=e?`?path=${encodeURIComponent(e)}`:"",n=await fetch(`/api/cwd/browse${t}`),r=await n.json();if(!n.ok||r.error)throw Error(r.error??`HTTP ${n.status}`);return r}function K(){return(0,r.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3","aria-hidden":"true",children:(0,r.jsx)("path",{d:"M1.5 3h4l1.5 2h7.5v7.5h-13z"})})}function G(){return(0,r.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,r.jsx)("rect",{x:"2",y:"3",width:"12",height:"10",rx:"1.5"}),(0,r.jsx)("path",{d:"M2 9h12"}),(0,r.jsx)("circle",{cx:"11.5",cy:"11",r:"0.6",fill:"currentColor",stroke:"none"})]})}function J({onCancel:e,onSelect:t,busy:n=!1,error:a}){let{t:l}=(0,F.s)(),[o,c]=(0,i.useState)(null),[d,u]=(0,i.useState)(""),[h,p]=(0,i.useState)(null),[m,f]=(0,i.useState)(!1),[g,x]=(0,i.useState)(""),[v,y]=(0,i.useState)([]),[b,w]=(0,i.useState)(null),[k,j]=(0,i.useState)(null),[S,C]=(0,i.useState)(!0),N=(0,i.useCallback)(async e=>{C(!0),j(null);try{let t=await V(e),n=t.path??e??"/";u(n),p(t.parentPath??null),f(!0===t.upToDrives),x(n),y(t.directories??[]),w(t.drives??null)}catch(e){j(e instanceof Error?e.message:String(e))}finally{C(!1)}},[]);(0,i.useEffect)(()=>{c(document.body),N()},[N]);let T=g.trim()!==d,I=!!d&&!T&&!n,M=!!h||m||/^[a-zA-Z]:[\\/]?$/.test(d);return o?(0,s.createPortal)((0,r.jsx)("div",{className:"directory-picker-backdrop",role:"dialog","aria-modal":"true","aria-label":l("directoryPicker.selectDirectory"),onClick:t=>{t.target!==t.currentTarget||n||e()},onKeyDown:t=>{"Escape"!==t.key||n||e()},style:{position:"fixed",inset:0,zIndex:1e3,display:"flex",alignItems:"center",justifyContent:"center",background:"var(--scrim)"},children:(0,r.jsxs)("div",{className:`directory-picker-panel ${q().sheet}`,style:{width:520,maxWidth:"calc(100vw - 16px)",height:"min(620px, calc(100dvh - 16px))",maxHeight:"calc(100dvh - 16px)",display:"flex",flexDirection:"column",overflow:"hidden"},children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",flexShrink:0,padding:"12px 18px"},children:[(0,r.jsx)("div",{style:{minWidth:0,flex:1},children:(0,r.jsx)("div",{style:{color:"var(--text)",fontWeight:700,fontSize:15},children:l("directoryPicker.selectDirectory")})}),(0,r.jsx)("button",{type:"button",onClick:e,disabled:n,title:l("i18n.close"),"aria-label":l("i18n.close"),className:q().btnQuiet,style:{fontSize:20,lineHeight:1},children:"\xd7"})]}),(0,r.jsxs)("form",{onSubmit:e=>{e.preventDefault();let t=g.trim();t&&N(t)},style:{display:"flex",alignItems:"center",gap:8,flexShrink:0,padding:"10px 14px"},children:[(0,r.jsx)("button",{className:`directory-picker-back ${q().btn}`,type:"button",onClick:()=>void N(h??void 0),disabled:S||!M,title:l("directoryPicker.goToParent"),"aria-label":l("directoryPicker.goToParent"),style:{width:36,height:36,padding:0,flexShrink:0,cursor:M?"pointer":"default"},children:(0,r.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,r.jsx)("path",{d:"m18 15-6-6-6 6"})})}),(0,r.jsx)("label",{htmlFor:"directory-path",style:{position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap"},children:l("directoryPicker.directoryPath")}),(0,r.jsx)("input",{className:`directory-picker-path ${q().field}`,id:"directory-path",type:"text",value:g,placeholder:"/path/to/project or ~/project",autoFocus:!0,autoComplete:"off",spellCheck:!1,onChange:e=>{x(e.target.value),j(null)},style:{minWidth:0,flex:1,height:36,fontFamily:"var(--font-mono)"}}),(0,r.jsx)("button",{className:`directory-picker-action ${q().btn}`,type:"submit",disabled:S||!g.trim(),title:l("directoryPicker.goToDirectory"),style:{minWidth:58,height:36},children:l("directoryPicker.go")})]}),(0,r.jsxs)("div",{className:"directory-picker-list",style:{flex:1,minHeight:0,overflow:"auto",padding:"8px 10px"},children:[S?(0,r.jsx)("div",{style:{padding:8,color:"var(--text-dim)",fontSize:11},children:l("directoryPicker.loadingDirectories")}):null!==b?(0,r.jsx)(r.Fragment,{children:b.length>0?b.map(e=>(0,r.jsxs)("button",{className:`directory-picker-entry ${q().navRow}`,type:"button",onClick:()=>void N(e.path),title:e.path,style:{minHeight:34,gap:7,padding:"6px 8px",color:"var(--text-muted)",fontFamily:"var(--font-mono)",fontSize:11},children:[(0,r.jsx)(G,{}),(0,r.jsx)("span",{children:e.name})]},e.path)):(0,r.jsx)("div",{style:{padding:8,color:"var(--text-dim)",fontSize:11},children:l("directoryPicker.noDrives")})}):v.length>0?v.map(e=>(0,r.jsxs)("button",{className:`directory-picker-entry ${q().navRow}`,type:"button",onClick:()=>void N(e.path),title:e.path,style:{minHeight:30,gap:7,padding:"5px 8px",color:"var(--text-muted)",fontFamily:"var(--font-mono)",fontSize:11},children:[(0,r.jsx)(K,{}),(0,r.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name})]},e.path)):(0,r.jsx)("div",{style:{padding:8,color:"var(--text-dim)",fontSize:11},children:l("directoryPicker.noSubdirectories")}),(k||a)&&(0,r.jsx)("div",{style:{padding:"8px",color:"var(--danger)",fontSize:11},children:k??a})]}),(0,r.jsxs)("div",{className:"directory-picker-footer",style:{display:"flex",justifyContent:"flex-end",alignItems:"center",gap:10,flexShrink:0,padding:"10px 18px"},children:[(0,r.jsx)("button",{className:`directory-picker-action ${q().btn}`,type:"button",onClick:e,disabled:n,style:{padding:"6px 14px",fontSize:13},children:l("i18n.cancel")}),(0,r.jsx)("button",{className:`directory-picker-action ${q().btnPrimary}`,type:"button",onClick:()=>t(d),disabled:!I,title:l(T?"directoryPicker.openBeforeSelecting":"directoryPicker.selectCurrentDirectory"),style:{padding:"6px 16px",fontSize:13},children:l(n?"i18n.checking":"directoryPicker.selectThisFolder")})]})]})}),o):null}var Y=n(21443),Z=n.n(Y);async function Q(e,t){let n=await fetch(e,t?{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}:void 0),r=await n.json();if(!n.ok)throw Error(r.error||`HTTP ${n.status}`);return r}function X({onCancel:e,onSelect:t,busy:n=!1,error:a}){let{t:l}=(0,F.s)(),o=(0,i.useRef)(null),[c,d]=(0,i.useState)(!1),[u,h]=(0,i.useState)(!1),[p,m]=(0,i.useState)(null),[f,g]=(0,i.useState)([]),[x,v]=(0,i.useState)(""),[y,b]=(0,i.useState)(""),[w,k]=(0,i.useState)(!0),[j,S]=(0,i.useState)(!1),[C,N]=(0,i.useState)(!1),[T,I]=(0,i.useState)(null),[M,E]=(0,i.useState)(!1),[R,$]=(0,i.useState)(50),L=p?.device?.state==="pending",P=n||C,A=(0,i.useCallback)(async()=>{k(!0),I(null);try{let e=await Q("/api/github/projects");m(e),e.connected&&g((await Q("/api/github/projects?view=repositories")).repositories)}catch(e){I(e instanceof Error?e.message:String(e))}finally{k(!1)}},[]);async function _(){S(!0),I(null);try{let{device:e}=await Q("/api/github/projects",{action:"login"});m({connected:!1,login:null,device:e})}catch(e){I(e instanceof Error?e.message:String(e))}finally{S(!1)}}async function O(e){if(e.preventDefault(),y.trim()&&!P){N(!0),I(null);try{let{cwd:e}=await Q("/api/github/projects",{action:"open",repository:y});t(e)}catch(e){I(e instanceof Error?e.message:String(e))}finally{N(!1)}}}if((0,i.useEffect)(()=>{d(!0),A()},[A]),(0,i.useEffect)(()=>{if(!c||u)return;let e=o.current;return e?.showModal(),()=>e?.close()},[c,u]),(0,i.useEffect)(()=>{let e;if(!L||u)return;let t=!1,n=async()=>{try{let e=await Q("/api/github/projects");if(t)return;if(m(e),e.connected)return void await A();if(e.device?.state!=="pending")return}catch(e){t||I(e instanceof Error?e.message:String(e));return}t||(e=window.setTimeout(n,3e3))};return e=window.setTimeout(n,1500),()=>{t=!0,clearTimeout(e)}},[L,u,A]),!c)return null;if(u)return(0,r.jsx)(J,{onCancel:()=>h(!1),onSelect:t,busy:n,error:a});let z=f.filter(e=>`${e.fullName} ${e.description??""}`.toLowerCase().includes(x.toLowerCase())),D=T??a??p?.device?.error;return(0,s.createPortal)((0,r.jsx)("dialog",{ref:o,className:Z().dialog,"aria-labelledby":"cloud-project-title",onCancel:t=>{t.preventDefault(),P||e()},children:(0,r.jsxs)("form",{onSubmit:O,className:Z().form,children:[(0,r.jsxs)("header",{className:Z().header,children:[(0,r.jsx)("h2",{id:"cloud-project-title",children:l("cloudProjects.title")}),(0,r.jsx)("p",{children:l("cloudProjects.description")})]}),(0,r.jsxs)("div",{className:Z().sources,children:[(0,r.jsx)("span",{className:Z().activeSource,children:l("cloudProjects.github")}),(0,r.jsx)("button",{type:"button",onClick:()=>h(!0),disabled:P,children:l("cloudProjects.serverFolder")})]}),(0,r.jsxs)("div",{className:Z().body,children:[(0,r.jsxs)("section",{className:Z().account,"aria-label":l("cloudProjects.account"),children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("strong",{children:p?.connected?p.login:l("cloudProjects.connectTitle")}),(0,r.jsx)("p",{children:p?.connected?l("cloudProjects.connected"):l("cloudProjects.connectHelp")})]}),p?.connected?(0,r.jsx)("button",{type:"button",className:Z().secondary,onClick:()=>void A(),disabled:w||P,children:l("cloudProjects.refresh")}):(0,r.jsx)("button",{type:"button",className:Z().secondary,onClick:()=>void _(),disabled:w||j||L||P,children:j||L?l("cloudProjects.waiting"):l("cloudProjects.connect")})]}),L&&(0,r.jsxs)("div",{className:Z().login,role:"status",children:[(0,r.jsx)("p",{children:l("cloudProjects.deviceHelp")}),p.device?.code?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:Z().codeRow,children:[(0,r.jsx)("code",{children:p.device.code}),(0,r.jsx)("button",{type:"button",className:Z().secondary,onClick:()=>{navigator.clipboard.writeText(p.device.code).then(()=>E(!0)).catch(()=>I(l("cloudProjects.copyFailure")))},children:M?l("cloudProjects.copied"):l("cloudProjects.copyCode")})]}),(0,r.jsx)("a",{href:"https://github.com/login/device",target:"_blank",rel:"noreferrer",className:Z().loginLink,children:l("cloudProjects.openLogin")}),(0,r.jsx)("small",{children:l("cloudProjects.permissionHelp")})]}):(0,r.jsx)("p",{children:l("cloudProjects.preparingCode")})]}),p?.connected&&(0,r.jsxs)("section",{className:Z().repositories,"aria-label":l("cloudProjects.repositories"),children:[(0,r.jsx)("label",{htmlFor:"cloud-repo-search",children:l("cloudProjects.search")}),(0,r.jsx)("input",{id:"cloud-repo-search",value:x,onChange:e=>{v(e.target.value),$(50)},placeholder:l("cloudProjects.searchPlaceholder"),type:"search",disabled:P}),w?(0,r.jsx)("p",{role:"status",children:l("cloudProjects.loading")}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("ul",{className:Z().list,children:z.slice(0,R).map(e=>(0,r.jsx)("li",{children:(0,r.jsxs)("button",{type:"button",className:Z().repo,"aria-pressed":y===e.fullName,disabled:P,onClick:()=>b(e.fullName),children:[(0,r.jsxs)("span",{className:Z().repoHeading,children:[(0,r.jsx)("strong",{children:e.fullName}),(0,r.jsx)("small",{children:e.private?l("cloudProjects.private"):l("cloudProjects.public")})]}),e.description&&(0,r.jsx)("span",{className:Z().repoDescription,children:e.description})]})},e.fullName))}),!z.length&&(0,r.jsx)("p",{children:l("cloudProjects.empty")}),z.length>R&&(0,r.jsx)("button",{type:"button",className:Z().secondary,onClick:()=>$(e=>e+50),children:l("cloudProjects.more")})]})]}),(0,r.jsxs)("div",{className:Z().repositoryInput,children:[(0,r.jsx)("label",{htmlFor:"cloud-repository",children:l("cloudProjects.urlLabel")}),(0,r.jsx)("input",{id:"cloud-repository",value:y,onChange:e=>b(e.target.value),placeholder:"owner/repository",autoComplete:"off",spellCheck:!1,disabled:P,"aria-describedby":"cloud-repo-help"}),(0,r.jsx)("small",{id:"cloud-repo-help",children:l("cloudProjects.publicHelp")})]}),D&&(0,r.jsxs)("div",{className:Z().error,role:"alert",children:[(0,r.jsx)("strong",{children:l("cloudProjects.error")}),(0,r.jsx)("p",{children:D}),(0,r.jsx)("button",{type:"button",className:Z().secondary,onClick:()=>void A(),disabled:P,children:l("cloudProjects.refresh")})]}),C&&(0,r.jsx)("p",{role:"status",className:Z().progress,children:l("cloudProjects.openingHelp")})]}),(0,r.jsxs)("footer",{className:Z().footer,children:[(0,r.jsx)("button",{type:"button",className:Z().secondary,onClick:e,disabled:P,children:l("i18n.cancel")}),(0,r.jsx)("button",{type:"submit",className:Z().primary,disabled:P||!y.trim(),children:P?l("cloudProjects.opening"):l("cloudProjects.open")})]})]})}),document.body)}function ee({label:e="CUELO",markSize:t=22,gap:n=10,style:i,labelStyle:s}){return(0,r.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:n,minWidth:0,color:"var(--text)",...i},children:[(0,r.jsxs)("svg",{viewBox:"0 0 100 100",width:t,height:t,"aria-hidden":"true",style:{flexShrink:0},children:[(0,r.jsx)("path",{d:"M77.9 30.5 A34 34 0 0 0 16 50 A26 26 0 0 0 68 50",fill:"none",stroke:"currentColor",strokeWidth:"10",strokeLinecap:"round"}),(0,r.jsx)("circle",{cx:"42",cy:"50",r:"8.5",fill:"var(--brand-lamp)"})]}),(0,r.jsx)("span",{style:{minWidth:0,overflow:"hidden",color:"inherit",fontFamily:"var(--font-heading)",fontSize:15,fontWeight:700,letterSpacing:"-0.025em",whiteSpace:"nowrap",...s},children:e})]})}var et=n(2730);let en={ko:{"translator.modeVoice":"대화","translator.modeType":"타자","translator.source":"입력 언어","translator.swapDirection":"방향 바꾸기","translator.typeLabel":"번역할 문장","translator.typePlaceholder":"여행 중 전할 말을 입력하세요.","translator.typeSubmit":"번역","translator.typePending":"번역 중…","translator.typeError":"번역하지 못했어요. 다시 시도해 주세요.","translator.typeAuth":"Codex 로그인 상태를 확인해 주세요.","translator.tab":"통역","translator.title":"통역","translator.back":"대화로","translator.panelHint":"통역을 시작하면 ChatGPT 계정의 Codex 라이브가 두 사람의 말을 서로의 언어로 바로 소리 내어 옮깁니다. 작업 세션과 하네스 규칙을 거치지 않고, 기록은 저장하지 않습니다.","translator.open":"통역 화면 열기","translator.me":"나","translator.them":"상대","translator.myLanguage":"내 언어","translator.theirLanguage":"상대 언어","translator.swap":"두 언어 바꾸기","translator.clear":"지우기","translator.start":"통역 시작","translator.stop":"통역 끝내기","translator.empty":"통역 시작을 누르고 폰을 두 사람 사이에 두세요. 누가 말하든 상대 언어로 바로 옮겨 말합니다.","translator.connecting":"연결 중…","translator.live":"듣는 중 \xb7 그냥 말하세요","translator.unsupported":"이 브라우저는 실시간 통화(WebRTC\xb7마이크)를 지원하지 않습니다. 폰에서는 Chrome이나 Safari로 여세요.","translator.insecure":"마이크는 HTTPS 주소에서만 켜집니다.","translator.micDenied":"마이크 권한이 막혀 있습니다. 브라우저 설정에서 이 주소의 마이크를 허용하세요.","translator.micUnavailable":"마이크를 켜지 못했습니다. 다른 앱이 쓰고 있지 않은지 확인하세요.","translator.auth":"Codex 로그인이 없거나 만료됐습니다. 모델 설정에서 ChatGPT 계정으로 다시 로그인하세요.","translator.upstream":"Codex 라이브 연결이 끊겼습니다: {error}","translator.failed":"통역을 시작하지 못했습니다: {error}","translator.original":"원문","translator.translationPending":"통역 중…","translator.conversation":"통역 기록","translator.mood":"분위기","translator.mood.casual":"편하게","translator.mood.polite":"정중하게","translator.mood.formal":"격식 있게","translator.mood.haggling":"흥정","translator.mood.urgent":"긴급","translator.gender":"내 성별","translator.gender.male":"남성","translator.gender.female":"여성","translator.age":"내 나이대","translator.age.20s":"20대","translator.age.30s":"30대","translator.age.40s":"40대","translator.age.50s":"50대","translator.age.60s":"60대 이상","translator.partnerGender":"상대 성별","translator.partnerAge":"상대 나이","translator.partnerAge.child":"아이","translator.partnerAge.younger":"나보다 어리거나 비슷","translator.partnerAge.older":"나보다 위","translator.partnerAge.parent":"부모님 또래","translator.partnerAge.grandparent":"조부모님 또래","translator.notSet":"선택 안 함","translator.face":"마주보기","translator.faceHint":"상대 쪽 자막을 뒤집어 마주 앉은 사람이 읽게 합니다","translator.reconnecting":"다시 연결 중…","translator.idleStopped":"한동안 대화가 없어 통역을 멈췄습니다. 다시 시작하면 앞 대화에 이어집니다.","translator.generationSkipped":"방금 말은 통역하지 못하고 넘어갔습니다. 이어서 말씀하시면 계속 통역합니다.","translator.setup":"언어\xb7상황 설정","translator.sizeDown":"글자 작게","translator.sizeUp":"글자 크게","translator.faceExit":"마주보기 끄기","translator.translating":"옮기는 중…","translator.errorStatus":"통역이 멈췄습니다","translator.translation":"통역","translator.unknownLanguage":"언어 모름","translator.jumpLatest":"최근 말로","translator.voice":"통역 음성 듣기","translator.voiceHint":"끄면 통역을 글로만 보여 줍니다. 스피커가 조용하니 마이크를 막지 않아 통역 중에 끼어든 말도 들립니다.","translator.echoGuard":"통역 음성이 나올 때 마이크 끄기","translator.echoGuardHint":"스피커로 나온 통역이 다시 통역되지 않게 합니다. 그동안 상대가 한 말은 들리지 않으니 이어폰을 쓰면 꺼 두세요.","translator.noiseSuppression":"AI 소음 제거","translator.fastDrafts":"빠른 초안 자막","translator.fastDraftsHint":"전용 번역 모델이 초안 자막을 먼저 띄우고 Codex가 곧 바로잡습니다. 켜 둔 동안 추가 요금이 들 수 있습니다.","translator.noiseSuppressionHint":"시끄러운 곳에서 마이크 소음을 줄여 통역이 말을 더 잘 알아듣게 합니다. 목소리가 뭉개지면 꺼 두세요."},en:{"translator.modeVoice":"Voice","translator.modeType":"Type","translator.source":"Input language","translator.swapDirection":"Swap direction","translator.typeLabel":"Text to translate","translator.typePlaceholder":"Type what you want to say.","translator.typeSubmit":"Translate","translator.typePending":"Translating…","translator.typeError":"Translation failed. Try again.","translator.typeAuth":"Check your Codex sign-in.","translator.tab":"Interpret","translator.title":"Interpreter","translator.back":"Back to chat","translator.panelHint":"Start interpreting and Codex Live on your ChatGPT account speaks each person's words in the other's language right away. It bypasses work sessions and harness rules, and nothing is saved.","translator.open":"Open interpreter","translator.me":"Me","translator.them":"Them","translator.myLanguage":"My language","translator.theirLanguage":"Their language","translator.swap":"Swap languages","translator.clear":"Clear","translator.start":"Start interpreting","translator.stop":"Stop interpreting","translator.empty":"Press Start interpreting and put the phone between you. Whoever speaks is interpreted into the other language right away.","translator.connecting":"Connecting…","translator.live":"Listening \xb7 just talk","translator.unsupported":"This browser cannot make live calls (WebRTC and microphone). On a phone, open this page in Chrome or Safari.","translator.insecure":"The microphone only works on an HTTPS address.","translator.micDenied":"Microphone access is blocked. Allow the microphone for this address in the browser settings.","translator.micUnavailable":"The microphone could not be opened. Check that no other app is using it.","translator.auth":"The Codex sign-in is missing or expired. Sign in again with your ChatGPT account in model settings.","translator.upstream":"The Codex live connection dropped: {error}","translator.failed":"Interpreting could not start: {error}","translator.original":"Original","translator.translationPending":"Interpreting…","translator.conversation":"Interpretation log","translator.mood":"Mood","translator.mood.casual":"Casual","translator.mood.polite":"Polite","translator.mood.formal":"Formal","translator.mood.haggling":"Haggling","translator.mood.urgent":"Urgent","translator.gender":"My gender","translator.gender.male":"Male","translator.gender.female":"Female","translator.age":"My age","translator.age.20s":"20s","translator.age.30s":"30s","translator.age.40s":"40s","translator.age.50s":"50s","translator.age.60s":"60+","translator.partnerGender":"Their gender","translator.partnerAge":"Their age","translator.partnerAge.child":"Child","translator.partnerAge.younger":"Younger or same age","translator.partnerAge.older":"Older than me","translator.partnerAge.parent":"My parents' age","translator.partnerAge.grandparent":"My grandparents' age","translator.notSet":"Not set","translator.face":"Face to face","translator.faceHint":"Flip the other side's captions so the person across from you can read them","translator.reconnecting":"Reconnecting…","translator.idleStopped":"Interpreting stopped after a long silence. Start again to continue the conversation.","translator.generationSkipped":"That last line couldn't be interpreted and was skipped. Keep talking; interpreting continues.","translator.setup":"Languages and setting","translator.sizeDown":"Smaller text","translator.sizeUp":"Larger text","translator.faceExit":"Leave face to face","translator.translating":"Interpreting…","translator.errorStatus":"Interpreting stopped","translator.translation":"Interpretation","translator.unknownLanguage":"Language unknown","translator.jumpLatest":"Jump to latest","translator.voice":"Play the interpretation aloud","translator.voiceHint":"Off, the interpretation is shown as text only. With the speaker silent the mic stays open, so words spoken over an interpretation are heard too.","translator.echoGuard":"Mute the mic while the interpretation plays","translator.echoGuardHint":"Keeps the speaker's interpretation from being interpreted again. Words spoken meanwhile are not heard, so turn it off with earphones.","translator.noiseSuppression":"AI noise suppression","translator.fastDrafts":"Quick draft captions","translator.fastDraftsHint":"A dedicated translation model shows a quick draft first and Codex corrects it. Extra charges may apply while this is on.","translator.noiseSuppressionHint":"Cuts background noise from the mic in a loud place so the interpreter hears you better. Turn it off if your voice sounds muffled."}};function er(){let{locale:e}=(0,F.s)();return{tt:(0,i.useCallback)((t,n)=>(0,et.u0)(e,t,en,n),[e]),locale:e}}let ei={en:{issueLabel:"GitHub issue (optional)",issuePlaceholder:"#123 or GitHub issue URL",issueStart:"Start issue session",issueBusy:"Starting…",fallbackBase:"Fetch failed; started from local {branch}"},ko:{issueLabel:"GitHub 이슈 (선택)",issuePlaceholder:"#123 또는 GitHub 이슈 URL",issueStart:"이슈 세션 시작",issueBusy:"시작 중…",fallbackBase:"가져오기 실패; 로컬 {branch}에서 시작됨"},zh:{issueLabel:"GitHub Issue(可选)",issuePlaceholder:"#123 或 GitHub Issue URL",issueStart:"开始 Issue 会话",issueBusy:"正在启动…",fallbackBase:"拉取失败;已从本地 {branch} 启动"}},es={en:"The subdirectory {path} is not in this worktree; opened its root instead",ko:"이 워크트리에 하위 디렉터리 {path}이(가) 없어 루트 디렉터리를 대신 열었습니다",zh:"此工作树中不存在子目录 {path},已改为打开其根目录"};function ea(e,t){if(t)try{sessionStorage.setItem(`cuelo:worktree:${e}`,JSON.stringify(t))}catch{}}let el="omp-web:unread-session-ids",eo="omp-web:pinned-session-ids",ec="omp-web:removed-projects";function ed(e,t){return{minHeight:t?44:30,padding:"3px 10px",border:0,borderRadius:"var(--radius-control)",background:"var(--bg-hover)",color:e?"var(--text-dim)":"var(--text-muted)",cursor:e?"default":"pointer",fontSize:"var(--seed-font-size-t2-static)",lineHeight:1.3,textAlign:"left",whiteSpace:"normal",overflowWrap:"anywhere"}}function eu(e,t){return t&&e.startsWith(t)?"~"+e.slice(t.length):e}function eh({text:e,style:t}){return(0,r.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block",minWidth:0,lineHeight:1.35,direction:"rtl",textAlign:"left",...t},children:(0,r.jsx)("span",{style:{unicodeBidi:"plaintext"},children:e})})}function ep({open:e,children:t,style:n}){let[s,a]=(0,i.useState)(e),[l,o]=(0,i.useState)(e);return((0,i.useEffect)(()=>{let t,n;return e?(a(!0),o(!1),t=window.requestAnimationFrame(()=>{t=window.requestAnimationFrame(()=>o(!0))})):(o(!1),n=setTimeout(()=>a(!1),140)),()=>{void 0!==t&&window.cancelAnimationFrame(t),n&&clearTimeout(n)}},[e]),s)?(0,r.jsx)("div",{style:{...n,opacity:+!!l,transform:l?"translateY(0) scale(1)":"translateY(-8px) scale(0.96)",transformOrigin:"top center",transition:"opacity 140ms ease, transform 140ms ease",pointerEvents:e?"auto":"none"},children:t}):null}let em="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*";function ef(){let[e,t]=(0,i.useState)(!1),[n,s]=(0,i.useState)(!1),a=(0,i.useRef)(null),l=function(e,t){let[n,r]=(0,i.useState)(e),s=(0,i.useRef)(null),a=(0,i.useRef)(0);return(0,i.useEffect)(()=>{if(!t)return void r(e);a.current=0;let n=4*e.length,i=()=>{a.current+=1;let t=Math.floor(a.current/n*e.length);r(e.split("").map((e,n)=>" "===e?" ":n<t?e:em[Math.floor(Math.random()*em.length)]).join("")),a.current<n?s.current=requestAnimationFrame(i):r(e)};return s.current=requestAnimationFrame(i),()=>{s.current&&cancelAnimationFrame(s.current)}},[e,t]),n}(e?"0.10.270/18.20.2":"CUELO",n),o=(0,i.useCallback)(e=>{t(e),s(!0),setTimeout(()=>s(!1),(e?6:8)*4*(1e3/60)+100)},[]),c=(0,i.useCallback)(()=>{a.current&&clearTimeout(a.current);let t=!e;o(t),t&&(a.current=setTimeout(()=>o(!1),3e3))},[e,o]);return(0,i.useEffect)(()=>()=>{a.current&&clearTimeout(a.current)},[]),(0,r.jsx)("button",{className:"navigator-brand",onClick:c,style:{display:"flex",alignItems:"center",background:"none",border:"none",padding:0,cursor:"default",color:e?"var(--accent)":"var(--text)",flex:"0 1 auto",minWidth:0,overflow:"hidden"},children:(0,r.jsx)(ee,{label:l,labelStyle:e?{fontFamily:"var(--font-mono)",fontSize:12,letterSpacing:"-0.02em",textOverflow:"ellipsis"}:void 0})})}async function eg(e){let t=await fetch("/api/projects",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({updates:e})});if(!t.ok)throw Error(`HTTP ${t.status}`)}function ex({selectedSessionId:e,optimisticSession:t,onSelectSession:n,onNewSession:s,initialSessionId:a,skipInitialProjectSelection:l,onInitialRestoreDone:o,refreshKey:c,onSessionDeleted:d,selectedCwd:u,onCwdChange:h,onBackgroundTaskDone:p,translatorPanel:m,translatorActive:f=!1,routinePanel:g,routineActive:x=!1,navigatorMode:v="projects",onActivityChange:y}){let b,{tt:w}=er(),{t:k,locale:j}=(0,F.s)(),A=U(),[_,O]=(0,i.useState)([]),z=(0,i.useMemo)(()=>t&&!_.some(e=>e.id===t.id)?[t,..._]:_,[_,t]),[D,W]=(0,i.useState)(!0),[H,B]=(0,i.useState)(null),[q,V]=(0,i.useState)(null),[K,G]=(0,i.useState)(""),[Y,Z]=(0,i.useState)(!1),[Q,ee]=(0,i.useState)(""),[et,en]=(0,i.useState)(()=>new Set),[em,ey]=(0,i.useState)(()=>new Set),[ej,eS]=(0,i.useState)(null),[eC,eT]=(0,i.useState)(null),[eI,eM]=(0,i.useState)({version:1,projects:[]}),[eE,eR]=(0,i.useState)(!1),[e$,eL]=(0,i.useState)(!1),[eP,eA]=(0,i.useState)(!1),[e_,eF]=(0,i.useState)(null),[eO,ez]=(0,i.useState)(""),[eD,eW]=(0,i.useState)(!1),[eH,eU]=(0,i.useState)(null),[eB,eq]=(0,i.useState)(""),[eV,eK]=(0,i.useState)(!1),[eG,eJ]=(0,i.useState)(null),[eY,eZ]=(0,i.useState)(!1),[eQ,eX]=(0,i.useState)(null),[e0,e1]=(0,i.useState)(!1),[e2,e8]=(0,i.useState)(!1),[e4,e5]=(0,i.useState)(""),[e6,e3]=(0,i.useState)(null),[e7,e9]=(0,i.useState)(""),[te,tt]=(0,i.useState)(!1),[tn,tr]=(0,i.useState)(null),ti=(0,i.useRef)(null),[ts,ta]=(0,i.useState)(!1),[tl,to]=(0,i.useState)(null),tc=(0,i.useRef)(null),td=(0,i.useRef)(null),tu=(0,i.useRef)(null),th=(0,i.useRef)(!1),tp=(0,i.useRef)(!1),[tm,tf]=(0,i.useState)(!1),[tg,tx]=(0,i.useState)(()=>new Set),[tv,ty]=(0,i.useState)(()=>new Set),[tb,tw]=(0,i.useState)(()=>(function(){try{let e=window.localStorage.getItem(el);if(!e)return new Set;let t=JSON.parse(e);if(Array.isArray(t))return new Set(t.filter(e=>"string"==typeof e));return new Set}catch{return new Set}})()),[tk,tj]=(0,i.useState)(()=>new Set),[tS,tC]=(0,i.useState)(null),[tN,tT]=(0,i.useState)(!1),tI=(0,i.useRef)(new Set),tM=(0,i.useRef)(!1),tE=(0,i.useRef)(null);(0,i.useEffect)(()=>{tj(function(){try{let e=window.localStorage.getItem(eo);if(!e)return new Set;let t=JSON.parse(e);return Array.isArray(t)?new Set(t.filter(e=>"string"==typeof e)):new Set}catch{return new Set}}())},[]),(0,i.useEffect)(()=>{let e=null;try{e=window.localStorage.getItem(C)}catch{}tC(N(e,Date.now()));let t=e=>{if(e.key!==C||null===e.newValue)return;let t=N(e.newValue,Date.now());tC(e=>e?T(e,t):e)};return window.addEventListener("storage",t),()=>window.removeEventListener("storage",t)},[]);let tR=(0,i.useCallback)(async()=>{try{let e=await fetch("/api/projects",{cache:"no-store",signal:AbortSignal.timeout(5e3)});if(!e.ok)throw Error(`HTTP ${e.status}`);eM(await e.json())}catch{eM({version:1,projects:[]})}finally{eR(!0)}},[]);(0,i.useEffect)(()=>{tR()},[tR,c]),(0,i.useEffect)(()=>{let e=null;try{e=window.localStorage.getItem(ec)}catch{return}if(!e)return;let t=[];try{let n=JSON.parse(e);Array.isArray(n)&&(t=n.filter(e=>"string"==typeof e))}catch{t=[]}(async()=>{try{for(let e=0;e<t.length;e+=500){let n=t.slice(e,e+500);await eg(n.map(e=>({key:$(e),path:e,hidden:!0})))}}catch{return}try{window.localStorage.removeItem(ec)}catch{}await tR()})()},[tR]);let t$=(0,i.useCallback)(async e=>{if(tp.current)throw Error("Project update in progress");tp.current=!0,eW(!0);try{await eg(e),await tR()}finally{tp.current=!1,eW(!1)}},[tR]);(0,i.useEffect)(()=>{e_&&tu.current?.select()},[e_]);let tL=(0,i.useCallback)(async(e=!1,t=!1)=>{try{e&&W(!0);let n=await fetch(t?"/api/sessions?force=1":"/api/sessions",{cache:"no-store"});if(!n.ok)throw Error(`HTTP ${n.status}`);let r=await n.json();O(r.sessions),tM.current||tx(new Set(r.runningSessionIds??[])),B(null),e||(tf(!0),tE.current&&clearTimeout(tE.current),tE.current=setTimeout(()=>tf(!1),2e3))}catch(e){B(String(e))}finally{e&&W(!1)}},[]),tP=(0,i.useCallback)(e=>{tw(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n}),tj(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n}),tC(t=>t&&R(t,[e])),d?.(e),tL()},[tL,d]),[tA,t_]=(0,i.useState)(null),[tF,tO]=(0,i.useState)(!1),[tz,tD]=(0,i.useState)(null),tW=(0,i.useCallback)(()=>{tF||(t_(null),tD(null))},[tF]),tH=(0,i.useCallback)(async e=>{tO(!0),tD(null);let t=[],n=[],r=[];for(let i of e)if(!i.transient)try{let e=await fetch(`/api/sessions/${encodeURIComponent(i.id)}?skipRunning=1`,{method:"DELETE"});if(409===e.status){n.push(i.id);continue}if(!e.ok)throw Error(`HTTP ${e.status}`);t.push(i.id)}catch{r.push(i.name?.trim()||i.id.slice(0,8))}if(n.length>0&&(tM.current=!0,tx(e=>{if(n.every(t=>e.has(t)))return e;let t=new Set(e);for(let e of n)t.add(e);return t})),t.length>0){let e=new Set(t),n=n=>t.some(e=>n.has(e))?new Set([...n].filter(t=>!e.has(t))):n;for(let e of(tw(n),tj(n),tC(e=>e&&R(e,t)),t))d?.(e)}(await tL(),tO(!1),r.length>0)?tD(k("sidebar.clearSessionsFailed",{count:r.length,names:r.join(", ")})):n.length>0||t_(null)},[tL,d,k]),[tU,tB]=(0,i.useState)(0),tq=(0,i.useCallback)(()=>{tB(e=>e+1),tL()},[tL]),tV=(0,i.useRef)(!1);(0,i.useEffect)(()=>{let e=!tV.current;tV.current=!0,tL(e,!e)},[tL,c]),(0,i.useEffect)(()=>{if("priority"!==v)return;let e=()=>{"visible"===document.visibilityState&&tL(!1,!0)};e();let t=window.setInterval(e,15e3);return()=>window.clearInterval(t)},[tL,v]),(0,i.useEffect)(()=>{y?.({running:tg.size,waiting:_.filter(e=>tv.has(e.id))})},[_,y,tg,tv]),(0,i.useEffect)(()=>{try{0===tb.size?window.localStorage.removeItem(el):window.localStorage.setItem(el,JSON.stringify([...tb]))}catch{}},[tb]),(0,i.useEffect)(()=>{try{0===tk.size?window.localStorage.removeItem(eo):window.localStorage.setItem(eo,JSON.stringify([...tk]))}catch{}},[tk]),(0,i.useEffect)(()=>{if(tS)try{var e,t,n;let r,i,s=window.localStorage;s.setItem(C,(e=s.getItem(C),t=Date.now(),i=(r=Object.entries((n=T(tS,N(e,t))).opened)).length>500?r.sort((e,t)=>t[1]-e[1]).slice(0,500):r,JSON.stringify({since:n.since,opened:Object.fromEntries(i)})))}catch{}},[tS]);let tK=(0,i.useCallback)(e=>{tj(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]);(0,i.useEffect)(()=>{let e=!1,t=null,n=null,r=()=>{t&&clearTimeout(t),t=null},i=async()=>{if(e||"visible"!==document.visibilityState)return;let s=new AbortController;n?.abort(),n=s;try{let t=await fetch("/api/agent/running",{cache:"no-store",signal:s.signal});if(!t.ok)return;let r=await t.json();if(e||n!==s)return;tM.current=!0,tx(new Set(r.runningSessionIds??[])),ty(new Set(r.waitingSessionIds??[]))}catch{}finally{n===s&&(n=null),r(),e||"visible"!==document.visibilityState||(t=setTimeout(()=>void i(),2500))}},s=()=>{"visible"===document.visibilityState?i():(r(),n?.abort(),n=null)};return i(),document.addEventListener("visibilitychange",s),()=>{e=!0,r(),n?.abort(),document.removeEventListener("visibilitychange",s)}},[]),(0,i.useEffect)(()=>{let t=tI.current,n=[...t].filter(t=>!tg.has(t)&&t!==e),r=[...tg].filter(e=>!t.has(e));(n.length>0||r.length>0)&&tw(e=>{let t=new Set(e);return tg.forEach(e=>t.delete(e)),n.forEach(e=>t.add(e)),t});let i=r.some(e=>!_.some(t=>t.id===e));(n.length>0||i)&&tL(!1,!0),n.length>0&&p?.(),tI.current=tg},[tg,e,_,tL,p]),(0,i.useEffect)(()=>{e&&tw(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n})},[e]);let tG=e?z.find(t=>t.id===e)?.modified:void 0,tJ=null!==tS;(0,i.useEffect)(()=>{e&&void 0!==tG&&tJ&&tC(t=>t&&M(t,{id:e,modified:tG},Date.now()))},[e,tG,tJ]),(0,i.useEffect)(()=>{fetch("/api/home").then(e=>e.json()).then(e=>{e.home&&G(e.home),Z(!0===e.cloudProjects)}).catch(()=>{})},[]);let tY=(0,i.useRef)(!1),tZ=(0,i.useCallback)(e=>{if(!e)return null;if(eQ&&eQ.forCwd===e||eQ?.worktrees.some(t=>t.path===e))return eQ.projectRoot;let t=z.find(t=>t.cwd===e);return t?.projectRoot??e},[eQ,z]),tQ=(0,i.useRef)(null);(0,i.useEffect)(()=>{tQ.current!==q&&(tQ.current=q,h?.(q,tZ(q)))},[q,h,tZ]);let tX=(0,i.useRef)(null);(0,i.useEffect)(()=>{u&&u!==tX.current&&(tX.current=u,V(u))},[u]);let[t0,t1]=(0,i.useState)(0);(0,i.useLayoutEffect)(()=>{if(!q)return void eX(null);let e=!1;return fetch(`/api/worktrees?cwd=${encodeURIComponent(q)}`).then(e=>e.json()).then(t=>{if(!e){if(t.error||!t.projectRoot)return void eX(null);eX({forCwd:q,projectRoot:t.projectRoot,isGit:t.isGit??!1,isTopLevel:t.isTopLevel??!1,worktrees:t.worktrees??[]})}}).catch(()=>{e||eX(null)}),()=>{e=!0}},[q,t0,c]),(0,i.useEffect)(()=>{if(0!==_.length&&!l&&null===q){if(a&&!tY.current){tY.current=!0;let e=_.find(e=>e.id===a);if(e){V(e.cwd),n(e,!0);return}o?.()}if(!eE)return;let e=new Map(eI.projects.map(e=>[e.key,e])),t=P(_.length>0?L(_):[],eI.projects).filter(t=>!e.get($(t))?.hidden);t.length>0&&V(t[0])}},[_,q,a,l,n,o,eI,eE]);let t2=(0,i.useCallback)(async e=>{let t=e.trim();if(t&&!eY){eZ(!0),eJ(null);try{let e=await fetch("/api/cwd/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:t})}),n=await e.json().catch(()=>({}));if(!e.ok||n.error)return void eJ(n.error??k("workspace.unable"));let r=n.cwd??t,i=$(r),s=eI.projects.find(e=>e.key===i);if(s?.hidden===!0)try{await t$([{key:i,path:r,hidden:!1}])}catch{}V(r),eK(!1)}catch{eJ(k("workspace.unable"))}finally{eZ(!1)}}},[t$,eY,eI.projects,k]),t8=(0,i.useCallback)(()=>{eK(!0),eJ(null)},[]),t4=(0,i.useCallback)(async()=>{let e=e4.trim();if(e&&!ts&&eQ){ta(!0),e3(null);try{let t=await fetch("/api/worktrees",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:eQ.projectRoot,branch:e})}),n=await t.json().catch(()=>({}));if(!t.ok||n.error||!n.path)return void e3(n.error??`HTTP ${t.status}`);e8(!1),e5(""),e1(!1),eX(t=>t?{...t,forCwd:n.path,worktrees:[...t.worktrees,{path:n.path,branch:e,isMain:!1}]}:t),V(n.path),t1(e=>e+1)}catch(e){e3(e instanceof Error?e.message:String(e))}finally{ta(!1)}}},[e4,ts,eQ]),t5=(0,i.useCallback)(async(e,t)=>{if(eQ&&!ts){ta(!0),e3(null);try{let n=await fetch("/api/worktrees",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:eQ.projectRoot,path:e,force:t})}),r=await n.json().catch(()=>({}));if(!n.ok){if(r.dirty&&!t)return void to(e);e3(r.error??`HTTP ${n.status}`);return}to(null),q===e&&V(eQ.projectRoot),t1(e=>e+1)}catch(e){e3(e instanceof Error?e.message:String(e))}finally{ta(!1)}}},[eQ,ts,q]);(0,i.useEffect)(()=>{let e=e=>{tc.current&&!tc.current.contains(e.target)&&(eT(null),e1(!1),e8(!1),e5(""),e3(null),to(null),eq(""),eS(null))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let t6=(0,i.useCallback)(e=>{e.cwd&&V(e.cwd),n(e)},[n]),t3=(0,i.useCallback)((e=q)=>{if(!e)return;let t="function"==typeof crypto.randomUUID?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}-${Math.random().toString(36).slice(2)}`;V(e),s?.(t,e)},[q,s]),t7=(0,i.useCallback)(async()=>{let e=eQ?.projectRoot,t=e7.trim();if(!e||!t||te)return;tt(!0),tr(null);let r=ti.current,i=r?.issue===t&&r.cwd===e?r.id:"function"==typeof crypto.randomUUID?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}-${Math.random().toString(36).slice(2)}`;ti.current={issue:t,cwd:e,id:i};try{let r=await fetch("/api/agent/new",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e,issue:t,type:"ensure_session",createRequestId:i})}),s=await r.json();if(!r.ok||!s.sessionId||!s.cwd)throw Error(s.error??`HTTP ${r.status}`);ea(s.cwd,s.worktree),ti.current=null,e9(""),V(s.cwd),t1(e=>e+1),n({id:s.sessionId,cwd:s.cwd,projectRoot:e,path:"",created:new Date().toISOString(),modified:new Date().toISOString(),messageCount:0,firstMessage:"(no messages)",transient:!0})}catch(e){tr(e instanceof Error?e.message:String(e))}finally{tt(!1)}},[eQ,e7,te,n]),[t9,ne]=(0,i.useState)(!1),[nt,nn]=(0,i.useState)(null),nr=(0,i.useCallback)(async()=>{ne(!0),nn(null);try{let e=await fetch("/api/default-cwd",{method:"POST"}),t=await e.json().catch(()=>({}));if(!e.ok||!t.cwd)throw Error(t.error??`HTTP ${e.status}`);t3(t.cwd)}catch(e){nn(k("sidebar.newScratchSessionFailed",{error:e instanceof Error?e.message:String(e)}))}finally{ne(!1)}},[t3,k]),ni=(0,i.useCallback)(e=>{ey(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),ns=tZ(q),na=null===ns?null:$(ns),nl=(0,i.useMemo)(()=>new Map(eI.projects.map(e=>[e.key,e])),[eI.projects]),no=L(z);if(null!==ns){let e=$(ns);no.some(t=>$(t)===e)||no.unshift(ns)}let nc=P(no,eI.projects),nd=nc.filter(e=>e$||!nl.get($(e))?.hidden),nu=nc.some(e=>nl.get($(e))?.hidden),nh=()=>{eT(null),e1(!1),e8(!1),e5(""),e3(null),to(null),eq("")},np=async(e,t)=>{nh();try{await t$([{key:$(e),path:e,hidden:t}]),t&&na&&na===$(e)&&V(null),t||nc.some(t=>$(t)!==$(e)&&nl.get($(t))?.hidden)||eL(!1)}catch{}},nm=async e=>{if(th.current){th.current=!1,eF(null);return}let t=eO.trim();if(t===(nl.get($(e))?.alias??""))return void eF(null);eU(null);try{await t$([{key:$(e),path:e,alias:t||null}]),eF(null)}catch{eU(k("sidebar.projectUpdateFailed"))}},nf=async(e,t)=>{if(Q)return;let n=nd.indexOf(e),r=n+t;if(n<0||r<0||r>=nd.length)return;let i=new Set(nd),s=nc.map((e,t)=>i.has(e)?t:-1).filter(e=>e>=0),a=[...nc],l=s[n],o=s[r];[a[l],a[o]]=[a[o],a[l]],nh();try{await t$(a.map((e,t)=>({key:$(e),path:e,order:t})))}catch{}},ng=new Map;for(let e of z){let t=e.projectRoot??e.cwd;if(!t)continue;let n=$(t),r=ng.get(n);r?r.push(e):ng.set(n,[e])}let nx=(0,i.useMemo)(()=>{let e=new Map;for(let t of z){let n=t.projectRoot??t.cwd;if(!n)continue;let r=$(n),i=e.get(r);i||(i={running:0,unread:0},e.set(r,i)),tg.has(t.id)&&i.running++,tb.has(t.id)&&i.unread++}return e},[z,tg,tb]),nv=Q.trim().toLowerCase(),ny=Q.length>0,nb=nd.flatMap(e=>{let t=e.replace(/[\\/]+$/,"").split(/[\\/]/).at(-1)||e,n=$(e),r=nl.get(n),i=r?.alias??t,s=(ng.get(n)??[]).slice().sort((e,t)=>{let n=Number(tk.has(t.id))-Number(tk.has(e.id));return 0!==n?n:t.modified.localeCompare(e.modified)});if(!nv)return[{project:e,key:n,name:i,sessions:s,hidden:r?.hidden===!0}];let a=i.toLowerCase().includes(nv)||t.toLowerCase().includes(nv),l=s.filter(e=>(e.name||e.firstMessage.slice(0,50)||e.id.slice(0,12)).toLowerCase().includes(nv));return a||0!==l.length?[{project:e,key:n,name:i,sessions:a?s:l,hidden:r?.hidden===!0}]:[]}),nw=[],nk=[];for(let e of nb){let t=e.key===na||(nx.get(e.key)?.running??0)>0;(function(e){let t=e.trim().replace(/\\/g,"/").toLowerCase();return!!(/^[a-z]:\/?$/.test(t)||"/"===t||/(^|\/)appdata\/local\/temp(\/|$)/.test(t)||/^\/(?:var\/|private\/)?tmp(?:\/|$)/.test(t)||/^[a-z]:\/(?:tmp|temp)(?:\/|$)/.test(t)||/(^|\/)(?:users|home)\/[^/]+\/\.omp(\/|$)/.test(t))||t.split("/").some(e=>S.some(t=>e.startsWith(t)))})(e.project)&&!t?nk.push(e):nw.push(e)}let nj={running:0,unread:0};for(let e of nk){let t=nx.get(e.key);t&&(nj.running+=t.running,nj.unread+=t.unread)}let nS=ny||eP,nC=[...nw.map(e=>({kind:"project",group:e})),...nk.length>0?[{kind:"temporary"}]:[],...nS?nk.map(e=>({kind:"project",group:e})):[]],nN=function(e){let t=new Map;for(let n of e){let e=n.toLowerCase();t.set(e,(t.get(e)??0)+1)}return new Set([...t].filter(([,e])=>e>1).map(([e])=>e))}(nC.flatMap(e=>"project"===e.kind?[e.group.name]:[])),nT=(0,i.useMemo)(()=>tS?z.filter(e=>(function(e,t,n,r=E){if(e.transient||e.trial)return!1;if(r.has(e.id))return!0;if(t.has(e.id))return!1;let i=I(e);return null!==i&&i>(n.opened[e.id]??n.since)})(e,tg,tS,tv)):[],[tS,tg,z,tv]),nI=tN&&null!==tS,[nM,nE]=(0,i.useState)(null),nR=(0,i.useMemo)(()=>(function(e,t,n,r,i="Priority",s=new Set,a="Pinned",l=10){let o=e.filter(e=>!e.transient).slice().sort((e,t)=>{let n=Date.parse(e.modified),r=Date.parse(t.modified);return(Number.isFinite(r)?r:0)-(Number.isFinite(n)?n:0)}),c=o.filter(e=>s.has(e.id)),d=[],u=new Map,h=0;for(let e of o){if(s.has(e.id))continue;if(t.has(e.id)){d.push(e);continue}let n=new Date(e.modified);if(h>=l)continue;h+=1;let r=[n.getFullYear(),String(n.getMonth()+1).padStart(2,"0"),String(n.getDate()).padStart(2,"0")].join("-"),i=u.get(r);i?i.push(e):u.set(r,[e])}let p=[];for(let e of(c.length>0&&p.push({key:"pinned",label:a,running:!1,sessions:c}),d.length>0&&p.push({key:"priority",label:i,running:!0,sessions:d}),[...u.keys()].sort().reverse()))p.push({key:e,label:function(e,t,n){let[r,i,s]=e.split("-").map(Number),a=new Date(r,i-1,s),l=Math.round((Date.UTC(t.getFullYear(),t.getMonth(),t.getDate())-Date.UTC(a.getFullYear(),a.getMonth(),a.getDate()))/864e5);return 0===l||1===l?new Intl.RelativeTimeFormat(n,{numeric:"auto"}).format(-l,"day"):l>=0&&l<7?new Intl.DateTimeFormat(n,{weekday:"long"}).format(a):new Intl.DateTimeFormat(n,{month:"short",day:"numeric"}).format(a)}(e,n,r),running:!1,sessions:u.get(e)??[]});return p})(nI?z.filter(e=>e.id===nM&&!tg.has(e.id)||nT.includes(e)):z,tg,new Date,j,k("navigator.priority"),tk,k("sidebar.pinned"),nI?1/0:void 0),[nM,j,tk,nT,nI,tg,z,k]),n$=(0,i.useMemo)(()=>{let e=new Set(nT.map(e=>e.id)),t=[],n=[],r=[],i=null,s=[];for(let a of nR)if("pinned"===a.key){let s=a.sessions.filter(i=>{if(tv.has(i.id))t.push(i);else if(tg.has(i.id))n.push(i);else{if(!e.has(i.id))return!0;r.push(i)}return!1});s.length>0&&(i={...a,sessions:s})}else if(a.running)for(let e of a.sessions)(tv.has(e.id)?t:n).push(e);else{let t=a.sessions.filter(t=>!e.has(t.id)||(r.push(t),!1));t.length>0&&s.push({...a,sessions:t})}let a=[];return t.length>0&&a.push({key:"input",kind:"input",label:k("navigator.group.input"),sessions:t}),n.length>0&&a.push({key:"running",kind:"running",label:k("navigator.group.running"),sessions:n}),r.length>0&&a.push({key:"review",kind:"review",label:k("navigator.resultsToCheck"),sessions:r}),i&&a.push({key:"pinned",kind:"pinned",label:i.label,sessions:i.sessions}),s.forEach((e,t)=>a.push({key:e.key,kind:"done",label:e.label,heading:0===t?k("navigator.group.done"):void 0,sessions:e.sessions})),a},[nR,nT,tg,k,tv]),nL=(0,i.useCallback)(e=>{nE(e.id),t6(e)},[t6]),nP=!!(eQ?.isGit&&eQ.isTopLevel&&q&&ns===eQ.projectRoot),nA=eQ?.worktrees.find(e=>e.path===q)??eQ?.worktrees.find(e=>e.isMain),n_=(eQ?.worktrees.length??0)>=8,nF=n_&&eB.trim()?(eQ?.worktrees??[]).filter(e=>(e.branch??eu(e.path,K)).toLowerCase().includes(eB.trim().toLowerCase())):eQ?.worktrees??[],nO=ei[j.startsWith("ko")?"ko":j.startsWith("zh")?"zh":"en"],nz=function(e){if(e&&"u">typeof sessionStorage)try{return JSON.parse(sessionStorage.getItem(`cuelo:worktree:${e}`)??"null")??void 0}catch{return}}(q),nD=(()=>{if(!tA)return[];let e="project"===tA.kind?ng.get($(tA.project))??[]:nR.flatMap(e=>e.sessions),t=new Set;return e.filter(e=>!(e.transient||t.has(e.id))&&(t.add(e.id),!0))})(),nW=nD.filter(e=>!tg.has(e.id)),nH=e=>{let t=new Set;for(let n of e)n.transient||tg.has(n.id)||t.has(n.id)||t.add(n.id);return t.size},nU=void 0!==m&&f,nB=void 0!==g&&x,nq=nU||nB;return(0,r.jsxs)("div",{className:"session-navigator",tabIndex:-1,style:{display:"flex",flexDirection:"column",height:"100%",overflow:"hidden",outline:"none"},children:[eV&&(0,r.jsx)(Y?X:J,{busy:eY,error:eG,onCancel:()=>{eK(!1),eJ(null)},onSelect:e=>void t2(e)}),tA&&(0,r.jsx)(ev,{scope:tA,eligible:nW.length,runningExcluded:nD.length-nW.length,busy:tF,error:tz,onCancel:tW,onConfirm:()=>void tH(nW)}),(0,r.jsxs)("div",{className:"session-navigator-header",style:{padding:"4px 10px",flexShrink:0},children:[(0,r.jsxs)("div",{className:"session-navigator-titlebar",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[(0,r.jsx)(ef,{}),(0,r.jsxs)("div",{style:{display:"flex",gap:12},children:[(0,r.jsx)("button",{className:"navigator-icon-action",onClick:()=>t3(),disabled:!q,style:{display:"flex",alignItems:"center",justifyContent:"center",background:"var(--bg-hover)",border:0,color:q?"var(--text-muted)":"var(--text-dim)",cursor:q?"pointer":"not-allowed",width:32,height:32,padding:0,borderRadius:"var(--radius-control)",fontSize:12,flexShrink:0,transition:"background 0.12s, color 0.12s"},title:q?k("sidebar.newSessionTitle",{path:q}):k("sidebar.selectProject"),"aria-label":q?k("sidebar.newSessionTitle",{path:q}):k("sidebar.selectProject"),onMouseEnter:e=>{q&&(e.currentTarget.style.background="var(--bg-selected)",e.currentTarget.style.color="var(--accent)")},onMouseLeave:e=>{e.currentTarget.style.background="var(--bg-hover)",e.currentTarget.style.color=q?"var(--text-muted)":"var(--text-dim)"},children:(0,r.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round","aria-hidden":"true",children:[(0,r.jsx)("line",{x1:"6",y1:"1",x2:"6",y2:"11"}),(0,r.jsx)("line",{x1:"1",y1:"6",x2:"11",y2:"6"})]})}),(0,r.jsx)("button",{className:`navigator-icon-action${tm?" is-success":""}`,onClick:()=>tL(!1,!0),style:{display:"flex",alignItems:"center",justifyContent:"center",background:tm?"var(--success-soft)":"var(--bg-hover)",border:0,color:tm?"var(--success)":"var(--text-muted)",cursor:"pointer",width:32,height:32,borderRadius:"var(--radius-control)",padding:0,flexShrink:0,transition:"background 0.3s, color 0.3s"},onMouseEnter:e=>{tm||(e.currentTarget.style.background="var(--bg-selected)",e.currentTarget.style.color="var(--accent)")},onMouseLeave:e=>{tm||(e.currentTarget.style.background="var(--bg-hover)",e.currentTarget.style.color="var(--text-muted)")},title:k("sidebar.refresh"),children:tm?(0,r.jsx)("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"var(--success)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,r.jsx)("polyline",{points:"20 6 9 17 4 12"})}):(0,r.jsxs)("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,r.jsx)("path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}),(0,r.jsx)("path",{d:"M3 3v5h5"})]})})]})]}),nP&&(0,r.jsxs)("form",{onSubmit:e=>{e.preventDefault(),t7()},style:{marginTop:8},children:[(0,r.jsx)("label",{htmlFor:"session-issue",style:{display:"block",fontSize:12,color:"var(--text-muted)"},children:nO.issueLabel}),(0,r.jsxs)("div",{style:{display:"flex",gap:4,marginTop:4},children:[(0,r.jsx)("input",{id:"session-issue",value:e7,disabled:te,onChange:e=>{e9(e.target.value),tr(null)},placeholder:nO.issuePlaceholder,"aria-describedby":tn?"session-issue-error":void 0,"aria-invalid":!!tn,style:{minWidth:0,flex:1,padding:"6px 8px",fontSize:12,background:"var(--bg)",color:"var(--text)",border:0,borderRadius:"var(--radius-control)"}}),(0,r.jsx)("button",{type:"submit",disabled:te||!e7.trim(),title:nO.issueStart,"aria-label":nO.issueStart,style:{minWidth:32,padding:"4px 8px",border:0,borderRadius:"var(--radius-control)",background:"var(--bg-hover)",color:"var(--text)",cursor:te?"wait":"pointer"},children:te?"…":"↵"})]}),te&&(0,r.jsx)("div",{role:"status",style:{fontSize:12},children:nO.issueBusy}),tn&&(0,r.jsx)("div",{id:"session-issue-error",role:"alert",style:{fontSize:12,color:"var(--danger)",overflowWrap:"anywhere"},children:tn})]}),(nz||nA&&!nA.isMain)&&(0,r.jsxs)("div",{role:"status",title:q??void 0,style:{marginTop:4,fontSize:12,color:"var(--text-muted)",overflowWrap:"anywhere"},children:[nz?.branch??nA?.branch,nz?.fallback&&(0,r.jsx)("div",{children:nO.fallbackBase.replace("{branch}",nz.base)}),nz?.missingSubdirectory&&(0,r.jsx)("div",{children:es[j.startsWith("ko")?"ko":j.startsWith("zh")?"zh":"en"].replace("{path}",nz.missingSubdirectory)})]})]}),Y&&!nq&&(0,r.jsx)("button",{type:"button",className:"navigator-cloud-project",onClick:t8,style:{margin:"10px 12px 0",minHeight:44,flexShrink:0,border:0,borderRadius:"var(--radius-control)",background:"var(--bg)",color:"var(--text)",fontSize:13,fontWeight:600,cursor:"pointer"},children:k("cloudProjects.launch")}),(0,r.jsxs)("div",{className:"navigator-mode-bar",children:[(0,r.jsx)("h2",{className:"navigator-place-title",children:nU?w("translator.tab"):nB?k("routines.tab"):"projects"===v?k("sidebar.projects"):k("navigator.priority")}),(0,r.jsx)("span",{className:"navigator-mode-spacer"}),!nq&&"projects"===v&&(0,r.jsx)("button",{type:"button",onClick:()=>eL(e=>!e),disabled:!nu,title:k("sidebar.projectShowHidden"),"aria-label":k("sidebar.projectShowHidden"),"aria-pressed":e$,style:{display:"flex",alignItems:"center",justifyContent:"center",width:26,height:26,padding:0,border:"none",borderRadius:"var(--radius-control)",background:e$?"var(--bg-selected)":"transparent",color:e$?"var(--accent)":"var(--text-dim)",cursor:nu?"pointer":"default",opacity:nu?1:.45,flexShrink:0},children:(0,r.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,r.jsx)("path",{d:"M2.5 12s3.5-6 9.5-6 9.5 6 9.5 6-3.5 6-9.5 6-9.5-6-9.5-6Z"}),(0,r.jsx)("circle",{cx:"12",cy:"12",r:"2.5"}),!e$&&(0,r.jsx)("path",{d:"m4 4 16 16"})]})}),!nq&&"projects"===v&&(0,r.jsx)("button",{className:"navigator-add-project",type:"button",onClick:t8,title:k("sidebar.addProject"),"aria-label":k("sidebar.addProject"),style:{display:"flex",alignItems:"center",justifyContent:"center",width:28,height:28,padding:0,border:"none",borderRadius:"var(--radius-control)",background:"var(--bg-hover)",color:"var(--text-muted)",cursor:"pointer",transition:"background 0.12s, color 0.12s"},onMouseEnter:e=>{e.currentTarget.style.background="var(--bg-hover)",e.currentTarget.style.color="var(--text)"},onMouseLeave:e=>{e.currentTarget.style.background="var(--bg-hover)",e.currentTarget.style.color="var(--text-muted)"},children:(0,r.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,r.jsx)("path",{d:"M3 7.5A2.5 2.5 0 0 1 5.5 5H9l2 2h7.5A2.5 2.5 0 0 1 21 9.5v7A2.5 2.5 0 0 1 18.5 19h-13A2.5 2.5 0 0 1 3 16.5v-9Z"}),(0,r.jsx)("path",{d:"M15.5 10.5v5M13 13h5"})]})})]}),nU&&m,nB&&g,!nq&&"projects"===v&&(0,r.jsxs)("label",{className:"navigator-search",style:{position:"relative",display:"block",margin:"0 8px 8px"},children:[(0,r.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",style:{position:"absolute",left:10,top:"50%",transform:"translateY(-50%)",color:"var(--text-dim)",pointerEvents:"none"},children:[(0,r.jsx)("circle",{cx:"11",cy:"11",r:"7"}),(0,r.jsx)("path",{d:"m20 20-3.5-3.5"})]}),(0,r.jsx)("input",{className:"navigator-search-input",type:"search",value:Q,onChange:e=>ee(e.target.value),onKeyDown:e=>{"Escape"===e.key&&(e.preventDefault(),ee(""),e.currentTarget.blur())},placeholder:k("sidebar.searchProjectsAndSessions"),"aria-label":k("sidebar.searchProjectsAndSessions"),style:{width:"100%",height:34,padding:"0 10px 0 32px",border:0,borderRadius:"var(--radius-control)",outline:"none",background:"var(--bg-hover)",color:"var(--text)",fontFamily:"var(--font-mono)",fontSize:11}})]}),!nq&&"projects"===v&&(0,r.jsxs)("div",{id:"navigator-projects-panel",className:"navigator-session-list",style:{flex:"1 1 auto",overflowY:"auto",minHeight:80,padding:"0 6px 10px"},children:[(D||!eE)&&(0,r.jsx)("div",{style:{padding:"12px 8px",color:"var(--text-muted)",fontSize:12},children:k("sidebar.loading")}),H&&(0,r.jsx)("div",{style:{padding:"10px 8px",color:"var(--danger)",fontSize:12},children:H}),eH&&(0,r.jsx)("div",{style:{padding:"10px 8px",color:"var(--danger)",fontSize:12},children:eH}),!D&&eE&&!H&&0===nb.length&&(0,r.jsx)("div",{style:{padding:"12px 8px",color:"var(--text-muted)",fontSize:12},children:nv?k("sidebar.noMatchingProjects"):k("sidebar.noSessions")}),!D&&eE&&!H&&nC.map(t=>{let n,i,s;if("temporary"===t.kind)return(0,r.jsx)("div",{className:"navigator-project-group",children:(0,r.jsxs)("button",{type:"button",className:"navigator-project-row","aria-expanded":nS,title:k("sidebar.temporaryProjects"),onClick:()=>eA(e=>!e),style:{display:"flex",alignItems:"center",gap:6,width:"100%",minHeight:34,padding:"0 6px 0 2px",border:"none",background:"transparent",color:"var(--text-muted)",cursor:"pointer",textAlign:"left",fontSize:"var(--seed-font-size-t2-static)",fontWeight:600},children:[(0,r.jsx)("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:24,height:28,flexShrink:0,color:"var(--text-dim)"},children:(0,r.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{transform:nS?"rotate(0deg)":"rotate(-90deg)",transition:"transform 0.12s"},children:(0,r.jsx)("polyline",{points:"2.5 4 6 7.5 9.5 4"})})}),(0,r.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:k("sidebar.temporaryProjects")}),(0,r.jsx)("span",{style:{color:"var(--text-muted)",fontFamily:"var(--font-mono)",fontSize:11,flexShrink:0},children:nk.length}),eN(nj,k)]})},"navigator-temporary-projects");let{project:a,key:l,name:o,sessions:c,hidden:d}=t.group,u=l===na,h=nN.has(o.toLowerCase())&&eu((i=Math.max((n=a.trim().replace(/[\\/]+$/,"")).lastIndexOf("\\"),n.lastIndexOf("/")))<=0?"":n.slice(0,i),K)||null,p=!em.has(a)&&!nv,m=et.has(a),f=e_===a,g=nd.indexOf(a),x=eD||ny||g<=0,v=eD||ny||g>=nd.length-1,y=function(e){let t=new Map;for(let n of e)t.set(n.id,{session:n,children:[]});let n=new Map;for(let t of e)t.parentSessionId&&n.set(t.id,t.parentSessionId);let r=[];for(let e of t.values()){let i=function(e){let r=n.get(e),i=new Set;for(;r&&!i.has(r);){if(i.add(r),t.has(r))return r;r=n.get(r)}return null}(e.session.id);i?t.get(i).children.push(e):r.push(e)}let i=e=>{e.sort((e,t)=>t.session.modified.localeCompare(e.session.modified)),e.forEach(e=>i(e.children))};return i(r),r}(m?c:c.slice(0,5)),b=c.length>5;return(0,r.jsxs)("section",{className:"navigator-project-group",style:{marginBottom:p?3:9},children:[(0,r.jsxs)("div",{className:`navigator-project-row${u?" is-selected":""}`,ref:eC===a?tc:void 0,onMouseEnter:()=>eS(a),onMouseLeave:()=>eS(e=>e===a&&eC!==a?null:e),style:{display:"flex",alignItems:"center",minHeight:34,position:"relative",borderRadius:"var(--radius-control)",background:u?"var(--bg-hover)":"transparent",opacity:d?.55:1},children:[(0,r.jsx)("button",{type:"button",onClick:()=>ni(a),title:p?k("sidebar.expandProject"):k("sidebar.collapseProject"),"aria-label":p?k("sidebar.expandProject"):k("sidebar.collapseProject"),"aria-expanded":!p,style:{display:"flex",alignItems:"center",justifyContent:"center",width:24,height:28,marginLeft:2,padding:0,border:"none",background:"transparent",color:"var(--text-dim)",cursor:"pointer",flexShrink:0},children:(0,r.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{transform:p?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.12s"},children:(0,r.jsx)("polyline",{points:"2.5 4 6 7.5 9.5 4"})})}),f?(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,flex:1,minWidth:0,height:34,padding:"0 4px"},children:[(0,r.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{flexShrink:0,color:"var(--accent)"},children:(0,r.jsx)("path",{d:"M3 7.5A2.5 2.5 0 0 1 5.5 5H9l2 2h7.5A2.5 2.5 0 0 1 21 9.5v7A2.5 2.5 0 0 1 18.5 19h-13A2.5 2.5 0 0 1 3 16.5v-9Z"})}),(0,r.jsx)("input",{ref:tu,value:eO,onChange:e=>ez(e.target.value),onBlur:()=>void nm(a),onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),e.currentTarget.blur()):"Escape"===e.key&&(e.preventDefault(),th.current=!0,eF(null))},"aria-label":k("sidebar.projectAlias"),style:{flex:1,minWidth:0,height:24,padding:"2px 6px",border:0,borderRadius:"var(--radius-control)",outline:"none",background:"var(--bg)",color:"var(--text)",fontFamily:"var(--font-mono)",fontSize:12,fontWeight:600}})]}):(0,r.jsxs)("button",{className:"navigator-project-name",type:"button",onClick:()=>V(a),title:a,style:{display:"flex",alignItems:"center",gap:8,flex:1,minWidth:0,height:34,padding:"0 4px",border:"none",background:"transparent",color:u?"var(--text)":"var(--text-muted)",cursor:"pointer",textAlign:"left",fontSize:12.5,fontWeight:u?600:500},children:[(0,r.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{flexShrink:0,color:u?"var(--accent)":"var(--text-dim)"},children:(0,r.jsx)("path",{d:"M3 7.5A2.5 2.5 0 0 1 5.5 5H9l2 2h7.5A2.5 2.5 0 0 1 21 9.5v7A2.5 2.5 0 0 1 18.5 19h-13A2.5 2.5 0 0 1 3 16.5v-9Z"})}),(0,r.jsx)("span",{style:{flexShrink:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o}),null===h?null:(0,r.jsx)("span",{style:{flexShrink:2,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"var(--text-dim)",fontFamily:"var(--font-mono)",fontSize:10},children:h}),eN(nx.get(l),k)]}),!A&&(0,r.jsx)("button",{type:"button",onClick:()=>t3(a),title:k("sidebar.newSessionTitle",{path:a}),"aria-label":k("sidebar.newSessionTitle",{path:a}),style:{display:"flex",alignItems:"center",justifyContent:"center",width:28,height:28,padding:0,border:"none",borderRadius:"var(--radius-control)",background:"transparent",color:"var(--text-dim)",cursor:"pointer",opacity:+(ej===a),pointerEvents:ej===a?"auto":"none",transition:"opacity 0.12s, background 0.12s, color 0.12s",flexShrink:0},onFocus:()=>eS(a),onMouseEnter:e=>{e.currentTarget.style.background="var(--bg-selected)",e.currentTarget.style.color="var(--accent)"},onMouseLeave:e=>{e.currentTarget.style.background="transparent",e.currentTarget.style.color="var(--text-dim)"},children:(0,r.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round","aria-hidden":"true",children:[(0,r.jsx)("line",{x1:"6",y1:"1.5",x2:"6",y2:"10.5"}),(0,r.jsx)("line",{x1:"1.5",y1:"6",x2:"10.5",y2:"6"})]})}),(0,r.jsxs)("div",{style:{position:"static",flexShrink:0},children:[(0,r.jsx)("button",{type:"button",onClick:()=>{eT(eC===a?null:a),e1(!1),e8(!1),e3(null),u||V(a)},title:k("sidebar.projectActions"),"aria-label":k("sidebar.projectActions"),"aria-expanded":eC===a,style:{display:"flex",alignItems:"center",justifyContent:"center",width:26,height:26,marginRight:3,padding:0,border:"none",borderRadius:"var(--radius-control)",background:eC===a?"var(--bg-selected)":"transparent",color:u&&nA&&!nA.isMain?"var(--accent)":"var(--text-dim)",cursor:"pointer",opacity:A||ej===a||eC===a?1:0,pointerEvents:A||ej===a||eC===a?"auto":"none",transition:"opacity 0.12s, background 0.12s, color 0.12s"},onFocus:()=>eS(a),children:(0,r.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"currentColor","aria-hidden":"true",children:[(0,r.jsx)("circle",{cx:"3",cy:"7",r:"1.1"}),(0,r.jsx)("circle",{cx:"7",cy:"7",r:"1.1"}),(0,r.jsx)("circle",{cx:"11",cy:"7",r:"1.1"})]})}),(0,r.jsxs)(ep,{open:eC===a,style:{position:"absolute",top:"calc(100% + 4px)",right:3,width:"min(260px, calc(100vw - 24px))",zIndex:110,background:"var(--bg-raised)",border:0,borderRadius:"var(--radius-surface)",boxShadow:"var(--shadow-float)",boxSizing:"border-box",overflow:"hidden"},children:[A&&(0,r.jsxs)("button",{type:"button",className:"navigator-project-menu-new-session",onClick:()=>{eT(null),t3(a)},title:k("sidebar.newSessionTitle",{path:a}),style:{display:"flex",alignItems:"center",gap:8,width:"100%",minHeight:44,padding:"0 10px",border:"none",background:"transparent",color:"var(--text)",cursor:"pointer",textAlign:"left",fontSize:13},children:[(0,r.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round","aria-hidden":"true",children:[(0,r.jsx)("line",{x1:"6",y1:"1.5",x2:"6",y2:"10.5"}),(0,r.jsx)("line",{x1:"1.5",y1:"6",x2:"10.5",y2:"6"})]}),k("i18n.newSession")]}),nP&&eQ&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("button",{type:"button",onClick:()=>e1(e=>!e),title:nA?k("sidebar.switchWorktreeTitle",{path:nA.path}):k("sidebar.switchWorktree"),"aria-label":k("sidebar.worktrees"),"aria-expanded":e0,style:{display:"flex",alignItems:"center",gap:8,width:"100%",minHeight:34,padding:"0 10px",border:"none",background:e0?"var(--bg-selected)":"transparent",color:"var(--text-muted)",cursor:"pointer",textAlign:"left",fontSize:11},children:[(0,r.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,r.jsx)("line",{x1:"6",y1:"3",x2:"6",y2:"15"}),(0,r.jsx)("circle",{cx:"18",cy:"6",r:"3"}),(0,r.jsx)("circle",{cx:"6",cy:"18",r:"3"}),(0,r.jsx)("path",{d:"M18 9a9 9 0 0 1-9 9"})]}),(0,r.jsx)("span",{style:{flex:1},children:k("sidebar.worktrees")}),(0,r.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,r.jsx)("polyline",{points:"4 2.5 8 6 4 9.5"})})]}),(0,r.jsxs)(ep,{open:e0,style:{position:"static",width:"auto",zIndex:100,background:"var(--bg)",border:"none",borderRadius:0,boxShadow:"none",boxSizing:"border-box",overflow:"hidden"},children:[n_&&(0,r.jsx)("div",{style:{padding:"6px 8px"},children:(0,r.jsx)("input",{value:eB,onChange:e=>eq(e.target.value),onKeyDown:e=>{"Escape"===e.key&&(eq(""),e1(!1))},placeholder:k("sidebar.filterWorktrees"),autoFocus:!0,style:{width:"100%",fontSize:11,fontFamily:"var(--font-mono)",padding:"5px 8px",border:0,borderRadius:"var(--radius-control)",outline:"none",background:"var(--bg-subtle)",color:"var(--text)",boxSizing:"border-box"}})}),(0,r.jsxs)("div",{style:{maxHeight:"min(40vh, 300px)",overflowY:"auto"},children:[nF.map(e=>{let t=e.path===q||e.isMain&&!eQ.worktrees.some(e=>e.path===q);return tl===e.path?(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"7px 10px",background:"var(--danger-soft)"},children:[(0,r.jsx)("span",{style:{flex:1,fontSize:11,color:"var(--text)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:k("sidebar.forceRemoveCheckout")}),(0,r.jsx)("button",{onClick:()=>void t5(e.path,!0),disabled:ts,style:{padding:"3px 9px",background:"var(--danger)",border:"none",borderRadius:"var(--radius-control)",color:"var(--bg)",fontSize:11,fontWeight:600,cursor:"pointer",flexShrink:0},children:k("sidebar.force")}),(0,r.jsx)("button",{onClick:()=>to(null),style:{padding:"3px 9px",background:"var(--bg-hover)",border:0,borderRadius:"var(--radius-control)",color:"var(--text-muted)",fontSize:11,cursor:"pointer",flexShrink:0},children:k("sidebar.cancel")})]},e.path):(0,r.jsxs)("div",{className:"wt-row",style:{display:"flex",alignItems:"center"},children:[(0,r.jsxs)("button",{onClick:()=>{V(e.path),e1(!1),e3(null),eq("")},title:e.path,style:{flex:1,minWidth:0,display:"flex",alignItems:"center",gap:7,padding:"8px 10px",background:"var(--bg)",border:"none",color:t?"var(--text)":"var(--text-muted)",cursor:"pointer",textAlign:"left",fontSize:11,fontFamily:"var(--font-mono)"},children:[t?(0,r.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:(0,r.jsx)("polyline",{points:"1.5 5 4 7.5 8.5 2.5"})}):(0,r.jsx)("span",{style:{width:10,flexShrink:0}}),(0,r.jsx)(eh,{text:e.branch??eu(e.path,K),style:{flex:1}}),e.isMain&&(0,r.jsx)("span",{style:{flexShrink:0,color:"var(--text-dim)",fontSize:10},children:k("sidebar.main")})]}),!e.isMain&&(0,r.jsx)("button",{onClick:()=>void t5(e.path,!1),disabled:ts,title:k("sidebar.removeWorktreeTitle",{path:e.path}),style:{display:"flex",alignItems:"center",justifyContent:"center",width:34,height:28,padding:0,marginRight:4,background:"none",border:"none",color:"var(--text-dim)",cursor:"pointer",borderRadius:"var(--radius-control)",flexShrink:0,transition:"color 0.12s, background 0.12s"},onMouseEnter:e=>{e.currentTarget.style.color="var(--danger)",e.currentTarget.style.background="var(--danger-soft)"},onMouseLeave:e=>{e.currentTarget.style.color="var(--text-dim)",e.currentTarget.style.background="none"},children:(0,r.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("polyline",{points:"3 6 5 6 21 6"}),(0,r.jsx)("path",{d:"M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"}),(0,r.jsx)("path",{d:"M10 11v6M14 11v6"}),(0,r.jsx)("path",{d:"M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2"})]})})]},e.path)}),n_&&0===nF.length&&eB.trim()&&(0,r.jsx)("div",{style:{padding:"8px 10px",fontSize:11,color:"var(--text-dim)"},children:k("sidebar.noMatchingWorktrees")})]}),e2?(0,r.jsxs)("div",{style:{padding:"6px 8px"},children:[(0,r.jsx)("input",{ref:td,value:e4,onChange:e=>{e5(e.target.value),e3(null)},onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),t4()),"Escape"===e.key&&(e8(!1),e5(""),e3(null))},placeholder:k("sidebar.branchName"),style:{width:"100%",fontSize:11,fontFamily:"var(--font-mono)",padding:"5px 8px",border:0,borderRadius:"var(--radius-control)",outline:"none",background:"var(--bg-subtle)",color:"var(--text)",boxSizing:"border-box"}}),(0,r.jsxs)("div",{style:{display:"flex",gap:5,marginTop:5},children:[(0,r.jsx)("button",{onClick:()=>void t4(),disabled:ts||!e4.trim(),style:{flex:1,padding:"4px 0",background:"var(--accent)",border:"none",borderRadius:"var(--radius-control)",color:"var(--bg)",fontSize:11,fontWeight:600,cursor:ts||!e4.trim()?"not-allowed":"pointer",opacity:ts||!e4.trim()?.65:1},children:ts?k("sidebar.creating"):k("sidebar.create")}),(0,r.jsx)("button",{onClick:()=>{e8(!1),e5(""),e3(null)},style:{flex:1,padding:"4px 0",background:"var(--bg-hover)",border:0,borderRadius:"var(--radius-control)",color:"var(--text-muted)",fontSize:11,cursor:"pointer"},children:k("sidebar.cancel")})]})]}):(0,r.jsxs)("button",{onClick:e=>{e.stopPropagation(),e8(!0),e3(null),setTimeout(()=>td.current?.focus(),0)},title:k("sidebar.createWorktreeTitle"),style:{display:"flex",alignItems:"center",gap:7,width:"100%",padding:"8px 10px",background:"none",border:"none",color:"var(--text-muted)",cursor:"pointer",textAlign:"left",fontSize:11},children:[(0,r.jsxs)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinecap:"round",style:{flexShrink:0},children:[(0,r.jsx)("line",{x1:"5",y1:"1",x2:"5",y2:"9"}),(0,r.jsx)("line",{x1:"1",y1:"5",x2:"9",y2:"5"})]}),(0,r.jsx)("span",{children:k("sidebar.newWorktree")})]}),e6&&(0,r.jsx)("div",{style:{padding:"5px 10px 8px",color:"var(--danger)",fontSize:11,lineHeight:1.35,overflowWrap:"anywhere"},children:e6})]})]}),(0,r.jsxs)("button",{type:"button",disabled:eD,onClick:()=>{let e;return e=nl.get($(a))?.alias??"",void(th.current=!1,eU(null),ez(e),eF(a),nh())},style:{display:"flex",alignItems:"center",gap:8,width:"100%",minHeight:34,padding:"0 10px",border:"none",background:"transparent",color:"var(--text-muted)",cursor:eD?"default":"pointer",textAlign:"left",fontSize:11,opacity:eD?.55:1},children:[(0,r.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,r.jsx)("path",{d:"m4 20 4.5-1 10-10a2.1 2.1 0 0 0-3-3l-10 10L4 20Z"}),(0,r.jsx)("path",{d:"m13.5 8 3 3"})]}),k(nl.get($(a))?.alias?"sidebar.projectAliasEdit":"sidebar.projectAlias")]}),(0,r.jsxs)("button",{type:"button",disabled:x,title:ny?k("sidebar.projectMoveDisabledWhileFiltering"):void 0,onClick:()=>void nf(a,-1),style:{display:"flex",alignItems:"center",gap:8,width:"100%",minHeight:34,padding:"0 10px",border:"none",background:"transparent",color:"var(--text-muted)",cursor:x?"default":"pointer",textAlign:"left",fontSize:11,opacity:x?.55:1},children:[(0,r.jsx)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,r.jsx)("path",{d:"m6 15 6-6 6 6"})}),k("sidebar.projectMoveUp")]}),(0,r.jsxs)("button",{type:"button",disabled:v,title:ny?k("sidebar.projectMoveDisabledWhileFiltering"):void 0,onClick:()=>void nf(a,1),style:{display:"flex",alignItems:"center",gap:8,width:"100%",minHeight:34,padding:"0 10px",border:"none",background:"transparent",color:"var(--text-muted)",cursor:v?"default":"pointer",textAlign:"left",fontSize:11,opacity:v?.55:1},children:[(0,r.jsx)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,r.jsx)("path",{d:"m6 9 6 6 6-6"})}),k("sidebar.projectMoveDown")]}),(0,r.jsxs)("button",{type:"button",disabled:eD,onClick:()=>void np(a,!d),style:{display:"flex",alignItems:"center",gap:8,width:"100%",minHeight:34,padding:"0 10px",border:"none",background:"transparent",color:"var(--text-muted)",cursor:eD?"default":"pointer",textAlign:"left",fontSize:11,opacity:eD?.55:1},children:[(0,r.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,r.jsx)("path",{d:"M2.5 12s3.5-6 9.5-6 9.5 6 9.5 6-3.5 6-9.5 6-9.5-6-9.5-6Z"}),(0,r.jsx)("circle",{cx:"12",cy:"12",r:"2.5"}),!d&&(0,r.jsx)("path",{d:"m4 4 16 16"})]}),k(d?"sidebar.projectUnhide":"sidebar.projectHide")]}),(s=0===nH(ng.get(l)??[])||tF,(0,r.jsxs)("button",{type:"button",disabled:s,onClick:()=>{nh(),tD(null),t_({kind:"project",project:a,label:o})},style:{display:"flex",alignItems:"center",gap:8,width:"100%",minHeight:34,padding:"0 10px",border:"none",background:"transparent",color:"var(--text-muted)",cursor:s?"default":"pointer",textAlign:"left",fontSize:11,opacity:s?.55:1},children:[(0,r.jsx)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,r.jsx)("path",{d:"M4 7h16M9 7V5h6v2M6 7l1 13h10l1-13"})}),k("sidebar.clearProjectSessions")]}))]})]})]}),!p&&0===c.length&&u&&(0,r.jsx)("div",{style:{padding:"6px 12px 7px 32px",color:"var(--text-dim)",fontSize:11},children:k("sidebar.noSessions")}),!p&&y.length>0&&(0,r.jsx)("div",{style:{paddingLeft:12},children:y.map(t=>(0,r.jsx)(ek,{node:t,selectedSessionId:e,runningSessionIds:tg,unreadSessionIds:tb,pinnedSessionIds:tk,onSelectSession:t6,onTogglePinnedSession:tK,onRenamed:tL,onSessionDeleted:tP,onSessionArchived:tq,depth:0},t.session.id))}),!p&&b&&(0,r.jsx)("button",{type:"button",onClick:()=>{en(e=>{let t=new Set(e);return t.has(a)?t.delete(a):t.add(a),t})},style:{display:"block",margin:"3px 0 3px 32px",padding:"5px 8px",border:"none",background:"transparent",color:"var(--text-muted)",cursor:"pointer",fontSize:12,textAlign:"left"},children:m?k("sidebar.showLess"):k("sidebar.showMore")})]},a)})]}),!nq&&(0,r.jsx)(ew,{refreshKey:tU,selectedSessionId:e,onSelectSession:t6,onRestored:tq}),!nq&&"priority"===v&&(0,r.jsxs)("div",{id:"navigator-priority-panel",style:{flex:"1 1 auto",minHeight:80,overflowY:"auto",padding:"0 6px 10px"},children:[D&&(0,r.jsx)("div",{style:{padding:"12px 8px",color:"var(--text-muted)",fontSize:12},children:k("sidebar.loading")}),H&&(0,r.jsx)("div",{role:"alert",style:{padding:"10px 8px",color:"var(--danger)",fontSize:12},children:H}),!D&&!H&&(b=nH(nR.flatMap(e=>e.sessions)),(0,r.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",gap:8,padding:"8px 2px 2px"},children:[(0,r.jsx)("button",{type:"button",disabled:t9,onClick:()=>void nr(),title:k("sidebar.newScratchSessionTitle"),style:ed(t9,A),children:k("sidebar.newScratchSession")}),nR.length>0&&!nI&&(0,r.jsx)("button",{type:"button",disabled:0===b||tF,onClick:()=>{tD(null),t_({kind:"priority"})},style:ed(0===b||tF,A),children:k("sidebar.clearPriorityList")})]})),!D&&!H&&tS&&(0,r.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",gap:8,padding:"6px 2px 4px"},children:[(0,r.jsxs)("button",{type:"button","aria-pressed":nI,"aria-label":k("navigator.resultsToCheckCount",{count:nT.length}),title:k("navigator.resultsToCheckHint"),onClick:()=>{nE(null),tT(e=>!e)},style:{...ed(!1,A),display:"inline-flex",alignItems:"center",gap:6,background:nI?"var(--bg-selected)":"var(--bg-hover)",color:nI||nT.length>0?"var(--text)":"var(--text-muted)",fontWeight:nI?600:500,whiteSpace:"nowrap"},children:[k("navigator.resultsToCheck"),(0,r.jsx)("span",{"aria-hidden":"true",style:{minWidth:18,padding:"0 5px",borderRadius:"var(--radius-surface)",background:nT.length>0?"var(--seed-color-bg-neutral-inverted)":"var(--bg-subtle)",color:nT.length>0?"var(--seed-color-fg-neutral-inverted)":"var(--text-muted)",fontSize:11,fontVariantNumeric:"tabular-nums",lineHeight:"18px",textAlign:"center"},children:nT.length})]}),nT.some(e=>!tv.has(e.id))&&(0,r.jsx)("button",{type:"button",title:k("navigator.acknowledgeResultsHint"),onClick:()=>{nE(null),tC(e=>e&&function(e,t,n){let r=e;for(let e of t)r=M(r,e,n);return r}(e,nT,Date.now()))},style:ed(!1,A),children:k("navigator.acknowledgeResults")})]}),nt&&(0,r.jsx)("div",{role:"alert",style:{padding:"6px 8px",color:"var(--danger)",fontSize:12},children:nt}),!D&&!H&&0===nR.length&&(0,r.jsx)("div",{style:{padding:"12px 8px",color:"var(--text-muted)",fontSize:12},children:nI?k("navigator.resultsToCheckEmpty"):k("sidebar.noSessions")}),!D&&!H&&n$.map((t,n)=>(0,r.jsxs)("section",{"aria-labelledby":`priority-group-${t.key}`,className:"priority-group","data-group":t.kind,children:[t.heading&&(0,r.jsx)("h2",{className:"priority-group-heading","data-first":0===n?"":void 0,children:t.heading}),(0,r.jsxs)("h3",{id:`priority-group-${t.key}`,className:t.heading?"priority-group-day":"priority-group-heading","data-first":0!==n||t.heading?void 0:"",children:["input"===t.kind&&(0,r.jsx)("span",{className:"workbench-lamp","data-kind":"input","aria-hidden":"true"}),"running"===t.kind&&(0,r.jsx)("span",{className:"workbench-lamp","aria-hidden":"true"}),t.label,(0,r.jsx)("span",{className:"priority-group-count",children:t.sessions.length})]}),t.sessions.map(t=>(0,r.jsx)(eb,{session:t,selected:t.id===e,running:tg.has(t.id),waiting:tv.has(t.id),unread:tb.has(t.id),pinned:tk.has(t.id),onSelect:nI?nL:t6,onTogglePin:tK},t.id))]},t.key))]})]})}function ev({scope:e,eligible:t,runningExcluded:n,busy:s,error:a,onCancel:l,onConfirm:o}){let{t:c}=(0,F.s)(),d=s||0===t,u=(0,i.useRef)(null),h=(0,i.useRef)(null),p=(0,i.useRef)(s);p.current=s;let m=(0,i.useRef)(l);return m.current=l,(0,i.useEffect)(()=>{let e=u.current;if(!e)return;let t=document.activeElement,n=t instanceof HTMLElement&&t!==document.body&&t!==document.documentElement&&!e.contains(t)?t:null;(h.current??e).focus();let r=t=>{if("Escape"===t.key){if(p.current)return;t.preventDefault(),m.current();return}if("Tab"!==t.key)return;let n=Array.from(e.querySelectorAll('a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')).filter(e=>e.getClientRects().length>0),r=document.activeElement;if(0===n.length){t.preventDefault(),e.focus();return}let i=n[0],s=n[n.length-1];t.shiftKey&&(r===i||!e.contains(r))?(t.preventDefault(),s.focus()):t.shiftKey||r!==s&&e.contains(r)||(t.preventDefault(),i.focus())};return e.addEventListener("keydown",r),()=>{e.removeEventListener("keydown",r);let t=n?.isConnected?n:e.closest(".session-navigator");t?.focus()}},[]),(0,r.jsx)("div",{role:"presentation",style:{position:"fixed",inset:0,zIndex:1100,display:"flex",alignItems:"center",justifyContent:"center",padding:16,background:"var(--scrim)"},onClick:e=>{s||e.target!==e.currentTarget||l()},children:(0,r.jsxs)("div",{ref:u,role:"alertdialog","aria-modal":"true","aria-labelledby":"bulk-clear-title","aria-describedby":"bulk-clear-body",tabIndex:-1,style:{width:420,maxWidth:"100%",border:0,borderRadius:"var(--radius-surface)",background:"var(--bg-raised)",boxShadow:"var(--shadow-float)",overflow:"hidden"},children:[(0,r.jsxs)("div",{style:{padding:"18px 18px 14px"},children:[(0,r.jsx)("div",{id:"bulk-clear-title",style:{color:"var(--text)",fontSize:"var(--seed-font-size-t4-static)",fontWeight:600},children:c("sidebar.clearSessionsTitle")}),(0,r.jsxs)("div",{id:"bulk-clear-body",style:{marginTop:8,color:"var(--text-muted)",fontSize:"var(--seed-font-size-t3-static)",lineHeight:1.6,overflowWrap:"anywhere"},children:["project"===e.kind?c("sidebar.clearSessionsProjectBody",{project:e.label,count:t}):c("sidebar.clearSessionsPriorityBody",{count:t}),n>0&&(0,r.jsx)("div",{style:{marginTop:6},children:c("sidebar.clearSessionsRunningExcluded",{count:n})}),0===t&&(0,r.jsx)("div",{style:{marginTop:6},children:c("sidebar.clearSessionsNone")})]}),a&&(0,r.jsx)("div",{role:"alert",style:{marginTop:10,color:"var(--danger)",fontSize:"var(--seed-font-size-t3-static)",lineHeight:1.5,overflowWrap:"anywhere"},children:a})]}),(0,r.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"flex-end",gap:8,padding:"12px 18px"},children:[(0,r.jsx)("button",{ref:h,type:"button",onClick:l,disabled:s,style:{minHeight:36,padding:"0 12px",border:0,borderRadius:"var(--radius-control)",background:"var(--bg-hover)",color:"var(--text-muted)",cursor:s?"default":"pointer",fontSize:"var(--seed-font-size-t3-static)"},children:c("sidebar.clearSessionsCancel")}),(0,r.jsx)("button",{type:"button",onClick:o,disabled:d,"aria-busy":s,style:{minHeight:36,padding:"0 14px",border:0,borderRadius:"var(--radius-control)",background:d?"var(--bg-hover)":"var(--danger-soft)",color:d?"var(--text-dim)":"var(--danger)",cursor:d?"default":"pointer",fontSize:"var(--seed-font-size-t3-static)",fontWeight:600},children:c(s?"sidebar.clearSessionsBusy":"sidebar.clearSessionsConfirm")})]})]})})}function ey({filled:e=!1}){return(0,r.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:e?"currentColor":"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,r.jsx)("path",{d:"M12 17v5"}),(0,r.jsx)("path",{d:"M5 17h14"}),(0,r.jsx)("path",{d:"M6 3h12l-1 8 2 3H5l2-3-1-8z"})]})}function eb({session:e,selected:t,running:n,waiting:i,unread:s,pinned:a,onSelect:l,onTogglePin:o}){let{t:c}=(0,F.s)(),d=(e.name||e.firstMessage||e.id.slice(0,8)).replace(/\s+/g," ").trim(),u=e.cwd.split(/[\\/]/).filter(Boolean).at(-1)??"";return(0,r.jsxs)("div",{className:`priority-session-row${t?" is-selected":""}${n?" is-running":""}${s?" is-unread":""}`,style:{display:"flex",alignItems:"stretch",borderRadius:"var(--radius-control)",background:t?"var(--bg-selected)":"transparent"},children:[(0,r.jsxs)("button",{type:"button","aria-current":t?"page":void 0,onClick:()=>l(e),title:`${d}
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8974],{2498:e=>{e.exports={view:"MemoryTraceView_view__62Ck_",body:"MemoryTraceView_body__gELit",message:"MemoryTraceView_message__pDO_k",errorText:"MemoryTraceView_errorText__GkoKJ",sectionTitle:"MemoryTraceView_sectionTitle__lmuuo",sectionCount:"MemoryTraceView_sectionCount__9yRSn",requests:"MemoryTraceView_requests__scPBk",requestScroller:"MemoryTraceView_requestScroller__4ALfU",requestList:"MemoryTraceView_requestList__rQ4G0",requestRow:"MemoryTraceView_requestRow__LZd3A",requestIndex:"MemoryTraceView_requestIndex__TacwG",requestTime:"MemoryTraceView_requestTime__fJjQF",noticeChip:"MemoryTraceView_noticeChip__gz9AO",requestPreview:"MemoryTraceView_requestPreview__HwG7v",miniRail:"MemoryTraceView_miniRail__84C2v",flow:"MemoryTraceView_flow__UCgmI",titleText:"MemoryTraceView_titleText__38Tl7",flowPreview:"MemoryTraceView_flowPreview__HjgKe",rail:"MemoryTraceView_rail__HlWbE",station:"MemoryTraceView_station__ulNBH",stationButton:"MemoryTraceView_stationButton__BztyW",stationStep:"MemoryTraceView_stationStep__CgFYZ",stationCount:"MemoryTraceView_stationCount__2_rrN",stationLabel:"MemoryTraceView_stationLabel__QGYpC",stationNote:"MemoryTraceView_stationNote__Jc30I",detail:"MemoryTraceView_detail__Rnn_d",stageEmpty:"MemoryTraceView_stageEmpty__x0H_J",group:"MemoryTraceView_group__1SCqK",bucket:"MemoryTraceView_bucket__Vmuau",groupTitle:"MemoryTraceView_groupTitle__6Q1oM",groupCode:"MemoryTraceView_groupCode__qgzOG",query:"MemoryTraceView_query__DK87N",items:"MemoryTraceView_items__D8Wz8",item:"MemoryTraceView_item__wyulb",idList:"MemoryTraceView_idList__mQArH",path:"MemoryTraceView_path__97O3u",itemHead:"MemoryTraceView_itemHead__B0bQo",memoryId:"MemoryTraceView_memoryId__5KjoX",itemMeta:"MemoryTraceView_itemMeta__wbj6K",itemText:"MemoryTraceView_itemText__O92R_",graph:"MemoryTraceView_graph__RHbn9",graphHead:"MemoryTraceView_graphHead__sEDhc",scopeSwitch:"MemoryTraceView_scopeSwitch__3HBI2",legend:"MemoryTraceView_legend__52_dq",legendMark:"MemoryTraceView_legendMark__hS7sK",legendTitle:"MemoryTraceView_legendTitle__z_lgW",legendMemory:"MemoryTraceView_legendMemory__mkYqP",graphCaption:"MemoryTraceView_graphCaption__ot7gW",captionKind:"MemoryTraceView_captionKind__e1fLD",graphFrame:"MemoryTraceView_graphFrame__SgiqG",graphSvg:"MemoryTraceView_graphSvg___JeWV",columnHeads:"MemoryTraceView_columnHeads__drsYb",edges:"MemoryTraceView_edges__4zMSL",node:"MemoryTraceView_node__ymwrL",hit:"MemoryTraceView_hit__HS6HS",mark:"MemoryTraceView_mark__WxCZl",arrow:"MemoryTraceView_arrow__oz9U4",nodeText:"MemoryTraceView_nodeText__Tp4ud",ring:"MemoryTraceView_ring___LM5n"}},2730:(e,t,n)=>{"use strict";function r(e,t,n,i={}){let s=n[e]?.[t]??n.en?.[t];return void 0===s?t:function(e,t={}){return e.replace(/\{([\w.-]+)\}/g,(e,n)=>{let r=t[n];return void 0===r?e:String(r)})}(s,i)}n.d(t,{u0:()=>r})},13004:e=>{e.exports={backdrop:"SettingsConfig_backdrop__i6KYG",window:"SettingsConfig_window__m7dcs",sidebar:"SettingsConfig_sidebar__vEMEr",brand:"SettingsConfig_brand__DlYlu",eyebrow:"SettingsConfig_eyebrow__uTa5R",title:"SettingsConfig_title__DWTnA",context:"SettingsConfig_context__N0fl0",searchWrap:"SettingsConfig_searchWrap___PWrc",searchIcon:"SettingsConfig_searchIcon__8_YYE",search:"SettingsConfig_search__DUhSs",nav:"SettingsConfig_nav__V8P9S",navLabel:"SettingsConfig_navLabel__M1wMP",navButton:"SettingsConfig_navButton__CUOqu",navIcon:"SettingsConfig_navIcon__Wagpr",closeRail:"SettingsConfig_closeRail__PW3pT",closeButton:"SettingsConfig_closeButton__5y_6F",content:"SettingsConfig_content__n_a5Z",scrollContent:"SettingsConfig_scrollContent__03BsO",contentHeader:"SettingsConfig_contentHeader__tNmzv",contentTitle:"SettingsConfig_contentTitle__oiHOO",contentDescription:"SettingsConfig_contentDescription___l2QU",reloadNotice:"SettingsConfig_reloadNotice__enzeE",settingsBody:"SettingsConfig_settingsBody__QRFVu",group:"SettingsConfig_group__JQ_dy",groupTitle:"SettingsConfig_groupTitle__0SrM9",settingRow:"SettingsConfig_settingRow__Jy73r",settingLabel:"SettingsConfig_settingLabel__n8vtU",settingDescription:"SettingsConfig_settingDescription__TGWfP",settingControl:"SettingsConfig_settingControl__oz5Gn",select:"SettingsConfig_select__A5aGy",textInput:"SettingsConfig_textInput___NjZ2",jsonEditor:"SettingsConfig_jsonEditor__yTYDb",numberInput:"SettingsConfig_numberInput__TVVeJ",switch:"SettingsConfig_switch__5UYqz",multiSelect:"SettingsConfig_multiSelect__PTjyr",choice:"SettingsConfig_choice__Os8WR",choiceToggle:"SettingsConfig_choiceToggle__lyl75",reorder:"SettingsConfig_reorder__JR6tX",error:"SettingsConfig_error__j6wEj",saveState:"SettingsConfig_saveState__1tIL4",themeGrid:"SettingsConfig_themeGrid__7Lw8A",themeCard:"SettingsConfig_themeCard__DQFsT",themePreview:"SettingsConfig_themePreview__QzqXK",themePreviewBar:"SettingsConfig_themePreviewBar__ZbchX",themePreviewPanel:"SettingsConfig_themePreviewPanel__YN9ty",themePreviewLine:"SettingsConfig_themePreviewLine__jP0qg",themeCardBody:"SettingsConfig_themeCardBody__xiOe6",themeCardHeader:"SettingsConfig_themeCardHeader__YPRN2",themeSlot:"SettingsConfig_themeSlot__vGn9a",themeActive:"SettingsConfig_themeActive__PNmdk",mcpLayout:"SettingsConfig_mcpLayout__ek_Fi",mcpList:"SettingsConfig_mcpList__gZ9_o",scopeTabs:"SettingsConfig_scopeTabs__9bybS",scopeButton:"SettingsConfig_scopeButton__d4XPe",serverRows:"SettingsConfig_serverRows__JSJy0",serverRow:"SettingsConfig_serverRow__6gJdE",serverSelect:"SettingsConfig_serverSelect__cuYFx",serverToggle:"SettingsConfig_serverToggle__X5N_o",serverName:"SettingsConfig_serverName__lbfcK",sourceBadge:"SettingsConfig_sourceBadge__XDE2u",serverListEmpty:"SettingsConfig_serverListEmpty___icit",statusDot:"SettingsConfig_statusDot__dVcD4",addServer:"SettingsConfig_addServer__g0ivB",mcpEditor:"SettingsConfig_mcpEditor__XGcLp",editorHeader:"SettingsConfig_editorHeader__qDvAk",readOnlyNotice:"SettingsConfig_readOnlyNotice__KNzML",editorActions:"SettingsConfig_editorActions__h9p7Y",linkButton:"SettingsConfig_linkButton__0DH3I",primaryButton:"SettingsConfig_primaryButton__Eocwv",dangerButton:"SettingsConfig_dangerButton__XF_f_",empty:"SettingsConfig_empty__erg3A",seg:"SettingsConfig_seg__XuRNt",panel:"SettingsConfig_panel__ZI0zy",btn:"SettingsConfig_btn__n6fBy",btnPrimary:"SettingsConfig_btnPrimary__iimPs",btnDanger:"SettingsConfig_btnDanger__1fFIU",btnQuiet:"SettingsConfig_btnQuiet__fNd0U",btnOk:"SettingsConfig_btnOk__EO_j1",field:"SettingsConfig_field__PVLX2",badge:"SettingsConfig_badge__8u4iQ",badgeWarn:"SettingsConfig_badgeWarn___hejU",badgeDanger:"SettingsConfig_badgeDanger__Ya7g_",badgeInfo:"SettingsConfig_badgeInfo__P8FR7",textDanger:"SettingsConfig_textDanger__5_0Vx",textOk:"SettingsConfig_textOk__XPaRs",textWarn:"SettingsConfig_textWarn__MxfZX",lamp:"SettingsConfig_lamp__spLQJ",lampOn:"SettingsConfig_lampOn__I5AtE",lampWarn:"SettingsConfig_lampWarn__gG1l4",lampDanger:"SettingsConfig_lampDanger__7BeCc",scrim:"SettingsConfig_scrim__i645I",sheet:"SettingsConfig_sheet__YV6De",listRowSel:"SettingsConfig_listRowSel__7RSLQ",bare:"SettingsConfig_bare__XoKXl",fieldBare:"SettingsConfig_fieldBare__jiy_X",navRow:"SettingsConfig_navRow__dSjxf"}},14755:(e,t,n)=>{"use strict";n.d(t,{C1:()=>s,IN:()=>i,getPresetFromTools:()=>l,xG:()=>o});let r=[],i=["read","bash","edit","write"],s=["read","bash","edit","write","grep","glob"],a=Object.fromEntries(s.map(e=>[e,!0]));function l(e){let t=e.filter(e=>e.active);if(0===t.length)return"none";let n=t.map(e=>e.name).filter(e=>!0===a[e]).sort().join(",");return n===[...i].sort().join(",")?"default":n===[...s].sort().join(",")?"full":"default"}function o(e){return"none"===e?[...r]:"full"===e?[...s]:[...i]}},21040:e=>{e.exports={view:"RoutineView_view__4busO",topbar:"RoutineView_topbar__YPacL",back:"RoutineView_back__ac5Vn",body:"RoutineView_body__01N2Q",crumb:"RoutineView_crumb__K1_0X",link:"RoutineView_link__whmc9",head:"RoutineView_head__WBrda",headActions:"RoutineView_headActions__KqC_W",sub:"RoutineView_sub__mh018",facts:"RoutineView_facts__Yyns3",strong:"RoutineView_strong__x6Fhg",subNote:"RoutineView_subNote__tAUYO",mono:"RoutineView_mono__ms2qU",button:"RoutineView_button__sbfYZ",badge:"RoutineView_badge__uMNRL",tabs:"RoutineView_tabs__iPnSQ",table:"RoutineView_table__3ihqX",title:"RoutineView_title__WPF5j",no:"RoutineView_no__Ck2vM",emptyCell:"RoutineView_emptyCell__o5V_C",empty:"RoutineView_empty__FoRja",foot:"RoutineView_foot__EmDj9",sync:"RoutineView_sync__Fek1M",notice:"RoutineView_notice__VvzFH",postHead:"RoutineView_postHead__ooMEu",postMeta:"RoutineView_postMeta___lo7j",postBody:"RoutineView_postBody__nwcmb",clamp:"RoutineView_clamp__Yuyn8",expand:"RoutineView_expand__Vz52y",details:"RoutineView_details__2K_Io",latest:"RoutineView_latest__kPOEy",latestMeta:"RoutineView_latestMeta__w3r03",latestTitle:"RoutineView_latestTitle__5uEQK",row:"RoutineView_row__YLKM0",rowLabel:"RoutineView_rowLabel__wAaNU",field:"RoutineView_field__B4jvA",narrow:"RoutineView_narrow__EazoW",hint:"RoutineView_hint__R9fMv",days:"RoutineView_days__lm_q_",check:"RoutineView_check__gT_Aa",formActions:"RoutineView_formActions__A9Djj",danger:"RoutineView_danger__Xi84r",error:"RoutineView_error__JNoxw",panel:"RoutineView_panel__jkMFt",panelList:"RoutineView_panelList__JrArr",panelBadges:"RoutineView_panelBadges__H18oU",count:"RoutineView_count__GICfE",wide:"RoutineView_wide__bJkXf",rowSchedule:"RoutineView_rowSchedule__Co8RM",visuallyHidden:"RoutineView_visuallyHidden__M_RPw",inline:"RoutineView_inline__ZaYAe",chips:"RoutineView_chips__hnVXc",chipRemove:"RoutineView_chipRemove__wNru7",host:"RoutineView_host__SV_7k",quickTask:"RoutineView_quickTask__lGWoT",taskInput:"RoutineView_taskInput__UR_81",draftFields:"RoutineView_draftFields__HI4Hd",draft:"RoutineView_draft__Ln1kY",composerActions:"RoutineView_composerActions__XMQnU",draftMeta:"RoutineView_draftMeta__DTAws",notificationRow:"RoutineView_notificationRow__MTYbi",replyMeta:"RoutineView_replyMeta__OP9hc",thread:"RoutineView_thread__BnuAt",pushSwitch:"RoutineView_pushSwitch__Qt8cO",notifications:"RoutineView_notifications__ceLqO",newControl:"RoutineView_newControl__1XRVc",formFields:"RoutineView_formFields__oGedO",replies:"RoutineView_replies__nBhKm",replyCount:"RoutineView_replyCount__H0Kvu",pending:"RoutineView_pending__nyyRW",switchTrack:"RoutineView_switchTrack__EhSX5"}},21340:()=>{},21443:e=>{e.exports={dialog:"CloudProjectPicker_dialog__Dx2Dt",form:"CloudProjectPicker_form__MpEsn",header:"CloudProjectPicker_header__UcYbB",sources:"CloudProjectPicker_sources__6cl_0",activeSource:"CloudProjectPicker_activeSource__NptfQ",body:"CloudProjectPicker_body__vKMBC",account:"CloudProjectPicker_account__gb9Qo",repositories:"CloudProjectPicker_repositories__WSBt6",secondary:"CloudProjectPicker_secondary__hlaFU",primary:"CloudProjectPicker_primary__voWx5",loginLink:"CloudProjectPicker_loginLink__Gu5XC",login:"CloudProjectPicker_login__c0qSl",codeRow:"CloudProjectPicker_codeRow__jo8vy",repositoryInput:"CloudProjectPicker_repositoryInput__HWhvu",list:"CloudProjectPicker_list__0BSYU",repo:"CloudProjectPicker_repo__L4VaW",repoHeading:"CloudProjectPicker_repoHeading__3Pnq1",repoDescription:"CloudProjectPicker_repoDescription__YzPtB",error:"CloudProjectPicker_error__dAVsm",progress:"CloudProjectPicker_progress__OwvG9",footer:"CloudProjectPicker_footer__mmrGI"}},29213:e=>{e.exports={view:"PluginLabPanel_view__Sot51",toolbar:"PluginLabPanel_toolbar__co_Uq",hint:"PluginLabPanel_hint__kb7Hq",body:"PluginLabPanel_body__T_QMu",message:"PluginLabPanel_message__QbEDh",errorText:"PluginLabPanel_errorText__EI47_",list:"PluginLabPanel_list__BnAn6",card:"PluginLabPanel_card__5479R",cardHead:"PluginLabPanel_cardHead__SCiZ3",titleBlock:"PluginLabPanel_titleBlock__zfcvo",titleLine:"PluginLabPanel_titleLine__OmG7U",name:"PluginLabPanel_name__t4Ea0",id:"PluginLabPanel_id__osclH",control:"PluginLabPanel_control___gzgN",switch:"PluginLabPanel_switch__m3agg",switchLabel:"PluginLabPanel_switchLabel__DGX6y",description:"PluginLabPanel_description__PfruO",enhancement:"PluginLabPanel_enhancement__TOHjM",enhancementHead:"PluginLabPanel_enhancementHead__sgewN",enhancementDate:"PluginLabPanel_enhancementDate__4YWB1",enhancementSummary:"PluginLabPanel_enhancementSummary__srTnj",tools:"PluginLabPanel_tools__raR8s",metaLabel:"PluginLabPanel_metaLabel__LY5ak",toolList:"PluginLabPanel_toolList___rd6_",tool:"PluginLabPanel_tool___AjRR",problem:"PluginLabPanel_problem__Sx4aQ",problemLabel:"PluginLabPanel_problemLabel__rBSUT",cardActions:"PluginLabPanel_cardActions__GI_Bb",stage:"PluginLabPanel_stage__1l0FR",frame:"PluginLabPanel_frame__sP_V0",status:"PluginLabPanel_status__BYiAs",lines:"PluginLabPanel_lines__ONctT",notice:"PluginLabPanel_notice__mn_vu"}},34817:e=>{e.exports={notice:"RepoSyncIndicator_notice__6q27O",body:"RepoSyncIndicator_body___uZUj",repo:"RepoSyncIndicator_repo__U0mga",actions:"RepoSyncIndicator_actions__OgFJN"}},40960:e=>{e.exports={active:"ComputerTakeoverControl_active__7430b"}},66592:e=>{e.exports={root:"TypedInterpreter_root__q_c0E",results:"TypedInterpreter_results__6j7HQ",turn:"TypedInterpreter_turn__BELhE",label:"TypedInterpreter_label__tFGb1",original:"TypedInterpreter_original__IxOOM",translation:"TypedInterpreter_translation__bR55x",composer:"TypedInterpreter_composer__IgxpT",direction:"TypedInterpreter_direction__8Chyz",field:"TypedInterpreter_field__6QmFe",submit:"TypedInterpreter_submit__tRKd5",error:"TypedInterpreter_error__h7BTN",modes:"TypedInterpreter_modes__Krr0C",toolbar:"TypedInterpreter_toolbar__L_2u0"}},80455:(e,t,n)=>{Promise.resolve().then(n.bind(n,89976)),Promise.resolve().then(n.bind(n,84183))},84183:(e,t,n)=>{"use strict";n.d(t,{I18nProvider:()=>p,s:()=>m});var r=n(95155),i=n(12115);let s=JSON.parse('{"resource.reset.use":"리셋 사용","resource.reset.unavailable":"지금은 사용 불가","resource.reset.summary":"사용할 리셋: {name}","resource.reset.covers":"초기화할 한도: {limits}","resource.reset.includedOverage":"포함된 초과 사용량","resource.reset.mismatch":"요청한 리셋: {requested}. 서버에서 사용한 리셋: {consumed}. 자동으로 다시 시도하지 않았습니다.","resource.reset.rejection":"리셋 사용 실패: {code}. {reason}","resource.reset.name.full":"전체 리셋","resource.reset.name.fable":"페이블 리셋","resource.reset.name.fiveHour":"5시간 리셋","resource.reset.name.generic":"리셋","resource.reset.window.fiveHour":"5시간","resource.reset.window.weekly":"주간","resource.reset.chip.nextUse":"다음 사용","savedPrompts.title":"저장된 프롬프트","savedPrompts.loading":"불러오는 중...","savedPrompts.empty":"저장된 프롬프트 없음","savedPrompts.save":"현재 입력을 프롬프트로 저장","savedPrompts.saved":"저장됨","savedPrompts.delete":"삭제","savedPrompts.confirmDelete":"삭제할까요?","savedPrompts.cancel":"취소","savedPrompts.hint":"텍스트 입력 후 //를 입력하여 저장하세요. 변수: {{project_name}} {{session_name}} {{cwd}} {{date}}","savedPrompts.error":"저장된 프롬프트 요청 실패: {error}","memoryTrace.refresh":"새로고침","memoryTrace.noSession":"세션을 고르면 기억을 찾은 과정이 보여요.","memoryTrace.loading":"세션 기록을 읽는 중…","memoryTrace.error":"기억 추적을 불러오지 못했어요. {error}","memoryTrace.retry":"다시 불러오기","memoryTrace.empty":"이 세션에는 기억\xb7지도 기록이 없어요","memoryTrace.requests":"기록 있는 요청 {count}개","memoryTrace.requestsLabel":"요청","memoryTrace.requestHeading":"요청 #{index}","memoryTrace.noPreview":"(글 없음)","memoryTrace.flowLabel":"요청 흐름","memoryTrace.stageRecall":"기억 불러옴","memoryTrace.stageJev":"JEV 대조","memoryTrace.stageDocmap":"지도 후보","memoryTrace.stageDocs":"연 문서","memoryTrace.stageLessons":"편집 전 교훈","memoryTrace.stageSaved":"새로 저장","memoryTrace.stageEmpty":"이 요청에서는 이 단계가 없었어요.","memoryTrace.openedSummary":"{opened}개 열어 봄 \xb7 {skipped}개 후보만","memoryTrace.opened":"열어 봄","memoryTrace.candidateOnly":"후보만","memoryTrace.fromMap":"지도 후보","memoryTrace.lines":"읽은 줄 {lines}","memoryTrace.autoRecall":"요청 전에 자동으로 불러옴","memoryTrace.explicitRecall":"작업 중 직접 찾음","memoryTrace.query":"질의","memoryTrace.noResults":"돌아온 기억이 없어요.","memoryTrace.noMemoryText":"이 기록에는 기억 글이 남아 있지 않아요.","memoryTrace.jevUnknown":"판정 불명 {count}개","memoryTrace.jevUnrelated":"무관 {count}개","memoryTrace.lessonFor":"편집 전에 띄운 기억","memoryTrace.savedAuto":"자동 저장","memoryTrace.graphLabel":"연결 그래프","memoryTrace.graphScope":"그래프 범위","memoryTrace.scopeRequest":"이 요청","memoryTrace.scopeSession":"세션 전체","memoryTrace.legendRequest":"요청","memoryTrace.legendMemory":"기억","memoryTrace.legendDoc":"지도 문서","memoryTrace.legendFile":"편집 파일","memoryTrace.graphEmpty":"이 범위에는 이어진 항목이 없어요.","memoryTrace.nodeLabel":"{kind}: {label}, 연결 {count}개","memoryTrace.edgeRecalled":"불러옴","memoryTrace.edgeLesson":"편집 전 교훈","memoryTrace.verdictLegend":"JEV 판정","memoryTrace.verdictApply":"적용 조건 일치","memoryTrace.verdictExcepted":"조건 불충족\xb7예외","memoryTrace.verdictConflict":"요청과 충돌","memoryTrace.verdictUnconfirmed":"조건 미확인","memoryTrace.verdictUnlisted":"무관\xb7판정 불명","memoryTrace.graphHint":"노드를 가리키거나 포커스하면 전체 글이 여기 나와요.","memoryTrace.legendDocEdited":"열고 편집한 파일","memoryTrace.noticeHarness":"하네스","memoryTrace.noticeResume":"자동 재개","cloudProjects.launch":"GitHub 저장소 열기","cloudProjects.title":"클라우드 프로젝트","cloudProjects.description":"GitHub 저장소를 가져와 이 서버에서 작업을 이어가세요.","cloudProjects.github":"GitHub 저장소","cloudProjects.serverFolder":"서버 폴더 열기","cloudProjects.account":"GitHub 연결","cloudProjects.connectTitle":"내 GitHub 저장소 연결","cloudProjects.connectHelp":"연결하면 비공개 저장소도 목록에서 선택할 수 있습니다.","cloudProjects.connected":"GitHub 연결됨","cloudProjects.refresh":"다시 확인","cloudProjects.waiting":"로그인 대기 중","cloudProjects.connect":"GitHub 연결","cloudProjects.deviceHelp":"아래 코드를 GitHub 로그인 화면에 입력하세요.","cloudProjects.copyCode":"코드 복사","cloudProjects.copied":"복사됨","cloudProjects.copyFailure":"코드를 복사하지 못했습니다. 코드를 선택해 직접 복사하세요.","cloudProjects.openLogin":"GitHub에서 로그인","cloudProjects.permissionHelp":"GitHub에서 계정과 요청 권한을 확인하고 승인하세요. 인증 토큰은 서버에만 저장됩니다.","cloudProjects.preparingCode":"로그인 코드를 준비하고 있습니다.","cloudProjects.repositories":"내 저장소","cloudProjects.search":"저장소 검색","cloudProjects.searchPlaceholder":"이름 또는 설명으로 찾기","cloudProjects.loading":"저장소를 불러오고 있습니다.","cloudProjects.private":"비공개","cloudProjects.public":"공개","cloudProjects.empty":"일치하는 저장소가 없습니다. 다른 이름으로 검색하거나 URL을 입력하세요.","cloudProjects.more":"더 보기","cloudProjects.urlLabel":"선택한 저장소 또는 GitHub URL","cloudProjects.publicHelp":"공개 저장소는 로그인 없이도 가져올 수 있습니다. 이미 가져온 저장소는 변경 없이 다시 엽니다.","cloudProjects.error":"작업을 완료하지 못했습니다.","cloudProjects.openingHelp":"저장소를 서버에 가져오고 있습니다. 크기에 따라 시간이 걸릴 수 있습니다.","cloudProjects.opening":"프로젝트 여는 중","cloudProjects.open":"프로젝트 열기","common.ok":"확인","common.language":"언어","common.models":"모델","common.skills":"스킬","common.plugins":"플러그인","common.settings":"설정","updates.available":"CUELO 업데이트 있음","updates.availableTitle":"CUELO {version} 릴리스가 나왔습니다","updates.dialogEyebrow":"CUELO 릴리스","updates.dialogTitle":"새 CUELO 버전","updates.current":"현재 CUELO {version}","updates.changelog":"변경 사항","updates.viewRelease":"릴리스 보기","updates.manual":"소스에서 실행 중이면 서버를 먼저 멈추고 아래 명령으로 갱신한 뒤 다시 시작하세요. 별도 --home 경로를 사용한다면 setup에도 같은 --home 옵션을 붙이세요.","updates.copyCommand":"명령어 복사","updates.commandCopied":"명령어 복사됨","updates.copyFailed":"명령어를 복사할 수 없습니다","updates.apply":"지금 업데이트","updates.applyBusy":"업데이트 중…","updates.applyConfirm":"CUELO {version}(으)로 업데이트하고 다시 시작할까요?\\n\\n업데이트하는 동안 서버가 잠시 멈추고 이 화면은 진행 상황을 보여 줍니다. 새 버전이 응답하면 자동으로 새로 고칩니다.","updates.applyConfirmBusy":"CUELO {version}(으)로 업데이트하고 다시 시작할까요?\\n\\n실행 중인 세션 {count}개가 중단되고 서버가 잠시 멈춥니다. 이 화면은 진행 상황을 보여 주며, 새 버전이 응답하면 자동으로 새로 고칩니다.","updates.unsupported":"이 설치 방식은 앱에서 바로 바꿀 수 없습니다. 아래 명령을 사용하세요.","updates.unsupportedReason":"감지 결과: {reason}","updates.phase.starting":"업데이트 준비 중","updates.phase.fetching":"새 버전 받는 중","updates.phase.installing":"패키지 설치 중","updates.phase.building":"빌드 중","updates.phase.restarting":"서버 다시 시작 중","updates.phase.done":"업데이트 완료","updates.phase.handed-off":"서비스 갱신으로 넘김","updates.phase.restart-required":"설치 완료 — CUELO를 직접 다시 시작하세요","updates.phase.failed":"업데이트 실패","updates.waitingForRestart":"서버가 다시 시작되기를 기다리고 있습니다. 새 버전이 응답하면 화면을 새로 고칩니다.","updates.handedOff":"WSL 서비스 갱신이 자체 대기 화면에서 진행됩니다. 끝나면 이 화면이 새로 고쳐집니다.","updates.logPath":"로그: {path}","updates.applyStartFailed":"업데이트를 시작하지 못했습니다: {reason}","sidebar.hide":"사이드바 숨기기","sidebar.show":"사이드바 표시","theme.light":"라이트 모드 (클릭하면 다크)","theme.dark":"다크 모드 (클릭하면 시스템)","theme.auto":"시스템 테마 (클릭하면 라이트)","theme.graphite":"흑연 테마 (배경화면)","theme.graphiteHint":"흑연색 화면에 지금 캐릭터 모드의 배경화면을 깝니다. 다크 모드에서만 적용되고 이 브라우저에만 저장됩니다.","history.full":"전체 기록","history.unsaved":"전체 기록은 세션 저장 후 사용할 수 있습니다","history.label":"전체 기록","title.generating":"생성 중...","title.updated":"제목 업데이트됨","title.failed":"생성 실패","title.generate":"제목 생성","title.unsaved":"제목 생성은 세션 저장 후 사용할 수 있습니다","title.noMessages":"세션 이름을 지정하기 전에 메시지를 보내세요","title.generateSession":"세션 제목 생성","system.prompt":"시스템 프롬프트","system.empty":"시스템 프롬프트가 비어 있습니다 (도구 비활성화됨)","system.load":"시스템 프롬프트를 불러오려면 메시지를 보내세요","system.label":"시스템","session.info":"세션 정보","session.name":"이름","session.file":"파일","session.inMemory":"메모리 내","session.id":"ID","session.user":"사용자","session.assistant":"어시스턴트","session.toolCalls":"도구 호출","session.toolResults":"도구 결과","session.total":"합계","session.input":"입력","session.output":"출력","session.cacheRead":"캐시 읽기","session.cacheWrite":"캐시 쓰기","session.cost":"비용","session.context":"컨텍스트","session.copy":"{value} 복사","session.copied":"복사됨","session.title":"세션 정보","session.load":"세션 정보를 불러오려면 메시지를 보내거나 /session을 실행하세요","session.infoSection":"세션 정보","session.messages":"메시지","session.tokens":"Token","session.copyFile":"파일 경로 복사","session.copyId":"세션 ID 복사","session.cacheHitRate":"평균 캐시 적중률","session.totalActive":"활동 시간","workspace.opening":"워크스페이스를 여는 중...","workspace.unable":"워크스페이스를 열 수 없습니다","workspace.selectSession":"사이드바에서 세션을 선택하세요","workspace.getStarted":"시작하기","workspace.selectProject":"사이드바에서 프로젝트 디렉터리를 선택하세요","workspace.addModels":"하단의 모델 버튼으로 모델을 추가하세요","workspace.stepProject":"사이드바에서 프로젝트 디렉터리를 선택하세요","workspace.stepModels":"하단의 모델 버튼으로 모델을 추가하세요","workspace.mainWorking":"작업중","workspace.mainWaiting":"대기중","workspace.mainIdle":"대기","workspace.mainAttention":"입력필요","files.hidePanel":"파일 패널 숨기기","files.showPanel":"파일 패널 표시","files.noneOpen":"열린 파일 없음","files.docs.noProject":"프로젝트를 선택하면 문서 바로가기가 보입니다.","files.docs.loading":"프로젝트 문서를 찾는 중…","files.docs.projectDenied":"이 프로젝트 폴더는 CUELO가 읽을 수 있는 폴더 밖에 있습니다.","files.docs.loadFailed":"프로젝트 문서를 불러오지 못했습니다: {error}","files.docs.projectDir":"프로젝트 폴더: {path}","files.docs.noneFound":"저장소 루트까지 HANDOFF.md가 없고, 이 폴더에 doc/README.md나 doc/history도 없습니다.","files.docs.current":"현재 상태","files.docs.map":"문서 지도","files.docs.records":"최근 기록","files.docs.missing":"{file} 없음","files.docs.denied":"{file}은(는) 읽기 허용 폴더 밖에 있습니다","layout.resizeSidebar":"사이드바 크기 조절","layout.resizeFilePanel":"파일 패널 크기 조절","layout.resizeHint":"드래그하여 크기를 조절합니다. 더블 클릭 또는 Enter 키로 초기화합니다.","sidebar.new":"새로 만들기","sidebar.newSessionTitle":"{path}에서 새 세션","sidebar.refresh":"새로고침","sidebar.projects":"프로젝트","subagents.title":"서브 Agent","subagents.running":"실행 중","subagents.finished":"완료됨","subagents.history":"기록","subagents.runningCount":"{count}개 실행 중","subagents.finishedCount":"{count}개 완료됨","subagents.failed":"실패","subagents.aborted":"중단됨","subagents.back":"서브 Agent 목록으로 돌아가기","subagents.retrying":"재시도 중 {attempt}/{max}","subagents.usingTool":"{tool} 사용 중","subagents.details":"서브 Agent 실행 상세","subagents.closeDetails":"서브 Agent 상세 닫기","subagents.noTask":"작업 설명 없음","subagents.tools":"도구 {count}개","subagents.tokens":"{count} Token","subagents.loadingTranscript":"실시간 기록을 불러오는 중…","subagents.noTranscript":"서브 Agent가 아직 기록 메시지를 작성하지 않았습니다.","subagents.transcriptUnavailable":"실시간 기록을 아직 사용할 수 없습니다. 서브 Agent가 실행되는 동안 재시도합니다.","sidebar.searchProjectsAndSessions":"프로젝트 및 세션 제목 검색…","sidebar.addProject":"사용자 지정 프로젝트 경로 추가","sidebar.projectActions":"프로젝트 작업","sidebar.projectAlias":"별칭","sidebar.projectAliasEdit":"별칭 편집","sidebar.projectHide":"숨기기","sidebar.projectUnhide":"숨김 해제","sidebar.projectShowHidden":"숨긴 프로젝트 표시","sidebar.temporaryProjects":"임시\xb7시스템 경로","sidebar.projectMoveUp":"위로 이동","sidebar.projectMoveDown":"아래로 이동","sidebar.projectMoveDisabledWhileFiltering":"프로젝트 순서를 변경하려면 검색 필터를 지우세요","sidebar.projectUpdateFailed":"프로젝트 변경 사항을 저장할 수 없습니다. 다시 시도하세요.","sidebar.expandProject":"프로젝트 펼치기","sidebar.collapseProject":"프로젝트 접기","sidebar.showMore":"더 보기","sidebar.showLess":"간략히 보기","sidebar.selectProject":"프로젝트 선택…","sidebar.filterProjects":"프로젝트 필터…","sidebar.noMatchingProjects":"일치하는 프로젝트 없음","sidebar.useDefaultDirectory":"기본 디렉터리 사용","sidebar.customPath":"사용자 지정 경로…","directoryPicker.selectDirectory":"디렉터리 선택","directoryPicker.goToParent":"상위 디렉터리로 이동","directoryPicker.directoryPath":"디렉터리 경로","directoryPicker.goToDirectory":"디렉터리로 이동","directoryPicker.go":"이동","directoryPicker.loadingDirectories":"디렉터리를 불러오는 중…","directoryPicker.noSubdirectories":"하위 디렉터리 없음","directoryPicker.openBeforeSelecting":"선택하기 전에 이 경로를 엽니다","directoryPicker.selectCurrentDirectory":"현재 디렉터리 선택","directoryPicker.selectThisFolder":"이 폴더 선택","directoryPicker.noDrives":"드라이브를 찾을 수 없음","sidebar.checking":"확인 중…","sidebar.open":"열기","sidebar.cancel":"취소","sidebar.openRepoRoot":"저장소 루트 열기","sidebar.openRepoRootTitle":"worktree를 관리하려면 저장소 루트를 여세요.","sidebar.gitRepoRootOnly":"Git 저장소 루트 전용","sidebar.gitRepoRootOnlyTitle":"worktree는 Git 저장소 루트에서만 사용할 수 있습니다.","sidebar.worktrees":"Worktree...","sidebar.checkingWorktrees":"이 디렉터리의 worktree를 확인합니다.","sidebar.filterWorktrees":"worktree 필터…","sidebar.noMatchingWorktrees":"일치하는 worktree 없음","sidebar.switchWorktree":"worktree 전환","sidebar.switchWorktreeTitle":"worktree 전환: {path}","sidebar.main":"main","sidebar.forceRemoveCheckout":"커밋되지 않은 변경 사항이 있습니다. 체크아웃을 강제로 제거할까요?","sidebar.force":"강제","sidebar.createWorktreeTitle":"Branch에 대한 worktree 체크아웃을 생성합니다","sidebar.newWorktree":"새 worktree…","sidebar.branchName":"Branch 이름","sidebar.creating":"생성 중…","sidebar.create":"생성","sidebar.loading":"불러오는 중...","sidebar.noSessions":"세션 없음","sidebar.agentRunning":"Agent 실행 중…","sidebar.newActivity":"새 활동","sidebar.newSessionActivity":"새 세션 활동","sidebar.deleteSession":"{title}을(를) 삭제할까요?","sidebar.rename":"이름 변경","sidebar.pin":"맨 위에 고정","sidebar.unpin":"고정 해제","sidebar.pinned":"고정됨","sidebar.delete":"삭제","sidebar.deleteWithShiftClick":"삭제 (Shift+클릭으로 확인 없이 삭제)","sidebar.clearProjectSessions":"세션 비우기","sidebar.clearPriorityList":"목록 비우기","navigator.resultsToCheck":"확인할 결과","navigator.resultsToCheckCount":"확인할 결과 {count}","navigator.resultsToCheckHint":"이 브라우저에서 마지막으로 연 뒤 새로 끝난 대화와, 답을 기다리는 대화","navigator.resultsToCheckEmpty":"확인할 결과가 없습니다.","navigator.acknowledgeResults":"모두 확인","navigator.acknowledgeResultsHint":"지금 확인할 결과로 보이는 대화를 모두 본 것으로 표시합니다. 답을 기다리는 대화는 남습니다.","sidebar.waitingForAnswer":"답 기다림","sidebar.waitingForAnswerHint":"질문이나 승인 요청에 답할 때까지 멈춰 있습니다","sidebar.newScratchSession":"새 세션","sidebar.newScratchSessionTitle":"프로젝트 없이 세션 시작 (홈 폴더의 날짜별 임시 폴더)","sidebar.newScratchSessionFailed":"임시 폴더를 만들지 못했습니다: {error}","sidebar.clearSessionsTitle":"세션 삭제 확인","sidebar.clearSessionsProjectBody":"{project} 프로젝트의 세션 {count}개를 영구 삭제합니다. 되돌릴 수 없습니다.","sidebar.clearSessionsPriorityBody":"우선순위 목록의 세션 {count}개를 영구 삭제합니다. 되돌릴 수 없습니다.","sidebar.clearSessionsRunningExcluded":"실행 중인 세션 {count}개는 삭제하지 않습니다.","sidebar.clearSessionsNone":"지금 삭제할 수 있는 세션이 없습니다.","sidebar.clearSessionsConfirm":"삭제","sidebar.clearSessionsCancel":"취소","sidebar.clearSessionsBusy":"삭제 중…","sidebar.clearSessionsFailed":"{count}개 세션을 삭제하지 못했습니다: {names}","sidebar.archive":"보관 (목록에서 숨김, 복원 가능)","sidebar.archived":"보관됨","sidebar.restore":"복원","sidebar.noArchivedSessions":"보관된 세션 없음","sidebar.expandForks":"Fork 펼치기","sidebar.collapseForks":"Fork 접기","sidebar.messagesCount":"메시지 {count}개","sidebar.worktreePath":"Worktree: {path}","sidebar.removeWorktreeTitle":"worktree 체크아웃 {path}을(를) 제거합니다. Branch는 유지됩니다","files.deleted":"삭제됨","files.insertPath":"채팅에 경로 삽입","files.mention":"멘션","chat.loadingSession":"세션 불러오는 중...","chat.runningTool":"도구 실행 중...","chat.runningNamedTool":"{name} 실행 중...","chat.runningTools":"{names} 실행 중...","chat.runningToolsMore":"{names} (+{count}) 실행 중...","chat.waitingModel":"모델 응답 대기 중...","todo.progress":"{percent}% \xb7 {total}개 중 {completed}개 완료 \xb7 {remaining}개 남음","todo.progressDone":"{percent}% \xb7 {total}개 중 {completed}개 완료","todo.allDone":"{count}개 모두 완료","todo.showCompleted":"완료 {count}개 보기","todo.hideCompleted":"완료 {count}개 접기","todo.ready":"지금 가능","todo.waiting":"선행 대기: {tasks}","chat.runningCommand":"명령 실행 중...","chat.thinking":"생각 중...","chat.contextUsageTitle":"컨텍스트 윈도우: {limit} Token 중 {used} 사용 ({percent})","chat.contextUsageWarning":"컨텍스트 윈도우가 거의 차고 있습니다","chat.contextUsageCritical":"컨텍스트 윈도우가 거의 가득 찼습니다","chat.processDetails":"프로세스 상세","chat.message":"메시지","chat.messages":"메시지","chat.toolCall":"도구 호출","chat.toolCalls":"도구 호출","chat.collapseProcess":"프로세스 상세 접기","chat.expandProcess":"프로세스 상세 펼치기","process.empty":"이 세션에는 아직 작업 과정 기록이 없습니다","process.turn":"턴","process.turns":"턴","chat.loadEarlier":"위로 스크롤하면 이전 메시지를 불러옵니다 ({count}개 숨김)","chat.extensionRequest":"확장 요청","chat.responseSending":"응답을 보내는 중...","chat.responseFailed":"응답이 Agent에 전달되지 않았습니다. 아직 기다리는 중이니 다시 시도하세요.","chat.cancel":"취소","chat.confirm":"확인","chat.submit":"제출","chat.agentQuestion":"Agent가 입력을 기다립니다","chat.agentQuestionHint":"옵션을 선택하거나 직접 응답을 입력하세요.","chat.askAutoSelectHint":"{seconds}초 동안 응답이 없으면 추천안으로 자동 선택합니다. 선택하거나 입력하면 대기 시간이 다시 시작됩니다.","chat.recommended":"추천","chat.customAnswer":"기타 응답 (선택)","chat.chatAboutThis":"이것에 대해 대화","chat.submitAnswer":"답변 제출","chat.agentFormHint":"양식을 채워 제출하세요.","chat.askFormAutoSubmitHint":"{seconds}초 동안 응답이 없으면 지금 입력된 값을 그대로 제출합니다. 입력하면 대기 시간이 다시 시작됩니다.","chat.formOther":"기타","chat.formOtherPlaceholder":"직접 입력","chat.formRequired":"필수","chat.formInvalid":"표시된 항목을 확인한 뒤 제출하세요.","chat.formImageUnavailable":"이미지를 불러오지 못했습니다","chat.formError.required":"필수 항목입니다","chat.formError.selectAtLeastOne":"하나 이상 선택하세요","chat.formError.enterNumber":"숫자를 입력하세요","chat.formError.min":"{value} 이상이어야 합니다","chat.formError.max":"{value} 이하여야 합니다","chat.formError.minLength":"{value}자 이상 입력하세요","chat.formError.maxLength":"{value}자 이하로 입력하세요","chat.formError.email":"이메일 주소를 입력하세요","chat.formError.url":"전체 URL을 입력하세요","chat.formError.pattern":"형식이 맞지 않습니다 ({pattern})","chat.planApproval":"계획 승인","chat.planFeedback":"추가 계획 수립을 위한 피드백 (선택)","chat.refinePlan":"계획 계속하기","chat.approvePlan":"승인 후 구현","chat.extensionInput":"확장 터미널 입력","chat.extensionPanel":"확장 패널","chat.close":"닫기","chat.queued":"대기 중 \xb7 {count}","chat.recall":"입력창으로 되돌리기","chat.recallTitle":"대기 중인 메시지를 모두 제거하고 편집할 수 있도록 입력창에 다시 넣습니다","chat.queueRemove":"이 대기 메시지만 취소","chat.retrying":"재시도 중 ({attempt}/{max})…","chat.recoveredError":"이 시도는 실패해 자동으로 다시 보냈습니다.","chat.recoveredErrorDetail":"오류 보기","chat.loadingCommands":"명령 불러오는 중...","chat.slashCommands":"슬래시 명령 \xb7 {label}","chat.tabEnter":"Tab / Enter","chat.noCommands":"명령이 없습니다","chat.match":"일치 1개","chat.matches":"일치 {count}개","chat.command":"명령 1개","chat.commands":"명령 {count}개","chat.loadingFiles":"파일 불러오는 중...","chat.files":"파일 \xb7 {label}{hint}","chat.searching":"검색 중…","chat.noMatchingFiles":"일치하는 파일 없음","chat.searchingAll":" \xb7 전체 파일 검색 중…","chat.indexTruncated":" \xb7 인덱스 일부 생략됨","chat.steerPlaceholder":"지금 지시하거나 후속 메시지를 대기열에 추가하세요...","chat.agentPlaceholder":"Agent 실행 중…","chat.messagePlaceholder":"메시지 입력… / 명령어 \xb7 @ 파일","chat.steer":"지시","chat.followUp":"후속 메시지","chat.send":"보내기","chat.attachImageLimit":"메시지 하나에 이미지를 최대 {count}개까지 첨부할 수 있습니다.","chat.attachImageTooLarge":"{name} 파일이 이미지당 {limit} 제한을 초과합니다.","chat.attachFile":"파일 첨부","chat.emptyProjectLabel":"작업 폴더","chat.emptyProjectHint":"첫 메시지를 보내면 이 폴더에서 새 세션이 시작됩니다.","chat.openSessionList":"세션 목록 열기","chat.attachments":"첨부 파일","chat.removeImage":"이미지 {index} 제거","chat.removeAttachment":"{name} 제거","chat.attachExtracting":"텍스트 추출 중","chat.attachExtractingWait":"첨부 파일 처리가 끝날 때까지 기다려 주세요","chat.attachLimit":"메시지 하나에 이미지를 제외한 첨부 파일을 최대 {count}개까지 넣을 수 있습니다.","chat.attachTooLarge":"{name} 파일이 문서당 {limit} 제한을 초과합니다.","chat.attachTotalTooLarge":"첨부 문서의 합계가 {limit} 제한을 초과합니다.","chat.attachTextTooLarge":"{name}에서 추출한 텍스트가 {limit}자 제한을 초과합니다.","chat.attachTooManyPages":"{name} 파일이 PDF {limit}페이지 제한을 초과합니다.","chat.attachNoPdfText":"{name}에서 추출할 수 있는 텍스트가 없습니다. 스캔 또는 이미지 전용 PDF에 필요한 OCR은 지원하지 않습니다.","chat.attachPasswordProtected":"{name}은(는) 암호로 보호되어 텍스트를 추출할 수 없습니다.","chat.attachExtractFailed":"{name}에서 텍스트를 추출하지 못했습니다.","chat.attachKindAudio":"음성","chat.attachKindFile":"파일","chat.attachUploading":"저장 중","chat.attachTranscribing":"받아쓰기 중","chat.attachTranscribeFailed":"받아쓰기 실패","chat.attachStoredTooLarge":"{name} 파일이 파일당 {limit} 제한을 초과합니다.","chat.attachUploadFailed":"{name} 파일을 저장하지 못했습니다: {error}","chat.attachTranscribePending":"선택 필요","chat.transcribeGroup":"음성 받아쓰기","chat.transcribeChecking":"길이 확인 중","chat.transcribeConfirmTitle":"{name} 받아쓰기를 시작할까요?","chat.transcribePlanSummary":"{duration} \xb7 받아쓰기 호출 약 {calls}회","chat.transcribeDurationUnknown":"길이 알 수 없음","chat.transcribeUsageNotice":"받아쓰기는 연결된 계정의 사용량에 포함됩니다. 시작을 누르기 전에는 아무것도 보내지 않습니다.","chat.transcribeStart":"받아쓰기 시작","chat.transcribeSkip":"받아쓰지 않기","chat.transcribeCancel":"받아쓰기 취소","chat.transcribeRunning":"{name} 받아쓰는 중","chat.transcribeRetry":"다시 시도","chat.transcribeAction":"받아쓰기","chat.transcribeSkipped":"{name}은(는) 받아쓰지 않고 저장된 파일 경로만 보냅니다.","chat.transcribeFailedRow":"{name} 받아쓰기 실패: {error}","chat.transcribeToolMissing":"음성 도구(ffmpeg)를 쓸 수 없어 이 음성을 받아쓰기용으로 준비하지 못했습니다.","chat.transcribePartialFailed":"{total}조각 중 {done}조각까지 처리하고 멈췄습니다. 일부 결과는 붙이지 않았습니다.","chat.transcribeTooLong":"받아쓴 내용이 다른 첨부와 합친 글자 수 제한을 넘습니다.","chat.transcribeFallbackTitle":"{name} 기본 받아쓰기에 실패했습니다. ChatGPT/Codex로 이어서 받아쓸까요?","chat.transcribeFallbackProgress":"{total}조각 중 {done}조각은 이미 받아써서 그대로 둡니다. 실패한 조각과 남은 조각만 보냅니다.","chat.transcribeFallbackUsageNotice":"ChatGPT/Codex는 기본 받아쓰기와 다른 제공자이며, 로그인한 계정의 사용량에 포함됩니다. ChatGPT/Codex로 받아쓰기를 누르기 전에는 아무것도 보내지 않습니다.","chat.transcribeFallbackStart":"ChatGPT/Codex로 받아쓰기","chat.transcribeFallbackExpired":"이 선택은 만료됐거나 이미 사용됐습니다. 아무것도 보내지 않았습니다. 다시 시도하면 기본 받아쓰기부터 시작합니다.","chat.attachmentSettingsNav":"첨부 파일","chat.attachmentSettingsTitle":"첨부 파일","chat.attachmentSettingsDescription":"대화에 첨부한 파일은 에이전트가 열 수 있도록 이 컴퓨터에 저장됩니다.","chat.attachmentSettingsLoadFailed":"첨부 설정을 불러오지 못했습니다","chat.attachmentUploadLimit":"파일당 업로드 한도(MB)","chat.attachmentUploadLimitHelp":"이보다 큰 파일은 보내기 전에 거절합니다. 메시지에 바로 읽어 넣는 텍스트는 따로 문서당 8MB, 합계 240,000자 한도를 지킵니다.","chat.attachmentUploadLimitInvalid":"1 이상의 정수(MB)를 입력하세요.","chat.attachmentAutoCleanup":"쓰이지 않는 첨부 자동 삭제","chat.attachmentAutoCleanupHelp":"대화\xb7분기\xb7보내지 않은 초안에서 쓰이는 첨부는 지우지 않습니다. 어디에서도 쓰이지 않는다고 확인된 때부터 {days}일이 지나면 삭제하고, 쓰임을 확인할 수 없는 파일은 남겨 둡니다.","chat.attachmentSettingsSaved":"저장했습니다","characterMode.nav":"캐릭터","characterMode.title":"캐릭터","characterMode.description":"화면에 보이는 캐릭터의 얼굴\xb7이름\xb7스티커\xb7완료 음성을 고릅니다.","characterMode.label":"캐릭터 세트","characterMode.default":"기본","characterMode.office":"사무실 모드","characterMode.help":"이 PC의 서버 전체에 적용됩니다. 사무실 모드에서는 이 PC 프로필에 등록된 캐릭터가 해당 자리의 얼굴\xb7이름\xb7말투\xb7스티커\xb7음성을 대신합니다. 등록되지 않은 자리는 그대로입니다.","characterMode.noRoster":"이 PC에는 사무실 캐릭터 세트가 없어 기본 캐릭터가 그대로 쓰입니다.","characterMode.saved":"저장했습니다","chat.steerTitle":"현재 실행을 중단하고 이 메시지를 바로 전달합니다","chat.followUpTitle":"Agent가 끝난 후 이 메시지를 전달하도록 대기열에 추가합니다","chat.filterModels":"모델 필터…","chat.noMatchingModels":"일치하는 모델 없음","chat.modelRoles":"역할","chat.allModels":"전체 모델","chat.mainPreset":"Main 프리셋","roles.title":"모델 역할","roles.description":"omp는 하나의 현재 모델이 아니라 역할별로 작업을 라우팅합니다. 각 역할에 모델을 지정하면 CUELO과 omp CLI 모두에서 사용됩니다.","roles.scope":"저장 위치","roles.scopeGlobal":"전역","roles.scopeProject":"이 프로젝트","roles.unset":"— 미설정 —","roles.needsProject":"모델 역할을 편집하려면 프로젝트를 여세요.","roles.source.global":"전역 설정에서","roles.source.project":"프로젝트 설정에서","roles.source.default":"omp 기본값","roles.thinking":"Thinking","roles.thinkingInherit":"설정된 기본 thinking 수준 사용","roles.harnessNote":"CUELO Maker\xb7도구 역할 자리는 지정하기 전에도 목록에 표시됩니다. 쓸 자리만 직접 모델을 고르세요. 저장해도 로그인하거나 모델을 시험 호출하지 않습니다.","roles.harnessUnset":"미설정","roles.harness.implSol":"Maker: 한정된 설계와 깊은 원인 추적, 재작업","roles.harness.implSonnet":"Maker: 일반 구현과 보통 UI","roles.harness.implOpus":"Maker: 어려운 UI/UX","roles.harness.implDeepSeek":"Maker: 명세가 확정된 반복 작업, Main이 직접 고를 때만 사용","roles.harness.makerHardUiOpus":"Maker: 어려운 UI/UX (HARD)","roles.harness.makerHardCodeOpus":"Maker: HARD 코드, Main이 직접 고를 때만 사용","roles.harness.makerHardCodeSonnet":"Maker: 방향이 정해진 구현과 보통 UI (HARD)","roles.harness.crossReviewOpenAI":"교차검수 \xb7 OpenAI 필수 검토 (openai / openai-codex)","roles.harness.crossReviewAnthropic":"교차검수 \xb7 Anthropic 필수 검토 (anthropic)","roles.harness.crossReviewAdvisory":"교차검수 \xb7 보조 검토, 기다리지 않음 (제공자 무관)","roles.harness.preflightAnthropic":"계획 자문: 공동 사전 점검","roles.harness.skim":"도구 \xb7 다중 파일 소스 읽기 (skim)","roles.harness.draft":"도구 \xb7 문서 초안 작성 (draft)","roles.harness.ocr":"도구 \xb7 이미지 글자 전사 (ocr)","roles.harness.interpreter":"도구 \xb7 한영 통역 (interpreter)","chat.moreControls":"실행 옵션","chat.collapseControls":"실행 옵션 닫기","chat.shell":"Shell","chat.outputLocal":"출력은 로컬에만 유지","chat.outputModel":"출력을 모델로 전송","chat.noTools":"도구 없음, 읽기 전용","chat.builtInTools":"코어: {tools} \xb7 그 외 등록된 도구는 계속 활성화됨","chat.allBuiltInTools":"코어: {tools} \xb7 그 외 등록된 도구는 계속 활성화됨","chat.changeReasoning":"추론 수준 변경: {level}","chat.changeReasoningLabel":"추론 수준 변경","chat.currentReasoning":"현재 추론 강도: {level}","chat.outputSpeed":"{rate} tok/s","chat.outputSpeedTitle":"마지막 답변의 출력 속도(초당 출력 토큰, 요청 시작부터 생성 끝까지 기준)","chat.outputSpeedLive":"~{rate} tok/s","chat.outputSpeedLiveTitle":"지금 답변의 출력 속도 추정(받은 글자를 토큰으로 어림, 요청 시작부터 지금까지 기준). 답변이 끝나면 실제 토큰 수로 바뀝니다","chat.fastModeActive":"Fast 켜짐 \xb7 이 모델에 적용 중. 우선 처리라 요금\xb7사용량이 더 들 수 있습니다. 누르면 끕니다","chat.fastModeInactive":"Fast 요청됨 \xb7 이 모델\xb7계정에는 적용되지 않음. 누르면 끕니다","chat.fastModeOff":"Fast 꺼짐 \xb7 누르면 우선 처리를 요청합니다(provider에 따라 요금\xb7사용량이 더 듭니다)","chat.fastModeUnknown":"Fast 상태 확인 전 \xb7 누르면 이 세션의 실제 상태를 읽고 바꿉니다","chat.fastModeBusy":"Fast 바꾸는 중","chat.changeToolPreset":"도구 프리셋 변경","chat.stopCompaction":"압축 중지","chat.compactContext":"컨텍스트 압축","chat.compacting":"압축 중…","chat.compact":"Compact","chat.stopAgent":"Agent 중지","chat.stop":"중지","chat.liveVoice":"라이브 음성","chat.liveStart":"라이브 음성 시작","chat.liveStop":"라이브 음성 종료","chat.liveConnecting":"연결 중","chat.liveOn":"통화 중","chat.liveWorking":"작업 수행 중","chat.liveUnsupported":"이 브라우저에서는 라이브 통화를 할 수 없습니다","chat.liveMicDenied":"마이크 권한이 거부됐습니다","chat.liveMicUnavailable":"사용할 수 있는 마이크가 없습니다","chat.liveAuthRequired":"라이브 음성을 쓰려면 Codex 로그인이 필요합니다","chat.liveUpstreamFailed":"Codex가 라이브 통화를 거부했습니다","chat.liveFailed":"라이브 통화를 시작하지 못했습니다","chat.liveNeedsSession":"먼저 폴더를 선택하세요 — 라이브 통화는 이 대화의 에이전트로 말합니다","chat.liveVoiceSettingsNav":"통화 음성","chat.liveVoiceSettingsTitle":"통화 음성","chat.liveVoiceSettingsDescription":"라이브 통화와 통역 통화에서 말할 Codex 목소리와 말 빠르기를 고릅니다. 선택은 다음 통화부터 적용됩니다.","chat.liveVoiceSpeakerGroup":"목소리","chat.liveVoiceCodexLabel":"Codex 목소리","chat.liveVoiceCodexHelp":"라이브 통화와 통역 통화에서 이 목소리로 말합니다.","chat.livePaceLabel":"말 빠르기","chat.livePaceHelp":"천천히를 고르면 또박또박 느리게 말합니다.","chat.livePaceNormal":"보통","chat.livePaceSlow":"천천히","chat.liveVoiceLoadFailed":"음성 설정을 불러오지 못했습니다","chat.disableSound":"완료 알림음 끄기","chat.enableSound":"완료 알림음 켜기","chat.thinkingAuto":"추론 강도 자동 선택","chat.thinkingAutoCapped":"자동 선택, 최대 {level}","chat.thinkingOff":"추론 끔","chat.thinkingMinimal":"최소 추론","chat.thinkingLow":"낮은 추론","chat.thinkingMedium":"중간 추론","chat.thinkingHigh":"높은 추론","chat.thinkingXhigh":"매우 높은 추론","chat.thinkingMax":"최대 추론","chat.builtIn":"기본 제공","chat.extensions":"확장","chat.customCommands":"사용자 지정 명령어","chat.mcpPrompts":"MCP 프롬프트","chat.prompts":"프롬프트","chat.fileCommands":"명령어 파일","chat.skills":"Skill","chat.dormant":"휴면","chat.commandCompact":"컨텍스트를 압축합니다. 선택적으로 지침을 지정할 수 있습니다","chat.commandReload":"확장, Skill, 프롬프트, 도구를 다시 불러옵니다","chat.commandName":"세션 표시 이름을 설정합니다","chat.commandSession":"세션의 메시지, Token, 비용 통계를 표시합니다","chat.commandCopy":"마지막 어시스턴트 메시지를 복사합니다","chat.goalLabel":"목표","chat.goalPaused":"일시정지됨","chat.goalBudgetLeft":"{left} 남음","chat.goalTokensUsed":"{used} 사용","chat.jumpToBottom":"맨 아래로 이동","chat.loadLater":"아래로 스크롤하면 이후 메시지를 불러옵니다 ({count}개 남음)","chat.jumpMissing":"이 메시지는 지금 대화 화면에 없습니다(다른 분기이거나 압축된 기록).","chat.questionRail":"내 질문","chat.searchPlaceholder":"대화에서 찾기","chat.searchNoResults":"결과 없음","chat.searchCount":"{index}/{total}","chat.searchPrevious":"이전 결과","chat.searchNext":"다음 결과","chat.searchClose":"찾기 닫기","chat.compactionLabel":"압축","chat.compactionProgress":"컨텍스트 압축 중 \xb7 {seconds}초","chat.compactionReason.manual":"수동","chat.compactionReason.threshold":"임계치","chat.compactionReason.overflow":"초과","chat.compactionReason.idle":"유휴","chat.compactionReason.incomplete":"미완료","chat.compactedFrom":"{tokens} 토큰에서 압축됨","chat.interruptedTitle":"지난 실행이 중단됐어요","chat.interruptedDetail":"서버나 PC가 꺼지는 등으로 실행 도중 멈췄습니다. 자동으로 이어지지 않으면 메시지를 보내 계속할 수 있어요.","chat.interruptedDismiss":"닫기","chat.frequentModels":"자주 쓰는 모델","chat.modelPickCount":"{count}회","palette.searchPlaceholder":"대화 내용 검색","palette.searchResults":"대화 검색 결과","palette.searching":"검색 중…","palette.searchFailed":"검색하지 못했습니다","palette.searchEmpty":"일치하는 메시지가 없습니다","palette.searchHits":"메시지 {count}개","palette.searchTruncated.time":"시간 한도로 세션 {total}개 중 {scanned}개까지만 검색","palette.searchTruncated.bytes":"크기 한도로 세션 {total}개 중 {scanned}개까지만 검색","palette.searchTruncated.results":"앞쪽 결과만 표시 중 \xb7 검색어를 좁혀 보세요","palette.searchCompacted":"압축된 기록의 {count}개는 제외","palette.searchRoleUser":"내 질문","palette.searchRoleAssistant":"답변","palette.wideChatOn":"넓은 대화 폭 사용","palette.wideChatOff":"기본 대화 폭 사용","palette.groupViews":"보기","palette.groupViewsHint":"인스펙터에서 열림","palette.groupShortcuts":"바로가기","palette.groupScreen":"화면","palette.hintMove":"이동","palette.hintOpen":"열기","palette.hintClose":"닫기","chat.compacted":"압축됨","chat.tokensSaved":"{saved} 절약","chat.filesWritten":"변경된 파일","chat.openWrittenFile":"{name} 열기","chat.lessonsSaved":"[교훈 저장] 이번 턴에 에이전트가 직접 저장했습니다.","chat.savedLesson":"교훈: {memory}","chat.savedSkill":"스킬 {action}: {name}","i18n.close":"닫기","i18n.copy":"복사","i18n.copied":"복사됨","i18n.cancel":"취소","i18n.save":"저장","i18n.saving":"저장 중…","i18n.saved":"저장됨","i18n.remove":"제거","i18n.removing":"제거 중…","i18n.delete":"삭제","i18n.loading":"불러오는 중...","i18n.search":"검색","i18n.refresh":"새로고침","i18n.update":"업데이트","i18n.updating":"업데이트 중...","restart.title":"CUELO 재시작 중","restart.body":"서버가 돌아오면 이 페이지가 자동으로 새로고침됩니다.","restart.slow":"재시작이 2분 넘게 끝나지 않았습니다. 서버 PC의 %USERPROFILE%\\\\.omp\\\\restart-ompweb.log에서 READY/FAILED를 확인하세요. 서버가 돌아오면 이 페이지는 그대로 새로고침됩니다.","restart.returnedTitle":"CUELO 재시작 완료","restart.returnedBody":"서버가 돌아와 이 탭을 같은 대화로 다시 연결했습니다.","restart.returnedDismiss":"재시작 알림 닫기","i18n.check":"확인","i18n.checking":"확인 중...","i18n.install":"설치","i18n.installing":"설치 중...","i18n.noResults":"결과 없음","i18n.searchProviders":"Provider 검색…","i18n.noProviders":"일치하는 Provider 없음","i18n.newModel":"새 모델","i18n.addProvider":"Provider 추가","i18n.selectProviderModel":"Provider 또는 모델을 선택하세요","i18n.visibleInPrompt":"모델 프롬프트에 표시됨 — 클릭하여 비활성화","i18n.hiddenFromPrompt":"모델 프롬프트에서 숨겨짐 — 클릭하여 활성화","i18n.dormant":"휴면","i18n.hiddenButInvocable":"모델에서 숨겨졌지만 수동 호출은 가능합니다","i18n.skillSearchPlaceholder":"예: react, testing, deploy","i18n.searching":"검색 중…","i18n.noSkills":"Skill을 찾을 수 없음","i18n.checkUpdates":"업데이트 확인","i18n.updates":"업데이트","i18n.noResolvedResources":"확인된 리소스 없음","i18n.enablePackage":"패키지 활성화","i18n.disablePackage":"패키지 비활성화","i18n.filtered":"필터링됨","i18n.openSessionToReload":"다시 불러오려면 세션을 여세요","i18n.notFound":"찾을 수 없음","i18n.noPlugins":"구성된 Plugin 없음","trust.resourcesNotLoaded":"제한 모드","trust.trustProject":"프로젝트 신뢰","computerTakeover.allow":"가로채기 허용","computerTakeover.active":"가로채기 허용 중","computerTakeover.allowHint":"이 세션에서만 화면 가로채기를 허용합니다. 끄거나 세션이 닫히면 다시 거부로 돌아갑니다.","computerTakeover.activeHint":"이 세션은 화면 가로채기가 허용된 상태입니다. 누르면 끕니다.","computerTakeover.shared":"서버와 같은 폴더에서 연 세션은 따로 허용할 수 없습니다.","computerTakeover.failed":"가로채기 설정을 바꾸지 못했습니다: {error}","trust.trusting":"신뢰 처리 중...","trust.cancel":"취소","trust.dialogTitle":"이 프로젝트를 신뢰하시겠습니까?","trust.dialogBody":"프로젝트 리소스는 로컬 코드를 실행할 수 있습니다. 내용을 알고 있는 프로젝트만 신뢰하세요.","trust.skillsNotLoaded":"이 프로젝트가 신뢰되지 않아 프로젝트 Skill이 로드되지 않았습니다.","trust.pluginsNotLoaded":"이 프로젝트가 신뢰되지 않아 프로젝트 Plugin이 로드되지 않았습니다.","trust.projectScopeUnavailable":"프로젝트 리소스가 로드되지 않은 동안에는 프로젝트 설치를 사용할 수 없습니다.","trust.pendingBadge":"제한 모드 \xb7 신뢰 예약됨","trust.scheduledTitle":"신뢰가 예약됐습니다","trust.scheduledBody":"이 프로젝트는 아직 제한 모드입니다. 이 프로젝트의 모든 세션이 지금 하는 작업을 마치면 신뢰가 적용되며, 실행 중인 작업은 중단되지 않습니다.","trust.cancelSchedule":"예약 취소","trust.close":"닫기","trust.applyFailed":"예약한 신뢰를 적용하지 못해 프로젝트는 계속 제한 모드입니다: {error}. 다시 시도하려면 다시 신뢰하세요.","trust.settingsNav":"프로젝트 신뢰","trust.settingsDescription":"자체 확장\xb7hook\xb7도구\xb7MCP 서버가 있는 프로젝트는 신뢰한 뒤에만 그 코드를 불러옵니다. 세션이 작업 중일 때 바꾼 설정은 그 프로젝트의 모든 세션이 idle이 되면 적용되며, 실행 중인 작업은 중단되지 않습니다.","trust.settingsEmpty":"아직 신뢰 결정이 필요한 프로젝트가 없습니다.","trust.loadFailed":"프로젝트 신뢰 상태를 불러오지 못했습니다: {error}","trust.stateTrusted":"신뢰됨","trust.stateRestricted":"제한 모드","trust.stateNotRequired":"신뢰가 필요한 프로젝트 코드 없음","trust.pendingGrant":"신뢰를 승인했지만 아직 적용 전입니다. 세션들이 작업을 마칠 때까지 제한 모드가 유지됩니다.","trust.pendingRevoke":"신뢰 해제는 이미 저장됐습니다. 실행 중인 세션 {count}개가 아직 프로젝트 코드를 쓰고 있으며, 지금 작업이 끝나면 제한 모드로 다시 시작합니다.","trust.runtime":"실행 세션 {sessions} \xb7 작업 중 {running} \xb7 프로젝트 코드 로드 {loaded}","trust.revoke":"신뢰 해제","trust.trustAgain":"다시 신뢰","trust.confirm":"확인","trust.working":"저장 중…","trust.confirmGrant":"이 프로젝트를 신뢰할까요? 프로젝트의 확장\xb7hook\xb7도구\xb7MCP 서버가 이 컴퓨터에서 실행될 수 있습니다.","trust.confirmTrustAgain":"해제를 되돌리는 것은 새 신뢰 승인입니다. 프로젝트의 확장\xb7hook\xb7도구\xb7MCP 서버가 이 컴퓨터에서 실행될 수 있습니다.","trust.confirmRevoke":"신뢰를 해제할까요? 새 세션은 바로 제한 모드로 시작하고, 실행 중인 세션은 지금 작업을 마친 뒤 적용됩니다.","trust.doneApplied":"적용했습니다. 이 프로젝트의 세션은 이제 이 설정으로 시작합니다.","trust.doneCancelled":"예약을 취소했습니다. 프로젝트는 계속 제한 모드입니다.","trust.refresh":"새로고침","i18n.creatingSession":"새 세션 생성 중…","i18n.creating":"생성 중…","i18n.subscription":"구독","i18n.subscriptions":"구독 목록","i18n.customEndpoint":"사용자 지정 엔드포인트 형식","i18n.noChanges":"변경 사항 없음","i18n.branches":"Branch 목록","i18n.noActiveSession":"활성 세션 없음","i18n.noBranches":"이 세션에는 Branch가 없습니다","i18n.source":"소스","i18n.preview":"미리보기","i18n.diff":"Diff","i18n.downloadFile":"파일 다운로드","i18n.liveSync":"실시간 동기화 활성","i18n.notWatching":"감시 안 함","i18n.fileViewMode":"파일 보기 모드","i18n.compareHead":"작업 트리를 HEAD와 비교","i18n.mentionSelectedLines":"선택한 줄 멘션","i18n.disableWrap":"자동 줄바꿈 끄기","i18n.enableWrap":"자동 줄바꿈 켜기","i18n.htmlPreview":"HTML 미리보기","i18n.previewFile":"{file} 미리보기","i18n.invalidMermaid":"잘못된 Mermaid 다이어그램","i18n.renderingMermaid":"Mermaid 다이어그램 렌더링 중","i18n.previewAfterStreaming":"스트리밍 완료 후 미리보기 가능","i18n.showMermaidSource":"Mermaid 소스 보기","i18n.previewMermaid":"Mermaid 다이어그램 미리보기","i18n.openMermaidViewer":"다이어그램 뷰어 열기","i18n.mermaidViewer":"Mermaid 다이어그램 뷰어","i18n.mermaidDiagram":"Mermaid 다이어그램","i18n.zoomOut":"축소","i18n.zoomIn":"확대","toolImage.dialogLabel":"확대한 이미지","toolImage.requestEdit":"이 화면 수정 요청","toolImage.requestEditHint":"이 이미지를 입력창에 붙입니다. 고칠 내용을 적어 보내세요.","toolImage.noComposer":"붙일 입력창이 없습니다. 대화를 열고 「이 화면 수정 요청」을 누르세요.","toolImage.loadFailed":"이미지를 가져오지 못했습니다. 「이 화면 수정 요청」을 다시 누르세요.","toolImage.markHint":"고칠 곳을 드래그해 표시하세요","toolImage.markLimit":"구역은 {count}개까지 표시할 수 있습니다","toolImage.clearMarks":"표시 지우기","toolImage.regionLabel":"구역 {n}","toolImage.locatorIntro":"첨부한 화면에 고칠 곳을 빨간 상자로 표시했습니다(구역 {range}). 구역별 확대 그림이 뒤에 이어집니다.","toolImage.locatorRegion":"구역 {n}: x={x}, y={y}, 폭 {w}, 높이 {h} (원본 {width}\xd7{height} 픽셀 기준)","files.pickElement":"요소 지정","files.pickElementHint":"미리보기에서 고칠 요소를 누르세요","files.pickedElement":"지정한 요소","files.requestElementEdit":"이 요소 수정 요청","files.clearPick":"지정 해제","files.pickLocatorElement":"요소: {selector}","files.pickLocatorText":"텍스트: \\"{text}\\"","files.pickLocatorPosition":"화면 위치: x={x}, y={y}, 폭 {w}, 높이 {h} (미리보기 {vw}\xd7{vh} 기준)","i18n.fitToWidth":"너비에 맞춤","models.discoveryFetching":"모델 가져오는 중…","models.discoveryFetch":"모델 가져오기…","models.discoveryFilterPlaceholder":"{count}개 모델 필터…","models.discoveryFilter":"업스트림 모델 필터","models.discoverySelectShown":"표시된 항목 선택","models.discoveryNoMatches":"일치하는 모델이 없습니다.","models.discoveryAdded":"추가됨","models.discoveryShowing":"전체 {total}개 중 처음 {shown}개 표시","models.discoveryFetched":"{count}개 모델을 가져왔습니다","models.discoveryAddSelected":"선택 항목 추가","models.discoveryAddSelectedCount":"선택 항목 추가 ({count})","models.catalogSource":"출처: models.dev ↗","models.catalogFilling":"세부 정보 채우는 중…","models.catalogFill":"모델 세부 정보 채우기","models.catalogFilled":"{count}개 필드가 채워졌습니다","models.catalogNoEmptyFields":"채울 빈 필드가 없습니다","models.catalogNoExactMatch":"models.dev에서 정확히 일치하는 항목 없음","models.catalogPriceProvider":"Provider {provider}와 가격 일치","models.catalogPriceBaseUrl":"Base URL이 {provider}와 가격 일치","models.catalogPriceConsensus":"{total}개 중 {support}개 레코드에서 가격 일치","models.catalogPriceUnreliable":"신뢰할 수 있는 가격을 찾지 못했습니다","models.catalogUndo":"실행 취소","models.navGroupRoles":"역할 배정","models.navGroupAccounts":"연결된 계정","models.navGroupCustom":"직접 추가한 제공자","models.backToList":"목록으로","i18n.testingModel":"모델 연결 테스트 중...","i18n.connected":"연결됨","i18n.failed":"실패","i18n.test":"테스트","i18n.testConnection":"모델 연결 테스트","i18n.provider":"제공자","i18n.model":"모델","i18n.providerName":"Provider 이름","i18n.rename":"이름 변경","i18n.default":"기본값","i18n.disabled":"비활성화됨","i18n.noResources":"리소스 없음","i18n.unknown":"알 수 없음","i18n.installedVersion":"설치됨 {version}","i18n.configuredVersion":"설정됨 {version}","i18n.extensions":"확장","i18n.prompts":"프롬프트","i18n.themes":"테마","i18n.resourceCount":"{count} {label}","i18n.extensionShort":"확장","i18n.skillShort":"Skill","i18n.promptShort":"프롬프트","i18n.themeShort":"테마","i18n.custom":"사용자 지정","i18n.clearAll":"모두 지우기","i18n.connectedSuccessfully":"연결에 성공했습니다.","i18n.notConnected":"연결 안 됨","i18n.configured":"설정됨","i18n.notConfigured":"설정 안 됨","i18n.openingBrowser":"브라우저를 여는 중…","i18n.submit":"제출","i18n.login":"로그인","i18n.relogin":"다시 로그인","i18n.deviceLogin":"기기 코드로 로그인","i18n.deviceLoginGuide":"아래 주소를 열어 로그인한 뒤 이 코드를 입력하세요. 이 서버의 localhost로 돌아올 필요가 없어서 원격 서버에서도 됩니다.","i18n.disconnect":"연결 해제","i18n.networkError":"네트워크 오류","i18n.continuing":"계속 진행 중…","i18n.skills":"Skill","i18n.plugins":"Plugin","i18n.addSkill":"Skill 추가","i18n.addPlugin":"Plugin 추가","i18n.selectSkill":"Skill 선택","i18n.selectPackage":"패키지 선택","i18n.updateAvailable":"업데이트 있음","i18n.upToDate":"최신 상태","i18n.automaticChecksUnavailable":"자동 확인 불가","i18n.checkFailed":"확인 실패","i18n.installed":"설치됨","i18n.status":"상태","i18n.version":"버전","i18n.package":"패키지","i18n.resources":"리소스","i18n.installedPath":"설치 경로","i18n.cwd":"CWD","i18n.resolvedResources":"확인된 리소스","i18n.reloadSession":"세션 다시 불러오기","i18n.reloadSessionHint":"열린 세션의 설정과 스킬을 다시 불러옵니다. Plugin은 해제되지 않으니, 해제하려면 CUELO를 재시작하세요.","i18n.reloading":"다시 불러오는 중...","i18n.packageRemoved":"패키지가 제거되었습니다.","i18n.packageInstalled":"패키지가 설치되었습니다.","i18n.packageUpdated":"패키지가 업데이트되었습니다.","i18n.packageDisabled":"패키지가 비활성화되었습니다.","i18n.packageDisabledRestartRequired":"비활성화 설정을 저장했습니다. 이미 불러온 Plugin은 CUELO를 재시작해야 멈춥니다. 세션 다시 불러오기로는 해제되지 않습니다.","i18n.packageEnabled":"패키지가 활성화되었습니다.","i18n.sessionReloaded":"세션을 다시 불러왔습니다.","i18n.thinking":"사고 과정","i18n.loadingThinking":"사고 과정 불러오는 중...","i18n.copyMessage":"메시지 복사","i18n.editFromHere":"여기서부터 편집","i18n.editFromHereTitle":"여기서부터 편집 — 이 세션 내에서 분기합니다","i18n.newSession":"새 세션","i18n.newSessionTitle":"새 세션 — 여기서부터 독립된 복사본을 만듭니다","i18n.estimatedTokens":"스트리밍 중 예상 Token 수","i18n.messageUsage":"사용량","i18n.messageUsageTitle":"이 메시지의 Token\xb7비용 보기","i18n.providerAnthropicSubscription":"Anthropic 구독","i18n.providerAnthropicApi":"Anthropic API","i18n.noOutput":"(출력 없음)","i18n.noSummary":"(요약 없음)","i18n.conversationCompacted":"대화가 압축됨","i18n.compactionDescription":"이 지점 이전의 대화 기록이 다음 요약으로 압축되었습니다:","i18n.fileContext":"파일 컨텍스트: {details}","i18n.readFiles":"읽은 파일","i18n.modifiedFiles":"수정된 파일","i18n.hiddenExtensionMessage":"숨겨진 확장 메시지","i18n.noMessage":"(메시지 없음)","i18n.showOriginalReply":"영어 원문 보기","i18n.hideOriginalReply":"영어 원문 접기","i18n.showInputTranslation":"영어 통역 보기","i18n.hideInputTranslation":"영어 통역 접기","i18n.showExtensionMessage":"확장 메시지 표시","i18n.collapse":"접기","i18n.expand":"펼치기","i18n.hideDetails":"세부 정보 숨기기","i18n.showDetails":"세부 정보 표시","i18n.thinkingUnavailable":"사고 내용을 사용할 수 없음","i18n.before":"이전","i18n.after":"이후","i18n.largeMessageReveal":"메시지 내용이 매우 큽니다 ({size}). 클릭하면 일반 텍스트로 표시합니다 — 페이지 반응성을 유지하기 위해 마크다운 렌더링은 비활성화됩니다.","i18n.sessionComplete":"세션 완료","i18n.taskFinished":"작업이 완료되었습니다.","i18n.attentionNeeded":"확인이 필요합니다","i18n.extensionInputNeeded":"확장이 입력을 기다립니다.","navigator.toolbar":"탐색 보기","navigator.priority":"우선순위","navigator.view":"{label} 보기","gpt6.boundBadge":"6PRO {handle}","gpt6.boundBadgeHint":"이 세션은 6 Pro 연결번호 {handle}에 묶여 있습니다.","usage.none":"사용량 —","usage.open":"사용량 자세히 보기: {rows}","usage.openMore":", 그 외 {count}개","usage.showMore":"나머지 {count}개 보기","usage.showLess":"접기","usage.accountBlocked":"자동 차단","usage.accountSpent":"계정 한도 소진","usage.limitSpent":"한도 소진","usage.bai":"B.AI 누적토큰","usage.baiEmpty":"기록 없음","usage.baiRange":"집계 {from}~{to}","usage.baiUnmeasured":"미측정","usage.title":"사용량","usage.reorder":"순서 편집","usage.reorderDone":"완료","usage.reorderGroup":"계정 표시 순서","usage.moveUp":"{account} 위로","usage.moveDown":"{account} 아래로","usage.moved":"{account}: {position}번째로 이동","usage.authExpired":"인증 만료","usage.authUnavailable":"사용 불가","usage.relogin":"재로그인","usage.reloginFor":"{account} 계정 재로그인","usage.authIssues":"계정 오류 {count}","relogin.title":"재로그인 대상","relogin.guide":"「{action}」을 누른 뒤 브라우저에서 이 계정으로 로그인하세요. 다른 계정으로 로그인하면 이 계정의 오류는 그대로 남습니다.","relogin.done":"로그인을 마쳤습니다.","relogin.checking":"{account} 상태를 확인하려고 사용량을 다시 읽는 중…","relogin.recovered":"{account} 계정 인증이 복구됐습니다.","relogin.stillFailing":"로그인은 끝났지만 {account} 계정은 아직 인증 오류입니다. 다른 계정으로 로그인했을 수 있습니다.","relogin.unknown":"사용량에서 {account} 계정을 찾지 못해 복구 여부를 확인하지 못했습니다.","efficiency.title":"효율","efficiency.governor":"실행 통제","efficiency.lab":"구성 비교","efficiency.refresh":"새로고침","efficiency.refreshing":"불러오는 중…","efficiency.noSession":"세션을 선택하면 실행 기록을 볼 수 있습니다.","efficiency.loadingRuns":"실행 목록을 불러오는 중…","efficiency.runsEmpty":"이 세션에 기록된 실행이 없습니다.","efficiency.runsError":"실행 목록을 불러오지 못했습니다.","efficiency.selectRun":"실행을 고르면 역할\xb7병목\xb7미측정 공백을 볼 수 있습니다.","efficiency.loadingDetail":"실행 상세를 불러오는 중…","efficiency.detailError":"실행 상세를 불러오지 못했습니다.","efficiency.noTitle":"제목 없는 요청","efficiency.elapsed":"경과","efficiency.busyTotal":"생성시간 합","efficiency.noSumNote":"경과와 생성시간 합은 나란히만 두고 더하지 않습니다.","efficiency.summarySection":"요약","efficiency.rolesSection":"역할","efficiency.rolesEmpty":"이 실행에서 요청을 처리한 역할이 없습니다.","efficiency.bottlenecksSection":"병목","efficiency.bottlenecksEmpty":"측정된 병목이 없습니다.","efficiency.toolsSection":"도구 호출","efficiency.unmeasuredGap":"원인 미측정 공백","efficiency.elapsedValue":"경과 {value}","efficiency.estimatedCostValue":"추정 {value}","efficiency.estimatedCost":"추정 비용","efficiency.untimedLowerBound":"소요시간이 기록되지 않은 요청 {value}건 — 생성시간은 하한입니다.","efficiency.bottleneckOrderNote":"관측된 크기가 큰 순서입니다. 막대는 1위 대비 길이이며 경과시간 대비가 아닙니다.","efficiency.untimedRuns":"소요시간 미기록 run","efficiency.untimedMedianLowerBound":"소요시간이 기록되지 않은 요청이 있는 run {value}건 — 생성시간 중앙값은 하한입니다.","efficiency.unpricedLowerBound":"가격 미기록 포함 — 하한","efficiency.mixedPairingNote":"혼합 구성: 요청별 모델\xb7추론 강도 조합과 순서는 확인되지 않았습니다. 같은 조건의 실행으로 단정할 수 없습니다.","efficiency.unmeasuredShort":"미측정","efficiency.effortLabel":"effort {value}","efficiency.requestsValue":"요청 {value}회","efficiency.toolCallsValue":"도구 호출 {value}회","efficiency.busyTime":"생성시간","efficiency.tokens":"토큰","efficiency.unpricedRequests":"가격 미기록 요청","efficiency.firstTokenAvg":"첫 응답 대기(평균)","efficiency.firstTokenPartial":"첫 응답 대기는 기록된 요청 {recorded}/{total}건의 평균입니다.","efficiency.outputTokens":"대화 출력 토큰","efficiency.helpersTitle":"보조 모델 호출","efficiency.helperCallsValue":"{count}회 \xb7 출력 {output} \xb7 합계 {tokens} \xb7 {cost}","efficiency.helpersIncludedNote":"보조 호출의 토큰\xb7비용은 위 토큰\xb7추정 비용 합계에 들어 있고, 요청 수\xb7첫 응답 대기\xb7대화 출력 토큰에서는 빠집니다.","efficiency.toolFailedValue":"실패 {value}","efficiency.toolNoMatchValue":"무일치 {value}","efficiency.toolCancelledValue":"중단 {value}","efficiency.unmeasuredGapValue":"원인 미측정 공백 {value}","efficiency.roleMain":"Main","efficiency.roleMaker":"Maker","efficiency.roleChecker":"Checker","efficiency.roleAdvisor":"Advisor","efficiency.roleUnattributed":"미배정","efficiency.purposePrimary":"Primary","efficiency.purposeRework":"Rework","efficiency.purposeReview":"Review","efficiency.outcomeCompleted":"완료","efficiency.outcomeError":"오류","efficiency.outcomeAborted":"중단됨","efficiency.outcomeInterrupted":"요청으로 끊김","efficiency.outcomeRunning":"실행 중","efficiency.folder":"폴더","efficiency.folderAll":"전체 폴더","efficiency.folderPlaceholder":"폴더로 걸러보기, Enter로 적용","efficiency.loadingExperiments":"구성 비교를 불러오는 중…","efficiency.experimentsEmpty":"비교할 구성이 기록되지 않았습니다.","efficiency.experimentsError":"구성 비교를 불러오지 못했습니다.","efficiency.difficultyNote":"작업 난이도는 보정되지 않음","efficiency.runsValue":"실행 {value}회","efficiency.medianElapsed":"경과 중앙값","efficiency.medianBusy":"생성시간 중앙값","efficiency.medianTokens":"토큰 중앙값","efficiency.medianEstimatedCost":"추정 비용 중앙값","efficiency.totalEstimatedCost":"추정 비용 합","efficiency.reworkRate":"재작업률","efficiency.errorRate":"오류율","efficiency.unpricedRuns":"가격 미기록 run","efficiency.scopeAttributed":"현재 역할 체계만","efficiency.scopeAll":"전체 기록","efficiency.scopeSessions":"집계 세션","efficiency.scopeRuns":"집계 run","efficiency.scopeExcludedRuns":"제외된 run","efficiency.harness":"하네스","efficiency.harnessValue":"하네스 {value}","efficiency.harnessUnknown":"unknown","efficiency.harnessAll":"모든 하네스","efficiency.groupByHarness":"하네스별로 나누기","efficiency.harnessNote":"하네스는 run 시작 시점에 설치돼 있던 CUELO 버전입니다. 이 PC의 업데이트 기록으로만 정하며, 기록이 없거나 기록 밖에서 바뀐 구간은 unknown입니다.","efficiency.sawSection":"모델이 본 것","efficiency.sawApproxNote":"세션 기록으로 다시 맞춘 근사치입니다. 요청마다 보낸 시스템 프롬프트와 컨텍스트 훅이 바꾼 내용은 기록에 남지 않습니다.","efficiency.sawOpen":"요청별로 보기","efficiency.sawLoading":"요청 기록을 읽는 중…","efficiency.sawError":"요청 기록을 읽지 못했습니다.","efficiency.sawEmpty":"이 run에는 모델 요청 기록이 없습니다.","efficiency.sawFilterEmpty":"주입이 있는 요청이 없습니다.","efficiency.sawRole":"대화 기록","efficiency.sawSummary":"요청 {turns}회 \xb7 주입 {injections}건 \xb7 도구 {tools}회 \xb7 실패 {failed}건","efficiency.sawOnlyInjected":"주입 있는 요청만","efficiency.sawTurnLabel":"요청 {index}","efficiency.sawBefore":"이 요청 전에 들어온 것","efficiency.sawTrailing":"마지막 요청 뒤에 들어온 것 (이 run의 모델 요청에는 들어가지 않음)","efficiency.sawShowFull":"전체 보기","efficiency.sawShowArgs":"인자 보기","efficiency.sawShowResult":"결과 보기","efficiency.sawHideFull":"접기","efficiency.sawTruncated":"앞 {value}자만 보입니다.","efficiency.sawMore":"{value}개 더 보기","efficiency.sawShown":"{total}개 중 {shown}개 표시","efficiency.sawHiddenFromChat":"채팅에는 안 보임","efficiency.sawNotSent":"모델에 안 보냄","efficiency.sawSecretsMasked":"비밀값처럼 보이는 문자열은 [REDACTED]로 가렸습니다.","efficiency.sawKindInjection":"주입","efficiency.sawKindDeveloper":"개발자 메시지","efficiency.sawKindUser":"사용자 메시지","efficiency.sawKindCompaction":"압축","efficiency.sawKindModel":"모델 변경","efficiency.sawKindEffort":"effort 변경","efficiency.sawKindPrompt":"시스템 프롬프트 바뀜","efficiency.sawKindRules":"규칙 주입","efficiency.sawKindMemory":"기억 회상","efficiency.sawCompactionValue":"{before} → {after} 토큰","efficiency.sawMemoryIds":"기억 {value}건 회상 (본문은 기록되지 않음)","efficiency.sawToolOk":"성공","efficiency.sawToolFailed":"실패","efficiency.sawToolNoMatch":"일치 없음","efficiency.sawToolCancelled":"중단","efficiency.sawToolMissing":"결과 없음","efficiency.sawResultChars":"결과 {value}자","efficiency.sawUsage":"입력 {input} \xb7 출력 {output} \xb7 캐시 읽기 {cacheRead}","efficiency.sawStop":"종료: {value}","efficiency.sawToolsChanged":"도구 목록 변경: +{added} −{removed}","efficiency.sawPreludeTitle":"시스템 프롬프트와 도구","efficiency.sawPreludeRecorded":"기록된 것","efficiency.sawPreludeTools":"마지막 요청에 켜진 도구 {value}개 (기록됨)","efficiency.sawPreludeDigest":"시스템 프롬프트 지문: {value}","efficiency.sawPreludeDigestNone":"이 run 시점의 시스템 프롬프트 지문이 기록에 없습니다.","efficiency.sawPreludeMemory":"기억 회상 블록 (시스템 프롬프트의 일부, 기록됨)","efficiency.sawPreludeReconstruct":"지금 설정으로 다시 만들기","efficiency.sawPreludeLoading":"다시 만드는 중…","efficiency.sawPreludeApprox":"지금 설정으로 다시 만든 것이며 보낸 그대로가 아닙니다.","efficiency.sawPreludeNotLoaded":"이 세션이 지금 열려 있지 않아 다시 만들 수 없습니다. 시스템 프롬프트 본문은 기록되지 않습니다.","efficiency.sawPreludeMatch":"지금 프롬프트의 지문이 이 run의 기록과 같습니다.","efficiency.sawPreludeMismatch":"지금 프롬프트의 지문이 이 run의 기록과 다릅니다. 그사이 바뀌었을 수 있습니다.","toolRun.running":"실행 중","toolRun.failed":"실패","toolRun.exitCode":"exit {code}","toolRun.diffStats":"{added}줄 추가, {removed}줄 삭제","toolRun.askTimedOut":"시간 안에 답이 없어 입력된 값이 제출되었습니다.","panel.expand":"패널 넓게 보기","panel.restore":"원래 크기로","panel.more":"더 보기","panel.liveSync":"실시간 반영","panel.subagentsCount":"기록 {count}건","panel.refresh":"기록 새로고침","panel.close":"패널 닫기","pluginLab.counts":"플러그인 {count}개","pluginLab.refresh":"목록 새로고침","pluginLab.create":"새 플러그인 만들기","pluginLab.createHint":"요청을 입력창에 넣습니다. 다듬어서 보내세요.","pluginLab.starter":"plugin-lab 스킬로 내 프로필에 쓸 플러그인을 하나 만들어 줘.\\n- 하려는 일: \\n- 필요한 도구: \\n- 패널에 보여 줄 내용(없으면 비워 둠): \\n저장소 정식 폴더에 바로 만들고 이번 턴에 리뷰, 버전, CI, 배포까지 끝내 줘.","pluginLab.loading":"플러그인 목록을 불러오는 중…","pluginLab.loadFailed":"플러그인 목록을 불러오지 못했습니다: {error}","pluginLab.retry":"다시 불러오기","pluginLab.empty":"아직 플러그인이 없습니다. 「새 플러그인 만들기」로 요청을 입력창에 넣어 보세요.","pluginLab.listLabel":"플러그인 목록","pluginLab.on":"켜짐","pluginLab.off":"꺼짐","pluginLab.toggleLabel":"{name} 사용","pluginLab.toggleFailed":"상태를 바꾸지 못했습니다: {error}","pluginLab.tools":"도구","pluginLab.enhancements":"보강 이력","pluginLab.enhancementDateHint":"기록 시각","pluginLab.showAllEnhancements":"전체 {count}개 보기","pluginLab.showFewerEnhancements":"접기","pluginLab.problem":"문제","pluginLab.openPanel":"패널 열기","pluginLab.openPanelLabel":"{name} 패널 열기","pluginLab.back":"플러그인 목록으로","pluginLab.panelSubtitle":"격리 실행 \xb7 lab:{id}","pluginLab.frameTitle":"{name} 패널","pluginLab.lines":"에이전트 데이터 {count}줄","pluginLab.noLines":"이 세션에서 받은 에이전트 데이터 없음","pluginLab.draftInserted":"패널이 만든 초안을 입력창에 넣었습니다. 확인하고 보내세요.","pluginLab.applyHint":"도구 변경은 새 세션이나 /reload 뒤에 적용됩니다.","pluginLab.noComposer":"대화를 열어야 입력창에 넣을 수 있습니다.","pluginLab.draftNotRecorded":"초안은 입력창에 넣었지만 사용 기록은 남기지 못했습니다.","pluginLab.saving":"바꾸는 중…","makerDetail.region":"{title} 기록","makerDetail.noFiles":"이 Maker는 파일을 바꾸지 않았습니다","makerDetail.noChecks":"검사 실행 없음","makerDetail.archiveUnobserved":"기록에 도구 결과가 없어 확인할 수 없습니다","makerDetail.unavailable":"이 시도와 정확히 맞는 실행 기록이 없어 상세를 열 수 없습니다","makerDetail.checkPassed":"통과","makerDetail.checkUnverified":"판정 미확인","makerDetail.checkFailed":"실패","makerDetail.checkUnobserved":"결과 미관측","dispatchLane.label":"Maker 시도","dispatchLane.runPhase":"{run}({phase})","dispatchLane.checks":"검사 {passed}/{total}","dispatchLane.checksUnobserved":"검사 미관측","dispatchLane.checksLoading":"검사 읽는 중","dispatchLane.attempt":"시도 {attempt}","dispatchLane.attemptUnknown":"시도","dispatchLane.verdict.accepted":"수용","dispatchLane.verdict.rework":"재작업","dispatchLane.verdict.held":"보류","dispatchLane.open":"자세히","dispatchLane.openLabel":"{title} 자세히 보기","dispatchLane.unavailable":"상세 없음","credits.heading":"API 크레딧","credits.estimateNote":"결제 화면 잔액은 표시된 시각에 직접 확인해 적어 둔 값이라 이후 사용량은 빠져 있습니다. 추정 사용량과 추정 잔액은 이 PC의 토큰 수에 공개 단가를 곱한 어림값이며 청구서 금액이 아닙니다.","credits.loading":"API 크레딧 불러오는 중…","credits.loadFailed":"API 크레딧을 불러오지 못했습니다: {reason}","credits.wallet.hive":"Hive","credits.scope.hive":"이 PC 기록","credits.since":"{date}부터","credits.sinceDefault":"최근 30일","credits.total":"총액","credits.spent":"추정 사용","credits.remaining":"추정 잔액","credits.meterLabel":"{wallet} 크레딧 사용","credits.usedPct":"사용 {pct}%","credits.enterPrompt":"총액과 시작일을 넣으면 추정 잔액을 계산합니다.","credits.enter":"크레딧 입력","credits.edit":"수정","credits.formLabel":"{wallet} 크레딧","credits.totalUsd":"총액(USD)","credits.startDate":"시작일","credits.save":"저장","credits.saving":"저장 중…","credits.cancel":"취소","credits.clear":"지우기","credits.saveFailed":"저장하지 못했습니다: {reason}","credits.invalid.total":"총액을 숫자로 넣어 주세요.","credits.error.invalid_total":"총액은 0보다 큰 숫자여야 합니다","credits.error.invalid_start_date":"시작일을 확인하세요","credits.error.start_date_in_future":"시작일이 미래입니다","credits.error.session_scan_failed":"세션 기록을 읽지 못했습니다","credits.error.session_scan_partial":"일부 세션 기록을 읽지 못해 추정 사용이 실제보다 적을 수 있습니다","credits.error.internal":"예상하지 못한 오류가 났습니다","credits.error.settings_unreadable":"크레딧 설정 파일을 읽지 못해 덮어쓰지 않았습니다","credits.walletError":"사용량을 읽지 못했습니다: {reason}","credits.settingsError":"크레딧 설정 파일을 읽지 못했습니다. 다시 입력해 주세요.","credits.tokens":"입력 {input} \xb7 출력 {output}","credits.cacheTokens":"캐시 {cache}","credits.requests":"{count}회","credits.priceUnknown":"단가 미상","credits.purpose.session":"대화\xb7에이전트","credits.purpose.memory":"기억","credits.purpose.korean-reply-translation":"답변 번역","credits.wallet.anthropic":"Anthropic API","credits.billingLink":"실제 잔액 보기","credits.billingLinkLabel":"{wallet} 결제 화면에서 실제 잔액 보기(새 탭)","credits.scope.anthropic":"이 PC 기록","credits.anthropic.note":"토큰이 기록된 API 키 요청만 집계하며 구독(OAuth) 요청과 토큰 없는 실패는 제외합니다. 금액은 공개 단가 기준 추정치이며 청구서나 잔액이 아닙니다.","credits.anthropic.noCoverage":"이 기간에 인증 방식이 기록된 요청이 없어 API 키 사용량을 알 수 없습니다.","credits.anthropic.coverageSince":"인증 방식 최초 기록: {date} (이후 모든 요청의 기록을 보장하지는 않습니다)","credits.anthropic.none":"이 기간에 기록된 API 키 요청이 없습니다.","credits.anthropic.oauthExcluded":"구독(OAuth) 제외","credits.anthropic.unattributedExcluded":"인증 미기록 제외","credits.category.input":"입력","credits.category.output":"출력","credits.category.cacheRead":"캐시 읽기","credits.category.cacheWrite":"캐시 쓰기","credits.balance.label":"결제 화면 잔액","credits.balance.source":"직접 기록","credits.balance.observed":"{time} 확인","credits.balance.age.now":"방금","credits.balance.age.minutes":"{count}분 전","credits.balance.age.hours":"{count}시간 전","credits.balance.age.days":"{count}일 전","credits.balance.none":"기록된 잔액 없음","credits.balance.record":"잔액 기록","credits.balance.edit":"잔액 변경","credits.balance.formLabel":"{wallet} 결제 화면 잔액","credits.balance.amount":"잔액(USD)","credits.balance.observedAt":"확인 시각","credits.balance.observedAtHint":"제공자 결제 화면에서 잔액을 확인한 시각입니다.","credits.invalid.amount":"잔액을 숫자로 넣어 주세요.","credits.invalid.observedAt":"확인 시각을 넣어 주세요.","credits.error.invalid_balance":"잔액은 0 이상의 숫자여야 합니다","credits.error.invalid_observed_at":"확인 시각을 확인하세요","credits.error.observed_at_in_future":"확인 시각이 지금보다 늦습니다","credits.error.routes_unreadable":"설정 파일을 읽지 못해 사용 중인 API를 확인할 수 없습니다","credits.wallet.exa":"Exa","credits.wallet.typesafe":"TypeSafe Jev","credits.route.hive":"모델 역할(기억\xb7skim 등)에 배정됨","credits.route.exa":"기본 웹 검색 경로","credits.route.typesafe":"기본 빠른 판정(Jev) 경로","credits.route.anthropic":"구독 주간 한도를 다 쓰면 쓰는 API 키 대체 경로","credits.evidence.lastPaidUse":"이 PC 마지막 유료 사용: {time}","credits.evidence.unverified":"일부 세션 기록을 읽지 못해 최근 유료 사용을 확인하지 못했습니다.","routines.tab":"루틴","routines.title":"루틴 갤러리","routines.back":"대화로","routines.panelIntro":"정한 시각에 새 세션이 돌고, 마지막 답이 루틴 게시판에 글로 올라옵니다.","routines.galleryIntro":"루틴 하나가 갤러리 하나입니다. 글은 공용 저장소에서 읽어 와서 집과 클라우드에서 똑같이 보입니다.","routines.galleryList":"갤러리 목록","routines.new":"새 루틴","routines.col.gallery":"갤러리","routines.col.schedule":"일정","routines.col.host":"실행 PC","routines.col.posts":"글","routines.col.latest":"최근 글","routines.col.no":"번호","routines.col.title":"제목","routines.col.author":"글쓴이","routines.col.date":"작성일","routines.off":"꺼짐","routines.on":"켜짐","routines.turnOff":"끄기","routines.turnOn":"켜기","routines.toggledOff":"「{name}」 루틴을 껐습니다. 다른 PC는 다음 동기화(5분 안) 때 받습니다.","routines.toggledOn":"「{name}」 루틴을 켰습니다. 다른 PC는 다음 동기화(5분 안) 때 받습니다.","routines.hostNote":"이 루틴은 {host}에서 돕니다. 켜고 끈 것은 다른 PC에 다음 동기화(5분 안) 때 닿습니다.","routines.enabledCount":"켜진 루틴 {on}개 / 전체 {total}개","routines.filter.all":"전체 {count}","routines.filter.on":"켜짐 {count}","routines.filter.off":"꺼짐 {count}","routines.col.state":"상태","routines.col.next":"다음 실행","routines.col.toggle":"켜고 끄기","routines.nextRun":"다음 실행 {time}","routines.lastRun":"마지막 실행 {time}, {result}","routines.lastRun.ok":"글 올림","routines.lastRun.quiet":"알릴 것 없음","routines.lastRun.failed":"실패","routines.lastRun.timeout":"시간 초과","routines.noRunYet":"아직 실행 기록 없음","routines.newPosts":"새 글 {count}","routines.newMark":"N","routines.newMarkLabel":"새 글","routines.markAllRead":"전체 읽음 표시","routines.expandPost":"글 전체 보기","routines.details":"자세히 보기","routines.detailsHide":"자세히 접기","routines.deletedElsewhere":"이 루틴은 지워졌습니다. 다른 PC에서 지웠을 수 있습니다.","routines.networkError":"요청을 보내지 못했습니다: {error}","routines.koreaTime":"한국 시각","routines.sched.weekly":"{days} {times}","routines.sched.hourlyOne":"매시 {minute}분","routines.sched.hourlyN":"{every}시간마다 {minute}분 ({start}시 {minute}분부터)","routines.sched.withDays":"{days} {rest}","routines.sched.once":"{date} {time} 한 번","routines.running":"실행 중","routines.status.failed":"실패","routines.status.timeout":"시간 초과","routines.tabAll":"전체글 {count}","routines.tabFailed":"실패 {count}","routines.runNow":"지금 실행","routines.runHere":"이 PC에서 지금 실행","routines.runHereHint":"지금 실행은 이 PC({host})에서 돌아갑니다","routines.runStarted":"이 PC에서 실행을 시작했습니다. 끝나면 글이 올라옵니다.","routines.settings":"설정","routines.everyDay":"매일","routines.weekdays":"평일","routines.day.0":"일","routines.day.1":"월","routines.day.2":"화","routines.day.3":"수","routines.day.4":"목","routines.day.5":"금","routines.day.6":"토","routines.metaHost":"실행 PC {host}","routines.metaCwd":"폴더 {cwd}","routines.noPosts":"아직 올라온 글이 없습니다.","routines.noPostsNext":"첫 글은 다음 실행({time}) 뒤에 올라옵니다.","routines.noPostsOff":"꺼져 있어 예약 실행이 없습니다. 지금 실행으로 한 편 올릴 수 있습니다.","routines.noFailed":"실패한 글이 없습니다.","routines.empty":"아직 루틴이 없습니다.","routines.emptyHint":"루틴을 만들면 정한 요일과 시각에 새 세션이 돌고, 그 답이 루틴 게시판에 글로 올라옵니다.","routines.setupTitle":"루틴 저장소를 찾지 못했습니다","routines.setupMissing":"{dir} 폴더가 없습니다.","routines.setupNotGit":"{dir} 폴더가 git 저장소가 아닙니다.","routines.setupBody":"루틴과 글은 이 저장소에 쌓이고 집과 클라우드가 함께 씁니다. 비공개 저장소를 그 경로에 clone하거나, 다른 경로라면 CUELO_ROUTINES_DIR로 지정한 뒤 다시 읽으세요.","routines.reload":"다시 읽기","routines.sync.ok":"동기화 {time}","routines.sync.never":"아직 동기화하지 않음","routines.sync.syncing":"동기화 중","routines.sync.pending":"보낼 커밋 {count}개","routines.sync.nothing":"보낼 커밋 없음","routines.sync.error":"동기화 오류: {error}","routines.openSession":"세션 열기","routines.postAuthor":"글쓴이 {host}","routines.loadFailed":"불러오지 못했습니다: {error}","routines.postMissing":"글을 찾지 못했습니다.","routines.form.newTitle":"새 루틴","routines.form.editTitle":"루틴 설정","routines.form.name":"이름","routines.form.days":"요일","routines.form.time":"시각","routines.form.host":"실행 PC","routines.form.hostHint":"이 PC는 {host}입니다. 예약 실행은 여기 적은 PC에서만 돌아갑니다.","routines.form.model":"루틴 Main 모델","routines.form.modelPlaceholder":"PC 기본값 사용","routines.form.modelHint":"선택 사항입니다. provider/model-id 형식으로 덮어쓸 수 있으며, 실행 호스트에 존재하는 모델이어야 합니다. 플러그인이 비활성화되면 이 값은 무시됩니다.","routines.form.cwd":"프로젝트 폴더","routines.form.cwdPlaceholder":"비우면 루틴 저장소의 이 루틴 폴더에서 실행","routines.form.cwdHint":"실행 PC 기준 경로입니다. 그 PC에 없으면 그 회차는 실패 글로 남습니다.","routines.form.prompt":"지시문","routines.form.enabled":"사용","routines.form.enabledLabel":"예약대로 실행","routines.form.enabledHint":"끄면 예약만 멈추고 글은 그대로 남습니다.","routines.form.cancel":"취소","routines.form.save":"저장","routines.form.saving":"저장 중…","routines.form.deleteText":"루틴을 지우면 이 갤러리의 글 {count}개도 함께 지워집니다. git 기록에는 남습니다.","routines.form.delete":"루틴 삭제","routines.form.deleteConfirm":"「{name}」 루틴과 글 {count}개를 지웁니다. git 기록에는 남습니다. 지울까요?","routines.form.daysRequired":"요일을 하나 이상 고르세요.","routines.form.timesRequired":"시각을 하나 이상 넣으세요.","routines.form.schedule":"일정","routines.form.kind.weekly":"요일과 시각","routines.form.kind.hourly":"몇 시간마다","routines.form.kind.once":"한 번","routines.form.times":"시각","routines.form.newTime":"더할 시각","routines.form.addTime":"시각 추가","routines.form.removeTime":"{time} 빼기","routines.form.interval":"간격","routines.form.everyHours":"실행 간격","routines.form.everyHoursOption":"{n}시간마다","routines.form.minute":"분","routines.form.startHour":"시작 시","routines.form.hourlyDaysHint":"요일을 모두 고르면 매일 돕니다.","routines.form.when":"언제","routines.form.date":"날짜","routines.form.onceHint":"그 시각에 한 번 돌고 나면 저절로 꺼집니다.","routines.form.quietHint":"알릴 것이 없는 회차는 세션이 답을 [알림 없음]으로 시작하고, 글을 올리지 않습니다.","inspector.label":"인스펙터","inspector.views":"인스펙터 보기","inspector.more":"다른 보기","inspector.hide":"인스펙터 닫기","inspector.show":"인스펙터 열기","inspector.turn":"이번 턴","inspector.noTurn":"아직 턴이 없습니다.","inspector.backToChat":"대화로 돌아가기","workbench.places":"장소","workbench.runningCount":"실행 중 {count}","workbench.needsInput":"입력 필요","workbench.needsInputCount":"입력 필요 {count}","navigator.group.input":"입력 필요","navigator.group.running":"실행 중","navigator.group.done":"끝남"}'),a=["en","ko"],l=new Map;function o(e){if(!e.id.trim())throw Error("Locale id must not be empty");if(l.has(e.id))throw Error(`Locale already registered: ${e.id}`);l.set(e.id,e)}function c(){return[...l.keys()]}o({id:"en",label:"English",messages:{"resource.reset.use":"Use reset","resource.reset.unavailable":"Unavailable now","resource.reset.summary":"Reset to use: {name}","resource.reset.covers":"Limits to clear: {limits}","resource.reset.includedOverage":"Included overage","resource.reset.mismatch":"Requested reset: {requested}. Server consumed reset: {consumed}. Did not retry automatically.","resource.reset.rejection":"Failed to use reset: {code}. {reason}","resource.reset.name.full":"Full reset","resource.reset.name.fable":"Fable reset","resource.reset.name.fiveHour":"5-hour reset","resource.reset.name.generic":"Reset","resource.reset.window.fiveHour":"5h","resource.reset.window.weekly":"Weekly","resource.reset.chip.nextUse":"Next use","savedPrompts.title":"Saved prompts","savedPrompts.loading":"Loading...","savedPrompts.empty":"No saved prompts","savedPrompts.save":"Save current input as prompt","savedPrompts.saved":"Saved","savedPrompts.delete":"Delete","savedPrompts.confirmDelete":"Delete?","savedPrompts.cancel":"Cancel","savedPrompts.hint":"Type text then // to save. Variables: {{project_name}} {{session_name}} {{cwd}} {{date}}","savedPrompts.error":"Saved prompt request failed: {error}","cloudProjects.launch":"Open GitHub repository","cloudProjects.title":"Cloud project","cloudProjects.description":"Bring a GitHub repository to this server and keep working.","cloudProjects.github":"GitHub repositories","cloudProjects.serverFolder":"Open server folder","cloudProjects.account":"GitHub connection","cloudProjects.connectTitle":"Connect your GitHub repositories","cloudProjects.connectHelp":"Sign in to select private repositories from your list.","cloudProjects.connected":"Connected to GitHub","cloudProjects.refresh":"Check again","cloudProjects.waiting":"Waiting for sign-in","cloudProjects.connect":"Connect GitHub","cloudProjects.deviceHelp":"Enter this code on the GitHub sign-in page.","cloudProjects.copyCode":"Copy code","cloudProjects.copied":"Copied","cloudProjects.copyFailure":"Could not copy the code. Select and copy it manually.","cloudProjects.openLogin":"Sign in on GitHub","cloudProjects.permissionHelp":"Check the account and requested permissions on GitHub before approving. Tokens stay on the server.","cloudProjects.preparingCode":"Preparing your sign-in code.","cloudProjects.repositories":"Your repositories","cloudProjects.search":"Find a repository","cloudProjects.searchPlaceholder":"Search by name or description","cloudProjects.loading":"Loading repositories.","cloudProjects.private":"Private","cloudProjects.public":"Public","cloudProjects.empty":"No matching repositories. Try another name or enter a URL.","cloudProjects.more":"Show more","cloudProjects.urlLabel":"Selected repository or GitHub URL","cloudProjects.publicHelp":"Public repositories do not require sign-in. Existing workspaces are reopened without changing your files.","cloudProjects.error":"Could not complete the operation.","cloudProjects.openingHelp":"Importing the repository to this server. Large repositories may take a while.","cloudProjects.opening":"Opening project","cloudProjects.open":"Open project","common.ok":"OK","common.language":"Language","common.models":"Models","common.skills":"Skills","common.plugins":"Plugins","common.settings":"Settings","updates.available":"CUELO update available","updates.availableTitle":"CUELO {version} is available","updates.dialogEyebrow":"CUELO release","updates.dialogTitle":"New CUELO version","updates.current":"Running CUELO {version}","updates.changelog":"Changelog","updates.viewRelease":"View release","updates.manual":"Running from source? Stop the server first, run this update command, then start it again. If you use a custom --home path, pass the same --home option to setup.","updates.copyCommand":"Copy command","updates.commandCopied":"Command copied","updates.copyFailed":"Unable to copy the command","updates.apply":"Update now","updates.applyBusy":"Updating…","updates.applyConfirm":"Update CUELO to {version} and restart?\n\nThe server stops for a moment while it updates, and this panel shows the progress. The page reloads by itself when the new version answers.","updates.applyConfirmBusy":"Update CUELO to {version} and restart?\n\n{count} running session(s) will be interrupted and the server stops for a moment. This panel shows the progress, and the page reloads by itself when the new version answers.","updates.unsupported":"This installation cannot be updated from the app. Use the command below.","updates.unsupportedReason":"Detected: {reason}","updates.phase.starting":"Preparing the update","updates.phase.fetching":"Fetching the new version","updates.phase.installing":"Installing the package","updates.phase.building":"Building","updates.phase.restarting":"Restarting the server","updates.phase.done":"Update complete","updates.phase.handed-off":"Handed off to the service update","updates.phase.restart-required":"Installed. Restart CUELO yourself.","updates.phase.failed":"Update failed","updates.waitingForRestart":"Waiting for the server to come back. The page reloads when the new version answers.","updates.handedOff":"The WSL service update runs in its own wait screen. This page reloads when it finishes.","updates.logPath":"Log: {path}","updates.applyStartFailed":"Could not start the update: {reason}","sidebar.hide":"Hide sidebar","sidebar.show":"Show sidebar","theme.light":"Light mode (click for dark)","theme.dark":"Dark mode (click for system)","theme.auto":"System theme (click for light)","theme.graphite":"Graphite theme (wallpaper)","theme.graphiteHint":"Graphite surfaces with a wallpaper for the current character mode. Dark mode only, saved in this browser.","history.full":"Full history","history.unsaved":"Full history is available after the session is saved","history.label":"Full history","title.generating":"Generating...","title.updated":"Title updated","title.failed":"Generation failed","title.generate":"Generate title","title.unsaved":"Title generation is available after the session is saved","title.noMessages":"Send a message before naming this session","title.generateSession":"Generate a session title","system.prompt":"System prompt","system.empty":"System prompt is empty (tools are disabled)","system.load":"Send a message to load the system prompt","system.label":"System","session.info":"Session info","session.name":"Name","session.file":"File","session.inMemory":"In-memory","session.id":"ID","session.user":"User","session.assistant":"Assistant","session.toolCalls":"Tool Calls","session.toolResults":"Tool Results","session.total":"Total","session.input":"Input","session.output":"Output","session.cacheRead":"Cache Read","session.cacheWrite":"Cache Write","session.cost":"Cost","session.context":"Context","session.cacheHitRate":"Avg cache hit rate","session.copy":"Copy {value}","session.copied":"Copied","session.title":"Session info","session.load":"Send a message or run /session to load session info","session.infoSection":"Session Info","session.messages":"Messages","session.tokens":"Tokens","session.totalActive":"Active Time","session.copyFile":"Copy file path","session.copyId":"Copy session ID","workspace.opening":"Opening workspace...","workspace.unable":"Unable to open workspace","workspace.selectSession":"Select a session from the sidebar","workspace.getStarted":"Get Started","workspace.selectProject":"Select a project directory from the sidebar","workspace.addModels":"Add models via the Models button at the bottom","workspace.stepProject":"Select a project directory from the sidebar","workspace.stepModels":"Add models via the Models button at the bottom","workspace.mainWorking":"Working","workspace.mainWaiting":"Waiting","workspace.mainIdle":"Idle","workspace.mainAttention":"Input needed","files.hidePanel":"Hide file panel","files.showPanel":"Show file panel","files.noneOpen":"No file open","files.docs.noProject":"Select a project to see its documents.","files.docs.loading":"Looking for project documents…","files.docs.projectDenied":"This project folder is outside the folders CUELO may read.","files.docs.loadFailed":"Could not load project documents: {error}","files.docs.projectDir":"Project folder: {path}","files.docs.noneFound":"No HANDOFF.md up to the repository root, and no doc/README.md or doc/history in this folder.","files.docs.current":"Current state","files.docs.map":"Document map","files.docs.records":"Recent records","files.docs.missing":"{file} not found","files.docs.denied":"{file} is outside the readable folders","layout.resizeSidebar":"Resize sidebar","layout.resizeFilePanel":"Resize file panel","layout.resizeHint":"Drag to resize. Double-click or press Enter to reset.","sidebar.new":"New","sidebar.newSessionTitle":"New session in {path}","sidebar.refresh":"Refresh","sidebar.projects":"Projects","subagents.title":"Subagents","subagents.running":"Running","subagents.finished":"Finished","subagents.history":"History","subagents.runningCount":"{count} running","subagents.finishedCount":"{count} finished","subagents.failed":"Failed","subagents.aborted":"Aborted","subagents.back":"Back to subagents","subagents.retrying":"Retrying {attempt}/{max}","subagents.usingTool":"Using {tool}","subagents.details":"Subagent execution details","subagents.closeDetails":"Close subagent details","subagents.noTask":"No task description","subagents.tools":"{count} tools","subagents.tokens":"{count} tokens","subagents.loadingTranscript":"Loading live transcript…","subagents.noTranscript":"The subagent has not written any transcript messages yet.","subagents.transcriptUnavailable":"Live transcript is not available yet. Retrying while the subagent runs.","sidebar.searchProjectsAndSessions":"Search projects and session titles…","sidebar.addProject":"Add custom project path","sidebar.projectActions":"Project actions","sidebar.projectAlias":"Alias","sidebar.projectAliasEdit":"Edit alias","sidebar.projectHide":"Hide","sidebar.projectUnhide":"Unhide","sidebar.projectShowHidden":"Show hidden projects","sidebar.temporaryProjects":"Temporary / system paths","sidebar.projectMoveUp":"Move up","sidebar.projectMoveDown":"Move down","sidebar.projectMoveDisabledWhileFiltering":"Clear the search filter to reorder projects","sidebar.projectUpdateFailed":"Unable to save project changes. Try again.","sidebar.expandProject":"Expand project","sidebar.collapseProject":"Collapse project","sidebar.showMore":"Show more","sidebar.showLess":"Show less","sidebar.selectProject":"Select project…","sidebar.filterProjects":"Filter projects…","sidebar.noMatchingProjects":"No matching projects","sidebar.useDefaultDirectory":"Use default directory","sidebar.customPath":"Custom path…","directoryPicker.selectDirectory":"Select directory","directoryPicker.goToParent":"Go to parent directory","directoryPicker.directoryPath":"Directory path","directoryPicker.goToDirectory":"Go to directory","directoryPicker.go":"Go","directoryPicker.loadingDirectories":"Loading directories…","directoryPicker.noSubdirectories":"No subdirectories","directoryPicker.openBeforeSelecting":"Open this path before selecting it","directoryPicker.selectCurrentDirectory":"Select current directory","directoryPicker.selectThisFolder":"Select this folder","directoryPicker.noDrives":"No drives found","sidebar.checking":"Checking…","sidebar.open":"Open","sidebar.cancel":"Cancel","sidebar.openRepoRoot":"Open repo root","sidebar.openRepoRootTitle":"Open the repository root to manage worktrees.","sidebar.gitRepoRootOnly":"Git repo root only","sidebar.gitRepoRootOnlyTitle":"Worktrees are available in Git repository roots.","sidebar.worktrees":"Worktrees...","sidebar.checkingWorktrees":"Checking worktrees for this directory.","sidebar.filterWorktrees":"Filter worktrees…","sidebar.noMatchingWorktrees":"No matching worktrees","sidebar.switchWorktree":"Switch worktree","sidebar.switchWorktreeTitle":"Switch worktree: {path}","sidebar.main":"main","sidebar.forceRemoveCheckout":"Uncommitted changes. Force remove checkout?","sidebar.force":"Force","sidebar.createWorktreeTitle":"Create a worktree checkout for a branch","sidebar.newWorktree":"New worktree…","sidebar.branchName":"branch name","sidebar.creating":"Creating…","sidebar.create":"Create","sidebar.loading":"Loading...","sidebar.noSessions":"No sessions found","sidebar.agentRunning":"Agent running…","sidebar.newActivity":"New activity","sidebar.newSessionActivity":"New session activity","sidebar.deleteSession":"Delete {title}?","sidebar.rename":"Rename","sidebar.pin":"Pin to top","sidebar.unpin":"Unpin","sidebar.pinned":"Pinned","sidebar.delete":"Delete","sidebar.deleteWithShiftClick":"Delete (Shift+click to delete without confirmation)","sidebar.clearProjectSessions":"Clear sessions","sidebar.clearPriorityList":"Clear list","navigator.resultsToCheck":"To review","navigator.resultsToCheckCount":"To review {count}","navigator.resultsToCheckHint":"Finished conversations with new activity since you last opened them in this browser, and conversations waiting for your answer","navigator.resultsToCheckEmpty":"Nothing to review.","navigator.acknowledgeResults":"Mark all reviewed","navigator.acknowledgeResultsHint":"Marks every conversation now listed to review as seen. Conversations waiting for your answer stay.","sidebar.waitingForAnswer":"Needs answer","sidebar.waitingForAnswerHint":"Paused until you answer its question or approval request","sidebar.newScratchSession":"New session","sidebar.newScratchSessionTitle":"Start a session without a project (in a dated scratch folder under your home)","sidebar.newScratchSessionFailed":"Could not create the scratch folder: {error}","sidebar.clearSessionsTitle":"Confirm session deletion","sidebar.clearSessionsProjectBody":"Permanently delete {count} session(s) in {project}. This cannot be undone.","sidebar.clearSessionsPriorityBody":"Permanently delete {count} session(s) in the priority list. This cannot be undone.","sidebar.clearSessionsRunningExcluded":"{count} running session(s) will be kept.","sidebar.clearSessionsNone":"No session can be deleted right now.","sidebar.clearSessionsConfirm":"Delete","sidebar.clearSessionsCancel":"Cancel","sidebar.clearSessionsBusy":"Deleting…","sidebar.clearSessionsFailed":"Could not delete {count} session(s): {names}","sidebar.archive":"Archive (hide from list, restorable)","sidebar.archived":"Archived","sidebar.restore":"Restore","sidebar.noArchivedSessions":"No archived sessions","sidebar.expandForks":"Expand forks","sidebar.collapseForks":"Collapse forks","sidebar.messagesCount":"{count} msgs","sidebar.worktreePath":"Worktree: {path}","sidebar.removeWorktreeTitle":"Remove worktree checkout {path}; the branch is kept","files.deleted":"Deleted","files.insertPath":"Insert path into chat","files.mention":"mention","chat.loadingSession":"Loading session...","chat.runningTool":"Running tool...","chat.runningNamedTool":"Running {name}...","chat.runningTools":"Running {names}...","chat.runningToolsMore":"Running {names} (+{count})...","chat.waitingModel":"Waiting for model...","todo.progress":"{percent}% \xb7 {completed} of {total} done \xb7 {remaining} remaining","todo.progressDone":"{percent}% \xb7 {completed} of {total} done","todo.allDone":"All {count} done","todo.showCompleted":"Show {count} completed","todo.hideCompleted":"Hide {count} completed","todo.ready":"Ready","todo.waiting":"Waiting for: {tasks}","chat.runningCommand":"Running command...","chat.thinking":"Thinking...","chat.contextUsageTitle":"Context window: {used} of {limit} tokens ({percent})","chat.contextUsageWarning":"Context window is getting full","chat.contextUsageCritical":"Context window is nearly full","chat.processDetails":"Process details","chat.message":"message","chat.messages":"messages","chat.toolCall":"tool call","chat.toolCalls":"tool calls","chat.collapseProcess":"Collapse process details","chat.expandProcess":"Expand process details","process.empty":"No process activity in this session yet","process.turn":"turn","process.turns":"turns","chat.filesWritten":"Files changed","chat.openWrittenFile":"Open {name}","chat.lessonsSaved":"[Lessons saved] The agent stored these itself during this turn.","chat.savedLesson":"Lesson: {memory}","chat.savedSkill":"Skill {action}: {name}","chat.loadEarlier":"Scroll up to load earlier messages ({count} hidden)","chat.extensionRequest":"extension request","chat.responseSending":"Sending your answer...","chat.responseFailed":"Your answer did not reach the agent. It is still waiting - try again.","chat.cancel":"Cancel","chat.confirm":"Confirm","chat.submit":"Submit","chat.agentQuestion":"Agent needs your input","chat.agentQuestionHint":"Choose an option or provide a custom response.","chat.askAutoSelectHint":"If there is no response for {seconds}s, the recommended option is selected automatically. Choosing or typing restarts the wait.","chat.recommended":"Recommended","chat.customAnswer":"Other response (optional)","chat.chatAboutThis":"Chat about this","chat.submitAnswer":"Submit answer","chat.agentFormHint":"Fill in the form and submit it.","chat.askFormAutoSubmitHint":"If you do not respond in {seconds}s, the values currently in the form are submitted. Editing restarts the wait.","chat.formOther":"Other","chat.formOtherPlaceholder":"Type your own answer","chat.formRequired":"Required","chat.formInvalid":"Check the marked fields before you submit.","chat.formImageUnavailable":"Image could not be loaded","chat.formError.required":"Required","chat.formError.selectAtLeastOne":"Select at least one","chat.formError.enterNumber":"Enter a number","chat.formError.min":"Must be at least {value}","chat.formError.max":"Must be at most {value}","chat.formError.minLength":"Needs at least {value} characters","chat.formError.maxLength":"At most {value} characters","chat.formError.email":"Enter an email address","chat.formError.url":"Enter a full URL","chat.formError.pattern":"Must match {pattern}","chat.planApproval":"Plan approval","chat.planFeedback":"Feedback for another planning pass (optional)","chat.refinePlan":"Continue planning","chat.approvePlan":"Approve and implement","chat.extensionInput":"Extension terminal input","chat.extensionPanel":"Extension panel","chat.close":"Close","chat.queued":"Queued \xb7 {count}","chat.recall":"Recall to input","chat.recallTitle":"Remove all queued messages and put them back into the input box for editing","chat.queueRemove":"Cancel this queued message only","chat.retrying":"Retrying ({attempt}/{max})…","chat.recoveredError":"This attempt failed and was retried automatically.","chat.recoveredErrorDetail":"Show error","chat.loadingCommands":"Loading commands...","chat.slashCommands":"Slash commands \xb7 {label}","chat.tabEnter":"Tab / Enter","chat.noCommands":"No commands found","chat.match":"1 match","chat.matches":"{count} matches","chat.command":"1 command","chat.commands":"{count} commands","chat.loadingFiles":"Loading files...","chat.files":"Files \xb7 {label}{hint}","chat.searching":"Searching…","chat.noMatchingFiles":"No matching files","chat.searchingAll":" \xb7 searching all files…","chat.indexTruncated":" \xb7 index truncated","chat.steerPlaceholder":"Steer now / queue follow-up...","chat.agentPlaceholder":"Agent is running…","chat.messagePlaceholder":"Message… / commands \xb7 @ files","chat.steer":"Steer","chat.followUp":"Follow-up","chat.send":"Send","chat.attachImageLimit":"A message can include at most {count} images.","chat.attachImageTooLarge":"{name} exceeds the {limit} per-image limit.","chat.attachFile":"Attach files","chat.emptyProjectLabel":"Project folder","chat.emptyProjectHint":"Your first message starts a new session in this folder.","chat.openSessionList":"Open session list","chat.attachments":"Attachments","chat.removeImage":"Remove image {index}","chat.removeAttachment":"Remove {name}","chat.attachExtracting":"Extracting text","chat.attachExtractingWait":"Wait for the attachments to finish processing","chat.attachLimit":"A message can include at most {count} non-image attachments.","chat.attachTooLarge":"{name} exceeds the {limit} per-document limit.","chat.attachTotalTooLarge":"Attached documents exceed the {limit} combined size limit.","chat.attachTextTooLarge":"{name} exceeds the {limit}-character extracted text limit.","chat.attachTooManyPages":"{name} exceeds the {limit}-page PDF limit.","chat.attachNoPdfText":"{name} has no extractable text. Scanned or image-only PDFs require OCR, which is not supported.","chat.attachPasswordProtected":"{name} is password-protected and cannot be extracted.","chat.attachExtractFailed":"Could not extract text from {name}.","chat.attachKindAudio":"Audio","chat.attachKindFile":"File","chat.attachUploading":"Saving","chat.attachTranscribing":"Transcribing","chat.attachTranscribeFailed":"Transcription failed","chat.attachStoredTooLarge":"{name} exceeds the {limit} per-file limit.","chat.attachUploadFailed":"Could not save {name}: {error}","chat.attachTranscribePending":"Needs your choice","chat.transcribeGroup":"Audio transcription","chat.transcribeChecking":"Checking length","chat.transcribeConfirmTitle":"Transcribe {name}?","chat.transcribePlanSummary":"{duration} \xb7 transcription calls: about {calls}","chat.transcribeDurationUnknown":"Length unknown","chat.transcribeUsageNotice":"Transcription counts toward the connected account's usage. Nothing is sent until you start.","chat.transcribeStart":"Start transcription","chat.transcribeSkip":"Don't transcribe","chat.transcribeCancel":"Cancel transcription","chat.transcribeRunning":"Transcribing {name}","chat.transcribeRetry":"Try again","chat.transcribeAction":"Transcribe","chat.transcribeSkipped":"{name} has no transcript; only the saved file path is sent.","chat.transcribeFailedRow":"{name}: transcription failed. {error}","chat.transcribeToolMissing":"The audio tool (ffmpeg) is not available, so this audio cannot be prepared for transcription.","chat.transcribePartialFailed":"Stopped after {done} of {total} parts; no partial transcript is attached.","chat.transcribeTooLong":"The transcript does not fit beside the other attachments.","chat.transcribeFallbackTitle":"Primary transcription failed for {name}. Continue with ChatGPT/Codex?","chat.transcribeFallbackProgress":"{done} of {total} parts already have a transcript, which stays; continuing sends only the failed part and the rest.","chat.transcribeFallbackUsageNotice":"ChatGPT/Codex is a separate provider; its transcription counts toward the signed-in account's usage. CUELO sends nothing until you continue.","chat.transcribeFallbackStart":"Continue with ChatGPT/Codex","chat.transcribeFallbackExpired":"This fallback choice expired or you already used it. CUELO sent nothing; try again to start over.","chat.attachmentSettingsNav":"Attachments","chat.attachmentSettingsTitle":"Attachments","chat.attachmentSettingsDescription":"Files you attach in chat are saved on this computer so the agent can open them.","chat.attachmentSettingsLoadFailed":"Could not load attachment settings","chat.attachmentUploadLimit":"Upload limit per file (MB)","chat.attachmentUploadLimitHelp":"Larger files are refused before they are sent. Text read straight into the message keeps its own limits: 8 MB per document and 240,000 characters in total.","chat.attachmentUploadLimitInvalid":"Enter a whole number of MB, 1 or more.","chat.attachmentAutoCleanup":"Delete unused attachments automatically","chat.attachmentAutoCleanupHelp":"Attachments used by a conversation, a branch, or an unsent draft are kept. A file is deleted {days} days after it is confirmed unused everywhere; a file whose use cannot be confirmed is kept.","chat.attachmentSettingsSaved":"Saved","characterMode.nav":"Characters","characterMode.title":"Characters","characterMode.description":"Choose the faces, names, stickers and completion voices you see on screen.","characterMode.label":"Character set","characterMode.default":"Default","characterMode.office":"Office mode","characterMode.help":"Applies to this whole PC server. In office mode, the characters registered in this PC's profile replace the face, name, voice, stickers and sounds of their seats. Seats without an entry stay as they are.","characterMode.noRoster":"This PC has no office character set, so the default characters stay in use.","characterMode.saved":"Saved","chat.steerTitle":"Interrupt the current run and inject this message now","chat.followUpTitle":"Queue this message after the agent finishes","chat.filterModels":"Filter models…","chat.noMatchingModels":"No matching models","chat.modelRoles":"Roles","chat.allModels":"All models","chat.mainPreset":"Main preset","roles.title":"Model roles","roles.description":"omp routes work by role, not by one current model. Assign a model to each role and both CUELO and the omp CLI use it.","roles.scope":"Save to","roles.scopeGlobal":"Global","roles.scopeProject":"This project","roles.unset":"— not set —","roles.needsProject":"Open a project to edit its model roles.","roles.source.global":"from global config","roles.source.project":"from project config","roles.source.default":"omp default","roles.thinking":"Thinking","roles.thinkingInherit":"Use the configured default thinking level","roles.harnessNote":"CUELO Maker and tool slots are listed even before you assign them. Pick your own model only for the slots you use; saving does not sign in or test the model.","roles.harnessUnset":"not set","roles.harness.implSol":"Maker: bounded design, deep diagnosis and rework","roles.harness.implSonnet":"Maker: general implementation and routine UI","roles.harness.implOpus":"Maker: difficult UI/UX","roles.harness.implDeepSeek":"Maker: fully specified repetitive work, explicit selection","roles.harness.makerHardUiOpus":"Maker: difficult UI/UX (HARD)","roles.harness.makerHardCodeOpus":"Maker: HARD code, explicit selection","roles.harness.makerHardCodeSonnet":"Maker: settled implementation and routine UI (HARD)","roles.harness.crossReviewOpenAI":"Cross-review \xb7 required OpenAI reviewer (openai / openai-codex)","roles.harness.crossReviewAnthropic":"Cross-review \xb7 required Anthropic reviewer (anthropic)","roles.harness.crossReviewAdvisory":"Cross-review \xb7 advisory reviewer, non-blocking (any provider)","roles.harness.preflightAnthropic":"Plan advice: joint preflight","roles.harness.skim":"Tool \xb7 multi-file source reading (skim)","roles.harness.draft":"Tool \xb7 document drafting (draft)","roles.harness.ocr":"Tool \xb7 image text transcription (ocr)","roles.harness.interpreter":"Tool \xb7 Korean–English interpreter (interpreter)","chat.moreControls":"Run options","chat.collapseControls":"Close run options","chat.shell":"Shell","chat.outputLocal":"output stays local","chat.outputModel":"output sent to model","chat.noTools":"No tools, read-only","chat.builtInTools":"Core: {tools} \xb7 other registered tools stay enabled","chat.allBuiltInTools":"Core: {tools} \xb7 other registered tools stay enabled","chat.changeReasoning":"Change reasoning level: {level}","chat.changeReasoningLabel":"Change reasoning level","chat.currentReasoning":"Current reasoning level: {level}","chat.outputSpeed":"{rate} tok/s","chat.outputSpeedTitle":"Output speed of the last answer (output tokens per second, from request start to the end of generation)","chat.outputSpeedLive":"~{rate} tok/s","chat.outputSpeedLiveTitle":"Estimated output speed of the answer in progress (received text approximated as tokens, from request start until now). Switches to the real token count when the answer ends","chat.fastModeActive":"Fast on \xb7 applied to this model. Priority service may cost more or use more quota. Click to turn off","chat.fastModeInactive":"Fast requested \xb7 not applied for this model or account. Click to turn off","chat.fastModeOff":"Fast off \xb7 click to request priority service (may cost more or use more quota, depending on the provider)","chat.fastModeUnknown":"Fast state not checked yet \xb7 click to read this session's actual state and change it","chat.fastModeBusy":"Changing Fast","chat.changeToolPreset":"Change tool preset","chat.stopCompaction":"Stop compaction","chat.compactContext":"Compact context","chat.compacting":"Compacting…","chat.compact":"Compact","chat.stopAgent":"Stop agent","chat.stop":"Stop","chat.liveVoice":"Live voice","chat.liveStart":"Start live voice","chat.liveStop":"End live voice","chat.liveConnecting":"Connecting","chat.liveOn":"Live","chat.liveWorking":"Working","chat.liveUnsupported":"This browser cannot make live calls","chat.liveMicDenied":"Microphone access was denied","chat.liveMicUnavailable":"No microphone is available","chat.liveAuthRequired":"Sign in to Codex to use live voice","chat.liveUpstreamFailed":"Codex refused the live call","chat.liveFailed":"The live call could not start","chat.liveNeedsSession":"Choose a folder first — a live call speaks as this conversation's agent","chat.liveVoiceSettingsNav":"Call voice","chat.liveVoiceSettingsTitle":"Call voice","chat.liveVoiceSettingsDescription":"Choose the Codex voice that speaks in live and interpreter calls and how fast it speaks. The choice applies from the next call.","chat.liveVoiceSpeakerGroup":"Voice","chat.liveVoiceCodexLabel":"Codex voice","chat.liveVoiceCodexHelp":"Speaks in live calls and interpreter calls.","chat.livePaceLabel":"Speaking pace","chat.livePaceHelp":"Slow makes the voice speak slowly and clearly.","chat.livePaceNormal":"Normal","chat.livePaceSlow":"Slow","chat.liveVoiceLoadFailed":"Could not load voice settings","chat.disableSound":"Disable completion sound","chat.enableSound":"Enable completion sound","chat.thinkingAuto":"Automatically select reasoning effort","chat.thinkingAutoCapped":"Automatic, at most {level}","chat.thinkingOff":"Reasoning off","chat.thinkingMinimal":"Minimal reasoning","chat.thinkingLow":"Low reasoning","chat.thinkingMedium":"Medium reasoning","chat.thinkingHigh":"High reasoning","chat.thinkingXhigh":"Extra-high reasoning","chat.thinkingMax":"Max reasoning","chat.builtIn":"Built-in","chat.extensions":"Extensions","chat.customCommands":"Custom commands","chat.mcpPrompts":"MCP prompts","chat.prompts":"Prompts","chat.fileCommands":"Command files","chat.skills":"Skills","chat.dormant":"dormant","chat.commandCompact":"Compress context, optionally with instructions","chat.commandReload":"Reload extensions, skills, prompts, and tools","chat.commandName":"Set the session display name","chat.commandSession":"Show session message, token, and cost stats","chat.commandCopy":"Copy the last assistant message","chat.goalLabel":"Goal","chat.goalPaused":"paused","chat.goalBudgetLeft":"{left} left","chat.goalTokensUsed":"{used} used","chat.jumpToBottom":"Jump to bottom","chat.loadLater":"Scroll down to load later messages ({count} below)","chat.jumpMissing":"That message is not in this conversation view (another branch or compacted history).","chat.questionRail":"Your questions","chat.searchPlaceholder":"Find in conversation","chat.searchNoResults":"No results","chat.searchCount":"{index}/{total}","chat.searchPrevious":"Previous match","chat.searchNext":"Next match","chat.searchClose":"Close find","chat.compactionLabel":"Compacting","chat.compactionProgress":"Compacting context \xb7 {seconds}s","chat.compactionReason.manual":"manual","chat.compactionReason.threshold":"threshold","chat.compactionReason.overflow":"overflow","chat.compactionReason.idle":"idle","chat.compactionReason.incomplete":"incomplete","chat.compactedFrom":"Compacted from {tokens} tokens","chat.interruptedTitle":"The last run was interrupted","chat.interruptedDetail":"The run stopped before it finished, for example when the server or PC went down. If it does not resume automatically, send a message to continue.","chat.interruptedDismiss":"Dismiss","chat.frequentModels":"Frequently used","chat.modelPickCount":"{count}\xd7","palette.searchPlaceholder":"Search conversations","palette.searchResults":"Conversation search results","palette.searching":"Searching…","palette.searchFailed":"Search failed","palette.searchEmpty":"No matching messages","palette.searchHits":"{count} messages","palette.searchTruncated.time":"stopped at the time limit after {scanned} of {total} sessions","palette.searchTruncated.bytes":"stopped at the size limit after {scanned} of {total} sessions","palette.searchTruncated.results":"showing the first results; refine the query for more","palette.searchCompacted":"{count} in compacted history not shown","palette.searchRoleUser":"You","palette.searchRoleAssistant":"Answer","palette.wideChatOn":"Use wide chat","palette.wideChatOff":"Use standard chat width","palette.groupViews":"Views","palette.groupViewsHint":"open in the inspector","palette.groupShortcuts":"Shortcuts","palette.groupScreen":"Screen","palette.hintMove":"move","palette.hintOpen":"open","palette.hintClose":"close","chat.compacted":"Compacted","chat.tokensSaved":"{saved} saved","i18n.close":"Close","i18n.copy":"Copy","i18n.copied":"Copied","i18n.cancel":"Cancel","i18n.save":"Save","i18n.saving":"Saving…","i18n.saved":"Saved","i18n.remove":"Remove","i18n.removing":"Removing…","i18n.delete":"Delete","i18n.loading":"Loading...","i18n.search":"Search","i18n.refresh":"Refresh","i18n.update":"Update","i18n.updating":"Updating...","restart.title":"CUELO is restarting","restart.body":"This page reloads automatically when the server is back.","restart.slow":"The restart is taking longer than two minutes. Check READY or FAILED in %USERPROFILE%\\.omp\\restart-ompweb.log on the server PC. This page still reloads when the server is back.","restart.returnedTitle":"CUELO restarted","restart.returnedBody":"The server is back and this tab reconnected to the same conversation.","restart.returnedDismiss":"Dismiss restart notice","i18n.check":"Check","i18n.checking":"Checking...","i18n.install":"Install","i18n.installing":"Installing...","i18n.noResults":"No results","i18n.searchProviders":"Search providers…","i18n.noProviders":"No providers match","i18n.newModel":"new model","i18n.addProvider":"Add provider","i18n.selectProviderModel":"Select a provider or model","i18n.visibleInPrompt":"Visible in model prompt — click to disable","i18n.hiddenFromPrompt":"Hidden from model prompt — click to enable","i18n.dormant":"Dormant","i18n.hiddenButInvocable":"Hidden from model, still manually invocable","i18n.skillSearchPlaceholder":"e.g. react, testing, deploy","i18n.searching":"Searching…","i18n.noSkills":"No skills found","i18n.checkUpdates":"Check updates","i18n.updates":"updates","i18n.noResolvedResources":"No resolved resources","i18n.enablePackage":"Enable package","i18n.disablePackage":"Disable package","i18n.filtered":"filtered","i18n.openSessionToReload":"Open a session to reload","i18n.notFound":"Not found","i18n.noPlugins":"No plugins configured","trust.resourcesNotLoaded":"Restricted mode","trust.trustProject":"Trust project","computerTakeover.allow":"Allow takeover","computerTakeover.active":"Takeover allowed","computerTakeover.allowHint":"Allow screen takeover for this session only. It goes back to refused when you turn it off or the session closes.","computerTakeover.activeHint":"Screen takeover is allowed in this session. Click to turn it off.","computerTakeover.shared":"A session opened in the server's own folder cannot be allowed separately.","computerTakeover.failed":"Could not change takeover: {error}","trust.trusting":"Trusting...","trust.cancel":"Cancel","trust.dialogTitle":"Trust this project?","trust.dialogBody":"Project resources can run local code. Trust only projects whose contents you know.","trust.skillsNotLoaded":"Project skills are not loaded because this project is not trusted.","trust.pluginsNotLoaded":"Project plugins are not loaded because this project is not trusted.","trust.projectScopeUnavailable":"Project installs are unavailable while project resources are not loaded.","trust.pendingBadge":"Restricted mode \xb7 trust scheduled","trust.scheduledTitle":"Trust scheduled","trust.scheduledBody":"This project is still in restricted mode. Trust applies once every session in this project has finished its current work; nothing that is running gets interrupted.","trust.cancelSchedule":"Cancel scheduled trust","trust.close":"Close","trust.applyFailed":"The scheduled trust was not applied, so the project is still restricted: {error}. Trust it again to retry.","trust.settingsNav":"Project trust","trust.settingsDescription":"A project that ships its own extensions, hooks, tools, or MCP servers loads that code only after you trust it. A change made while a session is working applies when every session in that project is idle — running work is never interrupted.","trust.settingsEmpty":"No project needs a trust decision yet.","trust.loadFailed":"Could not load project trust: {error}","trust.stateTrusted":"Trusted","trust.stateRestricted":"Restricted","trust.stateNotRequired":"No project code needs trust","trust.pendingGrant":"Trust approved but not applied yet. The project stays restricted until its sessions finish their work.","trust.pendingRevoke":"Trust is already revoked. {count} running session(s) still use the project code and restart restricted when their current work ends.","trust.runtime":"Live sessions {sessions} \xb7 running {running} \xb7 project code loaded {loaded}","trust.revoke":"Revoke trust","trust.trustAgain":"Trust again","trust.confirm":"Confirm","trust.working":"Saving…","trust.confirmGrant":"Trust this project? Its extensions, hooks, tools, and MCP servers can run on this machine.","trust.confirmTrustAgain":"Undoing a revoke is a new trust approval. Its extensions, hooks, tools, and MCP servers can run on this machine.","trust.confirmRevoke":"Revoke trust? New sessions start restricted right away; running sessions finish their current work first.","trust.doneApplied":"Applied. Sessions in this project now start with this setting.","trust.doneCancelled":"Scheduled trust cancelled. The project stays restricted.","trust.refresh":"Refresh","i18n.creatingSession":"Creating new session…","i18n.creating":"Creating…","i18n.subscription":"Subscription","i18n.subscriptions":"Subscriptions","i18n.customEndpoint":"Custom endpoint format","i18n.noChanges":"No changes","i18n.branches":"Branches","i18n.noActiveSession":"No active session","i18n.noBranches":"This session has no branches","i18n.source":"Source","i18n.preview":"Preview","i18n.diff":"Diff","i18n.downloadFile":"Download file","i18n.liveSync":"Live sync active","i18n.notWatching":"Not watching","i18n.fileViewMode":"File view mode","i18n.compareHead":"Compare working tree with HEAD","i18n.mentionSelectedLines":"Mention selected lines","i18n.disableWrap":"Disable word wrap","i18n.enableWrap":"Enable word wrap","i18n.htmlPreview":"HTML preview","i18n.previewFile":"Preview {file}","i18n.invalidMermaid":"Invalid Mermaid diagram","i18n.renderingMermaid":"Rendering Mermaid diagram","i18n.previewAfterStreaming":"Preview available after streaming","i18n.showMermaidSource":"Show Mermaid source","i18n.previewMermaid":"Preview Mermaid diagram","i18n.openMermaidViewer":"Open diagram viewer","i18n.mermaidViewer":"Mermaid diagram viewer","i18n.mermaidDiagram":"Mermaid diagram","i18n.zoomOut":"Zoom out","i18n.zoomIn":"Zoom in","toolImage.dialogLabel":"Enlarged image","toolImage.requestEdit":"Request changes to this screen","toolImage.requestEditHint":"Attach this image to the message box. Describe the change, then send.","toolImage.noComposer":"There is no message box to attach to. Open a conversation, then press Request changes to this screen.","toolImage.loadFailed":"Couldn't load the image. Press Request changes to this screen again.","toolImage.markHint":"Drag over the part to change","toolImage.markLimit":"You can mark up to {count} areas","toolImage.clearMarks":"Clear marks","toolImage.regionLabel":"Area {n}","toolImage.locatorIntro":"The parts to change are marked with red boxes on the attached screen (areas {range}). A close-up of each area follows.","toolImage.locatorRegion":"Area {n}: x={x}, y={y}, width {w}, height {h} (original {width}\xd7{height} pixels)","files.pickElement":"Pick element","files.pickElementHint":"Click the element to change in the preview","files.pickedElement":"Picked element","files.requestElementEdit":"Request changes to this element","files.clearPick":"Clear selection","files.pickLocatorElement":"Element: {selector}","files.pickLocatorText":'Text: "{text}"',"files.pickLocatorPosition":"Position: x={x}, y={y}, width {w}, height {h} ({vw}\xd7{vh} preview)","i18n.fitToWidth":"Fit to width","models.discoveryFetching":"Importing models…","models.discoveryFetch":"Import models…","models.discoveryFilterPlaceholder":"Filter {count} models…","models.discoveryFilter":"Filter upstream models","models.discoverySelectShown":"Select shown","models.discoveryNoMatches":"No matching models.","models.discoveryAdded":"added","models.discoveryShowing":"Showing first {shown} of {total}","models.discoveryFetched":"{count} models fetched","models.discoveryAddSelected":"Add selected","models.discoveryAddSelectedCount":"Add selected ({count})","models.catalogSource":"source: models.dev ↗","models.catalogFilling":"Filling details…","models.catalogFill":"Fill model details","models.catalogFilled":"{count} fields filled","models.catalogNoEmptyFields":"No empty fields to fill","models.catalogNoExactMatch":"No exact models.dev match","models.catalogPriceProvider":"Price matched Provider {provider}","models.catalogPriceBaseUrl":"Price matched Base URL to {provider}","models.catalogPriceConsensus":"Price agreed by {support}/{total} records","models.catalogPriceUnreliable":"No reliable price found","models.catalogUndo":"Undo","models.navGroupRoles":"Role assignments","models.navGroupAccounts":"Connected accounts","models.navGroupCustom":"Custom providers","models.backToList":"Back to list","i18n.testingModel":"Testing model connection...","i18n.connected":"Connected","i18n.failed":"Failed","i18n.test":"Test","i18n.testConnection":"Test model connection","i18n.provider":"Provider","i18n.model":"Model","i18n.providerName":"Provider name","i18n.rename":"Rename","i18n.default":"Default","i18n.disabled":"Disabled","i18n.noResources":"No resources","i18n.unknown":"Unknown","i18n.installedVersion":"installed {version}","i18n.configuredVersion":"configured {version}","i18n.extensions":"Extensions","i18n.prompts":"Prompts","i18n.themes":"Themes","i18n.resourceCount":"{count} {label}","i18n.extensionShort":"ext","i18n.skillShort":"skills","i18n.promptShort":"prompts","i18n.themeShort":"themes","i18n.custom":"Custom","i18n.clearAll":"clear all","i18n.connectedSuccessfully":"Connected successfully.","i18n.notConnected":"not connected","i18n.configured":"configured","i18n.notConfigured":"not configured","i18n.openingBrowser":"Opening browser…","i18n.submit":"Submit","i18n.login":"Login","i18n.relogin":"Re-login","i18n.deviceLogin":"Log in with device code","i18n.deviceLoginGuide":"Open the page below, sign in, and enter this code. Nothing has to reach this server's localhost, so it also works on a remote server.","i18n.disconnect":"Disconnect","i18n.networkError":"Network error","i18n.continuing":"Continuing…","i18n.skills":"Skills","i18n.plugins":"Plugins","i18n.addSkill":"Add skill","i18n.addPlugin":"Add plugin","i18n.selectSkill":"Select a skill","i18n.selectPackage":"Select a package","i18n.updateAvailable":"Update available","i18n.upToDate":"Up to date","i18n.automaticChecksUnavailable":"Automatic checks unavailable","i18n.checkFailed":"Check failed","i18n.installed":"Installed","i18n.status":"Status","i18n.version":"Version","i18n.package":"Package","i18n.resources":"Resources","i18n.installedPath":"Installed path","i18n.cwd":"CWD","i18n.resolvedResources":"Resolved Resources","i18n.reloadSession":"Reload session","i18n.reloadSessionHint":"Reloads settings and skills for the open session. It does not unload plugins; restart CUELO for that.","i18n.reloading":"Reloading...","i18n.packageRemoved":"Package removed.","i18n.packageInstalled":"Package installed.","i18n.packageUpdated":"Package updated.","i18n.packageDisabled":"Package disabled.","i18n.packageDisabledRestartRequired":"Disabled setting saved. The plugin already loaded keeps running until CUELO restarts; reloading the session does not unload it.","i18n.packageEnabled":"Package enabled.","i18n.sessionReloaded":"Session reloaded.","i18n.thinking":"Thinking","i18n.largeMessageReveal":"Message content is very large ({size}). Click to view as plain text — markdown rendering is disabled to keep the page responsive.","i18n.loadingThinking":"Loading thinking...","i18n.copyMessage":"Copy message","i18n.editFromHere":"Edit from here","i18n.editFromHereTitle":"Edit from here — branches within this session","i18n.newSession":"New session","i18n.newSessionTitle":"New session — creates an independent copy from here","i18n.estimatedTokens":"Estimated token count while streaming","i18n.messageUsage":"Usage","i18n.messageUsageTitle":"Show this message's tokens and cost","i18n.providerAnthropicSubscription":"Anthropic subscription","i18n.providerAnthropicApi":"Anthropic API","i18n.noOutput":"(no output)","i18n.noSummary":"(no summary)","i18n.conversationCompacted":"Conversation compacted","i18n.compactionDescription":"The conversation history before this point was compacted into the following summary:","i18n.fileContext":"File context: {details}","i18n.readFiles":"Read files","i18n.modifiedFiles":"Modified files","i18n.hiddenExtensionMessage":"hidden extension message","i18n.noMessage":"(no message)","i18n.showOriginalReply":"Show English original","i18n.hideOriginalReply":"Hide English original","i18n.showInputTranslation":"Show English translation","i18n.hideInputTranslation":"Hide English translation","i18n.showExtensionMessage":"Show extension message","i18n.collapse":"Collapse","i18n.expand":"Expand","i18n.hideDetails":"Hide details","i18n.showDetails":"Show details","i18n.thinkingUnavailable":"Thinking content unavailable","i18n.before":"Before","i18n.after":"After","i18n.sessionComplete":"Session complete","i18n.taskFinished":"Task finished.","i18n.attentionNeeded":"Pi needs your attention","i18n.extensionInputNeeded":"An extension is waiting for your input.","navigator.toolbar":"Navigator views","navigator.priority":"Priority","navigator.view":"{label} navigator","gpt6.boundBadge":"6PRO {handle}","gpt6.boundBadgeHint":"This session is bound to 6 Pro connection number {handle}.","usage.none":"Usage —","usage.open":"Open usage details: {rows}","usage.openMore":", and {count} more","usage.showMore":"Show {count} more","usage.showLess":"Show less","usage.accountBlocked":"auto-blocked","usage.accountSpent":"account limit used up","usage.limitSpent":"limit used up","usage.bai":"B.AI tokens","usage.baiEmpty":"none recorded","usage.baiRange":"aggregated {from}–{to}","usage.baiUnmeasured":"not measured","usage.title":"Usage","usage.reorder":"Reorder","usage.reorderDone":"Done","usage.reorderGroup":"Account display order","usage.moveUp":"Move {account} up","usage.moveDown":"Move {account} down","usage.moved":"{account} moved to position {position}","usage.authExpired":"sign-in expired","usage.authUnavailable":"unavailable","usage.relogin":"Sign in again","usage.reloginFor":"Sign in again as {account}","usage.authIssues":"Account issues: {count}","relogin.title":"Account to sign in again","relogin.guide":"Press {action} and finish in the browser with this account. Signing in with a different account leaves this one failing.","relogin.done":"Sign-in finished.","relogin.checking":"Re-reading usage to check {account}…","relogin.recovered":"{account} is signed in again.","relogin.stillFailing":"Sign-in finished, but {account} still reports an auth error. You may have signed in with a different account.","relogin.unknown":"Could not find {account} in usage, so recovery is not confirmed.","efficiency.title":"Efficiency","efficiency.governor":"Run control","efficiency.lab":"Experiment Lab","efficiency.refresh":"Refresh","efficiency.refreshing":"Loading…","efficiency.noSession":"Select a session to see its runs.","efficiency.loadingRuns":"Loading runs…","efficiency.runsEmpty":"No runs recorded in this session.","efficiency.runsError":"Could not load runs.","efficiency.selectRun":"Select a run to see roles, bottlenecks, and unmeasured gaps.","efficiency.loadingDetail":"Loading run detail…","efficiency.detailError":"Could not load the run detail.","efficiency.noTitle":"Untitled request","efficiency.elapsed":"Elapsed","efficiency.busyTotal":"Generation time total","efficiency.noSumNote":"Elapsed and generation total are shown side by side, never added.","efficiency.summarySection":"Summary","efficiency.rolesSection":"Roles","efficiency.rolesEmpty":"No role recorded a request in this run.","efficiency.bottlenecksSection":"Bottlenecks","efficiency.bottlenecksEmpty":"No bottleneck measured.","efficiency.toolsSection":"Tool calls","efficiency.unmeasuredGap":"Unmeasured gap","efficiency.elapsedValue":"Elapsed {value}","efficiency.estimatedCostValue":"Est. {value}","efficiency.estimatedCost":"Est. cost","efficiency.untimedLowerBound":"{value} request(s) have no recorded duration — generation time is a lower bound.","efficiency.bottleneckOrderNote":"Largest observed items, longest first. Bar length is relative to the top item, not to elapsed time.","efficiency.untimedRuns":"Runs missing duration","efficiency.untimedMedianLowerBound":"{value} run(s) contain requests with no recorded duration — the median generation time is a lower bound.","efficiency.unpricedLowerBound":"Includes unpriced records — lower bound","efficiency.mixedPairingNote":"Mixed configuration: which model and reasoning effort each request used, and in what order, could not be determined. These runs cannot be assumed to share the same conditions.","efficiency.unmeasuredShort":"Unmeasured","efficiency.effortLabel":"Effort {value}","efficiency.requestsValue":"{value} requests","efficiency.toolCallsValue":"{value} tool calls","efficiency.busyTime":"Generation time","efficiency.tokens":"Tokens","efficiency.unpricedRequests":"Unpriced requests","efficiency.firstTokenAvg":"Wait for first token (avg)","efficiency.firstTokenPartial":"First-token wait is averaged over {recorded}/{total} requests that recorded it.","efficiency.outputTokens":"Conversation output tokens","efficiency.helpersTitle":"Auxiliary model calls","efficiency.helperCallsValue":"{count} calls \xb7 output {output} \xb7 total {tokens} \xb7 {cost}","efficiency.helpersIncludedNote":"Auxiliary call tokens and cost are included in the token and estimated cost totals above, and excluded from request count, first-token wait, and conversation output tokens.","efficiency.toolFailedValue":"failed {value}","efficiency.toolNoMatchValue":"no match {value}","efficiency.toolCancelledValue":"cancelled {value}","efficiency.unmeasuredGapValue":"Unmeasured gap {value}","efficiency.roleMain":"Main","efficiency.roleMaker":"Maker","efficiency.roleChecker":"Checker","efficiency.roleAdvisor":"Advisor","efficiency.roleUnattributed":"Unattributed","efficiency.purposePrimary":"Primary","efficiency.purposeRework":"Rework","efficiency.purposeReview":"Review","efficiency.outcomeCompleted":"Completed","efficiency.outcomeError":"Error","efficiency.outcomeAborted":"Aborted","efficiency.outcomeInterrupted":"Interrupted","efficiency.outcomeRunning":"Running","efficiency.folder":"Folder","efficiency.folderAll":"All folders","efficiency.folderPlaceholder":"Filter by folder, Enter to apply","efficiency.loadingExperiments":"Loading config comparison…","efficiency.experimentsEmpty":"No config recorded for comparison.","efficiency.experimentsError":"Could not load the config comparison.","efficiency.difficultyNote":"Task difficulty is not normalized.","efficiency.runsValue":"{value} runs","efficiency.medianElapsed":"Median elapsed","efficiency.medianBusy":"Median generation","efficiency.medianTokens":"Median tokens","efficiency.medianEstimatedCost":"Median est. cost","efficiency.totalEstimatedCost":"Total est. cost","efficiency.reworkRate":"Rework rate","efficiency.errorRate":"Error rate","efficiency.unpricedRuns":"Unpriced runs","efficiency.scopeAttributed":"Current roles only","efficiency.scopeAll":"All runs","efficiency.scopeSessions":"Sessions counted","efficiency.scopeRuns":"Runs counted","efficiency.scopeExcludedRuns":"Runs excluded","efficiency.harness":"Harness","efficiency.harnessValue":"Harness {value}","efficiency.harnessUnknown":"unknown","efficiency.harnessAll":"All harnesses","efficiency.groupByHarness":"Split by harness","efficiency.harnessNote":"Harness is the CUELO version installed when the run started. It comes only from this PC's update records; runs without a record, or in a span changed outside the records, are unknown.","efficiency.sawSection":"What the model saw","efficiency.sawApproxNote":"Approximate, rebuilt from the session log. The system prompt sent with each request and context-hook rewrites are not recorded.","efficiency.sawOpen":"Show requests","efficiency.sawLoading":"Loading requests…","efficiency.sawError":"Could not load requests.","efficiency.sawEmpty":"No model requests are recorded for this run.","efficiency.sawFilterEmpty":"No requests with injections.","efficiency.sawRole":"Transcript","efficiency.sawSummary":"{turns} requests \xb7 {injections} injected \xb7 {tools} tool calls \xb7 {failed} failed","efficiency.sawOnlyInjected":"Only requests with injections","efficiency.sawTurnLabel":"Request {index}","efficiency.sawBefore":"Arrived before this request","efficiency.sawTrailing":"Arrived after the last request (not part of any model request in this run)","efficiency.sawShowFull":"Show full text","efficiency.sawShowArgs":"Show arguments","efficiency.sawShowResult":"Show result","efficiency.sawHideFull":"Collapse","efficiency.sawTruncated":"Showing the first {value} characters.","efficiency.sawMore":"Load {value} more","efficiency.sawShown":"Showing {shown} of {total}","efficiency.sawHiddenFromChat":"Hidden in chat","efficiency.sawNotSent":"Not sent to the model","efficiency.sawSecretsMasked":"Strings that look like secrets are replaced with [REDACTED].","efficiency.sawKindInjection":"Injected","efficiency.sawKindDeveloper":"Developer message","efficiency.sawKindUser":"User message","efficiency.sawKindCompaction":"Compaction","efficiency.sawKindModel":"Model change","efficiency.sawKindEffort":"Effort change","efficiency.sawKindPrompt":"System prompt changed","efficiency.sawKindRules":"Rules injected","efficiency.sawKindMemory":"Memory recall","efficiency.sawCompactionValue":"{before} → {after} tokens","efficiency.sawMemoryIds":"{value} memories recalled (text not recorded)","efficiency.sawToolOk":"OK","efficiency.sawToolFailed":"Failed","efficiency.sawToolNoMatch":"No match","efficiency.sawToolCancelled":"Cancelled","efficiency.sawToolMissing":"No result","efficiency.sawResultChars":"result {value} chars","efficiency.sawUsage":"in {input} \xb7 out {output} \xb7 cache read {cacheRead}","efficiency.sawStop":"stop: {value}","efficiency.sawToolsChanged":"Tool list changed: +{added} −{removed}","efficiency.sawPreludeTitle":"System prompt and tools","efficiency.sawPreludeRecorded":"Recorded","efficiency.sawPreludeTools":"{value} tools active in the last request (recorded)","efficiency.sawPreludeDigest":"System prompt fingerprint: {value}","efficiency.sawPreludeDigestNone":"No system prompt fingerprint is recorded for this run.","efficiency.sawPreludeMemory":"Memory recall block (part of the system prompt, recorded)","efficiency.sawPreludeReconstruct":"Rebuild from current settings","efficiency.sawPreludeLoading":"Rebuilding…","efficiency.sawPreludeApprox":"Rebuilt now from the current configuration, not as sent.","efficiency.sawPreludeNotLoaded":"This session is not loaded right now, so it cannot be rebuilt. The system prompt text is not recorded.","efficiency.sawPreludeMatch":"The current prompt's fingerprint matches this run's record.","efficiency.sawPreludeMismatch":"The current prompt's fingerprint differs from this run's record; it may have changed since.","toolRun.running":"Running","toolRun.failed":"Failed","toolRun.exitCode":"exit {code}","toolRun.diffStats":"{added} lines added, {removed} lines removed","toolRun.askTimedOut":"No answer before the timeout. The form's current values were submitted.","panel.expand":"Widen panel","panel.restore":"Restore size","panel.more":"More","panel.liveSync":"Live updates","panel.subagentsCount":"{count} records","panel.refresh":"Refresh records","panel.close":"Close panel","pluginLab.counts":"{count} plugins","pluginLab.refresh":"Refresh list","pluginLab.create":"New plugin","pluginLab.createHint":"Puts a request into the message box. Edit it, then send.","pluginLab.starter":"Use the plugin-lab skill to build a plugin for my profile.\n- What it should do: \n- Tools it needs: \n- What its panel shows (leave empty for none): \nWrite it straight into the repository's formal plugin folder and ship it through review, version, CI and deploy in this turn.","pluginLab.loading":"Loading plugins…","pluginLab.loadFailed":"Could not load plugins: {error}","pluginLab.retry":"Load again","pluginLab.empty":"No plugins yet. Use “New plugin” to put a request into the message box.","pluginLab.listLabel":"Plugins","pluginLab.on":"On","pluginLab.off":"Off","pluginLab.toggleLabel":"Use {name}","pluginLab.toggleFailed":"Could not change the state: {error}","pluginLab.tools":"Tools","pluginLab.enhancements":"Enhancements","pluginLab.enhancementDateHint":"Recorded date","pluginLab.showAllEnhancements":"Show all {count}","pluginLab.showFewerEnhancements":"Show fewer","pluginLab.problem":"Problem","pluginLab.openPanel":"Open panel","pluginLab.openPanelLabel":"Open the {name} panel","pluginLab.back":"Back to plugins","pluginLab.panelSubtitle":"Sandboxed \xb7 lab:{id}","pluginLab.frameTitle":"{name} panel","pluginLab.lines":"{count} lines of agent data","pluginLab.noLines":"No agent data in this session","pluginLab.draftInserted":"The panel's draft is in the message box. Check it, then send.","pluginLab.applyHint":"Tool changes apply in a new session or after /reload.","pluginLab.noComposer":"Open a conversation to use the message box.","pluginLab.draftNotRecorded":"The draft is in the message box, but its use was not recorded.","pluginLab.saving":"Changing…","makerDetail.region":"{title} record","makerDetail.noFiles":"This Maker changed no files","makerDetail.noChecks":"No checks were run","makerDetail.archiveUnobserved":"The record holds no tool results, so this cannot be confirmed","makerDetail.unavailable":"No run record matches this attempt exactly, so its detail cannot be opened","makerDetail.checkPassed":"passed","makerDetail.checkUnverified":"verdict not confirmed","makerDetail.checkFailed":"failed","makerDetail.checkUnobserved":"result not observed","dispatchLane.label":"Maker attempts","dispatchLane.runPhase":"{run} ({phase})","dispatchLane.checks":"checks {passed}/{total}","dispatchLane.checksUnobserved":"checks not observed","dispatchLane.checksLoading":"reading checks","dispatchLane.attempt":"attempt {attempt}","dispatchLane.attemptUnknown":"attempt","dispatchLane.verdict.accepted":"accepted","dispatchLane.verdict.rework":"rework","dispatchLane.verdict.held":"held","dispatchLane.open":"Details","dispatchLane.openLabel":"Open details for {title}","dispatchLane.unavailable":"No detail","credits.heading":"API credits","credits.estimateNote":"The billing-page balance is what you read on the provider's billing page at the shown time. Later usage is not included. Estimated spend and balance multiply this PC's token counts by published prices and are not a bill.","credits.loading":"Loading API credits…","credits.loadFailed":"Could not load API credits: {reason}","credits.wallet.hive":"Hive","credits.scope.hive":"This PC's records","credits.since":"since {date}","credits.sinceDefault":"last 30 days","credits.total":"Total","credits.spent":"Est. spent","credits.remaining":"Est. left","credits.meterLabel":"{wallet} credit used","credits.usedPct":"{pct}% used","credits.enterPrompt":"Enter the total and start date to see an estimated balance.","credits.enter":"Enter credit","credits.edit":"Edit","credits.formLabel":"{wallet} credit","credits.totalUsd":"Total (USD)","credits.startDate":"Start date","credits.save":"Save","credits.saving":"Saving…","credits.cancel":"Cancel","credits.clear":"Remove","credits.saveFailed":"Not saved: {reason}","credits.invalid.total":"Enter the total as a number.","credits.error.invalid_total":"the total must be a number above 0","credits.error.invalid_start_date":"check the start date","credits.error.start_date_in_future":"the start date is in the future","credits.error.session_scan_failed":"session records could not be read","credits.error.session_scan_partial":"some session records could not be read, so the spent amount is a minimum","credits.error.internal":"an unexpected error occurred","credits.error.settings_unreadable":"the credit settings file could not be read, so it was not overwritten","credits.walletError":"Usage not read: {reason}","credits.settingsError":"The credit settings file could not be read. Enter the credits again.","credits.tokens":"in {input} \xb7 out {output}","credits.cacheTokens":"cache {cache}","credits.requests":"{count} calls","credits.priceUnknown":"price unknown","credits.purpose.session":"Chat \xb7 agents","credits.purpose.memory":"Memory","credits.purpose.korean-reply-translation":"Reply translation","credits.wallet.anthropic":"Anthropic API","credits.billingLink":"Actual balance","credits.billingLinkLabel":"See the actual {wallet} balance on its billing page (opens in a new tab)","credits.scope.anthropic":"This PC's records","credits.anthropic.note":"Counts only API-key responses with recorded tokens; excludes subscription (OAuth) requests and failed attempts without tokens. Amounts are estimates at published prices, not a bill or balance.","credits.anthropic.noCoverage":"No requests in this window have a recorded credential kind, so API-key usage is unknown.","credits.anthropic.coverageSince":"First recorded credential in window: {date} (this PC may not have recorded every later request)","credits.anthropic.none":"No recorded API-key requests in this window.","credits.anthropic.oauthExcluded":"Subscription (OAuth) excluded","credits.anthropic.unattributedExcluded":"Unrecorded credential excluded","credits.category.input":"Input","credits.category.output":"Output","credits.category.cacheRead":"Cache read","credits.category.cacheWrite":"Cache write","credits.balance.label":"Billing-page balance","credits.balance.source":"Manual record","credits.balance.observed":"Checked {time}","credits.balance.age.now":"Just now","credits.balance.age.minutes":"{count}m ago","credits.balance.age.hours":"{count}h ago","credits.balance.age.days":"{count}d ago","credits.balance.none":"No recorded balance","credits.balance.record":"Record balance","credits.balance.edit":"Edit balance","credits.balance.formLabel":"{wallet} billing-page balance","credits.balance.amount":"Balance (USD)","credits.balance.observedAt":"Checked at","credits.balance.observedAtHint":"When you saw the balance on the billing page.","credits.invalid.amount":"Enter a valid balance number.","credits.invalid.observedAt":"Enter a valid time.","credits.error.invalid_balance":"the balance must be 0 or more","credits.error.invalid_observed_at":"check the time","credits.error.observed_at_in_future":"the time is later than now","credits.error.routes_unreadable":"the settings file could not be read, so the APIs in use are unknown","credits.wallet.exa":"Exa","credits.wallet.typesafe":"TypeSafe Jev","credits.route.hive":"Assigned to model roles (memory, skim, etc.)","credits.route.exa":"Default web search path","credits.route.typesafe":"Default quick judgement (Jev) path","credits.route.anthropic":"API key fallback when the subscription's weekly allowance runs out","credits.evidence.lastPaidUse":"Last paid use on this PC: {time}","credits.evidence.unverified":"Some session logs could not be read, so recent paid use is unconfirmed.","memoryTrace.refresh":"Refresh","memoryTrace.noSession":"Select a session to see how it looked up memories.","memoryTrace.loading":"Reading the session log…","memoryTrace.error":"Could not load the memory trace. {error}","memoryTrace.retry":"Load again","memoryTrace.empty":"This session has no memory or doc-map records.","memoryTrace.requests":"{count} requests with records","memoryTrace.requestsLabel":"Requests","memoryTrace.requestHeading":"Request #{index}","memoryTrace.noPreview":"(no text)","memoryTrace.flowLabel":"Request flow","memoryTrace.stageRecall":"Recalled","memoryTrace.stageJev":"JEV check","memoryTrace.stageDocmap":"Map candidates","memoryTrace.stageDocs":"Docs opened","memoryTrace.stageLessons":"Pre-edit lessons","memoryTrace.stageSaved":"Saved","memoryTrace.stageEmpty":"This step did not happen in this request.","memoryTrace.openedSummary":"{opened} opened \xb7 {skipped} not opened","memoryTrace.opened":"Opened","memoryTrace.candidateOnly":"Candidate only","memoryTrace.fromMap":"Map candidate","memoryTrace.lines":"Lines {lines}","memoryTrace.autoRecall":"Recalled before the request","memoryTrace.explicitRecall":"Looked up during the work","memoryTrace.query":"Query","memoryTrace.noResults":"No memories came back.","memoryTrace.noMemoryText":"This log keeps no text for this memory.","memoryTrace.jevUnknown":"{count} undecided","memoryTrace.jevUnrelated":"{count} unrelated","memoryTrace.lessonFor":"Memories shown before editing","memoryTrace.savedAuto":"Auto-saved","memoryTrace.graphLabel":"Link graph","memoryTrace.graphScope":"Graph scope","memoryTrace.scopeRequest":"This request","memoryTrace.scopeSession":"Whole session","memoryTrace.legendRequest":"Request","memoryTrace.legendMemory":"Memory","memoryTrace.legendDoc":"Map doc","memoryTrace.legendFile":"Edited file","memoryTrace.graphEmpty":"Nothing is linked in this scope.","memoryTrace.nodeLabel":"{kind}: {label}, {count} links","memoryTrace.edgeRecalled":"Recalled","memoryTrace.edgeLesson":"Pre-edit lesson","memoryTrace.verdictLegend":"JEV verdict","memoryTrace.verdictApply":"Applies","memoryTrace.verdictExcepted":"Condition not met or exception","memoryTrace.verdictConflict":"Conflicts with the request","memoryTrace.verdictUnconfirmed":"Condition unconfirmed","memoryTrace.verdictUnlisted":"Unrelated or undecided","memoryTrace.graphHint":"Point at or focus a node to read its full text here.","memoryTrace.legendDocEdited":"Opened and edited","memoryTrace.noticeHarness":"Harness","memoryTrace.noticeResume":"Auto-resume","routines.tab":"Routines","routines.title":"Routine boards","routines.back":"Back to chat","routines.panelIntro":"At the set time a new session runs, and its final answer is posted to that routine's board.","routines.galleryIntro":"Each routine has its own board. Posts come from the shared repository, so every PC shows the same boards.","routines.galleryList":"All boards","routines.new":"New routine","routines.col.gallery":"Board","routines.col.schedule":"Schedule","routines.col.host":"Runs on","routines.col.posts":"Posts","routines.col.latest":"Latest","routines.col.no":"No.","routines.col.title":"Title","routines.col.author":"Author","routines.col.date":"Date","routines.off":"Off","routines.on":"On","routines.turnOff":"Turn off","routines.turnOn":"Turn on","routines.toggledOff":'Turned off "{name}". Other PCs pick this up on their next sync, within about 5 minutes.',"routines.toggledOn":'Turned on "{name}". Other PCs pick this up on their next sync, within about 5 minutes.',"routines.hostNote":"This routine runs on {host}. Turning it on or off reaches other PCs on their next sync, within about 5 minutes.","routines.enabledCount":"{on} of {total} routines on","routines.filter.all":"All {count}","routines.filter.on":"On {count}","routines.filter.off":"Off {count}","routines.col.state":"State","routines.col.next":"Next run","routines.col.toggle":"Turn on or off","routines.nextRun":"Next run {time}","routines.lastRun":"Last run {time}, {result}","routines.lastRun.ok":"posted","routines.lastRun.quiet":"nothing to report","routines.lastRun.failed":"failed","routines.lastRun.timeout":"timed out","routines.noRunYet":"No runs yet","routines.newPosts":"{count} new","routines.newMark":"N","routines.newMarkLabel":"New post","routines.markAllRead":"Mark all read","routines.expandPost":"Show the whole post","routines.details":"Show details","routines.detailsHide":"Hide details","routines.deletedElsewhere":"This routine was deleted, possibly on another PC.","routines.networkError":"Request failed: {error}","routines.koreaTime":"Korea time","routines.sched.weekly":"{days} {times}","routines.sched.hourlyOne":"Every hour at :{minute}","routines.sched.hourlyN":"Every {every} hours at :{minute} (from {start}:{minute})","routines.sched.withDays":"{days}, {rest}","routines.sched.once":"Once on {date} {time}","routines.running":"Running","routines.status.failed":"Failed","routines.status.timeout":"Timed out","routines.tabAll":"All {count}","routines.tabFailed":"Failed {count}","routines.runNow":"Run now","routines.runHere":"Run now on this PC","routines.runHereHint":"Run now uses this PC ({host})","routines.runStarted":"Started on this PC. The post appears when the run finishes.","routines.settings":"Settings","routines.everyDay":"Every day","routines.weekdays":"Weekdays","routines.day.0":"Sun","routines.day.1":"Mon","routines.day.2":"Tue","routines.day.3":"Wed","routines.day.4":"Thu","routines.day.5":"Fri","routines.day.6":"Sat","routines.metaHost":"Runs on {host}","routines.metaCwd":"Folder {cwd}","routines.noPosts":"No posts yet.","routines.noPostsNext":"The first post appears after the next run ({time}).","routines.noPostsOff":"This routine is off, so nothing is scheduled. Run now posts one right away.","routines.noFailed":"No failed posts.","routines.empty":"No routines yet.","routines.emptyHint":"Create a routine and a new session runs on the days and time you pick. Its answer is posted to the routine's board.","routines.setupTitle":"Routine repository not found","routines.setupMissing":"The folder {dir} does not exist.","routines.setupNotGit":"The folder {dir} is not a git repository.","routines.setupBody":"Routines and their posts live in this repository, shared by home and cloud. Clone the private repository to that path, or set CUELO_ROUTINES_DIR to another path, then reload.","routines.reload":"Reload","routines.sync.ok":"Synced {time}","routines.sync.never":"Not synced yet","routines.sync.syncing":"Syncing","routines.sync.pending":"{count} commits to push","routines.sync.nothing":"Nothing to push","routines.sync.error":"Sync error: {error}","routines.openSession":"Open session","routines.postAuthor":"By {host}","routines.loadFailed":"Could not load: {error}","routines.postMissing":"Post not found.","routines.form.newTitle":"New routine","routines.form.editTitle":"Routine settings","routines.form.name":"Name","routines.form.days":"Days","routines.form.time":"Time","routines.form.host":"Runs on","routines.form.hostHint":"This PC is {host}. Scheduled runs happen only on the PC named here.","routines.form.model":"Routine Main model","routines.form.modelPlaceholder":"Use PC default","routines.form.modelHint":"Optional. Override as provider/model-id; the model must be available on the executing host. Ignored when the plugin is disabled.","routines.form.cwd":"Project folder","routines.form.cwdPlaceholder":"Leave empty to run in this routine's folder in the repository","routines.form.cwdHint":"A path on the PC that runs it. If that folder is missing there, the run is posted as failed.","routines.form.prompt":"Instructions","routines.form.enabled":"Active","routines.form.enabledLabel":"Run on schedule","routines.form.enabledHint":"Turning this off only stops the schedule. Posts stay.","routines.form.cancel":"Cancel","routines.form.save":"Save","routines.form.saving":"Saving…","routines.form.deleteText":"Deleting the routine also removes its {count} posts. They stay in git history.","routines.form.delete":"Delete routine","routines.form.deleteConfirm":'Delete the routine "{name}" and its {count} posts? They stay in git history.',"routines.form.daysRequired":"Pick at least one day.","routines.form.timesRequired":"Add at least one time.","routines.form.schedule":"Schedule","routines.form.kind.weekly":"Days and times","routines.form.kind.hourly":"Every few hours","routines.form.kind.once":"Once","routines.form.times":"Times","routines.form.newTime":"Time to add","routines.form.addTime":"Add time","routines.form.removeTime":"Remove {time}","routines.form.interval":"Interval","routines.form.everyHours":"Hours between runs","routines.form.everyHoursOption":"Every {n} h","routines.form.minute":"Minute","routines.form.startHour":"Start hour","routines.form.hourlyDaysHint":"Pick every day to run daily.","routines.form.when":"When","routines.form.date":"Date","routines.form.onceHint":"It runs once at that time and then turns itself off.","routines.form.quietHint":"If a run has nothing to report, the session starts its answer with [알림 없음] and no post is made.","inspector.label":"Inspector","inspector.views":"Inspector views","inspector.more":"More views","inspector.hide":"Hide inspector","inspector.show":"Show inspector","inspector.turn":"This turn","inspector.noTurn":"No turn yet.","inspector.backToChat":"Back to the conversation","workbench.places":"Places","workbench.runningCount":"{count} running","workbench.needsInput":"Needs input","workbench.needsInputCount":"{count} need input","navigator.group.input":"Needs input","navigator.group.running":"Running","navigator.group.done":"Finished"}}),o({id:"ko",label:"한국어",messages:s});var d=n(2730);let u="pi-locale",h=(0,i.createContext)(null);function p({children:e}){let[t,n]=(0,i.useState)("en"),[s,o]=(0,i.useState)(!1),m=(0,i.useMemo)(()=>c().map(e=>l.get(e)).filter(e=>!!e),[]),f=(0,i.useMemo)(()=>Object.fromEntries(c().flatMap(e=>{let t=l.get(e);return t?[[e,t.messages]]:[]})),[]);(0,i.useEffect)(()=>{let e=function(){var e;let t=null;try{t=window.localStorage.getItem(u)}catch{}let n=window.navigator.languages.length?window.navigator.languages:[window.navigator.language];return"string"==typeof(e=t)&&a.includes(e)?e:function(e){for(let t of e){let e=t.toLowerCase();if("en"===e||e.startsWith("en-"))return"en";if("ko"===e||e.startsWith("ko-"))break}return"ko"}(n)}();n(e),document.documentElement.lang=e,o(!0)},[]);let g=(0,i.useCallback)(e=>{if(l.get(e)){n(e),document.documentElement.lang=e;try{window.localStorage.setItem(u,e)}catch{}}},[]),x=(0,i.useCallback)((e,n)=>(0,d.u0)(t,e,f,n),[t,f]),v=(0,i.useMemo)(()=>({locale:s?t:"en",setLocale:g,t:x,supportedLocales:m}),[s,t,g,x,m]);return(0,r.jsx)(h.Provider,{value:v,children:e})}function m(){let e=(0,i.useContext)(h);if(!e)throw Error("useI18n must be used inside I18nProvider");return e}},89976:(e,t,n)=>{"use strict";n.d(t,{AppShell:()=>w6});var r=n(95155),i=n(12115),s=n(47650),a=n(73321),l=n(16871),o=n(66919),c=n(81886);let d=["chat","process","subagents","files","resource","sidechat","efficiency","plugins","memory"];Object.freeze({rail:60,transcript:560,composer:384,navigator:240,deck:372});let u=Object.freeze({navigator:860,deck:1232}),h=Object.freeze({activeView:"chat",transientLayer:null,deckExpanded:!1}),p=Object.fromEntries(d.map(e=>[e,!0]));function m(e){return"string"==typeof e&&!0===p[e]?e:h.activeView}function f(e,t){switch(t.type){case"select-view":{let n,r=m(t.view);return{activeView:r,transientLayer:null,deckExpanded:(n=!0===e.deckExpanded,"chat"!==r&&n)}}case"open-layer":{let n,r=m(e.activeView);return{activeView:r,transientLayer:t.layer,deckExpanded:(n=!0===e.deckExpanded,"chat"!==r&&n)}}case"toggle-layer":{let n,r=m(e.activeView);return{activeView:r,transientLayer:e.transientLayer===t.layer?null:t.layer,deckExpanded:(n=!0===e.deckExpanded,"chat"!==r&&n)}}case"close-layer":{let t,n=m(e.activeView);return{activeView:n,transientLayer:null,deckExpanded:(t=!0===e.deckExpanded,"chat"!==n&&t)}}case"set-deck-expanded":{let n,r=m(e.activeView);return{activeView:r,transientLayer:e.transientLayer,deckExpanded:(n=t.expanded,"chat"!==r&&n)}}}}function g(e){let t=Number.isFinite(e)?Math.max(0,e):0;return{availableWidth:t,navigator:t>=u.navigator?"pinned":"drawer",deck:t>=u.deck?"pinned":"view-stack"}}let x=null,v=!1,y=-1/0;function b(e,t=Date.now()){v=e,e||(y=t)}let w=["projects","priority"],k="omp-web:navigator-mode",j="omp-prio-on",S=["omp-relay-session-","omp-cwd-","ompscope_"],C="omp-web:session-opened-at";function N(e,t){if(e)try{let t=JSON.parse(e);if(t&&"object"==typeof t&&"number"==typeof t.since&&Number.isFinite(t.since)){let e={};if(t.opened&&"object"==typeof t.opened)for(let[n,r]of Object.entries(t.opened))"number"==typeof r&&Number.isFinite(r)&&(e[n]=r);return{since:t.since,opened:e}}}catch{}return{since:t,opened:{}}}function T(e,t){let n=null;for(let[r,i]of Object.entries(t.opened))(e.opened[r]??-1/0)>=i||((n??={...e.opened})[r]=i);return!n&&t.since>=e.since?e:{since:Math.min(e.since,t.since),opened:n??e.opened}}function I(e){let t=Date.parse(e.modified);return Number.isFinite(t)?t:null}function M(e,t,n){let r=Math.max(n,I(t)??0);return(e.opened[t.id]??-1/0)>=r?e:{since:e.since,opened:{...e.opened,[t.id]:r}}}let E=new Set;function R(e,t){let n=null;for(let r of t)Object.hasOwn(e.opened,r)&&(n??={...e.opened},delete n[r]);return n?{since:e.since,opened:n}:e}function $(e){let t=e.trim().replace(/\\/g,"/");return"/"===(t=t.startsWith("//")?`//${t.slice(2).replace(/\/{2,}/g,"/")}`:t.replace(/\/{2,}/g,"/"))||/^[a-zA-Z]:\/$/.test(t)||(t=t.replace(/\/+$/,"")),/^[a-zA-Z]:\//.test(t)||t.startsWith("//")?t.toLowerCase():t}function L(e){let t=new Map;for(let n of e){let e=n.projectRoot??n.cwd;if(!e)continue;let r=$(e),i=t.get(r);(!i||n.modified>i.modified)&&t.set(r,{project:e,modified:n.modified})}return[...t.values()].sort((e,t)=>t.modified.localeCompare(e.modified)).map(e=>e.project)}function P(e,t){let n=new Map;for(let e of t)"number"==typeof e.order&&Number.isFinite(e.order)&&n.set($(e.key),e.order);let r=[...e],i=new Set(e.map($));for(let e of t){let t=$(e.key);!t||i.has(t)||(r.push(e.path??e.key),i.add(t))}return r.map((e,t)=>({project:e,defaultIndex:t,order:n.get($(e))})).sort((e,t)=>{let n=void 0!==e.order,r=void 0!==t.order;return n!==r?n?-1:1:n&&r&&e.order!==t.order?e.order-t.order:e.defaultIndex-t.defaultIndex}).map(({project:e})=>e)}let A=/^<skill name="([^"\n]+)" location="([^"\n]+)">\nReferences are relative to [^\n]+\.\n\n([\s\S]*)\n<\/skill>(?:\n\n([\s\S]+))?$/;function _(e){let t=e.match(A);if(!t)return null;let[,n,,,r]=t;return r?`/skill:${n} ${r}`:`/skill:${n}`}var F=n(84183);let O=`(max-width: ${u.navigator-1}px)`;function z(e){return{subscribe(t){if(!window.matchMedia)return()=>{};let n=window.matchMedia(e);return n.addEventListener("change",t),()=>n.removeEventListener("change",t)},getSnapshot:()=>!!window.matchMedia&&window.matchMedia(e).matches}}let D=z("(max-width: 640px)"),W=z(O);function H(){return!1}function U(){return(0,i.useSyncExternalStore)(D.subscribe,D.getSnapshot,H)}var B=n(13004),q=n.n(B);async function V(e){let t=e?`?path=${encodeURIComponent(e)}`:"",n=await fetch(`/api/cwd/browse${t}`),r=await n.json();if(!n.ok||r.error)throw Error(r.error??`HTTP ${n.status}`);return r}function K(){return(0,r.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3","aria-hidden":"true",children:(0,r.jsx)("path",{d:"M1.5 3h4l1.5 2h7.5v7.5h-13z"})})}function G(){return(0,r.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,r.jsx)("rect",{x:"2",y:"3",width:"12",height:"10",rx:"1.5"}),(0,r.jsx)("path",{d:"M2 9h12"}),(0,r.jsx)("circle",{cx:"11.5",cy:"11",r:"0.6",fill:"currentColor",stroke:"none"})]})}function J({onCancel:e,onSelect:t,busy:n=!1,error:a}){let{t:l}=(0,F.s)(),[o,c]=(0,i.useState)(null),[d,u]=(0,i.useState)(""),[h,p]=(0,i.useState)(null),[m,f]=(0,i.useState)(!1),[g,x]=(0,i.useState)(""),[v,y]=(0,i.useState)([]),[b,w]=(0,i.useState)(null),[k,j]=(0,i.useState)(null),[S,C]=(0,i.useState)(!0),N=(0,i.useCallback)(async e=>{C(!0),j(null);try{let t=await V(e),n=t.path??e??"/";u(n),p(t.parentPath??null),f(!0===t.upToDrives),x(n),y(t.directories??[]),w(t.drives??null)}catch(e){j(e instanceof Error?e.message:String(e))}finally{C(!1)}},[]);(0,i.useEffect)(()=>{c(document.body),N()},[N]);let T=g.trim()!==d,I=!!d&&!T&&!n,M=!!h||m||/^[a-zA-Z]:[\\/]?$/.test(d);return o?(0,s.createPortal)((0,r.jsx)("div",{className:"directory-picker-backdrop",role:"dialog","aria-modal":"true","aria-label":l("directoryPicker.selectDirectory"),onClick:t=>{t.target!==t.currentTarget||n||e()},onKeyDown:t=>{"Escape"!==t.key||n||e()},style:{position:"fixed",inset:0,zIndex:1e3,display:"flex",alignItems:"center",justifyContent:"center",background:"var(--scrim)"},children:(0,r.jsxs)("div",{className:`directory-picker-panel ${q().sheet}`,style:{width:520,maxWidth:"calc(100vw - 16px)",height:"min(620px, calc(100dvh - 16px))",maxHeight:"calc(100dvh - 16px)",display:"flex",flexDirection:"column",overflow:"hidden"},children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",flexShrink:0,padding:"12px 18px"},children:[(0,r.jsx)("div",{style:{minWidth:0,flex:1},children:(0,r.jsx)("div",{style:{color:"var(--text)",fontWeight:700,fontSize:15},children:l("directoryPicker.selectDirectory")})}),(0,r.jsx)("button",{type:"button",onClick:e,disabled:n,title:l("i18n.close"),"aria-label":l("i18n.close"),className:q().btnQuiet,style:{fontSize:20,lineHeight:1},children:"\xd7"})]}),(0,r.jsxs)("form",{onSubmit:e=>{e.preventDefault();let t=g.trim();t&&N(t)},style:{display:"flex",alignItems:"center",gap:8,flexShrink:0,padding:"10px 14px"},children:[(0,r.jsx)("button",{className:`directory-picker-back ${q().btn}`,type:"button",onClick:()=>void N(h??void 0),disabled:S||!M,title:l("directoryPicker.goToParent"),"aria-label":l("directoryPicker.goToParent"),style:{width:36,height:36,padding:0,flexShrink:0,cursor:M?"pointer":"default"},children:(0,r.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,r.jsx)("path",{d:"m18 15-6-6-6 6"})})}),(0,r.jsx)("label",{htmlFor:"directory-path",style:{position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap"},children:l("directoryPicker.directoryPath")}),(0,r.jsx)("input",{className:`directory-picker-path ${q().field}`,id:"directory-path",type:"text",value:g,placeholder:"/path/to/project or ~/project",autoFocus:!0,autoComplete:"off",spellCheck:!1,onChange:e=>{x(e.target.value),j(null)},style:{minWidth:0,flex:1,height:36,fontFamily:"var(--font-mono)"}}),(0,r.jsx)("button",{className:`directory-picker-action ${q().btn}`,type:"submit",disabled:S||!g.trim(),title:l("directoryPicker.goToDirectory"),style:{minWidth:58,height:36},children:l("directoryPicker.go")})]}),(0,r.jsxs)("div",{className:"directory-picker-list",style:{flex:1,minHeight:0,overflow:"auto",padding:"8px 10px"},children:[S?(0,r.jsx)("div",{style:{padding:8,color:"var(--text-dim)",fontSize:11},children:l("directoryPicker.loadingDirectories")}):null!==b?(0,r.jsx)(r.Fragment,{children:b.length>0?b.map(e=>(0,r.jsxs)("button",{className:`directory-picker-entry ${q().navRow}`,type:"button",onClick:()=>void N(e.path),title:e.path,style:{minHeight:34,gap:7,padding:"6px 8px",color:"var(--text-muted)",fontFamily:"var(--font-mono)",fontSize:11},children:[(0,r.jsx)(G,{}),(0,r.jsx)("span",{children:e.name})]},e.path)):(0,r.jsx)("div",{style:{padding:8,color:"var(--text-dim)",fontSize:11},children:l("directoryPicker.noDrives")})}):v.length>0?v.map(e=>(0,r.jsxs)("button",{className:`directory-picker-entry ${q().navRow}`,type:"button",onClick:()=>void N(e.path),title:e.path,style:{minHeight:30,gap:7,padding:"5px 8px",color:"var(--text-muted)",fontFamily:"var(--font-mono)",fontSize:11},children:[(0,r.jsx)(K,{}),(0,r.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name})]},e.path)):(0,r.jsx)("div",{style:{padding:8,color:"var(--text-dim)",fontSize:11},children:l("directoryPicker.noSubdirectories")}),(k||a)&&(0,r.jsx)("div",{style:{padding:"8px",color:"var(--danger)",fontSize:11},children:k??a})]}),(0,r.jsxs)("div",{className:"directory-picker-footer",style:{display:"flex",justifyContent:"flex-end",alignItems:"center",gap:10,flexShrink:0,padding:"10px 18px"},children:[(0,r.jsx)("button",{className:`directory-picker-action ${q().btn}`,type:"button",onClick:e,disabled:n,style:{padding:"6px 14px",fontSize:13},children:l("i18n.cancel")}),(0,r.jsx)("button",{className:`directory-picker-action ${q().btnPrimary}`,type:"button",onClick:()=>t(d),disabled:!I,title:l(T?"directoryPicker.openBeforeSelecting":"directoryPicker.selectCurrentDirectory"),style:{padding:"6px 16px",fontSize:13},children:l(n?"i18n.checking":"directoryPicker.selectThisFolder")})]})]})}),o):null}var Y=n(21443),Z=n.n(Y);async function Q(e,t){let n=await fetch(e,t?{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}:void 0),r=await n.json();if(!n.ok)throw Error(r.error||`HTTP ${n.status}`);return r}function X({onCancel:e,onSelect:t,busy:n=!1,error:a}){let{t:l}=(0,F.s)(),o=(0,i.useRef)(null),[c,d]=(0,i.useState)(!1),[u,h]=(0,i.useState)(!1),[p,m]=(0,i.useState)(null),[f,g]=(0,i.useState)([]),[x,v]=(0,i.useState)(""),[y,b]=(0,i.useState)(""),[w,k]=(0,i.useState)(!0),[j,S]=(0,i.useState)(!1),[C,N]=(0,i.useState)(!1),[T,I]=(0,i.useState)(null),[M,E]=(0,i.useState)(!1),[R,$]=(0,i.useState)(50),L=p?.device?.state==="pending",P=n||C,A=(0,i.useCallback)(async()=>{k(!0),I(null);try{let e=await Q("/api/github/projects");m(e),e.connected&&g((await Q("/api/github/projects?view=repositories")).repositories)}catch(e){I(e instanceof Error?e.message:String(e))}finally{k(!1)}},[]);async function _(){S(!0),I(null);try{let{device:e}=await Q("/api/github/projects",{action:"login"});m({connected:!1,login:null,device:e})}catch(e){I(e instanceof Error?e.message:String(e))}finally{S(!1)}}async function O(e){if(e.preventDefault(),y.trim()&&!P){N(!0),I(null);try{let{cwd:e}=await Q("/api/github/projects",{action:"open",repository:y});t(e)}catch(e){I(e instanceof Error?e.message:String(e))}finally{N(!1)}}}if((0,i.useEffect)(()=>{d(!0),A()},[A]),(0,i.useEffect)(()=>{if(!c||u)return;let e=o.current;return e?.showModal(),()=>e?.close()},[c,u]),(0,i.useEffect)(()=>{let e;if(!L||u)return;let t=!1,n=async()=>{try{let e=await Q("/api/github/projects");if(t)return;if(m(e),e.connected)return void await A();if(e.device?.state!=="pending")return}catch(e){t||I(e instanceof Error?e.message:String(e));return}t||(e=window.setTimeout(n,3e3))};return e=window.setTimeout(n,1500),()=>{t=!0,clearTimeout(e)}},[L,u,A]),!c)return null;if(u)return(0,r.jsx)(J,{onCancel:()=>h(!1),onSelect:t,busy:n,error:a});let z=f.filter(e=>`${e.fullName} ${e.description??""}`.toLowerCase().includes(x.toLowerCase())),D=T??a??p?.device?.error;return(0,s.createPortal)((0,r.jsx)("dialog",{ref:o,className:Z().dialog,"aria-labelledby":"cloud-project-title",onCancel:t=>{t.preventDefault(),P||e()},children:(0,r.jsxs)("form",{onSubmit:O,className:Z().form,children:[(0,r.jsxs)("header",{className:Z().header,children:[(0,r.jsx)("h2",{id:"cloud-project-title",children:l("cloudProjects.title")}),(0,r.jsx)("p",{children:l("cloudProjects.description")})]}),(0,r.jsxs)("div",{className:Z().sources,children:[(0,r.jsx)("span",{className:Z().activeSource,children:l("cloudProjects.github")}),(0,r.jsx)("button",{type:"button",onClick:()=>h(!0),disabled:P,children:l("cloudProjects.serverFolder")})]}),(0,r.jsxs)("div",{className:Z().body,children:[(0,r.jsxs)("section",{className:Z().account,"aria-label":l("cloudProjects.account"),children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("strong",{children:p?.connected?p.login:l("cloudProjects.connectTitle")}),(0,r.jsx)("p",{children:p?.connected?l("cloudProjects.connected"):l("cloudProjects.connectHelp")})]}),p?.connected?(0,r.jsx)("button",{type:"button",className:Z().secondary,onClick:()=>void A(),disabled:w||P,children:l("cloudProjects.refresh")}):(0,r.jsx)("button",{type:"button",className:Z().secondary,onClick:()=>void _(),disabled:w||j||L||P,children:j||L?l("cloudProjects.waiting"):l("cloudProjects.connect")})]}),L&&(0,r.jsxs)("div",{className:Z().login,role:"status",children:[(0,r.jsx)("p",{children:l("cloudProjects.deviceHelp")}),p.device?.code?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:Z().codeRow,children:[(0,r.jsx)("code",{children:p.device.code}),(0,r.jsx)("button",{type:"button",className:Z().secondary,onClick:()=>{navigator.clipboard.writeText(p.device.code).then(()=>E(!0)).catch(()=>I(l("cloudProjects.copyFailure")))},children:M?l("cloudProjects.copied"):l("cloudProjects.copyCode")})]}),(0,r.jsx)("a",{href:"https://github.com/login/device",target:"_blank",rel:"noreferrer",className:Z().loginLink,children:l("cloudProjects.openLogin")}),(0,r.jsx)("small",{children:l("cloudProjects.permissionHelp")})]}):(0,r.jsx)("p",{children:l("cloudProjects.preparingCode")})]}),p?.connected&&(0,r.jsxs)("section",{className:Z().repositories,"aria-label":l("cloudProjects.repositories"),children:[(0,r.jsx)("label",{htmlFor:"cloud-repo-search",children:l("cloudProjects.search")}),(0,r.jsx)("input",{id:"cloud-repo-search",value:x,onChange:e=>{v(e.target.value),$(50)},placeholder:l("cloudProjects.searchPlaceholder"),type:"search",disabled:P}),w?(0,r.jsx)("p",{role:"status",children:l("cloudProjects.loading")}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("ul",{className:Z().list,children:z.slice(0,R).map(e=>(0,r.jsx)("li",{children:(0,r.jsxs)("button",{type:"button",className:Z().repo,"aria-pressed":y===e.fullName,disabled:P,onClick:()=>b(e.fullName),children:[(0,r.jsxs)("span",{className:Z().repoHeading,children:[(0,r.jsx)("strong",{children:e.fullName}),(0,r.jsx)("small",{children:e.private?l("cloudProjects.private"):l("cloudProjects.public")})]}),e.description&&(0,r.jsx)("span",{className:Z().repoDescription,children:e.description})]})},e.fullName))}),!z.length&&(0,r.jsx)("p",{children:l("cloudProjects.empty")}),z.length>R&&(0,r.jsx)("button",{type:"button",className:Z().secondary,onClick:()=>$(e=>e+50),children:l("cloudProjects.more")})]})]}),(0,r.jsxs)("div",{className:Z().repositoryInput,children:[(0,r.jsx)("label",{htmlFor:"cloud-repository",children:l("cloudProjects.urlLabel")}),(0,r.jsx)("input",{id:"cloud-repository",value:y,onChange:e=>b(e.target.value),placeholder:"owner/repository",autoComplete:"off",spellCheck:!1,disabled:P,"aria-describedby":"cloud-repo-help"}),(0,r.jsx)("small",{id:"cloud-repo-help",children:l("cloudProjects.publicHelp")})]}),D&&(0,r.jsxs)("div",{className:Z().error,role:"alert",children:[(0,r.jsx)("strong",{children:l("cloudProjects.error")}),(0,r.jsx)("p",{children:D}),(0,r.jsx)("button",{type:"button",className:Z().secondary,onClick:()=>void A(),disabled:P,children:l("cloudProjects.refresh")})]}),C&&(0,r.jsx)("p",{role:"status",className:Z().progress,children:l("cloudProjects.openingHelp")})]}),(0,r.jsxs)("footer",{className:Z().footer,children:[(0,r.jsx)("button",{type:"button",className:Z().secondary,onClick:e,disabled:P,children:l("i18n.cancel")}),(0,r.jsx)("button",{type:"submit",className:Z().primary,disabled:P||!y.trim(),children:P?l("cloudProjects.opening"):l("cloudProjects.open")})]})]})}),document.body)}function ee({label:e="CUELO",markSize:t=22,gap:n=10,style:i,labelStyle:s}){return(0,r.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:n,minWidth:0,color:"var(--text)",...i},children:[(0,r.jsxs)("svg",{viewBox:"0 0 100 100",width:t,height:t,"aria-hidden":"true",style:{flexShrink:0},children:[(0,r.jsx)("path",{d:"M77.9 30.5 A34 34 0 0 0 16 50 A26 26 0 0 0 68 50",fill:"none",stroke:"currentColor",strokeWidth:"10",strokeLinecap:"round"}),(0,r.jsx)("circle",{cx:"42",cy:"50",r:"8.5",fill:"var(--brand-lamp)"})]}),(0,r.jsx)("span",{style:{minWidth:0,overflow:"hidden",color:"inherit",fontFamily:"var(--font-heading)",fontSize:15,fontWeight:700,letterSpacing:"-0.025em",whiteSpace:"nowrap",...s},children:e})]})}var et=n(2730);let en={ko:{"translator.modeVoice":"대화","translator.modeType":"타자","translator.source":"입력 언어","translator.swapDirection":"방향 바꾸기","translator.typeLabel":"번역할 문장","translator.typePlaceholder":"여행 중 전할 말을 입력하세요.","translator.typeSubmit":"번역","translator.typePending":"번역 중…","translator.typeError":"번역하지 못했어요. 다시 시도해 주세요.","translator.typeAuth":"Codex 로그인 상태를 확인해 주세요.","translator.tab":"통역","translator.title":"통역","translator.back":"대화로","translator.panelHint":"통역을 시작하면 ChatGPT 계정의 Codex 라이브가 두 사람의 말을 서로의 언어로 바로 소리 내어 옮깁니다. 작업 세션과 하네스 규칙을 거치지 않고, 기록은 저장하지 않습니다.","translator.open":"통역 화면 열기","translator.me":"나","translator.them":"상대","translator.myLanguage":"내 언어","translator.theirLanguage":"상대 언어","translator.swap":"두 언어 바꾸기","translator.clear":"지우기","translator.start":"통역 시작","translator.stop":"통역 끝내기","translator.empty":"통역 시작을 누르고 폰을 두 사람 사이에 두세요. 누가 말하든 상대 언어로 바로 옮겨 말합니다.","translator.connecting":"연결 중…","translator.live":"듣는 중 \xb7 그냥 말하세요","translator.unsupported":"이 브라우저는 실시간 통화(WebRTC\xb7마이크)를 지원하지 않습니다. 폰에서는 Chrome이나 Safari로 여세요.","translator.insecure":"마이크는 HTTPS 주소에서만 켜집니다.","translator.micDenied":"마이크 권한이 막혀 있습니다. 브라우저 설정에서 이 주소의 마이크를 허용하세요.","translator.micUnavailable":"마이크를 켜지 못했습니다. 다른 앱이 쓰고 있지 않은지 확인하세요.","translator.auth":"Codex 로그인이 없거나 만료됐습니다. 모델 설정에서 ChatGPT 계정으로 다시 로그인하세요.","translator.upstream":"Codex 라이브 연결이 끊겼습니다: {error}","translator.failed":"통역을 시작하지 못했습니다: {error}","translator.original":"원문","translator.translationPending":"통역 중…","translator.conversation":"통역 기록","translator.mood":"분위기","translator.mood.casual":"편하게","translator.mood.polite":"정중하게","translator.mood.formal":"격식 있게","translator.mood.haggling":"흥정","translator.mood.urgent":"긴급","translator.gender":"내 성별","translator.gender.male":"남성","translator.gender.female":"여성","translator.age":"내 나이대","translator.age.20s":"20대","translator.age.30s":"30대","translator.age.40s":"40대","translator.age.50s":"50대","translator.age.60s":"60대 이상","translator.partnerGender":"상대 성별","translator.partnerAge":"상대 나이","translator.partnerAge.child":"아이","translator.partnerAge.younger":"나보다 어리거나 비슷","translator.partnerAge.older":"나보다 위","translator.partnerAge.parent":"부모님 또래","translator.partnerAge.grandparent":"조부모님 또래","translator.notSet":"선택 안 함","translator.face":"마주보기","translator.faceHint":"상대 쪽 자막을 뒤집어 마주 앉은 사람이 읽게 합니다","translator.reconnecting":"다시 연결 중…","translator.idleStopped":"한동안 대화가 없어 통역을 멈췄습니다. 다시 시작하면 앞 대화에 이어집니다.","translator.generationSkipped":"방금 말은 통역하지 못하고 넘어갔습니다. 이어서 말씀하시면 계속 통역합니다.","translator.setup":"언어\xb7상황 설정","translator.sizeDown":"글자 작게","translator.sizeUp":"글자 크게","translator.faceExit":"마주보기 끄기","translator.translating":"옮기는 중…","translator.errorStatus":"통역이 멈췄습니다","translator.translation":"통역","translator.unknownLanguage":"언어 모름","translator.jumpLatest":"최근 말로","translator.voice":"통역 음성 듣기","translator.voiceHint":"끄면 통역을 글로만 보여 줍니다. 스피커가 조용하니 마이크를 막지 않아 통역 중에 끼어든 말도 들립니다.","translator.echoGuard":"통역 음성이 나올 때 마이크 끄기","translator.echoGuardHint":"스피커로 나온 통역이 다시 통역되지 않게 합니다. 그동안 상대가 한 말은 들리지 않으니 이어폰을 쓰면 꺼 두세요.","translator.noiseSuppression":"AI 소음 제거","translator.fastDrafts":"빠른 초안 자막","translator.fastDraftsHint":"전용 번역 모델이 초안 자막을 먼저 띄우고 Codex가 곧 바로잡습니다. 켜 둔 동안 추가 요금이 들 수 있습니다.","translator.noiseSuppressionHint":"시끄러운 곳에서 마이크 소음을 줄여 통역이 말을 더 잘 알아듣게 합니다. 목소리가 뭉개지면 꺼 두세요."},en:{"translator.modeVoice":"Voice","translator.modeType":"Type","translator.source":"Input language","translator.swapDirection":"Swap direction","translator.typeLabel":"Text to translate","translator.typePlaceholder":"Type what you want to say.","translator.typeSubmit":"Translate","translator.typePending":"Translating…","translator.typeError":"Translation failed. Try again.","translator.typeAuth":"Check your Codex sign-in.","translator.tab":"Interpret","translator.title":"Interpreter","translator.back":"Back to chat","translator.panelHint":"Start interpreting and Codex Live on your ChatGPT account speaks each person's words in the other's language right away. It bypasses work sessions and harness rules, and nothing is saved.","translator.open":"Open interpreter","translator.me":"Me","translator.them":"Them","translator.myLanguage":"My language","translator.theirLanguage":"Their language","translator.swap":"Swap languages","translator.clear":"Clear","translator.start":"Start interpreting","translator.stop":"Stop interpreting","translator.empty":"Press Start interpreting and put the phone between you. Whoever speaks is interpreted into the other language right away.","translator.connecting":"Connecting…","translator.live":"Listening \xb7 just talk","translator.unsupported":"This browser cannot make live calls (WebRTC and microphone). On a phone, open this page in Chrome or Safari.","translator.insecure":"The microphone only works on an HTTPS address.","translator.micDenied":"Microphone access is blocked. Allow the microphone for this address in the browser settings.","translator.micUnavailable":"The microphone could not be opened. Check that no other app is using it.","translator.auth":"The Codex sign-in is missing or expired. Sign in again with your ChatGPT account in model settings.","translator.upstream":"The Codex live connection dropped: {error}","translator.failed":"Interpreting could not start: {error}","translator.original":"Original","translator.translationPending":"Interpreting…","translator.conversation":"Interpretation log","translator.mood":"Mood","translator.mood.casual":"Casual","translator.mood.polite":"Polite","translator.mood.formal":"Formal","translator.mood.haggling":"Haggling","translator.mood.urgent":"Urgent","translator.gender":"My gender","translator.gender.male":"Male","translator.gender.female":"Female","translator.age":"My age","translator.age.20s":"20s","translator.age.30s":"30s","translator.age.40s":"40s","translator.age.50s":"50s","translator.age.60s":"60+","translator.partnerGender":"Their gender","translator.partnerAge":"Their age","translator.partnerAge.child":"Child","translator.partnerAge.younger":"Younger or same age","translator.partnerAge.older":"Older than me","translator.partnerAge.parent":"My parents' age","translator.partnerAge.grandparent":"My grandparents' age","translator.notSet":"Not set","translator.face":"Face to face","translator.faceHint":"Flip the other side's captions so the person across from you can read them","translator.reconnecting":"Reconnecting…","translator.idleStopped":"Interpreting stopped after a long silence. Start again to continue the conversation.","translator.generationSkipped":"That last line couldn't be interpreted and was skipped. Keep talking; interpreting continues.","translator.setup":"Languages and setting","translator.sizeDown":"Smaller text","translator.sizeUp":"Larger text","translator.faceExit":"Leave face to face","translator.translating":"Interpreting…","translator.errorStatus":"Interpreting stopped","translator.translation":"Interpretation","translator.unknownLanguage":"Language unknown","translator.jumpLatest":"Jump to latest","translator.voice":"Play the interpretation aloud","translator.voiceHint":"Off, the interpretation is shown as text only. With the speaker silent the mic stays open, so words spoken over an interpretation are heard too.","translator.echoGuard":"Mute the mic while the interpretation plays","translator.echoGuardHint":"Keeps the speaker's interpretation from being interpreted again. Words spoken meanwhile are not heard, so turn it off with earphones.","translator.noiseSuppression":"AI noise suppression","translator.fastDrafts":"Quick draft captions","translator.fastDraftsHint":"A dedicated translation model shows a quick draft first and Codex corrects it. Extra charges may apply while this is on.","translator.noiseSuppressionHint":"Cuts background noise from the mic in a loud place so the interpreter hears you better. Turn it off if your voice sounds muffled."}};function er(){let{locale:e}=(0,F.s)();return{tt:(0,i.useCallback)((t,n)=>(0,et.u0)(e,t,en,n),[e]),locale:e}}let ei={en:{issueLabel:"GitHub issue (optional)",issuePlaceholder:"#123 or GitHub issue URL",issueStart:"Start issue session",issueBusy:"Starting…",fallbackBase:"Fetch failed; started from local {branch}"},ko:{issueLabel:"GitHub 이슈 (선택)",issuePlaceholder:"#123 또는 GitHub 이슈 URL",issueStart:"이슈 세션 시작",issueBusy:"시작 중…",fallbackBase:"가져오기 실패; 로컬 {branch}에서 시작됨"},zh:{issueLabel:"GitHub Issue(可选)",issuePlaceholder:"#123 或 GitHub Issue URL",issueStart:"开始 Issue 会话",issueBusy:"正在启动…",fallbackBase:"拉取失败;已从本地 {branch} 启动"}},es={en:"The subdirectory {path} is not in this worktree; opened its root instead",ko:"이 워크트리에 하위 디렉터리 {path}이(가) 없어 루트 디렉터리를 대신 열었습니다",zh:"此工作树中不存在子目录 {path},已改为打开其根目录"};function ea(e,t){if(t)try{sessionStorage.setItem(`cuelo:worktree:${e}`,JSON.stringify(t))}catch{}}let el="omp-web:unread-session-ids",eo="omp-web:pinned-session-ids",ec="omp-web:removed-projects";function ed(e,t){return{minHeight:t?44:30,padding:"3px 10px",border:0,borderRadius:"var(--radius-control)",background:"var(--bg-hover)",color:e?"var(--text-dim)":"var(--text-muted)",cursor:e?"default":"pointer",fontSize:"var(--seed-font-size-t2-static)",lineHeight:1.3,textAlign:"left",whiteSpace:"normal",overflowWrap:"anywhere"}}function eu(e,t){return t&&e.startsWith(t)?"~"+e.slice(t.length):e}function eh({text:e,style:t}){return(0,r.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block",minWidth:0,lineHeight:1.35,direction:"rtl",textAlign:"left",...t},children:(0,r.jsx)("span",{style:{unicodeBidi:"plaintext"},children:e})})}function ep({open:e,children:t,style:n}){let[s,a]=(0,i.useState)(e),[l,o]=(0,i.useState)(e);return((0,i.useEffect)(()=>{let t,n;return e?(a(!0),o(!1),t=window.requestAnimationFrame(()=>{t=window.requestAnimationFrame(()=>o(!0))})):(o(!1),n=setTimeout(()=>a(!1),140)),()=>{void 0!==t&&window.cancelAnimationFrame(t),n&&clearTimeout(n)}},[e]),s)?(0,r.jsx)("div",{style:{...n,opacity:+!!l,transform:l?"translateY(0) scale(1)":"translateY(-8px) scale(0.96)",transformOrigin:"top center",transition:"opacity 140ms ease, transform 140ms ease",pointerEvents:e?"auto":"none"},children:t}):null}let em="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*";function ef(){let[e,t]=(0,i.useState)(!1),[n,s]=(0,i.useState)(!1),a=(0,i.useRef)(null),l=function(e,t){let[n,r]=(0,i.useState)(e),s=(0,i.useRef)(null),a=(0,i.useRef)(0);return(0,i.useEffect)(()=>{if(!t)return void r(e);a.current=0;let n=4*e.length,i=()=>{a.current+=1;let t=Math.floor(a.current/n*e.length);r(e.split("").map((e,n)=>" "===e?" ":n<t?e:em[Math.floor(Math.random()*em.length)]).join("")),a.current<n?s.current=requestAnimationFrame(i):r(e)};return s.current=requestAnimationFrame(i),()=>{s.current&&cancelAnimationFrame(s.current)}},[e,t]),n}(e?"0.10.271/18.20.2":"CUELO",n),o=(0,i.useCallback)(e=>{t(e),s(!0),setTimeout(()=>s(!1),(e?6:8)*4*(1e3/60)+100)},[]),c=(0,i.useCallback)(()=>{a.current&&clearTimeout(a.current);let t=!e;o(t),t&&(a.current=setTimeout(()=>o(!1),3e3))},[e,o]);return(0,i.useEffect)(()=>()=>{a.current&&clearTimeout(a.current)},[]),(0,r.jsx)("button",{className:"navigator-brand",onClick:c,style:{display:"flex",alignItems:"center",background:"none",border:"none",padding:0,cursor:"default",color:e?"var(--accent)":"var(--text)",flex:"0 1 auto",minWidth:0,overflow:"hidden"},children:(0,r.jsx)(ee,{label:l,labelStyle:e?{fontFamily:"var(--font-mono)",fontSize:12,letterSpacing:"-0.02em",textOverflow:"ellipsis"}:void 0})})}async function eg(e){let t=await fetch("/api/projects",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({updates:e})});if(!t.ok)throw Error(`HTTP ${t.status}`)}function ex({selectedSessionId:e,optimisticSession:t,onSelectSession:n,onNewSession:s,initialSessionId:a,skipInitialProjectSelection:l,onInitialRestoreDone:o,refreshKey:c,onSessionDeleted:d,selectedCwd:u,onCwdChange:h,onBackgroundTaskDone:p,translatorPanel:m,translatorActive:f=!1,routinePanel:g,routineActive:x=!1,navigatorMode:v="projects",onActivityChange:y}){let b,{tt:w}=er(),{t:k,locale:j}=(0,F.s)(),A=U(),[_,O]=(0,i.useState)([]),z=(0,i.useMemo)(()=>t&&!_.some(e=>e.id===t.id)?[t,..._]:_,[_,t]),[D,W]=(0,i.useState)(!0),[H,B]=(0,i.useState)(null),[q,V]=(0,i.useState)(null),[K,G]=(0,i.useState)(""),[Y,Z]=(0,i.useState)(!1),[Q,ee]=(0,i.useState)(""),[et,en]=(0,i.useState)(()=>new Set),[em,ey]=(0,i.useState)(()=>new Set),[ej,eS]=(0,i.useState)(null),[eC,eT]=(0,i.useState)(null),[eI,eM]=(0,i.useState)({version:1,projects:[]}),[eE,eR]=(0,i.useState)(!1),[e$,eL]=(0,i.useState)(!1),[eP,eA]=(0,i.useState)(!1),[e_,eF]=(0,i.useState)(null),[eO,ez]=(0,i.useState)(""),[eD,eW]=(0,i.useState)(!1),[eH,eU]=(0,i.useState)(null),[eB,eq]=(0,i.useState)(""),[eV,eK]=(0,i.useState)(!1),[eG,eJ]=(0,i.useState)(null),[eY,eZ]=(0,i.useState)(!1),[eQ,eX]=(0,i.useState)(null),[e0,e1]=(0,i.useState)(!1),[e2,e8]=(0,i.useState)(!1),[e4,e5]=(0,i.useState)(""),[e6,e3]=(0,i.useState)(null),[e7,e9]=(0,i.useState)(""),[te,tt]=(0,i.useState)(!1),[tn,tr]=(0,i.useState)(null),ti=(0,i.useRef)(null),[ts,ta]=(0,i.useState)(!1),[tl,to]=(0,i.useState)(null),tc=(0,i.useRef)(null),td=(0,i.useRef)(null),tu=(0,i.useRef)(null),th=(0,i.useRef)(!1),tp=(0,i.useRef)(!1),[tm,tf]=(0,i.useState)(!1),[tg,tx]=(0,i.useState)(()=>new Set),[tv,ty]=(0,i.useState)(()=>new Set),[tb,tw]=(0,i.useState)(()=>(function(){try{let e=window.localStorage.getItem(el);if(!e)return new Set;let t=JSON.parse(e);if(Array.isArray(t))return new Set(t.filter(e=>"string"==typeof e));return new Set}catch{return new Set}})()),[tk,tj]=(0,i.useState)(()=>new Set),[tS,tC]=(0,i.useState)(null),[tN,tT]=(0,i.useState)(!1),tI=(0,i.useRef)(new Set),tM=(0,i.useRef)(!1),tE=(0,i.useRef)(null);(0,i.useEffect)(()=>{tj(function(){try{let e=window.localStorage.getItem(eo);if(!e)return new Set;let t=JSON.parse(e);return Array.isArray(t)?new Set(t.filter(e=>"string"==typeof e)):new Set}catch{return new Set}}())},[]),(0,i.useEffect)(()=>{let e=null;try{e=window.localStorage.getItem(C)}catch{}tC(N(e,Date.now()));let t=e=>{if(e.key!==C||null===e.newValue)return;let t=N(e.newValue,Date.now());tC(e=>e?T(e,t):e)};return window.addEventListener("storage",t),()=>window.removeEventListener("storage",t)},[]);let tR=(0,i.useCallback)(async()=>{try{let e=await fetch("/api/projects",{cache:"no-store",signal:AbortSignal.timeout(5e3)});if(!e.ok)throw Error(`HTTP ${e.status}`);eM(await e.json())}catch{eM({version:1,projects:[]})}finally{eR(!0)}},[]);(0,i.useEffect)(()=>{tR()},[tR,c]),(0,i.useEffect)(()=>{let e=null;try{e=window.localStorage.getItem(ec)}catch{return}if(!e)return;let t=[];try{let n=JSON.parse(e);Array.isArray(n)&&(t=n.filter(e=>"string"==typeof e))}catch{t=[]}(async()=>{try{for(let e=0;e<t.length;e+=500){let n=t.slice(e,e+500);await eg(n.map(e=>({key:$(e),path:e,hidden:!0})))}}catch{return}try{window.localStorage.removeItem(ec)}catch{}await tR()})()},[tR]);let t$=(0,i.useCallback)(async e=>{if(tp.current)throw Error("Project update in progress");tp.current=!0,eW(!0);try{await eg(e),await tR()}finally{tp.current=!1,eW(!1)}},[tR]);(0,i.useEffect)(()=>{e_&&tu.current?.select()},[e_]);let tL=(0,i.useCallback)(async(e=!1,t=!1)=>{try{e&&W(!0);let n=await fetch(t?"/api/sessions?force=1":"/api/sessions",{cache:"no-store"});if(!n.ok)throw Error(`HTTP ${n.status}`);let r=await n.json();O(r.sessions),tM.current||tx(new Set(r.runningSessionIds??[])),B(null),e||(tf(!0),tE.current&&clearTimeout(tE.current),tE.current=setTimeout(()=>tf(!1),2e3))}catch(e){B(String(e))}finally{e&&W(!1)}},[]),tP=(0,i.useCallback)(e=>{tw(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n}),tj(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n}),tC(t=>t&&R(t,[e])),d?.(e),tL()},[tL,d]),[tA,t_]=(0,i.useState)(null),[tF,tO]=(0,i.useState)(!1),[tz,tD]=(0,i.useState)(null),tW=(0,i.useCallback)(()=>{tF||(t_(null),tD(null))},[tF]),tH=(0,i.useCallback)(async e=>{tO(!0),tD(null);let t=[],n=[],r=[];for(let i of e)if(!i.transient)try{let e=await fetch(`/api/sessions/${encodeURIComponent(i.id)}?skipRunning=1`,{method:"DELETE"});if(409===e.status){n.push(i.id);continue}if(!e.ok)throw Error(`HTTP ${e.status}`);t.push(i.id)}catch{r.push(i.name?.trim()||i.id.slice(0,8))}if(n.length>0&&(tM.current=!0,tx(e=>{if(n.every(t=>e.has(t)))return e;let t=new Set(e);for(let e of n)t.add(e);return t})),t.length>0){let e=new Set(t),n=n=>t.some(e=>n.has(e))?new Set([...n].filter(t=>!e.has(t))):n;for(let e of(tw(n),tj(n),tC(e=>e&&R(e,t)),t))d?.(e)}(await tL(),tO(!1),r.length>0)?tD(k("sidebar.clearSessionsFailed",{count:r.length,names:r.join(", ")})):n.length>0||t_(null)},[tL,d,k]),[tU,tB]=(0,i.useState)(0),tq=(0,i.useCallback)(()=>{tB(e=>e+1),tL()},[tL]),tV=(0,i.useRef)(!1);(0,i.useEffect)(()=>{let e=!tV.current;tV.current=!0,tL(e,!e)},[tL,c]),(0,i.useEffect)(()=>{if("priority"!==v)return;let e=()=>{"visible"===document.visibilityState&&tL(!1,!0)};e();let t=window.setInterval(e,15e3);return()=>window.clearInterval(t)},[tL,v]),(0,i.useEffect)(()=>{y?.({running:tg.size,waiting:_.filter(e=>tv.has(e.id))})},[_,y,tg,tv]),(0,i.useEffect)(()=>{try{0===tb.size?window.localStorage.removeItem(el):window.localStorage.setItem(el,JSON.stringify([...tb]))}catch{}},[tb]),(0,i.useEffect)(()=>{try{0===tk.size?window.localStorage.removeItem(eo):window.localStorage.setItem(eo,JSON.stringify([...tk]))}catch{}},[tk]),(0,i.useEffect)(()=>{if(tS)try{var e,t,n;let r,i,s=window.localStorage;s.setItem(C,(e=s.getItem(C),t=Date.now(),i=(r=Object.entries((n=T(tS,N(e,t))).opened)).length>500?r.sort((e,t)=>t[1]-e[1]).slice(0,500):r,JSON.stringify({since:n.since,opened:Object.fromEntries(i)})))}catch{}},[tS]);let tK=(0,i.useCallback)(e=>{tj(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]);(0,i.useEffect)(()=>{let e=!1,t=null,n=null,r=()=>{t&&clearTimeout(t),t=null},i=async()=>{if(e||"visible"!==document.visibilityState)return;let s=new AbortController;n?.abort(),n=s;try{let t=await fetch("/api/agent/running",{cache:"no-store",signal:s.signal});if(!t.ok)return;let r=await t.json();if(e||n!==s)return;tM.current=!0,tx(new Set(r.runningSessionIds??[])),ty(new Set(r.waitingSessionIds??[]))}catch{}finally{n===s&&(n=null),r(),e||"visible"!==document.visibilityState||(t=setTimeout(()=>void i(),2500))}},s=()=>{"visible"===document.visibilityState?i():(r(),n?.abort(),n=null)};return i(),document.addEventListener("visibilitychange",s),()=>{e=!0,r(),n?.abort(),document.removeEventListener("visibilitychange",s)}},[]),(0,i.useEffect)(()=>{let t=tI.current,n=[...t].filter(t=>!tg.has(t)&&t!==e),r=[...tg].filter(e=>!t.has(e));(n.length>0||r.length>0)&&tw(e=>{let t=new Set(e);return tg.forEach(e=>t.delete(e)),n.forEach(e=>t.add(e)),t});let i=r.some(e=>!_.some(t=>t.id===e));(n.length>0||i)&&tL(!1,!0),n.length>0&&p?.(),tI.current=tg},[tg,e,_,tL,p]),(0,i.useEffect)(()=>{e&&tw(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n})},[e]);let tG=e?z.find(t=>t.id===e)?.modified:void 0,tJ=null!==tS;(0,i.useEffect)(()=>{e&&void 0!==tG&&tJ&&tC(t=>t&&M(t,{id:e,modified:tG},Date.now()))},[e,tG,tJ]),(0,i.useEffect)(()=>{fetch("/api/home").then(e=>e.json()).then(e=>{e.home&&G(e.home),Z(!0===e.cloudProjects)}).catch(()=>{})},[]);let tY=(0,i.useRef)(!1),tZ=(0,i.useCallback)(e=>{if(!e)return null;if(eQ&&eQ.forCwd===e||eQ?.worktrees.some(t=>t.path===e))return eQ.projectRoot;let t=z.find(t=>t.cwd===e);return t?.projectRoot??e},[eQ,z]),tQ=(0,i.useRef)(null);(0,i.useEffect)(()=>{tQ.current!==q&&(tQ.current=q,h?.(q,tZ(q)))},[q,h,tZ]);let tX=(0,i.useRef)(null);(0,i.useEffect)(()=>{u&&u!==tX.current&&(tX.current=u,V(u))},[u]);let[t0,t1]=(0,i.useState)(0);(0,i.useLayoutEffect)(()=>{if(!q)return void eX(null);let e=!1;return fetch(`/api/worktrees?cwd=${encodeURIComponent(q)}`).then(e=>e.json()).then(t=>{if(!e){if(t.error||!t.projectRoot)return void eX(null);eX({forCwd:q,projectRoot:t.projectRoot,isGit:t.isGit??!1,isTopLevel:t.isTopLevel??!1,worktrees:t.worktrees??[]})}}).catch(()=>{e||eX(null)}),()=>{e=!0}},[q,t0,c]),(0,i.useEffect)(()=>{if(0!==_.length&&!l&&null===q){if(a&&!tY.current){tY.current=!0;let e=_.find(e=>e.id===a);if(e){V(e.cwd),n(e,!0);return}o?.()}if(!eE)return;let e=new Map(eI.projects.map(e=>[e.key,e])),t=P(_.length>0?L(_):[],eI.projects).filter(t=>!e.get($(t))?.hidden);t.length>0&&V(t[0])}},[_,q,a,l,n,o,eI,eE]);let t2=(0,i.useCallback)(async e=>{let t=e.trim();if(t&&!eY){eZ(!0),eJ(null);try{let e=await fetch("/api/cwd/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:t})}),n=await e.json().catch(()=>({}));if(!e.ok||n.error)return void eJ(n.error??k("workspace.unable"));let r=n.cwd??t,i=$(r),s=eI.projects.find(e=>e.key===i);if(s?.hidden===!0)try{await t$([{key:i,path:r,hidden:!1}])}catch{}V(r),eK(!1)}catch{eJ(k("workspace.unable"))}finally{eZ(!1)}}},[t$,eY,eI.projects,k]),t8=(0,i.useCallback)(()=>{eK(!0),eJ(null)},[]),t4=(0,i.useCallback)(async()=>{let e=e4.trim();if(e&&!ts&&eQ){ta(!0),e3(null);try{let t=await fetch("/api/worktrees",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:eQ.projectRoot,branch:e})}),n=await t.json().catch(()=>({}));if(!t.ok||n.error||!n.path)return void e3(n.error??`HTTP ${t.status}`);e8(!1),e5(""),e1(!1),eX(t=>t?{...t,forCwd:n.path,worktrees:[...t.worktrees,{path:n.path,branch:e,isMain:!1}]}:t),V(n.path),t1(e=>e+1)}catch(e){e3(e instanceof Error?e.message:String(e))}finally{ta(!1)}}},[e4,ts,eQ]),t5=(0,i.useCallback)(async(e,t)=>{if(eQ&&!ts){ta(!0),e3(null);try{let n=await fetch("/api/worktrees",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:eQ.projectRoot,path:e,force:t})}),r=await n.json().catch(()=>({}));if(!n.ok){if(r.dirty&&!t)return void to(e);e3(r.error??`HTTP ${n.status}`);return}to(null),q===e&&V(eQ.projectRoot),t1(e=>e+1)}catch(e){e3(e instanceof Error?e.message:String(e))}finally{ta(!1)}}},[eQ,ts,q]);(0,i.useEffect)(()=>{let e=e=>{tc.current&&!tc.current.contains(e.target)&&(eT(null),e1(!1),e8(!1),e5(""),e3(null),to(null),eq(""),eS(null))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let t6=(0,i.useCallback)(e=>{e.cwd&&V(e.cwd),n(e)},[n]),t3=(0,i.useCallback)((e=q)=>{if(!e)return;let t="function"==typeof crypto.randomUUID?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}-${Math.random().toString(36).slice(2)}`;V(e),s?.(t,e)},[q,s]),t7=(0,i.useCallback)(async()=>{let e=eQ?.projectRoot,t=e7.trim();if(!e||!t||te)return;tt(!0),tr(null);let r=ti.current,i=r?.issue===t&&r.cwd===e?r.id:"function"==typeof crypto.randomUUID?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}-${Math.random().toString(36).slice(2)}`;ti.current={issue:t,cwd:e,id:i};try{let r=await fetch("/api/agent/new",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e,issue:t,type:"ensure_session",createRequestId:i})}),s=await r.json();if(!r.ok||!s.sessionId||!s.cwd)throw Error(s.error??`HTTP ${r.status}`);ea(s.cwd,s.worktree),ti.current=null,e9(""),V(s.cwd),t1(e=>e+1),n({id:s.sessionId,cwd:s.cwd,projectRoot:e,path:"",created:new Date().toISOString(),modified:new Date().toISOString(),messageCount:0,firstMessage:"(no messages)",transient:!0})}catch(e){tr(e instanceof Error?e.message:String(e))}finally{tt(!1)}},[eQ,e7,te,n]),[t9,ne]=(0,i.useState)(!1),[nt,nn]=(0,i.useState)(null),nr=(0,i.useCallback)(async()=>{ne(!0),nn(null);try{let e=await fetch("/api/default-cwd",{method:"POST"}),t=await e.json().catch(()=>({}));if(!e.ok||!t.cwd)throw Error(t.error??`HTTP ${e.status}`);t3(t.cwd)}catch(e){nn(k("sidebar.newScratchSessionFailed",{error:e instanceof Error?e.message:String(e)}))}finally{ne(!1)}},[t3,k]),ni=(0,i.useCallback)(e=>{ey(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),ns=tZ(q),na=null===ns?null:$(ns),nl=(0,i.useMemo)(()=>new Map(eI.projects.map(e=>[e.key,e])),[eI.projects]),no=L(z);if(null!==ns){let e=$(ns);no.some(t=>$(t)===e)||no.unshift(ns)}let nc=P(no,eI.projects),nd=nc.filter(e=>e$||!nl.get($(e))?.hidden),nu=nc.some(e=>nl.get($(e))?.hidden),nh=()=>{eT(null),e1(!1),e8(!1),e5(""),e3(null),to(null),eq("")},np=async(e,t)=>{nh();try{await t$([{key:$(e),path:e,hidden:t}]),t&&na&&na===$(e)&&V(null),t||nc.some(t=>$(t)!==$(e)&&nl.get($(t))?.hidden)||eL(!1)}catch{}},nm=async e=>{if(th.current){th.current=!1,eF(null);return}let t=eO.trim();if(t===(nl.get($(e))?.alias??""))return void eF(null);eU(null);try{await t$([{key:$(e),path:e,alias:t||null}]),eF(null)}catch{eU(k("sidebar.projectUpdateFailed"))}},nf=async(e,t)=>{if(Q)return;let n=nd.indexOf(e),r=n+t;if(n<0||r<0||r>=nd.length)return;let i=new Set(nd),s=nc.map((e,t)=>i.has(e)?t:-1).filter(e=>e>=0),a=[...nc],l=s[n],o=s[r];[a[l],a[o]]=[a[o],a[l]],nh();try{await t$(a.map((e,t)=>({key:$(e),path:e,order:t})))}catch{}},ng=new Map;for(let e of z){let t=e.projectRoot??e.cwd;if(!t)continue;let n=$(t),r=ng.get(n);r?r.push(e):ng.set(n,[e])}let nx=(0,i.useMemo)(()=>{let e=new Map;for(let t of z){let n=t.projectRoot??t.cwd;if(!n)continue;let r=$(n),i=e.get(r);i||(i={running:0,unread:0},e.set(r,i)),tg.has(t.id)&&i.running++,tb.has(t.id)&&i.unread++}return e},[z,tg,tb]),nv=Q.trim().toLowerCase(),ny=Q.length>0,nb=nd.flatMap(e=>{let t=e.replace(/[\\/]+$/,"").split(/[\\/]/).at(-1)||e,n=$(e),r=nl.get(n),i=r?.alias??t,s=(ng.get(n)??[]).slice().sort((e,t)=>{let n=Number(tk.has(t.id))-Number(tk.has(e.id));return 0!==n?n:t.modified.localeCompare(e.modified)});if(!nv)return[{project:e,key:n,name:i,sessions:s,hidden:r?.hidden===!0}];let a=i.toLowerCase().includes(nv)||t.toLowerCase().includes(nv),l=s.filter(e=>(e.name||e.firstMessage.slice(0,50)||e.id.slice(0,12)).toLowerCase().includes(nv));return a||0!==l.length?[{project:e,key:n,name:i,sessions:a?s:l,hidden:r?.hidden===!0}]:[]}),nw=[],nk=[];for(let e of nb){let t=e.key===na||(nx.get(e.key)?.running??0)>0;(function(e){let t=e.trim().replace(/\\/g,"/").toLowerCase();return!!(/^[a-z]:\/?$/.test(t)||"/"===t||/(^|\/)appdata\/local\/temp(\/|$)/.test(t)||/^\/(?:var\/|private\/)?tmp(?:\/|$)/.test(t)||/^[a-z]:\/(?:tmp|temp)(?:\/|$)/.test(t)||/(^|\/)(?:users|home)\/[^/]+\/\.omp(\/|$)/.test(t))||t.split("/").some(e=>S.some(t=>e.startsWith(t)))})(e.project)&&!t?nk.push(e):nw.push(e)}let nj={running:0,unread:0};for(let e of nk){let t=nx.get(e.key);t&&(nj.running+=t.running,nj.unread+=t.unread)}let nS=ny||eP,nC=[...nw.map(e=>({kind:"project",group:e})),...nk.length>0?[{kind:"temporary"}]:[],...nS?nk.map(e=>({kind:"project",group:e})):[]],nN=function(e){let t=new Map;for(let n of e){let e=n.toLowerCase();t.set(e,(t.get(e)??0)+1)}return new Set([...t].filter(([,e])=>e>1).map(([e])=>e))}(nC.flatMap(e=>"project"===e.kind?[e.group.name]:[])),nT=(0,i.useMemo)(()=>tS?z.filter(e=>(function(e,t,n,r=E){if(e.transient||e.trial)return!1;if(r.has(e.id))return!0;if(t.has(e.id))return!1;let i=I(e);return null!==i&&i>(n.opened[e.id]??n.since)})(e,tg,tS,tv)):[],[tS,tg,z,tv]),nI=tN&&null!==tS,[nM,nE]=(0,i.useState)(null),nR=(0,i.useMemo)(()=>(function(e,t,n,r,i="Priority",s=new Set,a="Pinned",l=10){let o=e.filter(e=>!e.transient).slice().sort((e,t)=>{let n=Date.parse(e.modified),r=Date.parse(t.modified);return(Number.isFinite(r)?r:0)-(Number.isFinite(n)?n:0)}),c=o.filter(e=>s.has(e.id)),d=[],u=new Map,h=0;for(let e of o){if(s.has(e.id))continue;if(t.has(e.id)){d.push(e);continue}let n=new Date(e.modified);if(h>=l)continue;h+=1;let r=[n.getFullYear(),String(n.getMonth()+1).padStart(2,"0"),String(n.getDate()).padStart(2,"0")].join("-"),i=u.get(r);i?i.push(e):u.set(r,[e])}let p=[];for(let e of(c.length>0&&p.push({key:"pinned",label:a,running:!1,sessions:c}),d.length>0&&p.push({key:"priority",label:i,running:!0,sessions:d}),[...u.keys()].sort().reverse()))p.push({key:e,label:function(e,t,n){let[r,i,s]=e.split("-").map(Number),a=new Date(r,i-1,s),l=Math.round((Date.UTC(t.getFullYear(),t.getMonth(),t.getDate())-Date.UTC(a.getFullYear(),a.getMonth(),a.getDate()))/864e5);return 0===l||1===l?new Intl.RelativeTimeFormat(n,{numeric:"auto"}).format(-l,"day"):l>=0&&l<7?new Intl.DateTimeFormat(n,{weekday:"long"}).format(a):new Intl.DateTimeFormat(n,{month:"short",day:"numeric"}).format(a)}(e,n,r),running:!1,sessions:u.get(e)??[]});return p})(nI?z.filter(e=>e.id===nM&&!tg.has(e.id)||nT.includes(e)):z,tg,new Date,j,k("navigator.priority"),tk,k("sidebar.pinned"),nI?1/0:void 0),[nM,j,tk,nT,nI,tg,z,k]),n$=(0,i.useMemo)(()=>{let e=new Set(nT.map(e=>e.id)),t=[],n=[],r=[],i=null,s=[];for(let a of nR)if("pinned"===a.key){let s=a.sessions.filter(i=>{if(tv.has(i.id))t.push(i);else if(tg.has(i.id))n.push(i);else{if(!e.has(i.id))return!0;r.push(i)}return!1});s.length>0&&(i={...a,sessions:s})}else if(a.running)for(let e of a.sessions)(tv.has(e.id)?t:n).push(e);else{let t=a.sessions.filter(t=>!e.has(t.id)||(r.push(t),!1));t.length>0&&s.push({...a,sessions:t})}let a=[];return t.length>0&&a.push({key:"input",kind:"input",label:k("navigator.group.input"),sessions:t}),n.length>0&&a.push({key:"running",kind:"running",label:k("navigator.group.running"),sessions:n}),r.length>0&&a.push({key:"review",kind:"review",label:k("navigator.resultsToCheck"),sessions:r}),i&&a.push({key:"pinned",kind:"pinned",label:i.label,sessions:i.sessions}),s.forEach((e,t)=>a.push({key:e.key,kind:"done",label:e.label,heading:0===t?k("navigator.group.done"):void 0,sessions:e.sessions})),a},[nR,nT,tg,k,tv]),nL=(0,i.useCallback)(e=>{nE(e.id),t6(e)},[t6]),nP=!!(eQ?.isGit&&eQ.isTopLevel&&q&&ns===eQ.projectRoot),nA=eQ?.worktrees.find(e=>e.path===q)??eQ?.worktrees.find(e=>e.isMain),n_=(eQ?.worktrees.length??0)>=8,nF=n_&&eB.trim()?(eQ?.worktrees??[]).filter(e=>(e.branch??eu(e.path,K)).toLowerCase().includes(eB.trim().toLowerCase())):eQ?.worktrees??[],nO=ei[j.startsWith("ko")?"ko":j.startsWith("zh")?"zh":"en"],nz=function(e){if(e&&"u">typeof sessionStorage)try{return JSON.parse(sessionStorage.getItem(`cuelo:worktree:${e}`)??"null")??void 0}catch{return}}(q),nD=(()=>{if(!tA)return[];let e="project"===tA.kind?ng.get($(tA.project))??[]:nR.flatMap(e=>e.sessions),t=new Set;return e.filter(e=>!(e.transient||t.has(e.id))&&(t.add(e.id),!0))})(),nW=nD.filter(e=>!tg.has(e.id)),nH=e=>{let t=new Set;for(let n of e)n.transient||tg.has(n.id)||t.has(n.id)||t.add(n.id);return t.size},nU=void 0!==m&&f,nB=void 0!==g&&x,nq=nU||nB;return(0,r.jsxs)("div",{className:"session-navigator",tabIndex:-1,style:{display:"flex",flexDirection:"column",height:"100%",overflow:"hidden",outline:"none"},children:[eV&&(0,r.jsx)(Y?X:J,{busy:eY,error:eG,onCancel:()=>{eK(!1),eJ(null)},onSelect:e=>void t2(e)}),tA&&(0,r.jsx)(ev,{scope:tA,eligible:nW.length,runningExcluded:nD.length-nW.length,busy:tF,error:tz,onCancel:tW,onConfirm:()=>void tH(nW)}),(0,r.jsxs)("div",{className:"session-navigator-header",style:{padding:"4px 10px",flexShrink:0},children:[(0,r.jsxs)("div",{className:"session-navigator-titlebar",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[(0,r.jsx)(ef,{}),(0,r.jsxs)("div",{style:{display:"flex",gap:12},children:[(0,r.jsx)("button",{className:"navigator-icon-action",onClick:()=>t3(),disabled:!q,style:{display:"flex",alignItems:"center",justifyContent:"center",background:"var(--bg-hover)",border:0,color:q?"var(--text-muted)":"var(--text-dim)",cursor:q?"pointer":"not-allowed",width:32,height:32,padding:0,borderRadius:"var(--radius-control)",fontSize:12,flexShrink:0,transition:"background 0.12s, color 0.12s"},title:q?k("sidebar.newSessionTitle",{path:q}):k("sidebar.selectProject"),"aria-label":q?k("sidebar.newSessionTitle",{path:q}):k("sidebar.selectProject"),onMouseEnter:e=>{q&&(e.currentTarget.style.background="var(--bg-selected)",e.currentTarget.style.color="var(--accent)")},onMouseLeave:e=>{e.currentTarget.style.background="var(--bg-hover)",e.currentTarget.style.color=q?"var(--text-muted)":"var(--text-dim)"},children:(0,r.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round","aria-hidden":"true",children:[(0,r.jsx)("line",{x1:"6",y1:"1",x2:"6",y2:"11"}),(0,r.jsx)("line",{x1:"1",y1:"6",x2:"11",y2:"6"})]})}),(0,r.jsx)("button",{className:`navigator-icon-action${tm?" is-success":""}`,onClick:()=>tL(!1,!0),style:{display:"flex",alignItems:"center",justifyContent:"center",background:tm?"var(--success-soft)":"var(--bg-hover)",border:0,color:tm?"var(--success)":"var(--text-muted)",cursor:"pointer",width:32,height:32,borderRadius:"var(--radius-control)",padding:0,flexShrink:0,transition:"background 0.3s, color 0.3s"},onMouseEnter:e=>{tm||(e.currentTarget.style.background="var(--bg-selected)",e.currentTarget.style.color="var(--accent)")},onMouseLeave:e=>{tm||(e.currentTarget.style.background="var(--bg-hover)",e.currentTarget.style.color="var(--text-muted)")},title:k("sidebar.refresh"),children:tm?(0,r.jsx)("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"var(--success)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,r.jsx)("polyline",{points:"20 6 9 17 4 12"})}):(0,r.jsxs)("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,r.jsx)("path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}),(0,r.jsx)("path",{d:"M3 3v5h5"})]})})]})]}),nP&&(0,r.jsxs)("form",{onSubmit:e=>{e.preventDefault(),t7()},style:{marginTop:8},children:[(0,r.jsx)("label",{htmlFor:"session-issue",style:{display:"block",fontSize:12,color:"var(--text-muted)"},children:nO.issueLabel}),(0,r.jsxs)("div",{style:{display:"flex",gap:4,marginTop:4},children:[(0,r.jsx)("input",{id:"session-issue",value:e7,disabled:te,onChange:e=>{e9(e.target.value),tr(null)},placeholder:nO.issuePlaceholder,"aria-describedby":tn?"session-issue-error":void 0,"aria-invalid":!!tn,style:{minWidth:0,flex:1,padding:"6px 8px",fontSize:12,background:"var(--bg)",color:"var(--text)",border:0,borderRadius:"var(--radius-control)"}}),(0,r.jsx)("button",{type:"submit",disabled:te||!e7.trim(),title:nO.issueStart,"aria-label":nO.issueStart,style:{minWidth:32,padding:"4px 8px",border:0,borderRadius:"var(--radius-control)",background:"var(--bg-hover)",color:"var(--text)",cursor:te?"wait":"pointer"},children:te?"…":"↵"})]}),te&&(0,r.jsx)("div",{role:"status",style:{fontSize:12},children:nO.issueBusy}),tn&&(0,r.jsx)("div",{id:"session-issue-error",role:"alert",style:{fontSize:12,color:"var(--danger)",overflowWrap:"anywhere"},children:tn})]}),(nz||nA&&!nA.isMain)&&(0,r.jsxs)("div",{role:"status",title:q??void 0,style:{marginTop:4,fontSize:12,color:"var(--text-muted)",overflowWrap:"anywhere"},children:[nz?.branch??nA?.branch,nz?.fallback&&(0,r.jsx)("div",{children:nO.fallbackBase.replace("{branch}",nz.base)}),nz?.missingSubdirectory&&(0,r.jsx)("div",{children:es[j.startsWith("ko")?"ko":j.startsWith("zh")?"zh":"en"].replace("{path}",nz.missingSubdirectory)})]})]}),Y&&!nq&&(0,r.jsx)("button",{type:"button",className:"navigator-cloud-project",onClick:t8,style:{margin:"10px 12px 0",minHeight:44,flexShrink:0,border:0,borderRadius:"var(--radius-control)",background:"var(--bg)",color:"var(--text)",fontSize:13,fontWeight:600,cursor:"pointer"},children:k("cloudProjects.launch")}),(0,r.jsxs)("div",{className:"navigator-mode-bar",children:[(0,r.jsx)("h2",{className:"navigator-place-title",children:nU?w("translator.tab"):nB?k("routines.tab"):"projects"===v?k("sidebar.projects"):k("navigator.priority")}),(0,r.jsx)("span",{className:"navigator-mode-spacer"}),!nq&&"projects"===v&&(0,r.jsx)("button",{type:"button",onClick:()=>eL(e=>!e),disabled:!nu,title:k("sidebar.projectShowHidden"),"aria-label":k("sidebar.projectShowHidden"),"aria-pressed":e$,style:{display:"flex",alignItems:"center",justifyContent:"center",width:26,height:26,padding:0,border:"none",borderRadius:"var(--radius-control)",background:e$?"var(--bg-selected)":"transparent",color:e$?"var(--accent)":"var(--text-dim)",cursor:nu?"pointer":"default",opacity:nu?1:.45,flexShrink:0},children:(0,r.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,r.jsx)("path",{d:"M2.5 12s3.5-6 9.5-6 9.5 6 9.5 6-3.5 6-9.5 6-9.5-6-9.5-6Z"}),(0,r.jsx)("circle",{cx:"12",cy:"12",r:"2.5"}),!e$&&(0,r.jsx)("path",{d:"m4 4 16 16"})]})}),!nq&&"projects"===v&&(0,r.jsx)("button",{className:"navigator-add-project",type:"button",onClick:t8,title:k("sidebar.addProject"),"aria-label":k("sidebar.addProject"),style:{display:"flex",alignItems:"center",justifyContent:"center",width:28,height:28,padding:0,border:"none",borderRadius:"var(--radius-control)",background:"var(--bg-hover)",color:"var(--text-muted)",cursor:"pointer",transition:"background 0.12s, color 0.12s"},onMouseEnter:e=>{e.currentTarget.style.background="var(--bg-hover)",e.currentTarget.style.color="var(--text)"},onMouseLeave:e=>{e.currentTarget.style.background="var(--bg-hover)",e.currentTarget.style.color="var(--text-muted)"},children:(0,r.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,r.jsx)("path",{d:"M3 7.5A2.5 2.5 0 0 1 5.5 5H9l2 2h7.5A2.5 2.5 0 0 1 21 9.5v7A2.5 2.5 0 0 1 18.5 19h-13A2.5 2.5 0 0 1 3 16.5v-9Z"}),(0,r.jsx)("path",{d:"M15.5 10.5v5M13 13h5"})]})})]}),nU&&m,nB&&g,!nq&&"projects"===v&&(0,r.jsxs)("label",{className:"navigator-search",style:{position:"relative",display:"block",margin:"0 8px 8px"},children:[(0,r.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",style:{position:"absolute",left:10,top:"50%",transform:"translateY(-50%)",color:"var(--text-dim)",pointerEvents:"none"},children:[(0,r.jsx)("circle",{cx:"11",cy:"11",r:"7"}),(0,r.jsx)("path",{d:"m20 20-3.5-3.5"})]}),(0,r.jsx)("input",{className:"navigator-search-input",type:"search",value:Q,onChange:e=>ee(e.target.value),onKeyDown:e=>{"Escape"===e.key&&(e.preventDefault(),ee(""),e.currentTarget.blur())},placeholder:k("sidebar.searchProjectsAndSessions"),"aria-label":k("sidebar.searchProjectsAndSessions"),style:{width:"100%",height:34,padding:"0 10px 0 32px",border:0,borderRadius:"var(--radius-control)",outline:"none",background:"var(--bg-hover)",color:"var(--text)",fontFamily:"var(--font-mono)",fontSize:11}})]}),!nq&&"projects"===v&&(0,r.jsxs)("div",{id:"navigator-projects-panel",className:"navigator-session-list",style:{flex:"1 1 auto",overflowY:"auto",minHeight:80,padding:"0 6px 10px"},children:[(D||!eE)&&(0,r.jsx)("div",{style:{padding:"12px 8px",color:"var(--text-muted)",fontSize:12},children:k("sidebar.loading")}),H&&(0,r.jsx)("div",{style:{padding:"10px 8px",color:"var(--danger)",fontSize:12},children:H}),eH&&(0,r.jsx)("div",{style:{padding:"10px 8px",color:"var(--danger)",fontSize:12},children:eH}),!D&&eE&&!H&&0===nb.length&&(0,r.jsx)("div",{style:{padding:"12px 8px",color:"var(--text-muted)",fontSize:12},children:nv?k("sidebar.noMatchingProjects"):k("sidebar.noSessions")}),!D&&eE&&!H&&nC.map(t=>{let n,i,s;if("temporary"===t.kind)return(0,r.jsx)("div",{className:"navigator-project-group",children:(0,r.jsxs)("button",{type:"button",className:"navigator-project-row","aria-expanded":nS,title:k("sidebar.temporaryProjects"),onClick:()=>eA(e=>!e),style:{display:"flex",alignItems:"center",gap:6,width:"100%",minHeight:34,padding:"0 6px 0 2px",border:"none",background:"transparent",color:"var(--text-muted)",cursor:"pointer",textAlign:"left",fontSize:"var(--seed-font-size-t2-static)",fontWeight:600},children:[(0,r.jsx)("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:24,height:28,flexShrink:0,color:"var(--text-dim)"},children:(0,r.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{transform:nS?"rotate(0deg)":"rotate(-90deg)",transition:"transform 0.12s"},children:(0,r.jsx)("polyline",{points:"2.5 4 6 7.5 9.5 4"})})}),(0,r.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:k("sidebar.temporaryProjects")}),(0,r.jsx)("span",{style:{color:"var(--text-muted)",fontFamily:"var(--font-mono)",fontSize:11,flexShrink:0},children:nk.length}),eN(nj,k)]})},"navigator-temporary-projects");let{project:a,key:l,name:o,sessions:c,hidden:d}=t.group,u=l===na,h=nN.has(o.toLowerCase())&&eu((i=Math.max((n=a.trim().replace(/[\\/]+$/,"")).lastIndexOf("\\"),n.lastIndexOf("/")))<=0?"":n.slice(0,i),K)||null,p=!em.has(a)&&!nv,m=et.has(a),f=e_===a,g=nd.indexOf(a),x=eD||ny||g<=0,v=eD||ny||g>=nd.length-1,y=function(e){let t=new Map;for(let n of e)t.set(n.id,{session:n,children:[]});let n=new Map;for(let t of e)t.parentSessionId&&n.set(t.id,t.parentSessionId);let r=[];for(let e of t.values()){let i=function(e){let r=n.get(e),i=new Set;for(;r&&!i.has(r);){if(i.add(r),t.has(r))return r;r=n.get(r)}return null}(e.session.id);i?t.get(i).children.push(e):r.push(e)}let i=e=>{e.sort((e,t)=>t.session.modified.localeCompare(e.session.modified)),e.forEach(e=>i(e.children))};return i(r),r}(m?c:c.slice(0,5)),b=c.length>5;return(0,r.jsxs)("section",{className:"navigator-project-group",style:{marginBottom:p?3:9},children:[(0,r.jsxs)("div",{className:`navigator-project-row${u?" is-selected":""}`,ref:eC===a?tc:void 0,onMouseEnter:()=>eS(a),onMouseLeave:()=>eS(e=>e===a&&eC!==a?null:e),style:{display:"flex",alignItems:"center",minHeight:34,position:"relative",borderRadius:"var(--radius-control)",background:u?"var(--bg-hover)":"transparent",opacity:d?.55:1},children:[(0,r.jsx)("button",{type:"button",onClick:()=>ni(a),title:p?k("sidebar.expandProject"):k("sidebar.collapseProject"),"aria-label":p?k("sidebar.expandProject"):k("sidebar.collapseProject"),"aria-expanded":!p,style:{display:"flex",alignItems:"center",justifyContent:"center",width:24,height:28,marginLeft:2,padding:0,border:"none",background:"transparent",color:"var(--text-dim)",cursor:"pointer",flexShrink:0},children:(0,r.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{transform:p?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.12s"},children:(0,r.jsx)("polyline",{points:"2.5 4 6 7.5 9.5 4"})})}),f?(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,flex:1,minWidth:0,height:34,padding:"0 4px"},children:[(0,r.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{flexShrink:0,color:"var(--accent)"},children:(0,r.jsx)("path",{d:"M3 7.5A2.5 2.5 0 0 1 5.5 5H9l2 2h7.5A2.5 2.5 0 0 1 21 9.5v7A2.5 2.5 0 0 1 18.5 19h-13A2.5 2.5 0 0 1 3 16.5v-9Z"})}),(0,r.jsx)("input",{ref:tu,value:eO,onChange:e=>ez(e.target.value),onBlur:()=>void nm(a),onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),e.currentTarget.blur()):"Escape"===e.key&&(e.preventDefault(),th.current=!0,eF(null))},"aria-label":k("sidebar.projectAlias"),style:{flex:1,minWidth:0,height:24,padding:"2px 6px",border:0,borderRadius:"var(--radius-control)",outline:"none",background:"var(--bg)",color:"var(--text)",fontFamily:"var(--font-mono)",fontSize:12,fontWeight:600}})]}):(0,r.jsxs)("button",{className:"navigator-project-name",type:"button",onClick:()=>V(a),title:a,style:{display:"flex",alignItems:"center",gap:8,flex:1,minWidth:0,height:34,padding:"0 4px",border:"none",background:"transparent",color:u?"var(--text)":"var(--text-muted)",cursor:"pointer",textAlign:"left",fontSize:12.5,fontWeight:u?600:500},children:[(0,r.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{flexShrink:0,color:u?"var(--accent)":"var(--text-dim)"},children:(0,r.jsx)("path",{d:"M3 7.5A2.5 2.5 0 0 1 5.5 5H9l2 2h7.5A2.5 2.5 0 0 1 21 9.5v7A2.5 2.5 0 0 1 18.5 19h-13A2.5 2.5 0 0 1 3 16.5v-9Z"})}),(0,r.jsx)("span",{style:{flexShrink:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o}),null===h?null:(0,r.jsx)("span",{style:{flexShrink:2,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"var(--text-dim)",fontFamily:"var(--font-mono)",fontSize:10},children:h}),eN(nx.get(l),k)]}),!A&&(0,r.jsx)("button",{type:"button",onClick:()=>t3(a),title:k("sidebar.newSessionTitle",{path:a}),"aria-label":k("sidebar.newSessionTitle",{path:a}),style:{display:"flex",alignItems:"center",justifyContent:"center",width:28,height:28,padding:0,border:"none",borderRadius:"var(--radius-control)",background:"transparent",color:"var(--text-dim)",cursor:"pointer",opacity:+(ej===a),pointerEvents:ej===a?"auto":"none",transition:"opacity 0.12s, background 0.12s, color 0.12s",flexShrink:0},onFocus:()=>eS(a),onMouseEnter:e=>{e.currentTarget.style.background="var(--bg-selected)",e.currentTarget.style.color="var(--accent)"},onMouseLeave:e=>{e.currentTarget.style.background="transparent",e.currentTarget.style.color="var(--text-dim)"},children:(0,r.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round","aria-hidden":"true",children:[(0,r.jsx)("line",{x1:"6",y1:"1.5",x2:"6",y2:"10.5"}),(0,r.jsx)("line",{x1:"1.5",y1:"6",x2:"10.5",y2:"6"})]})}),(0,r.jsxs)("div",{style:{position:"static",flexShrink:0},children:[(0,r.jsx)("button",{type:"button",onClick:()=>{eT(eC===a?null:a),e1(!1),e8(!1),e3(null),u||V(a)},title:k("sidebar.projectActions"),"aria-label":k("sidebar.projectActions"),"aria-expanded":eC===a,style:{display:"flex",alignItems:"center",justifyContent:"center",width:26,height:26,marginRight:3,padding:0,border:"none",borderRadius:"var(--radius-control)",background:eC===a?"var(--bg-selected)":"transparent",color:u&&nA&&!nA.isMain?"var(--accent)":"var(--text-dim)",cursor:"pointer",opacity:A||ej===a||eC===a?1:0,pointerEvents:A||ej===a||eC===a?"auto":"none",transition:"opacity 0.12s, background 0.12s, color 0.12s"},onFocus:()=>eS(a),children:(0,r.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"currentColor","aria-hidden":"true",children:[(0,r.jsx)("circle",{cx:"3",cy:"7",r:"1.1"}),(0,r.jsx)("circle",{cx:"7",cy:"7",r:"1.1"}),(0,r.jsx)("circle",{cx:"11",cy:"7",r:"1.1"})]})}),(0,r.jsxs)(ep,{open:eC===a,style:{position:"absolute",top:"calc(100% + 4px)",right:3,width:"min(260px, calc(100vw - 24px))",zIndex:110,background:"var(--bg-raised)",border:0,borderRadius:"var(--radius-surface)",boxShadow:"var(--shadow-float)",boxSizing:"border-box",overflow:"hidden"},children:[A&&(0,r.jsxs)("button",{type:"button",className:"navigator-project-menu-new-session",onClick:()=>{eT(null),t3(a)},title:k("sidebar.newSessionTitle",{path:a}),style:{display:"flex",alignItems:"center",gap:8,width:"100%",minHeight:44,padding:"0 10px",border:"none",background:"transparent",color:"var(--text)",cursor:"pointer",textAlign:"left",fontSize:13},children:[(0,r.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round","aria-hidden":"true",children:[(0,r.jsx)("line",{x1:"6",y1:"1.5",x2:"6",y2:"10.5"}),(0,r.jsx)("line",{x1:"1.5",y1:"6",x2:"10.5",y2:"6"})]}),k("i18n.newSession")]}),nP&&eQ&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("button",{type:"button",onClick:()=>e1(e=>!e),title:nA?k("sidebar.switchWorktreeTitle",{path:nA.path}):k("sidebar.switchWorktree"),"aria-label":k("sidebar.worktrees"),"aria-expanded":e0,style:{display:"flex",alignItems:"center",gap:8,width:"100%",minHeight:34,padding:"0 10px",border:"none",background:e0?"var(--bg-selected)":"transparent",color:"var(--text-muted)",cursor:"pointer",textAlign:"left",fontSize:11},children:[(0,r.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,r.jsx)("line",{x1:"6",y1:"3",x2:"6",y2:"15"}),(0,r.jsx)("circle",{cx:"18",cy:"6",r:"3"}),(0,r.jsx)("circle",{cx:"6",cy:"18",r:"3"}),(0,r.jsx)("path",{d:"M18 9a9 9 0 0 1-9 9"})]}),(0,r.jsx)("span",{style:{flex:1},children:k("sidebar.worktrees")}),(0,r.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,r.jsx)("polyline",{points:"4 2.5 8 6 4 9.5"})})]}),(0,r.jsxs)(ep,{open:e0,style:{position:"static",width:"auto",zIndex:100,background:"var(--bg)",border:"none",borderRadius:0,boxShadow:"none",boxSizing:"border-box",overflow:"hidden"},children:[n_&&(0,r.jsx)("div",{style:{padding:"6px 8px"},children:(0,r.jsx)("input",{value:eB,onChange:e=>eq(e.target.value),onKeyDown:e=>{"Escape"===e.key&&(eq(""),e1(!1))},placeholder:k("sidebar.filterWorktrees"),autoFocus:!0,style:{width:"100%",fontSize:11,fontFamily:"var(--font-mono)",padding:"5px 8px",border:0,borderRadius:"var(--radius-control)",outline:"none",background:"var(--bg-subtle)",color:"var(--text)",boxSizing:"border-box"}})}),(0,r.jsxs)("div",{style:{maxHeight:"min(40vh, 300px)",overflowY:"auto"},children:[nF.map(e=>{let t=e.path===q||e.isMain&&!eQ.worktrees.some(e=>e.path===q);return tl===e.path?(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"7px 10px",background:"var(--danger-soft)"},children:[(0,r.jsx)("span",{style:{flex:1,fontSize:11,color:"var(--text)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:k("sidebar.forceRemoveCheckout")}),(0,r.jsx)("button",{onClick:()=>void t5(e.path,!0),disabled:ts,style:{padding:"3px 9px",background:"var(--danger)",border:"none",borderRadius:"var(--radius-control)",color:"var(--bg)",fontSize:11,fontWeight:600,cursor:"pointer",flexShrink:0},children:k("sidebar.force")}),(0,r.jsx)("button",{onClick:()=>to(null),style:{padding:"3px 9px",background:"var(--bg-hover)",border:0,borderRadius:"var(--radius-control)",color:"var(--text-muted)",fontSize:11,cursor:"pointer",flexShrink:0},children:k("sidebar.cancel")})]},e.path):(0,r.jsxs)("div",{className:"wt-row",style:{display:"flex",alignItems:"center"},children:[(0,r.jsxs)("button",{onClick:()=>{V(e.path),e1(!1),e3(null),eq("")},title:e.path,style:{flex:1,minWidth:0,display:"flex",alignItems:"center",gap:7,padding:"8px 10px",background:"var(--bg)",border:"none",color:t?"var(--text)":"var(--text-muted)",cursor:"pointer",textAlign:"left",fontSize:11,fontFamily:"var(--font-mono)"},children:[t?(0,r.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:(0,r.jsx)("polyline",{points:"1.5 5 4 7.5 8.5 2.5"})}):(0,r.jsx)("span",{style:{width:10,flexShrink:0}}),(0,r.jsx)(eh,{text:e.branch??eu(e.path,K),style:{flex:1}}),e.isMain&&(0,r.jsx)("span",{style:{flexShrink:0,color:"var(--text-dim)",fontSize:10},children:k("sidebar.main")})]}),!e.isMain&&(0,r.jsx)("button",{onClick:()=>void t5(e.path,!1),disabled:ts,title:k("sidebar.removeWorktreeTitle",{path:e.path}),style:{display:"flex",alignItems:"center",justifyContent:"center",width:34,height:28,padding:0,marginRight:4,background:"none",border:"none",color:"var(--text-dim)",cursor:"pointer",borderRadius:"var(--radius-control)",flexShrink:0,transition:"color 0.12s, background 0.12s"},onMouseEnter:e=>{e.currentTarget.style.color="var(--danger)",e.currentTarget.style.background="var(--danger-soft)"},onMouseLeave:e=>{e.currentTarget.style.color="var(--text-dim)",e.currentTarget.style.background="none"},children:(0,r.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("polyline",{points:"3 6 5 6 21 6"}),(0,r.jsx)("path",{d:"M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"}),(0,r.jsx)("path",{d:"M10 11v6M14 11v6"}),(0,r.jsx)("path",{d:"M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2"})]})})]},e.path)}),n_&&0===nF.length&&eB.trim()&&(0,r.jsx)("div",{style:{padding:"8px 10px",fontSize:11,color:"var(--text-dim)"},children:k("sidebar.noMatchingWorktrees")})]}),e2?(0,r.jsxs)("div",{style:{padding:"6px 8px"},children:[(0,r.jsx)("input",{ref:td,value:e4,onChange:e=>{e5(e.target.value),e3(null)},onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),t4()),"Escape"===e.key&&(e8(!1),e5(""),e3(null))},placeholder:k("sidebar.branchName"),style:{width:"100%",fontSize:11,fontFamily:"var(--font-mono)",padding:"5px 8px",border:0,borderRadius:"var(--radius-control)",outline:"none",background:"var(--bg-subtle)",color:"var(--text)",boxSizing:"border-box"}}),(0,r.jsxs)("div",{style:{display:"flex",gap:5,marginTop:5},children:[(0,r.jsx)("button",{onClick:()=>void t4(),disabled:ts||!e4.trim(),style:{flex:1,padding:"4px 0",background:"var(--accent)",border:"none",borderRadius:"var(--radius-control)",color:"var(--bg)",fontSize:11,fontWeight:600,cursor:ts||!e4.trim()?"not-allowed":"pointer",opacity:ts||!e4.trim()?.65:1},children:ts?k("sidebar.creating"):k("sidebar.create")}),(0,r.jsx)("button",{onClick:()=>{e8(!1),e5(""),e3(null)},style:{flex:1,padding:"4px 0",background:"var(--bg-hover)",border:0,borderRadius:"var(--radius-control)",color:"var(--text-muted)",fontSize:11,cursor:"pointer"},children:k("sidebar.cancel")})]})]}):(0,r.jsxs)("button",{onClick:e=>{e.stopPropagation(),e8(!0),e3(null),setTimeout(()=>td.current?.focus(),0)},title:k("sidebar.createWorktreeTitle"),style:{display:"flex",alignItems:"center",gap:7,width:"100%",padding:"8px 10px",background:"none",border:"none",color:"var(--text-muted)",cursor:"pointer",textAlign:"left",fontSize:11},children:[(0,r.jsxs)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinecap:"round",style:{flexShrink:0},children:[(0,r.jsx)("line",{x1:"5",y1:"1",x2:"5",y2:"9"}),(0,r.jsx)("line",{x1:"1",y1:"5",x2:"9",y2:"5"})]}),(0,r.jsx)("span",{children:k("sidebar.newWorktree")})]}),e6&&(0,r.jsx)("div",{style:{padding:"5px 10px 8px",color:"var(--danger)",fontSize:11,lineHeight:1.35,overflowWrap:"anywhere"},children:e6})]})]}),(0,r.jsxs)("button",{type:"button",disabled:eD,onClick:()=>{let e;return e=nl.get($(a))?.alias??"",void(th.current=!1,eU(null),ez(e),eF(a),nh())},style:{display:"flex",alignItems:"center",gap:8,width:"100%",minHeight:34,padding:"0 10px",border:"none",background:"transparent",color:"var(--text-muted)",cursor:eD?"default":"pointer",textAlign:"left",fontSize:11,opacity:eD?.55:1},children:[(0,r.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,r.jsx)("path",{d:"m4 20 4.5-1 10-10a2.1 2.1 0 0 0-3-3l-10 10L4 20Z"}),(0,r.jsx)("path",{d:"m13.5 8 3 3"})]}),k(nl.get($(a))?.alias?"sidebar.projectAliasEdit":"sidebar.projectAlias")]}),(0,r.jsxs)("button",{type:"button",disabled:x,title:ny?k("sidebar.projectMoveDisabledWhileFiltering"):void 0,onClick:()=>void nf(a,-1),style:{display:"flex",alignItems:"center",gap:8,width:"100%",minHeight:34,padding:"0 10px",border:"none",background:"transparent",color:"var(--text-muted)",cursor:x?"default":"pointer",textAlign:"left",fontSize:11,opacity:x?.55:1},children:[(0,r.jsx)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,r.jsx)("path",{d:"m6 15 6-6 6 6"})}),k("sidebar.projectMoveUp")]}),(0,r.jsxs)("button",{type:"button",disabled:v,title:ny?k("sidebar.projectMoveDisabledWhileFiltering"):void 0,onClick:()=>void nf(a,1),style:{display:"flex",alignItems:"center",gap:8,width:"100%",minHeight:34,padding:"0 10px",border:"none",background:"transparent",color:"var(--text-muted)",cursor:v?"default":"pointer",textAlign:"left",fontSize:11,opacity:v?.55:1},children:[(0,r.jsx)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,r.jsx)("path",{d:"m6 9 6 6 6-6"})}),k("sidebar.projectMoveDown")]}),(0,r.jsxs)("button",{type:"button",disabled:eD,onClick:()=>void np(a,!d),style:{display:"flex",alignItems:"center",gap:8,width:"100%",minHeight:34,padding:"0 10px",border:"none",background:"transparent",color:"var(--text-muted)",cursor:eD?"default":"pointer",textAlign:"left",fontSize:11,opacity:eD?.55:1},children:[(0,r.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,r.jsx)("path",{d:"M2.5 12s3.5-6 9.5-6 9.5 6 9.5 6-3.5 6-9.5 6-9.5-6-9.5-6Z"}),(0,r.jsx)("circle",{cx:"12",cy:"12",r:"2.5"}),!d&&(0,r.jsx)("path",{d:"m4 4 16 16"})]}),k(d?"sidebar.projectUnhide":"sidebar.projectHide")]}),(s=0===nH(ng.get(l)??[])||tF,(0,r.jsxs)("button",{type:"button",disabled:s,onClick:()=>{nh(),tD(null),t_({kind:"project",project:a,label:o})},style:{display:"flex",alignItems:"center",gap:8,width:"100%",minHeight:34,padding:"0 10px",border:"none",background:"transparent",color:"var(--text-muted)",cursor:s?"default":"pointer",textAlign:"left",fontSize:11,opacity:s?.55:1},children:[(0,r.jsx)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,r.jsx)("path",{d:"M4 7h16M9 7V5h6v2M6 7l1 13h10l1-13"})}),k("sidebar.clearProjectSessions")]}))]})]})]}),!p&&0===c.length&&u&&(0,r.jsx)("div",{style:{padding:"6px 12px 7px 32px",color:"var(--text-dim)",fontSize:11},children:k("sidebar.noSessions")}),!p&&y.length>0&&(0,r.jsx)("div",{style:{paddingLeft:12},children:y.map(t=>(0,r.jsx)(ek,{node:t,selectedSessionId:e,runningSessionIds:tg,unreadSessionIds:tb,pinnedSessionIds:tk,onSelectSession:t6,onTogglePinnedSession:tK,onRenamed:tL,onSessionDeleted:tP,onSessionArchived:tq,depth:0},t.session.id))}),!p&&b&&(0,r.jsx)("button",{type:"button",onClick:()=>{en(e=>{let t=new Set(e);return t.has(a)?t.delete(a):t.add(a),t})},style:{display:"block",margin:"3px 0 3px 32px",padding:"5px 8px",border:"none",background:"transparent",color:"var(--text-muted)",cursor:"pointer",fontSize:12,textAlign:"left"},children:m?k("sidebar.showLess"):k("sidebar.showMore")})]},a)})]}),!nq&&(0,r.jsx)(ew,{refreshKey:tU,selectedSessionId:e,onSelectSession:t6,onRestored:tq}),!nq&&"priority"===v&&(0,r.jsxs)("div",{id:"navigator-priority-panel",style:{flex:"1 1 auto",minHeight:80,overflowY:"auto",padding:"0 6px 10px"},children:[D&&(0,r.jsx)("div",{style:{padding:"12px 8px",color:"var(--text-muted)",fontSize:12},children:k("sidebar.loading")}),H&&(0,r.jsx)("div",{role:"alert",style:{padding:"10px 8px",color:"var(--danger)",fontSize:12},children:H}),!D&&!H&&(b=nH(nR.flatMap(e=>e.sessions)),(0,r.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",gap:8,padding:"8px 2px 2px"},children:[(0,r.jsx)("button",{type:"button",disabled:t9,onClick:()=>void nr(),title:k("sidebar.newScratchSessionTitle"),style:ed(t9,A),children:k("sidebar.newScratchSession")}),nR.length>0&&!nI&&(0,r.jsx)("button",{type:"button",disabled:0===b||tF,onClick:()=>{tD(null),t_({kind:"priority"})},style:ed(0===b||tF,A),children:k("sidebar.clearPriorityList")})]})),!D&&!H&&tS&&(0,r.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",gap:8,padding:"6px 2px 4px"},children:[(0,r.jsxs)("button",{type:"button","aria-pressed":nI,"aria-label":k("navigator.resultsToCheckCount",{count:nT.length}),title:k("navigator.resultsToCheckHint"),onClick:()=>{nE(null),tT(e=>!e)},style:{...ed(!1,A),display:"inline-flex",alignItems:"center",gap:6,background:nI?"var(--bg-selected)":"var(--bg-hover)",color:nI||nT.length>0?"var(--text)":"var(--text-muted)",fontWeight:nI?600:500,whiteSpace:"nowrap"},children:[k("navigator.resultsToCheck"),(0,r.jsx)("span",{"aria-hidden":"true",style:{minWidth:18,padding:"0 5px",borderRadius:"var(--radius-surface)",background:nT.length>0?"var(--seed-color-bg-neutral-inverted)":"var(--bg-subtle)",color:nT.length>0?"var(--seed-color-fg-neutral-inverted)":"var(--text-muted)",fontSize:11,fontVariantNumeric:"tabular-nums",lineHeight:"18px",textAlign:"center"},children:nT.length})]}),nT.some(e=>!tv.has(e.id))&&(0,r.jsx)("button",{type:"button",title:k("navigator.acknowledgeResultsHint"),onClick:()=>{nE(null),tC(e=>e&&function(e,t,n){let r=e;for(let e of t)r=M(r,e,n);return r}(e,nT,Date.now()))},style:ed(!1,A),children:k("navigator.acknowledgeResults")})]}),nt&&(0,r.jsx)("div",{role:"alert",style:{padding:"6px 8px",color:"var(--danger)",fontSize:12},children:nt}),!D&&!H&&0===nR.length&&(0,r.jsx)("div",{style:{padding:"12px 8px",color:"var(--text-muted)",fontSize:12},children:nI?k("navigator.resultsToCheckEmpty"):k("sidebar.noSessions")}),!D&&!H&&n$.map((t,n)=>(0,r.jsxs)("section",{"aria-labelledby":`priority-group-${t.key}`,className:"priority-group","data-group":t.kind,children:[t.heading&&(0,r.jsx)("h2",{className:"priority-group-heading","data-first":0===n?"":void 0,children:t.heading}),(0,r.jsxs)("h3",{id:`priority-group-${t.key}`,className:t.heading?"priority-group-day":"priority-group-heading","data-first":0!==n||t.heading?void 0:"",children:["input"===t.kind&&(0,r.jsx)("span",{className:"workbench-lamp","data-kind":"input","aria-hidden":"true"}),"running"===t.kind&&(0,r.jsx)("span",{className:"workbench-lamp","aria-hidden":"true"}),t.label,(0,r.jsx)("span",{className:"priority-group-count",children:t.sessions.length})]}),t.sessions.map(t=>(0,r.jsx)(eb,{session:t,selected:t.id===e,running:tg.has(t.id),waiting:tv.has(t.id),unread:tb.has(t.id),pinned:tk.has(t.id),onSelect:nI?nL:t6,onTogglePin:tK},t.id))]},t.key))]})]})}function ev({scope:e,eligible:t,runningExcluded:n,busy:s,error:a,onCancel:l,onConfirm:o}){let{t:c}=(0,F.s)(),d=s||0===t,u=(0,i.useRef)(null),h=(0,i.useRef)(null),p=(0,i.useRef)(s);p.current=s;let m=(0,i.useRef)(l);return m.current=l,(0,i.useEffect)(()=>{let e=u.current;if(!e)return;let t=document.activeElement,n=t instanceof HTMLElement&&t!==document.body&&t!==document.documentElement&&!e.contains(t)?t:null;(h.current??e).focus();let r=t=>{if("Escape"===t.key){if(p.current)return;t.preventDefault(),m.current();return}if("Tab"!==t.key)return;let n=Array.from(e.querySelectorAll('a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')).filter(e=>e.getClientRects().length>0),r=document.activeElement;if(0===n.length){t.preventDefault(),e.focus();return}let i=n[0],s=n[n.length-1];t.shiftKey&&(r===i||!e.contains(r))?(t.preventDefault(),s.focus()):t.shiftKey||r!==s&&e.contains(r)||(t.preventDefault(),i.focus())};return e.addEventListener("keydown",r),()=>{e.removeEventListener("keydown",r);let t=n?.isConnected?n:e.closest(".session-navigator");t?.focus()}},[]),(0,r.jsx)("div",{role:"presentation",style:{position:"fixed",inset:0,zIndex:1100,display:"flex",alignItems:"center",justifyContent:"center",padding:16,background:"var(--scrim)"},onClick:e=>{s||e.target!==e.currentTarget||l()},children:(0,r.jsxs)("div",{ref:u,role:"alertdialog","aria-modal":"true","aria-labelledby":"bulk-clear-title","aria-describedby":"bulk-clear-body",tabIndex:-1,style:{width:420,maxWidth:"100%",border:0,borderRadius:"var(--radius-surface)",background:"var(--bg-raised)",boxShadow:"var(--shadow-float)",overflow:"hidden"},children:[(0,r.jsxs)("div",{style:{padding:"18px 18px 14px"},children:[(0,r.jsx)("div",{id:"bulk-clear-title",style:{color:"var(--text)",fontSize:"var(--seed-font-size-t4-static)",fontWeight:600},children:c("sidebar.clearSessionsTitle")}),(0,r.jsxs)("div",{id:"bulk-clear-body",style:{marginTop:8,color:"var(--text-muted)",fontSize:"var(--seed-font-size-t3-static)",lineHeight:1.6,overflowWrap:"anywhere"},children:["project"===e.kind?c("sidebar.clearSessionsProjectBody",{project:e.label,count:t}):c("sidebar.clearSessionsPriorityBody",{count:t}),n>0&&(0,r.jsx)("div",{style:{marginTop:6},children:c("sidebar.clearSessionsRunningExcluded",{count:n})}),0===t&&(0,r.jsx)("div",{style:{marginTop:6},children:c("sidebar.clearSessionsNone")})]}),a&&(0,r.jsx)("div",{role:"alert",style:{marginTop:10,color:"var(--danger)",fontSize:"var(--seed-font-size-t3-static)",lineHeight:1.5,overflowWrap:"anywhere"},children:a})]}),(0,r.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"flex-end",gap:8,padding:"12px 18px"},children:[(0,r.jsx)("button",{ref:h,type:"button",onClick:l,disabled:s,style:{minHeight:36,padding:"0 12px",border:0,borderRadius:"var(--radius-control)",background:"var(--bg-hover)",color:"var(--text-muted)",cursor:s?"default":"pointer",fontSize:"var(--seed-font-size-t3-static)"},children:c("sidebar.clearSessionsCancel")}),(0,r.jsx)("button",{type:"button",onClick:o,disabled:d,"aria-busy":s,style:{minHeight:36,padding:"0 14px",border:0,borderRadius:"var(--radius-control)",background:d?"var(--bg-hover)":"var(--danger-soft)",color:d?"var(--text-dim)":"var(--danger)",cursor:d?"default":"pointer",fontSize:"var(--seed-font-size-t3-static)",fontWeight:600},children:c(s?"sidebar.clearSessionsBusy":"sidebar.clearSessionsConfirm")})]})]})})}function ey({filled:e=!1}){return(0,r.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:e?"currentColor":"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,r.jsx)("path",{d:"M12 17v5"}),(0,r.jsx)("path",{d:"M5 17h14"}),(0,r.jsx)("path",{d:"M6 3h12l-1 8 2 3H5l2-3-1-8z"})]})}function eb({session:e,selected:t,running:n,waiting:i,unread:s,pinned:a,onSelect:l,onTogglePin:o}){let{t:c}=(0,F.s)(),d=(e.name||e.firstMessage||e.id.slice(0,8)).replace(/\s+/g," ").trim(),u=e.cwd.split(/[\\/]/).filter(Boolean).at(-1)??"";return(0,r.jsxs)("div",{className:`priority-session-row${t?" is-selected":""}${n?" is-running":""}${s?" is-unread":""}`,style:{display:"flex",alignItems:"stretch",borderRadius:"var(--radius-control)",background:t?"var(--bg-selected)":"transparent"},children:[(0,r.jsxs)("button",{type:"button","aria-current":t?"page":void 0,onClick:()=>l(e),title:`${d}
2
2
  ${e.cwd}
3
3
  ${new Date(e.modified).toLocaleString()}`,style:{minWidth:0,flex:1,display:"block",padding:"7px 8px",border:"none",background:"transparent",color:"var(--text)",cursor:"pointer",textAlign:"left"},children:[(0,r.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:6,minWidth:0},children:[(0,r.jsx)("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"var(--text)",fontSize:12.5,fontWeight:500,lineHeight:1.4},children:d}),i&&(0,r.jsx)(ej,{}),n&&!i&&(0,r.jsx)(eS,{}),!n&&s&&(0,r.jsx)(eC,{})]}),(0,r.jsx)("span",{style:{display:"block",marginTop:2,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"var(--text-dim)",fontSize:10,fontFamily:"var(--font-mono)"},children:u})]}),(0,r.jsx)("button",{type:"button","aria-pressed":a,"aria-label":c(a?"sidebar.unpin":"sidebar.pin"),title:c(a?"sidebar.unpin":"sidebar.pin"),onClick:()=>o(e.id),style:{width:30,border:"none",background:"transparent",color:a?"var(--accent)":"var(--text-dim)",cursor:"pointer",flexShrink:0},children:(0,r.jsx)(ey,{filled:a})})]})}function ew({refreshKey:e,selectedSessionId:t,onSelectSession:n,onRestored:s}){let{t:a}=(0,F.s)(),[l,o]=(0,i.useState)(!1),[c,d]=(0,i.useState)([]);(0,i.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await fetch("/api/sessions?archived=1",{cache:"no-store"});if(!t.ok)throw Error(`HTTP ${t.status}`);let n=await t.json();e||d(n.sessions)}catch{}})(),()=>{e=!0}},[e]);let u=(0,i.useCallback)(async(e,t)=>{e.stopPropagation();try{await fetch(`/api/sessions/${encodeURIComponent(t)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({archived:!1})}),s(t)}catch{}},[s]);return 0!==c.length||l?(0,r.jsxs)("section",{style:{marginTop:8},children:[(0,r.jsxs)("button",{type:"button",onClick:()=>o(e=>!e),style:{display:"flex",alignItems:"center",gap:6,width:"100%",padding:"7px 12px",background:"transparent",border:"none",color:"var(--text-muted)",cursor:"pointer",fontSize:12,fontWeight:600,textAlign:"left"},children:[(0,r.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:l?"rotate(0deg)":"rotate(-90deg)",transition:"transform 0.1s"},children:(0,r.jsx)("polyline",{points:"2 3.5 5 6.5 8 3.5"})}),a("sidebar.archived")," (",c.length,")"]}),l&&(0,r.jsxs)("div",{style:{paddingLeft:12},children:[0===c.length&&(0,r.jsx)("div",{style:{padding:"4px 12px 8px 20px",color:"var(--text-dim)",fontSize:11},children:a("sidebar.noArchivedSessions")}),c.map(e=>{let i=_(e.firstMessage)??e.firstMessage,s=e.name||i.slice(0,50)||e.id.slice(0,12);return(0,r.jsxs)("div",{onClick:()=>n(e),style:{height:40,display:"flex",alignItems:"center",paddingLeft:20,paddingRight:4,gap:4,cursor:"pointer",overflow:"hidden",background:e.id===t?"var(--bg-selected)":"transparent"},children:[(0,r.jsx)("div",{style:{flex:1,minWidth:0,fontSize:12,color:"var(--text)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s}),(0,r.jsx)("button",{onClick:t=>u(t,e.id),title:a("sidebar.restore"),style:{display:"flex",alignItems:"center",justifyContent:"center",height:24,padding:"0 8px",flexShrink:0,background:"var(--bg-hover)",border:0,borderRadius:"var(--radius-control)",color:"var(--text-muted)",cursor:"pointer",fontSize:11,fontWeight:500},children:a("sidebar.restore")})]},e.id)})]})]}):null}function ek({node:e,selectedSessionId:t,runningSessionIds:n,unreadSessionIds:s,pinnedSessionIds:a,onSelectSession:l,onRenamed:o,onSessionDeleted:c,onTogglePinnedSession:d,onSessionArchived:u,depth:h}){let[p,m]=(0,i.useState)(!1),f=e.children.length>0;return(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{style:{position:"relative"},children:[h>0&&(0,r.jsx)("div",{style:{position:"absolute",left:10*h+6,top:0,bottom:0,width:1,background:"var(--border)",pointerEvents:"none"}}),(0,r.jsx)(eT,{session:e.session,isSelected:e.session.id===t,isRunning:n.has(e.session.id),isUnread:s.has(e.session.id),isPinned:a.has(e.session.id),onClick:()=>l(e.session),onTogglePin:()=>d(e.session.id),onRenamed:o,onDeleted:e=>c?.(e),onArchived:e=>u?.(e),depth:h,hasChildren:f,collapsed:p,onToggleCollapse:()=>m(e=>!e)})]}),f&&!p&&(0,r.jsx)("div",{children:e.children.map(e=>(0,r.jsx)(ek,{node:e,selectedSessionId:t,runningSessionIds:n,unreadSessionIds:s,pinnedSessionIds:a,onSelectSession:l,onTogglePinnedSession:d,onRenamed:o,onSessionDeleted:c,onSessionArchived:u,depth:h+1},e.session.id))})]})}function ej(){let{t:e}=(0,F.s)();return(0,r.jsxs)("span",{className:"session-waiting-indicator",title:e("sidebar.waitingForAnswerHint"),children:[(0,r.jsx)("span",{className:"workbench-lamp","data-kind":"input","aria-hidden":"true"}),e("sidebar.waitingForAnswer")]})}function eS(){let{t:e}=(0,F.s)();return(0,r.jsx)("span",{className:"session-running-indicator",title:e("sidebar.agentRunning"),"aria-label":e("sidebar.agentRunning"),role:"img",children:(0,r.jsx)("span",{className:"workbench-lamp","aria-hidden":"true"})})}function eC(){let{t:e}=(0,F.s)();return(0,r.jsx)("span",{title:e("sidebar.newActivity"),"aria-label":e("sidebar.newSessionActivity"),style:{width:14,height:14,display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,color:"var(--text)"},children:(0,r.jsx)("span",{style:{width:6,height:6,borderRadius:3,background:"currentColor"}})})}function eN(e,t){return e&&(0!==e.running||0!==e.unread)?(0,r.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:5,flexShrink:0,marginLeft:6},children:[e.running>0&&(0,r.jsxs)("span",{title:t("sidebar.agentRunning"),"aria-label":`${t("sidebar.agentRunning")} (${e.running})`,style:{display:"inline-flex",alignItems:"center",gap:4,color:"var(--text-muted)",fontSize:11,fontFamily:"var(--font-mono)"},children:[(0,r.jsx)("span",{className:"workbench-lamp","aria-hidden":"true"}),e.running]}),e.unread>0&&(0,r.jsxs)("span",{title:t("sidebar.newSessionActivity"),"aria-label":`${t("sidebar.newSessionActivity")} (${e.unread})`,style:{display:"inline-flex",alignItems:"center",gap:3,color:"var(--text-muted)",fontSize:11,fontFamily:"var(--font-mono)"},children:[(0,r.jsx)("span",{style:{width:6,height:6,borderRadius:3,background:"var(--text)",display:"inline-block"}}),e.unread]})]}):null}function eT({session:e,isSelected:t,isRunning:n,isUnread:s,isPinned:a,onClick:l,onTogglePin:o,onRenamed:c,onDeleted:d,onArchived:u,depth:h=0,hasChildren:p=!1,collapsed:m=!1,onToggleCollapse:f}){let{t:g}=(0,F.s)(),[x,v]=(0,i.useState)(!1),[y,b]=(0,i.useState)(!1),[w,k]=(0,i.useState)(""),[j,S]=(0,i.useState)(!1),[C,N]=(0,i.useState)(!1),T=(0,i.useRef)(null);(0,i.useEffect)(()=>{if(y){let e=requestAnimationFrame(()=>T.current?.select());return()=>cancelAnimationFrame(e)}},[y]);let I=_(e.firstMessage)??e.firstMessage,M=e.name||I.slice(0,50)||e.id.slice(0,12),E=(0,i.useCallback)(t=>{t.stopPropagation(),e.transient||(k(e.name||I.slice(0,50)||e.id.slice(0,12)),b(!0))},[e.name,e.transient,I,e.id]),R=(0,i.useCallback)(async()=>{let t=w.trim();if(b(!1),w!==M&&t!==(e.name??""))try{await fetch(`/api/sessions/${encodeURIComponent(e.id)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t})}),c?.()}catch{}},[w,e.id,e.name,c,M]),$=(0,i.useCallback)(async()=>{if(!e.transient){S(!1),N(!0);try{await fetch(`/api/sessions/${encodeURIComponent(e.id)}`,{method:"DELETE"}),d?.(e.id)}catch{N(!1)}}},[e.id,e.transient,d]),L=(0,i.useCallback)(async t=>{if(t.stopPropagation(),!e.transient)try{await fetch(`/api/sessions/${encodeURIComponent(e.id)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({archived:!0})}),u?.(e.id)}catch{}},[e.id,e.transient,u]),P=(0,i.useCallback)(e=>{e.stopPropagation(),e.shiftKey?$():S(!0)},[$]),A=(0,i.useCallback)(e=>{e.stopPropagation(),$()},[$]),O=(0,i.useCallback)(e=>{e.stopPropagation(),S(!1)},[]),z=(0,i.useCallback)(t=>{(function(e,t=window){let n=new CustomEvent("pi-web:session-row-contextmenu",{cancelable:!0,detail:e});return!t.dispatchEvent(n)})({id:e.id,path:e.path,cwd:e.cwd,name:e.name,clientX:t.clientX,clientY:t.clientY,refresh:()=>{c?.()}})&&(t.preventDefault(),t.stopPropagation())},[c,e.cwd,e.id,e.name,e.path]);return(0,r.jsx)("div",{className:`navigator-session-row${t?" is-selected":""}${n?" is-running":""}${s?" is-unread":""}${j?" is-confirming":""}`,onClick:j||y?void 0:l,onContextMenu:j||y?void 0:z,onMouseEnter:()=>v(!0),onMouseLeave:()=>{v(!1)},style:{height:40,display:"flex",alignItems:"center",paddingLeft:h>0?10*h+8:8,paddingRight:4,cursor:j||y?"default":"pointer",background:t?"var(--bg-selected)":x?"var(--bg-hover)":"transparent",transition:"background 0.1s",opacity:C?.5:1,gap:4,overflow:"hidden"},children:j?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{style:{flex:1,minWidth:0,fontSize:12,color:"var(--text)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:g("sidebar.deleteSession",{title:M.slice(0,22)+(M.length>22?"…":"")})}),(0,r.jsxs)("div",{style:{display:"flex",gap:5,flexShrink:0},children:[(0,r.jsxs)("button",{onClick:A,style:{display:"flex",alignItems:"center",justifyContent:"center",gap:4,height:30,padding:"0 11px",background:"var(--danger)",border:"none",borderRadius:"var(--radius-control)",color:"var(--bg)",cursor:"pointer",fontSize:12,fontWeight:600,whiteSpace:"nowrap"},children:[(0,r.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("polyline",{points:"3 6 5 6 21 6"}),(0,r.jsx)("path",{d:"M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"}),(0,r.jsx)("path",{d:"M10 11v6M14 11v6"}),(0,r.jsx)("path",{d:"M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2"})]}),g("sidebar.delete")]}),(0,r.jsx)("button",{onClick:O,style:{display:"flex",alignItems:"center",justifyContent:"center",height:30,padding:"0 11px",background:"var(--bg-hover)",border:0,borderRadius:"var(--radius-control)",color:"var(--text-muted)",cursor:"pointer",fontSize:12,fontWeight:500,whiteSpace:"nowrap"},children:g("sidebar.cancel")})]})]}):y?(0,r.jsx)("input",{ref:T,value:w,onChange:e=>k(e.target.value),onBlur:R,onKeyDown:e=>{"Enter"===e.key&&R(),"Escape"===e.key&&b(!1)},autoFocus:!0,style:{flex:1,fontSize:12,padding:"5px 8px",border:0,borderRadius:"var(--radius-control)",outline:"none",background:"var(--bg)",color:"var(--text)",height:30}}):(0,r.jsxs)(r.Fragment,{children:[h>0&&(0,r.jsxs)("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-dim)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[(0,r.jsx)("line",{x1:"6",y1:"3",x2:"6",y2:"15"}),(0,r.jsx)("circle",{cx:"18",cy:"6",r:"3"}),(0,r.jsx)("circle",{cx:"6",cy:"18",r:"3"}),(0,r.jsx)("path",{d:"M18 9a9 9 0 0 1-9 9"})]}),(0,r.jsxs)("button",{type:"button",onClick:e=>{e.stopPropagation(),l()},"aria-current":t?"page":void 0,title:M,style:{display:"flex",alignItems:"center",gap:6,flex:1,minWidth:0,color:"var(--text)",fontSize:12.5,fontWeight:t?500:400,lineHeight:1.35,padding:0,border:"none",background:"transparent",fontFamily:"inherit",textAlign:"left",cursor:"pointer"},children:[(0,r.jsx)("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:M}),n&&(0,r.jsx)(eS,{}),!n&&s&&(0,r.jsx)(eC,{}),e.worktreeBranch&&(0,r.jsx)("span",{title:g("sidebar.worktreePath",{path:e.cwd}),style:{display:"flex",color:"var(--accent)",flexShrink:0},children:(0,r.jsxs)("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,r.jsx)("line",{x1:"6",y1:"3",x2:"6",y2:"15"}),(0,r.jsx)("circle",{cx:"18",cy:"6",r:"3"}),(0,r.jsx)("circle",{cx:"6",cy:"18",r:"3"}),(0,r.jsx)("path",{d:"M18 9a9 9 0 0 1-9 9"})]})})]}),p&&(0,r.jsx)("button",{onClick:e=>{e.stopPropagation(),f?.()},title:g(m?"sidebar.expandForks":"sidebar.collapseForks"),style:{display:"flex",alignItems:"center",justifyContent:"center",width:20,height:20,padding:0,flexShrink:0,background:"none",border:"none",color:"var(--text-dim)",cursor:"pointer",transform:m?"rotate(-90deg)":"none",transition:"transform 0.15s"},children:(0,r.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:(0,r.jsx)("polyline",{points:"2 3.5 5 6.5 8 3.5"})})}),!e.transient&&(0,r.jsxs)("div",{style:{display:"flex",gap:4,flexShrink:0},children:[(0,r.jsx)("button",{className:"navigator-session-action",onClick:e=>{e.stopPropagation(),o?.()},title:g(a?"sidebar.unpin":"sidebar.pin"),"aria-label":g(a?"sidebar.unpin":"sidebar.pin"),"aria-pressed":a,style:{display:"flex",alignItems:"center",justifyContent:"center",width:26,height:26,padding:0,background:a?"var(--bg-selected)":"transparent",border:"none",borderRadius:"var(--radius-control)",color:a?"var(--accent)":"var(--text-muted)",cursor:"pointer",flexShrink:0,opacity:x||a?1:0,pointerEvents:x||a?"auto":"none",transition:"opacity 0.12s, background 0.12s, color 0.12s"},onFocus:()=>v(!0),children:(0,r.jsx)(ey,{filled:a})}),(0,r.jsx)("button",{className:"navigator-session-action",onClick:E,title:g("sidebar.rename"),style:{display:"flex",alignItems:"center",justifyContent:"center",width:26,height:26,padding:0,background:"transparent",border:"none",borderRadius:"var(--radius-control)",color:"var(--text-muted)",cursor:"pointer",flexShrink:0,opacity:+!!x,pointerEvents:x?"auto":"none",transition:"opacity 0.12s, background 0.12s, color 0.12s, border-color 0.12s"},onFocus:()=>v(!0),onMouseEnter:e=>{e.currentTarget.style.background="var(--bg-selected)",e.currentTarget.style.color="var(--accent)"},onMouseLeave:e=>{e.currentTarget.style.background="transparent",e.currentTarget.style.color="var(--text-muted)"},children:(0,r.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,r.jsx)("path",{d:"M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"})})}),(0,r.jsx)("button",{className:"navigator-session-action",onClick:L,title:g("sidebar.archive"),style:{display:"flex",alignItems:"center",justifyContent:"center",width:26,height:26,padding:0,background:"transparent",border:"none",borderRadius:"var(--radius-control)",color:"var(--text-muted)",cursor:"pointer",flexShrink:0,transition:"background 0.12s, color 0.12s, border-color 0.12s"},onMouseEnter:e=>{e.currentTarget.style.background="var(--bg-selected)",e.currentTarget.style.color="var(--accent)"},onMouseLeave:e=>{e.currentTarget.style.background="transparent",e.currentTarget.style.color="var(--text-muted)"},children:(0,r.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("rect",{x:"3",y:"4",width:"18",height:"4",rx:"1"}),(0,r.jsx)("path",{d:"M5 8v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8"}),(0,r.jsx)("path",{d:"M10 12h4"})]})}),(0,r.jsx)("button",{className:"navigator-session-action",onClick:P,title:g("sidebar.deleteWithShiftClick"),style:{display:"flex",alignItems:"center",justifyContent:"center",width:26,height:26,padding:0,background:"transparent",border:"none",borderRadius:"var(--radius-control)",color:"var(--text-muted)",cursor:"pointer",flexShrink:0,opacity:+!!x,pointerEvents:x?"auto":"none",transition:"opacity 0.12s, background 0.12s, color 0.12s, border-color 0.12s"},onFocus:()=>v(!0),onMouseEnter:e=>{e.currentTarget.style.background="var(--danger-soft)",e.currentTarget.style.color="var(--danger)"},onMouseLeave:e=>{e.currentTarget.style.background="transparent",e.currentTarget.style.color="var(--text-muted)"},children:(0,r.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("polyline",{points:"3 6 5 6 21 6"}),(0,r.jsx)("path",{d:"M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"}),(0,r.jsx)("path",{d:"M10 11v6M14 11v6"}),(0,r.jsx)("path",{d:"M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2"})]})})]})]})})}let eI=/\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~]|\][^\x07]*(?:\x07|\x1B\\))/g,eM=/^\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~]|\][^\x07]*(?:\x07|\x1B\\))/,eE=/\x1B\[([0-9;]*)m/g,eR=/\x1B_pi:c\x07/g,e$=["#1f2937","#dc2626","#16a34a","#d97706","#2563eb","#9333ea","#0891b2","#6b7280"],eL=["#9ca3af","#ef4444","#22c55e","#f59e0b","#3b82f6","#a855f7","#06b6d4","#e5e7eb"];function eP(e){return e.replace(eR,"").replace(eI,"")}function eA(e){let t=[],n=0;for(;n<e.length;){if(27===e.charCodeAt(n)){let t=e.slice(n).match(eM);if(t){n+=t[0].length;continue}}let r=e.codePointAt(n);if(void 0===r)break;let i=String.fromCodePoint(r);t.push({start:n,end:n+i.length,char:i}),n+=i.length}return t}function e_(e,t){let n=eA(e)[t];return n?e.slice(0,n.start)+e.slice(n.end):e}function eF(e){return eA(e)[0]?.char}function eO(e){let t=/^[┌├└╭╰][─┬┴┼]+[┐┤┘╮╯]$/,n=[];for(let r of e){let e=r.replace(eR,""),i=eP(e).trimEnd();if(t.test(i))continue;let s=e,a=eF(s);("│"===a||"┃"===a)&&" "===eF(s=e_(s,0))&&(s=e_(s,0));let l=function(e){let t=eA(e);for(let e=t.length-1;e>=0;e--)if(""!==t[e].char.trim())return e;return -1}(s),o=l>=0?eA(s)[l]?.char:void 0;("│"===o||"┃"===o)&&(s=e_(s,l)),n.push(function(e){let t=e;for(;;){let e=eA(t),n=e[e.length-1];if(!n||""!==n.char.trim())return t;t=t.slice(0,n.start)+t.slice(n.end)}}(s))}for(;n.length>0&&""===eP(n[0]).trim();)n.shift();for(;n.length>0&&""===eP(n[n.length-1]).trim();)n.pop();return n.length?n:e}function ez(e){let t,n=[],r={},i=0;for(eE.lastIndex=0;null!==(t=eE.exec(e));)t.index>i&&n.push({text:e.slice(i,t.index),style:r}),r=function(e,t){let n={...e};for(let e=0;e<t.length;e++){let r=t[e];if(0===r)for(let e of Object.keys(n))delete n[e];else if(1===r)n.fontWeight=700;else if(2===r)n.opacity=.65;else if(3===r)n.fontStyle="italic";else if(4===r)n.textDecoration="underline";else if(22===r)delete n.fontWeight,delete n.opacity;else if(23===r)delete n.fontStyle;else if(24===r)delete n.textDecoration;else if(39===r)delete n.color;else if(49===r)delete n.backgroundColor;else if(r>=30&&r<=37)n.color=e$[r-30];else if(r>=90&&r<=97)n.color=eL[r-90];else if(r>=40&&r<=47)n.backgroundColor=e$[r-40];else if(r>=100&&r<=107)n.backgroundColor=eL[r-100];else if((38===r||48===r)&&2===t[e+1]){let[i,s,a]=[t[e+2],t[e+3],t[e+4]];[i,s,a].every(e=>"number"==typeof e&&Number.isFinite(e))&&(38===r?n.color=`rgb(${i}, ${s}, ${a})`:n.backgroundColor=`rgb(${i}, ${s}, ${a})`),e+=4}else if((38===r||48===r)&&5===t[e+1]){let i=function(e){if(e>=0&&e<8)return e$[e];if(e>=8&&e<16)return eL[e-8];if(e>=16&&e<=231){let t=e-16,n=Math.floor(t/36),r=Math.floor(t%36/6),i=e=>0===e?0:55+40*e;return`rgb(${i(n)}, ${i(r)}, ${i(t%6)})`}if(e>=232&&e<=255){let t=8+(e-232)*10;return`rgb(${t}, ${t}, ${t})`}}(t[e+2]);i&&(38===r?n.color=i:n.backgroundColor=i),e+=2}}return n}(r,t[1]?t[1].split(";").map(e=>Number(e||"0")):[0]),i=t.index+t[0].length;return i<e.length&&n.push({text:e.slice(i),style:r}),n}let eD={ArrowUp:"\x1b[A",ArrowDown:"\x1b[B",ArrowRight:"\x1b[C",ArrowLeft:"\x1b[D",Home:"\x1b[H",End:"\x1b[F",Insert:"\x1b[2~",Delete:"\x1b[3~",PageUp:"\x1b[5~",PageDown:"\x1b[6~",Escape:"\x1b",Backspace:""},eW={ArrowLeft:"\x1bb",ArrowRight:"\x1bf",ArrowUp:"\x1bp",ArrowDown:"\x1bn"},eH={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",svg:"image/svg+xml",bmp:"image/bmp",ico:"image/x-icon",avif:"image/avif"},eU={mp3:"audio/mpeg",wav:"audio/wav",ogg:"audio/ogg",oga:"audio/ogg",opus:"audio/ogg",m4a:"audio/mp4",aac:"audio/aac",flac:"audio/flac",weba:"audio/webm",webm:"audio/webm"};function eB(e){return(e.replace(/\\/g,"/").split("/").pop()??"").toLowerCase().split(".").pop()??""}function eq(e){return null!==(eH[eB(e)]??null)}function eV(e){let t;return null!==("pdf"===(t=eB(e))||"docx"===t?t:null)}function eK(e,t,n={}){let r={...e,content:t};return n.omitUsage&&(r.usage=void 0),r}function eG(e,t={}){return!!t.hideThinking&&"thinking"===e.type||function(e,t={}){return"thinking"===e.type&&!e.deferred&&!t.isStreaming&&""===e.thinking.trim()}(e,t)}function eJ(e,t={}){return t.isStreaming||"error"!==e.stopReason?null:e.errorMessage?.trim()||"Unknown provider error"}function eY(e,t){let n=e[t];if(n?.role!=="assistant"||"error"!==n.stopReason)return!1;for(let n=t+1;n<e.length;n++){let t=e[n].role;if("user"===t)break;if("assistant"===t)return!0}return!1}function eZ(e,t={}){let n=[];for(let r of function(e,t={}){return(e.content??[]).filter(e=>!eG(e,t))}(e,t)){let e="image"===r.type||"text"===r.type&&r.text.trim().length>0?"answer":"process",t=n[n.length-1];t?.kind===e?t.blocks.push(r):n.push({kind:e,blocks:[r]})}return n}function eQ(e){return e.filter(e=>"toolCall"===e.type).length}let eX=/[\u3000-\u30ff\u3400-\u9fff\uf900-\ufaff\u{20000}-\u{2fa1f}\uac00-\ud7af]/u;function e0(e){let t=0,n=0;for(let r of e)eX.test(r)?t++:n++;return t+n/4}function e1(e){return"text"===e.type?e.text:"thinking"===e.type?e.thinking:"toolCall"===e.type?JSON.stringify(e.input??{})??"":null}function e2(e,t){if(!e)return e0(t);let n=Math.min(e.text.length,t.length),r=0;for(;r<n&&e.text.charCodeAt(r)===t.charCodeAt(r);)r++;let i=r>0?t.charCodeAt(r-1):0;return i>=55296&&i<=56319&&r--,e.tokens-e0(e.text.slice(r))+e0(t.slice(r))}function e8(e,t,n){let r=new URLSearchParams({sessionId:e,toolCallId:t});return void 0!==n&&r.set("index",String(n)),`/api/tool-image?${r}`}let e4=/^\[[1-9]\d* tool result images? omitted from initial history payload(?:: [^\]\n]*)?, ~\d+ bytes\]$/;function e5(e){let t=new Map;for(let n of e)"toolResult"===n.role&&t.set(n.toolCallId,n);let n=[],r=-1;return{collect(e,i){for(let s of i)"toolCall"===s.type&&function(e,t){if(!t||t.isError)return!1;if(t.content?.some(e=>"image"===e.type))return!0;let n=e.input??{};if("generate_image"===e.toolName)return!0;if("write"===e.toolName)return"xd://generate_image"===n.path;if("eval"===e.toolName){let e;return e=t.content?.at(-1),e?.type==="text"&&e4.test(e.text)}return"read"===e.toolName&&"string"==typeof n.path&&eq(n.path)}(s,t.get(s.toolCallId))&&(n.push({type:"image",source:{type:"url",url:""},toolImage:{toolCallId:s.toolCallId}}),r=e)},attach(e){if(0===n.length)return e;let t=[...n,...e];return n=[],t},takeRemaining(){if(0===n.length)return null;let e={idx:r,blocks:n};return n=[],e}}}let e6=new Map,e3=new Map,e7="[한국어 번역]\n";function e9(e){return e.filter(e=>"text"===e.type&&"string"==typeof e.text).map(e=>e.text).join("\n")}function te(e){if("custom"!==e.role||"korean-reply-translation"!==e.customType)return null;let t=e.details;if(!t||"object"!=typeof t)return null;let n="sourceTimestamp"in t&&"number"==typeof t.sourceTimestamp?t.sourceTimestamp:void 0,r="sourceHash"in t&&"string"==typeof t.sourceHash?t.sourceHash:void 0;return void 0===n&&void 0===r?null:{sourceTimestamp:n,sourceHash:r}}let tt="command",tn="autolearn-saved";function tr(e){return"custom"===e.role&&(e.customType===tt||e.customType===tn&&!1!==e.display)}function ti(e,t){let n=e[t];if(n?.role!=="custom"||"user-input-translation"!==n.customType)return -1;for(let n=t-1;n>=0;n--)if("user"===e[n].role)return n;return -1}let ts="local-command:";function ta(e){return e?.startsWith(ts)===!0}function tl(e,t,n){let r=new Set(n.map(e=>e.message)),i=[],s=[];for(let n=0;n<e.length;n++){let a=n<t.length;!(r.has(e[n])||a&&ta(t[n]))&&(i.push(e[n]),a&&s.push(t[n]))}for(let e of n){let t=0;if(null!==e.baseEntryId){let n=s.indexOf(e.baseEntryId);if(-1===n)continue;t=n+1}let n=e.message.timestamp??0;for(;t<i.length;){let e=i[t];if(!r.has(e)&&"number"==typeof e.timestamp&&e.timestamp>n)break;t+=1}i.splice(t,0,e.message),t<=s.length&&s.splice(t,0,e.entryId)}return{messages:i,entryIds:s}}function to(e){return"user"===e.role||"custom"===e.role&&"compaction"===e.customType}let tc={create:!0,update:!0};function td(e){return"string"==typeof e?e.replace(/\s+/g," ").trim():""}function tu(e){if("string"==typeof e)return e;if(!Array.isArray(e))return"";let t=[];for(let n of e)n&&"object"==typeof n&&"type"in n&&"text"===n.type&&"text"in n&&"string"==typeof n.text&&t.push(n.text);return t.join("\n")}function th(e,t){if(0===e.length)return -1;if(!t)return 0;let n=-1;for(let r=0;r<e.length;r++){let i=e[r];if(i.item===t.item){if(i.k===t.k)return r;n=r}}return -1===n?0:n}function tp(e){try{return decodeURIComponent(e)}catch{return e}}function tm(e){return/^[a-zA-Z]:[\\/]/.test(e)||e.startsWith("\\\\")?e.replace(/\\/g,"/"):e}function tf(e){let t=tm(e),n=/^[a-zA-Z]:\//.test(t),r=t.startsWith("//"),i=t.startsWith("/")&&!n&&!r,s=[];for(let e of t.split("/"))if(e&&"."!==e){if(".."===e){s.length>0&&".."!==s[s.length-1]?s.pop():i||n||r||s.push(e);continue}s.push(e)}let a=s.join("/");return n?a:r?`//${a}`:i?`/${a}`:a}function tg(e,t,n=t){let r,i,s,a,l;if(!e)return null;let o=e.split("#",1)[0].split("?",1)[0].trim();if(!o)return null;let c=null,d=null,u=tp(o),h=u.startsWith("\\\\"),p=tm(u),m=p.toLowerCase();if(m.startsWith("/api/")||m.startsWith("/_next/")||!h&&p.startsWith("//")||/^[a-zA-Z][a-zA-Z0-9+.-]*:/i.test(p)&&!m.startsWith("file:")&&!/^[a-zA-Z]:\//.test(p))return null;if(m.startsWith("file:")?d=(c=function(e){try{let t=new URL(e);if("file:"!==t.protocol)return null;let n=tp(t.pathname);if(t.hostname)return`//${t.hostname}${n.startsWith("/")?n:`/${n}`}`;if(/^\/[a-zA-Z]:\//.test(n))return n.slice(1);return n}catch{return null}}(p))?"absolute":null:/^[a-zA-Z]:\//.test(p)||p.startsWith("/")?(c=p,d="absolute"):t&&!(p.startsWith("#")||p.startsWith("?"))&&(p.startsWith("./")||p.startsWith("../")||p.includes("/")||/(^|\/)\.?[^/]+\.[^/.]+$/.test(p))&&(c=`${tm(t).replace(/\/+$/,"")}/${p}`,d="relative"),!c)return null;let f=tf(c).replace(/:\d+(?::\d+)?$/,"");return"relative"===d&&n&&(r=tf(f).replace(/\/+$/,""),i=tf(n).replace(/\/+$/,""),a=(s=/^[a-zA-Z]:\//.test(r)||/^[a-zA-Z]:\//.test(i))?r.toLowerCase():r,!(a===(l=s?i.toLowerCase():i)||a.startsWith(`${l}/`)))?null:f}function tx(e,t){let n;if(!e)return null;let r=/^[a-zA-Z]:[\\/]/.test(e)||e.startsWith("\\\\")||void 0!==t&&(/^[a-zA-Z]:[\\/]/.test(t)||t.startsWith("\\\\")),i=e=>r?e.replace(/\\/g,"/"):e,s=i(e),a=t?i(t).replace(/\/+$/,""):void 0,l=/^[a-zA-Z]:\//.test(s),o=s.startsWith("//");if(l||o)n=s;else if(s.startsWith("/")){let e=a?.match(/^([a-zA-Z]:)(?:\/|$)/)?.[1]??a?.match(/^(\/\/[^/]+\/[^/]+)(?:\/|$)/)?.[1];n=e?`${e}${s}`:s}else{if(!a)return null;n=`${a}/${s}`}return tf(n)}function tv(e){let t=e.toLowerCase();return"write"===t||t.startsWith("write_")||t.endsWith(".write")||t.endsWith("_write")}function ty(e){let t=e.toLowerCase();return"edit"===t||t.startsWith("edit_")||t.endsWith(".edit")||t.endsWith("_edit")||t.includes("str_replace")||t.includes("replace_editor")}function tb(e){if(!e)return null;let t=e.file_path??e.path;return"string"==typeof t&&t.length>0?t:null}function tw(e,t){if(!e||"object"!=typeof e||"delete"===e.op&&!t)return null;let n=e.path??e.resolvedPath;return"string"==typeof n&&n.length>0?n:null}function tk(e,t,n=!1){let r=t.details,i=tb(e);if(i)return!n&&r&&"object"==typeof r&&"delete"===r.op?[]:[i];if(!r||"object"!=typeof r)return[];if(Array.isArray(r.perFileResults))return r.perFileResults.map(e=>tw(e,n)).filter(e=>null!==e);let s=tw(r,n);return s?[s]:[]}function tj(e,t){let n=tb(e);return(t?tk(e,t,!0):n?[n]:[]).filter(tI)}function tS(e,t,n){let r=tj(e,t);return r.length>0&&r.every(e=>tT(e,n))}let tC=new Map(["skills","commands","rules","prompts","extensions","instructions","hooks","tools","agents","plugins","mcp.json",".mcp.json","SYSTEM.md","SYSTEM_TEMPLATE.md","APPEND_SYSTEM.md","AGENTS.md","settings.json","config.yml","secrets.yml"].map(e=>[e.toLowerCase(),e])),tN=[/^\/(?:private\/)?(?:var\/)?tmp(?:\/|$)/,/^\/(?:private\/)?var\/folders\/[^/]+\/[^/]+\/T(?:\/|$)/,/^(?:[a-z]:|\/mnt\/[a-z])\/(?:windows\/)?temp(?:\/|$)/i,/^(?:[a-z]:|\/mnt\/[a-z])\/users\/[^/]+\/appdata\/local\/temp(?:\/|$)/i];function tT(e,t){let n=tx(e,t),r=t?tx(t)?.replace(/\/+$/,""):void 0,i=n??e.replace(/\\/g,"/"),s=/^(?:[a-zA-Z]:\/|\/\/|\/mnt\/[a-zA-Z](?:\/|$))/.test(i)||void 0!==r&&/^(?:[a-zA-Z]:\/|\/\/)/.test(r),a=e=>s?e.toLowerCase():e,l=null===n||void 0!==r&&(a(n)===a(r)||a(n).startsWith(`${a(r)}/`));return!!function(e,t){let n=(e,n)=>void 0!==e&&(t?e.toLowerCase()===n:e===n),r=e.findIndex(e=>n(e,".omp"));if(r<0||r===e.length-1)return!1;let i=e[r+1];if(n(i,"agent")||n(i,"wt")||n(i,"profiles")&&n(e[r+3],"agent"))return!1;let s=tC.get(i.toLowerCase());return!(void 0!==s&&(t||s===i))}((null!==n&&l&&void 0!==r?n.slice(r.length):i).split("/").filter(e=>""!==e&&"."!==e),s)||!l&&tN.some(e=>e.test(i))}function tI(e){return!!/^[a-zA-Z]:[\\/]/.test(e)||!/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//.test(e)}function tM(e,t,n){let r=new Set,i=[];for(let a of e){var s;if("toolCall"!==a.type||!(tv(s=a.toolName)||ty(s)))continue;let e=t?.get(a.toolCallId);if(e&&!e.isError)for(let t of tk(a.input,e)){if(!tI(t))continue;let e=tx(t,n);!(!e||tT(t,n))&&(r.has(e)||(r.add(e),i.push({filePath:e})))}}return i}function tE(e){let t=[];for(let n of e){if(!n||"object"!=typeof n||!("name"in n)||!("tasks"in n))return{phases:t,malformed:!0};let{name:e,tasks:r}=n;if("string"!=typeof e||!Array.isArray(r))return{phases:t,malformed:!0};let i=Array.isArray(r)?r.flatMap(e=>{if(!e||"object"!=typeof e||!("content"in e)||!("status"in e))return[];let{content:t,status:n}=e;if("string"!=typeof t||"pending"!==n&&"in_progress"!==n&&"completed"!==n&&"abandoned"!==n&&"blocked"!==n)return[];let r="blocker"in e&&"string"==typeof e.blocker?e.blocker:void 0,i="dependsOn"in e&&Array.isArray(e.dependsOn)?e.dependsOn.filter(e=>"string"==typeof e):[];return[{content:t,status:n,blocker:r,...i.length>0?{dependsOn:i}:{}}]}):[];if(i.length!==r.length)return{phases:t,malformed:!0};i.length>0&&t.push({name:e,tasks:i})}return{phases:t,malformed:!1}}function tR(e){if(!Array.isArray(e))return null;let{phases:t,malformed:n}=tE(e);return n?null:t}function t$(e,t){var n;let r;if(t){let e=t.details,n=e&&"object"==typeof e&&"phases"in e?e.phases:void 0;if(!Array.isArray(n))return{kind:"unknown"};let{phases:r,malformed:i}=tE(n);return i?{kind:"unknown"}:{kind:"authoritative",phases:r}}let i=Array.isArray(r=(n=e.input)&&"object"==typeof n&&"list"in n?n.list:void 0)?r.flatMap(e=>{if(!e||"object"!=typeof e||!("phase"in e)||!("items"in e))return[];let{phase:t,items:n}=e;if("string"!=typeof t||!Array.isArray(n))return[];let r=n.filter(e=>"string"==typeof e).map(e=>({content:e,status:"pending"}));return r.length>0?[{name:t,tasks:r}]:[]}):[];return i.length>0?{kind:"preview",phases:i}:{kind:"unknown"}}function tL(e){if(!e)return!1;let t=e.toLowerCase();return"todo"===t||t.endsWith(".todo")||t.endsWith("_todo")}function tP(e,t,n=null,r=null){return n||(function(e,t){for(let n=e.length-1;n>=0;n-=1){let r=e[n],i=r.trackerTodos??[];for(let e=i.length-1;e>=0;e-=1){let t=tR(i[e]);if(t)return t}if("assistant"!==r.role)continue;let s=r.content;if(Array.isArray(s))for(let e=s.length-1;e>=0;e-=1){let n=s[e];if("toolCall"!==n.type||!tL(n.toolName))continue;let r=t$(n,t.get(n.toolCallId));if("unknown"!==r.kind)return r.phases}}return null}(e,t)??r)}function tA(e,t){if(!e.dependsOn?.length)return[];let n=new Set(t.flatMap(e=>e.tasks.filter(e=>"completed"===e.status).map(e=>e.content)));return e.dependsOn.filter(e=>!n.has(e))}function t_(e){let t=0,n=0,r=null,i=null,s=null;for(let a of e)for(let l of a.tasks){if("completed"===l.status){t+=1;continue}"abandoned"!==l.status&&(n+=1,tA(l,e).length>0?s||(s={phase:a,task:l}):"in_progress"===l.status?r||(r={phase:a,task:l}):"blocked"===l.status?s||(s={phase:a,task:l}):i||(i={phase:a,task:l}))}let a=r??i??s,l=t+n;return{currentPhase:a?.phase??null,activeTask:a?.task??null,remaining:n,completed:t,total:l,percent:l>0?Math.round(t/l*100):null}}function tF(e){return/^[a-zA-Z]:[\\/]/.test(e)||e.startsWith("\\\\")?e.replace(/\\/g,"/"):e}function tO(e){return tF(e).split("/").filter(Boolean).map(encodeURIComponent).join("/")}function tz(e){let t=tF(e).replace(/\/+$/,"");return t.split("/").pop()??t}function tD(e,t){if(!t)return e;let n=tF(e),r=tF(t).replace(/\/$/,"");return n.startsWith(r+"/")?n.slice(r.length+1):e}var tW=n(65063),tH=n(7644),tU=n(32316),tB=n(88374),tq=n(63280),tV=n(94764),tK=n(63835),tG=n(54152),tJ=n(84678),tY=n(98164);let tZ={...tV.j,attributes:{...tV.j.attributes,code:[["className",/^language-./,"math-inline","math-display"]]},strip:[...tV.j.strip||[],"iframe","object","style","form"]};function tQ(e){let t=e.includes("\r\n")?"\r\n":"\n",n=e.split(/\r?\n/),r=[],i=null,s=0,a=null,l=new Map;for(let e=0;e<n.length;e++){var o;let t=n[e];if(a){r.push(t),RegExp(`</${a}\\s*>`,"i").test(t)&&(a=null);continue}let c=t.match(/^ {0,3}(`{3,}|~{3,})/);if(c){let e=c[1][0],n=c[1].length;i?e===i.marker&&n>=i.size&&(i=null):i={marker:e,size:n},s=0,r.push(t);continue}if(i){r.push(t);continue}let d=t.match(/<(code|pre|script|style)\b/i);if(d){let e=d[1].toLowerCase(),n=t.slice((d.index??0)+d[0].length);RegExp(`</${e}\\s*>`,"i").test(n)||(a=e),s=0,r.push(t);continue}if(/^(?: {4}|\t)/.test(t)||""===t.trim()){s=0,r.push(t);continue}if(s||t.includes("`")){s=function(e,t){let n=t;for(let t=0;t<e.length;){if("`"!==e[t]){t++;continue}let r=t+1;for(;"`"===e[r];)r++;let i=r-t;0===n?n=i:i===n&&(n=0),t=r}return n}(t,s),r.push(t);continue}let u=t.match(/^([ ]{0,3})\\\[[ \t]*(.+?)[ \t]*\\\][ \t]*$/);if(u){let e=u[2].trim();if(e){r.push(`${u[1]}$$`,`${u[1]}${e}`,`${u[1]}$$`);continue}}let h=t.match(/^([ ]{0,3})\\\[[ \t]*$/);if(h){let t=function(e,t){for(let n=t;n<e.length;n++){let t=e[n];if(/^ {0,3}\\\][ \t]*$/.test(t))return n;if(/^ {0,3}(`{3,}|~{3,})/.test(t)||/^ {0,3}\\\[[ \t]*$/.test(t)||/<(code|pre|script|style)\b/i.test(t))break}return -1}(n,e+1);if(-1!==t){r.push(`${h[1]}$$`,...n.slice(e+1,t).map(e=>t0(e,h[1])),`${h[1]}$$`),e=t;continue}}let p=t.match(/^([ \t]{0,3})\$\$(.+)\$\$[ \t]*$/);if(p){let e=p[2].trim();if(e){r.push(`${p[1]}$$`,`${p[1]}${e}`,`${p[1]}$$`);continue}}let m=t.match(/^([ \t]{0,3})\$\$(.+)$/);if(m){let t=m[1],i=m[2].trimEnd();if(i&&!i.includes("$$")){let s=tX(n,e+1,t,l);if(s){r.push(`${t}$$`,`${t}${i}`);for(let i=e+1;i<s.index;i++)r.push(t0(n[i],t));s.content&&r.push(`${t}${s.content}`),r.push(`${t}$$`),e=s.index;continue}}}let f=t.match(/^([ \t]{0,3})\$\$\s*$/);if(f){let t=f[1],i=tX(n,e+1,t,l);if(i&&(i.glued||""!==t)){r.push(`${t}$$`);for(let s=e+1;s<i.index;s++)r.push(t0(n[s],t));i.content&&r.push(`${t}${i.content}`),r.push(`${t}$$`),e=i.index;continue}}r.push((o=t,/^\s{0,3}\[[^\]]+\]:/.test(o)||/]\s*\(/.test(o)||/<(?:!--|\/?[A-Za-z][^>]*>)/.test(o)||/\b(?:https?|file|mailto):/i.test(o)||/\b[A-Za-z]:\\/.test(o)?o:o.replace(/(?<!\\)\\\(([^`\r\n$]+?)(?<!\\)\\\)/g,(e,t)=>t.trim()?`$${t}$`:e)))}return r.join(t)}function tX(e,t,n,r){let i=r.get(n);if(void 0!==i&&t<i)return null;for(let i=t;i<e.length;i++){var s,a,l,o;let t=e[i];if(s=t,""===(a=n)?/^ {0,3}\$\$\s*$/.test(s):s.startsWith(a)&&/^\$\$\s*$/.test(s.slice(a.length)))return{index:i,content:"",glued:!1};if(l=t,/^ {0,3}(`{3,}|~{3,})/.test(l)||/^[ \t]*(?:[-+*]|\d{1,9}[.)])(?:[ \t]+|$)/.test(l)||/^ {0,3}#{1,6}(?:[ \t]+|$)/.test(l)||/^ {0,3}>/.test(l)||/<(code|pre|script|style)\b/i.test(l)||(o=t,/^ {0,3}\$\$(?:\S|[ \t]+\S)/.test(o)))return r.set(n,i),null;let c=function(e,t){if(!e.startsWith(t))return null;let n=e.slice(t.length).match(/^(.+?)\$\$\s*$/);if(!n)return null;let r=n[1].trimEnd();return r&&!r.includes("$$")?r:null}(t,n);if(null!==c)return{index:i,content:c,glued:!0}}return r.set(n,e.length),null}function t0(e,t){if(!t||!e||e.startsWith(" "))return e;let n=e.match(/^ */)?.[0].length??0;return n>=t.length?e:`${t.slice(n)}${e}`}let t1={singleTilde:!1},t2=[[tG.A,["yaml"]],[tJ.A,t1],tY.A],t8=[[tG.A,["yaml"]],[tJ.A,t1],tY.A],t4=[tq.A,[tK.A,tZ],[tB.A,{throwOnError:!1,strict:!1}]],t5=[tq.A,[tK.A,tZ],[tB.A,{throwOnError:!1,strict:!1}]],t6="pi-theme",t3=["light","dark","auto"],t7={preference:"auto",theme:"light"},t9="omp-theme",ne=null,nt=0,nn=new Set,nr=null,ni=!1;function ns(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function na(e){return"auto"===e?ns():e}let nl="--omp-md-";function no(e){let t=document.documentElement,n=ne?.palettes[e];t.dataset.ompThemeMode=e,t.setAttribute("data-seed-color-mode","dark"===e?"dark-only":"light-only"),t.classList.toggle("dark","dark"===e);for(let e=t.style.length-1;e>=0;e-=1){let n=t.style.item(e);n.startsWith("--")&&!n.startsWith(nl)&&t.style.removeProperty(n)}if(n){for(let[e,r]of Object.entries(n.variables))e.startsWith(nl)&&t.style.setProperty(e,r);t.dataset.ompThemeName=n.name}try{localStorage.setItem(t9,e)}catch{}}function nc(){if(nr)return nr;let e=function(){try{let e=localStorage.getItem(t6);if("light"===e||"dark"===e||"auto"===e)return e;let t=localStorage.getItem(t9);if("light"===t||"dark"===t)return t}catch{}return"auto"}(),t=na(e);return no(t),nr={preference:e,theme:t}}function nd(e,t,n){if(no(t),n)try{localStorage.setItem(t6,e)}catch{}nr={preference:e,theme:t},nn.forEach(e=>e())}function nu(){let e=nc();if("auto"!==e.preference)return;let t=ns();t!==e.theme&&nd("auto",t,!1)}function nh(e){return nn.add(e),nc(),ni||!window.matchMedia||(window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",nu),window.addEventListener("focus",nu),document.addEventListener("visibilitychange",()=>{"visible"===document.visibilityState&&nu()}),ni=!0),nu(),()=>{nn.delete(e)}}function np(){return nc()}function nm(){return t7}async function nf(e){let t=++nt,n=e?`?cwd=${encodeURIComponent(e)}`:"",r=await fetch(`/api/theme${n}`,{cache:"no-store"});if(!r.ok)throw Error(`Theme request failed (${r.status})`);let i=await r.json();if(t===nt){ne=i;try{localStorage.setItem("omp-theme-config",JSON.stringify(ne))}catch{}no(nc().theme)}}function ng(e){let t=(0,i.useSyncExternalStore)(nh,np,nm);(0,i.useEffect)(()=>{e?.syncWithOmp&&nf(e.cwd).catch(()=>{})},[e?.cwd,e?.syncWithOmp]);let n=(0,i.useCallback)((e,t)=>{let n=na(e),r=()=>{nd(e,n,!0)},i=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;if("function"!=typeof document.startViewTransition||i)return void r();let s=t?.x??window.innerWidth/2,a=t?.y??window.innerHeight/2,l=Math.hypot(Math.max(s,window.innerWidth-s),Math.max(a,window.innerHeight-a));document.startViewTransition(r).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${s}px ${a}px)`,`circle(${l}px at ${s}px ${a}px)`]},{duration:450,easing:"cubic-bezier(0.22, 0.61, 0.36, 1)",pseudoElement:"::view-transition-new(root)"})}).catch(()=>{})},[]),r=(0,i.useCallback)(e=>{var t;let r;n((t=nc().preference,r=t3.indexOf(t),t3[(r+1)%t3.length]),e)},[n]),s=(0,i.useCallback)((e,t)=>{n(e,t)},[n]);return{theme:t.theme,preference:t.preference,toggleTheme:r,setPreference:s,isDark:"dark"===t.theme}}function nx(e){if(navigator.clipboard?.writeText)return navigator.clipboard.writeText(e);try{let t=document.createElement("textarea");return t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t),Promise.resolve()}catch{return Promise.reject()}}let nv={...tH.vs,...Object.fromEntries(["url","symbol","number","boolean","variable","constant","inserted"].map(e=>[e,{...tH.vs[e],color:"var(--seed-color-palette-green-800)"}]))};function ny({code:e,isStreaming:t}){let{isDark:s}=ng(),{t:a}=(0,F.s)(),[l,o]=(0,i.useState)(!0),[c,d]=(0,i.useState)(null),[u,h]=(0,i.useState)(!1),p=`${s?"dark":"light"}
4
4
  ${e}`,m=l&&!t;(0,i.useEffect)(()=>{if(!m)return;let t=!1;return d({key:p,status:"loading"}),(async()=>{let{default:r}=await Promise.all([n.e(866),n.e(8367),n.e(3308)]).then(n.bind(n,43328)),i=getComputedStyle(document.body).fontFamily;if(await document.fonts.load(`16px ${i}`,e),await document.fonts.ready,t)return;if(r.initialize({startOnLoad:!1,securityLevel:"strict",suppressErrorRendering:!0,theme:s?"dark":"default",fontFamily:i}),!await r.parse(e,{suppressErrors:!0}))throw Error("Invalid Mermaid diagram");let a="u">typeof crypto&&"randomUUID"in crypto?`mermaid-${crypto.randomUUID()}`:`mermaid-${Date.now()}-${Math.random().toString(36).slice(2)}`,l=await r.render(a,e);t||d({key:p,status:"ready",svg:l.svg})})().catch(()=>{t||d({key:p,status:"error"})}),()=>{t=!0}},[e,p,s,m]);let f=(0,i.useMemo)(()=>(0,r.jsx)("button",{type:"button",onClick:()=>o(e=>!e),disabled:t,title:t?a("i18n.previewAfterStreaming"):m?a("i18n.showMermaidSource"):a("i18n.previewMermaid"),className:["markdown-code-action",m?"is-active":""].filter(Boolean).join(" "),children:m?a("i18n.source"):a("i18n.preview")}),[t,m,a]);if(!m)return(0,r.jsx)(nw,{code:e,lang:"mermaid",headerAction:f,isStreaming:t});let g=c?.key===p&&"error"===c.status?(0,r.jsx)("div",{className:"mermaid-block mermaid-block-error",children:a("i18n.invalidMermaid")}):c?.key!==p||"ready"!==c.status?(0,r.jsx)("div",{className:"mermaid-block mermaid-block-loading","aria-label":a("i18n.renderingMermaid")}):(0,r.jsxs)(r.Fragment,{children:[!u&&(0,r.jsx)("button",{type:"button",className:"mermaid-block mermaid-preview-button",title:a("i18n.openMermaidViewer"),"aria-label":a("i18n.openMermaidViewer"),onClick:()=>h(!0),dangerouslySetInnerHTML:{__html:c.svg}}),u&&(0,r.jsx)(nb,{svg:c.svg,onClose:()=>h(!1)})]});return(0,r.jsxs)("div",{className:"markdown-code-block",children:[(0,r.jsxs)("div",{className:"markdown-code-header",children:[(0,r.jsx)("span",{className:"markdown-code-lang",children:"mermaid"}),f]}),g]})}function nb({svg:e,onClose:t}){let{t:n}=(0,F.s)(),s=(0,i.useRef)(null),[a,l]=(0,i.useState)(1);return(0,i.useEffect)(()=>{let e=s.current;if(!e)return;let t=document.body.style.overflow;return document.body.style.overflow="hidden",e.showModal(),()=>{document.body.style.overflow=t,e.open&&e.close()}},[]),(0,r.jsx)("dialog",{ref:s,className:"mermaid-zoom-dialog","aria-label":n("i18n.mermaidViewer"),onCancel:e=>{e.preventDefault(),t()},onKeyDown:e=>{"Escape"===e.key&&(e.preventDefault(),t())},children:(0,r.jsxs)("div",{className:"mermaid-zoom-layout",children:[(0,r.jsxs)("div",{className:"mermaid-zoom-toolbar",children:[(0,r.jsx)("span",{className:"mermaid-zoom-title",children:n("i18n.mermaidDiagram")}),(0,r.jsxs)("div",{className:"mermaid-zoom-actions",children:[(0,r.jsxs)("div",{className:"mermaid-zoom-stepper",children:[(0,r.jsx)("button",{type:"button",onClick:()=>l(e=>Math.max(.5,e-.25)),disabled:a<=.5,title:n("i18n.zoomOut"),"aria-label":n("i18n.zoomOut"),children:(0,r.jsx)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:(0,r.jsx)("path",{d:"M5 12h14"})})}),(0,r.jsxs)("span",{className:"mermaid-zoom-value",children:[Math.round(100*a),"%"]}),(0,r.jsx)("button",{type:"button",onClick:()=>l(e=>Math.min(3,e+.25)),disabled:a>=3,title:n("i18n.zoomIn"),"aria-label":n("i18n.zoomIn"),children:(0,r.jsx)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:(0,r.jsx)("path",{d:"M12 5v14M5 12h14"})})})]}),(0,r.jsx)("button",{type:"button",className:"mermaid-zoom-icon-button",onClick:()=>l(1),title:n("i18n.fitToWidth"),"aria-label":n("i18n.fitToWidth"),children:(0,r.jsx)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,r.jsx)("path",{d:"M8 3H3v5M16 3h5v5M8 21H3v-5M16 21h5v-5"})})}),(0,r.jsx)("button",{type:"button",className:"mermaid-zoom-icon-button",onClick:t,title:n("i18n.close"),"aria-label":n("i18n.close"),children:(0,r.jsx)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:(0,r.jsx)("path",{d:"M6 6l12 12M18 6 6 18"})})})]})]}),(0,r.jsx)("div",{className:"mermaid-zoom-viewport",onClick:e=>{e.target===e.currentTarget&&t()},children:(0,r.jsx)("div",{className:"mermaid-zoom-canvas",style:{width:`${100*a}%`},dangerouslySetInnerHTML:{__html:e}})})]})})}let nw=(0,i.memo)(function({code:e,lang:t,headerAction:n,isStreaming:s}){let{isDark:a}=ng(),{t:l}=(0,F.s)(),[o,c]=(0,i.useState)(!1);return(0,r.jsxs)("div",{className:"markdown-code-block",children:[(0,r.jsxs)("div",{className:"markdown-code-header",children:[(0,r.jsx)("span",{className:"markdown-code-lang",children:t||"text"}),(0,r.jsxs)("div",{className:"markdown-code-actions",children:[n,(0,r.jsx)("button",{onClick:()=>{nx(e).then(()=>{c(!0),setTimeout(()=>c(!1),1500)})},className:"markdown-code-action",children:l(o?"i18n.copied":"i18n.copy")})]})]}),s?(0,r.jsx)("pre",{style:{margin:0,padding:"11px 13px",fontSize:12.5,lineHeight:1.62,overflowX:"auto",background:"color-mix(in srgb, var(--bg) 92%, var(--bg-panel))"},children:(0,r.jsx)("code",{style:{fontFamily:"var(--font-mono)"},children:e})}):(0,r.jsx)(tW.A,{language:t||"text",style:a?tH.xJ:nv,showLineNumbers:!0,lineNumberStyle:{color:"var(--text-muted)",fontStyle:"normal"},customStyle:{margin:0,padding:"11px 13px",fontSize:12.5,lineHeight:1.62,borderRadius:0,background:"color-mix(in srgb, var(--bg) 92%, var(--bg-panel))"},codeTagProps:{style:{fontFamily:"var(--font-mono)"}},children:e})]})});function nk({children:e,className:t,isStreaming:n,cwd:s,onOpenFile:a}){let l=(0,i.useMemo)(()=>tQ(e),[e]),o=(0,i.useMemo)(()=>({code({className:e,children:t,...i}){let s=e?.replace("language-","").toLowerCase()??"",a=String(t);return e?.includes("language-")||a.includes("\n")?"mermaid"===s?(0,r.jsx)(ny,{code:a.replace(/\n$/,""),isStreaming:n}):(0,r.jsx)(nw,{code:a.replace(/\n$/,""),lang:s,isStreaming:n}):(0,r.jsx)("code",{className:"markdown-inline-code",...i,children:t})},pre:({children:e})=>(0,r.jsx)(r.Fragment,{children:e}),a({href:e,children:t,...n}){delete n.node;let i=a?tg(e,s):null;return i&&a?(0,r.jsx)("a",{href:e,...n,onClick:e=>{if(e.defaultPrevented||0!==e.button||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=e.currentTarget.getAttribute("target");t&&"_self"!==t||(e.preventDefault(),a(i))},children:t}):(0,r.jsx)("a",{href:e,...n,target:"_blank",rel:"noopener noreferrer",children:t})},img({src:e,alt:t,...n}){delete n.node;let i="string"==typeof e?tg(e,s):null,a=i?`/api/files/${tO(i)}?type=read`:e;return(0,r.jsx)("img",{src:a,alt:t??"",loading:"lazy",...n})},table:({children:e})=>(0,r.jsx)("div",{className:"markdown-table-wrap",children:(0,r.jsx)("table",{children:e})})}),[s,n,a]);return(0,r.jsx)("div",{className:["markdown-body",t].filter(Boolean).join(" "),children:(0,r.jsx)(tU.oz,{remarkPlugins:t2,rehypePlugins:t4,components:o,children:l})})}function nj(e){let[t,n]=(0,i.useState)(()=>Date.now());return(0,i.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}let nS=new Map,nC=new Set;function nN(){nC.forEach(e=>e())}function nT(e){return nC.add(e),()=>{nC.delete(e)}}function nI(e,t){return e&&t?`${e}\u0000${t}`:null}function nM(e){let t=!1;for(let n of e)t=nS.delete(n)||t;t&&nN()}var nE=n(54265);let nR=(0,i.createContext)(null);function n$(e,t,n){return Math.min(n,Math.max(t,e))}function nL(e,t,n){let r=t.width>0?n.width/t.width:0,i=t.height>0?n.height/t.height:0;return{x:n$((e.x-t.left)*r,0,n.width),y:n$((e.y-t.top)*i,0,n.height)}}function nP(e){let t=n$(Math.round(.004*Math.max(e.width,e.height)),2,12);return{inner:t,outer:2*t}}let nA="#e5191f",n_="#ffffff";function nF(e){let{promise:t,resolve:n,reject:r}=Promise.withResolvers();return e.toBlob(e=>e?n(e):r(Error("canvas encode failed")),"image/png"),t}function nO(e,t){let n=document.createElement("canvas");n.width=e,n.height=t;let r=n.getContext("2d");if(!r)throw Error("canvas 2d unavailable");return[n,r]}async function nz(e,t){let n=await createImageBitmap(e);try{let e={width:n.width,height:n.height},{inner:r,outer:i}=nP(e),s=Math.max(14,7*nP(e).inner),[a,l]=nO(e.width,e.height);l.drawImage(n,0,0),t.forEach((t,n)=>{let a=function(e,t){let{inner:n,outer:r}=nP(t),i=(n,r)=>{let i=n$(e.x-n,r,t.width-r),s=n$(e.y-n,r,t.height-r),a=n$(e.x+e.w+n,r,t.width-r);return{x:i,y:s,w:Math.max(0,a-i),h:Math.max(0,n$(e.y+e.h+n,r,t.height-r)-s)}};return{inner:i(n/2,n/2),outer:i(n+r/2,r/2)}}(t,e);l.lineJoin="miter",l.strokeStyle=n_,l.lineWidth=i,l.strokeRect(a.outer.x,a.outer.y,a.outer.w,a.outer.h),l.strokeStyle=nA,l.lineWidth=r,l.strokeRect(a.inner.x,a.inner.y,a.inner.w,a.inner.h);let o=String(n+1);l.font=`700 ${s}px sans-serif`;let c=Math.round(.35*s),d=Math.ceil(l.measureText(o).width)+2*c,u=Math.round(1.3*s),h=Math.min(Math.max(0,t.x-r),e.width-d),p=t.y-r-u,m=p>=0?p:Math.min(t.y,e.height-u);l.fillStyle=n_,l.fillRect(h-1,m-1,d+2,u+2),l.fillStyle=nA,l.fillRect(h,m,d,u),l.fillStyle=n_,l.textBaseline="middle",l.textAlign="center",l.fillText(o,h+d/2,m+u/2)});let o=await Promise.all(t.map(t=>{let r=function(e,t,n=.12){let r=Math.round(e.w*n),i=Math.round(e.h*n),s=n$(e.x-r,0,t.width),a=n$(e.y-i,0,t.height),l=n$(e.x+e.w+r,0,t.width);return{x:s,y:a,w:l-s,h:n$(e.y+e.h+i,0,t.height)-a}}(t,e),[i,s]=nO(r.w,r.h);return s.drawImage(n,r.x,r.y,r.w,r.h,0,0,r.w,r.h),nF(i)}));return{marked:await nF(a),crops:o}}finally{n.close()}}function nD({src:e,regions:t,max:n,onAdd:s,onNaturalSize:a,regionLabel:l}){let o=(0,i.useRef)(null),[c,d]=(0,i.useState)(null),u=(0,i.useRef)(null),[h,p]=(0,i.useState)(null),m=e=>{let t=o.current,n=u.current;return t&&n&&c?function(e,t,n,r){let i=n$(Math.min(e.x,t.x),n.left,n.left+n.width),s=n$(Math.max(e.x,t.x),n.left,n.left+n.width),a=n$(Math.min(e.y,t.y),n.top,n.top+n.height),l=n$(Math.max(e.y,t.y),n.top,n.top+n.height);if(s-i<6||l-a<6)return null;let o=nL({x:i,y:a},n,r),c=nL({x:s,y:l},n,r),d=Math.floor(o.x),u=Math.floor(o.y),h=Math.min(r.width,Math.ceil(c.x))-d,p=Math.min(r.height,Math.ceil(c.y))-u;return h>0&&p>0?{x:d,y:u,w:h,h:p}:null}(n.start,e,t.getBoundingClientRect(),c):null},f=(e,t)=>{if(u.current?.pointerId!==e.pointerId)return;let n=t?m({x:e.clientX,y:e.clientY}):null;u.current=null,p(null),n&&s(n)};return(0,r.jsxs)("div",{className:"tool-image-marker","data-drawing":c&&t.length<n?"true":void 0,onPointerDown:e=>{c&&!(t.length>=n)&&("mouse"!==e.pointerType||0===e.button)&&(e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId),u.current={pointerId:e.pointerId,start:{x:e.clientX,y:e.clientY}})},onPointerMove:e=>{u.current?.pointerId===e.pointerId&&p(m({x:e.clientX,y:e.clientY}))},onPointerUp:e=>f(e,!0),onPointerCancel:e=>f(e,!1),children:[(0,r.jsx)("img",{ref:o,className:"tool-image-full",src:e,alt:"",draggable:!1,onLoad:e=>{let t={width:e.currentTarget.naturalWidth,height:e.currentTarget.naturalHeight};d(t),a(t)}}),c&&t.map((e,t)=>(0,r.jsx)(nW,{region:e,natural:c,label:String(t+1),title:l(t+1)},`${t}-${e.x}-${e.y}`)),c&&h&&(0,r.jsx)(nW,{region:h,natural:c})]})}function nW({region:e,natural:t,label:n,title:i}){let s={left:e.x/t.width*100,top:e.y/t.height*100,width:e.w/t.width*100,height:e.h/t.height*100};return(0,r.jsx)("span",{className:"tool-image-region","data-draft":n?void 0:"true",role:n?"img":void 0,"aria-label":i,style:{left:`${s.left}%`,top:`${s.top}%`,width:`${s.width}%`,height:`${s.height}%`},children:n&&(0,r.jsx)("span",{className:"tool-image-region-number","aria-hidden":"true",children:n})})}function nH(e){if(!e||"object"!=typeof e||"string"!=typeof e.data||"string"!=typeof e.mimeType||!e.mimeType.startsWith("image/"))return!1;let t=function(e){if(!e||e.length%4!=0)return null;let t=e.endsWith("==")?2:+!!e.endsWith("="),n=e.length-t;for(let t=0;t<n;t+=1){var r;if(!((r=e.charCodeAt(t))>=65&&r<=90||r>=97&&r<=122||r>=48&&r<=57||43===r||47===r))return null}for(let t=n;t<e.length;t+=1)if("="!==e[t])return null;return e.length/4*3-t}(e.data);return null!==t&&t<=0xa00000}function nU(e){let t=e.details;if("number"==typeof t?.exitCode)return t.exitCode;let n=e.content.map(e=>"text"===e.type?e.text:"").join("\n"),r=/Command exited with code (-?\d+)\s*$/.exec(n.trimEnd());return r?Number(r[1]):null}let nB=/<(read-files|modified-files)>\s*([\s\S]*?)\s*<\/\1>/g,nq=/(?:\r?\n){2,}((?:[ \t]*<(?:read-files|modified-files)>[ \t]*\r?\n[\s\S]*?\r?\n[ \t]*<\/(?:read-files|modified-files)>[ \t]*(?:\r?\n)?)+)\s*$/;function nV(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${Math.round(e/1e3)}k`:e.toLocaleString()}let nK={hideThinkingBlock:!1},nG=new Set,nJ=nK,nY=0;function nZ(e){return nG.add(e),()=>{nG.delete(e)}}function nQ(){return nJ}function nX(){return nK}async function n0(e){let t=++nY,n=e?`?cwd=${encodeURIComponent(e)}`:"",r=await fetch(`/api/display-settings${n}`,{cache:"no-store"});if(!r.ok)throw Error(`Display settings request failed (${r.status})`);let i=await r.json();t!==nY||i.hideThinkingBlock!==nJ.hideThinkingBlock&&(nJ={hideThinkingBlock:!0===i.hideThinkingBlock},nG.forEach(e=>e()))}function n1(){return(0,i.useSyncExternalStore)(nZ,nQ,nX)}function n2(e){let t=new Date(e),n=e=>String(e).padStart(2,"0");return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}let n8=["YUKI(유키)","ISANA(이사나)","MIO(미오)","RIN(린)","MITSU(미츠)","SHION(시온)","HIKARI(히카리)"],n4={"YUKI(유키)":"yuki","ISANA(이사나)":"isana","MIO(미오)":"mio","RIN(린)":"rin","MITSU(미츠)":"mitsu","SHION(시온)":"shion","HIKARI(히카리)":"hikari"},n5=["approval","choice","done","failed","blocked","working"],n6={approval:"부름",choice:"물음",done:"기쁨",failed:"사과",blocked:"난처",working:"시작"},n3={approval:!1,choice:!1,done:!1,failed:!1,blocked:!1,working:!0},n7="/api/office-characters/",n9={voice:"/audio/completion/",sticker:"/stickers/"};function re(e){switch(e){case"completed":return"done";case"failed":return"failed";case"aborted":return null;default:return"neutral"}}function rt(e){return void 0===e?"done":"string"==typeof e&&Object.hasOwn(n6,e)?e:null}function rn(e,t){let n=new Map,r=new Map;if(!Array.isArray(e))return{files:n,lines:r};for(let i of e){if("object"!=typeof i||null===i)continue;let{file:e,tag:s,ko:a}=i;if("string"!=typeof e||""===e)continue;let l=rt(s);if(null===l)continue;let o=t+e.replace(/^\/+/,""),c=n.get(l);c?c.push(o):n.set(l,[o]),"string"==typeof a&&""!==a.trim()&&r.set(o,a.trim())}return{files:n,lines:r}}function rr(e,t=n9){let n=new Map;if("object"!=typeof e||null===e)return n;let{characters:r}=e;if(!Array.isArray(r))return n;for(let e of r){if("object"!=typeof e||null===e)continue;let{id:r,clips:i,stickers:s,captions:a}=e;if("string"!=typeof r||""===r)continue;let l=rn(i,t.voice),o=rn(s,t.sticker),c=function(e){let t=new Map;if(!Array.isArray(e))return t;for(let n of e){if("object"!=typeof n||null===n)continue;let{tag:e,ko:r}=n;if("string"!=typeof r||""===r.trim())continue;let i=rt(e);if(null===i)continue;let s=t.get(i);s?s.push(r.trim()):t.set(i,[r.trim()])}return t}(a),d=new Map;for(let e of n5){let t=l.files.get(e)??[],n=new Map;for(let e of t){let t=l.lines.get(e);void 0!==t&&n.set(e,t)}d.set(e,{voices:t,stickers:o.files.get(e)??[],lines:n,captions:c.get(e)??[]})}n.set(r,d)}return n}function ri(e,t,n){let r=t&&Object.hasOwn(n4,t)?n4[t]:null;return r?e.get(r)?.get(n)??null:null}function rs(e,t,n){return e.get(t)?.get(n)??null}async function ra(e=fetch){try{let t=await e("/audio/completion/voices.json");if(!t.ok)return new Map;return rr(await t.json())}catch{return new Map}}function rl(e,t,n=Math.random){if(0===e.length)return null;if(1===e.length)return e[0];let r=null===t?-1:e.indexOf(t),i=-1===r?e.length:e.length-1,s=Math.min(i-1,Math.max(0,Math.floor(n()*i)));return e[-1!==r&&s>=r?s+1:s]}function ro(e){let t=[];if("bashExecution"!==e.role){if("string"==typeof e.content)t.push(e.content.trim());else for(let n of e.content)if("text"===n.type)t.push(n.text.trim());else if("toolCall"===n.type){let e="id"in n&&"string"==typeof n.id?n.id:"";t.push(`toolCall:${n.toolCallId||e}`)}}let n="toolResult"===e.role?e.toolCallId:"custom"===e.role?e.customType:"bashExecution"===e.role?e.command:null;return JSON.stringify([e.role,n,t.filter(Boolean)])}function rc(e,t,n,r){if(t&&("web6"!==t.provider||t.model!==rd))return{provider:t.provider,model:t.model,credentialId:t.credentialId};for(let t=e.length-1;t>=0;t--){let n=e[t];if("user"===n.role)break;if("assistant"===n.role&&("web6"!==n.provider||n.model!==rd))return{provider:n.provider,model:n.model,credentialId:n.credentialId}}return{provider:n,model:r,credentialId:void 0}}let rd="ChatGPT 6PRO",ru="/api/sidecars/resource";function rh(e){if("string"==typeof e.status&&"unknown"!==e.status)return"exhausted"===e.status;let t=e.amount??{},n=e=>{let n=t[e];return"number"==typeof n&&Number.isFinite(n)?n:null},r=n("usedFraction");if(null!==r&&r>=1)return!0;let i=n("remainingFraction");if(null!==i&&i<=0)return!0;let s=n("used"),a=n("limit");if(null!==s&&null!==a&&s>=a)return!0;let l=n("remaining");return null!==l&&l<=0||"percent"===t.unit&&null!==s&&s>=100}let rp=[{alias:"RIN(린)",file:"rin.webp"},{alias:"MIO(미오)",file:"mio.webp"},{alias:"MITSU(미츠)",file:"mitsu.webp",provider:"hive",model:"zai-org/glm-5.3-flash"},{alias:"YUKI(유키)",file:"yuki.webp",provider:"openai-codex"},{alias:"ISANA(이사나)",file:"isana.webp",provider:"hive"},{alias:"SHION(시온)",file:"shion.webp",provider:"web6"},{alias:"HIKARI(히카리)",file:"hikari.webp",provider:"google-vertex",model:"gemini-4-argon"}],rm={"gemini-4-argon":"HIKARI(히카리)"},rf=[{seed:3,alias:rp[3].alias,provider:"openai-codex",model:"gpt-6-astra",voice:"빠른 판단\xb7선명한 결론\xb7영리한 장난기",summonExample:"유키 불러와",switchExample:"유키로 교체해"},{seed:4,alias:rp[4].alias,provider:"hive",model:"deepseek-ai/deepseek-v4.1-flash-1017",voice:"호기심과 실행력\xb7생기 있는 관찰\xb7솔직함",summonExample:"이사나 불러와",switchExample:"이사나로 교체해"},{seed:0,alias:rp[0].alias,provider:"anthropic",model:"claude-opus-5-5",oauthPosition:0,voice:"조용한 집중\xb7날카로운 분석\xb7건조한 유머",summonExample:"린 불러와",switchExample:"린으로 교체해"},{seed:1,alias:rp[1].alias,provider:"anthropic",model:"claude-opus-5-5",oauthPosition:1,voice:"따뜻하고 세심함\xb7부드럽고 안정적인 설명",summonExample:"미오 불러와",switchExample:"미오로 교체해"},{seed:2,alias:rp[2].alias,provider:"hive",model:"zai-org/glm-5.3-flash",voice:"부지런한 배달\xb7통통 튀는 보고\xb7끈질긴 재도전",summonExample:"미츠 불러와",switchExample:"미츠로 교체해"},{seed:6,alias:rp[6].alias,provider:"google-vertex",model:"gemini-4-argon",voice:"빠른 관찰\xb7톡 쏘는 한마디\xb7장난스러운 여유",summonExample:"히카리 불러와",switchExample:"히카리로 교체해"},{seed:5,alias:rp[5].alias,provider:"web6",model:"gpt-6-pro",voice:"우아한 전략\xb7넓은 시야\xb7은근한 장난기",summonExample:"시온 불러와",switchExample:null,summonNote:"WEB6 상담으로 호출합니다.",switchNote:"SHION은 WEB6 상담 전용이라 Main으로 교체할 수 없습니다."}],rg=rf.filter(e=>null!==e.switchExample),rx={mode:"default",rosterAvailable:!1,seats:[]},rv=rx,ry=new Map,rb=new Map,rw=rf,rk=new Set,rj=null,rS=0,rC=new Map,rN=new Map,rT=null,rI=!1;function rM(e){let t="office"===e.mode?e.seats.filter(e=>!rp.some(t=>t.alias===e.alias)&&"MITSU(미츠)"!==e.seat):[];rS+=1;let n=JSON.stringify([e.mode,e.rosterAvailable,t]);if(n!==rT)for(let r of(rT=n,rv={...e,seats:t},rb=new Map([...ry=new Map(t.flatMap(e=>{let t=rp.findIndex(t=>t.alias===e.seat);return t>=0?[[t,e]]:[]}))].flatMap(([e,t])=>{let n=rp[e];return"provider"in n&&!("model"in n)?[[n.provider,{seed:e,alias:t.alias}]]:[]})),rC=new Map([...ry].flatMap(([e,t])=>{let n=rp[e];return"model"in n?[[`${n.provider}/${n.model}`,{seed:e,alias:t.alias}]]:[]})),rN=new Map(Object.entries(rm).flatMap(([e,t])=>{let n=rp.findIndex(e=>e.alias===t),r=ry.get(n);return r?[[e,{seed:n,alias:r.alias}]]:[]})),rw=0===ry.size?rf:rf.map(e=>{let t,n,r,i=ry.get(rp.findIndex(t=>t.alias===e.alias));return i?(t=i.names.findLast(e=>/[가-힣]/.test(e))??i.names[0]??i.alias.split("(",1)[0],{...e,alias:i.alias,voice:i.voice.temperament.split(/(?<=[.。])\s/,1)[0].replace(/[.。]$/,""),summonExample:`${t} 불러와`,switchExample:`${r=(n=t.charCodeAt(t.length-1)-44032)>=0&&n<=11171?n%28:0,`${t}${0===r||8===r?"로":"으로"}`} 교체해`}):e}),rk))r()}function rE(){return rv}function rR(e){return rk.add(e),()=>{rk.delete(e)}}async function r$(e=fetch){let t=rS;try{let n=await e("/api/character-mode",{cache:"no-store"});if(!n.ok)return!1;let r=await n.json();if("object"!=typeof r||null===r)return!1;if(t!==rS)return!0;let{mode:i,rosterAvailable:s,seats:a}=r;return rM({mode:"office"===i?"office":"default",rosterAvailable:!0===s,seats:Array.isArray(a)?a:[]}),!0}catch{return!1}}let rL=new WeakMap;function rP(e){let t=rL.get(e);return t||(t=rr(e.manifest,{voice:n7,sticker:n7}),rL.set(e,t)),t}function rA(e){return e?rv.seats.find(t=>t.seat===e||t.alias===e)??null:null}function r_(e){return rv.seats.find(t=>t.seat===e)?.alias??e}let rF=rp.filter(e=>!("provider"in e)).length,rO=new Map(rp.flatMap((e,t)=>"provider"in e&&!("model"in e)?[[e.provider,t]]:[])),rz=new Map(rp.flatMap((e,t)=>"model"in e?[[`${e.provider}/${e.model}`,{seed:t,alias:e.alias}]]:[])),rD=new Map(Object.entries(rm).map(([e,t])=>[e,{seed:rp.findIndex(e=>e.alias===t),alias:t}])),rW=new Map([...rO].map(([e,t])=>[e,{seed:t,alias:rp[t].alias}])),rH=new Map(Object.entries({"google-antigravity":"HIKARI(히카리)"}).map(([e,t])=>[e,rp.findIndex(e=>e.alias===t)]));function rU(e,t){if(void 0===t)return null;let n=`${e}/${t}`;return rC.get(n)??rN.get(t)??rz.get(n)??rD.get(t)??null}function rB(e){return rb.get(e)??rW.get(e)??null}function rq(e){let t=e%rp.length;return ry.get(t)?.alias??rp[t].alias}function rV(e){let t=e%rp.length;return ry.get(t)?.faceUrl??`/avatars/${rp[t].file}`}function rK(e){return 0===e.length?"":1===e.length?"•••":2===e.length?`${e[0]}•••`:`${e[0]}•••${e[e.length-1]}`}function rG(e){return({"openai-codex":"OpenAI Codex",anthropic:"Anthropic","google-gemini":"Google Gemini","github-copilot":"GitHub Copilot","opencode-go":"OpenCode Go",devin:"Devin","b-ai":"B.AI",web6:"WEB6"})[e]??e.replace(/(^|-)(\w)/g,(e,t,n)=>`${t?" ":""}${n.toUpperCase()}`)}function rJ(e){let t=new Map;for(let n of e){if(!Number.isSafeInteger(n.oauthPosition)||n.oauthPosition<0)continue;let e=t.get(n.provider)??new Set;e.add(n.oauthPosition),t.set(n.provider,e)}return e.map(e=>{var n;let r=e.metadata?.email,i=e.metadata?.accountId,s="string"==typeof r&&r.length>0?r:"string"==typeof i?i:"",a=s.length>0?function(e){let t=e.lastIndexOf("@");if(t<=0)return rK(e);let n=e.slice(t+1),r=n.lastIndexOf("."),i=r<0?n:n.slice(0,r),s=r<0?"":n.slice(r);return`${rK(e.slice(0,t))}@${0===i.length?"":`${i[0]}•••`}${s}`}(s):"",l=(n=e.provider,rO.get(n)??-1);if(l>=0)return{seed:l,alias:rq(l),masked:a,raw:s};let o=e.oauthPosition;if(!Number.isSafeInteger(o)||o<0){let n=t.get(e.provider)??new Set;for(o=0;n.has(o);)o++;n.add(o),t.set(e.provider,n)}let c=rH.get(e.provider)??-1;if(c>=0)return{seed:c,alias:`${rq(c)}${o+1}`,masked:a,raw:s};let d=o%rF,u=o<rF?rq(d):`${rq(d)}${o+1}`;return{seed:d,alias:u,masked:a,raw:s}})}class rY extends Error{constructor(e,t,n,r){super(e,r),this.kind=t,this.status=n,this.name="ResourceClientError",this.code=r?.code,this.outcomeUnknown=r?.outcomeUnknown}}function rZ(e,t){return`${ru}${e}${t?"?refresh=1":""}`}function rQ(e,t,n=!1){return e instanceof rY?e:t?new rY("요청 시간이 초과되었습니다.","timeout",void 0,{cause:e}):n||e instanceof DOMException&&"AbortError"===e.name?new rY("요청이 취소되었습니다.","aborted",void 0,{cause:e}):new rY(e instanceof Error?e.message:String(e),"network",void 0,{cause:e})}function rX(e,t){return null==e?{status:"error",data:null,error:t}:{status:"stale",data:e,error:t}}async function r0(e,t){let n,r=t.fetchImpl??fetch,i=new AbortController,s=!1,a=()=>i.abort(t.signal?.reason);t.signal?.aborted?a():t.signal?.addEventListener("abort",a,{once:!0}),null!=t.timeoutMs&&(n=setTimeout(()=>{s=!0,i.abort(new DOMException("Timeout","TimeoutError"))},t.timeoutMs));try{let t,n=await r(e,{signal:i.signal});try{t=await n.json()}catch(e){throw new rY("리소스 서버 응답이 JSON이 아닙니다.","invalid-response",n.status,{cause:e})}let s=t&&"object"==typeof t?t:null,a="string"==typeof s?.error?s.error:null;if(!n.ok||a)throw new rY(a??`HTTP ${n.status}`,"http",n.status,{code:"string"==typeof s?.code?s.code:void 0,outcomeUnknown:s?.outcomeUnknown===!0});return t}catch(e){throw rQ(e,s,i.signal.aborted)}finally{clearTimeout(n),t.signal?.removeEventListener("abort",a)}}function r1(e){return"google-antigravity"===e.provider&&Array.isArray(e.limits)?{...e,limits:e.limits.filter(e=>"google"===e.id.split(":")[1]||/gemini/i.test(e.label??""))}:e}async function r2(e={}){try{let t=await r0(rZ("/usage",!0===e.refresh),e);if(!t||!Array.isArray(t.reports))throw new rY("사용량 응답 형식이 올바르지 않습니다.","invalid-response");return{status:"fresh",data:{...t,reports:t.reports.map(r1)},error:null}}catch(t){return rX(e.previous,rQ(t,!1))}}async function r8(e,t={}){if(!e)return rX(void 0,new rY("세션 id가 올바르지 않습니다.","invalid-response"));try{let n=await r0(`/api/agent/${encodeURIComponent(e)}/account`,t),r=n?.state==="resolved"||n?.state==="unresolved"||n?.state==="not-running"||n?.state==="unsupported";if(!n||n.sessionId!==e||"number"!=typeof n.observedAt||!r||!Array.isArray(n.resetRecommendations))throw new rY("현재 계정 응답 형식이 올바르지 않습니다.","invalid-response");return{status:"fresh",data:n,error:null}}catch(e){return rX(void 0,rQ(e,!1))}}async function r4(e={}){try{let t=await r0(rZ("/models",!0===e.refresh),{...e,timeoutMs:e.timeoutMs??12e4});if(!t||!Array.isArray(t.models)||!Array.isArray(t.agents)||!Array.isArray(t.daily))throw new rY("모델 집계 응답 형식이 올바르지 않습니다.","invalid-response");return{status:"fresh",data:t,error:null}}catch(t){return rX(e.previous,rQ(t,!1))}}async function r5(e={}){try{let t=await r0(`${ru}/credits${!0===e.refresh?"?refresh=1":""}`,{...e,timeoutMs:e.timeoutMs??6e4});if(!(t&&"object"==typeof t&&t.settings&&"object"==typeof t.settings&&t.hive&&Array.isArray(t.hive.rows)&&(void 0===t.anthropic||Array.isArray(t.anthropic?.rows))&&(void 0===t.balances||Array.isArray(t.balances)&&t.balances.every(e=>!!e&&"string"==typeof e.wallet&&(null===e.recorded||"object"==typeof e.recorded&&Number.isFinite(e.recorded?.amountUsd)&&Number.isFinite(e.recorded?.observedAt))))))throw new rY("API 크레딧 응답 형식이 올바르지 않습니다.","invalid-response");return{status:"fresh",data:t,error:null}}catch(t){return rX(e.previous,rQ(t,!1))}}async function r6(e,t={}){await r7({wallet:"hive",value:e},t)}async function r3(e,t,n={}){await r7({kind:"balance",wallet:e,value:t},n)}async function r7(e,t){await r0(`${ru}/credits/settings`,{...t,timeoutMs:t.timeoutMs??2e4,fetchImpl:async(n,r)=>{let i=new Headers(r?.headers);return i.set("Content-Type","application/json"),(t.fetchImpl??fetch)(n,{...r,method:"POST",headers:i,body:JSON.stringify(e)})}})}async function r9(e,t,n={}){if(!Number.isSafeInteger(e)||e<=0)throw new rY("credential id가 올바르지 않습니다.","invalid-response");let r=await r0(`${ru}/credential/${e}/${t?"enable":"disable"}`,{...n,timeoutMs:n.timeoutMs??2e4,fetchImpl:async(e,t)=>(n.fetchImpl??fetch)(e,{...t,method:"POST"})});if(!r||!0!==r.ok||r.credentialId!==e||!t!==r.disabled)throw new rY("계정 전환 응답 형식이 올바르지 않습니다.","invalid-response");return r}async function ie(e,t,n={}){if(!Number.isSafeInteger(e)||e<=0)throw new rY("credential id가 올바르지 않습니다.","invalid-response");if(!t)throw new rY("credit id가 올바르지 않습니다.","invalid-response");let r=await r0(`${ru}/credential/${e}/reset`,{...n,timeoutMs:n.timeoutMs??2e4,fetchImpl:async(e,r)=>{let i=new Headers(r?.headers);return i.set("Content-Type","application/json"),(n.fetchImpl??fetch)(e,{...r,method:"POST",headers:i,body:JSON.stringify({confirm:!0,creditId:t})})}});if(!r||"boolean"!=typeof r.ok||r.credentialId!==e||r.creditId!==t||"string"!=typeof r.code||r.ok!==("reset"===r.code))throw new rY("리셋 사용 응답 형식이 올바르지 않습니다.","invalid-response");return r}function it(e,t){if(e.has(t))return null;e.add(t);let n=!1;return()=>{n||(n=!0,e.delete(t))}}let ir={faces:new Map,pins:new Map},ii=[],is=ir,ia=null,il=ii,io=new Map,ic=new Set;function id(e){let t=(ic.add(e),()=>{ic.delete(e)}),n=rR(e);return()=>{t(),n()}}function iu(e){is=e,ic.forEach(e=>e())}function ih(e){return Number.isSafeInteger(e)&&e>0}function ip(e,t){return`${e}:${t}`}function im(e){let t=e??ii;il=t;let n=t.map(e=>[e.provider,e.credentialId??"",e.oauthPosition??"",e.metadata?.accountId??"",e.metadata?.email??""].join("\0")).join("|");if(n===ia)return;ia=n;let r=rJ(t),i=new Map;t.forEach((e,t)=>{let n=e.credentialId;if(!ih(n))return;let s=ip(e.provider,n);i.has(s)||i.set(s,{seed:r[t].seed,alias:r[t].alias})}),iu({faces:i,pins:is.pins})}function ig(e,t,n,r){if(!t)return null;let i=rU(t,r);if(i)return i;if(ih(n)){let e=is.faces.get(ip(t,n));if(e)return e}let s=e?is.pins.get(e):void 0;if(s&&s.provider===t){let e=is.faces.get(ip(t,s.credentialId));if(e)return e}return rB(t)??("anthropic"!==t||ih(n)||s?.provider===t?null:rw.find(e=>e.provider===t&&0===e.oauthPosition)??null)}async function ix(e,t,n,r){if(!t||ih(n)||rB(t))return ig(e,t,n,r);try{let{data:n}=await r8(e);if(n?.state==="resolved"&&n.provider===t&&ih(n.credentialId)){let r=new Map(is.pins);r.set(e,{provider:t,credentialId:n.credentialId,observedAt:Date.now()}),iu({faces:is.faces,pins:r})}}catch{}return ig(e,t,void 0,r)}function iv(e,t,n,r){let s=!!t&&!ih(n)&&!!e;return(0,i.useEffect)(()=>{s&&e&&t&&function(e,t){let n=Date.now(),r=is.pins.get(e);if(r&&r.provider===t&&n-r.observedAt<3e4)return;let i=`${e}\u0000${t}`,s=io.get(i);void 0!==s&&n-s<3e4||(io.set(i,n),r8(e).then(t=>{let n=t.data;if(!n||"resolved"!==n.state)return;let{provider:r,credentialId:i}=n;if("string"!=typeof r||""===r||!ih(i))return;let s=new Map(is.pins);s.set(e,{provider:r,credentialId:i,observedAt:Date.now()}),iu({faces:is.faces,pins:s})}).catch(()=>{}))}(e,t)},[s,e,t]),(0,i.useSyncExternalStore)(id,()=>ig(e,t,n,r),()=>null)}function iy(){return(0,i.useEffect)(()=>{if(!rI){rI=!0;let e=()=>{"visible"===document.visibilityState&&r$()};window.addEventListener("focus",e),document.addEventListener("visibilitychange",e)}null===rj&&(rj=r$().then(e=>{e||(rj=null)}))},[]),(0,i.useSyncExternalStore)(rR,rE,()=>rx)}rR(()=>{ia=null,im(il)});let ib={ko:{"dispatch.title":"서브에이전트 {count}명","dispatch.tally":"실행 중 {running} \xb7 실행 완료 {done} \xb7 Main 수용 {accepted}","dispatch.expand":"발주 상세 펼치기","dispatch.collapse":"발주 상세 접기","run.dispatching":"발주 중","run.pending":"대기","run.running":"실행 중","run.completed":"실행 완료","run.failed":"실행 실패","run.aborted":"중단됨","run.unobserved":"실행 상태 미관측","verdict.accepted":"Main 수용","verdict.rework":"Main 재작업 요청","verdict.held":"Main 보류","verdict.none":"검수 미기록","verdict.attempt":"{attempt}차","detail.stage":"현재 단계","detail.stageNone":"기록 없음","detail.model":"모델","detail.modelNone":"미관측","detail.fallback":"대체 모델","detail.agentId":"담당 ID","detail.reason":"판정 사유","detail.source.live":"실시간 관측","detail.source.record":"세션 기록","detail.openSubagents":"서브에이전트 상세 열기","detail.openProcess":"작업 기록 열기","summary.live":"진행 중","summary.files":"변경 파일 {count}","summary.files.one":"변경 파일 {count}","summary.checks":"검사 {count}","summary.checks.one":"검사 {count}","summary.checksFailed":"실패 {count}","summary.unverified":"미확인 {count}","summary.verdictUnverified":"판정 미확인 {count}","summary.verdictUnverified.one":"판정 미확인 {count}","result.label":"이번 결과","result.open":"결과 보기","result.openNamed":"{name} 결과 보기","result.previewTitle":"{name} 미리보기","result.previewFailed":"미리보기를 불러오지 못했습니다. 결과 보기를 누르세요.","result.more":"다른 결과 {count}","result.previewLoading":"미리보기를 불러오는 중","result.kind.html":"화면","result.kind.pdf":"PDF","result.kind.document":"문서","result.kind.image":"이미지","summary.heading.files":"변경 파일","summary.heading.checks":"실행한 검사","summary.check.exit":"exit {code}","summary.makers":"Maker {count}","summary.makers.one":"Maker {count}","summary.remaining":"남은 일 {count}","summary.heading.remaining":"남은 일","summary.time.unobserved":"시간 기록 없음","summary.time.running":"아직 실행 중","summary.todo.pending":"대기","summary.todo.in_progress":"진행 중","summary.todo.blocked":"막힘","summary.todo.blocker":"막힌 이유: {blocker}","summary.todo.none":"남은 일 없음","flow.heading":"작업 흐름","flow.aria":"이번 턴의 작업 단계","flow.toggle":"작업 흐름","flow.stage.investigate":"조사","flow.stage.edit":"수정","flow.stage.check":"검사","flow.stage.review":"교차리뷰","flow.stage.commit":"커밋\xb7푸시","flow.stage.ci":"CI","flow.stage.deploy":"배포","flow.state.waiting":"대기","flow.state.running":"진행 중","flow.state.done":"완료","flow.state.redone":"다시 고침","flow.state.passed":"통과","flow.state.unverified":"판정 미확인","flow.state.failed":"실패","flow.state.unobserved":"결과 미관측","flow.state.findings":"지적 {count}건","flow.state.findings.one":"지적 {count}건","flow.state.noFindings":"지적 없음","flow.state.open":"미해결 {count}건","flow.state.reviewUnusable":"리뷰 불가","flow.state.skipped":"건너뜀","flow.state.notNeeded":"필요 없음","flow.count.passed":"통과 {count}","flow.count.unverified":"판정 미확인 {count}","flow.count.failed":"실패 {count}","flow.count.unobserved":"결과 미관측 {count}","flow.count.running":"진행 중 {count}","flow.earlier":"이전 회차 {count}건","flow.attempt":"{attempt}회차","flow.label.typecheck":"타입 검사","flow.label.lint":"린트","flow.label.test":"테스트","flow.label.build":"빌드","flow.label.verify":"검증","flow.label.smoke":"스모크 확인","flow.label.check":"검사","flow.label.ci":"CI 확인","flow.label.deploy":"배포 실행","flow.label.review":"리뷰","flow.label.resolve":"지적 처리","flow.label.commit":"커밋\xb7푸시","flow.details":"자세히","flow.commandOmitted":"명령 본문은 압축된 요청의 요약에서 생략했어요.","flow.exit":"셸 종료 코드 {code}","flow.exit.none":"종료 코드 기록 없음","flow.exit.error":"오류로 끝남","flow.evidence":"판정에 쓴 기록","flow.why.confirmed":"확인된 것","flow.why.missing":"없는 것","flow.why.exitZero":"셸 종료 코드 0","flow.why.check":"{label} 명령의 종료 코드. 뒤에 이어 붙인 명령(파이프, ;, || 등)이 결과를 가릴 수 있어서 통과로 세지 않았어요.","flow.why.ci":"CI 결과를 종료 코드로 돌려준 기록. gh run watch --exit-status처럼 결과를 돌려주는 명령이 아니라서 통과로 세지 않았어요.","flow.why.ciOtherRun":"이 커밋의 CI 실행이라는 기록. 기다린 실행은 기록상 다른 커밋 {sha}의 실행이에요.","flow.why.ciPublishRun":"이 커밋의 CI 실행 결과. 이 명령이 기다린 실행은 게시 실행이라 CI 판정으로 세지 않았어요.","flow.why.watched.passed":"기다린 실행이 통과로 끝남","flow.why.watched.failed":"기다린 실행이 실패로 끝남","flow.why.watched.unjudged":"기다린 실행이 판정 없이 끝남({conclusion})","flow.why.ciUnjudged":"이 커밋의 CI 판정. 기다린 실행이 통과도 실패도 아닌 {conclusion} 상태로 끝나서, 명령의 실패를 CI 실패로 세지 않았어요.","flow.why.deploy":"배포가 끝났다는 기록. 배포를 띄우고 바로 돌아오는 명령이라 셸 종료 코드만으로는 끝났는지 알 수 없어요.","flow.strip.running":"{stage} 진행 중","flow.loop.badge":"↻ {attempt}회차","flow.loop.failed":"{stage} {attempt}회차 실패로 수정에 되돌아옴","flow.loop.findings":"{stage} {attempt}회차 지적으로 수정에 되돌아옴","flow.state.stale":"수정 전 통과","flow.state.staleDone":"수정 전 완료","flow.count.stale":"수정 전 통과 {count}","flow.why.stale":"이 결과 뒤에 파일을 다시 고쳐서, 마지막 수정본은 아직 확인하지 않았어요.","flow.compound.failed":"묶은 명령 실패","flow.why.compoundConfirmed":"{stages}를 한 명령으로 돌렸고, 명령 전체가 실패로 끝남","flow.why.compoundMissing":"어느 단계에서 실패했는지","flow.why.next":"다음에 할 일","flow.why.check.syntax":"{label} 명령의 종료 코드. 명령에 $(…)\xb7백틱\xb7( ) 묶음\xb7{ } 같은 셸 구문이 있어서, 그 종료 코드가 셸 종료 코드까지 그대로 왔는지 이 화면은 따지지 않아요. 그래서 통과로 세지 않았어요.","flow.why.check.optional":"{label} 스크립트가 실제로 실행된 기록. --if-present를 쓰면 스크립트가 없을 때 실행기가 아무것도 실행하지 않고 종료 코드 0으로 끝나요.","flow.why.noExit":"이 호출의 종료 코드. 결과 기록에 종료 코드가 없어요.","flow.why.noResult":"이 호출의 결과. 결과 기록이 없어요.","flow.why.interrupted":"이 호출의 결과. 호출이 끝나기 전에 끊겼어요.","flow.why.noCompletion":"이 호출의 종료 코드. 호출이 백그라운드 job으로 넘어갔고, 그 job의 완료 기록이 없어요.","flow.next.rerun":"먼저 이 호출의 완료 기록과 출력을 확인하세요. 실행이 끝났고 검사 명령 자체의 종료 코드를 찾을 수 없을 때만 파이프, ;, ||, 감싸는 구문 없이 검사 명령을 단독으로 다시 실행하세요. 긴 출력은 tail이나 grep으로 자르지 말고 결과 artifact에서 확인하세요.","flow.next.optional":"먼저 이 호출의 완료 기록과 출력을 확인하세요. 실행이 끝났고 스크립트 실행 기록을 찾을 수 없을 때만 --if-present 없이 스크립트 이름으로 다시 실행하세요.","flow.next.compound":"먼저 이 호출의 완료 기록과 출력을 확인하세요. 실행이 끝났고 어느 단계가 실패했는지 찾을 수 없을 때만 단계마다 명령을 나눠 다시 실행하세요.","flow.next.again":"먼저 이 호출의 완료 기록과 출력을 확인하세요. 실행이 끝났고 종료 코드를 찾을 수 없을 때만 같은 검사를 다시 실행하세요.","flow.repeats":"반복 실행 {count}건","flow.ci.notNeeded":"비공개 저장소에만 반영됐어요. 게시 실행 {run} 뒤에도 공개 {repo}의 {ref}는 CI를 통과한 {sha} 그대로예요.","flow.ci.nothingToPublish":"커밋 {sha}의 게시 실행 로그에 「Public tree already matches; nothing to publish」가 남았어요. 공개 저장소가 그대로라 새로 돌 CI가 없어요.","summary.stale":"수정 전 통과 {count}","summary.compoundFailed":"묶은 명령 실패 {count}","graph.branch":"수정 중 맡긴 Maker {count}","graph.branch.one":"수정 중 맡긴 Maker {count}","graph.parallel.observed":"동시 실행 관측","graph.join":"Main 판정","graph.parallel.batch":"같은 발주 묶음","graph.concurrency.overlapped":"겹쳐 실행","graph.concurrency.unknown":"겹침 여부 모름","graph.kind.feature":"기능","graph.kind.maintenance":"유지보수","graph.kind.diagnostic":"진단","graph.kind.unknown":"종류 미기록","graph.outputs":"변경 결과","graph.files":"파일 {count}","graph.docs":"문서 {count}","graph.files.one":"파일 {count}","graph.docs.one":"문서 {count}","graph.detail.aria":"선택한 노드 자세히","graph.maker.open":"Maker 기록 열기","graph.maker.unavailable":"실시간 기록이 없어 여기서 열 수 없어요.","graph.motion.pause":"움직임 멈춤","graph.replay":"재생","graph.replay.stop":"재생 멈춤","turn.heading":"{time} 턴","turn.headingLive":"진행 중인 턴","turn.headingUnknown":"이 턴","turn.show":"인스펙터에서 보기","turn.shown":"인스펙터에 표시 중","turn.peek":"흐름 보기","turn.numbers":"턴 결과 수","turn.metric.files":"변경 파일","turn.metric.checks":"검사","turn.metric.remaining":"남은 일","turn.metric.unverified":"미확인","turn.metric.verdict":"판정 미확인","turn.metric.stale":"수정 전 통과","turn.metric.failed":"실패","turn.dispatches":"서브에이전트","turn.empty":"이 턴에는 기록된 작업 단계가 없습니다.","turn.none":"아직 턴이 없습니다.","subflow.aria":"이 서브에이전트 실행의 단계","subflow.calls":"도구 {count}회","subflow.reedits":"다시 수정 {count}회","subflow.checks":"검사 {passed}/{total} 통과","subflow.reported":"보고함","subflow.unobserved":"기록 미관측","subflow.rework":"↻ Main 재작업 요청 {count}회로 구현에 되돌아옴","subflow.prior":"이전 판정","subflow.firstTitle":"첫 발주 제목","subflow.runTitle":"이번 실행 제목","delivery.title":"보낸 입력 {count}","delivery.kind.steer":"지금 지시","delivery.kind.followUp":"완료 후 요청","delivery.stage.sending":"보내는 중","delivery.stage.accepted":"접수됨 \xb7 전달 대기","delivery.stage.delivered":"전달됨 \xb7 대화에 들어감","delivery.stage.failed":"보내지 못함 \xb7 입력창에 되돌림","delivery.stage.unconfirmed":"전달 확인 못 함 \xb7 큐에서 빠짐","delivery.images":"이미지 {count}개","delivery.images.one":"이미지 {count}개","delivery.showOlder":"이전 {count}개 더 보기","delivery.showRecent":"최근 {count}개만 보기","live.nativeVoice":"기본 음성","progress.label":"진행","phase.investigate":"조사","phase.implement":"구현","phase.verify":"검증","phase.report":"보고","phase.current":"지금 단계 {phase}","phase.hint":"도구 호출로 읽은 지금 단계입니다. 고친 뒤 다시 고치면 앞 단계로 돌아갑니다.","progress.todo":"할 일 {completed}/{total} ({percent}%)","eta.label":"예상 시간","eta.elapsed":"경과 {duration}","eta.remaining":"남은 시간 보통 {range} (과거 {samples}건)","eta.percent":"약 {percent}% 추정","eta.overrun":"과거 최장 기록({longest}) 이상 경과","eta.sparseTail":"과거 {samples}건 중 {longerRuns}건만 이보다 오래 걸림","eta.hint":"같은 모델\xb7작업 등급의 과거 첫 시도 가운데 지금 경과보다 오래 걸린 실행들의 남은 시간 분포(가운데 절반)입니다.","eta.byTodo":"할 일 기준 약 {duration} 남음 ({completed}/{total} 단계)","eta.byTodoSoon":"할 일 기준 1분 이내 ({completed}/{total} 단계)","eta.byTodoHint":"todo 완료 비율로만 잰 값입니다. 단계마다 걸리는 시간이 달라 오차가 큽니다.","eta.rework":"재작업 {attempt}차 \xb7 첫 발주부터 {duration}","eta.reworkAttempt":"재작업 {attempt}차","eta.reworkHint":"재작업 시도는 과거 소요 기록이 거의 없어 남은 시간\xb7%를 추정하지 않습니다. 첫 발주부터의 시간에는 시도 사이 Main 검수\xb7대기 시간이 들어 있습니다.","eta.rangeMinutes":"{low}~{high}분","eta.range":"{low}~{high}","duration.seconds":"{seconds}초","duration.minutesSeconds":"{minutes}분 {seconds}초","duration.minutes":"{minutes}분","duration.hours":"{hours}시간","duration.hoursMinutes":"{hours}시간 {minutes}분","duration.underMinute":"1분 미만"},en:{"dispatch.title":"Subagents: {count}","dispatch.tally":"{running} running \xb7 {done} finished \xb7 {accepted} accepted by Main","dispatch.expand":"Show dispatch details","dispatch.collapse":"Hide dispatch details","run.dispatching":"Dispatching","run.pending":"Queued","run.running":"Running","run.completed":"Run finished","run.failed":"Run failed","run.aborted":"Stopped","run.unobserved":"Run state not observed","verdict.accepted":"Accepted by Main","verdict.rework":"Main asked for rework","verdict.held":"Held by Main","verdict.none":"No review recorded","verdict.attempt":"attempt {attempt}","detail.stage":"Current step","detail.stageNone":"Not recorded","detail.model":"Model","detail.modelNone":"Not observed","detail.fallback":"fallback","detail.agentId":"Agent ID","detail.reason":"Review note","detail.source.live":"live","detail.source.record":"session record","detail.openSubagents":"Open subagent details","detail.openProcess":"Open work log","summary.live":"In progress","summary.files":"{count} files changed","summary.files.one":"{count} file changed","summary.checks":"{count} checks","summary.checks.one":"{count} check","summary.checksFailed":"{count} failed","summary.unverified":"{count} unverified","summary.verdictUnverified":"{count} verdicts not confirmed","summary.verdictUnverified.one":"{count} verdict not confirmed","result.label":"Result","result.open":"View result","result.openNamed":"View result: {name}","result.previewTitle":"Preview of {name}","result.previewFailed":"Couldn't load the preview. Use View result to open it.","result.more":"{count} more","result.previewLoading":"Loading preview","result.kind.html":"Page","result.kind.pdf":"PDF","result.kind.document":"Document","result.kind.image":"Image","summary.heading.files":"Files changed","summary.heading.checks":"Checks run","summary.check.exit":"exit {code}","summary.makers":"{count} Makers","summary.makers.one":"{count} Maker","summary.remaining":"{count} left","summary.heading.remaining":"Still to do","summary.time.unobserved":"time not recorded","summary.time.running":"still running","summary.todo.pending":"pending","summary.todo.in_progress":"in progress","summary.todo.blocked":"blocked","summary.todo.blocker":"blocked by: {blocker}","summary.todo.none":"nothing left","flow.heading":"Work flow","flow.aria":"Work stages of this turn","flow.toggle":"Work flow","flow.stage.investigate":"Investigate","flow.stage.edit":"Edit","flow.stage.check":"Check","flow.stage.review":"Cross review","flow.stage.commit":"Commit & push","flow.stage.ci":"CI","flow.stage.deploy":"Deploy","flow.state.waiting":"waiting","flow.state.running":"in progress","flow.state.done":"done","flow.state.redone":"fixed again","flow.state.passed":"passed","flow.state.unverified":"verdict not confirmed","flow.state.failed":"failed","flow.state.unobserved":"result not observed","flow.state.findings":"{count} findings","flow.state.findings.one":"{count} finding","flow.state.noFindings":"no findings","flow.state.open":"{count} open","flow.state.reviewUnusable":"review unusable","flow.state.skipped":"skipped","flow.state.notNeeded":"not needed","flow.count.passed":"{count} passed","flow.count.unverified":"{count} not confirmed","flow.count.failed":"{count} failed","flow.count.unobserved":"{count} not observed","flow.count.running":"{count} running","flow.earlier":"{count} from earlier attempts","flow.attempt":"Attempt {attempt}","flow.label.typecheck":"Type check","flow.label.lint":"Lint","flow.label.test":"Tests","flow.label.build":"Build","flow.label.verify":"Verification","flow.label.smoke":"Smoke check","flow.label.check":"Check","flow.label.ci":"CI check","flow.label.deploy":"Deploy run","flow.label.review":"Review","flow.label.resolve":"Resolve","flow.label.commit":"Commit & push","flow.details":"Details","flow.commandOmitted":"The command body is omitted from this compacted request summary.","flow.exit":"shell exit code {code}","flow.exit.none":"no exit code recorded","flow.exit.error":"ended with an error","flow.evidence":"Judged from","flow.why.confirmed":"Confirmed","flow.why.missing":"Missing","flow.why.exitZero":"shell exit code 0","flow.why.check":"The exit code of the {label} command itself. Commands chained after it (a pipe, ;, || and so on) can hide its result, so it was not counted as passed.","flow.why.ci":"A CI result returned as an exit code. The command does not return one the way gh run watch --exit-status does, so it was not counted as passed.","flow.why.ciOtherRun":"A record that the run belongs to this commit. The watched run is recorded for another commit, {sha}.","flow.why.ciPublishRun":"The result of this commit's CI run. The run this command waited on is the publish run, so its result was not counted as CI.","flow.why.watched.passed":"The watched run ended as passed","flow.why.watched.failed":"The watched run ended as failed","flow.why.watched.unjudged":"The watched run ended without a verdict ({conclusion})","flow.why.ciUnjudged":"This commit's CI verdict. The watched run ended as {conclusion}, neither passed nor failed, so the command's failure was not counted as a CI failure.","flow.why.deploy":"A record that the deploy finished. The command starts the deploy and returns at once, so its exit code cannot tell whether the deploy finished.","flow.strip.running":"{stage} in progress","flow.loop.badge":"↻ attempt {attempt}","flow.loop.failed":"{stage} failed in attempt {attempt}, so the flow went back to edit","flow.loop.findings":"{stage} raised findings in attempt {attempt}, so the flow went back to edit","flow.state.stale":"Passed before edit","flow.state.staleDone":"Done before edit","flow.count.stale":"{count} passed before edit","flow.why.stale":"Files were edited after this result, so the latest revision has not been checked.","flow.compound.failed":"Combined command failed","flow.why.compoundConfirmed":"{stages} ran as one command, and the whole command failed","flow.why.compoundMissing":"Which stage failed","flow.why.next":"Next","flow.why.check.syntax":"The exit code of the {label} command itself. The command contains shell syntax such as $(…), backticks, ( ) grouping or { } braces, and this panel does not trace whether that exit code reaches the shell exit code, so it was not counted as passed.","flow.why.check.optional":"A record that the {label} script actually ran. With --if-present, the runner exits 0 without running anything when the script does not exist.","flow.why.noExit":"The exit code of this call. The result record has no exit code.","flow.why.noResult":"The result of this call. There is no result record for it.","flow.why.interrupted":"The result of this call. The call was interrupted before it finished.","flow.why.noCompletion":"The exit code of this call. The call moved to a background job and has no completion record for that job.","flow.next.rerun":"First check this call's completion record and output. Rerun the check command on its own without a pipe, ;, || or wrapping syntax only if the run has ended and the check's own exit code cannot be recovered. Read long output from the result artifact instead of cutting it with tail or grep.","flow.next.optional":"First check this call's completion record and output. Rerun the script by name without --if-present only if the run has ended and proof that the script ran cannot be recovered.","flow.next.compound":"First check this call's completion record and output. Rerun each stage as a separate command only if the run has ended and the failing stage cannot be recovered.","flow.next.again":"First check this call's completion record and output. Rerun the same check only if the run has ended and no exit code can be recovered.","flow.repeats":"{count} repeated runs","flow.ci.notNeeded":"Only the private repository changed. After publish run {run}, public {repo} {ref} still points at {sha}, which already passed CI.","flow.ci.nothingToPublish":"The publish run log for commit {sha} says “Public tree already matches; nothing to publish”. The public repository did not change, so there is no new CI run.","summary.stale":"{count} passed before edit","summary.compoundFailed":"{count} combined failed","graph.branch":"{count} Makers dispatched during edit","graph.branch.one":"{count} Maker dispatched during edit","graph.parallel.observed":"Seen running together","graph.join":"Main verdict","graph.parallel.batch":"Same dispatch batch","graph.concurrency.overlapped":"Overlapped","graph.concurrency.unknown":"Overlap unknown","graph.kind.feature":"Feature","graph.kind.maintenance":"Maintenance","graph.kind.diagnostic":"Diagnostic","graph.kind.unknown":"Kind not recorded","graph.outputs":"Changed","graph.files":"{count} files","graph.docs":"{count} docs","graph.files.one":"{count} file","graph.docs.one":"{count} doc","graph.detail.aria":"Selected node details","graph.maker.open":"Open Maker record","graph.maker.unavailable":"No live record, so it can't be opened here.","graph.motion.pause":"Pause motion","graph.replay":"Replay","graph.replay.stop":"Stop replay","turn.heading":"Turn at {time}","turn.headingLive":"Turn in progress","turn.headingUnknown":"This turn","turn.show":"Open in the inspector","turn.shown":"Shown in the inspector","turn.peek":"View flow","turn.numbers":"Turn result counts","turn.metric.files":"Files changed","turn.metric.checks":"Checks","turn.metric.remaining":"Left","turn.metric.unverified":"Unverified","turn.metric.verdict":"Verdict unconfirmed","turn.metric.stale":"Passed before edit","turn.metric.failed":"Failed","turn.dispatches":"Subagents","turn.empty":"This turn recorded no work steps.","turn.none":"No turn yet.","subflow.aria":"Stages of this subagent run","subflow.calls":"tool calls: {count}","subflow.reedits":"re-edited {count}\xd7","subflow.checks":"{passed}/{total} checks passed","subflow.reported":"Reported","subflow.unobserved":"Not observed","subflow.rework":"↻ Back to implement \xb7 Main rework requests: {count}","subflow.prior":"Previous verdict","subflow.firstTitle":"First dispatch title","subflow.runTitle":"Current run title","delivery.title":"{count} sent","delivery.kind.steer":"Now","delivery.kind.followUp":"After this run","delivery.stage.sending":"Sending","delivery.stage.accepted":"Received \xb7 waiting to deliver","delivery.stage.delivered":"Delivered \xb7 in the conversation","delivery.stage.failed":"Not sent \xb7 back in the composer","delivery.stage.unconfirmed":"Delivery not confirmed \xb7 left the queue","delivery.images":"{count} images","delivery.images.one":"{count} image","delivery.showOlder":"Show {count} earlier","delivery.showRecent":"Show only the latest {count}","live.nativeVoice":"default voice","progress.label":"Progress","phase.investigate":"Investigate","phase.implement":"Implement","phase.verify":"Verify","phase.report":"Report","phase.current":"current phase {phase}","phase.hint":"Current phase read from tool calls. It goes back when the child edits again after checking.","progress.todo":"todo {completed}/{total} ({percent}%)","eta.label":"Estimate","eta.elapsed":"{duration} elapsed","eta.remaining":"usually {range} left ({samples} past runs)","eta.percent":"about {percent}% (estimate)","eta.overrun":"At or beyond the longest past run ({longest})","eta.sparseTail":"Only {longerRuns} of {samples} past runs took longer","eta.hint":"Middle half of the remaining time among past first attempts of the same model and class that ran longer than this one has so far.","eta.byTodo":"about {duration} left by todo ({completed}/{total} steps)","eta.byTodoSoon":"under a minute left by todo ({completed}/{total} steps)","eta.byTodoHint":"Measured from the todo completion ratio only. Steps take different amounts of time, so this can be far off.","eta.rework":"rework attempt {attempt} \xb7 {duration} since first dispatch","eta.reworkAttempt":"rework attempt {attempt}","eta.reworkHint":"Rework attempts have almost no recorded durations, so no remaining time or % is estimated. Time since the first dispatch includes Main review and waiting between attempts.","eta.rangeMinutes":"{low}–{high} min","eta.range":"{low}–{high}","duration.seconds":"{seconds} s","duration.minutesSeconds":"{minutes} min {seconds} s","duration.minutes":"{minutes} min","duration.hours":"{hours} h","duration.hoursMinutes":"{hours} h {minutes} min","duration.underMinute":"under 1 min"}};function iw(){let{locale:e}=(0,F.s)();return{st:(0,i.useCallback)((t,n)=>(0,et.u0)(e,t,ib,n),[e]),locale:e}}function ik({seed:e,size:t,provider:n}){iy();let s=rV(e),[a,l]=(0,i.useState)(null),o=a===s,[c,d]=(0,i.useState)(!1);return o?(0,r.jsx)("span",{className:"account-avatar account-avatar-mono","data-tone":e%6,style:{width:t,height:t,fontSize:Math.round(.46*t)},"aria-hidden":"true",children:rq(e).slice(0,1)}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{type:"button",className:"account-avatar-button",style:{width:t,height:t},onClick:e=>{e.stopPropagation(),d(!0)},"aria-label":rq(e),children:(0,r.jsx)("img",{className:"account-avatar",src:s,width:t,height:t,alt:"","aria-hidden":"true",draggable:!1,onError:()=>l(s)})}),c&&(0,r.jsx)(ij,{seed:e,provider:n,onClose:()=>d(!1)})]})}function ij({seed:e,provider:t,onClose:n}){let{t:a}=(0,F.s)(),l=(0,i.useRef)(null);(0,i.useEffect)(()=>{let e=l.current;if(!e)return;let t=document.body.style.overflow;return document.body.style.overflow="hidden",e.showModal(),()=>{document.body.style.overflow=t,e.open&&e.close()}},[]);let o=rq(e);return(0,s.createPortal)((0,r.jsxs)("dialog",{ref:l,className:"account-avatar-dialog","aria-label":o,onCancel:e=>{e.preventDefault(),n()},onKeyDown:e=>{"Escape"===e.key&&(e.preventDefault(),n())},onClick:e=>{e.stopPropagation(),e.target===e.currentTarget&&n()},children:[(0,r.jsx)("img",{className:"account-avatar-full",src:rV(e),width:256,height:256,alt:o,draggable:!1}),(0,r.jsxs)("p",{className:"account-avatar-caption",children:[(0,r.jsx)("span",{className:"account-avatar-caption-alias",children:o}),t?(0,r.jsx)("span",{className:"account-avatar-caption-provider",children:rG(t)}):null]}),(0,r.jsx)("button",{type:"button",className:"account-avatar-close",onClick:n,children:a("i18n.close")})]}),document.body)}function iS(e){let t,n=[],r=null,i=0,s=0,a=0,l=0,o=[],c=[],d=()=>({lineNo:null,text:"",type:"empty"}),u=()=>{if(!r){o=[],c=[];return}let e=Math.max(o.length,c.length);for(let t=0;t<e;t++){let e=o[t]?{lineNo:o[t].lineNo,text:o[t].text,type:"removed"}:d(),n=c[t]?{lineNo:c[t].lineNo,text:c[t].text,type:"added"}:d();r.rows.push({type:"line",left:e,right:n})}o=[],c=[]};for(let d of e.split(/\r?\n/)){if(!(a>0||l>0)){if(d.startsWith("--- ")){u(),t=iC(d.slice(4));continue}if(d.startsWith("+++ ")){u(),r={oldPath:t,newPath:iC(d.slice(4)),rows:[]},n.push(r);continue}}let e=d.match(/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);if(e){r||(r={rows:[]},n.push(r)),u(),i=Number(e[1]),s=Number(e[3]),a=void 0===e[2]?1:Number(e[2]),l=void 0===e[4]?1:Number(e[4]),r.rows.push({type:"hunk",text:d});continue}if(!r)continue;if(d.startsWith("\\ ")){u(),r.rows.push({type:"hunk",text:d});continue}let h=d[0],p=d.slice(1);" "===h?(u(),r.rows.push({type:"line",left:{lineNo:i++,text:p,type:"context"},right:{lineNo:s++,text:p,type:"context"}}),a>0&&a--,l>0&&l--):"-"===h?(o.push({lineNo:i++,text:p}),a>0&&a--):"+"===h?(c.push({lineNo:s++,text:p}),l>0&&l--):""!==d&&(u(),r.rows.push({type:"hunk",text:d}))}u();let h=n.filter(e=>e.rows.some(e=>"line"===e.type));return h.length>0?h:null}function iC(e){return e.split(" ")[0].trim()}function iN({task:e,phases:t}){let{t:n}=(0,F.s)(),i="completed"===e.status,s="abandoned"===e.status,a="in_progress"===e.status,l="blocked"===e.status,o=!t||i||s?[]:tA(e,t),c=o.length>0?n("todo.waiting",{tasks:o.join(", ")}):!t||i||s||l?null:n("todo.ready"),d=i?"✓":s?"\xd7":l?"!":a?"›":"",u=i?"is-completed":s?"is-abandoned":l?"is-blocked":a?"is-active":"is-pending";return(0,r.jsxs)("div",{role:"listitem","aria-label":`${e.status}: ${e.content}${c?`; ${c}`:""}`,className:`todo-checklist-row ${u}`,children:[(0,r.jsx)("span",{"aria-hidden":"true",className:"todo-checklist-marker",children:d}),(0,r.jsxs)("span",{className:"todo-checklist-content",children:[e.content,l&&e.blocker?(0,r.jsxs)("span",{className:"todo-checklist-blocker",children:[" (",e.blocker,")"]}):null,c&&(0,r.jsxs)("span",{className:`todo-checklist-readiness${o.length>0?" is-waiting":""}`,children:[" \xb7 ",c]})]})]})}let iT="/icons/catppuccin";function iI({name:e,size:t=14}){let n={width:t,height:t,"--catppuccin-icon-light":`url(${iT}/latte/${e}.svg)`,"--catppuccin-icon-dark":`url(${iT}/mocha/${e}.svg)`};return(0,r.jsx)("span",{"aria-hidden":"true",className:"catppuccin-file-icon",style:n})}function iM({size:e=14,open:t=!1}){return(0,r.jsx)(iI,{name:t?"_folder_open":"_folder",size:e})}function iE({size:e=14}){return(0,r.jsx)(iI,{name:"_file",size:e})}let iR={ts:"typescript",tsx:"typescript-react",js:"javascript",mjs:"javascript",cjs:"javascript",jsx:"javascript-react",py:"python",json:"json",jsonl:"json",css:"css",less:"css",scss:"sass",html:"html",htm:"html",md:"markdown",markdown:"markdown",mdx:"markdown",yaml:"yaml",yml:"yaml",toml:"toml",sh:"bash",bash:"bash",zsh:"bash",fish:"bash",rs:"rust",go:"go",sql:"database",graphql:"graphql",gql:"graphql",tf:"terraform",hcl:"terraform",docx:"ms-word",pdf:"pdf",lock:"lock"};function i$(e,t=14){let n=e.toLowerCase(),i="dockerfile"===n||n.startsWith("dockerfile.")?"docker":".env"===n||n.startsWith(".env.")?"env":[".gitignore",".gitattributes",".gitmodules"].includes(n)?"git":"package-lock.json"===n?"npm-lock":"bun.lock"===n?"bun-lock":["next.config.js","next.config.mjs","next.config.cjs","next.config.ts"].includes(n)?"next":[".eslintrc",".eslintrc.js",".eslintrc.json",".eslintrc.yml","eslint.config.mjs","eslint.config.js"].includes(n)?"eslint":["yarn.lock","pnpm-lock.yaml","cargo.lock"].includes(n)?"lock":n.endsWith(".config.ts")||n.endsWith(".config.js")||n.endsWith(".config.mjs")||n.endsWith(".config.cjs")?"config":void 0;if(i)return(0,r.jsx)(iI,{name:i,size:t});let s=iR[n.split(".").pop()??""];return s?(0,r.jsx)(iI,{name:s,size:t}):(0,r.jsx)(iE,{size:t})}function iL({files:e,onOpenFile:t}){let{t:n}=(0,F.s)();return 0===e.length?null:(0,r.jsx)("div",{"aria-label":n("chat.filesWritten"),style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:6,marginTop:6},children:e.map(({filePath:e})=>{let i=tz(e);return(0,r.jsxs)("button",{className:"turn-written-file",type:"button",title:e,"aria-label":n("chat.openWrittenFile",{name:i}),onClick:()=>t?.(e),style:{display:"inline-flex",alignItems:"center",gap:4,padding:"2px 8px",fontSize:12,fontFamily:"var(--font-mono)",color:"var(--text)",background:"var(--bg-subtle)",border:0,borderRadius:"var(--radius-control)",cursor:"pointer"},children:[i$(i,12),(0,r.jsx)("span",{children:i})]},e)})})}let iP=/^att_[0-9a-f]{32}$/,iA=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function i_(e){return"string"==typeof e&&iP.test(e)}function iF(e){return"string"==typeof e&&iA.test(e)}class iO extends Error{constructor(e,t){super(t),this.code=e,this.name="DocumentAttachmentError"}}let iz={markdown:"text/markdown",text:"text/plain",pdf:"application/pdf"},iD={".txt":!0,".csv":!0,".tsv":!0,".json":!0,".log":!0},iW={"text/plain":!0,"text/csv":!0,"text/tab-separated-values":!0,"application/json":!0,"text/json":!0};function iH(e){let t=e.name.toLocaleLowerCase();if(t.endsWith(".md")||t.endsWith(".markdown"))return"markdown";if(t.endsWith(".pdf"))return"pdf";let n=t.lastIndexOf(".");if(n>0&&iD[t.slice(n)])return"text";let r=e.type.toLocaleLowerCase().split(";",1)[0]?.trim();return"text/markdown"===r?"markdown":"application/pdf"===r?"pdf":r&&iW[r]?"text":null}let iU={".mp3":"audio/mpeg",".wav":"audio/wav",".wave":"audio/wav",".m4a":"audio/mp4",".ogg":"audio/ogg",".oga":"audio/ogg",".opus":"audio/ogg",".flac":"audio/flac",".webm":"audio/webm",".aac":"audio/aac",".aif":"audio/aiff",".aiff":"audio/aiff"};function iB(e){let t=e.name.toLocaleLowerCase(),n=t.lastIndexOf("."),r=n>0?iU[t.slice(n)]:void 0;if(r)return r;let i=e.type.toLocaleLowerCase().split(";",1)[0]?.trim();return i?.startsWith("audio/")?i:null}function iq(e,t){try{let n=new TextDecoder(e,{fatal:!0}).decode(t);return n.includes("\0")?null:n}catch{return null}}function iV(e){if(!Array.isArray(e))return[];let t=[],n=0,r=0;for(let i of e){if(i&&"object"==typeof i&&"string"==typeof i.name&&i.name.length>0&&("text/markdown"===i.mimeType||"text/plain"===i.mimeType||"application/pdf"===i.mimeType)&&"number"==typeof i.size&&Number.isSafeInteger(i.size)&&i.size>=0&&i.size<=8388608&&"string"==typeof i.text&&i.text.length<=12e4){if(t.length>=3)break;!(n+i.size>0x1000000)&&(r+i.text.length>24e4||(t.push({name:i.name,mimeType:i.mimeType,size:i.size,text:i.text,...i_(i.attachmentId)?{attachmentId:i.attachmentId}:{}}),n+=i.size,r+=i.text.length))}}return t}async function iK(e){let t,n=iH(e);if(!n)throw new iO("unsupported",`Unsupported document type: ${e.name}`);if(e.size>8388608)throw new iO("file_too_large",`${e.name} exceeds the document size limit`);if("pdf"===n)t=await i8(e);else{try{t=await e.text()}catch(e){throw new iO("read_failed",e instanceof Error?e.message:String(e))}i4(t)}return{name:e.name,mimeType:iz[n],size:e.size,text:t}}function iG(e,t){let n=iV(t);if(0===n.length)return e;let r={userMessageLength:e.length,documents:n.map(({name:e,mimeType:t,size:n,text:r})=>({name:e,mimeType:t,size:n,textLength:r.length}))},i=`${i5}${JSON.stringify(r)}${i6}
@@ -17,7 +17,7 @@ ${t}`)),[l,o]=(0,i.useState)(null),[c,d]=(0,i.useState)(()=>new Set);if((0,i.use
17
17
  ${t}`,r=e6.get(n);if(void 0!==r)return Promise.resolve(r);let i=e3.get(n);if(i)return i;let s=fetch(e8(e,t),{cache:"no-store"}).then(async e=>{if(!e.ok)return 0;let t=await e.json(),r=Number.isSafeInteger(t.count)&&t.count>=0?t.count:0;return e6.set(n,r),r}).catch(()=>0).finally(()=>e3.delete(n));return e3.set(n,s),s})(e,t).then(e=>{n&&a(e)}),()=>{n=!1}},[s,e,t]),!s)return null;let u=Array.from({length:s},(e,t)=>t).filter(e=>!c.has(e));return 0===u.length?null:(0,r.jsxs)("div",{className:"tool-image-strip","data-tool-call-id":t,children:[u.map(i=>(0,r.jsx)("button",{type:"button",className:"tool-image-thumb","aria-label":n("i18n.zoomIn"),onClick:()=>o(i),children:(0,r.jsx)("img",{src:e8(e,t,i),alt:"",loading:"lazy",draggable:!1,onError:()=>d(e=>new Set(e).add(i))})},i)),null!==l&&(0,r.jsx)(sg,{src:e8(e,t,l),fileName:`screen-${t.slice(-8)}-${l+1}`,onClose:()=>o(null)})]})}let sf={"image/png":"png","image/jpeg":"jpg","image/webp":"webp","image/gif":"gif"};function sg({src:e,fileName:t,onClose:n}){let{t:a}=(0,F.s)(),o=(0,i.useContext)(nR),c=(0,i.useRef)(null),[d,u]=(0,i.useState)(!1),[h,p]=(0,i.useState)(null),[m,f]=(0,i.useState)([]),[g,x]=(0,i.useState)(null),v=(0,i.useRef)(null);(0,i.useEffect)(()=>{let e=c.current;if(!e)return;let t=document.body.style.overflow;return document.body.style.overflow="hidden",e.showModal(),()=>{v.current?.abort(),document.body.style.overflow=t,e.open&&e.close()}},[]);let y=()=>{v.current?.abort(),n()},b=async()=>{let r,i;if(!o)return void p(a("toolImage.noComposer"));v.current?.abort();let s=new AbortController;v.current=s,u(!0),p(null);try{let n=await fetch(e,{signal:s.signal});if(!n.ok)throw Error(`HTTP ${n.status}`);let l=await n.blob(),o=sf[l.type];if(!o)throw Error(`unsupported ${l.type}`);if(0!==m.length&&g){let e=await nz(l,m);r=[new File([e.marked],`${t}-marked.png`,{type:"image/png"}),...e.crops.map((e,n)=>new File([e],`${t}-region-${n+1}.png`,{type:"image/png"}))];let n=1===m.length?"1":`1~${m.length}`;i=[a("toolImage.locatorIntro",{range:n}),...m.map((e,t)=>a("toolImage.locatorRegion",{n:t+1,x:e.x,y:e.y,w:e.w,h:e.h,width:g.width,height:g.height}))].join("\n")+"\n"}else r=[new File([l],`${t}.${o}`,{type:l.type})]}catch{if(s.signal.aborted)return;u(!1),p(a("toolImage.loadFailed"));return}if(!s.signal.aborted&&c.current?.open){if(!o(r,i)){u(!1),p(a("toolImage.noComposer"));return}n()}};return(0,s.createPortal)((0,r.jsxs)("dialog",{ref:c,className:"tool-image-dialog","aria-label":a("toolImage.dialogLabel"),onCancel:e=>{e.preventDefault(),y()},onClick:e=>{e.target===e.currentTarget&&y()},children:[(0,r.jsx)(nD,{src:e,regions:m,max:9,onAdd:e=>f(t=>t.length<9?[...t,e]:t),onNaturalSize:x,regionLabel:e=>a("toolImage.regionLabel",{n:e})}),h?(0,r.jsx)("p",{role:"alert",className:"tool-image-error",children:h}):(0,r.jsx)("p",{className:"tool-image-hint","data-hidden":m.length>0&&m.length<9?"true":void 0,children:m.length>=9?a("toolImage.markLimit",{count:9}):a("toolImage.markHint")}),(0,r.jsxs)("div",{className:"tool-image-actions",children:[(0,r.jsx)(l.r,{variant:"neutralSolid",size:"medium",loading:d,onClick:()=>void b(),title:a("toolImage.requestEditHint"),children:a("toolImage.requestEdit")}),(0,r.jsx)(l.r,{variant:"neutralWeak",size:"medium",disabled:0===m.length,onClick:()=>f([]),children:a("toolImage.clearMarks")}),(0,r.jsx)(l.r,{variant:"neutralWeak",size:"medium",onClick:y,children:a("i18n.close")})]})]}),document.body)}function sx({block:e,isStreaming:t,cwd:n,onOpenFile:i}){return(0,r.jsx)(sn,{isStreaming:t,cwd:n,onOpenFile:i,children:e.text})}function sv({block:e,duration:t,sessionId:n,entryId:s,blockIndex:a}){let{t:l}=(0,F.s)(),[o,c]=(0,i.useState)(null),[d,u]=(0,i.useState)(!0===e.deferred),[h,p]=(0,i.useState)(null);(0,i.useEffect)(()=>{if(!e.deferred){c(null),u(!1),p(null);return}let t=!1;return n&&s?(u(!0),p(null),(function(e,t,n){let r=`${e}:${t}:${n}`,i=st.get(r);if(i)return st.delete(r),st.set(r,i),i;let s=fetch(`/api/sessions/${encodeURIComponent(e)}/entries/${encodeURIComponent(t)}/thinking?blockIndex=${n}`).then(async e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);let t=await e.json();if("string"!=typeof t.thinking)throw Error("Invalid thinking response");return t.thinking}).catch(e=>{throw st.delete(r),e});if(st.set(r,s),st.size>100){let e=st.keys().next().value;e&&st.delete(e)}return s})(n,s,a).then(e=>{t||c(e)}).catch(e=>{t||p(e instanceof Error?e.message:String(e))}).finally(()=>{t||u(!1)}),()=>{t=!0}):(u(!1),p(l("i18n.thinkingUnavailable")),()=>{t=!0})},[e.deferred,e.thinking,a,s,n,l]);let m=e.deferred?o:e.thinking,f="string"==typeof m&&m.trim().length>0;return(0,r.jsxs)("div",{className:"markdown-thinking","aria-label":l("i18n.thinking"),children:[(0,r.jsx)("div",{className:"markdown-thinking-content",children:d?(0,r.jsx)("span",{className:"markdown-thinking-status",children:l("i18n.loadingThinking")}):h?(0,r.jsx)("span",{className:"markdown-thinking-error",children:h}):f?(0,r.jsx)(nk,{className:"markdown-thinking-body",children:m}):(0,r.jsx)("span",{className:"markdown-thinking-status",children:l("chat.thinking")})}),void 0!==t&&f&&(0,r.jsxs)("span",{className:"markdown-thinking-duration",children:[t,"s"]})]})}function sy({block:e,result:t,duration:n,runStartedAt:s,sessionId:a}){var l;let o,{t:c}=(0,F.s)(),d=(0,i.useId)(),[u]=(0,i.useState)(()=>Date.now()),[h,p]=(0,i.useState)(null),m=(l=t?null:nI(a,e.toolCallId),(0,i.useSyncExternalStore)(nT,()=>l?nS.get(l)??null:null,()=>null)),f=e.toolName.toLowerCase(),g=JSON.stringify(e.input,null,2),x="todo"===f||f.endsWith(".todo")||f.endsWith("_todo"),v="bash"===f||f.startsWith("bash ")||f.endsWith(".bash")||f.endsWith("_bash"),y=t&&!t.isError?function(e){var t;let n=e.details;if(!("object"==typeof(t=n)&&null!==t&&!Array.isArray(t)))return null;let r="string"==typeof n.patch?n.patch:null;if(r)return{text:r};let i="string"==typeof n.diff?n.diff:null;return i?{text:i}:null}(t):null,b=x?"unknown"===(o=t$(e,t)).kind||0===o.phases.length?null:o.phases:null,w=y?y.text.split(/\r?\n/).reduce((e,t)=>(t.startsWith("+")&&!t.startsWith("+++")&&(e.added+=1),t.startsWith("-")&&!t.startsWith("---")&&(e.removed+=1),e),{added:0,removed:0}):null,k=t?t.content.filter(e=>"text"===e.type).map(e=>e.text).join("\n"):null,j=null!==k&&("(no output)"===k.trim()||""===k.trim()),S=t?nU(t):null,C=t?t.isError||null!==S&&0!==S?"failed":"done":"running",N="failed"===C,T=h??N;if(x&&b)return(0,r.jsx)(sN,{phases:b});let I=v&&"string"==typeof e.input.command?e.input.command:"",M=function(e,t,n){let r,i=t.html;if(!("ask"===(r=e.trim().toLowerCase())||r.endsWith(".ask")||r.endsWith("_ask"))||"string"!=typeof i)return null;let s="object"==typeof n&&null!==n?n:{},a=[];if(Array.isArray(s.answers))for(let e of s.answers)"string"==typeof e?.question&&"string"==typeof e.answer&&a.push({question:e.question,answer:e.answer});let l=!0===s.timedOut,o=a[0]?.question||i.replace(/<(script|style|template)\b[\s\S]*?<\/\1>/gi," ").replace(/<[^>]*>/g," ").replace(/&nbsp;/gi," ").replace(/&amp;/gi,"&").replace(/&lt;/gi,"<").replace(/&gt;/gi,">").replace(/&quot;/gi,'"').replace(/&#39;/gi,"'").replace(/\s+/g," ").trim(),c=a.length>1?` (+${a.length-1})`:"",d=Math.max(0,120-c.length),u=o.length>d?`${o.slice(0,Math.max(0,d-1))}…`:o;return{target:`${u}${c}`,rows:a,timedOut:l}}(e.toolName,e.input,t?.details),E=null!==M&&M.rows.length>0?M:null,R=!!(b||y||E),$=v?I.split(/\r?\n/,1)[0]??"":M?.target??function(e,t){if(t){let e=t.flatMap(e=>e.tasks),n=e.filter(e=>"completed"===e.status||"abandoned"===e.status).length;return`${n}/${e.length} tasks`}return function(e){var t;let n=e.input;if(!n||"object"!=typeof n)return"";let r=Object.keys(n);if(0===r.length)return"";let i=e.toolName.toLowerCase();if(t=i,["grep","read","write","glob"].some(e=>t===e||t.endsWith(`.${e}`)||t.endsWith(`_${e}`))&&"string"==typeof n.i){let e=n.i.trim();if(e)return e.slice(0,120)}if(("eval"===i||i.endsWith(".eval")||i.endsWith("_eval"))&&"string"==typeof n.title){let e=n.title.trim();if(e)return e.slice(0,120)}if("command"in n)return String(n.command).slice(0,120);if("path"in n)return String(n.path).slice(-120);if("file_path"in n)return String(n.file_path).slice(-120);if("pattern"in n)return String(n.pattern).slice(0,120);if("query"in n)return String(n.query).slice(0,120);let s=r.map(e=>n[e]).find(e=>"string"==typeof e||"number"==typeof e||"boolean"==typeof e);if(void 0!==s)return String(s).slice(0,120);try{return JSON.stringify(n).slice(0,120)}catch{return r.join(", ").slice(0,120)}}(e)}(e,b),L=!v&&/^\S+$/.test($)&&/[\\/]/.test($),P=w?c("toolRun.diffStats",{added:w.added,removed:w.removed}):"";return(0,r.jsxs)("div",{className:`tool-call-card ${N?"is-error":"running"===C?"is-running":"is-done"}${v?" is-shell":""}`,"aria-busy":"running"===C||void 0,style:{overflow:"hidden",fontSize:12},children:[(0,r.jsxs)("button",{type:"button",className:"tool-call-header",onClick:()=>p(!T),"aria-expanded":T,"aria-controls":T?d:void 0,style:{display:"flex",alignItems:"center",gap:7,width:"100%",padding:"6px 10px",background:"none",border:"none",cursor:"pointer",fontSize:12,textAlign:"left",minWidth:0},children:[(0,r.jsx)(sS,{toolName:e.toolName}),(0,r.jsx)("span",{className:"tool-call-name",children:v?"bash":e.toolName}),v&&f.includes("(local)")&&(0,r.jsx)("span",{className:"shell-local-label",children:"local"}),(0,r.jsx)("span",{className:`tool-call-target${L?" is-path":""}`,title:v?I:$,children:L?(0,r.jsx)("bdi",{dir:"ltr",children:$}):$}),w&&(0,r.jsxs)("span",{className:"tool-call-diffstats",title:P,"aria-label":P,children:[(0,r.jsxs)("span",{style:{color:"var(--success)"},children:["+",w.added]}),(0,r.jsxs)("span",{style:{color:"var(--danger)"},children:["−",w.removed]})]}),(0,r.jsx)(sw,{state:C,duration:n,exitCode:S,startedAt:s??u}),(0,r.jsx)("svg",{className:"tool-call-chevron",width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"var(--text-dim)",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{transform:T?"rotate(180deg)":"none",transition:"transform 0.15s"},children:(0,r.jsx)("polyline",{points:"2 3.5 5 6.5 8 3.5"})})]}),"running"===C&&m&&(0,r.jsx)("div",{className:"tool-call-progress",title:m,style:{padding:"0 10px 6px 29px",color:"var(--text-dim)",fontSize:11,lineHeight:1.4,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},children:m}),T&&(0,r.jsx)("div",{id:d,className:"tool-call-body",children:v?(0,r.jsx)(sT,{command:I,output:k??"",pending:!t,isError:N}):(0,r.jsxs)(r.Fragment,{children:[y&&(0,r.jsx)("div",{style:{maxHeight:560,overflowY:"auto",overflowX:"hidden"},children:(0,r.jsx)(sI,{diff:y})}),t&&N&&(0,r.jsx)(sL,{text:k??"",isEmpty:j,isError:!0}),E&&!N&&(0,r.jsx)(sb,{summary:E}),!R&&(0,r.jsx)("pre",{className:"tool-call-input",style:{margin:0,padding:"8px 10px",color:"var(--text-muted)",fontSize:12,lineHeight:1.5,overflow:"auto",maxHeight:400,whiteSpace:"pre-wrap",wordBreak:"break-all"},children:g}),t&&!R&&!N&&(0,r.jsx)(sL,{text:k??"",isEmpty:j,isError:!1})]})})]})}function sb({summary:e}){let{t}=(0,F.s)();return(0,r.jsxs)("div",{className:"tool-call-ask",style:{padding:"8px 10px"},children:[(0,r.jsx)("dl",{style:{margin:0,display:"grid",gap:8},children:e.rows.map((e,t)=>(0,r.jsxs)("div",{style:{minWidth:0},children:[(0,r.jsx)("dt",{style:{color:"var(--text-muted)",fontSize:12,lineHeight:1.5,overflowWrap:"anywhere"},children:e.question}),(0,r.jsx)("dd",{style:{margin:"2px 0 0",color:"var(--text)",fontSize:12,lineHeight:1.5,whiteSpace:"pre-wrap",overflowWrap:"anywhere"},children:""===e.answer?"—":e.answer})]},t))}),e.timedOut&&(0,r.jsx)("p",{style:{margin:"8px 0 0",color:"var(--text-muted)",fontSize:12,lineHeight:1.5},children:t("toolRun.askTimedOut")})]})}function sw({state:e,duration:t,exitCode:n,startedAt:i}){let{t:s}=(0,F.s)();return"running"===e?(0,r.jsx)(sk,{startedAt:i}):(0,r.jsxs)(r.Fragment,{children:[void 0!==t&&(0,r.jsxs)("span",{className:"tool-run-duration",children:[t,"s"]}),"failed"===e&&(0,r.jsxs)("span",{className:"tool-run-failed",children:[(0,r.jsx)(nE.E,{tone:"critical",variant:"weak",size:"medium",children:s("toolRun.failed")}),null!==n&&(0,r.jsx)("span",{className:"tool-run-exit",children:s("toolRun.exitCode",{code:n})})]})]})}function sk({startedAt:e}){let{t}=(0,F.s)(),n=nj(500)-e;return n<400?null:(0,r.jsxs)("span",{className:"tool-run-running",children:[t("toolRun.running"),(0,r.jsxs)("span",{className:"tool-run-duration",children:[Math.floor(n/1e3),"s"]})]})}function sj(e,t){let n=e.trim().toLowerCase();return n===t||n.endsWith(`.${t}`)||n.endsWith(`_${t}`)||n.split(/[.\s:_-]+/).includes(t)}function sS({toolName:e}){let t,n=(t=e.trim().toLowerCase()).includes("str_replace")||t.includes("replace_editor")||sj(t,"edit")?"edit":sj(t,"read")||sj(t,"cat")?"read":sj(t,"write")||sj(t,"save")?"write":sj(t,"glob")||sj(t,"find")?"glob":sj(t,"grep")||sj(t,"search")?"grep":sj(t,"bash")||sj(t,"shell")||sj(t,"exec")?"bash":sj(t,"todo")?"todo":sj(t,"eval")?"eval":sj(t,"task")||sj(t,"agent")?"task":sj(t,"browser")||sj(t,"web_search")||sj(t,"fetch")?"browser":sj(t,"image")||sj(t,"inspect_image")?"image":"generic";return(0,r.jsx)("span",{"aria-hidden":"true","data-tool-icon":n,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:14,height:14,flexShrink:0,color:"var(--text-muted)"},children:(0,r.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.15",strokeLinecap:"round",strokeLinejoin:"round",children:(0,r.jsx)(sC,{kind:n})})})}function sC({kind:e}){switch(e){case"read":return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("path",{d:"M2.75 1.75h5.5l3 3v7.5h-8.5V1.75Z"}),(0,r.jsx)("path",{d:"M8.25 1.75v3h3"}),(0,r.jsx)("path",{d:"M4.2 9.1c1.1-1.4 3.6-1.4 4.7 0-1.1 1.4-3.6 1.4-4.7 0Z"}),(0,r.jsx)("circle",{cx:"6.55",cy:"9.1",r:"0.7",fill:"currentColor",stroke:"none"})]});case"write":return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("path",{d:"M2.75 1.75h5.5l3 3v7.5h-8.5V1.75Z"}),(0,r.jsx)("path",{d:"M8.25 1.75v3h3"}),(0,r.jsx)("path",{d:"M6.55 6.25v4.15m-1.7-1.55 1.7 1.7 1.7-1.7"})]});case"glob":return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("path",{d:"M1.75 4.5A1.25 1.25 0 0 1 3 3.25h2.25l1.35 1.35h4.4A1.25 1.25 0 0 1 12.25 5.85v5.1A1.25 1.25 0 0 1 11 12.2H3a1.25 1.25 0 0 1-1.25-1.25V4.5Z"}),(0,r.jsx)("path",{d:"M9 7.1v3.8M7.1 9h3.8M7.65 7.65l2.7 2.7m0-2.7-2.7 2.7"})]});case"grep":return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("circle",{cx:"5.9",cy:"5.9",r:"3.25"}),(0,r.jsx)("path",{d:"m8.35 8.35 3.25 3.25"}),(0,r.jsx)("path",{d:"M4.6 5.2h2.5M4.6 6.8h1.7"})]});case"edit":return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("path",{d:"M2.75 1.75h5.5l3 3v7.5h-8.5V1.75Z"}),(0,r.jsx)("path",{d:"M8.25 1.75v3h3"}),(0,r.jsx)("path",{d:"m4.45 10.55 4.75-4.75 1.45 1.45-4.75 4.75-1.95.5.5-1.95Z"}),(0,r.jsx)("path",{d:"m8.45 6.55 1.45 1.45"})]});case"bash":return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("rect",{x:"1.5",y:"2.1",width:"11",height:"9.8",rx:"1.3"}),(0,r.jsx)("path",{d:"m4 5.2 1.8 1.8L4 8.8M7.2 8.8h2.3"})]});case"todo":return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("path",{d:"M5.5 3.25h7M5.5 7h7M5.5 10.75h7"}),(0,r.jsx)("path",{d:"m1.5 3.1 1 1 1.7-1.9M1.5 6.85l1 1 1.7-1.9M1.5 10.6l1 1 1.7-1.9"})]});case"eval":return(0,r.jsx)(r.Fragment,{children:(0,r.jsx)("path",{d:"m5 2.5-3 4.5 3 4.5M9 2.5l3 4.5-3 4.5M7.8 2 6.2 12"})});case"task":return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("circle",{cx:"3.1",cy:"3.2",r:"1.25"}),(0,r.jsx)("circle",{cx:"10.9",cy:"3.2",r:"1.25"}),(0,r.jsx)("circle",{cx:"10.9",cy:"10.8",r:"1.25"}),(0,r.jsx)("path",{d:"M4.35 3.2h2.1a2.9 2.9 0 0 1 2.9 2.9v3.45"}),(0,r.jsx)("path",{d:"M9.35 3.2h-1.1"})]});case"browser":return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("circle",{cx:"7",cy:"7",r:"5.2"}),(0,r.jsx)("path",{d:"M1.9 7h10.2M7 1.8c1.45 1.4 2.2 3.15 2.2 5.2S8.45 10.8 7 12.2C5.55 10.8 4.8 9.05 4.8 7S5.55 3.2 7 1.8Z"})]});case"image":return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("rect",{x:"1.75",y:"2.25",width:"10.5",height:"9.5",rx:"1.15"}),(0,r.jsx)("circle",{cx:"4.8",cy:"5.1",r:"1"}),(0,r.jsx)("path",{d:"m2.6 10 2.6-2.7 1.8 1.8 1.45-1.45 2.95 2.95"})]});case"generic":return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("rect",{x:"1.75",y:"2",width:"10.5",height:"10",rx:"1.3"}),(0,r.jsx)("path",{d:"M4.35 5h5.3M4.35 7.35h3.8M4.35 9.7h4.6"})]})}}function sN({phases:e}){let t=e.reduce((e,t)=>e+t.tasks.length,0),n=e.reduce((e,t)=>e+t.tasks.filter(e=>"completed"===e.status).length,0);return(0,r.jsxs)("div",{className:"todo-checklist-preview",role:"list","aria-label":`Todo ${t} tasks`,children:[(0,r.jsxs)("div",{className:"todo-checklist-header",children:[(0,r.jsxs)("svg",{className:"todo-checklist-icon",width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[(0,r.jsx)("path",{d:"M5.5 3.25h7M5.5 7h7M5.5 10.75h7",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"}),(0,r.jsx)("path",{d:"m1.5 3.1 1 1 1.7-1.9M1.5 6.85l1 1 1.7-1.9M1.5 10.6l1 1 1.7-1.9",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})]}),(0,r.jsx)("span",{className:"todo-checklist-title",children:"Todo"}),(0,r.jsxs)("span",{className:"todo-checklist-count",children:[t," ",1===t?"task":"tasks"]}),n>0&&n<t&&(0,r.jsxs)("span",{className:"todo-checklist-progress",children:[n,"/",t]})]}),(0,r.jsx)("div",{className:"todo-checklist-body",children:e.map((t,n)=>(0,r.jsxs)("div",{className:"todo-checklist-phase",children:[e.length>1&&(0,r.jsx)("div",{className:"todo-checklist-phase-name",children:t.name}),t.tasks.map((e,t)=>(0,r.jsx)(iN,{task:e},`${e.content}-${t}`))]},`${t.name}-${n}`))})]})}function sT({command:e,output:t,pending:n,isError:i}){let{isDark:s}=ng(),{t:a}=(0,F.s)(),l=eO(t.split(/\r?\n/)),o=1===l.length&&""===l[0]?[]:l;return(0,r.jsxs)("div",{className:`shell-output-preview${i?" is-error":""}`,children:[(0,r.jsxs)("div",{className:"shell-command-line",children:[(0,r.jsx)("span",{className:"shell-command-prompt","aria-hidden":"true",children:"$"}),(0,r.jsx)(tW.A,{className:"shell-command-code",language:"bash",style:s?tH.xJ:tH.vs,PreTag:"span",CodeTag:"span",wrapLongLines:!0,customStyle:{flex:1,minWidth:0,margin:0,padding:0,border:"none",overflow:"visible",background:"transparent",color:"var(--text)",fontFamily:"var(--font-mono)",fontSize:13,lineHeight:1.55,whiteSpace:"pre-wrap",overflowWrap:"anywhere"},codeTagProps:{style:{fontFamily:"var(--font-mono)"}},children:e||" "})]}),(0,r.jsxs)("div",{className:"shell-output-panel",children:[(0,r.jsx)("div",{className:"shell-output-divider",children:(0,r.jsx)("span",{className:"shell-output-label",children:"Output"})}),(0,r.jsxs)("div",{className:"shell-output-body",children:[0===o.length&&!n&&(0,r.jsx)("span",{className:"shell-output-empty",children:a("i18n.noOutput")}),o.map((e,t)=>{let n=eP(e).trimStart(),s=i||/^(?:error|fatal|failed|failure|✖|x\b)/i.test(n)?"is-error":/^(?:warning|warn|!)/i.test(n)?"is-warning":/^(?:success|passed|ok\b|✓|\+)/i.test(n)?"is-success":"";return(0,r.jsxs)("div",{className:`shell-output-line ${s}`.trim(),children:[ez(e).map((e,t)=>Object.keys(e.style).length>0?(0,r.jsx)("span",{style:e.style,children:e.text},t):(0,r.jsx)("span",{children:e.text},t)),""===e?"\xa0":null]},t)})]})]})]})}function sI({diff:e}){return(0,r.jsx)("div",{style:{background:"var(--bg)"},children:(0,r.jsx)(sM,{text:e.text})})}function sM({text:e}){let{t}=(0,F.s)(),n=(0,i.useMemo)(()=>iS(e),[e]);if(!n)return(0,r.jsx)(s$,{text:e});let s=n.length>1;return(0,r.jsx)("div",{style:{background:"var(--bg)"},children:n.map((e,n)=>(0,r.jsxs)("div",{style:{minWidth:0,marginTop:8*(0!==n),fontFamily:"var(--font-mono)",fontSize:12,lineHeight:1.55},children:[s&&(0,r.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) minmax(0, 1fr)",position:"sticky",top:0,zIndex:1,background:"var(--bg-panel)"},children:[(0,r.jsx)(sE,{title:e.oldPath||t("i18n.before"),side:"left"}),(0,r.jsx)(sE,{title:e.newPath||t("i18n.after"),side:"right"})]}),(0,r.jsx)("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) minmax(0, 1fr)"},children:e.rows.map((e,t)=>"hunk"===e.type?null:(0,r.jsxs)("div",{style:{display:"contents"},children:[(0,r.jsx)(sR,{cell:e.left,side:"left"}),(0,r.jsx)(sR,{cell:e.right,side:"right"})]},t))})]},n))})}function sE({title:e,side:t}){return(0,r.jsx)("div",{title:e,style:{padding:"left"===t?"5px 14px 5px 10px":"5px 10px 5px 14px",color:"var(--text-dim)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e})}function sR({cell:e,side:t}){let n="added"===e.type?"var(--success-soft)":"removed"===e.type?"var(--danger-soft)":"empty"===e.type?"var(--bg-subtle)":"transparent",i="added"===e.type?"+":"removed"===e.type?"-":" ",s="added"===e.type?"var(--success)":"removed"===e.type?"var(--danger)":"var(--text-dim)";return(0,r.jsxs)("div",{style:{display:"flex",minWidth:0,background:n,marginInlineEnd:4*("left"===t)},children:[(0,r.jsx)("span",{style:{width:42,padding:"0 6px",textAlign:"right",color:"var(--text-dim)",userSelect:"none",background:"var(--bg-panel)",flexShrink:0},children:e.lineNo??""}),(0,r.jsx)("span",{style:{width:18,padding:"0 5px",color:s,userSelect:"none",fontWeight:"context"===e.type||"empty"===e.type?400:700,flexShrink:0},children:i}),(0,r.jsx)("span",{style:{flex:1,minWidth:0,padding:"0 10px 0 0",color:"empty"===e.type?"var(--text-dim)":"var(--text)",whiteSpace:"pre-wrap",overflowWrap:"anywhere"},children:e.text||"\xa0"})]})}function s$({text:e}){let t=e.split(/\r?\n/);return(0,r.jsx)("div",{style:{fontFamily:"var(--font-mono)",fontSize:12,lineHeight:1.55,minWidth:0},children:t.map((e,t)=>{let n=e.startsWith("@@")?"hunk":e.startsWith("+")&&!e.startsWith("+++")?"added":e.startsWith("-")&&!e.startsWith("---")?"removed":"context";return(0,r.jsxs)("div",{style:{display:"flex",background:"added"===n?"var(--success-soft)":"removed"===n?"var(--danger-soft)":"hunk"===n?"var(--accent-soft)":"transparent"},children:[(0,r.jsx)("span",{style:{width:48,padding:"0 8px",color:"var(--text-dim)",background:"var(--bg-panel)",textAlign:"right",userSelect:"none",flexShrink:0},children:t+1}),(0,r.jsx)("span",{style:{padding:"0 10px",whiteSpace:"pre-wrap",overflowWrap:"anywhere",color:"added"===n?"var(--success)":"removed"===n?"var(--danger)":"hunk"===n?"var(--accent)":"var(--text)"},children:e||"\xa0"})]},t)})})}function sL({text:e,isEmpty:t,isError:n}){let{t:i}=(0,F.s)();return(0,r.jsx)("div",{style:{background:n?"var(--danger-soft)":"var(--bg-subtle)"},children:(0,r.jsx)("pre",{style:{margin:0,padding:"8px 10px",color:n?"var(--danger)":t?"var(--text-dim)":"var(--text-muted)",fontSize:12,lineHeight:1.5,overflow:"auto",maxHeight:400,background:"var(--bg)",whiteSpace:"pre-wrap",wordBreak:"break-all",fontStyle:t?"italic":"normal",opacity:t?.6:1},children:t?i("i18n.noOutput"):e})})}function sP({message:e}){let{t}=(0,F.s)(),n=sO(e.content),s=(0,i.useMemo)(()=>{let e,t,r,i,s;return e=[],t=[],r=n.match(nq),i=r?.[1]??"",s=r?.index===void 0?n:n.slice(0,r.index),i.replace(nB,(n,r,i)=>{let s=i.split(/\r?\n/).map(e=>e.trim()).filter(Boolean);return"read-files"===r?e.push(...s):t.push(...s),""}),{body:s.trim(),readFiles:e,modifiedFiles:t}},[n]),a=sa(e.timestamp),l=e.details&&"object"==typeof e.details&&"tokensBefore"in e.details&&"number"==typeof e.details.tokensBefore&&e.details.tokensBefore>0?e.details.tokensBefore:null;return(0,r.jsx)("div",{style:{marginBottom:16},children:(0,r.jsxs)("div",{style:{border:0,borderRadius:"var(--radius-surface)",overflow:"hidden",background:"var(--bg-subtle)"},children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"7px 10px",background:"var(--bg-panel)",color:"var(--text-muted)"},children:[(0,r.jsx)("span",{style:{fontFamily:"var(--font-mono)",fontSize:11,fontWeight:650},children:"compaction"}),null!==l&&(0,r.jsx)("span",{style:{fontSize:11},children:t("chat.compactedFrom",{tokens:nV(l)})}),a&&(0,r.jsx)("span",{style:{marginLeft:"auto",color:"var(--text-dim)",fontSize:10},children:a})]}),(0,r.jsxs)("div",{style:{padding:"11px 13px 12px"},children:[(0,r.jsx)("div",{style:{color:"var(--text)",fontSize:15,fontWeight:700,lineHeight:1.35},children:t("i18n.conversationCompacted")}),(0,r.jsx)("div",{style:{marginTop:3,marginBottom:10,color:"var(--text)",fontSize:14,lineHeight:1.5},children:t("i18n.compactionDescription")}),s.body?(0,r.jsx)(nk,{className:"markdown-compaction-message",children:s.body}):(0,r.jsx)("span",{style:{color:"var(--text-dim)",fontSize:12},children:t("i18n.noSummary")}),(0,r.jsx)(sA,{readFiles:s.readFiles,modifiedFiles:s.modifiedFiles})]})]})})}function sA({readFiles:e,modifiedFiles:t}){let{t:n}=(0,F.s)();if(0===e.length+t.length)return null;let i=[];return e.length>0&&i.push(`${e.length} read`),t.length>0&&i.push(`${t.length} modified`),(0,r.jsxs)("details",{className:"compaction-file-details",children:[(0,r.jsx)("summary",{children:n("i18n.fileContext",{details:i.join(", ")})}),t.length>0&&(0,r.jsx)(s_,{title:n("i18n.modifiedFiles"),files:t}),e.length>0&&(0,r.jsx)(s_,{title:n("i18n.readFiles"),files:e})]})}function s_({title:e,files:t}){return(0,r.jsxs)("div",{className:"compaction-file-section",children:[(0,r.jsx)("div",{className:"compaction-file-title",children:e}),(0,r.jsx)("ul",{className:"compaction-file-list",children:t.map(e=>(0,r.jsx)("li",{children:e},e))})]})}function sF({message:e,cwd:t,onOpenFile:n}){var s;let a,{t:l}=(0,F.s)(),o=!1===e.display,[c,d]=(0,i.useState)(!o),[u,h]=(0,i.useState)(!1),[p,m]=(0,i.useState)(!1),f=sO(e.content),g="string"==typeof(s=e.content)?[]:s.filter(e=>"image"===e.type),x=void 0!==e.details,v=x?function(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}(e.details):"",y=e.customType||"extension",b=sa(e.timestamp);return(0,r.jsx)("div",{style:{marginBottom:16},children:(0,r.jsxs)("div",{style:{border:0,borderRadius:"var(--radius-surface)",overflow:"hidden",background:o?"var(--bg-hover)":"var(--bg-subtle)",opacity:o&&!c?.82:1},children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"7px 10px",background:"var(--bg-panel)",color:"var(--text-muted)",fontSize:12},children:[(0,r.jsx)("span",{style:{color:"var(--text-muted)",fontFamily:"var(--font-mono)",fontSize:11,fontWeight:650},children:y}),o&&(0,r.jsx)("span",{style:{color:"var(--text-dim)",fontSize:11},children:l("i18n.hiddenExtensionMessage")}),b&&(0,r.jsx)("span",{style:{marginLeft:"auto",color:"var(--text-dim)",fontSize:10},children:b})]}),c?(0,r.jsxs)("div",{style:{padding:"6px 9px"},children:[g.length>0&&(0,r.jsx)("div",{style:{display:"flex",gap:6,flexWrap:"wrap",marginBottom:8*!!f},children:g.map((e,t)=>{let n=sz(e);return n?(0,r.jsx)("img",{src:n,alt:"",style:{maxWidth:240,maxHeight:240,borderRadius:"var(--radius-control)",objectFit:"contain",display:"block"}},t):null})}),f?(0,r.jsx)(nk,{className:"markdown-custom-message",cwd:t,onOpenFile:n,children:f}):(0,r.jsx)("span",{style:{color:"var(--text-dim)",fontSize:12},children:l("i18n.noMessage")})]}):(0,r.jsx)("button",{onClick:()=>d(!0),style:{display:"block",width:"100%",padding:"8px 10px",border:"none",background:"transparent",color:"var(--text-dim)",cursor:"pointer",fontSize:12,textAlign:"left"},children:f?(a=f.replace(/\s+/g," ").trim())?a.length>140?`${a.slice(0,140)}...`:a:"Show extension message":l("i18n.showExtensionMessage")}),(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"4px 9px",background:"var(--bg-subtle)"},children:[f||v?(0,r.jsx)("button",{className:"message-meta-action",onClick:()=>{nx(f||v).then(()=>{m(!0),setTimeout(()=>m(!1),1500)})},style:{padding:"3px 7px",border:"none",background:"none",color:p?"var(--accent)":"var(--text-dim)",cursor:"pointer",fontSize:11},children:l(p?"i18n.copied":"i18n.copy")}):null,(x||o)&&(0,r.jsx)("button",{onClick:()=>{o?d(e=>!e):h(e=>!e)},style:{marginLeft:"auto",padding:"3px 7px",border:"none",background:"none",color:"var(--text-dim)",cursor:"pointer",fontSize:11},children:l(o?c?"i18n.collapse":"i18n.expand":u?"i18n.hideDetails":"i18n.showDetails")})]}),x&&(o&&c||!o&&u)&&(0,r.jsx)("pre",{style:{margin:0,padding:"9px 10px",background:"var(--bg)",color:"var(--text-muted)",fontSize:12,lineHeight:1.5,whiteSpace:"pre-wrap",wordBreak:"break-word",maxHeight:360,overflow:"auto",fontFamily:"var(--font-mono)"},children:v})]})})}function sO(e){return"string"==typeof e?e:e.filter(e=>"text"===e.type).map(e=>e.text).join("\n")}function sz(e){return e.source?"base64"===e.source.type?`data:${e.source.media_type};base64,${e.source.data}`:e.source.url??"":e.data?`data:${e.mimeType};base64,${e.data}`:""}function sD({message:e,sessionId:t}){let[n,s]=(0,i.useState)(null),[a,l]=(0,i.useState)(!1),[o,c]=(0,i.useState)(null),d=!e.output&&void 0===e.exitCode&&!e.cancelled,u=e.cancelled||void 0!==e.exitCode&&0!==e.exitCode,h=t&&e.fullOutputPath?`/api/agent/${encodeURIComponent(t)}/bash-output?path=${encodeURIComponent(e.fullOutputPath)}`:null,p=e.truncated&&h&&null===n,m=n??e.output;async function f(){if(h){l(!0),c(null);try{let e=await fetch(h),t=await e.json();t.success?s(t.data?.output??""):c(t.error??"failed")}catch(e){c(String(e))}finally{l(!1)}}}let g=e.excludeFromContext?"bash (local)":"bash",x={type:"toolCall",toolCallId:`bash-${e.timestamp??""}`,toolName:g,input:{command:e.command}},v=d?void 0:{role:"toolResult",toolCallId:x.toolCallId,toolName:g,content:m?[{type:"text",text:m}]:[],isError:u,details:void 0!==e.exitCode?{exitCode:e.exitCode}:void 0,timestamp:e.timestamp};return(0,r.jsxs)("div",{style:{margin:"6px 0"},children:[(0,r.jsx)(sy,{block:x,result:v,runStartedAt:e.timestamp}),e.truncated&&h&&(0,r.jsxs)("div",{style:{padding:"4px 10px",fontSize:11,marginTop:-1},children:[p&&(0,r.jsx)("button",{onClick:f,disabled:a,style:{background:"none",border:"none",color:"var(--accent)",cursor:a?"default":"pointer",fontSize:11,padding:0,textDecoration:"underline"},children:a?"loading…":"view full output"}),(0,r.jsx)("a",{href:`${h}&download=1`,style:{marginLeft:10*!!p,color:"var(--accent)",fontSize:11,textDecoration:"underline"},children:"download full output"}),o&&(0,r.jsxs)("span",{style:{marginLeft:6,color:"var(--text-dim)",fontSize:11},children:["(",o,")"]})]})]})}let sW=/^[\t ]*(?:WORK_CLASS|PURPOSE|BLOCKS_PRIMARY|PRIMARY_DELIVERABLE|OWNED_PATHS|FINDING_ID)[\t ]*:[^\r\n]*$/i;function sH(e){if(!e)return null;let t=/^\s*TASK_GUARD\s*:\s*$/im.exec(e),n=e;if(t){let r=t.index+t[0].length;"\r"===e[r]&&(r+=1),"\n"===e[r]&&(r+=1);let i=r;for(;r<e.length;){let t=e.indexOf("\n",r),n=-1===t?e.length:t,s=n>r&&"\r"===e[n-1]?n-1:n;if(!sW.test(e.slice(r,s)))break;i=s,r=-1===t?e.length:t+1}let s=t[0].length-t[0].trimStart().length;n=`${e.slice(0,t.index+s)}${e.slice(i)}`}let r=[...n.matchAll(/^\s*TASK_TITLE\s*:\s*(.*?)\s*$/gim)].map(e=>e[1]??"");return 1===r.length&&r[0]&&r[0]===r[0].trim()&&/[가-힣]/u.test(r[0])?r[0]:null}function sU(e){let t=e.live,n=e.archive&&("archive"===e.identity||"session-file"===e.archiveMatch)?e.archive:void 0,r=[t?.assignment,t?.progress?.assignment,t?.task].map(sH).find(e=>null!==e)??(n?.taskTitle?.trim()||null),i=t?.progress?.lastIntent?.trim()||"",s=t?.progress?.currentTool?.trim()||"";return{title:r??"담당 업무 미확인",stage:i&&s?`${i} \xb7 ${s}`:i||(s?`${s} 실행 중`:null),explicitTitle:null!==r}}function sB(e){let t=e.live?.progress,n="string"==typeof t?.resolvedModel?t.resolvedModel.trim():"",r=e.archive&&("archive"===e.identity||"session-file"===e.archiveMatch)?e.archive:void 0,i="string"==typeof t?.resolvedThinkingLevel?t.resolvedThinkingLevel.trim():"",s="string"==typeof r?.thinkingLevel?r.thinkingLevel.trim():"";if(n){let e=n.split("/").pop()||n;return{model:n,modelShort:i&&e.endsWith(`:${i}`)?e.slice(0,-(i.length+1)):e,modelIsFallback:t?.resolvedModelIsFallback===!0,effort:i||s||null}}let a="string"==typeof r?.model?r.model.trim():"";return{model:a||null,modelShort:a?a.split("/").pop()||a:null,modelIsFallback:!!a&&r?.modelIsFallback===!0,effort:s||null}}class sq extends Error{constructor(e,t,n){super(t),this.kind=e,this.status=n,this.name="SubagentClientError"}}async function sV(e){try{return await e.json()}catch{throw new sq("invalid-response","응답 JSON을 해석할 수 없습니다.",e.status)}}function sK(e){return!!e&&"object"==typeof e&&"string"==typeof e.name&&"number"==typeof e.bytes&&"number"==typeof e.modified&&(null===e.messages||"number"==typeof e.messages)&&(void 0===e.taskTitle||"string"==typeof e.taskTitle)&&"string"==typeof e.firstTask}function sG(e){return!!e&&"object"==typeof e&&"string"==typeof e.role&&("message"===e.kind||"custom"===e.kind)&&"string"==typeof e.text&&(null===e.at||"number"==typeof e.at)}function sJ(e){return!!e&&"object"==typeof e&&!!("id"in e&&"string"==typeof e.id)&&!!("index"in e&&"number"==typeof e.index)&&!!("agent"in e&&"string"==typeof e.agent)&&!!("agentSource"in e&&("bundled"===e.agentSource||"user"===e.agentSource||"project"===e.agentSource))&&!!("status"in e&&("pending"===e.status||"running"===e.status||"completed"===e.status||"failed"===e.status||"aborted"===e.status||"unknown"===e.status))&&!!("lastUpdate"in e&&"number"==typeof e.lastUpdate)&&!0}function sY(e){return!!e&&"object"==typeof e&&(!("id"in e)||void 0===e.id||"string"==typeof e.id)&&(!("type"in e)||void 0===e.type||"string"==typeof e.type)&&(!("message"in e)||void 0===e.message||null!==e.message&&"object"==typeof e.message)}function sZ(e=(e,t)=>fetch(e,t),t="/api/sidecars/subagent"){let n=async(t,n,r)=>{let i;try{i=await e(t,n)}catch(e){if(n.signal?.aborted)throw e;throw new sq(r,"sidecar-unreachable"===r?"Subagent 기록 사이드카(30144)에 연결할 수 없습니다.":"실시간 Subagent 상태에 연결할 수 없습니다.")}let s=await sV(i);if(!i.ok)throw new sq("http",function(e,t){if(e&&"object"==typeof e&&"error"in e){let t=e.error;if("string"==typeof t&&t)return t}return t}(s,`HTTP ${i.status}`),i.status);return{response:i,body:s}};return{async getLiveSnapshots(e,t){let{body:r}=await n(`/api/agent/${encodeURIComponent(e)}`,{method:"GET",signal:t},"live-unreachable");if(!r||"object"!=typeof r)throw new sq("invalid-response","실시간 Subagent 응답이 올바르지 않습니다.");if("string"==typeof r.error&&r.error)throw new sq("http",r.error);if(!0!==r.running)return{runtime:"detached",subagents:[]};let i=r.state?.subagents;if(void 0!==i&&(!Array.isArray(i)||!i.every(sJ)))throw new sq("invalid-response","실시간 Subagent 목록이 올바르지 않습니다.");return{runtime:"running",subagents:i??[]}},async getLiveTranscript(e,t,r,i){let{body:s}=await n(`/api/agent/${encodeURIComponent(e)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"get_subagent_messages",subagentId:t,fromByte:r}),signal:i},"live-unreachable");if(!s||"object"!=typeof s)throw new sq("invalid-response","실시간 Subagent 기록 응답이 올바르지 않습니다.");if("string"==typeof s.error&&s.error)throw new sq("http",s.error);if(!0!==s.success||!s.data||"object"!=typeof s.data)throw new sq("invalid-response","실시간 Subagent 기록 응답이 올바르지 않습니다.");let a=s.data;if(!Array.isArray(a.entries)||!a.entries.every(sY)||"number"!=typeof a.fromByte||"number"!=typeof a.nextByte||"boolean"!=typeof a.reset)throw new sq("invalid-response","실시간 Subagent 기록 응답이 올바르지 않습니다.");return{fromByte:a.fromByte,nextByte:a.nextByte,reset:a.reset,entries:a.entries}},async getArchive(e,r){let i=`${t}/archive?session=${encodeURIComponent(e)}`,{body:s}=await n(i,{method:"GET",signal:r},"sidecar-unreachable");if(!s||"object"!=typeof s||"string"!=typeof s.sessionId||"string"!=typeof s.dir||"boolean"!=typeof s.found||!Array.isArray(s.subagents)||!s.subagents.every(sK))throw new sq("invalid-response","Subagent 기록 목록 응답이 올바르지 않습니다.");return{sessionId:s.sessionId,dir:s.dir,found:s.found,subagents:s.subagents,...!0===s.listTruncated?{listTruncated:!0}:{}}},async getArchiveTranscript(e,r,i=400,s){let a=`${t}/transcript?session=${encodeURIComponent(e)}&name=${encodeURIComponent(r)}&limit=${encodeURIComponent(String(i))}`,{body:l}=await n(a,{method:"GET",signal:s},"sidecar-unreachable");if(!l||"object"!=typeof l||"string"!=typeof l.sessionId||"string"!=typeof l.name||"number"!=typeof l.bytes||"boolean"!=typeof l.truncated||!Array.isArray(l.entries)||!l.entries.every(sG))throw new sq("invalid-response","Subagent 디스크 기록 응답이 올바르지 않습니다.");return{sessionId:l.sessionId,name:l.name,bytes:l.bytes,truncated:l.truncated,entries:l.entries}}}}let sQ=["feature","maintenance","diagnostic"],sX=/^[\t ]*([A-Z_]+)[\t ]*:[\t ]*(.*?)[\t ]*$/;function s0(e){if("string"!=typeof e)return null;let t=e.split(/\r?\n/),n=t.findIndex(e=>/^\s*TASK_GUARD\s*:\s*$/.test(e));if(n<0)return null;for(let e=n+1;e<t.length;e+=1){let n=sX.exec(t[e]);if(!n)break;if("WORK_CLASS"!==n[1])continue;let r=n[2].toLowerCase();return sQ.includes(r)?r:null}return null}let s1={verdicts:new Map,runs:new Map,latestByAgent:new Map,spawnedAt:new Map,durations:new Map,parallelWith:new Map,runStartedAt:new Map};function s2(e){return Array.isArray(e)?e.filter(e=>"object"==typeof e&&null!==e):[]}function s8(e){return"string"==typeof e&&e.trim()?e:null}function s4(e){return"number"==typeof e.durationMs&&Number.isFinite(e.durationMs)&&e.durationMs>=0?e.durationMs:null}function s5(e){switch(e){case"pending":case"queued":return"pending";case"running":return"running";case"completed":case"success":return"completed";case"failed":case"error":return"failed";case"aborted":case"cancelled":case"canceled":return"aborted";default:return null}}function s6(e){return"string"==typeof e?e:e.map(e=>"text"===e.type?e.text:"").join("\n")}function s3(e,t){if(t?.isError)return null;let n=s2(e.input.tasks),r=s2(t?.details?.progress),i=Math.max(n.length,r.length),s=[];for(let a=0;a<i;a++){let i=r.find(e=>e.index===a)??r[a],l=n[a],o=s8(i?.id)??s8(l?.name);o&&s.push({key:`${e.toolCallId}#${a}`,toolCallId:e.toolCallId,index:a,agentId:o,agent:s8(i?.agent)??s8(l?.agent),task:s8(i?.task)??s8(l?.task)??"",workClass:s0(l?.task)??s0(i?.task),spawned:!!t})}return s}let s7=/<task-result\b([^>]*)>/g,s9=/(\w+)="([^"]*)"/g;function ae(e,t,n){return t.find(t=>t.parentToolCallId?t.parentToolCallId===e.toolCallId&&t.id===e.agentId:t.id===e.agentId&&n.latestByAgent.get(e.agentId)===e.key)}function at(e,t,n){var r;let i,s,a,l,o=ae(e,t,n),c=o?{key:e.key,identity:"live",live:o.assignment?o:{...o,assignment:e.task}}:{key:e.key,identity:"live",live:{id:e.agentId,index:e.index,agent:e.agent??"",agentSource:"user",status:"unknown",task:e.task,lastUpdate:0}},d=sU(c),u=n.runs.get(e.key),h=null;o&&"unknown"!==o.status?(i=o.status,h="live"):u&&"unknown"!==u.status?(i=u.status,h="record"):i=e.spawned?"unobserved":"dispatching";let p=n.verdicts.get(e.key),m=p&&p.length>0?p[p.length-1]:null,f=m?.at??null,g=null===f?null:(r=e.key,s=n.runStartedAt.get(r)??null,a=o?.progress?.durationMs,l=o&&("pending"===o.status||"running"===o.status)&&"number"==typeof a&&o.lastUpdate>0?o.lastUpdate-a:null,null===s?l:null===l?s:Math.max(s,l)),x=null!==f&&null!==g&&g>f;return{member:e,title:d.title,explicitTitle:d.explicitTitle,stage:o?d.stage:null,model:o?sB(c):null,run:i,runSource:h,verdict:x?null:m,priorVerdict:x?m:null,runTitle:x?sH(o?.progress?.task):null,observedParallelWith:n.parallelWith.get(e.key)}}function an(e,t){return t.find(t=>t.parentToolCallId===e.toolCallId&&t.id===e.agentId)}function ar(e,t){let n=[...t.verdicts.get(e.key)??[]].sort((e,t)=>e.order-t.order),r=new Map,i=[];for(let e of n){let t={attempt:e.attempt,verdict:e.verdict,reason:e.reason};null===e.attempt?i.push(t):r.set(e.attempt,t)}return[...i,...[...r.values()].sort((e,t)=>(e.attempt??0)-(t.attempt??0))]}function ai(e){return"assistant"!==e.role?[]:e.content?.filter(e=>"toolCall"===e.type&&"task"===e.toolName)??[]}let as=(0,i.createContext)({ledger:s1,subagents:[],toolResults:new Map});n(21340);let aa={test:!0,tests:!0,__tests__:!0,__fixtures__:!0,fixtures:!0,__snapshots__:!0,node_modules:!0,coverage:!0},al={html:0,document:1,image:2},ao=["investigate","edit","check","review","commit","ci","deploy"];function ac(e,t){let n="",r=t;for(;r<e.length&&'"'!==e[r];){let t=e[r];if("\\"===t&&r+1<e.length){let i=e[r+1];"\n"!==i&&(n+='$`"\\'.includes(i)?i:t+i),r+=2}else if("$"===t&&"("===e[r+1]){let t=ad(e,r+1);n+=e.slice(r,t),r=t}else if("`"===t){let t=au(e,r+1);n+=e.slice(r,t),r=t}else n+=t,r+=1}return{text:n,end:Math.min(r+1,e.length)}}function ad(e,t){let n=e[t],r="{"===n?"}":")",i=0,s=t;for(;s<e.length;){let t=e[s];if("\\"===t)s+=2;else if("'"===t){let t=e.indexOf("'",s+1);s=t<0?e.length:t+1}else if('"'===t)s=ac(e,s+1).end;else if("`"===t)s=au(e,s+1);else{if(t===n)i+=1;else if(t===r&&0==--i)return s+1;s+=1}}return e.length}function au(e,t){let n=t;for(;n<e.length&&"`"!==e[n];)n+="\\"===e[n]?2:1;return Math.min(n+1,e.length)}function ah(e){let{tokens:t,groups:n,expandingHeredoc:r}=function(e){let t=[],n=[],r=!1,i=[],s=[],a="",l=-1,o=!1,c=e=>{if(l<0)return;let n={value:a,start:l,end:e,risky:o};for(let e of(t.push(n),s.splice(0)))e.at===t.length-1&&(e.owner=n);a="",l=-1,o=!1},d=0;for(;d<e.length;){let u=e[d];if("\\"===u)"\n"!==e[d+1]&&(l<0&&(l=d),a+=e[d+1]??""),d+=2;else if("'"===u){l<0&&(l=d);let t=e.indexOf("'",d+1),n=t<0?e.length:t;a+=e.slice(d+1,n),d=n+1}else if('"'===u){l<0&&(l=d);let t=ac(e,d+1);/\$[({]|`/.test(e.slice(d,t.end))&&(o=!0),a+=t.text,d=t.end}else if("$"===u&&("("===e[d+1]||"{"===e[d+1])){l<0&&(l=d);let t=ad(e,d+1);a+=e.slice(d,t),o=!0,d=t}else if("`"===u){l<0&&(l=d);let t=au(e,d+1);a+=e.slice(d,t),o=!0,d=t}else if("#"===u&&l<0){let t=e.indexOf("\n",d);d=t<0?e.length:t}else if(" "===u||" "===u||"\r"===u)c(d),d+=1;else if("\n"===u){c(d);let n=t[t.length-1];for(let a of("&&"!==n&&"||"!==n&&"|"!==n&&t.push(";"),d+=1,s.length=0,i.splice(0)))for(;d<e.length;){let t=e.indexOf("\n",d),n=t<0?e.length:t,i=e.slice(d,n);if(d=n+1,(a.stripTabs?i.replace(/^\t+/,""):i)===a.delimiter)break;!a.quoted&&/\$[({]|`/.test(i)&&(a.owner?a.owner.risky=!0:r=!0)}}else if("<"===u&&"<"===e[d+1]&&"<"!==e[d+2]){c(d);let n=d+2,r="-"===e[n];for(r&&(n+=1);" "===e[n]||" "===e[n];)n+=1;let a="",l=!1;for(;n<e.length&&!/[\s;&|<>()]/.test(e[n]);){let t=e[n];if("'"===t||'"'===t){l=!0;let r=e.indexOf(t,n+1),i=r<0?e.length:r;a+=e.slice(n+1,i),n=i+1}else"\\"===t&&(l=!0),a+="\\"===t?e[n+1]??"":t,n+="\\"===t?2:1}if(a){let e=t[t.length-1],n={delimiter:a,stripTabs:r,quoted:l,owner:void 0!==e&&"string"!=typeof e?e:null,at:t.length};i.push(n),n.owner||s.push(n)}d=n}else";"===u?(c(d),t.push(";"),d+=";"===e[d+1]?2:1):"&"===u?"&"===e[d+1]?(c(d),t.push("&&"),d+=2):(">"===e[d+1]||/[<>]$/.test(a)?(l<0&&(l=d),a+=u):(c(d),t.push("&")),d+=1):"|"===u?"|"===e[d+1]?(c(d),t.push("||"),d+=2):a.endsWith(">")?(a+=u,d+=1):(c(d),t.push("|"),d+="&"===e[d+1]?2:1):("("===u||")"===u?(c(d),n.push(d)):(l<0&&(l=d),("{"===u||"}"===u||"!"===u)&&(o=!0),a+=u),d+=1)}return c(e.length),{tokens:t,groups:n,expandingHeredoc:r}}(e),i=[],s=[],a={pipelines:[],operators:[],background:!1},l={commands:[],negated:!1},o=[],c=()=>{let t=o.map(e=>e.value).filter(e=>"{"!==e&&"}"!==e);if(0===l.commands.length&&"!"===t[0]&&(l.negated=!0,t.shift()),t.length>0){let r=o[0].start,i=o[o.length-1].end,a=o.some(e=>e.risky)||n.some(e=>e>=r&&e<=i),c={words:t,text:e.slice(r,i),uncertain:a};l.commands.push(c),s.push(c)}o=[]},d=()=>{c(),l.commands.length>0&&a.pipelines.push(l),l={commands:[],negated:!1}},u=e=>{d(),a.pipelines.length>0&&i.push({...a,background:e}),a={pipelines:[],operators:[],background:!1}};for(let e of t)"string"!=typeof e?o.push(e):"|"===e?c():"&&"===e||"||"===e?(d(),a.operators.push(e)):u("&"===e);return u(!1),{lists:i,commands:s,uncertain:n.length>0||r||t.some(e=>"string"!=typeof e&&e.risky)}}function ap(e){return e.slice(e.lastIndexOf("/")+1)}let am={bash:!0,sh:!0,zsh:!0,dash:!0},af={sudo:!0,env:!0,command:!0,exec:!0,nice:!0,nohup:!0,time:!0,timeout:!0,setsid:!0,"systemd-run":!0},ag={"-u":!0,"--unit":!0,"-p":!0,"--property":!0,"-E":!0,"--setenv":!0,"--description":!0,"--slice":!0,"-M":!0,"--machine":!0,"-H":!0,"--host":!0,"--uid":!0,"--gid":!0,"--working-directory":!0,"-s":!0,"--signal":!0,"-k":!0,"--kill-after":!0},ax={"--wait":!0,"-W":!0,"--pipe":!0,"-P":!0,"--pty":!0,"-t":!0,"--scope":!0},av={if:!0,then:!0,elif:!0,else:!0,do:!0,while:!0,until:!0};function ay(e){let t=ak(e);if(t>=0&&"eval"===e[t])return t+1<e.length?e.slice(t+1).join(" "):null;if(t<0||!Object.hasOwn(am,ap(e[t]))||ab(e,t))return null;for(let n=t+1;n<e.length&&/^[-+]/.test(e[n]);n+=1){if(/^-[a-zA-Z]*c[a-zA-Z]*$/.test(e[n]))return e[n+1]??null;(/^[-+][a-zA-Z]*[oO]$/.test(e[n])||"--rcfile"===e[n]||"--init-file"===e[n])&&(n+=1)}return null}function ab(e,t){for(let n=t+1;n<e.length&&/^[-+]/.test(e[n]);n+=1){if(/^-[a-zA-Z]*n[a-zA-Z]*$/.test(e[n])||/^-[a-zA-Z]*o$/.test(e[n])&&"noexec"===e[n+1])return!0;(/^[-+][a-zA-Z]*[oO]$/.test(e[n])||"--rcfile"===e[n]||"--init-file"===e[n])&&(n+=1)}return!1}let aw={command:/^-[a-zA-Z]*[vV]/,sudo:/^(?:-[a-zA-Z]*[lvVhK]|--(?:list|validate|version|help|remove-timestamp)$)/};function ak(e){let t=!1,n="";for(let r=0;r<e.length;r+=1){let i=e[r];if(!(/^[A-Za-z_]\w*=/.test(i)||!t&&Object.hasOwn(av,i))){if(t&&(i.startsWith("-")||/^\d+(?:\.\d+)?[smhd]?$/.test(i))){if(Object.hasOwn(aw,n)&&aw[n].test(i))return -1;"command"!==n&&Object.hasOwn(ag,i)&&(r+=1);continue}if(!Object.hasOwn(af,ap(i)))return r;t=!0,n=ap(i)}}return -1}let aj=/(?:^|\/)wsl\/update\.sh$/;function aS(e,t=0){let n=ay(e);if(null!==n)return t<3&&ah(n).commands.some(e=>aS(e.words,t+1));let r=ak(e);if(r<0)return!1;if(aj.test(e[r]))return!0;if(!Object.hasOwn(am,ap(e[r]))||ab(e,r))return!1;let i=e.slice(r+1).find(e=>!e.startsWith("-"));return void 0!==i&&aj.test(i)}function aC(e){let t=ak(e),n=t<0?e:e.slice(0,t),r=n.map(ap);return r.includes("systemd-run")?!n.some(e=>Object.hasOwn(ax,e)):!!(r.includes("sudo")&&n.some(e=>"--background"===e||/^-[a-zA-Z]*b[a-zA-Z]*$/.test(e)))||r.includes("setsid")&&!n.includes("-w")&&!n.includes("--wait")}function aN(e){let[t]=e.pipelines;return 1!==e.pipelines.length||1!==t.commands.length||t.negated?null:t.commands[0]}function aT(e){if(e.every(e=>/^[A-Za-z_]\w*=/.test(e)))return!0;let[t,...n]=e;return"cd"===t?n.length<=1:"export"===t?n.every(e=>/^[A-Za-z_]\w*=/.test(e)):"set"===t&&n.every(e=>/^[-+][a-zA-Z]+$/.test(e)&&!/^-[a-zA-Z]*n/.test(e)||"pipefail"===e)}let aI={tail:!0,head:!0,cat:!0,tee:!0},aM=/(?:^|[^\w-])(?:tests?|typecheck|tsc|lint|eslint|vitest|jest|pytest|build|check|verify|smoke)(?![\w])/i,aE={bun:!0,bunx:!0,npm:!0,npx:!0,pnpm:!0,yarn:!0,node:!0,python:!0,python3:!0,deno:!0},aR={"--help":!0,"-h":!0,"--version":!0},a$=Object.fromEntries(["-C","-r","--allow-fs-read","--allow-fs-write","--build-snapshot-config","--conditions","--cpu-prof-dir","--debug-port","--inspect-port","--experimental-config-file","--experimental-default-config-file","--experimental-test-isolation","--test-isolation","--report-dir","--report-directory","--cpu-prof-interval","--cpu-prof-name","--diagnostic-dir","--disable-proto","--disable-warning","--dns-result-order","--env-file","--env-file-if-exists","--experimental-loader","--experimental-package-map","--experimental-sea-config","--experimental-test-tag-filter","--heap-prof-dir","--heap-prof-interval","--heap-prof-name","--heapsnapshot-near-heap-limit","--heapsnapshot-signal","--icu-data-dir","--import","--input-type","--inspect-publish-uid","--loader","--localstorage-file","--max-http-header-size","--max-old-space-size-percentage","--network-family-autoselection-attempt-timeout","--openssl-config","--redirect-warnings","--report-filename","--report-signal","--require","--run","--secure-heap","--secure-heap-min","--snapshot-blob","--test-concurrency","--test-coverage-branches","--test-coverage-exclude","--test-coverage-functions","--test-coverage-include","--test-coverage-lines","--test-global-setup","--test-name-pattern","--test-random-seed","--test-reporter","--test-reporter-destination","--test-rerun-failures","--test-shard","--test-skip-pattern","--test-timeout","--title","--tls-cipher-list","--tls-keylog","--trace-event-categories","--trace-event-file-pattern","--trace-require-module","--unhandled-rejections","--use-largepages","--v8-pool-size","--watch-kill-signal","--watch-path"].map(e=>[e,!0]));function aL(e){let t=ak(e);if(t<0)return!1;let n=ap(e[t]);if("test"===n||"["===n||e.slice(t+1).some(e=>Object.hasOwn(aR,e)))return!1;if(aM.test(n))return!0;if(!Object.hasOwn(aE,n))return!1;if("node"===n&&function(e,t){for(let n=t;n<e.length;n+=1){let t=e[n];if("--test"===t)return!0;if("--"===t||!t.startsWith("-"))break;Object.hasOwn(a$,t)&&(n+=1)}return!1}(e,t+1))return!0;let r=function(e,t){for(let n=t;n<e.length;n+=1){let t=e[n];if("-m"===t)return e[n+1];if(/^-[a-zA-Z]*[cep]/.test(t)||/^--(?:eval|print)(?:=|$)/.test(t))break;if(!t.startsWith("-")){if("run"===t||"exec"===t||"x"===t||"dlx"===t)return e.slice(n+1).find(e=>!e.startsWith("-"));return t}}}(e,t+1);return void 0!==r&&aM.test(r)}let aP={"-C":!0,"-c":!0,"--git-dir":!0,"--work-tree":!0,"--namespace":!0},aA={commit:{"--dry-run":!0,"-h":!0,"--help":!0},push:{"--dry-run":!0,"-n":!0,"-h":!0,"--help":!0,"--delete":!0,"-d":!0}};function a_(e){let t=ak(e);if(t<0||"git"!==ap(e[t]))return null;for(let n=t+1;n<e.length;n+=1)if(Object.hasOwn(aP,e[n]))n+=1;else if(!e[n].startsWith("-"))return{name:e[n],at:n};return null}function aF(e,t=0,n){let r=ay(e);if(null!==r)return t<3&&ah(r).commands.some(e=>aF(e.words,t+1,n));let i=a_(e);if(!i||"commit"!==i.name&&"push"!==i.name||void 0!==n&&i.name!==n)return!1;let s=aA[i.name];return!e.slice(i.at+1).some(e=>Object.hasOwn(s,e)||"push"===i.name&&/[nd]/.test(function(e){if(!/^-[a-zA-Z0-9]/.test(e))return"";let t="";for(let n of e.slice(1)){if("o".includes(n)||!/[a-zA-Z0-9]/.test(n))break;t+=n}return t}(e)))}function aO(e){return aT(e)||null!==a_(e)}let az={check:({words:e})=>aL(e),commit:({words:e})=>aF(e),ci:({words:e})=>{let t=ak(e);return t>=0&&"gh"===ap(e[t])&&"run"===e[t+1]&&"watch"===e[t+2]&&e.includes("--exit-status")},deploy:e=>aS(e.words)},aD={test:"test",tests:"test",vitest:"test",jest:"test",pytest:"test",typecheck:"typecheck",tsc:"typecheck",lint:"lint",eslint:"lint",build:"build",check:"verify",verify:"verify",smoke:"smoke"};function aW(e){return!e||"object"!=typeof e||"bash"!==e.toolName||!e.input||"object"!=typeof e.input||Array.isArray(e.input)?null:("string"==typeof e.input.command?e.input.command.trim():"")||null}let aH={"$?":!1,"${PIPESTATUS[0]}":!0};function aU(e,t){let n=a1(t);if("notRun"===n)return[];let r=n?void 0:t,i=ah(e),s=[];if(i.commands.some(({words:e})=>(function e(t,n=0){let r=ay(t);return null!==r?n<3&&ah(r).commands.some(t=>e(t.words,n+1)):aL(t)})(e))&&s.push("check"),i.commands.some(({words:e})=>aF(e))&&s.push("commit"),i.commands.some(({words:e})=>(function e(t,n=0){let r=ay(t);if(null!==r)return n<3&&ah(r).commands.some(t=>e(t.words,n+1));let i=ak(t);return i>=0&&"gh"===ap(t[i])&&"run"===t[i+1]&&["watch","view","list"].includes(t[i+2])})(e))&&s.push("ci"),i.commands.some(az.deploy)&&s.push("deploy"),0===s.length)return[];let a=r?nU(r):null,l=null===a?!!r?.isError:0!==a,o=s.length>1?{stages:s,failed:l}:void 0,c=r?lh(r):"";return s.map(e=>{var t;let s,d,u,h="commit"===e?aO:aT,p=function e(t,n,r=aT,i=0){let{lists:s}=t,a=[],l=t.uncertain,o=!1;return s.forEach((t,c)=>{for(let d of(t.pipelines.some(e=>e.commands.some(({words:e})=>e.some(e=>e.includes("pipefail"))))&&(o=!1),t.pipelines)){let u=!1;for(let h of d.commands){let p=i<3?ay(h.words):null,m=null===p?null:e(ah(p),n,r,i+1);if(m&&m.decisive.length>0)a.push(...m.decisive);else if(n(h))a.push(h);else{let e=ak(h.words);u&&o&&e>=0&&Object.hasOwn(aI,ap(h.words[e]))||r(h.words)||function(e,t){if(t!==e.length-1||e[t].background)return!1;let n=aN(e[t])?.words;return n?.[0]==="exit"&&(1===n.length||2===n.length&&"$?"===n[1])}(s,c)||(l=!0);continue}u=!0,(m?.reach==="masked"||d.negated||d.commands.length>1&&!o||t.operators.includes("||")||t.background||aC(h.words)||!function(e,t){if(t===e.length-1)return!0;let n=e[e.length-1],r=aN(n)?.words;return!!r&&"exit"===r[0]&&!n.background&&t===e.length-2&&(1===r.length||2===r.length&&"$?"===r[1])}(s,c))&&(l=!0)}}let d=aN(t)?.words;!t.background&&d?.[0]==="set"&&3===d.length&&"pipefail"===d[2]&&(/^-[a-zA-Z]*o$/.test(d[1])?o=!0:/^\+[a-zA-Z]*o$/.test(d[1])&&(o=!1))}),{reach:0===a.length?"absent":l?"masked":"carried",decisive:a}}(i,az[e],h),m="check"===e&&p.decisive.some(({words:e})=>e.includes("--if-present")),f=r?(t=az[e],s=new Map,d=i.lists.map(e=>(function(e){let t=e&&!e.background?aN(e)?.words:void 0;if(!t||"echo"!==t[0]||t.length<2)return null;let n=t.slice(1);if(n.some(e=>e.startsWith("-")||/^(?:\d*[<>]|&>)/.test(e)))return null;let r=n.join(" ");for(let[e,t]of Object.entries(aH)){let n=r.indexOf(e);if(n<0||r.indexOf(e,n+1)>=0)continue;let i=r.slice(0,n),s=r.slice(n+e.length);if(/[$`\\]/.test(i+s)||!/[^\s\d]/.test(i))break;return{prefix:i,suffix:s,first:t}}return null})(e)),u=c.split("\n").map(e=>e.trimEnd()),i.lists.forEach((e,n)=>{let r=d[n+1];if(!r||e.background||e.operators.includes("||"))return;let i=e.pipelines[e.pipelines.length-1],a=e.pipelines.slice(0,-1);if(i.negated||a.some(e=>e.negated||1!==e.commands.length||!h(e.commands[0].words)))return;let l=r.first||1===i.commands.length?i.commands[0]:void 0;if(!l||!t(l)||aC(l.words)||l.uncertain)return;let o=d.filter(e=>e?.prefix===r.prefix&&e.suffix===r.suffix),c=RegExp(`^${r.prefix.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(-?\\d+)${r.suffix.trimEnd().replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}$`),p=u.flatMap(e=>{let t=c.exec(e);return t?[{code:Number(t[1]),line:e}]:[]});if(p.length!==o.length)return;let m=d.slice(0,n+2).filter(e=>o.includes(e)).length-1;s.set(l,p[m])}),s):new Map,g=p.decisive.flatMap(e=>f.get(e)??[]),x=g.length>0&&g.length===p.decisive.length?g.find(({code:e})=>0!==e)??g[0]:null,v=x?0!==x.code?"failed":m?"unverified":"passed":l?o?"unverified":"failed":null===a?"unobserved":"carried"!==p.reach||m?"unverified":"passed",y="unobserved"===v?"interrupted"===n?"interrupted":r?"noExit":"noResult":"unverified"!==v?null:m?"optional":l&&o?"compound":i.uncertain?"syntax":"masked";return{stage:e,state:v,exitCode:a,labels:"check"===e?function(e){let t=[];for(let{words:n}of e){let e=ak(n);n.forEach((n,r)=>{if(r!==e||"test"!==n)for(let e of n.replace(/^-+/,"").toLowerCase().split(":")){let n=Object.hasOwn(aD,e)?aD[e]:void 0;n&&!t.includes(n)&&t.push(n)}})}return t}(p.decisive):[],...o?{compound:o}:{},...x?{evidence:x.line}:{},...y?{reason:y}:{}}})}function aB(e,t){let n=aW(e),r=null===n?void 0:aU(n,t).find(e=>"check"===e.stage);return null!==n&&r?{toolCallId:e.toolCallId,command:n,state:r.state,exitCode:r.exitCode,labels:r.labels,...r.compound?{compound:r.compound}:{},...r.reason?{reason:r.reason}:{}}:null}let aq=/\.(?:md|mdx|markdown|txt)$/i,aV=/^docs?$/i;function aK(e){return aq.test(e)||e.split(/[\\/]/).slice(0,-1).some(e=>aV.test(e))}let aG={read:!0,grep:!0,glob:!0,find:!0,ls:!0,skim:!0,web_search:!0,fetch:!0,ast_grep:!0,lsp:!0,recall:!0,reflect:!0},aJ={multiedit:!0,notebookedit:!0,draft:!0},aY={rename:!0,rename_file:!0},aZ={passed:"done",failed:"failed",unverified:"unverified",unobserved:"unobserved"};function aQ(e){return e.split("\n")[0].trim()||void 0}let aX=/^\[[^\]\n]*? ([0-9a-f]{7,40})\] (.+)$/m,a0=/^\s*\+?[0-9a-f]{7,40}\.{2,3}([0-9a-f]{7,40})\s+\S+\s+->\s+\S+/m;function a1(e){let t=e?.details;return t&&"object"==typeof t?"__synthetic"in t&&!0===t.__synthetic&&"executed"in t&&!1===t.executed?"notRun":"__interrupted"in t&&!0===t.__interrupted?"interrupted":null:null}let a2=/\btool\.git_(?:finalize|integrate)\s*\(/,a8=/\b(?:Committed|Integrated \S+) and pushed ([0-9a-f]{40})\b|\bcommitSha["']?\s*:\s*["']([0-9a-f]{40})["']/,a4=/\bgit_(?:finalize|integrate) failed\b|\bok["']?\s*:\s*false\b|\bstage["']?\s*:\s*["'](?!complete["'])[\w-]+["']/,a5=/\bstage["']?\s*:\s*["'](?:up-to-date|aborted)["']/,a6=/["']?\bmessage["']?\s*:\s*(["'`])((?:\\[\s\S]|(?!\1)[^\\])*)\1/;function a3(e,t){if("string"==typeof t.commitSha&&""!==t.commitSha.trim())return t.commitSha.trim();let n=a8.exec(lh(e));return n?.[1]??n?.[2]??null}let a7=/^bg_\d+$/;function a9(e){let t=e.details,n=t&&"object"==typeof t&&"async"in t?t.async:null;if(n&&"object"==typeof n&&"jobId"in n&&"string"==typeof n.jobId&&a7.test(n.jobId))return n.jobId;let r=lh(e).trimStart();return r.startsWith("Backgrounded")?/\bBackgrounded as job (bg_\d+)\b/.exec(r)?.[1]??null:null}function le(e,t){let n=/Command exited with code (-?\d+)\s*$/.exec(t.trimEnd());return{jobId:e,text:t,exitCode:n?Number(n[1]):null}}function lt(e){return"passed"===e||"failed"===e||"done"===e}function ln(e){let t=null;for(let n of e.values())"failed"===n.outcome&&(!t||n.order>t.order)&&(t=n);return t?.stage??null}function lr(e){return e.commandKey??JSON.stringify([e.cwd??"",e.command])}function li(e){let t=new Map;for(let n of e){if("check"!==n.stage)continue;let e=lr(n),r=t.get(e);(r?.outcome!=="failed"||lt(n.outcome))&&t.set(e,n)}return[...t.values()]}function ls(e){return"compound"in e&&e.compound?.failed===!0}let la={failed:6,running:5,unverified:4,unobserved:3,stale:2,passed:1,done:0};function ll(e){return"stale"!==e&&(lt(e)||"running"===e)}function lo(e){if("ci"!==e.stage)return null;let t=ah(e.command).commands.flatMap(({words:e})=>lm(e)).map(e=>"run"===e[0]&&("watch"===e[1]||"view"===e[1])?lv(e):null);return t.length>0&&t.every(e=>null!==e)?t:null}let lc={"publish public mirror":!0,"publish-public.yml":!0,".github/workflows/publish-public.yml":!0},ld={ci:!0,"ci.yml":!0,".github/workflows/ci.yml":!0},lu=/^[0-9a-f]{40}$/i;function lh(e){let t=e.content;return"string"==typeof t?t:Array.isArray(t)?t.map(e=>e&&"object"==typeof e&&"text"in e&&"string"==typeof e.text?e.text:"").join("\n"):""}function lp(e){let t=[];for(let n of e.split("\n")){let e,r=n.trim();if(r.startsWith("{")||r.startsWith("[")){try{e=JSON.parse(r)}catch{continue}for(let n of Array.isArray(e)?e:[e])n&&"object"==typeof n&&!Array.isArray(n)&&t.push(n)}}return t}function lm(e,t=0){let n=ay(e);if(null!==n)return t<3?ah(n).commands.flatMap(e=>lm(e.words,t+1)):[];let r=ak(e);return r>=0&&"gh"===ap(e[r])?[e.slice(r+1)]:[]}function lf(e,t){for(let n=0;n<e.length;n+=1)for(let r of t){if(e[n]===r)return e[n+1]??null;if(r.startsWith("--")&&e[n].startsWith(`${r}=`))return e[n].slice(r.length+1)}return null}let lg={"-R":!0,"--repo":!0,"-j":!0,"--job":!0,"--interval":!0,"-i":!0,"--json":!0,"-q":!0,"--jq":!0,"-t":!0,"--template":!0};function lx(e){for(let t=2;t<e.length;t+=1){if(Object.hasOwn(lg,e[t])){t+=1;continue}if(!e[t].startsWith("-"))return e[t]}return null}function lv(e){let t=lx(e);return null!==t&&/^\d+$/.test(t)?t:null}let ly=/^https:\/\/github\.com\/([^/\s]+\/[^/\s]+)\/actions\/runs\/\d+/i;function lb(e,t){if(!t||t.isError||!/\bgh\b/.test(e)||0!==nU(t))return[];let n=ah(e).commands.flatMap(({words:e})=>lm(e)).filter(e=>"run"===e[0]&&("list"===e[1]||"view"===e[1]));if(0===n.length)return[];let r=1===n.length?n[0]:null,i=r?.[1]==="list"?lf(r,["-c","--commit"])?.toLowerCase():void 0,s=i&&/^[0-9a-f]{7,40}$/.test(i)?i:null,a=lh(t);return s||a.includes("headSha")?lp(a).flatMap(e=>{let t="string"==typeof e.headSha?e.headSha.toLowerCase():s;if(null===t)return[];let n="string"==typeof e.url?ly.exec(e.url)?.[1]??null:null;return[{id:"number"==typeof e.databaseId||"string"==typeof e.databaseId?String(e.databaseId):r?.[1]==="view"?lv(r):null,repo:(n??(r?lf(r,["-R","--repo"]):null))?.toLowerCase()??null,sha:t,status:e.status,conclusion:e.conclusion,branch:"string"==typeof e.headBranch?e.headBranch:r?lf(r,["-b","--branch"]):null,workflow:("string"==typeof e.workflowName?e.workflowName:"string"==typeof e.name&&"databaseId"in e?e.name:r?lf(r,["-w","--workflow"]):null)?.toLowerCase()??null,title:"string"==typeof e.displayTitle?e.displayTitle:null}]}):[]}let lw=/\b\d{9,12}\b/g,lk=/\b(?=[0-9a-f]*[a-f])[0-9a-f]{7,40}\b/;function lj(e,t){if(e?.type!=="toolCall")return[];let n=aW(e);return null===n?[]:lb(n,t).flatMap(e=>e.repo&&e.sha&&e.branch&&e.workflow&&"completed"===e.status&&"success"===e.conclusion&&Object.hasOwn(ld,e.workflow)?[{repo:e.repo,sha:e.sha,branch:e.branch,workflow:e.workflow}]:[])}let lS="Public tree already matches; nothing to publish";function lC(e){let t=null===e?null:/^\$(?:\{([A-Za-z_]\w*)\}|([A-Za-z_]\w*))$/.exec(e);return t?t[1]??t[2]:null}function lN(e){let t="run"===e[0]&&"list"===e[1]?lf(e,["-w","--workflow"])?.toLowerCase():void 0;return void 0!==t&&Object.hasOwn(lc,t)}function lT(e,t){let n=new Map,r=[];for(let{words:i}of ah(e).commands){let e=i.map(e=>/^([A-Za-z_]\w*)=([\s\S]*)$/.exec(e));if(i.length>0&&e.every(e=>null!==e)){for(let t of e){if(!t)continue;let e=/^\$\(([\s\S]*)\)$/.exec(t[2])?.[1],r=void 0===e?[]:ah(e).commands.flatMap(e=>lm(e.words));n.set(t[1],1===r.length&&lN(r[0]))}continue}for(let e of lm(i)){if(lN(e)){r.push({args:e,publish:!0});continue}let i="run"===e[0]&&("watch"===e[1]||"view"===e[1])?lx(e):null,s=lC(i),a=null!==s?!0===n.get(s):null!==i&&/^\d+$/.test(i)&&t(i);r.push({args:e,publish:a})}}return r}function lI(e,t){let n=lT(e,t);return n.length>0&&n.every(({publish:e})=>e)}function lM(e,t){if(!e||!t)return!1;let[n,r]=e.length<=t.length?[e.toLowerCase(),t.toLowerCase()]:[t.toLowerCase(),e.toLowerCase()];return n.length>=7&&/^[0-9a-f]+$/.test(r)&&r.startsWith(n)}function lE(e,t,n){if(lM(e.sha,t.step.commit))return!0;let{title:r}=t.step;return!!r&&!!e.title&&!!e.repo&&!(e.order<=t.order)&&!!e.workflow&&!!Object.hasOwn(ld,e.workflow)&&[...n.publishRuns.values()].some(n=>n.order>t.order&&null!==n.sha&&lM(n.sha,t.step.commit)&&null!==n.repo&&n.repo!==e.repo)&&function(e,t){if(e===t)return!0;let n=e.endsWith("…")?e.slice(0,-1):null;return null!==n&&n.length>=20&&t.startsWith(n)}(e.title,r)}let lR={failure:!0,cancelled:!0,timed_out:!0,startup_failure:!0},l$=/^(\d{4}-\d\d-\d\dT\d\d:\d\d:\d\dZ) READY ([0-9a-f]{7,40})\b/,lL=/^(\d{4}-\d\d-\d\dT\d\d:\d\d:\d\dZ) (ROLLED_BACK|ROLLBACK_FAILED|FAIL)\b/,lP=/^(\d{4}-\d\d-\d\dT\d\d:\d\d:\d\dZ) START old=\S* target=([0-9a-f]{7,40})\b/;function lA(e,t,n=!1,r=[],i,s=[]){let a,l,o=[],c=[],d=1,u=new Map,h=-1,p=-1,m=new Map,f={publishRuns:new Map,watched:[],heads:[],ciHeads:[],nothingToPublish:[],runs:[]},g=Array.isArray(e)?e:[],x=t instanceof Map?t:new Map,v=function(e,t,n=[]){let r=new Map,i=new Map,s=new Map;for(let e of n)null!==e.after&&s.set(e.after,[...s.get(e.after)??[],e]);let a=(e,t)=>{for(let n of e){let e=i.get(n.jobId);e&&(i.delete(n.jobId),r.set(e.toolCallId,{...e.result,isError:!1,content:[{type:"text",text:n.text}],details:{...null===n.exitCode?{}:{exitCode:n.exitCode},backgroundJob:{jobId:n.jobId,after:t}}}))}};for(let n of Array.isArray(e)?e:[]){if(!n||"toolCall"!==n.type)continue;let e=t.get(n.toolCallId);if(e){let t="bash"===n.toolName||"eval"===n.toolName?a9(e):null;t?i.set(t,{toolCallId:n.toolCallId,result:e}):r.set(n.toolCallId,e),"wait"===n.toolName&&a(function(e){let t=e.details,n=t&&"object"==typeof t&&"jobs"in t?t.jobs:null,r=(Array.isArray(n)?n:[]).flatMap(e=>{if(!e||"object"!=typeof e||!("id"in e)||!("status"in e)||!("resultText"in e)||"string"!=typeof e.id||!a7.test(e.id)||"completed"!==e.status&&"failed"!==e.status||"string"!=typeof e.resultText)return[];let t="exitCode"in e&&"number"==typeof e.exitCode?e.exitCode:null;return[{...le(e.id,e.resultText),...null===t?{}:{exitCode:t}}]});if(r.length>0)return r;let i=lh(e),s=[...i.matchAll(/^### (bg_\d+) \[\w+\] — (?:completed|failed)$/gm)];return s.map((e,t)=>{let n=(e.index??0)+e[0].length,r=i.slice(n,t+1<s.length?s[t+1].index:i.length),a=r.indexOf("\n```\n"),l=r.lastIndexOf("\n```");return le(e[1],a>=0&&l>a?r.slice(a+5,l):"")})}(e),n.toolCallId);let s="read"===n.toolName?function(e,t){let n=e.input.path,r="string"==typeof n?/^proc:\/\/(bg_\d+)$/.exec(n)?.[1]:void 0;if(!r)return null;let[i,...s]=lh(t).split("\n");return RegExp(`^1\\|${r} \\[\\w+\\] — (?:completed|failed)\\b`).test(i)?le(r,s.map(e=>e.replace(/^\d+\|/,"")).join("\n")):null}(n,e):null;s&&a([s],n.toolCallId)}for(let e of s.get(n.toolCallId)??[])a(function(e){let t=e.replace(/^\s*<system-notice>\s*\n?/,"").replace(/\s*<\/system-notice>\s*$/,""),n=/^Background job (bg_\d+) has (?:completed|failed)\b[^\n]*(?:\n|$)/.exec(t);if(n)return[le(n[1],t.slice(n[0].length))];let r=[...t.matchAll(/^── Job (\S+) .*──$/gm)];return r.flatMap((e,n)=>{if(!a7.test(e[1]))return[];let i=(e.index??0)+e[0].length;return[le(e[1],t.slice(i,n+1<r.length?r[n+1].index:t.length).replace(/^\n/,""))]})}(e.text),n.toolCallId)}return r}(g,x,Array.isArray(s)?s:[]),y=[];g.forEach((e,t)=>{let r;if(!e||"toolCall"!==e.type)return;let s=v.get(e.toolCallId);for(let a of(!function(e,t,n,r){let i=aW(t);if(null===i||!i.includes("gh"))return;let s=(t,n)=>{let i=e.publishRuns.get(t);i&&(null===n.sha||null!==i.sha)||e.publishRuns.set(t,{...n,order:i?.order??r})};for(let t of lb(i,n))e.runs.push({...t,order:r}),t.id&&t.sha&&t.workflow&&Object.hasOwn(lc,t.workflow)&&s(t.id,{sha:t.sha,repo:t.repo});for(let e of function(e,t){if(!t||t.isError||0!==nU(t))return[];let n=ah(e).commands.flatMap(({words:e})=>lm(e)).filter(e=>"run"===e[0]&&"list"===e[1]);if(1!==n.length)return[];let r=lf(n[0],["-w","--workflow"])?.toLowerCase(),i=void 0!==r&&Object.hasOwn(lc,r),s=lf(n[0],["-R","--repo"])?.toLowerCase()??null;return lh(t).split("\n").flatMap(e=>{let t=e.trim();if(t.startsWith("{")||t.startsWith("["))return[];let n=t.toLowerCase();if(!i&&!Object.keys(lc).some(e=>n.includes(e)))return[];let r=t.match(lw)??[];return 1===r.length?[{id:r[0],sha:lk.exec(n)?.[0]??null,repo:s}]:[]})}(i,n))s(e.id,e);for(let i of lj(t,n))e.ciHeads.push({...i,order:r});for(let t of function(e,t){let n=ah(e),r=n.commands.flatMap(({words:e})=>lm(e)).filter(e=>"api"===e[0]),i=!n.uncertain&&1===n.commands.length&&1===r.length,s=t&&!t.isError&&0===nU(t)?lh(t).trim():"",a=[];for(let e of r){let t=e.slice(1).find(e=>/^\/?repos\//.test(e)),n=t?/^\/?repos\/([^/]+\/[^/]+)\/commits\/([^/?\s]+)$/.exec(t):null;if(!n)continue;let r=lf(e,["-q","--jq"]),l=null;if(i&&".sha"===r)l=s.split("\n")[0]?.trim();else if(i&&null===r&&s.startsWith("{"))try{l=JSON.parse(s.slice(0,s.lastIndexOf("}")+1)).sha}catch{}let o="string"==typeof l&&lu.test(l)?l.toLowerCase():null;a.push({repo:n[1].toLowerCase(),ref:n[2],sha:o})}return a}(i,n))e.heads.push({...t,order:r});let a=function(e,t){if(!t||t.isError||0!==nU(t)||2!==e.split(lS).length)return null;let{lists:n}=ah(e),r=0;for(;r<n.length&&["set","cd"].includes(aN(n[r])?.words[0]??"");)r+=1;let i=r<n.length-1?function(e){let t=aN(e)?.words,n=t?.length===1?/^([A-Za-z_]\w*)=\$\(([\s\S]*)\)$/.exec(t[0]):null;if(!n)return null;let r=ah(n[2]),i=1===r.lists.length?aN(r.lists[0]):null,s=i?.words[0]==="gh"?lm(i.words):[];if(1!==s.length||"run"!==s[0][0]||"list"!==s[0][1])return null;let a=lf(s[0],["-c","--commit"]),l=lf(s[0],["-w","--workflow"])?.toLowerCase();return a&&lu.test(a)&&l&&Object.hasOwn(lc,l)?{name:n[1],sha:a.toLowerCase()}:null}(n[r]):null;return i&&function(e,t){if(e.background||1!==e.pipelines.length)return!1;let[n]=e.pipelines,[r,i,...s]=n.commands;if(n.negated||!i||s.length>1||"gh"!==r.words[0])return!1;let a=lm(r.words);if(1!==a.length||"run"!==a[0][0]||"view"!==a[0][1]||!a[0].includes("--log"))return!1;let l=lx(a[0]);if(lC(l)!==t)return!1;for(let e=2;e<a[0].length;e+=1){let t=a[0][e];if("-R"===t||"--repo"===t)e+=1;else if(t!==l&&"--log"!==t&&!t.startsWith("--repo=")&&!/^2>/.test(t))return!1}let[o,...c]=i.words,d=c.filter(e=>e.startsWith("-")),u=c.filter(e=>!e.startsWith("-"));if("grep"!==o||!d.every(e=>/^-[oFas]+$/.test(e))||!d.some(e=>e.includes("o"))||1!==u.length||u[0]!==lS)return!1;let[h]=s;return!h||("head"===h.words[0]||"tail"===h.words[0])&&h.words.slice(1).every(e=>/^(?:-n?\d*|\d+)$/.test(e))}(n[n.length-1],i.name)&&n.slice(r+1,-1).flatMap(e=>e.pipelines.flatMap(({commands:e})=>e)).every(({words:e})=>(function(e,t){let[n,...r]=e;if("["===n||"[["===n||"test"===n||"exit"===n||"true"===n||":"===n||"sleep"===n)return!0;if("echo"===n||"printf"===n)return r.every(e=>!/`|\$\(/.test(e)&&!/public|tree|already|matches|nothing|publish/i.test(e)&&[...e.matchAll(/\$\{?([A-Za-z_]\w*|[?])/g)].every(e=>e[1]===t||"?"===e[1]));if("gh"!==n)return!1;let i=lm(e);return 1===i.length&&"run"===i[0][0]&&"watch"===i[0][1]&&lC(lx(i[0]))===t})(e,i.name))&&lh(t).split("\n").some(e=>e.trim()===lS)?i.sha:null}(i,n);a&&e.nothingToPublish.push({sha:a,order:r})}(f,e,s,t),Array.isArray(r=function(e,t,n,r){if(!e.input||"object"!=typeof e.input||Array.isArray(e.input)||"string"!=typeof e.toolName)return null;let i=a1(t);if("notRun"===i)return null;let s={toolCallId:e.toolCallId,attempt:0},a=n&&!i?"running":"unobserved",l=aW(e);if(null!==l){var o;let n,i,c=(o=t,(i=(n=o?.details)&&"object"==typeof n&&"backgroundJob"in n?n.backgroundJob:null)&&"object"==typeof i&&"jobId"in i&&"after"in i&&"string"==typeof i.jobId&&"string"==typeof i.after?{jobId:i.jobId,after:i.after}:null);return aU(l,t).map(n=>{var i,o,d,u;let h,p;if("commit"===n.stage){let e,r,o=t?"unobserved"===n.state&&function(e,t){if(t.isError)return!1;let{commands:n}=ah(e),r=lh(t),i=e=>n.some(({words:t})=>aF(t,0,e));return(!i("commit")||aX.test(r))&&(!i("push")||a0.test(r))}(l,t)?"done":aZ[n.state]:a;return{...s,stage:"commit",..."done"===o?(e=(i=t)?lh(i):"",(r=aX.exec(e))?{commit:r[1],title:r[2].trim()}:{commit:a0.exec(e)?.[1]??null}):{commit:null},docsOnly:!1,outcome:o}}let m=n.evidence??(c&&null!==n.exitCode?`Command exited with code ${n.exitCode}`:void 0),f=m&&c?`${c.jobId} \xb7 ${m}`:m,g="ci"===n.stage&&"failed"===n.state&&t?function(e,t){let n=ah(e).commands.flatMap(({words:e})=>lm(e)),r=n.find(e=>"run"===e[0]&&"watch"===e[1]&&e.includes("--exit-status")),i=r?lx(r):null;if(null===i||!n.some(e=>"run"===e[0]&&"view"===e[1]&&e.includes("--json")&&lx(e)===i))return null;let s=lp(lh(t)).filter(e=>"completed"===e.status&&"string"==typeof e.conclusion),a=1===s.length?s[0].conclusion:null;return"string"!=typeof a||""===a||"success"===a||Object.hasOwn(lR,a)?null:a}(l,t):null,x=g?"unverified":t?n.state:a,v="check"===n.stage&&x===n.state?n.reason:void 0;return{...s,stage:n.stage,command:l,..."check"===n.stage?{cwd:(o=e.input,d=r,u=e.toolCallId,h=d?tx(d)??d:void 0,(p="string"==typeof o.cwd?o.cwd:"")?tx(p,h)??(h?tx(`${h.replace(/\/+$/,"")}/${p}`):null)??`?${u}`:h??"")}:{},exitCode:n.exitCode,labels:n.labels,outcome:x,...n.compound?{compound:n.compound}:{},...f?{evidence:g?`${f} \xb7 ${g}`:f}:{},...g?{otherRun:{kind:"unjudged",conclusion:g}}:{},...v?{reason:v}:{}}})}let c=e.toolName.toLowerCase().split(/[.:/]/).pop()??"",d=i?void 0:t,u=d?.details&&"object"==typeof d.details?d.details:{};if("cross_review"===c){let t="resolve"===e.input.action?"resolve":"review";if(!d||d.isError)return{...s,stage:"review",action:t,findings:null,outcome:d?"failed":a};if("resolve"===t){if(!0===u.pass)return{...s,stage:"review",action:t,findings:0,outcome:"passed"};let e=Array.isArray(u.open)?u.open.length:null;return{...s,stage:"review",action:t,findings:e,outcome:!1===u.pass?"failed":"unobserved"}}let n=Array.isArray(u.findings)?u.findings.length:null;if(null!==n&&n>0)return{...s,stage:"review",action:t,findings:n,outcome:"failed"};let r=Array.isArray(u.reviewers)?u.reviewers:[];return!1===u.passable||r.some(e=>!e||"object"!=typeof e||!("status"in e)||"ok"!==e.status)?{...s,stage:"review",action:t,findings:n,outcome:"unverified",unusable:!0}:{...s,stage:"review",action:t,findings:n,outcome:null===n?"unobserved":"done"}}if("git_finalize"===c){let t="string"==typeof e.input.message?aQ(e.input.message):void 0,n=t?{title:t}:{};if(!d)return{...s,stage:"commit",commit:null,docsOnly:!1,...n,outcome:a};let r=a3(d,u),i=d.isError||!1===u.ok,l=!i&&(!0===u.ok||null!==r),o=e.input.files,c=l&&Array.isArray(o)&&o.length>0&&o.every(e=>"string"==typeof e&&aK(e));return{...s,stage:"commit",commit:l?r:null,docsOnly:c,...n,outcome:l?"done":i?"failed":"unobserved"}}if("git_integrate"===c){if("abort"===e.input.action||"up-to-date"===u.stage)return null;if(!d)return{...s,stage:"commit",commit:null,docsOnly:!1,outcome:a};let t=a3(d,u),n=d.isError||!1===u.ok,r=!n&&null!==t,i=u.files,l=r&&Array.isArray(i)&&i.length>0&&i.every(e=>"string"==typeof e&&aK(e));return{...s,stage:"commit",commit:r?t:null,docsOnly:l,outcome:r?"done":n?"failed":"unobserved"}}if("eval"===c)return function(e,t,n){let r=function(e){if("string"==typeof e.code)return e.code;let t=e.cells;return Array.isArray(t)?t.map(e=>e&&"object"==typeof e&&"code"in e&&"string"==typeof e.code?e.code:"").join("\n"):""}(e.input);if(!a2.test(r))return null;let i=a6.exec(r)?.[2],s=void 0===i?void 0:aQ(i.replace(/\\n/g,"\n").replace(/\\(["'`\\])/g,"$1")),a={toolCallId:e.toolCallId,attempt:0,stage:"commit",docsOnly:!1,...s?{title:s}:{}};if(!t)return{...a,commit:null,outcome:n};let l=lh(t),o=a8.exec(l),c=o?(o[1]??o[2]).toLowerCase():null;if(!c&&a5.test(l))return null;let d=a4.test(l);return c&&!d?{...a,commit:c,outcome:"done"}:{...a,commit:null,outcome:!c&&(d||t.isError)?"failed":"unobserved"}}(e,d,a);if(function(e,t){if("task"===t||Object.hasOwn(aJ,t))return!0;if("lsp"===t)return"string"==typeof e.input.action&&Object.hasOwn(aY,e.input.action);if(!tv(e.toolName)&&!ty(e.toolName))return!1;let n=e.input.file_path??e.input.path;return"string"!=typeof n||/^[a-zA-Z]:[\\/]/.test(n)||!/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//.test(n)}(e,c))return!i&&t?.isError?null:(tv(e.toolName)||ty(e.toolName))&&tS(e.input,d,r)?{...s,stage:"investigate",outcome:i?"unobserved":t||!n?"done":"running"}:{...s,stage:"edit",outcome:d?"done":a,..."task"===c?{dispatch:!0}:{},...!function(e,t,n){if(!t||!(tv(e.toolName)||ty(e.toolName)))return!1;let r=tj(e.input,t);return r.length>0&&r.every(e=>(function(e,t){if(e.split(/[\\/]/).includes(".."))return!1;let n=t?tx(t)??t:void 0,r=tD(tx(e,t)??e,n);if(/^[\\/]/.test(r)||/^[a-zA-Z]:[\\/]/.test(r))return!1;let i=r.split(/[\\/]/).filter(e=>""!==e&&"."!==e);return"HANDOFF.md"===i.at(-1)||"doc"===i[0]&&"history"===i[1]&&i.length>2})(e,n))}(e,d,r)?{}:{recordOnly:!0}};return Object.hasOwn(aG,c)?{...s,stage:"investigate",outcome:i?"unobserved":t||!n?"done":"running"}:null}(e,s,n,i))?r:r?[r]:[])){let n=s?void 0:x.get(e.toolCallId);"check"===a.stage&&"noResult"===a.reason&&n&&a9(n)&&(a.reason="noCompletion"),y.push({step:a,order:t})}}),a=null,l=!1,y.forEach((e,t)=>{let{step:n,order:r}=e;if("commit"===n.stage&&"done"===n.outcome&&n.commit&&(a={step:{...n,commit:n.commit},order:r},l=!1),"edit"!==n.stage||"done"!==n.outcome||n.dispatch||n.recordOnly||(l=!0),"ci"!==n.stage||!a)return;let i=a,s=ah(n.command).commands.flatMap(({words:e})=>lm(e)).find(e=>"run"===e[0]&&"watch"===e[1]);if(s){let e,a=lv(s),o=e=>(f.publishRuns.get(e)?.order??1/0)<=r;if((e=lT(n.command,o).filter(({args:e})=>"run"===e[0]&&"watch"===e[1])).length>0&&e.every(({publish:e})=>e)){lI(n.command,o)||"passed"!==n.outcome&&"failed"!==n.outcome||(a&&"passed"===n.outcome&&f.watched.push({id:a,order:r}),y[t]={order:r,step:{...n,outcome:"unverified",evidence:void 0,otherRun:{kind:"publish",outcome:n.outcome}}});return}let c=a?f.runs.filter(e=>e.id===a):[],d=c.find(e=>null!==e.sha)?.sha;if(!d||c.some(e=>lE(e,i,f))){d&&l&&"passed"===n.outcome&&(y[t]={order:r,step:{...n,stale:!0}});return}if("passed"===n.outcome||"failed"===n.outcome){let e=d.slice(0,7);y[t]={order:r,step:{...n,outcome:"unverified",evidence:`run ${a} \xb7 ${e}`,otherRun:{kind:"commit",sha:e,outcome:n.outcome}}}}return}if("unverified"!==n.outcome)return;let o=f.runs.find(e=>e.order===r&&null!==e.workflow&&Object.hasOwn(ld,e.workflow)&&lE(e,i,f));if(!o||"completed"!==o.status||"string"!=typeof o.conclusion)return;let c="success"===o.conclusion?"passed":Object.hasOwn(lR,o.conclusion)?"failed":null;c&&(y[t]={order:r,step:{...n,outcome:c,evidence:`run ${o.id??"?"} \xb7 ${o.status} ${o.conclusion}`,..."passed"===c&&l?{stale:!0}:{}}})}),y.forEach((e,t)=>{let{step:n,order:r}=e;if("deploy"!==n.stage||"unverified"!==n.outcome&&"unobserved"!==n.outcome)return;let i=function(e){let t=[],n=(e,r)=>{let i=ay(e);if(null!==i){if(r<3)for(let e of ah(i).commands)n(e.words,r+1);return}if(!aS(e))return;let s=ak(e),a=aj.test(e[s])?s:e.findIndex((e,t)=>t>s&&!e.startsWith("-")),l=e[a+1];t.push(void 0!==l&&/^[0-9a-f]{7,40}$/i.test(l)?l.toLowerCase():null)};for(let{words:t}of ah(e).commands)n(t,0);return 1===t.length?t[0]:null}(n.command),s=x.get(n.toolCallId);if("number"!=typeof s?.timestamp)return;let a=s.details,l=a&&"object"==typeof a&&"wallTimeMs"in a&&"number"==typeof a.wallTimeMs?a.wallTimeMs:0,o=1e3*Math.floor((s.timestamp-l)/1e3);for(let e=r;e<g.length;e+=1){let s=g[e],a=s?.type==="toolCall"?v.get(s.toolCallId):void 0;if(a)for(let e of lh(a).split("\n")){let s=e.trim().replace(/^\d+[:-](?=\d{4}-\d\d-\d\dT)/,"");if(null===i){let e=lP.exec(s);e&&Date.parse(e[1])>=o&&(i=e[2]);continue}let a=l$.exec(s);if(a&&Date.parse(a[1])>=o&&lM(a[2],i)){y[t]={order:r,step:{...n,outcome:"passed",evidence:`${a[1]} READY ${a[2].slice(0,12)}`}};return}let l=lL.exec(s);if(l&&Date.parse(l[1])>=o){y[t]={order:r,step:{...n,outcome:"failed",evidence:s.length>120?`${s.slice(0,119)}…`:s}};return}}}});let b=(e,t)=>null!==e&&(f.publishRuns.get(e)?.order??1/0)<=t;for(let{step:e,order:t}of y){let n=e;if("ci"===n.stage){let e=ah(n.command).commands.flatMap(({words:e})=>lm(e)).find(e=>"run"===e[0]&&"watch"===e[1]),r=e?lv(e):null;r&&"passed"===n.outcome&&f.watched.push({id:r,order:t}),!n.compound&&lI(n.command,e=>b(e,t))&&(n={toolCallId:n.toolCallId,attempt:n.attempt,stage:"investigate",outcome:"passed"===n.outcome||"unverified"===n.outcome?"done":n.outcome})}if("edit"!==n.stage||"done"!==n.outcome||n.dispatch){if("check"===n.stage||"review"===n.stage||"ci"===n.stage){let e="check"===n.stage?`check:${lr(n)}`:n.stage,t=u.get(e);(t?.outcome!=="failed"||lt(n.outcome))&&u.set(e,{stage:n.stage,outcome:n.outcome,order:o.length})}}else{let e=ln(u);e&&(c.push({from:e,attempt:d}),d+=1),u=new Map,h=o.length,n.recordOnly||(p=o.length)}n.attempt=d,m.set(n,t),o.push(n)}let w=!1;o.forEach((e,t)=>{t<("commit"===e.stage||w&&("ci"===e.stage||"deploy"===e.stage)?p:h)&&"investigate"!==e.stage&&"edit"!==e.stage&&("passed"===e.outcome||"done"===e.outcome)&&(e.stale=!0),"commit"===e.stage&&"done"===e.outcome&&(w=!0)});let k=o.filter(e=>"commit"===e.stage&&"done"===e.outcome&&e.attempt===d).at(-1),j=k?m.get(k)??-1:-1,S=k&&!k.stale&&k.commit&&lu.test(k.commit)?{sha:k.commit.toLowerCase(),order:j}:null,C=S?function(e,t,n){let r=e.watched.find(({id:n,order:r})=>{let i=e.publishRuns.get(n);return r>t.order&&i?.sha===t.sha&&i.order>t.order&&i.order<=r});if(!r)return null;let i=new Map;for(let t of e.heads)t.order>r.order&&i.set(`${t.repo}#${t.ref}`,t);let s=[...n,...e.ciHeads.filter(e=>e.order<t.order)];for(let e of i.values())if(null!==e.sha&&e.sha!==t.sha&&s.some(t=>t.repo===e.repo&&t.sha===e.sha&&t.branch===e.ref))return{kind:"publicHeadUnchanged",repo:e.repo,ref:e.ref,sha:e.sha,runId:r.id};return null}(f,S,r)??(f.nothingToPublish.some(({sha:e,order:t})=>e===S.sha&&t>S.order)?{kind:"nothingToPublish",commit:S.sha}:null):null;if(C?.kind==="nothingToPublish"){let e=C.commit;o.forEach((t,n)=>{var r;let i,s=m.get(t)??-1;if("ci"!==t.stage||"unverified"!==t.outcome||s<=j||!f.nothingToPublish.some(t=>t.order===s&&t.sha===e)&&(r=t.command,!((i=ah(r).commands.flatMap(({words:e})=>lm(e))).length>0&&i.every(t=>"run"===t[0]&&"list"===t[1]&&lf(t,["-c","--commit"])?.toLowerCase()===e))))return;let a={toolCallId:t.toolCallId,attempt:t.attempt,stage:"investigate",outcome:"done"};o[n]=a,m.set(a,s)})}let N=ao.map(e=>{let t=o.filter(t=>t.stage===e),n="investigate"===e?t:t.filter(e=>e.attempt===d);return{stage:e,status:function(e,t){if(0===t.length)return"waiting";if("check"!==e){let e=new Set,n=null;for(let r of t){let t=r.stale?"stale":r.outcome;if("failed"!==n||lt(r.outcome)){if(null!==n&&!("ci"!==r.stage||ll(t))&&!ah(r.command).commands.some(({words:e})=>lm(e).some(e=>"run"===e[0]&&"watch"===e[1]&&e.includes("--exit-status")))){let t="stale"===n&&(lo(r)?.every(t=>e.has(t))??!1);if(ll(n)||t)continue}if(n=t,"stale"===t||"passed"===r.outcome||"failed"===r.outcome)for(let t of lo(r)??[])e.add(t)}}return n??"waiting"}let n="done";for(let e of li(t)){let t=e.stale?"stale":e.outcome;la[t]>la[n]&&(n=t)}return n}(e,n),steps:n,earlier:"investigate"===e?[]:t.filter(e=>e.attempt<d)}}),T=N[ao.indexOf("deploy")],I=o.some(e=>"commit"===e.stage&&"done"===e.outcome&&!e.docsOnly);!k?.docsOnly||k.stale||I||"waiting"!==T.status||(T.status="notNeeded");let M=N[ao.indexOf("ci")],E=M.steps.some(e=>(m.get(e)??1/0)>j);C&&("waiting"===M.status||("unverified"===M.status||"stale"===M.status)&&!E)?M.status="notNeeded":C=null;let R=-1;N.forEach((e,t)=>{"waiting"!==e.status&&"failed"!==e.status&&"skipped"!==e.status&&"notNeeded"!==e.status&&"stale"!==e.status&&e.steps.some(e=>!e.stale&&"failed"!==e.outcome&&!ls(e))&&(R=t)});let $=null;if(n&&o.length>0)if(ln(u))$={stage:"edit",returning:!0};else if(R<0)$={stage:N.find(e=>"waiting"!==e.status)?.stage??ao[0],returning:!1};else{let e=N[R].steps.at(-1);if(e?.stage==="review"&&e.unusable)$={stage:"review",returning:!1};else{let e=N.slice(R+1).find(e=>"skipped"!==e.status&&"notNeeded"!==e.status);$=e?{stage:e.stage,returning:!1}:null}}if(N.forEach((e,t)=>{t<R&&"waiting"===e.status&&(e.status="skipped")}),!n&&o.length>0){let e=!I;for(let t of N)"waiting"===t.status&&(t.status=e&&("ci"===t.stage||"deploy"===t.stage)?"notNeeded":"skipped")}return{steps:o,attempt:d,loops:c,stages:N,current:function(e,t,n){let r=e.at(-1);if(!r)return null;if(!n||n.stale)return r.stage;let i=t.filter(e=>("commit"===e.stage||"ci"===e.stage||"deploy"===e.stage)&&e.steps.length>0&&"notNeeded"!==e.status&&"skipped"!==e.status),s=i.find(e=>"commit"!==e.stage&&Object.hasOwn(l_,e.status));return s?.stage??i.at(-1)?.stage??r.stage}(o,N,k),reached:R<0?null:ao[R],next:$,publication:C}}let l_={running:!0,unobserved:!0,unverified:!0,failed:!0,stale:!0},lF="끊기기 전에 바깥에 영향을 주는 행동(커밋\xb7push, `git_finalize`\xb7`git_integrate`, 배포\xb7`update.sh`, CI 재실행, 이슈\xb7PR 댓글, 메시지 전송)을 하던 중이었다면 다시 하기 전에 그 결과가 이미 반영됐는지 `git log`\xb7`git status`\xb7원격 브랜치, `gh run list`, 배포 로그, 해당 페이지로 먼저 확인하고, 반영됐으면 되풀이하지 않는다. ",lO="[자동 재개] CUELO 업데이트\xb7재시작 때문에 이 세션의 진행 중 작업이 중단(abort)됐다. 서버가 새 버전으로 다시 떴다. 중단 직전에 돌던 명령\xb7도구 결과는 사라졌을 수 있으니 파일\xb7프로세스 상태를 먼저 확인하고, 하던 작업을 이어서 진행한다. "+lF+"그때 돌던 SubAgent(task child)도 멈췄지만 기록은 남아 있다. 결과를 받지 못한 child에는 먼저 `write agent://<id>`로 이어서 하라고 보내 되살리고, 되살아나지 않으면(isolated 작업 공간 등) 남은 파일 상태를 확인한 뒤 새로 맡긴다.",lz="[자동 재개] CUELO 서버가 예기치 않게 종료돼 이 세션의 진행 중 작업이 중간에 끊겼다. 서버가 다시 떴다. 끊기기 직전에 돌던 명령\xb7도구 결과는 사라졌을 수 있다. 그 명령을 그대로 다시 실행하지 말고, 파일\xb7프로세스 상태를 먼저 확인한 뒤 하던 작업을 이어서 진행한다. "+lF+"그때 돌던 SubAgent(task child)도 멈췄지만 기록은 남아 있다. 결과를 받지 못한 child에는 먼저 `write agent://<id>`로 이어서 하라고 보내 되살리고, 되살아나지 않으면 남은 파일 상태를 확인한 뒤 새로 맡긴다.",lD="[자동 재개] CUELO 업데이트의 세션 정지 단계가 이 세션의 진행 중 작업을 중단(abort)했지만, 업데이트가 실패해 기존 서버가 그대로 돌고 있다(새 버전으로 바뀌지 않았다). 중단 직전에 돌던 명령\xb7도구 결과는 사라졌을 수 있으니 파일\xb7프로세스 상태를 먼저 확인하고, 하던 작업을 이어서 진행한다. "+lF+"그때 돌던 SubAgent(task child)도 멈췄지만 기록은 남아 있다. 결과를 받지 못한 child에는 먼저 `write agent://<id>`로 이어서 하라고 보내 되살리고, 되살아나지 않으면(isolated 작업 공간 등) 남은 파일 상태를 확인한 뒤 새로 맡긴다.",lW=new Set(["[자동 재개] CUELO 업데이트\xb7재시작 때문에 이 세션의 진행 중 작업이 중단(abort)됐다. 서버가 새 버전으로 다시 떴다. 중단 직전에 돌던 명령\xb7도구 결과는 사라졌을 수 있으니 파일\xb7프로세스 상태를 먼저 확인하고, 하던 작업을 이어서 진행한다. 그때 돌던 SubAgent(task child)도 멈췄지만 기록은 남아 있다. 결과를 받지 못한 child에는 먼저 `write agent://<id>`로 이어서 하라고 보내 되살리고, 되살아나지 않으면(isolated 작업 공간 등) 남은 파일 상태를 확인한 뒤 새로 맡긴다.","[자동 재개] CUELO 서버가 예기치 않게 종료돼 이 세션의 진행 중 작업이 중간에 끊겼다. 서버가 다시 떴다. 끊기기 직전에 돌던 명령\xb7도구 결과는 사라졌을 수 있다. 그 명령을 그대로 다시 실행하지 말고, 파일\xb7프로세스 상태를 먼저 확인한 뒤 하던 작업을 이어서 진행한다. 그때 돌던 SubAgent(task child)도 멈췄지만 기록은 남아 있다. 결과를 받지 못한 child에는 먼저 `write agent://<id>`로 이어서 하라고 보내 되살리고, 되살아나지 않으면 남은 파일 상태를 확인한 뒤 새로 맡긴다.","[자동 재개] CUELO 업데이트의 세션 정지 단계가 이 세션의 진행 중 작업을 중단(abort)했지만, 업데이트가 실패해 기존 서버가 그대로 돌고 있다(새 버전으로 바뀌지 않았다). 중단 직전에 돌던 명령\xb7도구 결과는 사라졌을 수 있으니 파일\xb7프로세스 상태를 먼저 확인하고, 하던 작업을 이어서 진행한다. 그때 돌던 SubAgent(task child)도 멈췄지만 기록은 남아 있다. 결과를 받지 못한 child에는 먼저 `write agent://<id>`로 이어서 하라고 보내 되살리고, 되살아나지 않으면(isolated 작업 공간 등) 남은 파일 상태를 확인한 뒤 새로 맡긴다."]),lH={sending:!0,accepted:!0,delivered:!1,unconfirmed:!1,failed:!1};function lU(e){return e.trim()}function lB(e){return lU(e.text)||(e.images>0?"[Image]":"")}function lq(e){let t=e.filter(e=>!lH[e.stage]);if(t.length<=4)return e;let n=new Set(t.slice(0,t.length-4).map(e=>e.id));return e.filter(e=>!n.has(e.id))}function lV(e,t){switch(t.type){case"submit":return lq([...e,{id:t.id,kind:t.kind,text:t.text,images:t.images??0,stage:"sending",inQueue:!1}]);case"ack":return e.map(e=>e.id===t.id&&"sending"===e.stage?{...e,stage:"accepted"}:e);case"fail":return lq(e.map(e=>e.id===t.id&&lH[e.stage]?{...e,stage:"failed",inQueue:!1}:e));case"queue":return function(e,t,n){let r=new Map,i=(e,t)=>{let n=`${e}\u0000${lU(t)}`;r.set(n,(r.get(n)??0)+1)};for(let e of t)i("steer",e);for(let e of n)i("followUp",e);let s=!1,a=e.map(e=>{if(!lH[e.stage])return e;let t=`${e.kind}\u0000${lB(e)}`,n=r.get(t)??0;return n>0?(r.set(t,n-1),e.inQueue&&"accepted"===e.stage)?e:(s=!0,{...e,stage:"accepted",inQueue:!0}):e.inQueue?(s=!0,{...e,stage:"unconfirmed",inQueue:!1}):e});return s?a:e}(e,t.steering,t.followUp);case"user-message":{let n=lU(t.text);if(!n&&0===t.images)return e;let r=e.find(e=>(lH[e.stage]||"unconfirmed"===e.stage)&&e.kind===t.kind&&lU(e.text)===n&&e.images===t.images);if(!r)return e;return lq(e.map(e=>e===r?{...e,stage:"delivered",inQueue:!1}:e))}case"withdraw":{let n=e=>lH[e.stage]||"unconfirmed"===e.stage;if(void 0===t.text)return e.filter(e=>!n(e));let r=lU(t.text),i=e.find(e=>n(e)&&e.kind===t.kind&&(lU(e.text)===r||lB(e)===r));return i?e.filter(e=>e!==i):e}case"idle":{let t=e.filter(e=>e.inQueue);return t.length===e.length?e:t}case"reset":return 0===e.length?e:[]}}function lK(e){return"user"!==e.role?"":"string"==typeof e.content?e.content:e.content.filter(e=>"text"===e.type).map(e=>e.text).join("\n")}function lG(e){return"steering"in e&&!0===e.steering?"steer":"followUp"}function lJ(e){return e.flatMap(e=>e.tasks.flatMap(t=>"completed"===t.status||"abandoned"===t.status?[]:[{phase:e.name,content:t.content,status:t.status,blocker:t.blocker??null}]))}function lY(e,t,n){let r=[],i=[],s=null;for(let n of e){if("toolCall"!==n.type)continue;if("task"===n.toolName){i.push(n);continue}if(tL(n.toolName)){let e=t$(n,t.get(n.toolCallId));"authoritative"===e.kind&&(s=e.phases);continue}let e=aB(n,t.get(n.toolCallId));e&&r.push(e)}return{checks:r,dispatchCalls:i,files:tM(e,t,n),remaining:s?lJ(s):null}}function lZ(e,t,n){let r=[];for(let i=Math.max(0,t);i<Math.min(e.length,n);i++){let t=e[i];"assistant"===t.role&&r.push(...t.content??[])}return r}function lQ(e,t,n){let r=[],i=null;for(let s=Math.max(0,t);s<Math.min(e.length,n);s++){let t=e[s];if("assistant"===t.role)for(let e of t.content??[])"toolCall"===e.type&&(i=e.toolCallId);else if("custom"===t.role&&"async-result"===t.customType){let e="string"==typeof t.content?t.content:t.content.map(e=>"text"===e.type?e.text:"").join("\n");r.push({text:e,after:i})}}return r}function lX(e,t){var n;let r=t;for(;r>=0&&(n=e[r],n?.role==="custom"?"compaction"===n.customType:n?.role==="user"&&("steer"===lG(n)||function(e){if(e===lO||e===lz||e===lD||lW.has(e))return!0;let[t,n]=e.split("\n",2);return("[하네스 통지] 이 세션이 시작한 CUELO 업데이트가 끝나 런타임이 새 버전으로 교체됐고, 이 세션이 그 위에서 재개됐습니다."===t||"[하네스 통지] 이 세션이 시작한 CUELO 업데이트가 실패했습니다."===t)&&void 0!==n&&n.startsWith("requestId=")}(lK(n))));){let t=r-1;for(;t>=0&&"user"!==e[t].role;)t-=1;r=t}return r}function l0(e,t,n,r){let i=Math.min(e.length,r),s=new Map;for(let t=Math.max(0,n);t<i;t++){let n=e[t];"toolResult"===n.role&&s.set(n.toolCallId,t)}let a=[];for(let r=Math.max(0,n-1);r<i;r++){let i=e[r];if(r>=n&&"assistant"===i.role)for(let e of i.content??[]){if("toolCall"!==e.type||!tL(e.toolName))continue;let n=t$(e,t.get(e.toolCallId));"authoritative"===n.kind&&a.push({at:s.get(e.toolCallId)??r,phases:n.phases})}for(let e of i.trackerTodos??[]){let t=tR(e);t&&a.push({at:r+.5,phases:t})}}let l=null;for(let e of a)(!l||e.at>=l.at)&&(l=e);return l?l.phases:null}function l1(e,t,n,r=0,i=[]){for(let s=Math.max(0,r);s<Math.min(e.length,n);s++){let n=e[s];if("assistant"===n.role)for(let e of n.content??[])"toolCall"===e.type&&i.push(...lj(e,t.get(e.toolCallId)))}return i}function l2(e,t,n){let r=null,i=null;for(let s=Math.max(0,t-1);s<Math.min(e.length,n);s++){let t=e[s];for(let e of[t.timestamp,"assistant"===t.role?t.completedAt:void 0])"number"==typeof e&&Number.isFinite(e)&&((null===r||e<r)&&(r=e),(null===i||e>i)&&(i=e))}return{startedAt:r,endedAt:i}}function l8(e,t){if(0===e.length)return null;let n=[...e].sort((e,t)=>e-t),r=(n.length-1)*t,i=Math.floor(r),s=Math.ceil(r);return n[i]+(n[s]-n[i])*(r-i)}let l4=["investigate","implement","verify","report"],l5={edit:!0,write:!0,ast_edit:!0,multiedit:!0,notebookedit:!0},l6={bash:!0,eval:!0};function l3(e){let t=[],n=new Map;for(let r of e)if("toolResult"===r.role&&n.set(r.toolCallId,r),"assistant"===r.role&&Array.isArray(r.content))for(let e of r.content)"toolCall"===e.type&&t.push(e);return{blocks:t,results:n}}function l7(e,t,n,r){return!0===l5[t]&&!tS(e.input,n.get(e.toolCallId),r)}function l9(e){return(e.toolName??"").toLowerCase().split(/[.:/]/).pop()??""}function oe(e){return"yield"===l9(e)&&!Array.isArray(e.input?.type)}function ot(e,t){if(0===e.length)return null;let{blocks:n,results:r}=l3(e),i=-1;n.forEach((e,t)=>{oe(e)&&(i=t)});let s=i>=0&&i===n.length-1,a=s?n.findLastIndex((e,t)=>t<i&&oe(e))+1:i+1,l={calls:{investigate:0,implement:0,verify:0,report:0},phase:"investigate",ended:s,reedits:0,checks:{passed:0,failed:0,unknown:0},verifiedAfterEdit:!1},o=!1;for(let e of n.slice(a)){let n=l9(e);if(l7(e,n,r,t))"verify"===l.phase&&(l.reedits+=1),o=!0,l.phase="implement",l.verifiedAfterEdit=!1;else if(l6[n]){if(l.phase=o?"verify":"investigate",o){l.verifiedAfterEdit=!0;let t=aB(e,r.get(e.toolCallId));t?.state==="passed"?l.checks.passed+=1:t?.state==="failed"?l.checks.failed+=1:t&&(l.checks.unknown+=1)}}else"yield"===n&&(l.phase="report",o=!1);l.calls[l.phase]+=1}return l}function on(e,t){if(!e)return{run:null,stations:l4.map(e=>({phase:e,state:"unobserved",calls:0}))};let n=t&&e.ended?{calls:{investigate:0,implement:0,verify:0,report:0},phase:"investigate",ended:!1,reedits:0,checks:{passed:0,failed:0,unknown:0},verifiedAfterEdit:!1}:e,r=t?l4.indexOf(n.phase):l4.findLastIndex(e=>n.calls[e]>0),i=l4.map((e,i)=>{let s,a=n.calls[e];return s=t&&e===n.phase?"active":a>0?"verify"!==e||n.verifiedAfterEdit?"done":"stale":i<r?"skipped":t?"waiting":"none",{phase:e,state:s,calls:a}});return{run:n,stations:i}}function or(e){if(e<6e4)return null;let t=Math.round(e/6e4);return{hours:Math.floor(t/60),minutes:t%60}}function oi(e){if("assistant"!==e.role)return e;let t=e.content;if(!Array.isArray(t))return e;let n=t.map(e=>("object"!=typeof e||null===e||Array.isArray(e)||"toolCall"!==e.type?null:{type:"toolCall",toolCallId:"string"==typeof e.toolCallId?e.toolCallId:"string"==typeof e.id?e.id:"",toolName:"string"==typeof e.toolName?e.toolName:"string"==typeof e.name?e.name:"",input:"object"!=typeof e.input||null===e.input||Array.isArray(e.input)?"object"!=typeof e.arguments||null===e.arguments||Array.isArray(e.arguments)?{}:e.arguments:e.input})??e);return{...e,content:n}}function os(e){return"pending"===e||"running"===e}let oa=new Map;function ol(e){return`${e.liveId??""}|${e.status??""}|${e.archiveName??""}`}function oo(e){return e instanceof sq&&("live-unreachable"===e.kind||"sidecar-unreachable"===e.kind)?{kind:"unreachable",message:e.message}:{kind:"error",message:e instanceof Error?e.message:String(e)}}function oc(e,{sessionId:t,client:n,enabled:r}){let[s,a]=(0,i.useState)(oa),l=(0,i.useRef)(new Map),o=(0,i.useRef)(e);o.current=e;let c=(0,i.useCallback)(()=>{let e=l.current;a(t=>{let n=!1,r=new Map;for(let[i,s]of e){let e=t.get(i),a=e&&e.entries===s.collected&&e.state===s.state?e:{state:s.state,entries:s.collected};a!==e&&(n=!0),r.set(i,a)}return r.size!==t.size&&(n=!0),n?r:t})},[]),d=e.map(e=>`${e.key}|${ol(e)}`).join("\n");return(0,i.useEffect)(()=>{if(!r)return;let e=!1,i=!1,s=null,a=l.current,d=new Set(o.current.map(e=>e.key));for(let e of[...a.keys()])d.has(e)||a.delete(e);for(let e of o.current){let t=ol(e);a.get(e.key)?.signature!==t&&a.set(e.key,{signature:t,nextByte:0,collected:[],state:{kind:"loading"}})}c();let u=async(r,i,s,a)=>{if(!r.archiveName){i.state={kind:"empty",source:"live",note:a};return}try{let l=await n.getArchiveTranscript(t,r.archiveName,400,s);if(e)return;0===i.collected.length&&(i.collected=l.entries.flatMap((e,t)=>{let n=`archive:${t}`;return e.message&&"assistant"===e.message.role?[{id:n,message:e.message}]:e.irc?[{id:n,irc:{from:e.irc.from||void 0,message:e.irc.message||void 0,truncated:!0===e.irc.truncated}}]:[]})),i.state=0===l.entries.length?{kind:"empty",source:"archive",note:a}:{kind:"ready-archive",entries:l.entries,truncated:l.truncated,note:a}}catch(n){if(e||s.aborted)return;let t=oo(n);i.state="unreachable"===t.kind?{kind:"unreachable",message:t.message}:{kind:"error",message:t.message}}},h=async(r,i)=>{let s=a.get(r.key);if(s){if(!r.liveId)return void await u(r,s,i);try{var l,o;let a=await n.getLiveTranscript(t,r.liveId,s.nextByte,i);if(e)return;let c=(l=a.entries,o=a.fromByte,l.flatMap((e,t)=>{let n=e.id??`${o}:${t}`;if("message"===e.type&&e.message)return[{id:n,message:oi(e.message)}];if("custom_message"===e.type&&"irc:incoming"===e.customType){let t=e.details;return!t||"object"!=typeof t||Array.isArray(t)?[]:[{id:n,irc:{from:"string"==typeof t.from?t.from:void 0,message:"string"==typeof t.message?t.message:void 0}}]}return[]}));a.reset||0===a.fromByte?s.collected=c:c.length>0&&(s.collected=[...s.collected,...c]),s.nextByte=a.nextByte,s.collected.length>0?("ready-live"!==s.state.kind||s.state.entries!==s.collected)&&(s.state={kind:"ready-live",entries:s.collected}):await u(r,s,i)}catch(t){if(e||i.aborted)return;if(r.archiveName){let e=oo(t);await u(r,s,i,`실시간 기록을 읽지 못해 디스크 기록을 표시합니다: ${e.message}`)}else{let e=oo(t);s.state="unreachable"===e.kind?{kind:"unreachable",message:e.message}:{kind:"error",message:e.message}}}}},p=async()=>{if(e||i||"u">typeof document&&"visible"!==document.visibilityState)return;i=!0;let t=new AbortController;s=t;try{for(let e of o.current)await h(e,t.signal)}finally{i=!1}e||c()};p();let m=o.current.some(e=>os(e.status))?setInterval(()=>void p(),3e3):void 0,f=()=>{"visible"===document.visibilityState&&p()};return document.addEventListener("visibilitychange",f),()=>{e=!0,s?.abort(),clearInterval(m),document.removeEventListener("visibilitychange",f)}},[n,r,c,t,d]),s}let od="omp-web:flow-motion",ou=new Set,oh=null;function op(){if(null===oh)try{oh="paused"===window.localStorage.getItem(od)}catch{oh=!1}return oh}function om(e){return ou.add(e),()=>{ou.delete(e)}}function of(){return(0,i.useSyncExternalStore)(om,op,()=>!1)}function og({paused:e}){let{st:t}=iw();return(0,r.jsx)("button",{type:"button",className:"flow-graph-motion","aria-pressed":e,onClick:()=>(function(e){oh=e;try{e?window.localStorage.setItem(od,"paused"):window.localStorage.removeItem(od)}catch{}for(let e of ou)e()})(!e),children:t("graph.motion.pause")})}function ox(e,t,n){return n&&t.current===e.stage?"active":"waiting"===e.status?"deploy"===e.stage?"approval":"waiting":"skipped"===e.status||"notNeeded"===e.status?"skipped":"stale"===e.status?"stale":"done"===e.status||"passed"===e.status?"done":"failed"===e.status||"running"===e.status?e.status:"unverified"}function ov(e){return e.stale?"stale":e.outcome}let oy=(0,r.jsx)("svg",{className:"flow-chevron",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,r.jsx)("polyline",{points:"6 9 12 15 18 9"})});function ob({look:e}){return(0,r.jsxs)("span",{className:"flow-node","aria-hidden":"true",children:[("done"===e||"stale"===e)&&(0,r.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",strokeDasharray:"stale"===e?"3.5 2":void 0,children:(0,r.jsx)("polyline",{points:"5 12 10 17 19 7"})}),"unverified"===e&&(0,r.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",children:[(0,r.jsx)("line",{x1:"12",y1:"6",x2:"12",y2:"13"}),(0,r.jsx)("line",{x1:"12",y1:"18",x2:"12",y2:"18.5"})]}),"failed"===e&&(0,r.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",children:[(0,r.jsx)("line",{x1:"7",y1:"7",x2:"17",y2:"17"}),(0,r.jsx)("line",{x1:"17",y1:"7",x2:"7",y2:"17"})]}),"skipped"===e&&(0,r.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",children:(0,r.jsx)("line",{x1:"6",y1:"12",x2:"18",y2:"12"})})]})}function ow({outcome:e}){let t={className:"flow-check-icon",width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0};return"stale"===e?(0,r.jsxs)("svg",{...t,strokeWidth:2,children:[(0,r.jsx)("path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}),(0,r.jsx)("path",{d:"M3 3v5h5"}),(0,r.jsx)("path",{d:"M12 7v5l4 2"})]}):"passed"===e||"done"===e?(0,r.jsx)("svg",{...t,strokeWidth:2.5,children:(0,r.jsx)("polyline",{points:"5 12 10 17 19 7"})}):"failed"===e?(0,r.jsxs)("svg",{...t,strokeWidth:2.5,children:[(0,r.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"}),(0,r.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"})]}):"running"===e?(0,r.jsxs)("svg",{...t,strokeWidth:2,children:[(0,r.jsx)("path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0"}),(0,r.jsx)("path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0"}),(0,r.jsx)("path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7"}),(0,r.jsx)("path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8"}),(0,r.jsx)("path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69"}),(0,r.jsx)("path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8"}),(0,r.jsx)("path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69"}),(0,r.jsx)("path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7"})]}):(0,r.jsxs)("svg",{...t,strokeWidth:2,children:[(0,r.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,r.jsx)("line",{x1:"12",x2:"12",y1:"8",y2:"12"}),(0,r.jsx)("line",{x1:"12",x2:"12.01",y1:"16",y2:"16"})]})}function ok({step:e,st:t}){let n=t(`flow.state.${e.outcome}`);if(e.stale)n=t("passed"===e.outcome?"flow.state.stale":"flow.state.staleDone");else if("review"===e.stage&&"failed"===e.outcome&&null!==e.findings){let r=1===e.findings?"flow.state.findings.one":"flow.state.findings";n=t("resolve"===e.action?"flow.state.open":r,{count:e.findings})}else"review"===e.stage&&e.unusable?n=t("flow.state.reviewUnusable"):"review"===e.stage&&"done"===e.outcome&&(n=t("flow.state.noFindings"));return(0,r.jsxs)("span",{className:"flow-tone","data-tone":ov(e),children:[n,"commit"===e.stage&&e.commit&&(0,r.jsxs)(r.Fragment,{children:[" ",(0,r.jsxs)("span",{className:"flow-sha-tail",children:["\xb7\xa0",(0,r.jsx)("code",{className:"flow-sha",children:e.commit.slice(0,7)})]})]})]})}let oj={syntax:"flow.why.check.syntax",optional:"flow.why.check.optional",noExit:"flow.why.noExit",noResult:"flow.why.noResult",noCompletion:"flow.why.noCompletion",interrupted:"flow.why.interrupted"},oS={masked:"flow.next.rerun",syntax:"flow.next.rerun",optional:"flow.next.optional",compound:"flow.next.compound",noExit:"flow.next.again",noResult:"flow.next.again",noCompletion:"flow.next.again",interrupted:"flow.next.again"};function oC({step:e,label:t,st:n}){let i=ls(e),s=e.compound?.stages.map(e=>n(`flow.stage.${e}`)).join("\xb7")??"",a=e.otherRun,l=e.reason?oj[e.reason]:void 0,o=i?n("flow.why.compoundConfirmed",{stages:s}):a?.kind==="unjudged"?n("flow.why.watched.unjudged",{conclusion:a.conclusion}):a?n(`flow.why.watched.${a.outcome}`):n("flow.why.exitZero"),c=i?n("flow.why.compoundMissing"):l?n(l,{label:t}):"check"===e.stage?n("flow.why.check",{label:t}):a?.kind==="commit"?n("flow.why.ciOtherRun",{sha:a.sha}):a?.kind==="publish"?n("flow.why.ciPublishRun"):a?.kind==="unjudged"?n("flow.why.ciUnjudged",{conclusion:a.conclusion}):n(`flow.why.${e.stage}`),d=e.reason?n(oS[e.reason]):i?n("flow.next.compound"):null,u="unverified"===e.outcome||"unobserved"===e.outcome&&void 0!==e.reason,h=null!==e.exitCode?n("flow.exit",{code:e.exitCode}):n("failed"===e.outcome?"flow.exit.error":"running"===e.outcome?"flow.state.running":"flow.exit.none");return(0,r.jsxs)("div",{className:"flow-raw",children:[u&&(0,r.jsxs)("p",{className:"flow-why",children:["unverified"===e.outcome&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("b",{children:n("flow.why.confirmed")})," ",o,(0,r.jsx)("br",{})]}),(0,r.jsx)("b",{children:n("flow.why.missing")})," ",c,d&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("br",{}),(0,r.jsx)("b",{children:n("flow.why.next")})," ",d]})]}),e.stale&&(0,r.jsx)("p",{className:"flow-why",children:n("flow.why.stale")}),void 0===e.commandKey?(0,r.jsx)("code",{className:"flow-raw-command",children:e.command}):(0,r.jsx)("p",{className:"flow-why",children:n("flow.commandOmitted")}),(0,r.jsx)("div",{className:"flow-exit",children:h}),e.evidence&&(0,r.jsxs)("div",{className:"flow-exit",children:[n("flow.evidence")," ",(0,r.jsx)("code",{className:"flow-evidence",children:e.evidence})]})]})}function oN({steps:e,st:t,attempts:n=!1}){return(0,r.jsx)("ul",{className:"flow-checks",children:e.map(e=>{let i="check"===e.stage?e.labels.map(e=>t(`flow.label.${e}`)).join("\xb7")||t("flow.label.check"):"review"===e.stage?t("resolve"===e.action?"flow.label.resolve":"flow.label.review"):"ci"===e.stage||"deploy"===e.stage||"commit"===e.stage?t(`flow.label.${e.stage}`):t(`flow.stage.${e.stage}`),s=ov(e),a=(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(ow,{outcome:s}),(0,r.jsx)(ok,{step:e,st:t}),(0,r.jsxs)("span",{className:"flow-check-label",children:[n?`${t("flow.attempt",{attempt:e.attempt})} \xb7 ${i}`:i,ls(e)&&(0,r.jsx)("span",{className:"flow-compound",children:t("flow.compound.failed")})]})]});return"check"!==e.stage&&"ci"!==e.stage&&"deploy"!==e.stage?(0,r.jsx)("li",{className:"flow-check","data-result":s,children:(0,r.jsx)("div",{className:"flow-check-head",children:a})},e.toolCallId):(0,r.jsx)("li",{className:"flow-check","data-result":s,children:(0,r.jsxs)("details",{children:[(0,r.jsxs)("summary",{className:"flow-check-head",children:[a,(0,r.jsxs)("span",{className:"flow-disclose",children:[t("flow.details"),oy]})]}),(0,r.jsx)(oC,{step:e,label:i,st:t})]})},`${e.toolCallId}#${e.stage}`)})})}function oT({steps:e,st:t}){return 0===e.length?null:(0,r.jsxs)("details",{className:"flow-earlier",children:[(0,r.jsxs)("summary",{className:"flow-earlier-toggle",children:[t("flow.earlier",{count:e.length}),oy]}),(0,r.jsx)(oN,{steps:e,st:t,attempts:!0})]})}function oI({view:e,steps:t,st:n}){if(0===t.length)return null;if("check"!==e.stage)return(0,r.jsx)(oN,{steps:t,st:n});let i=li(t),s=e=>{let t=oM.indexOf(ov(e));return t<0?oM.length:t},a=[...i].sort((e,t)=>s(e)-s(t)),l=t.filter(e=>!i.includes(e));return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(oN,{steps:a,st:n}),l.length>0&&(0,r.jsxs)("details",{className:"flow-earlier",children:[(0,r.jsxs)("summary",{className:"flow-earlier-toggle",children:[n("flow.repeats",{count:l.length}),oy]}),(0,r.jsx)(oN,{steps:l,st:n})]})]})}let oM=["failed","unverified","unobserved","stale","running","passed"];function oE({view:e,flow:t,live:n,st:i,compact:s=!1}){if(n&&t.current===e.stage)return i("flow.state.running");if("waiting"===e.status)return i("flow.state.waiting");if("skipped"===e.status||"notNeeded"===e.status)return i(`flow.state.${e.status}`);let a=e.steps[e.steps.length-1];if("investigate"===e.stage)return i("running"===e.status?"flow.state.running":"flow.state.done");if("edit"===e.stage&&"done"===e.status)return i(t.attempt>1?"flow.state.redone":"flow.state.done");if("check"===e.stage&&!s){let t=new Map;for(let n of li(e.steps))t.set(ov(n),(t.get(ov(n))??0)+1);return oM.filter(e=>t.has(e)).map((e,n)=>(0,r.jsxs)("span",{children:[n>0&&" \xb7 ",(0,r.jsx)("span",{className:"flow-tone","data-tone":e,children:i(`flow.count.${e}`,{count:t.get(e)??0})})]},e))}return"check"===e.stage||"edit"===e.stage?(0,r.jsx)("span",{className:"flow-tone","data-tone":e.status,children:i(`flow.state.${e.status}`)}):(0,r.jsx)(ok,{step:a,st:i})}function oR({flow:e,live:t,st:n,id:i}){let s=e.loops[e.loops.length-1],a=s?e.steps.filter(e=>e.stage===s.from):[],l=n("flow.loop.badge",{attempt:e.attempt});return(0,r.jsxs)("div",{className:"flow-chain-panel",id:i,children:[(0,r.jsxs)("div",{className:"flow-chain-wrap","data-loop":s?"":void 0,style:s?{"--loop-from":ao.indexOf(s.from)}:void 0,children:[(0,r.jsx)("ol",{className:"flow-chain","aria-label":n("flow.aria"),children:e.stages.map(i=>{let s=ox(i,e,t);return(0,r.jsxs)("li",{className:"flow-link","data-state":s,"aria-current":"active"===s?"step":void 0,children:[(0,r.jsx)(ob,{look:s}),(0,r.jsx)("span",{className:"flow-link-name",children:n(`flow.stage.${i.stage}`)}),(0,r.jsx)("span",{className:"flow-link-state",children:(0,r.jsx)(oE,{view:i,flow:e,live:t,st:n,compact:!0})})]},i.stage)})}),s&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flow-loop","aria-hidden":"true",children:[(0,r.jsx)("svg",{width:"22",height:"15",viewBox:"0 0 22 15",children:(0,r.jsx)("polyline",{points:"3 12 11 3 19 12",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round"})}),(0,r.jsx)("span",{className:"flow-loop-count",children:l})]}),(0,r.jsxs)("p",{className:"flow-loop-caption",children:[(0,r.jsx)("span",{className:"flow-loop-caption-count",children:l}),n("review"===s.from?"flow.loop.findings":"flow.loop.failed",{stage:n(`flow.stage.${s.from}`),attempt:s.attempt})]})]})]}),a.length>0&&(0,r.jsx)("div",{className:"flow-chain-attempts",children:(0,r.jsx)(oN,{steps:a,st:n,attempts:!0})})]})}function o$({sessionId:e,snapshots:t,client:n,enabled:r,transcripts:s=!0,cwd:a}){let l=(0,i.useMemo)(()=>t.filter(e=>os(e.status)),[t]),o=r&&!!e&&l.length>0,c=oc((0,i.useMemo)(()=>l.map(e=>({key:e.id,liveId:e.id,status:e.status})),[l]),{sessionId:e??"",client:n,enabled:o&&s}),[d,u]=(0,i.useState)(null),h=l.map(e=>e.id).sort().join("\n");return(0,i.useEffect)(()=>{let t;if(!o||!e)return;let n=new AbortController,r=h.split("\n"),i=`/api/subagents/eta?sessionId=${encodeURIComponent(e)}`,s=!0,a=0;async function l(){try{let t=await fetch(i,{signal:AbortSignal.any([n.signal,AbortSignal.timeout(15e3)])}),a=t.ok?await t.json():null;!n.signal.aborted&&a&&a.sessionId===e&&a.histories&&"object"==typeof a.histories&&(u(a),s=r.some(e=>!a.histories[e]))}catch{}finally{if(!n.signal.aborted){let e=s&&a<3;e&&(a+=1),t=window.setTimeout(l,e?1e4:6e4)}}}return l(),()=>{n.abort(),window.clearTimeout(t)}},[h,o,e]),(0,i.useMemo)(()=>{let t=new Map;if(!o)return t;let n=d&&d.sessionId===e?d.histories:void 0;for(let e of l){let r=(s?c.get(e.id)?.entries??[]:[]).flatMap(e=>"message"in e?[e.message]:[]);t.set(e.id,{phase:function(e,t){if(0===e.length)return null;let{blocks:n,results:r}=l3(e),i="investigate",s=!1;for(let e of n){let n=l9(e);l7(e,n,r,t)?(s=!0,i="implement"):l6[n]?i=s?"verify":"investigate":"yield"===n&&(i="report",s=!1)}return i}(r,a),trace:ot(r,a),todo:function(e){let t=new Map;for(let n of e)"toolResult"===n.role&&t.set(n.toolCallId,n);let n=tP([...e],t);if(!n)return null;let r=t_(n);return 0===r.total||null===r.percent?null:{completed:r.completed,total:r.total,percent:r.percent,activeTask:r.activeTask?.content??null}}(r),history:n?.[e.id]??null})}return t},[l,a,d,o,c,e,s])}function oL(e,t){let n=or(t);return n?0===n.hours?e("duration.minutes",{minutes:n.minutes}):0===n.minutes?e("duration.hours",{hours:n.hours}):e("duration.hoursMinutes",{hours:n.hours,minutes:n.minutes}):e("duration.underMinute")}function oP(e,t){let n=Math.floor(t/1e3);return n<60?e("duration.seconds",{seconds:n}):n<3600?e("duration.minutesSeconds",{minutes:Math.floor(n/60),seconds:n%60}):oL(e,t)}function oA({phase:e}){let{st:t}=iw();return(0,r.jsxs)("span",{className:"subagent-phase-steps","data-phase":e,title:t("phase.hint"),style:{position:"relative"},children:[(0,r.jsx)("span",{className:"sr-only",children:t("phase.current",{phase:t(`phase.${e}`)})}),(0,r.jsx)("span",{"aria-hidden":"true",children:l4.map((n,i)=>(0,r.jsxs)("span",{children:[i>0&&(0,r.jsx)("span",{style:{color:"var(--seed-color-fg-neutral-subtle, var(--text-muted))"},children:" › "}),(0,r.jsx)("span",{"data-current":n===e?"":void 0,style:n===e?{color:"var(--accent)",fontWeight:700}:{color:"var(--seed-color-fg-neutral-subtle, var(--text-muted))"},children:t(`phase.${n}`)})]},n))})]})}let o_={done:"done",stale:"stale",active:"active",waiting:"waiting",skipped:"skipped",none:"skipped",unobserved:"unverified"};function oF(e,t){let n=t.passed+t.failed+t.unknown,i=t.failed>0?"failed":t.unknown>0?"unverified":"passed";return(0,r.jsx)("span",{className:"flow-tone","data-tone":i,children:e("subflow.checks",{passed:t.passed,total:n})})}function oO({flow:e,live:t,verdict:n,attempts:i}){let{st:s}=iw(),a=of(),l=e.stations.findIndex(e=>"active"===e.state),o=l4.indexOf("implement"),c=i.filter(e=>"rework"===e.verdict).length,d=n?"accepted"===n.verdict?"done":"unverified":"waiting",u=n?`${s(`verdict.${n.verdict}`)}${null!==n.attempt&&n.attempt>1?` \xb7 ${s("verdict.attempt",{attempt:n.attempt})}`:""}`:s(t?"flow.state.waiting":"verdict.none");return(0,r.jsxs)("div",{className:"subagent-flow",children:[t&&l>=0&&(0,r.jsx)(og,{paused:a}),(0,r.jsxs)("ol",{className:"flow-graph","aria-label":s("subflow.aria"),"data-live":t?"":void 0,"data-motion":a?"paused":void 0,children:[e.stations.map((t,n)=>{let i=o_[t.state];return(0,r.jsx)("li",{className:"flow-graph-station","data-stage":t.phase,"data-state":i,"data-loop":c>0&&n>=o?"":void 0,"aria-current":"active"===t.state?"step":void 0,style:{"--col":n+1},children:(0,r.jsxs)("div",{className:"flow-graph-stop",children:[(0,r.jsx)("span",{className:"flow-graph-stop-name",children:s(`phase.${t.phase}`)}),(0,r.jsxs)("span",{className:"flow-graph-stop-state",children:[(0,r.jsx)(ob,{look:i}),(0,r.jsx)("span",{className:"flow-graph-stop-word",children:function(e,t,n){let i="verify"===t.phase&&null!==n&&n.checks.passed+n.checks.failed+n.checks.unknown>0;switch(t.state){case"active":return i&&n?(0,r.jsxs)(r.Fragment,{children:[e("flow.state.running")," \xb7 ",oF(e,n.checks)]}):e("flow.state.running");case"waiting":return e("flow.state.waiting");case"skipped":return e("flow.state.skipped");case"none":return e("detail.stageNone");case"unobserved":return e("subflow.unobserved");case"stale":return e(n&&n.checks.passed>0?"flow.state.stale":"flow.state.staleDone");case"done":if("report"===t.phase)return e("subflow.reported");if(i&&n)return oF(e,n.checks);if("implement"===t.phase&&n&&n.reedits>0)return`${e("subflow.calls",{count:t.calls})} \xb7 ${e("subflow.reedits",{count:n.reedits})}`;return e("subflow.calls",{count:t.calls})}}(s,t,e.run)})]})]})},t.phase)}),(0,r.jsx)("li",{className:"flow-graph-station","data-stage":"verdict","data-state":d,style:{"--col":l4.length+1},children:(0,r.jsxs)("div",{className:"flow-graph-stop",children:[(0,r.jsx)("span",{className:"flow-graph-stop-name",children:s("graph.join")}),(0,r.jsxs)("span",{className:"flow-graph-stop-state",children:[(0,r.jsx)(ob,{look:d}),(0,r.jsx)("span",{className:"flow-graph-stop-word",children:u})]})]})}),c>0&&(0,r.jsxs)("li",{className:"flow-graph-return",style:{"--from":o+1,"--to":l4.length+1},children:[(0,r.jsx)("span",{className:"flow-graph-return-line","aria-hidden":"true",children:(0,r.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:(0,r.jsx)("polyline",{points:"5 12 12 5 19 12"})})}),(0,r.jsx)("span",{className:"flow-graph-return-text",children:s("subflow.rework",{count:c})})]})]})]})}function oz(e,t){let n=e("progress.todo",{completed:t.completed,total:t.total,percent:t.percent});return t.activeTask?`${n} \xb7 ${t.activeTask}`:n}function oD({snapshot:e,view:t,id:n}){var i,s,a;let l,o,c,{st:d}=iw(),u=nj(5e3),h="number"!=typeof(l=e.progress?.durationMs)?null:l+(("pending"===e.status||"running"===e.status)&&e.lastUpdate>0?Math.max(0,u-e.lastUpdate):0);if(null===h)return null;let p=function(e,t){if(!e||e.rework||null===t||e.durationsSec.length<3)return null;let n=e.durationsSec.map(e=>1e3*e-t).filter(e=>e>0);if(n.length<3)return{kind:"overrun",longestMs:1e3*Math.max(...e.durationsSec),samples:e.durationsSec.length,longerRuns:n.length};let r=l8(n,.5)??0;return{kind:"remaining",p25Ms:l8(n,.25)??0,medianMs:r,p75Ms:l8(n,.75)??0,samples:n.length,percent:Math.round(t/(t+r)*100)}}(t.history,h),m=(i=t.todo,!i||null===h||0===i.completed||i.completed>=i.total?null:h*(i.total-i.completed)/i.completed),f={color:"var(--seed-color-fg-neutral-subtle, var(--text-muted))"},g=t.history,x=g?.rework&&null!==g.firstDispatchedAtMs?u-g.firstDispatchedAtMs:null;return(0,r.jsxs)("span",{id:n,className:"subagent-live-eta","data-eta":p?.kind??(g?.rework?"rework":"none"),children:[(0,r.jsx)("span",{"data-elapsed":Math.floor(h/1e3),children:d("eta.elapsed",{duration:oP(d,h)})}),g?.rework&&(0,r.jsxs)(r.Fragment,{children:[" \xb7 ",(0,r.jsx)("span",{style:f,title:d("eta.reworkHint"),children:null!==x&&x>=0?d("eta.rework",{attempt:g.attempt,duration:oP(d,x)}):d("eta.reworkAttempt",{attempt:g.attempt})})]}),p?.kind==="remaining"&&(0,r.jsxs)(r.Fragment,{children:[" \xb7 ",(0,r.jsx)("span",{title:d("eta.hint"),children:d("eta.remaining",{range:(s=p.p25Ms,a=p.p75Ms,o=or(s),c=or(a),o&&c&&0===o.hours&&0===c.hours?o.minutes===c.minutes?d("duration.minutes",{minutes:o.minutes}):d("eta.rangeMinutes",{low:o.minutes,high:c.minutes}):d("eta.range",{low:oL(d,s),high:oL(d,a)})),samples:p.samples})})," \xb7 ",(0,r.jsx)("span",{style:f,children:d("eta.percent",{percent:p.percent})})]}),p?.kind==="overrun"&&(0,r.jsxs)(r.Fragment,{children:[" \xb7 ",(0,r.jsx)("span",{style:{color:"var(--warning)"},title:d("eta.hint"),children:0===p.longerRuns?d("eta.overrun",{longest:oL(d,p.longestMs)}):d("eta.sparseTail",{samples:p.samples,longerRuns:p.longerRuns})})]}),null!==m&&t.todo&&(0,r.jsxs)(r.Fragment,{children:[" \xb7 ",(0,r.jsx)("span",{style:f,title:d("eta.byTodoHint"),children:m<6e4?d("eta.byTodoSoon",{completed:t.todo.completed,total:t.todo.total}):d("eta.byTodo",{duration:oL(d,m),completed:t.todo.completed,total:t.todo.total})})]})]})}let oW={dispatching:"run.dispatching",pending:"run.pending",running:"run.running",completed:"run.completed",failed:"run.failed",aborted:"run.aborted",unobserved:"run.unobserved"},oH={accepted:"verdict.accepted",rework:"verdict.rework",held:"verdict.held",none:"verdict.none"};function oU({maker:e,st:t}){let n=e.verdict?.verdict??"none",i=e.verdict?.attempt;return(0,r.jsxs)("span",{className:"answer-status-pair",children:[(0,r.jsx)("span",{className:"answer-status-run","data-state":e.run,children:t(oW[e.run])}),(0,r.jsx)("span",{className:"answer-status-arrow","aria-hidden":"true",children:"→"}),(0,r.jsxs)("span",{className:"answer-status-verdict","data-verdict":n,children:[t(oH[n]),null!=i&&i>1?` \xb7 ${t("verdict.attempt",{attempt:i})}`:null]})]})}function oB(e,t){let n=[],r=new Map;for(let t of e)"message"in t&&("assistant"===t.message.role?n.push(...t.message.content??[]):"toolResult"===t.message.role&&r.set(t.message.toolCallId,t.message));return lY(n,r,t)}function oq(e){return e.sessionFile?.split(/[\\/]/).pop()?.replace(/\.jsonl$/i,"")||void 0}function oV(e,t){let n=e?.state;return n?.kind!=="ready-live"?null:ot(n.entries.flatMap(e=>"message"in e?[e.message]:[]),t)}function oK({maker:e,st:t}){let n=e.runTitle??e.title;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"answer-dispatch-name",title:n,children:n}),e.priorVerdict&&!e.runTitle&&(0,r.jsx)("span",{className:"answer-dispatch-title-note",children:t("subflow.firstTitle")})]})}function oG({calls:e}){let{ledger:t,subagents:n,toolResults:s,onOpenPanel:a,sessionId:l,cwd:o,onOpenMaker:c,selectedMaker:d}=(0,i.useContext)(as),{st:u}=iw(),{t:h}=(0,F.s)(),[p,m]=(0,i.useState)(!1),f=(0,i.useId)(),g=(0,i.useMemo)(()=>sZ(),[]),x=(0,i.useMemo)(()=>e.flatMap(e=>s3(e,s.get(e.toolCallId))??[]).map(e=>at(e,n,t)),[e,s,n,t]),v=(0,i.useMemo)(()=>x.flatMap(e=>{if("pending"!==e.run&&"running"!==e.run)return[];let r=ae(e.member,n,t);return r?[r]:[]}),[x,n,t]),y=o$({sessionId:l,snapshots:v,client:g,enabled:!0,transcripts:p,cwd:o}),b=(0,i.useMemo)(()=>new Map(x.flatMap(e=>{let t=an(e.member,n);return t?[[e.member.key,t]]:[]})),[x,n]),w=(0,i.useMemo)(()=>p?[...b].filter(([,e])=>!os(e.status)).map(([e,t])=>({key:e,liveId:t.id,status:t.status,archiveName:oq(t)})):[],[b,p]),k=oc(w,{sessionId:l??"",client:g,enabled:p&&!!l&&w.length>0}),j=d?.origin?x.find(e=>e.member.key===d.origin):void 0,S=j?.run,C=j?.verdict??null;if((0,i.useEffect)(()=>{if(!d||!c||!S)return;let e=d.status;e&&e.run===S&&e.verdict?.order===C?.order||c({...d,status:{run:S,verdict:C}},!1)},[c,d,S,C]),0===x.length)return null;let N=0,T=0,I=0;for(let e of x)("dispatching"===e.run||"pending"===e.run||"running"===e.run)&&(N+=1),"completed"===e.run&&(T+=1),e.verdict?.verdict==="accepted"&&(I+=1);return(0,r.jsxs)("section",{className:"answer-dispatch","aria-label":u("dispatch.title",{count:x.length}),children:[(0,r.jsxs)("button",{type:"button",className:"answer-dispatch-toggle","aria-expanded":p,"aria-controls":f,title:u(p?"dispatch.collapse":"dispatch.expand"),onClick:()=>m(e=>!e),children:[(0,r.jsx)("span",{className:"answer-dispatch-heading",children:u("dispatch.title",{count:x.length})}),(0,r.jsx)("span",{className:"answer-dispatch-tally",children:u("dispatch.tally",{running:N,done:T,accepted:I})}),(0,r.jsx)("svg",{className:"answer-chevron",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,r.jsx)("polyline",{points:"6 9 12 15 18 9"})})]}),(0,r.jsx)("ul",{className:"answer-dispatch-list",id:f,"aria-label":p?h("dispatchLane.label"):void 0,children:x.map(e=>{var n;let i,s="pending"===e.run||"running"===e.run,a=s?v.find(t=>t.id===e.member.agentId):void 0,l=a?y.get(a.id):void 0,h=b.get(e.member.key),m=e.member.key===d?.origin,f=s&&"live"===e.runSource,g=p?on(f?l?.trace??null:oV(k.get(e.member.key),o),f):null,x=p?ar(e.member,t):[];return(0,r.jsxs)("li",{className:"answer-dispatch-row","data-dispatch-key":e.member.key,"data-focused":m?"":void 0,children:[p?(0,r.jsx)(oJ,{maker:e,phase:f&&g?.run?u(`phase.${g.run.phase}`):null,checks:function(e,t,n){if(!t)return{kind:"unobserved"};if(os(t.status))return{kind:"running"};let r=e?.state;if(!r||"loading"===r.kind)return{kind:"loading"};if("ready-live"===r.kind){let{checks:e}=oB(r.entries,n);return{kind:"counted",passed:e.filter(e=>"passed"===e.state).length,total:e.length}}return"empty"===r.kind&&"live"===r.source?{kind:"counted",passed:0,total:0}:{kind:"unobserved"}}(k.get(e.member.key),h,o),onOpen:h&&c?()=>c({key:`live:${h.id}`,toolCallId:e.member.toolCallId,origin:e.member.key,status:{run:e.run,verdict:e.verdict}}):null}):(0,r.jsxs)("div",{className:"answer-dispatch-line",children:[(0,r.jsx)(oK,{maker:e,st:u}),(0,r.jsx)(oU,{maker:e,st:u})]}),g&&(0,r.jsx)(oO,{flow:g,live:f,verdict:e.verdict,attempts:x}),p&&(0,r.jsx)(oZ,{attempts:x}),a&&l&&(0,r.jsxs)("div",{className:"answer-dispatch-progress",children:[l.todo?`${oz(u,l.todo)} \xb7 `:null,(0,r.jsx)(oD,{snapshot:a,view:l})]}),p&&(0,r.jsxs)("dl",{className:"answer-dispatch-detail",children:[s&&(0,r.jsxs)("div",{children:[(0,r.jsx)("dt",{children:u("detail.stage")}),(0,r.jsx)("dd",{children:e.stage??u("detail.stageNone")})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("dt",{children:u("detail.model")}),(0,r.jsx)("dd",{title:e.model?.model??void 0,children:e.model?.modelShort?`${e.model.modelShort}${e.model.effort?` \xb7 ${e.model.effort}`:""}${e.model.modelIsFallback?` \xb7 ${u("detail.fallback")}`:""}`:u("detail.modelNone")})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("dt",{children:u("detail.agentId")}),(0,r.jsxs)("dd",{children:[(0,r.jsx)("span",{className:"answer-mono",children:e.member.agentId}),e.runSource?` \xb7 ${u("live"===e.runSource?"detail.source.live":"detail.source.record")}`:""]})]}),e.priorVerdict&&(0,r.jsxs)("div",{children:[(0,r.jsx)("dt",{children:u("subflow.prior")}),(0,r.jsx)("dd",{children:(i=null!==(n=e.priorVerdict).attempt&&n.attempt>1?` \xb7 ${u("verdict.attempt",{attempt:n.attempt})}`:"",`${u(oH[n.verdict])}${i}${n.reason?` \xb7 ${n.reason}`:""}`)})]}),e.priorVerdict&&(0,r.jsxs)("div",{children:[(0,r.jsx)("dt",{children:u(e.runTitle?"subflow.firstTitle":"subflow.runTitle")}),(0,r.jsx)("dd",{children:e.runTitle?e.title:u("detail.stageNone")})]}),e.verdict?.reason&&(0,r.jsxs)("div",{children:[(0,r.jsx)("dt",{children:u("detail.reason")}),(0,r.jsx)("dd",{children:e.verdict.reason})]})]})]},e.member.key)})}),p&&a&&(0,r.jsxs)("div",{className:"answer-dispatch-links",children:[(0,r.jsx)("button",{type:"button",className:"answer-link",onClick:()=>a("subagents"),children:u("detail.openSubagents")}),(0,r.jsx)("button",{type:"button",className:"answer-link",onClick:()=>a("process"),children:u("detail.openProcess")})]})]})}function oJ({maker:e,phase:t,checks:n,onOpen:i}){let{st:s}=iw(),{t:a}=(0,F.s)(),l=e.verdict?.verdict??"none",o=s(oW[e.run]),c="running"===n.kind?null:"counted"===n.kind?a("dispatchLane.checks",{passed:n.passed,total:n.total}):a("loading"===n.kind?"dispatchLane.checksLoading":"dispatchLane.checksUnobserved");return(0,r.jsxs)("div",{className:"answer-dispatch-line is-lane",children:[(0,r.jsx)(oK,{maker:e,st:s}),(0,r.jsxs)("span",{className:"answer-status-pair",children:[(0,r.jsx)("span",{className:"answer-status-run","data-state":e.run,children:t?a("dispatchLane.runPhase",{run:o,phase:t}):o}),c&&(0,r.jsx)("span",{className:"answer-dispatch-checks","data-checks":"counted"===n.kind&&n.passed<n.total?"failed":n.kind,children:c}),(0,r.jsx)("span",{className:"answer-status-arrow","aria-hidden":"true",children:"→"}),(0,r.jsx)("span",{className:"answer-status-verdict","data-verdict":l,children:s(oH[l])})]}),i?(0,r.jsx)("button",{type:"button",className:"answer-link answer-dispatch-open","aria-label":a("dispatchLane.openLabel",{title:e.title}),onClick:i,children:a("dispatchLane.open")}):(0,r.jsx)("span",{className:"answer-dispatch-unavailable",title:a("makerDetail.unavailable"),children:a("dispatchLane.unavailable")})]})}function oY({maker:e}){let{ledger:t,subagents:n,sessionId:s,cwd:a}=(0,i.useContext)(as),l=(0,i.useMemo)(()=>sZ(),[]),o="pending"===e.run||"running"===e.run,c=o&&"live"===e.runSource,d=o?ae(e.member,n,t):void 0,u=o$({sessionId:s,snapshots:(0,i.useMemo)(()=>d?[d]:[],[d]),client:l,enabled:!0,transcripts:!0,cwd:a}),h=an(e.member,n),p=(0,i.useMemo)(()=>h&&!os(h.status)?[{key:e.member.key,liveId:h.id,status:h.status,archiveName:oq(h)}]:[],[h,e.member.key]),m=oc(p,{sessionId:s??"",client:l,enabled:!!s&&p.length>0}),f=d?u.get(d.id):void 0,g=on(c?f?.trace??null:oV(m.get(e.member.key),a),c),x=ar(e.member,t);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(oO,{flow:g,live:c,verdict:e.verdict,attempts:x}),(0,r.jsx)(oZ,{attempts:x})]})}function oZ({attempts:e}){let{t}=(0,F.s)();return e.length<2?null:(0,r.jsx)("ol",{className:"answer-dispatch-attempts","aria-label":t("dispatchLane.label"),children:e.map((e,n)=>(0,r.jsxs)("li",{"data-verdict":e.verdict,title:e.reason??void 0,children:[n>0&&(0,r.jsx)("span",{className:"answer-status-arrow","aria-hidden":"true",children:"→ "}),null===e.attempt?t("dispatchLane.attemptUnknown"):t("dispatchLane.attempt",{attempt:e.attempt})," ",t(`dispatchLane.verdict.${e.verdict}`)]},`${e.attempt??"n"}-${n}`))})}let oQ=/\.(?:md|mdx|markdown|txt)$/i;function oX(e){return`${(100*Math.min(1,Math.max(0,e))).toFixed(2)}%`}function o0(e,t,n){return"investigate"!==e.stage&&("edit"===e.stage?n>0||e.earlier.length>0:e.steps.length>0||e.earlier.length>0||"ci"===e.stage&&null!==t.publication)}function o1({entry:e,st:t}){let n="running"===e.maker.run||"pending"===e.maker.run||"dispatching"===e.maker.run;return e.bar&&null!==e.durationMs?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"flow-graph-track","aria-hidden":"true",children:(0,r.jsx)("span",{className:"flow-graph-bar",style:{left:oX(e.bar.offset),width:oX(e.bar.width)}})}),(0,r.jsx)("span",{className:"flow-graph-time",children:oP(t,e.durationMs)})]}):(0,r.jsx)("span",{className:"flow-graph-time-missing",children:t(n?"summary.time.running":"summary.time.unobserved")})}function o2({entry:e,together:t,batch:n=!1,st:i}){let s=e.maker.member.workClass;return(0,r.jsxs)("span",{className:"flow-graph-maker-tags",children:[(0,r.jsx)("span",{className:"flow-graph-chip","data-unknown":s?void 0:"",children:i(`graph.kind.${s??"unknown"}`)}),n&&e.batchSize>1&&(0,r.jsx)("span",{className:"flow-graph-chip",children:i("graph.parallel.batch")}),t&&(0,r.jsx)("span",{className:"flow-graph-chip","data-unknown":"unknown"===e.concurrency?"":void 0,"data-concurrency":e.concurrency,children:i(`graph.concurrency.${e.concurrency}`)})]})}function o8({selectable:e,selected:t,detailId:n,onSelect:i,className:s,children:a,style:l}){return e?(0,r.jsx)("button",{type:"button",className:s,style:l,"aria-pressed":t,"aria-controls":n,onClick:i,children:a}):(0,r.jsx)("div",{className:s,style:l,children:a})}function o4({summary:e,makers:t,timings:n,live:s=!1,onOpenFile:a}){let l,o,c,{subagents:d,onOpenMaker:u}=(0,i.useContext)(as),{st:h}=iw(),p=(0,i.useId)(),{flow:m}=e,f=(0,i.useMemo)(()=>(function(e,t,n,r){let i=function(e,t){let n=t.map(e=>null!==e.startedAt&&null!==e.durationMs?{start:e.startedAt,end:e.startedAt+e.durationMs}:null),r=e.startedAt,i=e.endedAt;for(let e of n)e&&((null===r||e.start<r)&&(r=e.start),(null===i||e.end>i)&&(i=e.end));let s=null!==r&&null!==i?i-r:0;return n.map(e=>e?s<=0||null===r?{offset:0,width:1}:{offset:(e.start-r)/s,width:(e.end-e.start)/s}:null)}(n,t),s=e.map(e=>"live"===e.runSource&&"running"===e.run),a=new Map;for(let t of e)a.set(t.member.toolCallId,(a.get(t.member.toolCallId)??0)+1);let l=e.map((n,r)=>{let l="unknown";for(let t=0;t<e.length;t+=1)if(t!==r&&(s[r]&&s[t]||n.observedParallelWith?.has(e[t].member.key))){l="overlapped";break}return{maker:n,bar:i[r],durationMs:t[r]?.durationMs??null,concurrency:l,batchSize:a.get(n.member.toolCallId)??1,liveRunning:s[r]}});return{makers:l,parallel:l.some(e=>"overlapped"===e.concurrency)?"observed":l.some(e=>e.batchSize>1)?"batch":"none",files:r.filter(e=>!oQ.test(e.filePath)),docs:r.filter(e=>oQ.test(e.filePath))}})(t,n,e.span,e.files),[t,n,e.span,e.files]),[g,x]=(0,i.useState)(void 0),v=of(),y=e.files.length,b=s&&m.current?m.stages.find(e=>e.stage===m.current):void 0,w=void 0===g?b&&o0(b,m,y)?`stage:${b.stage}`:(l=m.stages.filter(e=>o0(e,m,y)),o=m.loops[m.loops.length-1],(c=(m.next?.returning&&o?l.find(e=>e.stage===o.from):void 0)??l.find(e=>"failed"===e.status)??l.find(e=>"unverified"===e.status||"stale"===e.status)??l.findLast(e=>"notNeeded"!==e.status&&"skipped"!==e.status)??l[l.length-1])?`stage:${c.stage}`:y>0?"files":null):g,k=m.loops[m.loops.length-1],j=k?ao.indexOf(k.from):-1,S=ao.indexOf("edit"),C=b?ao.indexOf(b.stage):-1,N=f.makers.some(e=>e.liveRunning),T=f.files.length>0||f.docs.length>0,I=(0,i.useMemo)(()=>s?[]:function(e,t,n,r){let i=ao.indexOf("edit"),s=e=>"waiting"!==e.status&&"skipped"!==e.status&&"notNeeded"!==e.status,a=[],l=n,o=e=>{let t=ao.indexOf(e.stage);l&&t>i&&(a.push("branch"),l=!1),a.push(e.stage),l&&t===i&&(a.push("branch"),l=!1)},c=t[t.length-1];if(c){let t=ao.indexOf(c.from);for(let n of e)ao.indexOf(n.stage)<=t&&(s(n)||n.earlier.length>0||n.stage===c.from)&&o(n);for(let t of(l&&(a.push("branch"),l=!1),a.push("return"),e))ao.indexOf(t.stage)>=i&&s(t)&&o(t)}else for(let t of e)s(t)&&o(t);return l&&a.push("branch"),r&&a.push("outputs"),a}(m.stages,m.loops,f.makers.length>0,T),[s,m.stages,m.loops,f.makers.length,T]),[M,E]=(0,i.useState)(null),R=null!==M&&M<I.length?M:null;(0,i.useEffect)(()=>{if(null===R)return;let e=window.setTimeout(()=>E(R+1<I.length?R+1:null),800);return()=>window.clearTimeout(e)},[R,I.length]);let $=e=>{if(null!==R&&I.includes(e))return I[R]===e?"now":I.slice(0,R).includes(e)?"past":"ahead"},L=new Map;for(let e of f.makers){let t=e.maker.verdict?.verdict??"none";L.set(t,(L.get(t)??0)+1)}let P=1===L.size&&L.has("accepted"),A=m.stages[S+1],_=A?ox(A,m,s):"skipped",F=f.makers.length>0&&(0,r.jsxs)("li",{className:"flow-graph-branch","data-loop":k&&j>S?"":void 0,"data-merge":"skipped"===_||"waiting"===_||"approval"===_?"quiet":void 0,"data-beat":$("branch"),children:[(0,r.jsxs)("p",{className:"flow-graph-branch-head",children:[(0,r.jsx)("span",{children:h(1===f.makers.length?"graph.branch.one":"graph.branch",{count:f.makers.length})}),"none"!==f.parallel&&(0,r.jsx)("span",{className:"flow-graph-chip","data-parallel":f.parallel,children:h(`graph.parallel.${f.parallel}`)})]}),(0,r.jsx)("ul",{className:"flow-graph-lanes",children:f.makers.map(e=>{let t=`maker:${e.maker.member.key}`;return(0,r.jsx)("li",{className:"flow-graph-lane","data-run":e.maker.run,"data-live":e.liveRunning?"":void 0,children:(0,r.jsxs)(o8,{selectable:!0,selected:w===t,detailId:p,onSelect:()=>x(w===t?null:t),className:"flow-graph-maker",children:[(0,r.jsx)("span",{className:"flow-graph-maker-name",title:e.maker.title,children:e.maker.title}),(0,r.jsx)(o2,{entry:e,together:f.makers.length>1,st:h}),(0,r.jsx)("span",{className:"flow-graph-maker-time",children:(0,r.jsx)(o1,{entry:e,st:h})}),(0,r.jsx)(oU,{maker:e.maker,st:h})]})},e.maker.member.key)})}),(0,r.jsxs)("p",{className:"flow-graph-join","data-state":P?"done":"unverified",children:[(0,r.jsx)(ob,{look:P?"done":"unverified"}),(0,r.jsx)("span",{className:"flow-graph-join-label",children:h("graph.join")}),(0,r.jsx)("span",{className:"flow-graph-join-counts",children:["accepted","rework","held","none"].filter(e=>L.has(e)).map(e=>(0,r.jsxs)("span",{className:"answer-status-verdict","data-verdict":e,children:[h(oH[e])," ",L.get(e)]},e))})]})]},"branch"),O=k&&(0,r.jsxs)("li",{className:"flow-graph-return","data-beat":$("return"),style:{"--from":S+1,"--to":j+1},children:[(0,r.jsx)("span",{className:"flow-graph-return-line","aria-hidden":"true",children:(0,r.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:(0,r.jsx)("polyline",{points:"5 12 12 5 19 12"})})}),(0,r.jsxs)("span",{className:"flow-graph-return-text",children:[(0,r.jsx)("b",{children:h("flow.loop.badge",{attempt:m.attempt})})," ",h("review"===k.from?"flow.loop.findings":"flow.loop.failed",{stage:h(`flow.stage.${k.from}`),attempt:k.attempt})]})]},"return"),z=m.stages.map((e,t)=>{let n=ox(e,m,s),i=`stage:${e.stage}`,a=e.steps.some(ls);return(0,r.jsx)("li",{className:"flow-graph-station","data-stage":e.stage,"data-state":n,"data-again":e.earlier.length>0?"":void 0,"data-loop":k&&t>=S&&t<j?"":void 0,"data-beat":$(e.stage),"aria-current":"active"===n?"step":void 0,style:{"--col":t+1},children:(0,r.jsxs)(o8,{selectable:o0(e,m,y),selected:w===i,detailId:p,onSelect:()=>x(i),className:"flow-graph-stop",children:[(0,r.jsx)("span",{className:"flow-graph-stop-name",children:h(`flow.stage.${e.stage}`)}),(0,r.jsxs)("span",{className:"flow-graph-stop-state",children:[(0,r.jsx)(ob,{look:n}),(0,r.jsx)("span",{className:"flow-graph-stop-word",children:(0,r.jsx)(oE,{view:e,flow:m,live:s,st:h})})]}),a&&(0,r.jsx)("span",{className:"flow-compound",children:h("flow.compound.failed")})]})},e.stage)}),D=[];z.forEach((e,t)=>{D.push(e),t===S&&F&&D.push(F),t===j&&O&&D.push(O)});let W=null;if(w?.startsWith("stage:")){let t=m.stages.find(e=>`stage:${e.stage}`===w);if(t){let n="ci"===t.stage&&null!==m.publication&&"notNeeded"===t.status,i="edit"===t.stage||n?[]:t.steps;W=(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("h5",{className:"flow-graph-detail-title",children:h(`flow.stage.${t.stage}`)}),"ci"===t.stage&&m.publication&&(0,r.jsx)("p",{className:"flow-graph-note",children:"nothingToPublish"===m.publication.kind?h("flow.ci.nothingToPublish",{sha:m.publication.commit.slice(0,7)}):h("flow.ci.notNeeded",{run:m.publication.runId,repo:m.publication.repo,ref:m.publication.ref,sha:m.publication.sha.slice(0,7)})}),"edit"===t.stage&&(0,r.jsx)(iL,{files:e.files,onOpenFile:a}),(0,r.jsx)(oI,{view:t,steps:i,st:h}),(0,r.jsx)(oT,{steps:t.earlier,st:h})]})}}else if(w?.startsWith("maker:")){let e=f.makers.find(e=>`maker:${e.maker.member.key}`===w);if(e){let t=an(e.maker.member,d);W=(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("h5",{className:"flow-graph-detail-title",children:e.maker.title}),(0,r.jsx)(o2,{entry:e,together:f.makers.length>1,batch:!0,st:h}),(0,r.jsx)("p",{className:"flow-graph-detail-line",children:(0,r.jsx)(oU,{maker:e.maker,st:h})}),(0,r.jsx)("div",{className:"flow-graph-maker-time",children:(0,r.jsx)(o1,{entry:e,st:h})}),(0,r.jsx)(oY,{maker:e.maker}),t&&u?(0,r.jsx)("button",{type:"button",className:"flow-graph-open",onClick:()=>u({key:`live:${t.id}`,toolCallId:e.maker.member.toolCallId,origin:e.maker.member.key,status:{run:e.maker.run,verdict:e.maker.verdict}}),children:h("graph.maker.open")}):(0,r.jsx)("p",{className:"flow-graph-note",children:h("graph.maker.unavailable")})]})}}else("files"===w||"docs"===w)&&(W=(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("h5",{className:"flow-graph-detail-title",children:"files"===w?h(1===f.files.length?"graph.files.one":"graph.files",{count:f.files.length}):h(1===f.docs.length?"graph.docs.one":"graph.docs",{count:f.docs.length})}),(0,r.jsx)(iL,{files:"files"===w?f.files:f.docs,onOpenFile:a})]}));return(0,r.jsxs)("section",{className:"flow-section",children:[(0,r.jsxs)("div",{className:"flow-graph-head",children:[(0,r.jsx)("h4",{className:"flow-heading",children:h("flow.heading")}),(C>=0||N)&&(0,r.jsx)(og,{paused:v}),I.length>1&&(0,r.jsx)("button",{type:"button",className:"flow-graph-replay",onClick:()=>E(null===R?0:null),children:h(null===R?"graph.replay":"graph.replay.stop")})]}),(0,r.jsx)("div",{className:"flow-graph-frame",children:(0,r.jsxs)("ol",{className:"flow-graph","aria-label":h("flow.aria"),"data-live":s?"":void 0,"data-motion":v?"paused":void 0,"data-replay":null===R?void 0:"",children:[D,T&&(0,r.jsxs)("li",{className:"flow-graph-outputs","data-beat":$("outputs"),children:[(0,r.jsx)("span",{className:"flow-graph-outputs-label",children:h("graph.outputs")}),f.files.length>0&&(0,r.jsx)(o8,{selectable:!0,selected:"files"===w,detailId:p,onSelect:()=>x("files"),className:"flow-graph-output",children:h(1===f.files.length?"graph.files.one":"graph.files",{count:f.files.length})}),f.docs.length>0&&(0,r.jsx)(o8,{selectable:!0,selected:"docs"===w,detailId:p,onSelect:()=>x("docs"),className:"flow-graph-output",children:h(1===f.docs.length?"graph.docs.one":"graph.docs",{count:f.docs.length})})]})]})}),W&&(0,r.jsx)("div",{className:"flow-graph-detail",id:p,role:"region","aria-label":h("graph.detail.aria"),children:W})]})}function o5(e,t,n){let r=new URLSearchParams({type:t});return n&&r.set("sessionId",n),`/api/files/${tO(e)}?${r}`}function o6(e,t){let[n,r]=(0,i.useState)({kind:"loading"});return(0,i.useEffect)(()=>{let n=new AbortController;return r({kind:"loading"}),fetch(e,{method:"head"===t?"HEAD":"GET",cache:"no-store",signal:n.signal}).then(async e=>{if(!e.ok)return null;if("head"===t)return"";if("text"===t)return e.text();let n=await e.json();return"string"==typeof n.content?n.content:null}).then(e=>{n.signal.aborted||r(null===e?{kind:"failed"}:{kind:"ready",content:e})}).catch(()=>{n.signal.aborted||r({kind:"failed"})}),()=>n.abort()},[e,t]),n}function o3({messageKey:e}){let{st:t}=iw();return(0,r.jsx)("p",{className:"answer-result-fallback",role:"result.previewLoading"===e?"status":void 0,children:t(e)})}function o7({deliverable:e,sessionId:t,title:n}){let{filePath:i,kind:s}=e;if("image"===s){let e=o5(i,"read",t);return(0,r.jsx)(cn,{src:e,title:n},e)}if("html"===s){let e=o5(i,"read",t);return(0,r.jsx)(o9,{url:e,title:n},e)}if(i.toLowerCase().endsWith(".pdf")){let e=o5(i,"read",t);return(0,r.jsx)(ce,{url:e,title:n},e)}let a=o5(i,"preview",t);return(0,r.jsx)(ct,{url:a,title:n},a)}function o9({url:e,title:t}){let n=o6(e,"json");return"ready"!==n.kind?(0,r.jsx)(o3,{messageKey:"failed"===n.kind?"result.previewFailed":"result.previewLoading"}):(0,r.jsx)("iframe",{className:"answer-result-media",srcDoc:n.content,sandbox:"allow-scripts",title:t,scrolling:"no",inert:!0})}function ce({url:e,title:t}){let n=o6(e,"head");return"ready"!==n.kind?(0,r.jsx)(o3,{messageKey:"failed"===n.kind?"result.previewFailed":"result.previewLoading"}):(0,r.jsx)("iframe",{className:"answer-result-media",src:`${e}#toolbar=0&view=FitH`,title:t,inert:!0})}function ct({url:e,title:t}){let n=o6(e,"text");return"ready"!==n.kind?(0,r.jsx)(o3,{messageKey:"failed"===n.kind?"result.previewFailed":"result.previewLoading"}):(0,r.jsx)("iframe",{className:"answer-result-media",srcDoc:n.content,sandbox:"allow-same-origin",title:t,inert:!0})}function cn({src:e,title:t}){let[n,s]=(0,i.useState)("loading");return"failed"===n?(0,r.jsx)(o3,{messageKey:"result.previewFailed"}):(0,r.jsxs)(r.Fragment,{children:["loading"===n?(0,r.jsx)(o3,{messageKey:"result.previewLoading"}):null,(0,r.jsx)("img",{className:"answer-result-media","data-fit":"contain",src:e,alt:t,draggable:!1,hidden:"loading"===n,onLoad:()=>s("ready"),onError:()=>s("failed")})]})}function cr({deliverables:e,onOpenFile:t}){let{sessionId:n}=(0,i.useContext)(as),{st:s}=iw(),[a,o]=function(){let e=(0,i.useRef)(null),[t,n]=(0,i.useState)(!1);return(0,i.useEffect)(()=>{let r=e.current;if(!r||t)return;if("u"<typeof IntersectionObserver)return void n(!0);let i=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&n(!0)},{rootMargin:"200px 0px"});return i.observe(r),()=>i.disconnect()},[t]),[e,t]}(),[c,...d]=e;if(!c)return null;let u=tz(c.filePath),h=s("result.previewTitle",{name:u}),p=t?()=>t(c.filePath):void 0;return(0,r.jsxs)("section",{className:"answer-result","aria-label":s("result.label"),children:[(0,r.jsxs)("div",{ref:a,className:"answer-result-frame","data-kind":c.kind,children:[o&&(0,r.jsx)(o7,{deliverable:c,sessionId:n,title:h}),p&&(0,r.jsx)("button",{type:"button",className:"answer-result-cover",tabIndex:-1,"aria-hidden":"true",onClick:p})]}),(0,r.jsxs)("div",{className:"answer-result-bar",children:[(0,r.jsxs)("span",{className:"answer-result-title",children:[(0,r.jsx)("span",{className:"answer-result-kind",children:s("html"===c.kind?"result.kind.html":"image"===c.kind?"result.kind.image":c.filePath.toLowerCase().endsWith(".pdf")?"result.kind.pdf":"result.kind.document")}),(0,r.jsx)("span",{className:"answer-result-name",title:c.filePath,children:u})]}),p&&(0,r.jsx)(l.r,{className:"answer-result-open",variant:"neutralSolid",size:"medium",onClick:p,"aria-label":s("result.openNamed",{name:u}),children:s("result.open")})]}),d.length>0&&(0,r.jsxs)("div",{className:"answer-result-more",children:[(0,r.jsx)("span",{className:"answer-result-more-label",children:s("result.more",{count:d.length})}),(0,r.jsx)(iL,{files:d.map(({filePath:e})=>({filePath:e})),onOpenFile:t})]})]})}let ci=(0,i.createContext)({selected:null,shown:!1,select:()=>{}});function cs(e,t){let{ledger:n,subagents:r,toolResults:s}=(0,i.useContext)(as),a=(0,i.useMemo)(()=>t?[]:function(e){let t=[];for(let n of e){if(function(e){let t=e.toLowerCase().replace(/\\/g,"/").split("/");for(let e=0;e<t.length;e+=1){let n=t[e];if(Object.hasOwn(aa,n)||n.startsWith(".next")||"doc"===n&&"history"===t[e+1])return!0}return!1}(n.filePath))continue;let e=function(e){let t=eB(e);return"html"===t||"htm"===t?"html":eV(e)?"document":eq(e)?"image":null}(n.filePath);e&&t.push({filePath:n.filePath,kind:e})}return t.map((e,t)=>({deliverable:e,index:t})).sort((e,t)=>al[e.deliverable.kind]-al[t.deliverable.kind]||e.index-t.index).map(({deliverable:e})=>e)}(e.files),[t,e.files]),l=(0,i.useMemo)(()=>e.dispatchCalls.flatMap(e=>s3(e,s.get(e.toolCallId))??[]).map(e=>at(e,r,n)),[e.dispatchCalls,s,r,n]),o=(0,i.useMemo)(()=>l.map(e=>({startedAt:n.spawnedAt.get(e.member.key)??null,durationMs:n.durations.get(e.member.key)??null})),[l,n]),c=li(e.flow.steps),d=c.filter(e=>"failed"===e.outcome).length,u=c.filter(e=>"failed"===e.outcome||"unobserved"===e.outcome).length,h=c.filter(e=>e.compound?.failed).length,p=c.filter(e=>"unverified"===e.outcome&&!e.compound?.failed).length,m=c.filter(e=>e.stale).length,f=l.filter(e=>"failed"===e.run||"aborted"===e.run||"unobserved"===e.run||e.verdict?.verdict!=="accepted").length,g=t?0:u+f,x=0===e.flow.steps.length&&(t||0===e.files.length&&0===e.checks.length&&0===l.length&&!e.remaining?.length);return{deliverables:a,makers:l,timings:o,checks:c,failed:d,compoundFailed:h,verdictUnconfirmed:p,stale:m,unconfirmed:g,empty:x,attention:g>0||d>0||p>0||h>0||m>0}}function ca(e,t,n,r){let i=[r(1===e.files.length?"summary.files.one":"summary.files",{count:e.files.length}),r(1===t.checks.length?"summary.checks.one":"summary.checks",{count:t.checks.length})];return n&&i.unshift(r("summary.live")),t.failed>0&&i.push(r("summary.checksFailed",{count:t.failed})),t.compoundFailed>0&&i.push(r("summary.compoundFailed",{count:t.compoundFailed})),t.makers.length>0&&i.push(r(1===t.makers.length?"summary.makers.one":"summary.makers",{count:t.makers.length})),e.remaining&&i.push(r("summary.remaining",{count:e.remaining.length})),t.unconfirmed>0&&i.push(r("summary.unverified",{count:t.unconfirmed})),t.verdictUnconfirmed>0&&i.push(r(1===t.verdictUnconfirmed?"summary.verdictUnverified.one":"summary.verdictUnverified",{count:t.verdictUnconfirmed})),t.stale>0&&i.push(r("summary.stale",{count:t.stale})),i}function cl({summary:e,turnKey:t,live:n=!1}){let{st:s}=iw(),a=cs(e,n),{selected:l,shown:o,select:c}=(0,i.useContext)(ci);if(a.empty)return null;let d=l===t&&o;return(0,r.jsxs)("button",{type:"button",className:"turn-row","aria-pressed":d,"data-live":n?"":void 0,onClick:()=>c(t),children:[(0,r.jsx)(cu,{attention:a.attention,live:n}),(0,r.jsx)("span",{className:"turn-row-counts","data-attention":a.attention?"":void 0,children:ca(e,a,n,s).join(" \xb7 ")}),(0,r.jsxs)("span",{className:"turn-row-go",children:[(0,r.jsx)("span",{className:"turn-row-go-label",children:s(d?"turn.shown":"turn.show")}),(0,r.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,r.jsx)("path",{d:"m9 18 6-6-6-6"})})]})]})}function co({summary:e,turnKey:t,live:n=!1}){let{shown:s}=(0,i.useContext)(ci);return s?(0,r.jsx)(cl,{summary:e,turnKey:t,live:n}):(0,r.jsx)(cc,{summary:e,turnKey:t,live:n})}function cc({summary:e,turnKey:t,live:n}){let{st:s,locale:a}=iw(),l=cs(e,n),{select:o,latestTurn:c,compactedCalls:d,onOpenFile:u}=(0,i.useContext)(ci),h="live"===t||t===c?d:void 0;return l.empty&&!h?.length?null:(0,r.jsxs)("section",{className:"turn-inline","data-live":n?"":void 0,children:[(0,r.jsx)(cf,{summary:e,live:n,folded:!1,compactedCalls:h,onOpenFile:u,st:s,locale:a}),(0,r.jsx)("div",{className:"turn-inline-actions",children:(0,r.jsxs)("button",{type:"button",className:"turn-inline-show",onClick:()=>o(t),children:[s("turn.show"),(0,r.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,r.jsx)("path",{d:"m9 18 6-6-6-6"})})]})})]})}function cd({summary:e,live:t=!1,onOpen:n}){let{st:i}=iw(),s=cs(e,t);return s.empty?null:(0,r.jsxs)("button",{type:"button",className:"turn-peek",onClick:n,children:[(0,r.jsx)(cu,{attention:s.attention,live:t}),(0,r.jsx)("span",{className:"turn-peek-counts",children:ca(e,s,t,i).join(" \xb7 ")}),(0,r.jsx)("span",{className:"turn-peek-open",children:i("turn.peek")}),(0,r.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,r.jsx)("path",{d:"m18 15-6-6-6 6"})})]})}function cu({attention:e,live:t}){return t?(0,r.jsx)("span",{className:"workbench-lamp","aria-hidden":"true"}):e?(0,r.jsxs)("svg",{className:"turn-state-icon","data-tone":"warning",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,r.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,r.jsx)("line",{x1:"12",x2:"12",y1:"8",y2:"12"}),(0,r.jsx)("line",{x1:"12",x2:"12.01",y1:"16",y2:"16"})]}):(0,r.jsxs)("svg",{className:"turn-state-icon",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,r.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,r.jsx)("path",{d:"m9 12 2 2 4-4"})]})}function ch({title:e,summaryLine:t,folded:n,open:i=!1,children:s}){return n?(0,r.jsxs)("details",{className:"turn-block","data-folded":"",open:i,children:[(0,r.jsxs)("summary",{className:"turn-block-summary",children:[(0,r.jsx)("span",{className:"turn-block-title",children:e}),t&&(0,r.jsx)("span",{className:"turn-block-line",children:t}),(0,r.jsx)("svg",{className:"turn-block-chevron",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,r.jsx)("path",{d:"m6 9 6 6 6-6"})})]}),(0,r.jsx)("div",{className:"turn-block-body",children:s})]}):(0,r.jsxs)("section",{className:"turn-block",children:[(0,r.jsx)("h4",{className:"turn-block-title",children:e}),s]})}function cp(e,t,n,r){let i=t+(e??[]).reduce((e,t)=>e+(s3(t,n.get(t.toolCallId))?.length??0),0);return r(1===i?"summary.makers.one":"summary.makers",{count:i})}function cm({summary:e,live:t=!1,folded:n=!1,compactedCalls:s,onOpenFile:a}){let{st:l,locale:o}=iw(),{toolResults:c}=(0,i.useContext)(as);return e?(0,r.jsx)(cf,{summary:e,live:t,folded:n,compactedCalls:s,onOpenFile:a,st:l,locale:o}):s&&s.length>0?(0,r.jsx)("div",{className:"turn-inspector",children:(0,r.jsx)(ch,{title:l("turn.dispatches"),summaryLine:cp(s,0,c,l),folded:n,open:!0,children:(0,r.jsx)(oG,{calls:s})})}):(0,r.jsx)("p",{className:"inspector-empty",children:l("turn.none")})}function cf({summary:e,live:t,folded:n,compactedCalls:s,onOpenFile:a,st:l,locale:o}){let c=cs(e,t),{toolResults:d}=(0,i.useContext)(as),u=e.span.endedAt??e.span.startedAt,h=t?l("turn.headingLive"):null!==u?l("turn.heading",{time:new Intl.DateTimeFormat(o,{hour:"numeric",minute:"2-digit"}).format(new Date(u))}):l("turn.headingUnknown"),p=[{key:"files",label:l("turn.metric.files"),value:e.files.length},{key:"checks",label:l("turn.metric.checks"),value:c.checks.length},{key:"remaining",label:l("turn.metric.remaining"),value:e.remaining?.length??0}];c.failed>0&&p.push({key:"failed",label:l("turn.metric.failed"),value:c.failed,tone:"danger"}),c.unconfirmed>0&&p.push({key:"unconfirmed",label:l("turn.metric.unverified"),value:c.unconfirmed,tone:"warning"}),c.verdictUnconfirmed>0&&p.push({key:"verdict",label:l("turn.metric.verdict"),value:c.verdictUnconfirmed,tone:"warning"}),c.stale>0&&p.push({key:"stale",label:l("turn.metric.stale"),value:c.stale});let m=e.remaining;return(0,r.jsxs)("div",{className:"turn-inspector","data-live":t?"":void 0,children:[(0,r.jsx)("div",{className:"turn-inspector-head",children:(0,r.jsx)("h3",{className:"turn-inspector-title",children:h})}),(0,r.jsx)("dl",{className:"turn-metrics","aria-label":l("turn.numbers"),children:p.map(e=>(0,r.jsxs)("div",{className:"turn-metric","data-tone":e.tone,children:[(0,r.jsx)("dd",{children:e.value}),(0,r.jsx)("dt",{children:e.label})]},e.key))}),c.deliverables.length>0&&(0,r.jsx)(cr,{deliverables:c.deliverables,onOpenFile:a}),c.empty&&!s?.length?(0,r.jsx)("p",{className:"inspector-empty",children:l("turn.empty")}):e.flow.steps.length>0&&(n?(0,r.jsx)(ch,{title:l("flow.heading"),summaryLine:ca(e,c,t,l).join(" \xb7 "),folded:!0,open:!0,children:(0,r.jsx)(o4,{summary:e,makers:c.makers,timings:c.timings,live:t,onOpenFile:a})}):(0,r.jsx)("section",{className:"turn-block",children:(0,r.jsx)(o4,{summary:e,makers:c.makers,timings:c.timings,live:t,onOpenFile:a})})),(e.dispatchCalls.length>0||(s?.length??0)>0)&&(0,r.jsxs)(ch,{title:l("turn.dispatches"),summaryLine:cp(s,c.makers.length,d,l),folded:n,children:[e.dispatchCalls.length>0&&(0,r.jsx)(oG,{calls:e.dispatchCalls}),s&&s.length>0&&(0,r.jsx)(oG,{calls:s})]}),m&&(0,r.jsx)(ch,{title:l("summary.heading.remaining"),summaryLine:0===m.length?l("summary.todo.none"):l("summary.remaining",{count:m.length}),folded:n,children:0===m.length?(0,r.jsx)("p",{className:"answer-summary-empty",children:l("summary.todo.none")}):(0,r.jsx)("ul",{className:"flow-remaining-list",children:m.map((e,t)=>(0,r.jsxs)("li",{className:"answer-remaining","data-status":e.status,title:e.phase||void 0,children:[(0,r.jsx)("span",{className:"answer-remaining-status",children:l(`summary.todo.${e.status}`)}),(0,r.jsx)("span",{className:"answer-remaining-text",children:e.content}),e.blocker&&(0,r.jsx)("span",{className:"answer-remaining-blocker",children:l("summary.todo.blocker",{blocker:e.blocker})})]},`${e.phase}#${t}`))})})]})}let cg="cuelo-chat-search",cx="cuelo-chat-search-active";function cv(e,t){if("u">typeof CSS&&"highlights"in CSS){if(0===t.length||"u"<typeof Highlight)return void CSS.highlights.delete(e);CSS.highlights.set(e,new Highlight(...t))}}function cy({open:e,onClose:t,containerRef:n,index:s,renderedStart:a,renderedEnd:l,contentKey:o,onReveal:c,onProgrammaticScroll:d,focusRequest:u,t:h}){let p=(0,i.useRef)(null),[m,f]=(0,i.useState)(""),[g,x]=(0,i.useState)(null),[v,y]=(0,i.useState)({index:-1,total:0}),b=(0,i.useDeferredValue)(m),w=e?b.trim().toLowerCase():"",k=(0,i.useRef)(g);k.current=g;let j=(0,i.useRef)([]),S=(0,i.useRef)({key:null,needle:"",rendered:!1});(0,i.useEffect)(()=>{if(!e)return;let t=requestAnimationFrame(()=>p.current?.select());return()=>cancelAnimationFrame(t)},[e,u]),(0,i.useEffect)(()=>()=>{cv(cg,[]),cv(cx,[])},[]),(0,i.useLayoutEffect)(()=>{let t=n.current;if(!e||!w||!t){cv(cg,[]),cv(cx,[]),j.current=[],S.current={key:null,needle:"",rendered:!1},y(e=>0===e.total&&-1===e.index?e:{index:-1,total:0});return}let r=requestAnimationFrame(()=>{let e=function(e,t){let n=new Map,r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode:e=>(e.textContent??"").toLowerCase().includes(t)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(let e=r.nextNode();e;e=r.nextNode()){let r=e.parentElement?.closest("[data-chat-item]"),i=r?Number(r.dataset.chatItem):NaN;if(!Number.isInteger(i))continue;let s=(e.textContent??"").toLowerCase(),a=n.get(i);a||(a=[],n.set(i,a));for(let n=s.indexOf(t);-1!==n;n=s.indexOf(t,n+t.length)){let r=document.createRange();r.setStart(e,n),r.setEnd(e,n+t.length),a.push(r)}}return n}(t,w),n=new Map;for(let[t,r]of e)n.set(t,r.length);let r=function(e,t,n,r,i){let s=[];if(!t)return s;for(let a=0;a<e.length;a++){let l=a>=r&&a<i?n.get(a)??0:function(e,t){if(!t)return 0;let n=0;for(let r=e.indexOf(t);-1!==r;r=e.indexOf(t,r+t.length))n+=1;return n}(e[a],t);for(let e=0;e<l;e++)s.push({item:a,k:e})}return s}(s,w,n,a,l);j.current=r;let i=th(r,k.current);y(e=>e.index===i&&e.total===r.length?e:{index:i,total:r.length});let o=[];for(let t of e.values())for(let e of t)o.push(e);if(cv(cg,o),i<0){cv(cx,[]),S.current={key:null,needle:w,rendered:!1};return}let u=r[i],h=k.current;h&&h.item===u.item&&h.k===u.k||x(u);let p=u.item>=a&&u.item<l,m=S.current,f=m.needle!==w||m.key?.item!==u.item||m.key?.k!==u.k||!m.rendered&&p;if(S.current={key:u,needle:w,rendered:p},!p){cv(cx,[]),f&&c(u.item);return}let g=e.get(u.item)?.[u.k];if(cv(cx,g?[g]:[]),f)if(d(),g){let e,n;e=g.getBoundingClientRect(),n=t.getBoundingClientRect(),e.height<=0||e.top>=n.top+48&&e.bottom<=n.bottom-48||(t.scrollTop+=e.top-n.top-(t.clientHeight-e.height)/2)}else t.querySelector(`[data-chat-item="${u.item}"] > *`)?.scrollIntoView({block:"center"})});return()=>cancelAnimationFrame(r)},[e,w,s,a,l,o,g,n,c,d]);let C=(0,i.useCallback)(e=>{let t=j.current;if(0===t.length)return;let n=th(t,k.current);x(t[(n+e+t.length)%t.length])},[]);if(!e)return null;let N=m.trim().length>0?0===v.total?h("chat.searchNoResults"):h("chat.searchCount",{index:v.index+1,total:v.total}):"";return(0,r.jsxs)("div",{className:"chat-find-bar",role:"search","data-dismissible-layer":"",onKeyDown:e=>{"Escape"===e.key&&(e.preventDefault(),e.stopPropagation(),t())},children:[(0,r.jsx)("input",{ref:p,type:"search",value:m,onChange:e=>f(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.nativeEvent.isComposing||(e.preventDefault(),C(e.shiftKey?-1:1))},placeholder:h("chat.searchPlaceholder"),"aria-label":h("chat.searchPlaceholder"),autoComplete:"off",spellCheck:!1}),(0,r.jsx)("span",{className:"chat-find-count","aria-live":"polite",children:N}),(0,r.jsx)("button",{type:"button",onClick:()=>C(-1),disabled:0===v.total,"aria-label":h("chat.searchPrevious"),title:`${h("chat.searchPrevious")} (Shift+Enter)`,children:(0,r.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,r.jsx)("path",{d:"m18 15-6-6-6 6"})})}),(0,r.jsx)("button",{type:"button",onClick:()=>C(1),disabled:0===v.total,"aria-label":h("chat.searchNext"),title:`${h("chat.searchNext")} (Enter)`,children:(0,r.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,r.jsx)("path",{d:"m6 9 6 6 6-6"})})}),(0,r.jsx)("button",{type:"button",onClick:t,"aria-label":h("chat.searchClose"),title:`${h("chat.searchClose")} (Esc)`,children:(0,r.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,r.jsx)("path",{d:"M18 6 6 18"}),(0,r.jsx)("path",{d:"m6 6 12 12"})]})})]})}function cb({questions:e,containerRef:t,layoutKey:n,onJump:s,label:a}){let l=(0,i.useRef)(null),[o,c]=(0,i.useState)(-1),[d,u]=(0,i.useState)(!1);(0,i.useEffect)(()=>{let e=setTimeout(()=>u(!0),0);return()=>clearTimeout(e)},[]);let h=d&&e.length>=2;(0,i.useEffect)(()=>{let n=t.current;if(!n||!h)return;let r=0,i=null,s=()=>{r=0,i?.[0]?.isConnected||(i=n.querySelectorAll("[data-chat-item]"));let t=n.getBoundingClientRect().top+8,s=0,a=i.length-1,l=i.length-1;for(;s<=a;){let e=s+a>>1,n=i[e].firstElementChild?.getBoundingClientRect();n&&n.bottom>t?(l=e,a=e-1):s=e+1}let o=l>=0?Number(i[l].dataset.chatItem):-1,d=-1;for(let t of e){if(t.item>o)break;d=t.item}c(d)},a=()=>{r||(r=requestAnimationFrame(s))};return r=requestAnimationFrame(s),n.addEventListener("scroll",a,{passive:!0}),()=>{n.removeEventListener("scroll",a),r&&cancelAnimationFrame(r)}},[e,h,n,t]),(0,i.useEffect)(()=>{let e=l.current,t=e?.querySelector("[aria-current='true']");if(!e||!t)return;let n=t.offsetTop-e.scrollTop;(n<0||n+t.offsetHeight>e.clientHeight)&&(e.scrollTop=t.offsetTop-(e.clientHeight-t.offsetHeight)/2)},[o]);let p=e.length,m=(0,i.useCallback)((e,t)=>{let n="ArrowUp"===e.key?t-1:"ArrowDown"===e.key?t+1:"Home"===e.key?0:"End"===e.key?p-1:null;if(null===n)return;e.preventDefault();let r=Math.max(0,Math.min(p-1,n));l.current?.querySelectorAll("button")[r]?.focus()},[p]);if(!h)return null;let f=e.some(e=>e.item===o)?o:e[0].item;return(0,r.jsx)("nav",{className:"question-rail","aria-label":a,children:(0,r.jsx)("div",{ref:l,className:"question-rail-list",children:e.map((e,t)=>(0,r.jsx)(cw,{question:e,position:t,count:p,active:e.item===o,focusable:e.item===f,onJump:s,onMoveFocus:m},e.item))})})}let cw=(0,i.memo)(function({question:e,position:t,count:n,active:i,focusable:s,onJump:a,onMoveFocus:l}){let o=e.text.length>140?`${e.text.slice(0,140)}…`:e.text;return(0,r.jsx)("button",{type:"button",className:"question-rail-tick",tabIndex:s?0:-1,"aria-current":i?"true":void 0,"aria-label":`${t+1}/${n} ${o}`,title:o,onClick:()=>a(e.item),onKeyDown:e=>l(e,t),children:(0,r.jsx)("span",{"aria-hidden":"true"})})});function ck({label:e,tone:t,children:n}){return(0,r.jsxs)("div",{className:"run-status-line","data-tone":t,role:"status","aria-live":"polite",children:[(0,r.jsx)("span",{className:"run-status-label",children:e}),(0,r.jsx)("span",{className:"run-status-text",children:n})]})}let cj={manual:!0,threshold:!0,overflow:!0,idle:!0,incomplete:!0};function cS({compaction:e,t}){let[n,s]=(0,i.useState)(()=>Date.now());if((0,i.useEffect)(()=>{if(!e)return;s(Date.now());let t=setInterval(()=>s(Date.now()),1e3);return()=>clearInterval(t)},[e]),!e)return null;let a=Math.max(0,Math.floor((n-e.startedAt)/1e3)),l=e.reason&&!0===cj[e.reason]?t(`chat.compactionReason.${e.reason}`):null;return(0,r.jsxs)(ck,{label:t("chat.compactionLabel"),tone:"accent",children:[t("chat.compactionProgress",{seconds:a}),l?` \xb7 ${l}`:""]})}function cC({onDismiss:e,t}){return(0,r.jsxs)("div",{className:"interrupted-run-notice",role:"status",children:[(0,r.jsx)("span",{className:"interrupted-run-mark","aria-hidden":"true"}),(0,r.jsxs)("span",{className:"interrupted-run-text",children:[(0,r.jsx)("strong",{children:t("chat.interruptedTitle")}),(0,r.jsx)("span",{children:t("chat.interruptedDetail")})]}),(0,r.jsx)("button",{type:"button",onClick:e,"aria-label":t("chat.interruptedDismiss"),title:t("chat.interruptedDismiss"),children:(0,r.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,r.jsx)("path",{d:"M18 6 6 18"}),(0,r.jsx)("path",{d:"m6 6 12 12"})]})})]})}var cN=n(39092),cT=n.n(cN);let cI=["01","02","03"];function cM(e){let t=0x811c9dc5;for(let n=0;n<e.length;n+=1)t=Math.imul(t^e.charCodeAt(n),0x1000193);return(t>>>0)/0x100000000}function cE(e,t,n){if(e&&"streaming"!==t){let r=rA(e);if(r){let e="failed"===t?"failed":"done",i=rl(rs(rP(r),r.id,e)?.stickers??[],null,()=>cM(n));return i?{src:i,alt:n6[e]}:null}}if(!e||"streaming"===t||!n8.includes(e))return null;let r="failed"===t?"failed":"done",i=e.slice(0,e.indexOf("(")).toLowerCase(),s=rl(cI.map(e=>`/stickers/${i}/${r}/${e}.webp`),null,()=>cM(n));return s?{src:s,alt:n6[r]}:null}let cR=new Map,c$=(0,i.createContext)(cR);function cL({utterances:e,children:t}){return(0,r.jsx)(c$.Provider,{value:e,children:t})}function cP({turnIndex:e,turnEntryId:t,sessionId:n,cwd:s,onOpenFile:a}){let l=(0,i.useContext)(c$).get(e);return l&&0!==l.length?(0,r.jsx)("div",{className:"inline-utterance-thread","data-turn":e,"data-turn-entry":t,style:{display:"contents"},children:l.map(e=>(0,r.jsx)(cA,{utterance:e,sessionId:n,cwd:s,onOpenFile:a},e.key))}):null}function cA({utterance:e,sessionId:t,cwd:n,onOpenFile:s}){let a=iv(null===e.accountSessionId?void 0:e.accountSessionId??t,e.provider,e.credentialId,e.model),[l,o]=(0,i.useState)(!1),[c,d]=(0,i.useState)(!1),u=(0,i.useRef)(null);(0,i.useLayoutEffect)(()=>{let e=u.current;e&&!l&&d(e.scrollHeight>e.clientHeight+1)},[e.text,l]);let h=e.text.trim().length>0,p=e.label?.trim(),m=a?.alias??p??rG(e.provider),f=a?.alias.split("(",1)[0]?.trim(),g=a&&p&&p!==a.alias&&p!==f?`작업 \xb7 ${p}`:null,x=cE(a?.alias,e.status,e.key),v="failed"===e.status?"중단됨":"streaming"===e.status&&h?"작업 중":null;return(0,r.jsxs)("div",{className:"inline-utterance","data-status":e.status,style:{marginBottom:16},children:[(0,r.jsxs)("div",{className:"inline-utterance-role",style:{display:"flex",alignItems:"center",gap:9,marginBottom:2,fontSize:11,color:"var(--text-dim)",...a?{minHeight:40}:null},children:[a&&(0,r.jsx)(ik,{seed:a.seed,size:40,provider:e.provider}),(0,r.jsxs)("div",{style:{minWidth:0},children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,minWidth:0},children:[(0,r.jsx)("span",{style:{fontSize:15,fontWeight:600,color:"var(--text)"},children:m}),v&&(0,r.jsx)("span",{style:{color:"failed"===e.status?"var(--danger)":"var(--text-dim)"},children:v})]}),g&&(0,r.jsx)("div",{style:{marginTop:1,fontSize:11,lineHeight:1.35,color:"var(--text-muted)",overflowWrap:"anywhere"},children:g})]})]}),h?(0,r.jsx)("div",{ref:u,style:{fontSize:12.5,lineHeight:1.6,...l?null:{maxHeight:240,overflow:"hidden"}},children:(0,r.jsx)(nk,{isStreaming:"streaming"===e.status,cwd:n,onOpenFile:s,children:e.text})}):(0,r.jsx)("div",{role:"status",style:{color:"var(--text-muted)",fontSize:11.5,lineHeight:1.6},children:"failed"===e.status?"발화 없이 중단되었습니다":"아직 발화가 없습니다"}),h&&(c||l)&&(0,r.jsx)("button",{type:"button",onClick:()=>o(e=>!e),"aria-expanded":l,style:{marginTop:4,padding:"3px 9px",height:22,border:0,borderRadius:"var(--radius-control)",background:"var(--bg-hover)",color:"var(--text-muted)",cursor:"pointer",fontSize:11},children:l?"접기":"더보기"}),x&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("img",{src:x.src,alt:x.alt,style:{display:"block",width:"min(148px, 34vw)",maxWidth:"100%",height:"auto"},className:"jsx-e0a9ca790f024efb inline-utterance-sticker"}),(0,r.jsx)(cT(),{id:"e0a9ca790f024efb",children:".inline-utterance-sticker{transform-origin:center 75%;animation:inline-utterance-sticker-pop 200ms cubic-bezier(0,0,.15,1)both}@keyframes inline-utterance-sticker-pop{from{opacity:0;transform:scale(.88)}to{opacity:1;transform:scale(1)}}@media(prefers-reduced-motion:reduce){.inline-utterance-sticker{animation:none}}"})]})]})}let c_=/^\[character-summon alias="([^"\r\n]+)" model="([^"\r\n]+)"(?: oauth-position="\d+")?\]\r?$/mu;function cF(e,t,n,r){if("string"!=typeof n)return[];let i=c_.exec(n),s=i?.[1],a=i?.[2];return s&&a?[{toolCallId:e,...t?{name:t}:{},alias:s,model:a,batchSize:r}]:[]}function cO(e){if(!e||"assistant"!==e.role)return[];let t=[];for(let n of e.content??[]){if("toolCall"!==n.type||"task"!==n.toolName)continue;let e=n.input,r=+(void 0!==e.task)+(Array.isArray(e.tasks)?e.tasks.length:0);if(t.push(...cF(n.toolCallId,"string"==typeof e.name?e.name:void 0,e.task,r)),Array.isArray(e.tasks))for(let i of e.tasks)!i||"object"!=typeof i||Array.isArray(i)||t.push(...cF(n.toolCallId,"name"in i&&"string"==typeof i.name?i.name:void 0,"task"in i?i.task:void 0,r))}return t}function cz(e){if(!e||"assistant"!==e.role)return[];let t=[];for(let n of e.content??[])"toolCall"===n.type&&"task"===n.toolName&&t.push(n.toolCallId);return t}let cD=/^agent:\/\/([^/?#]+)\/?$/i;function cW(e,t){if(!e||"assistant"!==e.role)return[];let n=[];for(let r of e.content??[]){if("toolCall"!==r.type||"write"!==r.toolName)continue;let e=r.input,i="string"==typeof e.path?cD.exec(e.path):null,s=i?.[1],a=e.content;if(!s||"string"!=typeof a)continue;let l=t?.get(r.toolCallId);n.push({toolCallId:r.toolCallId,to:s,message:a,...l?.from?{from:l.from}:{},...l?.receipts?{receipts:l.receipts}:{}})}return n}function cH(e,t,n){for(let r of["string"==typeof e.progress?.resolvedModel?e.progress.resolvedModel.trim():"",t?.model.trim()??""]){let e=r.indexOf("/");if(e>0&&r.slice(0,e)===n)return r.slice(e+1).trim()||void 0}}let cU=["greeting","utterance","message","text"],cB=function(e){let t=(0,i.useMemo)(()=>sZ(),[]),n=function(e,t){let[n,r]=(0,i.useState)(null);return(0,i.useEffect)(()=>{if(!t)return void r(null);let n=!1,i=new AbortController;return r(null),e.getArchive(t,i.signal).then(e=>{n||r(e)}).catch(()=>{}),()=>{n=!0,i.abort()}},[e,t]),n}(t,e.sessionId),r=(0,i.useMemo)(()=>{let t=new Set(e.subagents.map(e=>e.id)),r=[];if(n&&n.sessionId===e.sessionId){let i=e.turns.flatMap(e=>e.characterSummons);for(let s of n.subagents){if(t.has(s.name))continue;let n=[...i].reverse().find(e=>e.name===s.name);n&&r.push(function(e,t,n){let r=e.status??"unknown",i={id:e.name,index:n,agent:"",agentSource:"bundled",status:r,task:e.firstTask||void 0,lastUpdate:e.modified,parentToolCallId:t.toolCallId},s="string"==typeof e.model&&e.model.trim()?e.model.trim():void 0,a="string"==typeof e.errorMessage&&e.errorMessage.trim()?e.errorMessage.trim():void 0;return(void 0!==s||void 0!==a)&&(i.progress={index:n,id:e.name,agent:"",status:r,task:e.firstTask,recentTools:[],recentOutput:[],toolCount:0,requests:0,tokens:0,cost:0,durationMs:0,...void 0!==s?{resolvedModel:s,resolvedModelIsFallback:!0===e.modelIsFallback}:{},...void 0!==a?{retryFailure:{attempt:0,errorMessage:a}}:{}}),i}(s,n,e.subagents.length+r.length))}}return function(e,t){let n=new Map;for(let t of e)for(let e of t.characterSummons){let r=n.get(e.toolCallId)??{turnIndex:t.index,requests:[]};r.requests.push(e),n.set(e.toolCallId,r)}return t.flatMap(t=>{let r=t.parentToolCallId?n.get(t.parentToolCallId):void 0;if(!r)return[];let i=r.requests.filter(e=>e.name),s="string"==typeof t.task?c_.exec(t.task):null,a=s?.[1],l=s?.[2],o=i.find(e=>e.name===t.id)??(a&&l?r.requests.find(e=>e.alias===a&&e.model===l):void 0)??(1===r.requests.length&&1===r.requests[0].batchSize?r.requests[0]:void 0);if(!o)return[];let c=e.flatMap(e=>e.peerSends.filter(e=>e.to===t.id||"all"===e.to).map(t=>({turnIndex:e.index,send:t})));return[{snapshot:t,turnIndex:r.turnIndex,summon:o,sends:c}]})}(e.turns,[...e.subagents,...r])},[e.subagents,e.turns,e.sessionId,n]),s=(0,i.useMemo)(()=>r.map(({snapshot:t})=>{let n=t.sessionFile?.split(/[\\/]/).pop()?.replace(/\.jsonl$/i,"")||t.id;return e.subagents.some(e=>e.id===t.id)?{key:t.id,liveId:t.id,status:t.status,archiveName:n}:{key:t.id,status:t.status,archiveName:n}}),[r,e.subagents]),a=oc(s,{sessionId:e.sessionId??"",client:t,enabled:!!e.sessionId&&s.length>0});return(0,i.useMemo)(()=>r.flatMap(t=>(function(e,t,n){var r;let{snapshot:i,summon:s}=e,a="completed"===(r=i.status)||"unknown"===r?"settled":"failed"===r||"aborted"===r?"failed":"streaming",l="failed"===a,o=s?.model.split("/",1)[0]?.trim()||void 0,c=l&&o?o:function(e,t,n){let r="string"==typeof e.progress?.resolvedModel?e.progress.resolvedModel.trim():"",i=r.indexOf("/");if(i>0)return r.slice(0,i);let s=t?.model.trim()??"",a=s.indexOf("/");return a>0?s.slice(0,a):n?.trim()||void 0}(i,s,n),d=i.id.trim()||void 0,u=`subagent:${i.id}`,h=[],p=e.turnIndex,m=0;if((t?.entries??[]).forEach((t,n)=>{var r;let f;if("irc"in t){let{from:n,message:r,truncated:s}=t.irc;if(s||"string"!=typeof n||"string"!=typeof r)return;for(let t=m;t<e.sends.length;t+=1){let s=e.sends[t];if(s.send.message===r&&function(e,t){if(!e.from)return!1;let n=e.receipts;return!!n&&n.some(e=>e.to===t&&("injected"===e.outcome||"woken"===e.outcome||"revived"===e.outcome))}(s.send,i.id)&&s.send.from===n){p=s.turnIndex,m=t+1;break}}return}if("assistant"!==t.message.role)return;let g=t.message.provider||c;if(!g||l&&o&&g!==o)return;let x=((f=((r=t.message).content??[]).filter(e=>"text"===e.type).map(e=>e.text.trim()).filter(e=>e.length>0).join("\n\n")).length>0?f:function(e){let t="";for(let n of e.content??[]){if("toolCall"!==n.type||"yield"!==n.toolName)continue;let e=n.input.data,r="";if("string"==typeof e)r=e;else if("object"==typeof e&&null!==e&&!Array.isArray(e))for(let t of["report",...cU]){let n=e[t];if("string"==typeof n&&n.trim().length>0){r=n;break}}let i=r.trim();i.length>0&&(t=i)}return t}(r))||(l?t.message.errorMessage?.trim()??"":"");if(0===x.length)return;let v=t.message.model||cH(i,s,g);h.push({key:`${i.id}:${n}`,turnIndex:p,speakerId:u,provider:g,...v?{model:v}:{},credentialId:t.message.credentialId,accountSessionId:null,label:l&&s?s.alias:d,text:x,status:a})}),0===h.length&&"settled"!==a&&c){let e=l?i.progress?.retryFailure?.errorMessage?.trim():void 0,t=cH(i,s,c);h.push({key:`${i.id}:pending`,turnIndex:p,speakerId:u,provider:c,...t?{model:t}:{},accountSessionId:null,label:l&&s?s.alias:d,text:e||"",status:a})}return h})(t,a.get(t.snapshot.id),e.sessionProvider)),[r,a,e.sessionProvider])},cq="web6",cV=[],cK=[],cG=function(e){let t=(0,i.useMemo)(()=>(function(e=(e,t)=>fetch(e,t),t="/api/web6/consults"){return{async listConsults(n,r){let i=n.trim();if(!i)throw Error("sessionId가 필요하다");let s=`${t}?sessionId=${encodeURIComponent(i)}`,a=await e(s,{signal:r});if(!a.ok)throw Error(`HTTP ${a.status}`);let l=await a.json(),o=l&&"object"==typeof l&&"consults"in l?l.consults:null;if(!Array.isArray(o))throw Error("consults 배열이 아니다");return o.flatMap(e=>{let t=function(e){if(!e||"object"!=typeof e||Array.isArray(e))return null;let t="string"==typeof e.sessionId?e.sessionId.trim():"";if(!t)return null;let n=e.startedAt;if("number"!=typeof n||!Number.isFinite(n))return null;let r=e.status;if("ok"!==r&&"failed"!==r)return null;let i="number"==typeof e.finishedAt&&Number.isFinite(e.finishedAt)?e.finishedAt:n,{conversationId:s,text:a,error:l}=e;return{sessionId:t,startedAt:n,finishedAt:i,elapsedMs:"number"==typeof e.elapsedMs&&Number.isFinite(e.elapsedMs)?e.elapsedMs:i-n,model:"string"==typeof e.model?e.model:"",status:r,conversationId:"string"==typeof s&&""!==s?s:void 0,text:"string"==typeof a&&""!==a?a:void 0,error:"string"==typeof l&&""!==l?l:void 0}}(e);return t?.sessionId===i?[t]:[]})}}})(),[]),[n,r]=(0,i.useState)(cK),s=(0,i.useRef)(""),a=e.sessionId??"",l=a.length>0;return(0,i.useEffect)(()=>{if(!l){s.current="",r(cK);return}let e=new AbortController,n=async()=>{if("u"<typeof document||"hidden"!==document.visibilityState)try{let n=await t.listConsults(a,e.signal),i=n.map(e=>`${e.startedAt}.${e.finishedAt}.${e.status}`).join("|");if(i===s.current)return;s.current=i,r(n)}catch{}};n();let i=setInterval(()=>void n(),5e3);return()=>{e.abort(),clearInterval(i)}},[t,l,a]),(0,i.useMemo)(()=>(function(e,t,n){if(0===e.length)return cV;let r=function(e){let t=[];for(let n=0;n<e.length;n+=1){let r=e[n];if("user"!==r.role)continue;let i=r.timestamp;"number"==typeof i&&Number.isFinite(i)&&t.push({index:n,openedAt:i})}return t}(t);if(0===r.length)return cV;let i=[];for(let t of[...e].sort((e,t)=>e.startedAt-t.startedAt)){if(t.sessionId!==n||"failed"!==t.status)continue;let e=function(e,t){let n;for(let r of e)r.openedAt>t||(!n||r.openedAt>=n.openedAt)&&(n=r);return n?.index}(r,t.startedAt);if(void 0===e)continue;let s=t.error??"";0!==s.trim().length&&i.push({key:`${cq}:${t.startedAt}:${t.finishedAt}`,turnIndex:e,provider:"web6",speakerId:`${cq}:${t.conversationId??"unknown"}`,text:s,status:"failed"})}return i.length>0?i:cV})(n,e.messages,a),[n,e.messages,a])},cJ="lab:";function cY(e){return e.startsWith(cJ)?e.slice(cJ.length).split(":",1)[0]||null:null}let cZ={now:()=>Date.now(),setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e)};function cQ(e){return e.multi&&e.options.length>1}function cX(e){return"text"===e.kind?{kind:"text",text:e.value}:{kind:"choice",checked:e.options.flatMap((e,t)=>e.checked?[t]:[]),otherOn:!1,other:""}}function c0(e,t){let n={};for(let[t,r]of e.hidden)c4(n,t,r);return e.fields.forEach((e,r)=>{let i=t[r];if(!e.name||!i)return;let s=function(e,t){if("text"===e.kind){var n,r,i="text"===t.kind?t.text:"";if(("number"===e.type||"range"===e.type)&&""!==i.trim()){let e=Number(i);if(Number.isFinite(e))return e}return i}if("choice"===t.kind){let i,s;return n=new Set(t.checked),r=t.otherOn?t.other:void 0,i=e.other?r?.trim():void 0,s=e.options.flatMap((e,t)=>n.has(t)&&!e.disabled?[e.value]:[]),cQ(e)?i?[...s,i]:s:i||s[0]}}(e,i);void 0!==s&&c4(n,e.name,s)}),n}function c1(e,t){let n={};for(let r of e.fields){if(!r.name||c5(n,r.name))continue;let e=function(e,t){if("choice"===e.kind){let n=void 0===t||Array.isArray(t)&&0===t.length;if(!e.required||!n)return;return cQ(e)?{code:"selectAtLeastOne"}:{code:"required"}}let n=void 0===t?"":String(t);if(""===n.trim())return e.required?{code:"required"}:void 0;if("number"===e.type||"range"===e.type){let t=Number(n);if(!Number.isFinite(t))return{code:"enterNumber"};if(void 0!==e.min&&t<e.min)return{code:"min",value:e.min};if(void 0!==e.max&&t>e.max)return{code:"max",value:e.max}}return void 0!==e.minLength&&n.length<e.minLength?{code:"minLength",value:e.minLength}:void 0!==e.maxLength&&n.length>e.maxLength?{code:"maxLength",value:e.maxLength}:"email"!==e.type||/^[^\s@]+@[^\s@]+$/.test(n)?"url"!==e.type||URL.canParse(n)?e.pattern&&(function(e){try{return RegExp(`^(?:${e})$`,"v")}catch{return}})(e.pattern)?.test(n)===!1?{code:"pattern",pattern:e.pattern.length>40?`${e.pattern.slice(0,39)}…`:e.pattern}:void 0:{code:"url"}:{code:"email"}}(r,c5(t,r.name));e&&c4(n,r.name,e)}return n}function c2(e){return e.map(e=>e.text).join("")}function c8(e,t,n){if(!e.multi)return{...t,checked:[n],otherOn:!1};let r=t.checked.includes(n)?t.checked.filter(e=>e!==n):[...t.checked,n].sort((e,t)=>e-t);return{...t,checked:r}}function c4(e,t,n){Object.defineProperty(e,t,{value:n,enumerable:!0,writable:!0,configurable:!0})}function c5(e,t){return Object.hasOwn(e,t)?e[t]:void 0}let c6={text:!0,search:!0,tel:!0,url:!0,email:!0,number:!0,password:!0,date:!0,time:!0,"datetime-local":!0,month:!0,week:!0,color:!0,range:!0},c3={width:"100%",minWidth:0,padding:"0 10px",borderRadius:"var(--radius-control)",background:"var(--bg)",color:"var(--text)",fontFamily:"var(--seed-font-family)",fontSize:"var(--seed-font-size-t4-static)"},c7={minHeight:36,padding:"0 12px",borderRadius:"var(--radius-control)",background:"var(--bg)",color:"var(--text-muted)",cursor:"pointer"};function c9({spans:e}){return(0,r.jsx)(r.Fragment,{children:e.map((e,t)=>{let n=[];return(e.text.split("\n").forEach((e,t)=>{t>0&&n.push((0,r.jsx)("br",{},`br-${t}`)),n.push(e)}),"code"===e.style)?(0,r.jsx)("code",{style:{padding:"0 4px",borderRadius:4,background:"var(--bg)",fontFamily:"var(--font-mono)",fontSize:"0.92em"},children:n},t):"strong"===e.style?(0,r.jsx)("strong",{style:{fontWeight:600},children:n},t):"em"===e.style?(0,r.jsx)("em",{children:n},t):(0,r.jsx)("span",{children:n},t)})})}function de({src:e,alt:t}){let{t:n}=(0,F.s)(),[s,a]=(0,i.useState)(!1);return!e||s?(0,r.jsx)("p",{style:{margin:0,color:"var(--text-muted)",fontSize:"var(--seed-font-size-t3-static)",overflowWrap:"anywhere"},children:t||n("chat.formImageUnavailable")}):(0,r.jsx)("img",{src:e,alt:t,onError:()=>a(!0),style:{display:"block",maxWidth:"100%",maxHeight:320,height:"auto",objectFit:"contain",borderRadius:"var(--radius-control)"}})}function dt({block:e,id:t}){let n={margin:0,color:"var(--text)",fontSize:"var(--seed-font-size-t4-static)",lineHeight:1.55,overflowWrap:"anywhere"};switch(e.kind){case"text":return(0,r.jsx)("p",{id:t,style:{...n,fontWeight:e.heading?600:400},children:(0,r.jsx)(c9,{spans:e.spans})});case"list":{let t=e.ordered?"ol":"ul";return(0,r.jsx)(t,{style:{...n,paddingInlineStart:22},children:e.items.map((e,t)=>(0,r.jsx)("li",{children:(0,r.jsx)(c9,{spans:e})},t))})}case"pre":return(0,r.jsx)("pre",{tabIndex:0,style:{margin:0,padding:"8px 10px",overflowX:"auto",maxWidth:"100%",borderRadius:"var(--radius-control)",background:"var(--bg)",color:"var(--text)",fontFamily:"var(--font-mono)",fontSize:"var(--seed-font-size-t3-static)",lineHeight:1.5},children:e.text});case"table":return(0,r.jsx)("div",{tabIndex:0,style:{maxWidth:"100%",overflowX:"auto",borderRadius:"var(--radius-control)",background:"var(--bg)"},children:(0,r.jsx)("table",{style:{borderCollapse:"collapse",width:"100%",fontSize:"var(--seed-font-size-t3-static)",fontVariantNumeric:"tabular-nums"},children:(0,r.jsx)("tbody",{children:e.rows.map((t,n)=>(0,r.jsx)("tr",{children:t.map((t,i)=>{let s=n<e.headerRows?"th":"td";return(0,r.jsx)(s,{scope:n<e.headerRows?"col":void 0,style:{padding:"6px 10px",background:n<e.headerRows?"var(--bg-hover)":void 0,color:n<e.headerRows?"var(--text-muted)":"var(--text)",fontWeight:n<e.headerRows?600:400,textAlign:"left",verticalAlign:"top",minWidth:72},children:(0,r.jsx)(c9,{spans:t})},i)})},n))})})});case"image":return(0,r.jsx)(de,{src:e.src,alt:e.alt})}}function dn({field:e,id:t,index:n,error:i,children:s,hasLabel:a}){let{t:l}=(0,F.s)();return(0,r.jsxs)("div",{"data-field":n,style:{display:"grid",gap:6,minWidth:0},children:[(a||e.required)&&(0,r.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:8},children:[a&&(0,r.jsx)("label",{id:`${t}-label`,htmlFor:"text"===e.kind||e.select?t:void 0,style:{color:"var(--text)",fontSize:"var(--seed-font-size-t4-static)",fontWeight:600,lineHeight:1.5},children:(0,r.jsx)(c9,{spans:e.label})}),e.required&&(0,r.jsx)("span",{style:{marginLeft:a?0:"auto",color:"var(--text-muted)",fontSize:"var(--seed-font-size-t2-static)",fontWeight:600},children:l("chat.formRequired")})]}),s,i&&(0,r.jsxs)("p",{id:`${t}-error`,style:{margin:0,display:"flex",alignItems:"flex-start",gap:6,color:"var(--danger)",fontSize:"var(--seed-font-size-t3-static)",fontWeight:500,lineHeight:1.45},children:[(0,r.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round","aria-hidden":"true",style:{flex:"none",marginTop:2},children:[(0,r.jsx)("circle",{cx:"7",cy:"7",r:"5.5"}),(0,r.jsx)("path",{d:"M7 4v3.4M7 9.6v.1"})]}),(0,r.jsx)("span",{children:function(e,t){switch(e.code){case"min":case"max":case"minLength":case"maxLength":return t(`chat.formError.${e.code}`,{value:e.value});case"pattern":return t("chat.formError.pattern",{pattern:e.pattern});default:return t(`chat.formError.${e.code}`)}}(i,l)})]})]})}function dr({field:e,id:t,index:n,state:s,error:a,captionId:l,fallbackName:o,onChange:c}){let{t:d}=(0,F.s)(),u=(0,i.useRef)(null);if("choice"!==s.kind)return null;let h=e.label.length>0,p={"aria-labelledby":h?`${t}-label`:l,"aria-label":h||l?void 0:o,"aria-required":e.required||void 0,"aria-invalid":!!a||void 0,"aria-describedby":a?`${t}-error`:void 0};if(e.select&&!e.multi)return(0,r.jsx)(dn,{field:e,id:t,index:n,error:a,hasLabel:h,children:(0,r.jsx)("select",{id:t,...p,value:String(s.checked[0]??""),onChange:t=>c(n,c8(e,s,Number(t.target.value))),style:{...c3,height:36},children:e.options.map((e,t)=>(0,r.jsx)("option",{value:t,disabled:e.disabled,children:c2(e.label)},t))})});let m=e.multi?"checkbox":"radio",f=(e,t)=>({display:"grid",gridTemplateColumns:"16px minmax(0, 1fr)",alignItems:"start",gap:9,minHeight:40,padding:"9px 10px",borderRadius:"var(--radius-control)",background:e?"var(--bg-selected)":"transparent",color:t?"var(--text-dim)":"var(--text)",cursor:t?"not-allowed":"pointer",fontSize:"var(--seed-font-size-t4-static)",lineHeight:1.5,overflowWrap:"anywhere"}),g={width:16,height:16,margin:"3px 0 0",accentColor:"var(--seed-color-fg-neutral)"},x=`${t}-choice`;return(0,r.jsx)(dn,{field:e,id:t,index:n,error:a,hasLabel:h,children:(0,r.jsxs)("div",{role:e.multi?"group":"radiogroup",...p,style:{display:"grid",gap:4},children:[e.options.map((t,i)=>{let a=s.checked.includes(i);return(0,r.jsxs)("label",{style:f(a,t.disabled),children:[(0,r.jsx)("input",{type:m,name:x,checked:a,disabled:t.disabled,"aria-required":!!e.required&&!e.multi||void 0,onChange:()=>c(n,c8(e,s,i)),style:g}),(0,r.jsx)("span",{children:(0,r.jsx)(c9,{spans:t.label})})]},i)}),e.other&&(0,r.jsxs)("div",{style:{display:"grid",gap:6},children:[(0,r.jsxs)("label",{style:f(s.otherOn,!1),children:[(0,r.jsx)("input",{type:m,name:x,checked:s.otherOn,onChange:()=>{c(n,e.multi?{...s,otherOn:!s.otherOn}:{...s,checked:[],otherOn:!0}),s.otherOn&&e.multi||u.current?.focus()},style:g}),(0,r.jsx)("span",{children:d("chat.formOther")})]}),(0,r.jsx)("input",{ref:u,type:"text",value:s.other,"aria-label":d("chat.formOther"),placeholder:d("chat.formOtherPlaceholder"),onChange:t=>{var r;let i;return c(n,(i=""!==(r=t.target.value).trim(),{...s,other:r,otherOn:!!i||s.otherOn,checked:i&&!e.multi?[]:s.checked}))},style:{...c3,height:36,width:"calc(100% - 35px)",marginInlineStart:35}})]})]})})}function di({field:e,id:t,index:n,state:i,error:s,captionId:a,fallbackName:l,onChange:o}){if("text"!==i.kind)return null;let c=e.label.length>0,d=Object.hasOwn(c6,e.type)?e.type:"text",u={id:t,value:i.text,placeholder:e.placeholder||void 0,"aria-labelledby":c?void 0:a,"aria-label":c||a?void 0:l,"aria-required":e.required||void 0,"aria-invalid":!!s||void 0,"aria-describedby":s?`${t}-error`:void 0},h=s?"color-mix(in srgb, var(--danger) 14%, var(--bg))":void 0;return(0,r.jsx)(dn,{field:e,id:t,index:n,error:s,hasLabel:c,children:e.multiline?(0,r.jsx)("textarea",{...u,rows:Math.max(2,e.rows),onChange:e=>o(n,{kind:"text",text:e.target.value}),style:{...c3,padding:"8px 10px",...h?{background:h}:{},lineHeight:1.5,resize:"vertical"}}):(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10},children:[(0,r.jsx)("input",{...u,type:d,min:"number"===d||"range"===d?e.min:void 0,max:"number"===d||"range"===d?e.max:void 0,step:"number"===d?"any":void 0,onChange:e=>o(n,{kind:"text",text:e.target.value}),style:{...c3,height:"color"===d?40:36,...h?{background:h}:{},..."range"===d?{padding:0}:{},fontVariantNumeric:"tabular-nums"}}),"range"===d&&(0,r.jsx)("output",{htmlFor:t,style:{minWidth:32,color:"var(--text-muted)",fontSize:"var(--seed-font-size-t3-static)",fontVariantNumeric:"tabular-nums"},children:i.text})]})})}function ds({request:e,onRespond:t,onActivity:n,delivery:s}){let{t:a}=(0,F.s)(),l=(0,i.useId)(),o=e.form,[c,d]=(0,i.useState)(()=>o.fields.map(cX)),u=(0,i.useRef)(c),[h,p]=(0,i.useState)(!1),m=(0,i.useRef)(null),f=(0,i.useRef)(n);f.current=n;let g=(0,i.useRef)(e);g.current=e;let x=s?.status==="sending",v=(0,i.useRef)(null);if(null===v.current){let e=Array.from(crypto.getRandomValues(new Uint8Array(12)),e=>e.toString(16).padStart(2,"0")).join(""),t=0;v.current=function(e,t=cZ){let n,r=-1/0,i=!1,s=()=>{i&&t.clearTimeout(n),i=!1,r=t.now(),e()};return{notify(){let e=1e3-(t.now()-r);e<=0?s():i||(i=!0,n=t.setTimeout(s,e))},cancel(){i&&t.clearTimeout(n),i=!1}}}(()=>{var n,r;let i=g.current;t+=1,f.current?.(i,(n=t,r=c0(i.form,u.current),`activity:form:v2:${e}:${n}:${JSON.stringify(r)}`))})}(0,i.useEffect)(()=>()=>v.current?.cancel(),[]);let y=(0,i.useCallback)((e,t)=>{let n=u.current.slice();n[e]=t,u.current=n,d(n),g.current.timeout&&f.current&&v.current?.notify()},[]),b=c0(o,c),w=h?c1(o,b):{},k=Object.keys(w).length>0,j=()=>{if(x)return;let n=c0(o,u.current),r=c1(o,n);if(Object.keys(r).length>0){p(!0);let e=o.fields.findIndex(e=>""!==e.name&&void 0!==c5(r,e.name));m.current?.querySelector(`[data-field="${e}"] input, [data-field="${e}"] select, [data-field="${e}"] textarea`)?.focus();return}t(e,{value:JSON.stringify(n)})};return(0,r.jsxs)("div",{"data-ask-form":"",style:{display:"flex",flexDirection:"column",minHeight:0},children:[(0,r.jsxs)("div",{style:{padding:"12px 16px"},children:[(0,r.jsx)("div",{style:{color:"var(--text)",fontSize:"var(--seed-font-size-t4-static)",fontWeight:600},children:a("chat.agentQuestion")}),(0,r.jsx)("div",{style:{marginTop:2,color:"var(--text-muted)",fontSize:"var(--seed-font-size-t3-static)"},children:a("chat.agentFormHint")}),e.timeout?(0,r.jsx)("div",{style:{marginTop:2,color:"var(--text-muted)",fontSize:"var(--seed-font-size-t3-static)"},children:a("chat.askFormAutoSubmitHint",{seconds:Math.round(e.timeout/1e3)})}):null]}),(0,r.jsx)("div",{ref:m,onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&"Enter"===e.key&&j()},style:{flex:"1 1 auto",minHeight:0,overflowY:"auto",overscrollBehavior:"contain",padding:16},children:(0,r.jsx)("div",{style:{display:"grid",gap:24,minWidth:0},children:o.sections.map((e,t)=>{let n,i=c2(e.title);return(0,r.jsxs)("section",{"aria-labelledby":i?`${l}-s${t}`:void 0,style:{display:"grid",gap:12,minWidth:0},children:[i&&(0,r.jsx)("h3",{id:`${l}-s${t}`,style:{margin:0,color:"var(--text-muted)",fontSize:"var(--seed-font-size-t3-static)",fontWeight:600,lineHeight:1.4},children:(0,r.jsx)(c9,{spans:e.title})}),e.blocks.map((e,s)=>{var a;let d;if("field"!==e.kind){let i=`${l}-s${t}b${s}`;return n="text"===e.kind?i:void 0,(0,r.jsx)(dt,{block:e,id:i},s)}let u=o.fields[e.index],p=n;n=void 0;let m=(a=e.index,d=o.fields[a],{id:`${l}-f${a}`,index:a,state:c[a],error:h&&d.name?c5(w,d.name):void 0,captionId:p,fallbackName:i||d.name,onChange:y});return"choice"===u.kind?(0,r.jsx)(dr,{...m,field:u},s):(0,r.jsx)(di,{...m,field:u},s)})]},t)})})}),(0,r.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",justifyContent:"flex-end",gap:8,padding:"12px 16px"},children:[k&&(0,r.jsx)("p",{role:"alert",style:{margin:0,marginRight:"auto",color:"var(--danger)",fontSize:"var(--seed-font-size-t3-static)"},children:a("chat.formInvalid")}),(0,r.jsx)("button",{type:"button",onClick:()=>t(e,{cancelled:!0}),style:c7,children:a("chat.cancel")}),(0,r.jsx)("button",{type:"button","aria-disabled":x||void 0,onClick:j,style:{minHeight:36,padding:"0 14px",borderRadius:"var(--radius-control)",background:x?"var(--seed-color-bg-disabled)":"var(--seed-color-bg-neutral-inverted)",color:x?"var(--seed-color-fg-disabled)":"var(--seed-color-fg-neutral-inverted)",cursor:x?"not-allowed":"pointer",fontWeight:600},children:a(x?"chat.responseSending":"chat.submitAnswer")})]})]})}let da={steer:"delivery.kind.steer",followUp:"delivery.kind.followUp"},dl={sending:"delivery.stage.sending",accepted:"delivery.stage.accepted",delivered:"delivery.stage.delivered",unconfirmed:"delivery.stage.unconfirmed",failed:"delivery.stage.failed"};function dc({rows:e,removeLabel:t,onRemove:n}){let s,{st:a}=iw(),[l,o]=(0,i.useState)(!1),{rows:c,hidden:d}=(s=Math.max(0,e.length-4),l||0===s?{rows:e,hidden:s}:{rows:e.slice(s),hidden:s}),u=e.length>4;return(0,i.useEffect)(()=>{u||o(!1)},[u]),(0,r.jsxs)(r.Fragment,{children:[u&&(0,r.jsx)("button",{type:"button",className:"answer-delivery-toggle","aria-expanded":l,onClick:()=>o(e=>!e),children:l?a("delivery.showRecent",{count:4}):a("delivery.showOlder",{count:d})}),(0,r.jsx)("ul",{className:"answer-delivery-list","aria-live":"polite",children:c.map(e=>{let i=iJ(e.text),s=[i?[i.message,i.documents.map(e=>e.name).join(", ")].filter(Boolean).join(" \xb7 "):e.text.trim(),e.images>0?a(1===e.images?"delivery.images.one":"delivery.images",{count:e.images}):""].filter(Boolean).join(" \xb7 ");return(0,r.jsxs)("li",{className:"answer-delivery-row","data-kind":e.kind,"data-stage":e.stage,children:[(0,r.jsx)("span",{className:"answer-delivery-kind",children:a(da[e.kind])}),(0,r.jsx)("span",{className:"answer-delivery-text",title:s,children:s}),(0,r.jsx)("span",{className:"answer-delivery-stage",children:a(dl[e.stage])}),e.removable&&n&&(0,r.jsx)("button",{type:"button",className:"answer-delivery-remove",title:t,"aria-label":`${t}: ${s}`,onClick:()=>n(e.kind,e.text),children:(0,r.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,r.jsx)("path",{d:"M18 6 6 18M6 6l12 12"})})})]},e.key)})})]})}async function dd(e,t){let n=await fetch(e,{cache:"no-store",...t}),r=await n.json();if(!n.ok)throw Error(r.error||`HTTP ${n.status}`);return r}let du=(0,i.forwardRef)(function({value:e,token:t,cwd:n,sessionTitle:s,style:a,maxHeight:l,onReplace:o,onClose:c},d){let{t:u}=(0,F.s)(),[h,p]=(0,i.useState)([]),[m,f]=(0,i.useState)(!0),[g,x]=(0,i.useState)(!1),[v,y]=(0,i.useState)(null),[b,w]=(0,i.useState)(null),[k,j]=(0,i.useState)(-1),S=(0,i.useRef)([]),C=t.query.toLowerCase(),N=h.filter(e=>`${e.title}
18
18
  ${e.body}`.toLowerCase().includes(C)),T=e.slice(0,t.start)+e.slice(t.end),I=!!T.trim(),M=N.length+ +!!I,E=(0,i.useCallback)(async()=>{p((await dd("/api/saved-prompts")).prompts)},[]);(0,i.useEffect)(()=>{let e=!1;return dd("/api/saved-prompts").then(t=>{e||p(t.prompts)}).catch(t=>{e||y(String(t.message??t))}).finally(()=>{e||f(!1)}),()=>{e=!0}},[]),(0,i.useEffect)(()=>{j(N.length>0?0:-1),w(null)},[C,h,N.length,I]),(0,i.useEffect)(()=>{S.current[k]?.scrollIntoView({block:"nearest"})},[k]);let R=r=>{var i,a;let l=new Date,c=`${l.getFullYear()}-${String(l.getMonth()+1).padStart(2,"0")}-${String(l.getDate()).padStart(2,"0")}`,d=(i=r.body,a={project_name:n?.replace(/[\\/]+$/,"").split(/[\\/]/).pop(),cwd:n,session_name:s,date:c},i.replace(/\{\{\s*([a-zA-Z_][\w]*)\s*\}\}/g,(e,t)=>(Object.hasOwn(a,t)?a[t]:void 0)||e));o(e,e.slice(0,t.start)+d+e.slice(t.end),t.start+d.length)},$=async()=>{if(!g&&I){x(!0),y(null);try{await dd("/api/saved-prompts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({body:T})}),o(e,T,t.start,!0),await E()}catch(e){y(e instanceof Error?e.message:String(e))}finally{x(!1)}}},L=async e=>{if(!g){if(b!==e)return void w(e);x(!0),y(null);try{await dd(`/api/saved-prompts/${encodeURIComponent(e)}`,{method:"DELETE"}),p(t=>t.filter(t=>t.id!==e)),w(null),await E()}catch(e){y(e instanceof Error?e.message:String(e))}finally{x(!1)}}};(0,i.useImperativeHandle)(d,()=>({handleKeyDown(e){if("Escape"===e.key)return c(),e.preventDefault(),!0;if(("ArrowDown"===e.key||"ArrowUp"===e.key)&&M>0)return e.preventDefault(),j(t=>"ArrowDown"===e.key?Math.min(M-1,t+1):t<0?M-1:Math.max(0,t-1)),!0;if("Tab"===e.key||"Enter"===e.key&&!e.shiftKey){if(k>=0&&k<M)return e.preventDefault(),g||(N[k]?R(N[k]):$()),!0;"Enter"===e.key&&c()}return!1}}));let P=e=>({width:"100%",minWidth:0,minHeight:44,borderRadius:"var(--radius-control)",padding:"8px",background:e?"var(--bg-selected)":"none",color:"var(--text)",textAlign:"left",cursor:"pointer",fontSize:12});return(0,r.jsxs)("div",{id:"saved-prompt-menu",role:"region","aria-label":u("savedPrompts.title"),"data-saved-prompt-menu":"",onMouseDown:e=>e.preventDefault(),onKeyDown:e=>{"Escape"===e.key&&(e.stopPropagation(),c())},style:{position:"absolute",left:0,right:0,zIndex:120,background:"var(--bg)",borderRadius:"var(--radius-surface)",boxShadow:"var(--shadow-float)",display:"flex",flexDirection:"column",overflow:"hidden",maxHeight:l,...a},children:[(0,r.jsx)("div",{style:{padding:"8px 10px",fontSize:11,color:"var(--text-dim)",flexShrink:0},children:m?u("savedPrompts.loading"):u("savedPrompts.title")}),(0,r.jsxs)("div",{style:{overflowY:"auto",minHeight:0,padding:4},children:[!m&&0===N.length&&(0,r.jsx)("div",{style:{padding:8,fontSize:12,color:"var(--text-dim)"},children:u("savedPrompts.empty")}),N.map((e,t)=>(0,r.jsxs)("div",{style:{display:"flex",gap:4,alignItems:"center"},children:[(0,r.jsxs)("button",{type:"button",ref:e=>{S.current[t]=e},disabled:g,"data-saved-prompt-id":e.id,onClick:()=>R(e),onMouseEnter:()=>j(t),style:P(t===k),children:[(0,r.jsx)("span",{style:{display:"block",overflowWrap:"anywhere"},children:e.title}),(0,r.jsx)("span",{style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"var(--text-dim)",fontSize:11},children:e.body.replace(/\s+/g," ")})]}),(0,r.jsx)("button",{type:"button",disabled:g,"data-delete-prompt":e.id,"aria-label":`${u("savedPrompts.delete")}: ${e.title}`,onClick:()=>void L(e.id),style:{...P(!1),width:"auto",flexShrink:0,color:"var(--danger, var(--text))"},children:u(b===e.id?"savedPrompts.confirmDelete":"savedPrompts.delete")}),b===e.id&&(0,r.jsx)("button",{type:"button",onClick:()=>w(null),style:{...P(!1),width:"auto",flexShrink:0},children:u("savedPrompts.cancel")})]},e.id)),I&&(0,r.jsx)("button",{type:"button","data-save-current-prompt":"",disabled:g||m,ref:e=>{S.current[N.length]=e},onClick:()=>void $(),onMouseEnter:()=>j(N.length),style:P(k===N.length),children:u("savedPrompts.save")})]}),v&&(0,r.jsx)("div",{role:"alert",style:{padding:"6px 10px",fontSize:12,color:"var(--danger, var(--text))",overflowWrap:"anywhere"},children:u("savedPrompts.error",{error:v})}),(0,r.jsx)("div",{style:{padding:"6px 10px",fontSize:10,color:"var(--text-dim)",overflowWrap:"anywhere",overflowY:"auto",flexShrink:0,maxHeight:"40%"},children:u("savedPrompts.hint")})]})}),dh=(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5"}),(0,r.jsx)("path",{d:"M15.54 8.46a5 5 0 0 1 0 7.07"})]}),dp=(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5"}),(0,r.jsx)("path",{d:"m22 9-6 6m0-6 6 6"})]});function dm({soundEnabled:e,onToggle:t}){let n=e?"완료음 끄기":"완료음 켜기";return(0,r.jsx)("div",{role:"group","aria-label":"오디오",style:{display:"flex",alignItems:"center",gap:6},children:(0,r.jsx)("button",{type:"button",className:`composer-icon-button${e?" is-active":""}`,onClick:t,"aria-pressed":e,title:n,"aria-label":n,children:(0,r.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e?dh:dp})})})}let df=RegExp("^(?:아|어|음|응|네|자|그럼|이제|일단|그만|좀|알았어|알겠어|아니|그래)*(?:(?:통화|전화)(?:를|좀|그만)*)?(?:좀|그만)*(?:끊어|끊어봐|끊을게|끊자|끊겠습니다|끊으라고)(?:줘|주세요|요)?$|^(?:아|어|음|응|네|자|그럼|이제|일단|그만|좀|알았어|알겠어|아니|그래)*(?:통화|전화)(?:를|좀|그만)*(?:종료|종료해|종료해봐|종료할게|종료하자|종료하라고)(?:줘|주세요|요)?$","u"),dg=["normal","slow"],dx={idle:!0,connecting:!0,live:!0,working:!0,error:!0,closed:!0};function dv(e){if("complete"===e.iceGatheringState)return Promise.resolve();let{promise:t,resolve:n}=Promise.withResolvers(),r=()=>{clearTimeout(s),e.removeEventListener("icegatheringstatechange",i),n()},i=()=>{"complete"===e.iceGatheringState&&r()},s=setTimeout(r,3e3);return e.addEventListener("icegatheringstatechange",i),t}function dy(e,t){return 401===e||"live-auth"===t?"auth":502===e||"live-upstream"===t?"upstream":"failed"}let db={unsupported:"chat.liveUnsupported","mic-denied":"chat.liveMicDenied","mic-unavailable":"chat.liveMicUnavailable",auth:"chat.liveAuthRequired",upstream:"chat.liveUpstreamFailed",failed:"chat.liveFailed"},dw=(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3z"}),(0,r.jsx)("path",{d:"M19 10v2a7 7 0 0 1-14 0v-2"}),(0,r.jsx)("line",{x1:"12",y1:"19",x2:"12",y2:"22"})]}),dk=(0,r.jsx)(r.Fragment,{children:(0,r.jsx)("rect",{x:"4",y:"4",width:"16",height:"16",rx:"3"})});function dj({sessionId:e,onEnsureSession:t,onTranscriptPersisted:n}){let{t:s}=(0,F.s)(),a=function(e,t,n){let{locale:r}=(0,F.s)(),[s,a]=(0,i.useState)("idle"),[l,o]=(0,i.useState)(null),[c,d]=(0,i.useState)(null),[u,h]=(0,i.useState)(null),[p,m]=(0,i.useState)(null),[f,g]=(0,i.useState)(!1),x=(0,i.useRef)(null),v=(0,i.useRef)(null),y=(0,i.useRef)(null),b=(0,i.useRef)(null),w=(0,i.useRef)(null),k=(0,i.useRef)(0);(0,i.useEffect)(()=>{m("u">typeof RTCPeerConnection&&"u">typeof navigator&&"function"==typeof navigator.mediaDevices?.getUserMedia)},[]);let j=(0,i.useCallback)(e=>{k.current+=1;let t=w.current;for(let e of(w.current=null,b.current?.close(),b.current=null,x.current?.close(),x.current=null,v.current?.getTracks()??[]))e.stop();v.current=null;let n=y.current;y.current=null,n&&(n.srcObject=null,n.remove()),t&&fetch(`/api/live/call/${encodeURIComponent(t)}`,{method:"DELETE"}).catch(()=>{}),a(e),h(null),g(!1)},[]),S=(0,i.useCallback)((e,t)=>{o(e),d(t??null),j("error")},[j]),C=(0,i.useCallback)(async()=>{let i,s=k.current+1;k.current=s,o(null),d(null),g(!0),a("connecting");let l=e;if(!l&&t){try{l=await t()}catch{l=void 0}if(k.current!==s)return}if(!l){k.current===s&&(g(!1),S("failed"));return}try{i=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(t){let e=t instanceof DOMException?t.name:"";k.current===s&&(g(!1),S("NotAllowedError"===e||"SecurityError"===e?"mic-denied":"mic-unavailable"));return}if(k.current!==s){for(let e of i.getTracks())e.stop();return}v.current=i;try{let e,t,o=new RTCPeerConnection;for(let e of(x.current=o,i.getTracks()))o.addTrack(e,i);let c=document.createElement("audio");if(c.autoplay=!0,y.current=c,o.ontrack=e=>{let[t]=e.streams;t&&(c.srcObject=t)},await o.setLocalDescription(await o.createOffer()),await dv(o),k.current!==s)return;let d=o.localDescription?.sdp;if(!d)throw Error("The browser produced no offer SDP.");let u=await fetch("/api/live/offer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:l,sdp:d,locale:r})}),p=await u.json().catch(()=>({})),m="",f="";if(p&&"object"==typeof p&&("error"in p&&(e=p.error),"message"in p&&"string"==typeof p.message&&(t=p.message),"callId"in p&&"string"==typeof p.callId&&(m=p.callId),"sdp"in p&&"string"==typeof p.sdp&&(f=p.sdp)),!u.ok||!m||!f){k.current===s&&(g(!1),S(dy(u.status,e),t));return}if(k.current!==s)return void fetch(`/api/live/call/${encodeURIComponent(m)}`,{method:"DELETE"}).catch(()=>{});if(await o.setRemoteDescription({type:"answer",sdp:f}),k.current!==s){o.close(),fetch(`/api/live/call/${encodeURIComponent(m)}`,{method:"DELETE"}).catch(()=>{});return}w.current=m;let v=new EventSource(`/api/live/events?callId=${encodeURIComponent(m)}`);b.current=v,v.onmessage=e=>{let t;if(k.current===s){try{t=JSON.parse(e.data)}catch{return}if(t&&"object"==typeof t&&"type"in t){if("state"===t.type&&"state"in t){var r;if("string"!=typeof t.state||(r=t.state,!0!==dx[r]))return;"closed"===t.state?j("closed"):a(t.state);return}if("transcript"===t.type&&"role"in t&&"text"in t){if(("user"===t.role||"assistant"===t.role)&&"string"==typeof t.text){let e;h({role:t.role,text:t.text}),"final"in t&&!0===t.final&&n&&Promise.resolve().then(()=>n(l)).catch(()=>{}),"final"in t&&!0===t.final&&"user"===t.role&&(e=t.text.normalize("NFC").replace(/[^\p{L}\p{N}]+/gu,"")).length>0&&df.test(e)&&j("idle")}return}"error"===t.type&&"message"in t&&"string"==typeof t.message&&S("upstream",t.message)}}},v.onerror=()=>{k.current===s&&w.current&&S("failed")},a("live")}catch(e){k.current===s&&S("failed",e instanceof Error?e.message:String(e))}finally{k.current===s&&g(!1)}},[e,t,n,r,S,j]),N=(0,i.useCallback)(()=>{if("idle"===s||"closed"===s||"error"===s){f||C();return}j("idle")},[f,s,C,j]);return(0,i.useEffect)(()=>()=>j("closed"),[j]),{state:s,failure:l,detail:c,transcript:u,supported:p,toggle:N}}(e,t,n),l="connecting"===a.state||"live"===a.state||"working"===a.state,o="connecting"===a.state?"chat.liveConnecting":"working"===a.state?"chat.liveWorking":"live"===a.state?"chat.liveOn":null,c=s(l?"chat.liveStop":"chat.liveStart"),d=!1===a.supported?db.unsupported:a.failure?db[a.failure]:null,u=!!(e||t),h=u?null:"chat.liveNeedsSession";return(0,r.jsxs)("div",{role:"group","aria-label":s("chat.liveVoice"),style:{display:"flex",alignItems:"center",gap:6,flex:"0 1 auto",minWidth:0},children:[d&&(0,r.jsx)("span",{role:"status",style:{fontSize:11,color:"var(--danger)",maxWidth:220,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:a.detail??void 0,children:s(d)}),o&&(0,r.jsx)("span",{style:{fontSize:11,color:"var(--text-muted)",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s(o)}),(0,r.jsx)("button",{type:"button",className:`composer-icon-button${l?" is-active":""}`,onClick:a.toggle,disabled:!a.supported||!u,"aria-pressed":l,title:h?s(h):c,"aria-label":h?s(h):c,children:(0,r.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l?dk:dw})})]})}let dS={display:"inline-flex",alignItems:"center",flexShrink:0,height:32,padding:"0 10px",border:0,borderRadius:"var(--radius-control)",background:"var(--accent-soft)",color:"var(--accent-hover)",fontFamily:"var(--font-mono)",fontSize:11,fontWeight:600,lineHeight:1.3,whiteSpace:"nowrap"};function dC({sessionId:e}){let{t}=(0,F.s)(),[n,s]=(0,i.useState)(null);return((0,i.useEffect)(()=>{if(!e)return void s(null);let t=!1,n=0,r=!1,i=async()=>{if("visible"===document.visibilityState)try{let n=await fetch("/api/gpt6/handles",{cache:"no-store"});if(!n.ok)return;let i=await n.json();if(t)return;let a=Array.isArray(i.handles)?i.handles:[],l=a.find(t=>t.sessionId===e&&"active"===t.status)?.handle??null;r=null!==l,s(l)}catch{}},a=async()=>{await i(),t||(n=window.setTimeout(()=>void a(),r?5e3:3e4))};return a(),document.addEventListener("visibilitychange",i),()=>{t=!0,window.clearTimeout(n),document.removeEventListener("visibilitychange",i)}},[e]),n)?(0,r.jsx)("span",{style:dS,title:t("gpt6.boundBadgeHint",{handle:n}),children:t("gpt6.boundBadge",{handle:n})}):null}let dN=new Map,dT="ompweb-drafts-for-reload-v1",dI=!1,dM=new Map,dE=new Map,dR="\0stale",d$=new Map,dL=0,dP=new Map,dA=new Map,d_=new Map,dF=new Map,dO=new Map,dz=(e,t,n)=>i2(e,t,n.length?{sentAttachmentIds:n}:{}),dD=null,dW=!1;function dH(){if(dI||"u"<typeof sessionStorage)return;dI=!0;let e=sessionStorage.getItem(dT);if(e){sessionStorage.removeItem(dT);try{let t=JSON.parse(e);if(!Array.isArray(t))return;for(let e of t){if(!Array.isArray(e)||2!==e.length||"string"!=typeof e[0])continue;let t=e[1];t&&"string"==typeof t.value&&Array.isArray(t.images)&&Array.isArray(t.documents)&&(dN.set(e[0],dB(t)),"string"==typeof t.draftId&&t.draftId&&(dM.set(e[0],t.draftId),dE.set(t.draftId,dR)),dX(e[0]))}}catch{}}}function dU(){if("u"<typeof sessionStorage)return{ok:!1,error:"sessionStorage unavailable"};try{return sessionStorage.setItem(dT,JSON.stringify([...dN.entries()].map(([e,t])=>{let n=dM.get(e);return[e,n?{...dB(t),draftId:n}:dB(t)]}))),{ok:!0}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}function dB(e){return{value:e.value,images:e.images.map(e=>({...e})),documents:e.documents.map(e=>({...e}))}}function dq(e){return!e.value&&0===e.images.length&&0===e.documents.length}function dV(e){dH();let t=dN.get(e);return t?dB(t):null}function dK(e,t){dH(),dq(t)?dN.delete(e):dN.set(e,dB(t)),dX(e)}function dG(e){dN.delete(e),dX(e)}function dJ(e,t,n,r,i,s=[]){let a=[...t??[],...r].filter(nH).slice(0,10).map(({data:e,mimeType:t})=>({data:e,mimeType:t})),l=iV([...i??[],...s]);return{value:e.trim()?n.trim()?`${e}
19
19
 
20
- ${n}`:e:n,images:a,documents:l}}function dY(e,t,n){if(e===t)return n?dB(n):dV(t);let r=dV(e),i=n&&!dq(n)?dB(n):r??(n?dB(n):null),s=dV(t),a=dM.get(e);if(dM.delete(e),a&&!dM.has(t)&&dM.set(t,a),dG(e),!i)return s;let l=s?dJ(s.value,s.images,i.value,i.images,s.documents,i.documents):i;return dK(t,l),dB(l)}function dZ(e){let t=[];for(let n of e??[])n.attachmentId&&!t.includes(n.attachmentId)&&t.push(n.attachmentId);return t}function dQ(e){dH();let t=dM.get(e);return t||(t=function(){let e=globalThis.crypto;if("function"==typeof e?.randomUUID)return e.randomUUID();let t=e.getRandomValues(new Uint8Array(16));t[6]=15&t[6]|64,t[8]=63&t[8]|128;let n=[...t].map(e=>e.toString(16).padStart(2,"0")).join("");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}(),dM.set(e,t)),t}function dX(e){let t=dZ(dN.get(e)?.documents),n=t.length?dQ(e):dM.get(e);for(let[e,n]of dA){for(let e of t)n.delete(e);0===n.size&&dA.delete(e)}let r=`${n??""}|${t.join(",")}`;dF.get(e)!==r&&(0!==t.length||n?dF.set(e,r):dF.delete(e),d6())}async function d0(e){let t=dQ(e);dP.set(t,(dP.get(t)??0)+1),await dO.get(t);let n=!1;return{draftId:t,end(e){if(n)return;n=!0;let r=(dP.get(t)??1)-1;if(r>0?dP.set(t,r):dP.delete(t),e){let n=dA.get(t)??new Set;n.add(e),dA.set(t,n)}dE.set(t,dR),d6()}}}function d1(e,t){let n=d_.get(e);if(!n)return[];for(let e of t)n.delete(e);return 0===n.size&&d_.delete(e),[...n].sort()}async function d2(){if(!dz)return;let e=[...function(){let e=new Map,t=(t,n)=>{let r=e.get(t)??new Set;for(let e of n)r.add(e);e.set(t,r)};for(let[e,n]of dM)t(n,dZ(dN.get(e)?.documents));for(let{draftId:e,ids:n}of d$.values())t(e,n);for(let[e,n]of dA)t(e,n);for(let e of dE.keys())t(e,[]);for(let e of d_.keys())t(e,[]);return new Map([...e].map(([e,t])=>[e,[...t].sort()]))}()].filter(([e,t])=>{if(dP.has(e))return!1;let n=dE.get(e);return d1(e,t).length>0||(0===t.length?void 0!==n:n!==t.join(","))}),t=dP.size>0,n=!1;for(let[r,i]of[...e.filter(([,e])=>e.length>0),...e.filter(([,e])=>0===e.length)]){if(0===i.length&&t)continue;let e=d1(r,i),s=dz(r,i,e).then(()=>{0===i.length?dE.delete(r):dE.set(r,i.join(","));let t=d_.get(r);if(t){for(let n of e)t.delete(n);0===t.size&&d_.delete(r)}},()=>{n=!0,i.length>0&&(t=!0)});dO.set(r,s),await s,dO.get(r)===s&&dO.delete(r)}n?function(){if(d5)return;d5=!0;let e=setTimeout(()=>{d5=!1,d6()},d4);"object"==typeof e&&"unref"in e&&e.unref(),d4=Math.min(2*d4,6e4)}():d4=d8}let d8=5e3,d4=5e3,d5=!1;function d6(){if(dz){if(dD){dW=!0;return}dD=Promise.resolve().then(d2).finally(()=>{dD=null,dW&&(dW=!1,d6())})}}let d3=Math.floor(Number.MAX_SAFE_INTEGER/1048576),d7=Object.freeze({uploadLimitMb:100,autoCleanupEnabled:!0,orphanGraceDays:7});function d9(e){return"number"==typeof e&&Number.isSafeInteger(e)&&e>=1&&e<=d3}async function ue(e){let t,n=await e.json().catch(()=>null);if(!e.ok||!n||!d9(n.uploadLimitMb)||"boolean"!=typeof n.autoCleanupEnabled)throw Error("string"==typeof n?.error?n.error:`HTTP ${e.status}`);return{uploadLimitMb:d9((t=n&&"object"==typeof n?n:{}).uploadLimitMb)?t.uploadLimitMb:d7.uploadLimitMb,autoCleanupEnabled:"boolean"==typeof t.autoCleanupEnabled?t.autoCleanupEnabled:d7.autoCleanupEnabled,orphanGraceDays:7}}async function ut(e={}){return ue(await fetch("/api/attachment-settings",{cache:"no-store",signal:e.signal}))}async function un(e){return ue(await fetch("/api/attachment-settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}))}function ur(e){let t=/(?:^|\s)@"([^"\n]*)$/.exec(e);if(t)return{start:e.length-(t[1].length+2),query:t[1],quoted:!0};let n=/(?:^|\s)@([^\s"]*)$/.exec(e);return n?{start:e.length-(n[1].length+1),query:n[1],quoted:!1}:null}function ui(e){let t=0;for(let n=0;n<e.length;n++)"/"===e[n]&&t++;return t}function us(e,t){if(!e)return!0;let n=0;for(let r=0;r<t.length&&n<e.length;r++)t[r]===e[n]&&n++;return n===e.length}function ua(e,t){let n=t?`${e}/`:e;return n.includes(" ")?`@"${n}" `:`@${n} `}function ul(e,t,n){let r=Math.max(1,Math.min(t,n)),i=Math.max(1,Math.max(t,n)),s=e.includes(" ")?`@"${e}"`:`@${e}`,a=r===i?`:${r}`:`:${r}-${i}`;return`${s}${a} `}let uo="omp-web:model-picks";function uc(){try{let e=JSON.parse(window.localStorage.getItem(uo)??"{}");if(!e||"object"!=typeof e||Array.isArray(e))return{};let t={};for(let[n,r]of Object.entries(e))"number"==typeof r&&Number.isFinite(r)&&r>0&&(t[n]=Math.floor(r));return t}catch{return{}}}function ud(e,t,n,r,i={}){let s=i.gap??8,a=i.margin??8,l=i.prefer??"above",o=Math.min(i.minHeight??120,Math.max(0,n-2*a)),c=Math.max(0,e-s-a),d=Math.max(0,n-t-s-a),u="above"===l?c:d,h="above"===l?d:c,p=u>=r||u>=h;return{side:p?l:"above"===l?"below":"above",maxHeight:Math.max(o,Math.min(r,p?u:h))}}function uu(e,t,n){return Math.min(e*t,n)}function uh(e,t,n){let{viewportFraction:r,cap:s,gap:a,margin:l,minHeight:o,prefer:c}=n,[d,u]=(0,i.useState)({side:c??"above",maxHeight:s}),h=(0,i.useCallback)(()=>{let t=e.current;if(!t)return;let n=window.visualViewport?.height??window.innerHeight,i=t.getBoundingClientRect(),d=ud(i.top,i.bottom,n,uu(n,r,s),{gap:a,margin:l,minHeight:o,prefer:c});u(e=>e.side===d.side&&e.maxHeight===d.maxHeight?e:d)},[e,s,a,l,o,c,r]);return(0,i.useEffect)(()=>{if(!t)return;h();let n=e.current,r=n?new ResizeObserver(h):null;return n&&r&&r.observe(n),window.addEventListener("resize",h),window.addEventListener("scroll",h,!0),window.visualViewport?.addEventListener("resize",h),window.visualViewport?.addEventListener("scroll",h),()=>{r?.disconnect(),window.removeEventListener("resize",h),window.removeEventListener("scroll",h,!0),window.visualViewport?.removeEventListener("resize",h),window.visualViewport?.removeEventListener("scroll",h)}},[e,h,t]),d}var up=n(14755);let um="omp-web:model-roles-expanded";async function uf(e,t,n,r,i,s,a){let l=e.slice(1).split(/\s/,1)[0];try{let o=t?.length?t:await a?.()??[],c=[...uM,...o].find(e=>e.name===l||"aliases"in e&&e.aliases?.includes(l));if(s&&(!c||"builtin"===c.source))return i(`/${l} cannot run with attachments. Remove them and retry.`),!1;let d=await n?.(e);if(d?.handled){if(d.error)return!1;return d.prompt&&r(d.prompt),!0}if(c&&"builtin"!==c.source)return r(e),!0;return i(`/${l} is not available in this web session.`),!1}catch(e){return i(e instanceof Error?e.message:String(e)),!1}}function ug(e){let t=e.transcription?.state;return"planning"===t||"confirm"===t||"running"===t||"fallback"===t}let ux=["off","default","full"],uv={off:"none",default:"default",full:"full"},uy=up.IN.join(" \xb7 "),ub=up.C1.filter(e=>!up.IN.includes(e)).join(" \xb7 ");function uw(e){return"above"===e?{bottom:"calc(100% + 8px)"}:{top:"calc(100% + 8px)"}}let uk=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"}),uj=0,uS={"text/markdown":"Markdown","text/plain":"Text","application/pdf":"PDF"};function uC(e,t){return uk.compare(e.name||e.modelId,t.name||t.modelId)||uk.compare(e.provider,t.provider)||uk.compare(e.modelId,t.modelId)}let uN=["auto","off","minimal","low","medium","high","xhigh","max"],uT=["low","medium","high","xhigh"],uI={auto:"chat.thinkingAuto",off:"chat.thinkingOff",minimal:"chat.thinkingMinimal",low:"chat.thinkingLow",medium:"chat.thinkingMedium",high:"chat.thinkingHigh",xhigh:"chat.thinkingXhigh",max:"chat.thinkingMax"},uM=[{name:"compact",descriptionKey:"chat.commandCompact",source:"builtin"},{name:"reload",descriptionKey:"chat.commandReload",source:"builtin"},{name:"name",descriptionKey:"chat.commandName",source:"builtin"},{name:"session",descriptionKey:"chat.commandSession",source:"builtin"},{name:"copy",descriptionKey:"chat.commandCopy",source:"builtin"}],uE=["builtin","extension","custom","mcp_prompt","prompt","file","skill"],uR={builtin:"chat.builtIn",extension:"chat.extensions",custom:"chat.customCommands",mcp_prompt:"chat.mcpPrompts",prompt:"chat.prompts",file:"chat.fileCommands",skill:"chat.skills"},u$={builtin:0,extension:1,custom:2,mcp_prompt:3,prompt:4,file:5,skill:6};function uL(e,t,n){let r=e.name.toLowerCase(),i=uP(e,n).toLowerCase();return r===t?0:r.startsWith(t)?1:r.includes(t)?2:i.includes(t)?3:4}function uP(e,t){return"descriptionKey"in e?t(e.descriptionKey):e.description??""}function uA(e,t){return"skill"===e.source&&!!e.name.startsWith("skill:")&&!0===t[e.name.slice(6)]}function u_(e){return{data:e.data,mimeType:e.mimeType}}function uF(e){return{...e,previewUrl:`data:${e.mimeType};base64,${e.data}`}}function uO(e){return(e??[]).filter(nH).slice(0,10).map(uF)}let uz=/^File saved at: (.+)\n\(([^,\n]+), (\d+) bytes\)/,uD="\n\nTranscript of the audio ";function uW(e){return iV(e).map(e=>{let t=iX(e),n="audio"===t&&e.attachmentId&&!e.text.includes(uD)?uz.exec(e.text):null;return{...e,id:++uj,status:"ready",..."audio"===t||"file"===t?{stored:t}:{},...n?{storedInfo:{path:n[1],mimeType:n[2],size:Number(n[3])}}:{}}})}function uH({name:e,mimeType:t,size:n,text:r,attachmentId:i}){return i?{name:e,mimeType:t,size:n,text:r,attachmentId:i}:{name:e,mimeType:t,size:n,text:r}}function uU(e,t){let n=new Map(t.flatMap(e=>e.attachmentId?[[e.attachmentId,e]]:[]));return[...e.map(e=>{let t=e.attachmentId?n.get(e.attachmentId):void 0;return t?(n.delete(e.attachmentId),{...e,id:t.id,sourceSize:t.sourceSize,storedInfo:t.storedInfo??e.storedInfo,transcription:t.transcription}):e}),...t.filter(e=>"ready"!==e.status)]}class uB extends Error{constructor(e,t,n,r,i=null){super(e),this.code=t,this.completedParts=n,this.parts=r,this.offer=i}}let uq="composer:unkeyed";async function uV(e){let t=await e.json().catch(()=>null),n=t&&"object"==typeof t?{...t}:{};if(e.ok)return n;let r="number"==typeof n.completedParts?n.completedParts:null,i="number"==typeof n.parts?n.parts:null,s="fallback_confirmation_required"===n.code&&"string"==typeof n.fallbackToken&&"string"==typeof n.notice&&null!==r&&null!==i?{token:n.fallbackToken,notice:n.notice,completedParts:r,parts:i}:null;throw new uB("string"==typeof n.error?n.error:`HTTP ${e.status}`,"string"==typeof n.code?n.code:null,r,i,s)}function uK(e,t){fetch(`/api/attachments/${encodeURIComponent(e)}/transcription`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({fallbackToken:t,approve:!1})}).catch(()=>void 0)}function uG(e){e.previewUrl.startsWith("blob:")&&URL.revokeObjectURL(e.previewUrl)}function uJ({tone:e,title:t,body:n}){let i="error"===e?"danger":"warning";return(0,r.jsxs)("div",{role:"alert",style:{display:"flex",alignItems:"flex-start",gap:8,maxHeight:120,marginBottom:8,padding:"7px 10px",overflowY:"auto",border:0,borderRadius:"var(--radius-control)",background:`var(--${i}-soft)`,color:`var(--${i})`,fontSize:11,lineHeight:1.45},children:[(0,r.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0,marginTop:1},"aria-hidden":"true",children:[(0,r.jsx)("path",{d:"M10.3 2.9 1.8 17a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 2.9a2 2 0 0 0-3.4 0Z"}),(0,r.jsx)("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),(0,r.jsx)("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),(0,r.jsxs)("div",{style:{minWidth:0},children:[(0,r.jsx)("div",{style:{fontWeight:600},children:t}),(0,r.jsx)("div",{style:{whiteSpace:"pre-wrap",overflowWrap:"anywhere"},children:n})]})]})}function uY({error:e}){return e?(0,r.jsx)(uJ,{tone:"error",title:"Model error",body:e}):null}function uZ({warnings:e}){return e&&0!==e.length?(0,r.jsx)(uJ,{tone:"warning",title:e.length>1?"Model scope warnings":"Model scope warning",body:e.join("\n")}):null}let uQ=(0,i.forwardRef)(function({onSend:e,onAbort:t,onSteer:n,onFollowUp:s,isStreaming:a,model:o,isAutoModelSelection:c,modelNames:d,modelList:u,modelError:h,modelScopeWarnings:p,onModelChange:m,onMainPresetChange:f,mainPresetActiveAlias:g,modelRoles:x,onRoleModelChange:v,modelSwitching:y,onCompact:b,onAbortCompaction:w,isCompacting:k,compactError:j,compactResult:S,toolPreset:C,onToolPresetChange:N,thinkingLevel:T,effectiveThinkingLevel:I,outputTokensPerSecond:M=null,outputSpeedLive:E=!1,thinkingCeiling:R,onThinkingLevelChange:$,availableThinkingLevels:L,thinkingLevelMap:P,fastMode:A=null,fastModeBusy:_=!1,onFastModeToggle:O,retryInfo:z,deliveryRows:D=[],inputHistory:W=[],onRecallQueue:H,onRemoveQueuedMessage:B,slashCommands:q,slashCommandsLoading:V,onLoadSlashCommands:K,onBuiltinCommand:G,soundEnabled:J,onSoundToggle:Y,onAudioUnlock:Z,onPromptWithStreamingBehavior:Q,draftKey:X,cwd:ee,sessionTitle:et,sessionId:en,onEnsureSession:er,onLiveTranscriptPersisted:ei},es){let ea,el,eo,ec,ed,eu,eh,ep,em,ef,{t:eg}=(0,F.s)();iy();let{st:ex}=iw(),ev=D.some(e=>e.removable),ey=U(),[eb,ew]=(0,i.useState)(()=>X?dV(X)?.value??"":""),[ek,ej]=(0,i.useState)(!1),[eS,eC]=(0,i.useState)(null),[eN,eT]=(0,i.useState)(""),[eI,eM]=(0,i.useState)({});(0,i.useEffect)(()=>{ek&&eM(uc())},[ek]);let[eE,eR]=(0,i.useState)(!1);(0,i.useEffect)(()=>{if(ek)try{eR("1"===window.localStorage.getItem(um))}catch{}},[ek]);let e$=()=>{eR(e=>{let t=!e;try{window.localStorage.setItem(um,t?"1":"0")}catch{}return t})},[eL,eP]=(0,i.useState)(!1),[eA,e_]=(0,i.useState)(null),[eF,eO]=(0,i.useState)(!1),[ez,eD]=(0,i.useState)(!1),[eW,eH]=(0,i.useState)(null),[eU,eB]=(0,i.useState)(!1),[eq,eV]=(0,i.useState)(()=>X?uO(dV(X)?.images):[]),[eK,eG]=(0,i.useState)(()=>X?uW(dV(X)?.documents):[]),[eJ,eY]=(0,i.useState)(null),eZ=(0,i.useMemo)(()=>eK.filter(e=>"ready"===e.status),[eK]),eQ=eK.some(e=>"ready"!==e.status||ug(e)),eX=eK.filter(e=>"audio"===e.stored&&e.attachmentId&&e.storedInfo&&(void 0!==e.transcription||!e.text.includes(uD))),e0=eb.trimStart(),e1=0===eq.length&&0===eK.length&&e0.startsWith("!"),e2=e1&&e0.startsWith("!!"),[e8,e4]=(0,i.useState)(!1),[e5,e6]=(0,i.useState)(0),[e3,e7]=(0,i.useState)(null),e9=e3?.value===eb&&e3.draftKey===X?e3.token:null,[te,tt]=(0,i.useState)(!1),[tn,tr]=(0,i.useState)(!1),ti=(0,i.useRef)(null),[ts,ta]=(0,i.useState)(null),[tl,to]=(0,i.useState)(!1),[tc,td]=(0,i.useState)(0),[tu,th]=(0,i.useState)(!1),[tp,tm]=(0,i.useState)(0),[tf,tg]=(0,i.useState)(null),[tx,tv]=(0,i.useState)(!1),[ty,tb]=(0,i.useState)(null),[tw,tk]=(0,i.useState)(null),tj=ee&&tw?.cwd===ee?tw.values:{},tS=(0,i.useRef)(null),tC=(0,i.useRef)(null),tN=(0,i.useRef)(null),tT=(0,i.useRef)(null),tI=(0,i.useRef)(null),tM=(0,i.useRef)(null),tE=(0,i.useRef)(null),tR=(0,i.useRef)(null),t$=(0,i.useRef)(null),tL=(0,i.useRef)(null),tP=(0,i.useRef)(null),tA=(0,i.useRef)(!1),t_=(0,i.useRef)(0),tF=(0,i.useRef)(!1),tO=(0,i.useRef)([]),tz=(0,i.useRef)([]),tD=(0,i.useRef)([]),tW=(0,i.useRef)(null),tH=(0,i.useRef)(null),tU=(0,i.useRef)(X),tB=(0,i.useRef)(eb),tq=(0,i.useRef)(eq),tV=(0,i.useRef)(0),tK=(0,i.useRef)(eK);tB.current=eb,tq.current=eq,tK.current=eK,(0,i.useImperativeHandle)(es,()=>({insertIfEmpty(e){let t=tS.current;(t?t.value:eb).trim()||(tB.current=e,ew(e),ta(null),requestAnimationFrame(()=>{t&&(t.focus(),t.style.height="auto",t.style.height=`${Math.min(t.scrollHeight,200)}px`)}))},replaceMessage(e){let t,n,r=tS.current;if(!function(e,t,n,r=0){return!e.trim()&&0===t&&0===n&&0===r}(r?r.value:eb,tq.current.length,tV.current,tK.current.length))return;let i=(t="string"==typeof e.content?e.content:e.content.filter(e=>"text"===e.type).map(e=>e.text).join("\n"),iJ(t)?.message??t),s=uO("string"==typeof e.content?[]:e.content.flatMap(e=>{if("image"!==e.type)return[];let t=e.source?.type==="base64"?e.source.data:e.data,n=e.source?.type==="base64"?e.source.media_type:e.mimeType;if("string"!=typeof t||"string"!=typeof n)return[];let r={data:t,mimeType:n};return nH(r)?[r]:[]})),a=uW((n="string"==typeof e.content?e.content:e.content.filter(e=>"text"===e.type).map(e=>e.text).join("\n"),iJ(n)?.documents??[]));tB.current=i,tq.current=s,tK.current=a,ew(i),ta(null),th(!1),eV(e=>(e.forEach(uG),s)),eG(a),requestAnimationFrame(()=>{r&&(r.focus(),r.style.height="auto",r.style.height=`${Math.min(r.scrollHeight,200)}px`)})},rekeyDraft(e,t){if(e===t)return;if(tU.current!==e)return void dY(e,t);let n={value:tB.current,images:tq.current.map(u_),documents:tK.current.filter(e=>"ready"===e.status).map(uH)},r=dY(e,t,n)??{value:"",images:[],documents:[]},i=r.value===n.value&&r.images.length===n.images.length&&r.images.every((e,t)=>e.data===n.images[t]?.data&&e.mimeType===n.images[t]?.mimeType)&&r.documents.length===n.documents.length&&r.documents.every((e,t)=>e.name===n.documents[t]?.name&&e.mimeType===n.documents[t]?.mimeType&&e.size===n.documents[t]?.size&&e.text===n.documents[t]?.text&&e.attachmentId===n.documents[t]?.attachmentId);if(tU.current=t,i)return;let s=uO(r.images),a=uU(uW(r.documents),tK.current),l=r.value;tB.current=l,tq.current=s,tK.current=a,ew(l),eV(e=>(e.forEach(uG),s)),eG(a),ta(null),th(!1)},restoreSubmission(e,t,n,r){if(!e.trim()&&!t?.length&&!n?.length)return;let i=tU.current,s=r??i,a=s===i,l=!a&&s?dV(s):null,o=dJ(e,t,a?tB.current:l?.value??"",a?tq.current.map(u_):l?.images??[],n,a?tK.current.filter(e=>"ready"===e.status).map(uH):l?.documents??[]);if(s&&dK(s,o),!a)return;let c=t?.length?[...uO(t).slice(0,Math.max(0,10-tq.current.length)),...tq.current].slice(0,10):tq.current,d=uU(uW(o.documents),tK.current);tB.current=o.value,tq.current=c,tK.current=d,ew(o.value),ta(null),th(!1),t?.length&&eV(e=>{let n=Math.max(0,10-e.length),r=uO(t).slice(0,n),i=r.length>0?[...r,...e]:e;return tq.current=i,i}),eG(d),requestAnimationFrame(()=>{let e=tS.current;e&&(e.focus(),e.setSelectionRange(e.value.length,e.value.length),e.style.height="auto",e.style.height=`${Math.min(e.scrollHeight,200)}px`)})},insertText(e){let t=tS.current;if(!t)return void ew(t=>t+(t?" ":"")+e);let n=t.selectionStart??t.value.length,r=t.selectionEnd??t.value.length,i=t.value.slice(0,n),s=t.value.slice(r),a=i.length>0&&!i.endsWith(" ")?" ":"",l=i+a+e+s;tB.current=l,ew(l),ta(null),requestAnimationFrame(()=>{if(!t)return;let r=n+a.length+e.length;t.setSelectionRange(r,r),t.focus(),t.style.height="auto",t.style.height=`${Math.min(t.scrollHeight,200)}px`})},addAttachments(e){t9(e)}}));let tG=(0,i.useCallback)(async e=>{let t=Math.max(0,10-tq.current.length-tV.current),n=e.filter(e=>e.size>0xa00000);n.length>0&&eY(eg("chat.attachImageTooLarge",{name:n.map(e=>e.name).join(", "),limit:iY(0xa00000)}));let r=e.filter(e=>e.size<=0xa00000),i=r.slice(0,t);if(i.length<r.length&&eY(eg("chat.attachImageLimit",{count:10})),i.length){tV.current+=i.length;try{let e=await Promise.all(i.map(e=>new Promise((t,n)=>{let r=new FileReader;r.onload=()=>{let n=r.result.split(",")[1];t({data:n,mimeType:e.type,previewUrl:URL.createObjectURL(e)})},r.onerror=n,r.readAsDataURL(e)})));eV(t=>{let n=e.slice(0,Math.max(0,10-t.length));e.slice(n.length).forEach(uG);let r=[...t,...n];return tq.current=r,r})}finally{tV.current-=i.length}}},[eg]),tJ=(0,i.useCallback)(async e=>{for(let t of e){let e=iH(t);if(!e)continue;if(tK.current.length>=3){eY(eg("chat.attachLimit",{count:3}));continue}if(t.size>8388608){eY(eg("chat.attachTooLarge",{name:t.name,limit:iY(8388608)}));continue}if(tK.current.reduce((e,t)=>e+t.size,0)+t.size>0x1000000){eY(eg("chat.attachTotalTooLarge",{limit:iY(0x1000000)}));continue}let n={id:++uj,name:t.name,mimeType:iz[e],size:t.size,text:"",status:"extracting"},r=[...tK.current,n];tK.current=r,eG(r);try{let e=await iK(t);if(tK.current.reduce((e,t)=>e+(t.id===n.id?0:t.text.length),0)+e.text.length>24e4)throw new iO("text_too_large","Total extracted text exceeds 240000 characters");let r=tK.current.map(t=>t.id===n.id?{...e,id:t.id,status:"ready"}:t);tK.current=r,eG(r)}catch(i){let e=tK.current.some(e=>e.id===n.id),r=tK.current.filter(e=>e.id!==n.id);if(tK.current=r,eG(r),!e)continue;i instanceof iO?"text_too_large"===i.code?eY(eg("chat.attachTextTooLarge",{name:t.name,limit:12e4.toLocaleString()})):"too_many_pages"===i.code?eY(eg("chat.attachTooManyPages",{name:t.name,limit:250})):"no_extractable_text"===i.code?eY(eg("chat.attachNoPdfText",{name:t.name})):"password_protected"===i.code?eY(eg("chat.attachPasswordProtected",{name:t.name})):eY(eg("chat.attachExtractFailed",{name:t.name})):eY(eg("chat.attachExtractFailed",{name:t.name}))}}},[eg]),tY=(0,i.useCallback)((e,t)=>{if(!tK.current.some(t=>t.id===e))return!1;let n=t?tK.current.map(n=>n.id===e?t:n):tK.current.filter(t=>t.id!==e);return tK.current=n,eG(n),!0},[]),tZ=(0,i.useCallback)((e,t)=>{if(!tK.current.some(t=>t.attachmentId===e))return!1;let n=tK.current.map(n=>n.attachmentId===e?t(n):n);return tK.current=n,eG(n),!0},[]),tQ=(0,i.useCallback)((e,t,n)=>{if(!e||e===tU.current)return;let r=dV(e);r?.documents.some(e=>e.attachmentId===t)&&dK(e,{...r,documents:uW(r.documents).map(e=>e.attachmentId===t?n(e):e).map(uH)})},[]),tX=(0,i.useRef)(new Map),t0=(0,i.useRef)(new Map),t1=(0,i.useRef)(new Set),t2=(0,i.useCallback)((e,t,n)=>{if(!e.storedInfo)return null;let r=Math.min(12e4,24e4-n.reduce((t,n)=>t+(n.attachmentId===e.attachmentId?0:n.text.length),0)),i=i0({...e.storedInfo,transcript:t},r);return i.length>r?null:{...e,text:i,size:new TextEncoder().encode(i).byteLength,transcription:void 0}},[]),t8=(0,i.useCallback)(e=>e instanceof uB&&"media_tool_unavailable"===e.code?eg("chat.transcribeToolMissing"):e instanceof uB&&"fallback_confirmation_expired"===e.code?eg("chat.transcribeFallbackExpired"):e instanceof uB&&"transcription_failed"===e.code&&null!==e.completedParts&&null!==e.parts?eg("chat.transcribePartialFailed",{done:e.completedParts,total:e.parts}):e instanceof Error?e.message:String(e),[eg]),t4=(0,i.useCallback)(async(e,t)=>{let n=tU.current,r=tK.current.find(t=>t.attachmentId===e);if(!r?.storedInfo)return;let i=r.transcription?.state==="confirm"?r.transcription.plan:null;t0.current.get(e)?.abort();let s=new AbortController;t0.current.set(e,s),tZ(e,e=>({...e,transcription:{state:"running",plan:i}}));try{let r=await uV(await fetch(`/api/attachments/${encodeURIComponent(e)}/transcription`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),signal:s.signal}));if("string"!=typeof r.transcript)throw new uB("Invalid transcription result",null,null,null);let i=r.transcript;tZ(e,e=>t2(e,i,tK.current)??{...e,transcription:{state:"failed",error:eg("chat.transcribeTooLong")}})||tQ(n,e,e=>t2(e,i,[])??e)}catch(r){if(s.signal.aborted)return void tZ(e,e=>({...e,transcription:{state:"skipped"}}));if(r instanceof uB&&"confirmation_required"===r.code)return void t5.current?.(e);let t=r instanceof uB?r.offer:null;if(t){let n={state:"fallback",reason:r instanceof Error?r.message:"",...t};tZ(e,e=>({...e,transcription:n}))||uK(e,t.token);return}let n=t8(r);tZ(e,e=>({...e,transcription:{state:"failed",error:n}}))}finally{t0.current.get(e)===s&&t0.current.delete(e)}},[eg,t8,tZ,tQ,t2]),t5=(0,i.useRef)(null),t6=(0,i.useCallback)(async e=>{let t;t0.current.get(e)?.abort();let n=new AbortController;t0.current.set(e,n),tZ(e,e=>({...e,transcription:{state:"planning"}}));try{t=function(e){if("boolean"!=typeof e.requiresConfirmation||"number"!=typeof e.estimatedCalls||"string"!=typeof e.notice||null!==e.durationSeconds&&"number"!=typeof e.durationSeconds||"direct"!==e.processing&&"compress-and-split"!==e.processing)throw new uB("Invalid transcription plan",null,null,null);return{durationSeconds:e.durationSeconds,estimatedCalls:e.estimatedCalls,requiresConfirmation:e.requiresConfirmation,processing:e.processing,notice:e.notice}}(await uV(await fetch(`/api/attachments/${encodeURIComponent(e)}/transcription`,{cache:"no-store",signal:n.signal})))}catch(t){if(n.signal.aborted)tZ(e,e=>({...e,transcription:{state:"skipped"}}));else{let n=t8(t);tZ(e,e=>({...e,transcription:{state:"failed",error:n}}))}return}finally{t0.current.get(e)===n&&t0.current.delete(e)}t.requiresConfirmation?tZ(e,e=>({...e,transcription:{state:"confirm",plan:t}})):await t4(e,{})},[t4,t8,tZ]);t5.current=t6;let t3=(0,i.useCallback)(e=>{let t=t0.current.get(e);if(t)return void t.abort();let n=tK.current.find(t=>t.attachmentId===e)?.transcription;n?.state==="fallback"&&uK(e,n.token),tZ(e,e=>({...e,transcription:{state:"skipped"}}))},[tZ]),t7=(0,i.useCallback)(async(e,t)=>{let n=null;for(let r of e){if(tK.current.length>=3){eY(eg("chat.attachLimit",{count:3}));continue}let e="file"===t&&r.size<=8388608,i={id:++uj,name:r.name,mimeType:"text/plain",size:e?r.size:0,text:"",status:e?"extracting":"uploading",sourceSize:r.size},s=[...tK.current,i];tK.current=s,eG(s);let a=(e,t)=>{let n=tK.current.filter(e=>e.id!==i.id);return e<=12e4&&n.reduce((e,t)=>e+t.text.length,0)+e<=24e4&&n.reduce((e,t)=>e+t.size,0)+t<=0x1000000};if(e){let e=await r.arrayBuffer().then(e=>{var t;return 255===(t=new Uint8Array(e))[0]&&254===t[1]?iq("utf-16le",t.subarray(2)):254===t[0]&&255===t[1]?iq("utf-16be",t.subarray(2)):t.includes(0)?null:iq("utf-8",t)??iq("euc-kr",t)},()=>null);if(null!==e&&a(e.length,r.size)){tY(i.id,{...i,text:e,status:"ready"});continue}}if(null===n&&(n=1048576*(await ut().catch(()=>d7)).uploadLimitMb),r.size>n){tY(i.id,null)&&eY(eg("chat.attachStoredTooLarge",{name:r.name,limit:iY(n)}));continue}let l={...i,stored:t,status:"uploading",size:0};if(!tY(i.id,l))continue;let o=tU.current??uq,c=await d0(o),d=null,u=new AbortController;tX.current.set(i.id,u);try{if(t1.current.has(i.id))continue;let e=await i1(r,{sessionId:en,draftId:c.draftId,signal:u.signal}),n=tK.current.filter(e=>e.id!==i.id).reduce((e,t)=>e+t.text.length,0),s=i0({path:e.path,size:e.size,mimeType:e.mimeType},Math.min(12e4,24e4-n)),h=new TextEncoder().encode(s).byteLength;if(!a(s.length,h)){tY(i.id,null)&&eY(eg("chat.attachTotalTooLarge",{limit:iY(0x1000000)}));continue}let p={...l,attachmentId:e.id,text:s,size:h,status:"ready",storedInfo:{path:e.path,size:e.size,mimeType:e.mimeType},..."audio"===t?{transcription:{state:"planning"}}:{}};if(tY(i.id,p))d=e.id;else if(!t1.current.has(i.id)&&o!==tU.current){let t=dV(o)??{value:"",images:[],documents:[]};dK(o,{...t,documents:[...t.documents,uH(p)]}),d=e.id}}catch(e){if(u.signal.aborted)continue;tY(i.id,null)&&eY(eg("chat.attachUploadFailed",{name:r.name,error:e instanceof Error?e.message:String(e)}))}finally{tX.current.delete(i.id),c.end(d)}d&&"audio"===t&&tK.current.some(e=>e.attachmentId===d)&&t6(d)}},[tY,t6,en,eg]),t9=(0,i.useCallback)(async e=>{eY(null);let{images:t,documents:n,audio:r,files:i}=function(e){let t=[],n=[],r=[],i=[];for(let s of e)s.type.startsWith("image/")?t.push(s):null!==iH(s)?n.push(s):iB(s)?r.push(s):i.push(s);return{images:t,documents:n,audio:r,files:i}}(e),s=n.filter(e=>e.size>8388608);await Promise.all([tG(t),tJ(n.filter(e=>e.size<=8388608)),t7(r,"audio"),t7([...i,...s],"file")])},[tJ,t7,tG]),ne=(0,i.useCallback)(e=>{eV(t=>{let n=[...t],[r]=n.splice(e,1);return r&&uG(r),tq.current=n,n})},[]),nt=(0,i.useCallback)(e=>{let t=tK.current.find(t=>t.id===e);if(t1.current.add(e),tX.current.get(e)?.abort(),t?.attachmentId){t0.current.get(t.attachmentId)?.abort(),t.transcription?.state==="fallback"&&uK(t.attachmentId,t.transcription.token);var n=t.attachmentId;for(let[e,t]of dA)t.delete(n)&&(0===t.size&&dA.delete(e),d6())}let r=tK.current.filter(t=>t.id!==e);tK.current=r,eG(r)},[]),nn=(0,i.useCallback)(()=>{tq.current=[],eV(e=>(e.forEach(uG),[]))},[]),nr=(0,i.useCallback)(()=>{tK.current=[],eG([])},[]),ni=(0,i.useCallback)(()=>{tB.current="",ew(""),ta(null),e7(null),tt(!1),th(!1),X&&dG(X),tU.current&&tU.current!==X&&dG(tU.current),nn(),nr(),eY(null),tS.current&&(tS.current.style.height="auto")},[nr,nn,X]);(0,i.useEffect)(()=>{X&&tU.current===X&&dK(X,{value:eb,images:eq.map(u_),documents:eZ.map(uH)})},[eq,X,eZ,eb]),(0,i.useEffect)(()=>{let e=tU.current;if(e===X)return;e&&dK(e,{value:tB.current,images:tq.current.map(u_),documents:tK.current.filter(e=>"ready"===e.status).map(uH)});let t=X?dV(X):null;tU.current=X;let n=t?.value??"",r=uO(t?.images),i=uW(t?.documents);tB.current=n,tq.current=r,tK.current=i,ew(n),ta(null),th(!1),eV(e=>(e.forEach(uG),r)),eG(i)},[X]),(0,i.useEffect)(()=>{let e=tS.current;e&&(e.style.height="auto",eb&&(e.style.height=`${Math.min(e.scrollHeight,200)}px`))},[eb]),(0,i.useEffect)(()=>()=>{tq.current.forEach(uG)},[]);let ns=(0,i.useCallback)((e,t)=>{let n=function(e,t){let n=dZ(t);if(0===n.length)return()=>{};let r=++dL;return d$.set(r,{draftId:dQ(e),ids:n}),e=>{if("accepted"!==e&&"returned"!==e)return;let t=d$.get(r);if(t){if(d$.delete(r),"accepted"===e){let e=d_.get(t.draftId)??new Set;for(let n of t.ids)e.add(n);d_.set(t.draftId,e)}d6()}}}(tU.current??uq,e);Promise.resolve(t()).then(e=>n("accepted"===e||"returned"===e?e:void 0),()=>void 0)},[]),na=(0,i.useCallback)(async()=>{let t=eb.trim(),n=e0.trim(),r=n.startsWith("/")||n.startsWith("!")?n:t;if(!r&&!eq.length&&!eZ.length||a||eQ)return;Z?.();let i=eq.length?eq:void 0,s=eZ.length?eZ:void 0;if(r.startsWith("/")){await uf(r,q,G,t=>ns(s,()=>e(t,i,s)),eY,!!(i||s),K)&&ni();return}ni(),ns(s,()=>e(r,i,s))},[eb,e0,eq,eZ,eQ,a,G,q,K,e,ni,Z,ns]),nl=!e0.startsWith("/")||e0.startsWith("//")||/\s/.test(e0.slice(1))?null:e0.slice(1).toLowerCase(),no=(()=>{if(null===nl)return[];let e=[...a?[]:uM,...q??[]],t=new Set;return[...e].filter(e=>{let t=e.name.toLowerCase(),n=uP(e,eg).toLowerCase();return t.includes(nl)||n.includes(nl)}).sort((e,t)=>{let n=uL(e,nl,eg)-uL(t,nl,eg);return 0!==n?n:u$[e.source]-u$[t.source]||uk.compare(e.name,t.name)}).filter(e=>{let n=e.name.toLowerCase();return!t.has(n)&&(t.add(n),!0)})})(),{commands:nc,groups:nd}=(ea=0,{commands:(el=uE.map(e=>{let t=no.filter(t=>t.source===e),n="skill"===e?[...t.filter(e=>!uA(e,tj)),...t.filter(e=>uA(e,tj))]:t;return{source:e,items:n.map(e=>({command:e,index:ea++}))}}).filter(e=>e.items.length>0)).flatMap(e=>e.items.map(({command:e})=>e)),groups:el}),nu=1===no.length?eg(nl?"chat.match":"chat.command"):eg(nl?"chat.matches":"chat.commands",{count:no.length}),nh=!!eb.trim(),np=!eQ&&(nh||eq.length>0||eZ.length>0),nm=(0,i.useCallback)((e,t)=>{let n=function(e,t){let n=Math.max(0,Math.min(e.length,t)),r=/(?:^|\s)(\/\/[^\s]*)$/.exec(e.slice(0,n));if(!r)return null;let i=n-r[1].length,s=/^\S*/.exec(e.slice(n))[0];return{start:i,end:n+s.length,query:e.slice(i+2,n)}}(e,t??e.length);if(e7(n?{value:e,draftKey:X,token:n}:null),tr(!1),!ee)return void ta(null);let r=t??e.length;ta(ur(e.slice(0,r)))},[ee,X]),nf=ts?.query??null,ng=i.useMemo(()=>null!==nf&&tf&&tf.cwd===ee?function(e,t,n=20){let r=t.toLowerCase();if(!r)return e.slice(0,n);let i=[];for(let t of e){let e=function(e,t){let n=e.path.toLowerCase(),r=0;if(t.includes("/"))n===t?r=100:n.startsWith(t)?r=80:n.includes(t)?r=50:us(t,n)&&(r=10);else{let e=n.lastIndexOf("/"),i=-1===e?n:n.slice(e+1);i===t?r=100:i.startsWith(t)?r=80:i.includes(t)?r=50:n.includes(t)?r=30:us(t,n)&&(r=10)}return e.isDir&&r>0&&(r+=10),r}(t,r);e>0&&i.push({entry:t,score:e})}return i.sort((e,t)=>t.score-e.score||ui(e.entry.path)-ui(t.entry.path)||e.entry.path.localeCompare(t.entry.path)),i.slice(0,n).map(e=>e.entry)}(tf.entries,nf):[],[nf,tf,ee]),nx=!!(nf&&tf?.truncated&&tf.cwd===ee);(0,i.useEffect)(()=>{if(!nx||!ee||!nf)return;let e=setTimeout(()=>{fetch(`/api/file-index?cwd=${encodeURIComponent(ee)}&q=${encodeURIComponent(nf)}`).then(e=>{if(!e.ok)throw Error(`file search failed: ${e.status}`);return e.json()}).then(e=>tb({cwd:ee,query:nf,matches:e.matches??[]})).catch(()=>{})},150);return()=>clearTimeout(e)},[nx,nf,ee]);let nv=nx&&null!==ty&&ty.cwd===ee&&ty.query===nf,ny=nv?ty.matches:ng,nb=null===ts?null:`${ts.start}:${+!!ts.quoted}:${ts.query}`;(0,i.useEffect)(()=>{if(null===nb){to(!1),td(0);return}to(!0),td(0)},[nb]);let nw=null!==ts,nk=uh(tL,tu,{viewportFraction:.44,cap:360}),nj=uh(tL,e8,{viewportFraction:.56,cap:460}),nS=uh(tL,tl,{viewportFraction:.48,cap:400}),nC=uh(tL,te,{viewportFraction:.48,cap:400}),nN=e9?`${e9.start}:${e9.end}:${e9.query}`:null;(0,i.useEffect)(()=>{tt(null!==nN)},[nN]);let nT=(0,i.useCallback)((e,t,n,r=!1)=>{tB.current===e&&tU.current===X&&(tB.current=t,ew(t),e7(null),tt(!1),tr(r),requestAnimationFrame(()=>{let e=tS.current;e&&(e.focus(),e.setSelectionRange(n,n),e.style.height="auto",e.style.height=`${Math.min(e.scrollHeight,200)}px`)}))},[X]);(0,i.useEffect)(()=>{if(!nw||!ee)return;let e=tW.current;e&&e.cwd===ee&&Date.now()-e.fetchedAt<1e4||tH.current===ee||(tH.current=ee,tv(!0),fetch(`/api/file-index?cwd=${encodeURIComponent(ee)}`).then(e=>{if(!e.ok)throw Error(`file index failed: ${e.status}`);return e.json()}).then(e=>{tg({cwd:ee,entries:function(e){let t=new Set;for(let n of e){let e=n.indexOf("/");for(;-1!==e;)t.add(n.slice(0,e)),e=n.indexOf("/",e+1)}let n=[];for(let e of t)n.push({path:e,isDir:!0});for(let t of e)t&&n.push({path:t,isDir:!1});return n.sort((e,t)=>ui(e.path)-ui(t.path)||e.path.localeCompare(t.path)),n}(e.files??[]),truncated:!!e.truncated}),tW.current={cwd:ee,fetchedAt:Date.now()}}).catch(()=>{tW.current=null}).finally(()=>{tH.current=null,tv(!1)}))},[nw,ee]);let nI=(0,i.useCallback)(e=>{if(!ts)return;let t=tS.current,n=t?.selectionStart??eb.length,r=eb.slice(0,ts.start),i=eb.slice(n);ts.quoted&&i.startsWith('"')&&(i=i.slice(1));let s=function(e,t,n=!1){let r=t?`${e}/`:e,i=n||r.includes(" ");if(t){let e=i?`@"${r}"`:`@${r}`;return{text:e,cursorOffset:i?e.length-1:e.length}}let s=i?`@"${r}" `:`@${r} `;return{text:s,cursorOffset:s.length}}(e.path,e.isDir,ts.quoted),a=r+s.text+i,l=r.length+s.cursorOffset;ew(a),ta(ur(a.slice(0,l))),requestAnimationFrame(()=>{let e=tS.current;e&&(e.focus(),e.setSelectionRange(l,l),e.style.height="auto",e.style.height=`${Math.min(e.scrollHeight,200)}px`)})},[ts,eb]);(0,i.useEffect)(()=>{tc>=ny.length&&td(Math.max(0,ny.length-1))},[ny.length,tc]),(0,i.useEffect)(()=>{tz.current.length=ny.length},[ny.length]),(0,i.useEffect)(()=>{tl&&tz.current[tc]?.scrollIntoView({block:"nearest",inline:"nearest"})},[tc,tl]),(0,i.useEffect)(()=>{tp>=W.length&&tm(Math.max(0,W.length-1))},[W.length,tp]),(0,i.useEffect)(()=>{tD.current.length=W.length},[W.length]),(0,i.useEffect)(()=>{tu&&tD.current[tp]?.scrollIntoView({block:"nearest",inline:"nearest"})},[tp,tu]);let nM=(0,i.useCallback)(e=>{tB.current=e,ew(e),th(!1),tm(0),ta(null),requestAnimationFrame(()=>{let t=tS.current;t&&(t.focus(),t.setSelectionRange(e.length,e.length),t.style.height="auto",t.style.height=`${Math.min(t.scrollHeight,200)}px`)})},[]),nE=(0,i.useCallback)(e=>{let t=`/${e.name} `;tB.current=t,ew(t),e4(!1),e6(0),requestAnimationFrame(()=>{let e=tS.current;e&&(e.focus(),e.setSelectionRange(t.length,t.length),e.style.height="auto",e.style.height=`${Math.min(e.scrollHeight,200)}px`)})},[]),nR=(0,i.useCallback)(async e=>{let t=eb.trim(),r=e0.trim(),i=r.startsWith("/")||r.startsWith("!")?r:t,a=eQ||!i&&0===eq.length&&0===eZ.length?null:{message:i,images:eq.length?eq:void 0,documents:eZ.length?eZ:void 0};if(!a)return;Z?.();let l="steer"===e?"steer":"followUp";if(i.startsWith("/")){await uf(i,q,G,e=>{if(!Q)throw Error("Cannot queue this command while the session is busy.");ns(a.documents,()=>Q(e,l,a.images,a.documents))},eY,!!(a.images?.length||a.documents?.length),K)&&ni();return}ni(),"steer"===e&&n?ns(a.documents,()=>n(a.message,a.images,a.documents)):"followup"===e&&s&&ns(a.documents,()=>s(a.message,a.images,a.documents))},[eb,e0,eq,eZ,eQ,q,K,G,Q,n,s,ni,Z,ns]),n$=(0,i.useCallback)(e=>{let t=nc.length-1;if(t<0)return 0;if("left"===e)return Math.max(0,e5-1);if("right"===e)return Math.min(t,e5+1);let n=tO.current[e5];if(!n)return"down"===e?Math.min(t,e5+1):Math.max(0,e5-1);let r=n.getBoundingClientRect(),i=r.left+r.width/2,s=r.top+r.height/2,a=-1,l=1/0;for(let n=0;n<=t;n+=1){if(n===e5)continue;let t=tO.current[n];if(!t)continue;let r=t.getBoundingClientRect(),o=r.top+r.height/2-s;if("down"===e?o<=4:o>=-4)continue;let c=1e3*Math.abs(o)+Math.abs(r.left+r.width/2-i);c<l&&(a=n,l=c)}return a>=0?a:"down"===e?Math.min(t,e5+1):Math.max(0,e5-1)},[nc.length,e5]),nL=(0,i.useCallback)(e=>{let r=e.nativeEvent,i=Date.now()-t_.current<100,l=tA.current||r.isComposing||229===r.keyCode;if("Enter"===e.key&&!e.shiftKey&&(l||i)){i&&e.preventDefault();return}if(tu&&!l){if("ArrowDown"===e.key){e.preventDefault(),tm(e=>Math.min(Math.max(0,W.length-1),e+1));return}if("ArrowUp"===e.key){e.preventDefault(),tm(e=>Math.max(0,e-1));return}if("Escape"===e.key){e.preventDefault(),th(!1);return}if(("Tab"===e.key||"Enter"===e.key&&!e.shiftKey)&&W[tp]){e.preventDefault(),nM(W[tp]);return}}if(!(te&&e9&&!l&&ti.current?.handleKeyDown(e))){if(e8&&null!==nl){if("ArrowDown"===e.key){e.preventDefault(),e6(n$("down"));return}if("ArrowUp"===e.key){e.preventDefault(),e6(n$("up"));return}if("ArrowRight"===e.key){e.preventDefault(),e6(n$("right"));return}if("ArrowLeft"===e.key){e.preventDefault(),e6(n$("left"));return}if("Escape"===e.key){e.preventDefault(),e4(!1);return}if(("Tab"===e.key||"Enter"===e.key&&!e.shiftKey)&&nc[e5]){e.preventDefault(),nE(nc[e5]);return}}if(tl&&null!==ts&&!l){if("ArrowDown"===e.key){e.preventDefault(),td(e=>Math.min(Math.max(0,ny.length-1),e+1));return}if("ArrowUp"===e.key){e.preventDefault(),td(e=>Math.max(0,e-1));return}if("Escape"===e.key){e.preventDefault(),to(!1);return}if(("Tab"===e.key||"Enter"===e.key&&!e.shiftKey)&&ny[tc]){e.preventDefault(),nI(ny[tc]);return}}if("ArrowUp"===e.key&&!l&&!a&&W.length>0&&0===eb.trim().length){e.preventDefault(),e4(!1),to(!1),tm(W.length-1),th(!0);return}if("Escape"===e.key&&!l&&a&&t){e.preventDefault(),t();return}"Enter"!==e.key||e.shiftKey||(e.preventDefault(),a&&(n||s)?nR(n?"steer":"followup"):na())}},[a,n,s,t,e8,nl,nc,e5,nE,nR,na,n$,tl,ts,ny,tc,nI,tu,W,tp,nM,eb,te,e9]),nP=(0,i.useCallback)(()=>{let e=tS.current;e&&(e.style.height="auto",e.style.height=`${Math.min(e.scrollHeight,200)}px`)},[]),nA=(0,i.useCallback)(e=>{let t=function(e){let t=Array.from(e.files??[]);if(t.length>0)return t;let n=[];for(let t of Array.from(e.items??[])){if("file"!==t.kind)continue;let e=t.getAsFile();e&&n.push(e)}return n}(e.clipboardData);t.length&&(e.preventDefault(),t9(t))},[t9]);(0,i.useEffect)(()=>{if(null===nl){e4(!1),e6(0),tF.current=!1;return}e4(!0),e6(0),!tF.current&&K&&(tF.current=!0,Promise.resolve(K()).catch(()=>{tF.current=!1}))},[nl,K]),(0,i.useEffect)(()=>{if(!e8||!ee)return;let e=!1;return tk({cwd:ee,values:{}}),fetch(`/api/skills?cwd=${encodeURIComponent(ee)}`).then(e=>{if(!e.ok)throw Error(`skills fetch failed: ${e.status}`);return e.json()}).then(t=>{if(e)return;let n={};for(let e of t.skills??[])n[e.name]=e.disableModelInvocation;tk({cwd:ee,values:n})}).catch(()=>{e||tk({cwd:ee,values:{}})}),()=>{e=!0}},[e8,ee]),(0,i.useEffect)(()=>{e5>=nc.length&&e6(Math.max(0,nc.length-1))},[nc.length,e5]),(0,i.useEffect)(()=>{tO.current.length=nc.length},[nc.length]),(0,i.useEffect)(()=>{e8&&tO.current[e5]?.scrollIntoView({block:"nearest",inline:"nearest"})},[e5,e8]);let n_=u&&u.length>0?u.map(e=>({provider:e.provider,modelId:e.id,name:e.name})).sort(uC):Object.entries(d??{}).map(([e,t])=>({provider:o?.provider??"unknown",modelId:e,name:t})).sort(uC),nF=g??null,nO=rg.find(e=>e.alias===nF)?.provider??null,nz=nO?n_.filter(e=>e.provider===nO):n_,nD=(eo=eN.trim().toLocaleLowerCase())?nz.filter(e=>`${e.name} ${e.modelId}`.toLocaleLowerCase().includes(eo)):nz,nW=nz.length>8,nU=[];for(let e of nD){let t=nU.find(t=>t.provider===e.provider);t?t.options.push(e):nU.push({provider:e.provider,options:[e]})}let nB=nO?[]:(x??[]).filter(e=>!e.hidden&&e.resolved),nq=o?nB.find(e=>e.resolved?.provider===o.provider&&e.resolved?.modelId===o.modelId):void 0,nK=eN.trim()?[]:nz.map((e,t)=>{var n,r;return{option:e,order:t,count:eI[n=e.provider,r=e.modelId,`${n}/${r}`]??0}}).filter(e=>e.count>=2).sort((e,t)=>t.count-e.count||e.order-t.order).slice(0,5).map(({option:e,count:t})=>({option:e,count:t})),nG=(e,t,n)=>{let i=e.modelId===o?.modelId&&e.provider===o?.provider;return(0,r.jsxs)("button",{onClick:()=>{if(ej(!1),eT(""),!i||c){var t,n;let r=function(e,t){let n={...e,[t]:(e[t]??0)+1},r=Object.keys(n);if(r.length<=30)return n;for(let e of(r.sort((e,t)=>n[e]-n[t]),r)){if(Object.keys(n).length<=30)break;e!==t&&delete n[e]}return n}(uc(),(t=e.provider,n=e.modelId,`${t}/${n}`));try{window.localStorage.setItem(uo,JSON.stringify(r))}catch{}eM(r),m?.(e.provider,e.modelId)}},style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"7px 12px",background:i?"var(--bg-selected)":"none",border:"none",color:i?"var(--text)":"var(--text-muted)",cursor:"pointer",fontSize:12,textAlign:"left",fontWeight:i?600:400,whiteSpace:"nowrap"},onMouseEnter:e=>{i||(e.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:e=>{i||(e.currentTarget.style.background="none")},children:[i?(0,r.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:(0,r.jsx)("polyline",{points:"1.5 5 4 7.5 8.5 2.5"})}):(0,r.jsx)("span",{style:{width:10,flexShrink:0}}),e.name,void 0!==n&&n>=2&&(0,r.jsx)("span",{style:{marginLeft:"auto",paddingLeft:12,color:"var(--text-dim)",fontFamily:"var(--font-mono)",fontSize:10.5},children:eg("chat.modelPickCount",{count:n})})]},`${t}:${e.provider}:${e.modelId}`)},nJ=o?n_.find(e=>e.modelId===o.modelId&&e.provider===o.provider)?.name??o.modelId:null,nY=S?Math.max(0,S.tokensBefore-S.estimatedTokensAfter):0,nZ=S?`${S.reason&&"manual"!==S.reason?`${S.reason[0].toUpperCase()}${S.reason.slice(1)} `:eg("chat.compacted")} ${nV(S.tokensBefore)} -> ${nV(S.estimatedTokensAfter)} tokens (${eg("chat.tokensSaved",{saved:nV(nY)})})`:null,nQ=e=>{let t=P?.[e];return null!=t&&t!==e?t:null},nX="auto"===(ec=T??"auto")?R?`auto ≤ ${nQ(R)??R}`:"auto":P?P[ec]??ec:ec,n0=(T??"auto")==="auto"&&I&&"auto"!==I?P?.[I]??I:null,n1=$&&n0?eg("chat.currentReasoning",{level:n0}):null,n2=e=>!L||L.includes(e),n8=[{level:"auto",ceiling:null},...uT.filter(n2).map(e=>({level:"auto",ceiling:e})),...uN.filter(e=>"auto"!==e&&n2(e)).map(e=>({level:e,ceiling:null}))],n4=Object.entries(uv).find(([,e])=>e===(C??"default"))?.[0]??"default";(0,i.useEffect)(()=>{let e=e=>{tC.current&&!tC.current.contains(e.target)&&tN.current&&!tN.current.contains(e.target)&&(ej(!1),eT("")),tT.current&&!tT.current.contains(e.target)&&tI.current&&!tI.current.contains(e.target)&&eP(!1),tM.current&&!tM.current.contains(e.target)&&eO(!1),tE.current&&!tE.current.contains(e.target)&&eD(!1),tR.current&&!tR.current.contains(e.target)&&eB(!1),!t$.current||t$.current.contains(e.target)||tS.current?.contains(e.target)||th(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),(0,i.useEffect)(()=>{ey||eB(!1)},[ey]);let n5=(0,r.jsx)("button",{type:"button",className:`composer-icon-button${eq.length||eK.length?" is-active":""}`,onClick:()=>tP.current?.click(),title:eg("chat.attachFile"),"aria-label":eg("chat.attachFile"),style:{flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",width:32,height:32,padding:0,background:"none",border:"none",borderRadius:"var(--radius-control)",color:eq.length||eK.length?"var(--accent)":"var(--text-muted)",cursor:"pointer",opacity:1,transition:"background 0.12s, color 0.12s"},onMouseEnter:e=>{e.currentTarget.style.background="var(--bg-hover)",e.currentTarget.style.color=eq.length||eK.length?"var(--accent)":"var(--text)"},onMouseLeave:e=>{e.currentTarget.style.background="none",e.currentTarget.style.color=eq.length||eK.length?"var(--accent)":"var(--text-muted)"},children:(0,r.jsxs)("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),(0,r.jsx)("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),(0,r.jsx)("polyline",{points:"21 15 16 10 5 21"})]})}),n6=f&&rg.length>0?(0,r.jsxs)("div",{ref:tT,style:{position:"relative",flexShrink:+!!ey,minWidth:0},children:[(0,r.jsxs)("button",{className:`${ey?"composer-icon-button":"composer-chip"}${eL?" is-active":""}`,onClick:e=>{let t=e.currentTarget.getBoundingClientRect();e_({top:t.top,bottom:t.bottom,left:t.left,width:t.width}),ej(!1),eT(""),eP(e=>!e)},disabled:a||y,"aria-haspopup":"menu","aria-expanded":eL,onKeyDown:e=>{"Escape"===e.key&&eL&&(e.stopPropagation(),eP(!1))},style:{display:"flex",alignItems:"center",gap:6,maxWidth:"100%",padding:"4px 8px",background:eL?"var(--bg-hover)":"none",border:"none",borderRadius:"var(--radius-control)",color:"var(--text-muted)",cursor:a||y?"not-allowed":"pointer",fontSize:12,opacity:a?.5:1,transition:"background 0.12s, color 0.12s"},onMouseEnter:e=>{a||y||(e.currentTarget.style.background="var(--bg-hover)",e.currentTarget.style.color="var(--text)")},onMouseLeave:e=>{e.currentTarget.style.background=eL?"var(--bg-hover)":"none",e.currentTarget.style.color="var(--text-muted)"},title:eg("chat.mainPreset"),"aria-label":eg("chat.mainPreset"),children:[(0,r.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},"aria-hidden":"true",children:(0,r.jsx)("path",{d:"M12 3l2.2 5.1 5.6.5-4.2 3.7 1.2 5.5L12 15l-4.8 2.8 1.2-5.5L4.2 8.6l5.6-.5z"})}),ey?null:(0,r.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},children:eg("chat.mainPreset")})]}),eL&&eA&&(()=>{let e=window.visualViewport?.height??window.innerHeight,{side:t,maxHeight:n}=ud(eA.top,eA.bottom,e,uu(e,.6,460),{gap:6,prefer:"above"}),i="above"===t?{bottom:e-eA.top+6}:{top:eA.bottom+6},s=ey?{left:8,right:8,maxWidth:"calc(100vw - 16px)"}:{left:eA.left,width:"max-content",minWidth:eA.width};return(0,r.jsx)("div",{ref:tI,role:"menu","aria-label":eg("chat.mainPreset"),onKeyDown:e=>{"Escape"===e.key&&(eP(!1),tT.current?.querySelector("button")?.focus())},style:{position:"fixed",...i,...s,zIndex:500,background:"var(--bg-raised)",border:0,borderRadius:"var(--radius-surface)",boxShadow:"var(--seed-shadow-s2)",overflow:"hidden",maxHeight:n,display:"flex",flexDirection:"column"},children:(0,r.jsx)("div",{style:{minHeight:0,overflowY:"auto"},children:rg.map(e=>{let t=e.alias===nF;return(0,r.jsxs)("button",{role:"menuitemradio","aria-checked":t,onClick:()=>{eP(!1),f({alias:e.alias,provider:e.provider,modelId:e.model,...void 0!==e.oauthPosition?{oauthPosition:e.oauthPosition}:{}})},title:`${e.provider}/${e.model}`,style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"7px 12px",background:t?"var(--bg-selected)":"none",border:"none",color:t?"var(--text)":"var(--text-muted)",cursor:"pointer",fontSize:12,textAlign:"left",fontWeight:t?600:400,whiteSpace:"nowrap"},onMouseEnter:e=>{t||(e.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:e=>{t||(e.currentTarget.style.background="none")},children:[t?(0,r.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:(0,r.jsx)("polyline",{points:"1.5 5 4 7.5 8.5 2.5"})}):(0,r.jsx)("span",{style:{width:10,flexShrink:0}}),(0,r.jsx)("img",{className:"account-avatar",src:rV(e.seed),width:20,height:20,alt:"","aria-hidden":"true",draggable:!1}),(0,r.jsx)("span",{children:r_(e.alias)}),(0,r.jsxs)("span",{style:{marginLeft:"auto",paddingLeft:12,color:"var(--text-dim)",fontSize:11,overflow:"hidden",textOverflow:"ellipsis"},children:[e.provider,"/",e.model,void 0!==e.oauthPosition?` \xb7 OAuth ${e.oauthPosition}`:""]})]},e.alias)})})})})()]}):null,n3=$?(0,r.jsxs)("div",{ref:tE,style:{position:"relative",flexShrink:0,minWidth:0},children:[(0,r.jsxs)("button",{type:"button",className:`${ey?"composer-icon-button":"composer-chip"}${ez?" is-active":""}`,onClick:e=>{let t=e.currentTarget.getBoundingClientRect();eH({top:t.top,bottom:t.bottom,left:t.left,width:t.width}),ej(!1),eT(""),eP(!1),eD(e=>!e)},disabled:a||y,"aria-haspopup":"menu","aria-expanded":ez,onKeyDown:e=>{"Escape"===e.key&&ez&&(e.stopPropagation(),eD(!1))},title:eg("chat.changeReasoning",{level:nX}),"aria-label":eg("chat.changeReasoning",{level:nX}),style:{display:"flex",alignItems:"center",justifyContent:"center",gap:5,padding:ey?0:"8px 12px",height:32,background:ez?"var(--bg-hover)":"none",border:"none",borderRadius:"var(--radius-control)",color:"var(--text-muted)",cursor:a||y?"not-allowed":"pointer",fontSize:12,opacity:a?.5:1,transition:"background 0.12s, color 0.12s"},onMouseEnter:e=>{a||y||(e.currentTarget.style.background="var(--bg-hover)",e.currentTarget.style.color="var(--text)")},onMouseLeave:e=>{e.currentTarget.style.background=ez?"var(--bg-hover)":"none",e.currentTarget.style.color="var(--text-muted)"},children:[(0,r.jsxs)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},"aria-hidden":"true",children:[(0,r.jsx)("path",{d:"M9.5 2A5.5 5.5 0 0 0 4 7.5c0 1.7.78 3.21 2 4.21V14a1 1 0 0 0 1 1h5a1 1 0 0 0 1-1v-2.29c1.22-1 2-2.51 2-4.21A5.5 5.5 0 0 0 9.5 2z"}),(0,r.jsx)("line",{x1:"7",y1:"18",x2:"12",y2:"18"}),(0,r.jsx)("line",{x1:"8",y1:"21",x2:"11",y2:"21"})]}),ey?null:(0,r.jsx)("span",{style:{whiteSpace:"nowrap"},children:nX})]}),ez&&eW&&(()=>{let e=window.visualViewport?.height??window.innerHeight,{side:t,maxHeight:n}=ud(eW.top,eW.bottom,e,uu(e,.6,460),{gap:6,prefer:"above"}),i="above"===t?{bottom:e-eW.top+6}:{top:eW.bottom+6},s=ey?{left:8,right:8,maxWidth:"calc(100vw - 16px)"}:{left:eW.left,width:"max-content",minWidth:Math.max(180,eW.width)};return(0,r.jsx)("div",{role:"menu","aria-label":eg("chat.changeReasoningLabel"),onKeyDown:e=>{"Escape"===e.key&&(eD(!1),tE.current?.querySelector("button")?.focus())},style:{position:"fixed",...i,...s,zIndex:500,background:"var(--bg-raised)",border:0,borderRadius:"var(--radius-surface)",boxShadow:"var(--seed-shadow-s2)",overflowY:"auto",maxHeight:n},children:n8.map(({level:e,ceiling:t})=>{let n=(T??"auto")===e&&("auto"!==e||(R??null)===t),i=t??e,s="auto"===e&&null===t?null:nQ(i),a=t?`auto ≤ ${s??t}`:s??e,l=t?eg("chat.thinkingAutoCapped",{level:s??t}):eg(uI[e]);return(0,r.jsxs)("button",{type:"button",role:"menuitemradio","aria-checked":n,onClick:()=>{eD(!1),$(e,t)},style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"7px 12px",background:n?"var(--bg-selected)":"none",border:"none",color:n?"var(--text)":"var(--text-muted)",cursor:"pointer",fontSize:12,textAlign:"left",fontWeight:n?600:400,whiteSpace:"nowrap"},onMouseEnter:e=>{n||(e.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:e=>{n||(e.currentTarget.style.background="none")},children:[n?(0,r.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:(0,r.jsx)("polyline",{points:"1.5 5 4 7.5 8.5 2.5"})}):(0,r.jsx)("span",{style:{width:10,flexShrink:0}}),(0,r.jsxs)("span",{style:{flex:1},children:[a,null!==s&&(0,r.jsxs)("span",{style:{fontSize:10,color:"var(--text-dim)",fontFamily:"var(--font-mono)",marginLeft:5},children:["(",i,")"]})]}),(0,r.jsx)("span",{style:{fontSize:11,color:"var(--text-dim)",marginLeft:8},children:l})]},t?`auto-${t}`:e)})})})()]}):null,n7=O?(ed=_?eg("chat.fastModeBusy"):null===A?eg("chat.fastModeUnknown"):A.active?eg("chat.fastModeActive"):A.enabled?eg("chat.fastModeInactive"):eg("chat.fastModeOff"),eu=_||a||y,eh=A?.enabled===!0,(0,r.jsx)("button",{type:"button",className:`composer-icon-button${A?.active?" is-active":""}`,onClick:O,disabled:eu,"aria-pressed":null===A?void 0:A.enabled,"aria-busy":_||void 0,title:ed,"aria-label":ed,style:{flexShrink:0,opacity:a?.5:1},children:(0,r.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:A?.active?"var(--accent)":"none",stroke:eh?"var(--accent)":"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",strokeDasharray:null===A?"3 2":void 0,style:{opacity:eh&&!A?.active?.6:1},"aria-hidden":"true",children:(0,r.jsx)("path",{d:"M13 2 4 14h7l-1 8 9-12h-7l1-8z"})})})):null,n9=(0,r.jsxs)(r.Fragment,{children:[n&&(0,r.jsxs)("button",{className:"composer-stream-action is-warning",onClick:()=>nR("steer"),disabled:!np,title:eQ?eg("chat.attachExtractingWait"):eg("chat.steerTitle"),style:{display:"flex",alignItems:"center",gap:5,padding:"7px 12px",background:np?"var(--warning-soft)":"var(--bg-hover)",border:0,borderRadius:"var(--radius-control)",color:np?"var(--warning)":"var(--text-dim)",cursor:np?"pointer":"not-allowed",fontSize:13,fontWeight:600,letterSpacing:"-0.01em",transition:"background 0.12s"},children:[(0,r.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("path",{d:"M5 1 L9 5 L5 9"}),(0,r.jsx)("line",{x1:"1",y1:"5",x2:"9",y2:"5"})]}),eg("chat.steer")]}),s&&(0,r.jsxs)("button",{className:"composer-stream-action is-followup",onClick:()=>nR("followup"),disabled:!np,title:eQ?eg("chat.attachExtractingWait"):eg("chat.followUpTitle"),style:{display:"flex",alignItems:"center",gap:5,padding:"7px 12px",background:np?"var(--bg-selected)":"var(--bg-hover)",border:0,borderRadius:"var(--radius-control)",color:np?"var(--text)":"var(--text-dim)",cursor:np?"pointer":"not-allowed",fontSize:13,fontWeight:600,letterSpacing:"-0.01em",transition:"background 0.12s"},children:[(0,r.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("line",{x1:"5",y1:"1",x2:"5",y2:"6"}),(0,r.jsx)("polyline",{points:"2.5 3.5 5 1 7.5 3.5"}),(0,r.jsx)("line",{x1:"2",y1:"9",x2:"8",y2:"9"})]}),eg("chat.followUp")]})]}),re=void 0!==Y?(0,r.jsx)(dm,{soundEnabled:J??!0,onToggle:Y}):null;return(0,r.jsxs)("div",{className:"chat-composer",style:{flexShrink:0,background:"transparent",padding:"0 16px 8px"},children:[(0,r.jsx)("input",{ref:tP,type:"file",multiple:!0,style:{display:"none"},onChange:e=>{t9(Array.from(e.target.files??[])),e.target.value=""}}),(0,r.jsxs)("div",{className:"chat-column-cap",style:{maxWidth:"var(--reading-measure)",margin:"0 auto"},children:[(0,r.jsx)(uY,{error:h}),(0,r.jsx)(uZ,{warnings:p}),D.length>0&&(0,r.jsxs)("div",{style:{marginBottom:8,border:0,borderRadius:"var(--radius-control)",background:"var(--bg-subtle)",padding:"5px 0"},children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,padding:"2px 8px 4px 10px"},children:[(0,r.jsx)("span",{style:{fontSize:12,fontWeight:600,color:"var(--text-muted)"},children:ex("delivery.title",{count:D.length})}),H&&ev&&(0,r.jsxs)("button",{onClick:H,title:eg("chat.recallTitle"),style:{display:"flex",alignItems:"center",gap:6,padding:"4px 12px",fontSize:12,color:"var(--text)",background:"var(--bg-hover)",border:0,borderRadius:"var(--radius-control)",cursor:"pointer",transition:"background 0.12s",whiteSpace:"nowrap"},onMouseEnter:e=>{e.currentTarget.style.background="var(--bg-selected)"},onMouseLeave:e=>{e.currentTarget.style.background="var(--bg-hover)"},children:[(0,r.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("polyline",{points:"9 14 4 9 9 4"}),(0,r.jsx)("path",{d:"M20 20v-7a4 4 0 0 0-4-4H4"})]}),eg("chat.recall")]})]}),(0,r.jsx)(dc,{rows:D,removeLabel:eg("chat.queueRemove"),onRemove:B?(e,t)=>B("steer"===e?"steering":"followUp",t):void 0})]}),z&&(0,r.jsxs)("div",{style:{marginBottom:8,padding:"5px 10px",background:"var(--warning-soft)",border:0,borderRadius:"var(--radius-control)",fontSize:12,color:"var(--warning)",display:"flex",alignItems:"center",gap:6},children:[(0,r.jsxs)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[(0,r.jsx)("path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}),(0,r.jsx)("path",{d:"M3 3v5h5"})]}),eg("chat.retrying",{attempt:z.attempt,max:z.maxAttempts}),z.errorMessage&&(0,r.jsxs)("span",{style:{opacity:.7,marginLeft:4},children:["— ",z.errorMessage]})]}),nZ&&(0,r.jsxs)("div",{style:{marginBottom:8,padding:"5px 10px",background:"var(--success-soft)",border:0,borderRadius:"var(--radius-control)",fontSize:12,color:"var(--success)",display:"flex",alignItems:"center",gap:6},children:[(0,r.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:(0,r.jsx)("polyline",{points:"20 6 9 17 4 12"})}),nZ]}),j&&(0,r.jsx)("div",{role:"alert",style:{marginBottom:8,padding:"7px 10px",background:"var(--danger-soft)",border:0,borderRadius:"var(--radius-control)",color:"var(--danger)",fontFamily:"var(--font-mono)",fontSize:12,lineHeight:1.5,whiteSpace:"pre-wrap",overflowWrap:"anywhere"},children:j}),eJ&&(0,r.jsxs)("div",{role:"alert",style:{display:"flex",alignItems:"center",gap:8,marginBottom:8,padding:"7px 10px",background:"var(--danger-soft)",border:0,borderRadius:"var(--radius-control)",color:"var(--danger)",fontSize:12,lineHeight:1.5},children:[(0,r.jsx)("span",{style:{flex:1,minWidth:0,overflowWrap:"anywhere"},children:eJ}),(0,r.jsx)("button",{type:"button",onClick:()=>eY(null),"aria-label":eg("i18n.close"),title:eg("i18n.close"),style:{flexShrink:0,width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",padding:0,border:"none",background:"transparent",color:"inherit",cursor:"pointer"},children:(0,r.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round","aria-hidden":"true",children:[(0,r.jsx)("line",{x1:"2",y1:"2",x2:"10",y2:"10"}),(0,r.jsx)("line",{x1:"10",y1:"2",x2:"2",y2:"10"})]})})]}),(eq.length>0||eK.length>0)&&(0,r.jsxs)("div",{role:"list","aria-label":eg("chat.attachments"),style:{display:"flex",alignItems:"center",gap:6,marginBottom:6,flexWrap:"wrap"},children:[eq.map((e,t)=>(0,r.jsxs)("div",{role:"listitem",style:{position:"relative",flexShrink:0},children:[(0,r.jsx)("img",{src:e.previewUrl,alt:"",style:{width:56,height:56,objectFit:"cover",borderRadius:"var(--radius-control)",display:"block"}}),(0,r.jsx)("button",{type:"button","aria-label":eg("chat.removeImage",{index:t+1}),onClick:()=>ne(t),style:{position:"absolute",top:-4,right:-4,width:16,height:16,borderRadius:"50%",background:"var(--bg-raised)",border:0,boxShadow:"var(--shadow-float)",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",padding:0,color:"var(--text-muted)"},children:(0,r.jsxs)("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round","aria-hidden":"true",children:[(0,r.jsx)("line",{x1:"1",y1:"1",x2:"7",y2:"7"}),(0,r.jsx)("line",{x1:"7",y1:"1",x2:"1",y2:"7"})]})})]},`image-${t}`)),eK.map(e=>(0,r.jsxs)("div",{className:"composer-chip",role:"listitem","aria-busy":"ready"!==e.status||ug(e)||void 0,style:{display:"flex",alignItems:"center",gap:7,minWidth:0,maxWidth:320,height:32,padding:"0 7px 0 9px"},children:["ready"!==e.status||e.transcription?.state==="planning"||e.transcription?.state==="running"?(0,r.jsx)("span",{"aria-hidden":"true",className:"workbench-lamp",style:{animation:"lamp-breathe 1.2s ease-in-out infinite"}}):i$(e.name,14),(0,r.jsxs)("span",{style:{minWidth:0,display:"flex",flexDirection:"column",lineHeight:1.15},children:[(0,r.jsx)("span",{title:e.name,style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"var(--text)",fontSize:12},children:e.name}),(0,r.jsxs)("span",{style:{color:"var(--text-dim)",fontSize:10},children:["audio"===e.stored?eg("chat.attachKindAudio"):"file"===e.stored?eg("chat.attachKindFile"):uS[e.mimeType]," \xb7 ",iY(e.sourceSize??e.size),"extracting"===e.status?` \xb7 ${eg("chat.attachExtracting")}`:"","uploading"===e.status?` \xb7 ${eg("chat.attachUploading")}`:"",e.transcription?.state==="planning"?` \xb7 ${eg("chat.transcribeChecking")}`:"",e.transcription?.state==="confirm"||e.transcription?.state==="fallback"?` \xb7 ${eg("chat.attachTranscribePending")}`:"",e.transcription?.state==="running"?` \xb7 ${eg("chat.attachTranscribing")}`:"",e.transcription?.state==="failed"&&(0,r.jsx)("span",{style:{color:"var(--danger)"},children:` \xb7 ${eg("chat.attachTranscribeFailed")}`})]})]}),(0,r.jsx)("button",{type:"button",onClick:()=>nt(e.id),"aria-label":eg("chat.removeAttachment",{name:e.name}),title:eg("chat.removeAttachment",{name:e.name}),style:{width:24,height:24,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",padding:0,border:"none",background:"transparent",color:"var(--text-muted)",cursor:"pointer"},children:(0,r.jsxs)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round","aria-hidden":"true",children:[(0,r.jsx)("line",{x1:"1.5",y1:"1.5",x2:"8.5",y2:"8.5"}),(0,r.jsx)("line",{x1:"8.5",y1:"1.5",x2:"1.5",y2:"8.5"})]})})]},e.id))]}),eX.length>0&&(0,r.jsx)("div",{role:"group","aria-label":eg("chat.transcribeGroup"),"aria-live":"polite",style:{display:"flex",flexDirection:"column",gap:6,marginBottom:6},children:eX.map(e=>{let t,n,i,s,a=e.attachmentId,o=e.transcription,c=o?.state==="confirm"||o?.state==="running"?o.plan:null,d=c?eg("chat.transcribePlanSummary",{duration:null===c.durationSeconds?eg("chat.transcribeDurationUnknown"):(n=Math.floor((t=Math.round(c.durationSeconds))/3600),i=Math.floor(t%3600/60),s=String(t%60).padStart(2,"0"),n>0?`${n}:${String(i).padStart(2,"0")}:${s}`:`${i}:${s}`),calls:c.estimatedCalls}):null,u=o?.state==="confirm"?eg("chat.transcribeConfirmTitle",{name:e.name}):o?.state==="fallback"?eg("chat.transcribeFallbackTitle",{name:e.name}):o?.state==="running"?eg("chat.transcribeRunning",{name:e.name}):o?.state==="planning"?`${e.name} \xb7 ${eg("chat.transcribeChecking")}`:o?.state==="failed"?eg("chat.transcribeFailedRow",{name:e.name,error:o.error}):eg("chat.transcribeSkipped",{name:e.name});return(0,r.jsxs)("div",{"data-transcription-state":o?.state??"idle",style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:8,padding:"7px 10px",border:0,borderRadius:"var(--radius-control)",background:o?.state==="failed"?"var(--danger-soft)":"var(--bg-panel)",fontSize:12,lineHeight:1.45},children:[(0,r.jsxs)("div",{style:{flex:"1 1 220px",minWidth:0},children:[(0,r.jsx)("div",{style:{color:o?.state==="failed"?"var(--danger)":"var(--text)",overflowWrap:"anywhere"},children:u}),d&&(0,r.jsx)("div",{style:{color:"var(--text-dim)",fontVariantNumeric:"tabular-nums"},children:d}),o?.state==="confirm"&&(0,r.jsxs)(r.Fragment,{children:[o.plan.notice&&(0,r.jsx)("div",{style:{color:"var(--text-dim)",overflowWrap:"anywhere"},children:o.plan.notice}),(0,r.jsx)("div",{style:{color:"var(--text-dim)"},children:eg("chat.transcribeUsageNotice")})]}),o?.state==="fallback"&&(0,r.jsxs)(r.Fragment,{children:[o.reason&&(0,r.jsx)("div",{style:{color:"var(--text-dim)",overflowWrap:"anywhere"},children:o.reason}),o.completedParts>0&&(0,r.jsx)("div",{style:{color:"var(--text-dim)",fontVariantNumeric:"tabular-nums"},children:eg("chat.transcribeFallbackProgress",{done:o.completedParts,total:o.parts})}),(0,r.jsx)("div",{style:{color:"var(--text-dim)",overflowWrap:"anywhere"},children:o.notice}),(0,r.jsx)("div",{style:{color:"var(--text-dim)"},children:eg("chat.transcribeFallbackUsageNotice")})]})]}),(0,r.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:[o?.state==="confirm"&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(l.r,{type:"button",variant:"neutralSolid",size:"small",onClick:()=>void t4(a,{confirmed:!0}),children:eg("chat.transcribeStart")}),(0,r.jsx)(l.r,{type:"button",variant:"neutralWeak",size:"small",onClick:()=>t3(a),children:eg("chat.transcribeSkip")})]}),o?.state==="fallback"&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(l.r,{type:"button",variant:"neutralSolid",size:"small",onClick:()=>void t4(a,{fallbackToken:o.token,approve:!0}),children:eg("chat.transcribeFallbackStart")}),(0,r.jsx)(l.r,{type:"button",variant:"neutralWeak",size:"small",onClick:()=>t3(a),children:eg("chat.transcribeSkip")})]}),(o?.state==="planning"||o?.state==="running")&&(0,r.jsx)(l.r,{type:"button",variant:"neutralWeak",size:"small",onClick:()=>t3(a),children:eg("chat.transcribeCancel")}),(void 0===o||"skipped"===o.state||"failed"===o.state)&&(0,r.jsx)(l.r,{type:"button",variant:"neutralWeak",size:"small",onClick:()=>void t6(a),children:eg(o?.state==="failed"?"chat.transcribeRetry":"chat.transcribeAction")})]})]},e.id)})}),(0,r.jsxs)("div",{ref:tL,style:{position:"relative",minWidth:0},children:[tu&&W.length>0&&(0,r.jsxs)("div",{ref:t$,style:{position:"absolute",left:0,right:0,...uw(nk.side),zIndex:120,background:"var(--bg-raised)",border:0,borderRadius:"var(--radius-surface)",boxShadow:"var(--seed-shadow-s3)",overflow:"hidden",maxHeight:nk.maxHeight},children:[(0,r.jsx)("div",{title:"Input history",style:{height:30,padding:"0 10px",background:"var(--bg-subtle)",display:"flex",alignItems:"center",color:"var(--text-dim)"},children:(0,r.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,r.jsx)("path",{d:"M3 12a9 9 0 1 0 3-6.7"}),(0,r.jsx)("path",{d:"M3 4v5h5"}),(0,r.jsx)("path",{d:"M12 7v5l3 2"})]})}),(0,r.jsx)("div",{style:{maxHeight:Math.max(0,nk.maxHeight-31),overflowY:"auto",padding:4},children:W.map((e,t)=>{let n=t===tp;return(0,r.jsxs)("button",{ref:e=>{tD.current[t]=e},type:"button",onMouseDown:t=>{t.preventDefault(),nM(e)},onMouseEnter:()=>tm(t),style:{width:"100%",display:"flex",alignItems:"flex-start",gap:8,padding:"7px 8px",border:"none",borderRadius:"var(--radius-control)",background:n?"var(--bg-selected)":"none",color:"var(--text)",cursor:"pointer",textAlign:"left",fontSize:12.5,lineHeight:1.45},children:[(0,r.jsx)("span",{style:{flexShrink:0,fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-dim)",paddingTop:1},children:t+1}),(0,r.jsx)("span",{style:{minWidth:0,display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:2,overflow:"hidden",overflowWrap:"anywhere"},children:e})]},`${t}:${e}`)})})]}),tn&&(0,r.jsx)("div",{role:"status",style:{fontSize:12,color:"var(--text-dim)",padding:"4px 8px"},children:eg("savedPrompts.saved")}),te&&e9&&(0,r.jsx)(du,{ref:ti,value:eb,token:e9,cwd:ee,sessionTitle:et,style:uw(nC.side),maxHeight:nC.maxHeight,onReplace:nT,onClose:()=>tt(!1)}),e8&&null!==nl&&(0,r.jsxs)("div",{style:{position:"absolute",left:0,right:0,...uw(nj.side),zIndex:120,background:"var(--bg-raised)",border:0,borderRadius:"var(--radius-surface)",boxShadow:"var(--seed-shadow-s3)",overflow:"hidden",maxHeight:nj.maxHeight},children:[(0,r.jsxs)("div",{style:{padding:"8px 10px",background:"var(--bg-subtle)",display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,fontSize:11,color:"var(--text-dim)"},children:[(0,r.jsx)("span",{children:V?eg("chat.loadingCommands"):eg("chat.slashCommands",{label:nu})}),(0,r.jsx)("span",{style:{fontFamily:"var(--font-mono)"},children:eg("chat.tabEnter")})]}),(0,r.jsx)("div",{style:{maxHeight:Math.max(0,nj.maxHeight-34),overflowY:"auto",padding:10},children:V||0!==no.length?nd.map(e=>(0,r.jsxs)("section",{style:{marginBottom:12},children:[(0,r.jsxs)("div",{style:{position:"sticky",top:-10,zIndex:1,display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,padding:"4px 0 6px",background:"var(--bg)",color:"var(--text-dim)",fontSize:10,fontWeight:600,textTransform:"uppercase"},children:[(0,r.jsx)("span",{children:eg(uR[e.source])}),(0,r.jsx)("span",{style:{fontFamily:"var(--font-mono)",fontWeight:500},children:e.items.length})]}),(0,r.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",gap:8},children:e.items.map(({command:e,index:t})=>{let n=t===e5,i=uA(e,tj);return(0,r.jsxs)("button",{ref:e=>{tO.current[t]=e},type:"button",onMouseDown:t=>{t.preventDefault(),nE(e)},onMouseEnter:()=>e6(t),style:{width:"100%",minWidth:0,minHeight:58,display:"flex",flexDirection:"column",gap:4,justifyContent:"center",padding:"9px 10px",border:0,borderRadius:"var(--radius-control)",background:n?"var(--bg-selected)":"var(--bg-subtle)",color:"var(--text)",cursor:"pointer",textAlign:"left"},children:[(0,r.jsxs)("span",{style:{fontSize:13,fontFamily:"var(--font-mono)",overflowWrap:"anywhere",wordBreak:"break-word",color:i?"var(--text-dim)":void 0},children:["/",e.name,i&&(0,r.jsx)("span",{style:{marginLeft:6,padding:"0 4px",background:"var(--bg-hover)",borderRadius:"var(--radius-control)",fontSize:9,color:"var(--text-dim)",whiteSpace:"nowrap"},children:eg("chat.dormant")})]}),uP(e,eg)&&(0,r.jsx)("span",{style:{display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:2,overflow:"hidden",fontSize:11,lineHeight:1.35,color:"var(--text-dim)"},children:uP(e,eg)})]},`${e.source}:${e.name}`)})})]},e.source)):(0,r.jsx)("div",{style:{padding:"2px 2px 4px",fontSize:12,color:"var(--text-dim)"},children:eg("chat.noCommands")})})]}),tl&&null!==ts&&(ep=tx&&(!tf||tf.cwd!==ee),em=1===ny.length?eg("chat.match"):eg("chat.matches",{count:ny.length}),ef=tf?.truncated&&!nv?ts.query?eg("chat.searchingAll"):eg("chat.indexTruncated"):"",(0,r.jsxs)("div",{style:{position:"absolute",left:0,right:0,...uw(nS.side),zIndex:120,background:"var(--bg-raised)",border:0,borderRadius:"var(--radius-surface)",boxShadow:"var(--seed-shadow-s3)",overflow:"hidden",maxHeight:nS.maxHeight},children:[(0,r.jsxs)("div",{style:{padding:"8px 10px",background:"var(--bg-subtle)",display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,fontSize:11,color:"var(--text-dim)"},children:[(0,r.jsx)("span",{children:ep?eg("chat.loadingFiles"):eg("chat.files",{label:em,hint:ef})}),(0,r.jsx)("span",{style:{fontFamily:"var(--font-mono)"},children:eg("chat.tabEnter")})]}),(0,r.jsx)("div",{style:{maxHeight:Math.max(0,nS.maxHeight-34),overflowY:"auto",padding:4},children:ep||0!==ny.length?ny.map((e,t)=>{let n=t===tc,i=e.path.split("/").pop()??e.path,s=e.path.slice(0,e.path.length-i.length);return(0,r.jsxs)("button",{ref:e=>{tz.current[t]=e},type:"button",onMouseDown:t=>{t.preventDefault(),nI(e)},onMouseEnter:()=>td(t),style:{width:"100%",display:"flex",alignItems:"center",gap:8,padding:"6px 8px",border:"none",borderRadius:"var(--radius-control)",background:n?"var(--bg-selected)":"none",color:"var(--text)",cursor:"pointer",textAlign:"left",fontSize:12.5,fontFamily:"var(--font-mono)"},children:[(0,r.jsx)("span",{style:{flexShrink:0,display:"flex",alignItems:"center"},children:e.isDir?(0,r.jsx)(iM,{size:14}):i$(i,14)}),(0,r.jsxs)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[s&&(0,r.jsx)("span",{style:{color:"var(--text-dim)"},children:s}),i,e.isDir&&(0,r.jsx)("span",{style:{color:"var(--text-dim)"},children:"/"})]})]},`${e.isDir?"d":"f"}:${e.path}`)}):(0,r.jsx)("div",{style:{padding:"6px 8px",fontSize:12,color:"var(--text-dim)"},children:nx&&!nv?eg("chat.searching"):eg("chat.noMatchingFiles")})})]})),(0,r.jsxs)("div",{className:`chat-composer-field${e1?" is-bash":""}${a?" is-streaming":""}`,style:{minWidth:0,display:"flex",gap:8,alignItems:"center",background:"var(--bg)",border:0,borderRadius:"var(--seed-radius-r3)",padding:"10px 10px 10px 14px",transition:"background 0.15s"},children:[(0,r.jsx)("textarea",{className:"chat-composer-textarea",ref:tS,"aria-controls":te?"saved-prompt-menu":void 0,value:eb,onChange:e=>{tB.current=e.target.value,ew(e.target.value),th(!1),nm(e.target.value,e.target.selectionStart)},onSelect:e=>{let t=e.currentTarget;nm(t.value,t.selectionStart)},onKeyDown:nL,onCompositionStart:()=>{tA.current=!0},onCompositionEnd:e=>{tA.current=!1,t_.current=Date.now();let t=e.currentTarget;nm(t.value,t.selectionStart)},onInput:nP,onPaste:nA,placeholder:a&&(n||s)?eg("chat.steerPlaceholder"):a?eg("chat.agentPlaceholder"):eg("chat.messagePlaceholder"),rows:1,style:{flex:1,minWidth:0,width:"100%",background:"none",border:"none",outline:"none",resize:"none",color:"var(--text)",fontSize:14,lineHeight:1.6,fontFamily:"inherit",minHeight:24,maxHeight:200,overflow:"auto"}}),a?ey?null:(0,r.jsx)("div",{style:{display:"flex",alignItems:"center",gap:6,flexShrink:0,alignSelf:"flex-end"},children:n9}):(0,r.jsxs)("button",{className:"chat-composer-send",onClick:na,disabled:!np,"aria-busy":eQ||void 0,"aria-label":ey?eg("chat.send"):void 0,title:eQ?eg("chat.attachExtractingWait"):void 0,style:{flexShrink:0,alignSelf:"flex-end",display:"flex",alignItems:"center",justifyContent:"center",gap:6,minWidth:ey?44:void 0,padding:ey?0:"7px 14px",background:np?"var(--accent-soft)":"var(--bg-raised)",border:"none",borderRadius:"var(--radius-control)",color:np?"var(--accent-hover)":"var(--text-dim)",cursor:np?"pointer":"not-allowed",fontSize:13,fontWeight:600,letterSpacing:"-0.01em",transition:"background 0.15s, color 0.15s"},children:[(0,r.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("line",{x1:"2",y1:"7",x2:"11",y2:"7"}),(0,r.jsx)("polyline",{points:"7.5 3 12 7 7.5 11"})]}),ey?null:eg("chat.send")]})]})]}),e1&&(0,r.jsxs)("div",{className:"text-xs px-2 py-1",style:{color:e2?"var(--text-muted)":"var(--accent)",marginTop:4},children:[eg("chat.shell")," \xb7 ",e2?eg("chat.outputLocal"):eg("chat.outputModel")]}),(0,r.jsxs)("div",{className:"composer-action-bar",style:{marginTop:8,display:"flex",alignItems:"center",gap:6},children:[(0,r.jsxs)("div",{style:{flex:ey?"1 1 0%":"0 0 auto",minWidth:ey?"min-content":0,display:"flex",alignItems:"center",gap:2},children:[(!ey||!a)&&n5,!ey&&n6,!(ey&&a)&&(n_.length>0||nJ||h)&&m&&(0,r.jsxs)("div",{ref:tC,style:{position:"relative",flex:ey?"1 1 0%":void 0,width:ey?0:void 0,minWidth:44*!!ey},children:[(0,r.jsxs)("button",{className:`composer-chip${ek?" is-active":""}`,onClick:e=>{let t=e.currentTarget.getBoundingClientRect();eC({top:t.top,bottom:t.bottom,left:t.left,width:t.width}),ej(e=>(e&&eT(""),!e))},disabled:a||y,"aria-busy":y||void 0,style:{display:"flex",alignItems:"center",gap:6,justifyContent:ey?"flex-start":void 0,padding:ey?"8px 10px":"8px 12px",height:32,width:ey?"100%":void 0,maxWidth:ey?"100%":220,overflow:"hidden",background:ek?"var(--bg-hover)":"none",border:"none",borderRadius:"var(--radius-control)",color:"var(--text-muted)",cursor:a||y?"not-allowed":"pointer",fontSize:12,opacity:a?.5:1,transition:"background 0.12s, color 0.12s"},onMouseEnter:e=>{a||y||(e.currentTarget.style.background="var(--bg-hover)",e.currentTarget.style.color="var(--text)")},onMouseLeave:e=>{e.currentTarget.style.background=ek?"var(--bg-hover)":"none",e.currentTarget.style.color="var(--text-muted)"},title:y?"Switching model":n_.length>0?"Change model":"No available models",children:[y?(0,r.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",style:{animation:"spin 0.8s linear infinite",flexShrink:0},"aria-hidden":"true",children:(0,r.jsx)("path",{d:"M21 12a9 9 0 1 1-2.64-6.36"})}):(0,r.jsxs)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"}),(0,r.jsx)("rect",{x:"9",y:"9",width:"6",height:"6"}),(0,r.jsx)("line",{x1:"9",y1:"1",x2:"9",y2:"4"}),(0,r.jsx)("line",{x1:"15",y1:"1",x2:"15",y2:"4"}),(0,r.jsx)("line",{x1:"9",y1:"20",x2:"9",y2:"23"}),(0,r.jsx)("line",{x1:"15",y1:"20",x2:"15",y2:"23"}),(0,r.jsx)("line",{x1:"20",y1:"9",x2:"23",y2:"9"}),(0,r.jsx)("line",{x1:"20",y1:"14",x2:"23",y2:"14"}),(0,r.jsx)("line",{x1:"1",y1:"9",x2:"4",y2:"9"}),(0,r.jsx)("line",{x1:"1",y1:"14",x2:"4",y2:"14"})]}),(0,r.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},children:nJ??(n_.length>0?"Select model":"No models")})]}),ek&&eS&&(()=>{let e=window.visualViewport?.height??window.innerHeight,{side:t,maxHeight:n}=ud(eS.top,eS.bottom,e,uu(e,.6,460),{gap:6,prefer:"above"}),i="above"===t?{bottom:e-eS.top+6}:{top:eS.bottom+6},s=ey?{left:8,right:8,maxWidth:"calc(100vw - 16px)"}:{left:eS.left,width:"max-content",minWidth:eS.width};return(0,r.jsxs)("div",{ref:tN,style:{position:"fixed",...i,...s,zIndex:500,background:"var(--bg-raised)",border:0,borderRadius:"var(--radius-surface)",boxShadow:"var(--seed-shadow-s2)",overflow:"hidden",maxHeight:n,display:"flex",flexDirection:"column"},children:[nW&&(0,r.jsx)("div",{style:{padding:"6px 8px",flexShrink:0},children:(0,r.jsx)("input",{value:eN,onChange:e=>eT(e.target.value),onKeyDown:e=>{"Escape"===e.key&&(eT(""),ej(!1))},placeholder:eg("chat.filterModels"),"aria-label":eg("chat.filterModels"),autoFocus:!0,autoComplete:"off",spellCheck:!1,style:{width:"100%",minWidth:220*!ey,fontSize:11,fontFamily:"var(--font-mono)",padding:"5px 8px",border:0,borderRadius:"var(--radius-control)",outline:"none",background:"var(--bg)",color:"var(--text)",boxSizing:"border-box"}})}),(0,r.jsxs)("div",{style:{minHeight:0,overflowY:"auto"},children:[nK.length>0&&(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{style:{padding:"6px 12px 4px",fontSize:10,fontWeight:600,color:"var(--text-dim)",textTransform:"uppercase",letterSpacing:"0.07em"},children:eg("chat.frequentModels")}),nK.map(({option:e,count:t})=>nG(e,"frequent",t))]}),nB.length>0&&!eN.trim()&&v&&(0,r.jsxs)("div",{style:{marginTop:6*(nK.length>0)},children:[(0,r.jsxs)("button",{type:"button",className:"model-role-disclosure","aria-expanded":eE,"aria-controls":"model-role-rows",onClick:e$,style:{display:"flex",alignItems:"center",gap:6,width:"100%",minHeight:32,padding:"6px 12px 4px",background:"none",border:"none",cursor:"pointer",textAlign:"left",fontSize:10,fontWeight:600,color:"var(--text-dim)",letterSpacing:"0.07em",whiteSpace:"nowrap"},children:[(0,r.jsx)("svg",{width:"8",height:"8",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{flexShrink:0,transform:eE?"rotate(90deg)":"none",transition:"transform 120ms"},children:(0,r.jsx)("polyline",{points:"3 1.5 7 5 3 8.5"})}),(0,r.jsx)("span",{style:{textTransform:"uppercase"},children:eg("chat.modelRoles")}),(0,r.jsx)("span",{style:{fontFamily:"var(--font-mono)"},children:nB.length}),nq&&(0,r.jsxs)("span",{style:{marginLeft:"auto",overflow:"hidden",textOverflow:"ellipsis",color:"var(--text-muted)",letterSpacing:0},children:[(0,r.jsx)("span",{style:{fontFamily:"var(--font-mono)",color:"var(--accent)",marginRight:6},children:nq.tag??nq.role.toUpperCase()}),nq.name]})]}),(0,r.jsx)("div",{id:"model-role-rows",hidden:!eE,children:nB.map(e=>{let t=nq?.role===e.role,n=e.resolved?.name??e.resolved?.modelId??"";return(0,r.jsxs)("button",{onClick:()=>{ej(!1),eT(""),v(e.role)},title:e.selector??n,style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"7px 12px",background:t?"var(--bg-selected)":"none",border:"none",color:t?"var(--text)":"var(--text-muted)",cursor:"pointer",fontSize:12,textAlign:"left",whiteSpace:"nowrap"},onMouseEnter:e=>{t||(e.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:e=>{t||(e.currentTarget.style.background="none")},children:[t?(0,r.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:(0,r.jsx)("polyline",{points:"1.5 5 4 7.5 8.5 2.5"})}):(0,r.jsx)("span",{style:{width:10,flexShrink:0}}),(0,r.jsx)("span",{style:{flexShrink:0,minWidth:58,padding:"1px 6px",borderRadius:"var(--radius-control)",border:0,background:"var(--bg-hover)",color:t?"var(--accent)":"var(--text-dim)",fontFamily:"var(--font-mono)",fontSize:9.5,fontWeight:700,letterSpacing:"0.06em",textAlign:"center"},children:e.tag??e.role.toUpperCase()}),(0,r.jsx)("span",{style:{fontWeight:t?600:500},children:e.name}),(0,r.jsxs)("span",{style:{marginLeft:"auto",paddingLeft:12,color:"var(--text-dim)",fontSize:11,overflow:"hidden",textOverflow:"ellipsis"},children:[n,e.resolved?.thinkingLevel?` \xb7 ${e.resolved.thinkingLevel}`:""]})]},e.role)})}),(0,r.jsx)("div",{style:{padding:"6px 12px 4px",fontSize:11,fontWeight:600,color:"var(--text-muted)",marginTop:4},children:eg("chat.allModels")})]}),0===nU.length?(0,r.jsx)("div",{style:{padding:"8px 12px",color:"var(--text-dim)",fontSize:12,whiteSpace:"nowrap"},children:eN.trim()?eg("chat.noMatchingModels"):"No available models"}):nU.map((e,t)=>(0,r.jsxs)("div",{children:[nU.length>1&&(0,r.jsx)("div",{style:{padding:"6px 12px 4px",fontSize:10,fontWeight:600,color:"var(--text-dim)",textTransform:"uppercase",letterSpacing:"0.07em",marginTop:6*(t>0)},children:e.provider}),e.options.map(e=>nG(e,"all"))]},e.provider))]})]})})()]}),ey&&a&&(0,r.jsx)("div",{style:{display:"flex",alignItems:"center",gap:6,minWidth:0},children:n9}),!ey&&n3,!ey&&n7,!ey&&n1&&(0,r.jsx)("span",{style:{flexShrink:0,padding:"0 6px",fontSize:12,color:"var(--text-muted)",whiteSpace:"nowrap"},children:n1}),!ey&&null!==M&&(0,r.jsx)("span",{title:eg(E?"chat.outputSpeedLiveTitle":"chat.outputSpeedTitle"),style:{flexShrink:0,padding:"0 6px",fontSize:12,color:"var(--text-muted)",whiteSpace:"nowrap",fontVariantNumeric:"tabular-nums"},children:eg(E?"chat.outputSpeedLive":"chat.outputSpeed",{rate:M>=10?Math.round(M):M.toFixed(1)})}),(0,r.jsx)(dC,{sessionId:en})]}),(0,r.jsxs)("div",{ref:tR,style:{flex:"0 1 auto",minWidth:0,display:"flex",alignItems:"center",justifyContent:"flex-end",position:"relative",marginLeft:"auto",gap:ey?4:2},children:[ey?(0,r.jsx)("button",{type:"button",className:`composer-icon-button${eU?" is-active":""}`,title:eg("chat.moreControls"),"aria-label":eg("chat.moreControls"),"aria-expanded":eU,onClick:()=>{ej(!1),eT(""),eB(e=>!e)},children:(0,r.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:[(0,r.jsx)("line",{x1:"4",y1:"7",x2:"20",y2:"7"}),(0,r.jsx)("line",{x1:"4",y1:"17",x2:"20",y2:"17"}),(0,r.jsx)("circle",{cx:"10",cy:"7",r:"2.2"}),(0,r.jsx)("circle",{cx:"16",cy:"17",r:"2.2"})]})}):(0,r.jsx)(l.r,{type:"button",variant:"neutralWeak",size:"small",layout:"withText",title:eU?void 0:eg("chat.moreControls"),"aria-label":eg("chat.moreControls"),"aria-expanded":eU,onClick:()=>{ej(!1),eT(""),eB(e=>!e)},children:eg("chat.moreControls")}),(0,r.jsxs)("div",{className:"composer-run-options",role:"group","aria-label":eg("chat.moreControls"),style:{display:eU?ey?"grid":"flex":"none",gridTemplateColumns:ey?"repeat(3, minmax(0, max-content))":void 0,alignItems:"center",gap:1,position:"absolute",right:0,bottom:"100%",marginBottom:"var(--seed-dimension-x1)",zIndex:60,padding:1,width:"max-content",maxWidth:"calc(100vw - 32px)",flexWrap:"wrap",justifyContent:"flex-end",border:0,borderRadius:"var(--seed-radius-r2)",background:"var(--bg-raised)",boxShadow:"var(--seed-shadow-s2)"},children:[ey&&(0,r.jsxs)(r.Fragment,{children:[a&&n5,n6,n3,n7]}),!a&&N&&(0,r.jsxs)("div",{ref:tM,style:{position:"relative"},children:[(0,r.jsxs)("button",{className:`composer-chip${eF?" is-active":""}`,onClick:()=>!a&&eO(e=>!e),disabled:a,title:eg("chat.changeToolPreset")+`: ${n4}`,"aria-label":eg("chat.changeToolPreset"),style:{display:"flex",alignItems:"center",justifyContent:"center",gap:5,padding:"8px 12px",height:32,background:eF?"var(--bg-hover)":"none",border:"none",borderRadius:"var(--radius-control)",color:"var(--text-muted)",cursor:a?"not-allowed":"pointer",fontSize:12,opacity:a?.5:1,transition:"background 0.12s, color 0.12s"},onMouseEnter:e=>{a||(e.currentTarget.style.background="var(--bg-hover)",e.currentTarget.style.color="var(--text)")},onMouseLeave:e=>{e.currentTarget.style.background=eF?"var(--bg-hover)":"none",e.currentTarget.style.color="var(--text-muted)"},children:[(0,r.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,r.jsx)("path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"})}),(0,r.jsx)("span",{style:{whiteSpace:"nowrap"},children:n4})]}),eF&&(0,r.jsx)("div",{style:{position:"absolute",bottom:"calc(100% + 6px)",right:0,zIndex:100,background:"var(--bg-raised)",border:0,borderRadius:"var(--radius-surface)",boxShadow:"var(--seed-shadow-s2)",overflow:"hidden",minWidth:120},children:ux.map(e=>{let t=uv[e],n=(C??"default")===t,i="off"===e?eg("chat.noTools"):"default"===e?eg("chat.builtInTools",{tools:uy}):eg("chat.allBuiltInTools",{tools:`${uy} + ${ub}`});return(0,r.jsxs)("button",{onClick:()=>{eO(!1),n||N(t)},style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"7px 12px",background:n?"var(--bg-selected)":"none",border:"none",color:n?"var(--text)":"var(--text-muted)",cursor:"pointer",fontSize:12,textAlign:"left",fontWeight:n?600:400,whiteSpace:"nowrap"},onMouseEnter:e=>{n||(e.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:e=>{n||(e.currentTarget.style.background="none")},children:[n?(0,r.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:(0,r.jsx)("polyline",{points:"1.5 5 4 7.5 8.5 2.5"})}):(0,r.jsx)("span",{style:{width:10,flexShrink:0}}),(0,r.jsx)("span",{style:{flex:1},children:e}),(0,r.jsx)("span",{style:{fontSize:11,color:"var(--text-dim)",marginLeft:8},children:i})]},e)})})]}),!a&&b&&(0,r.jsx)("div",{children:(0,r.jsx)("button",{className:`composer-chip${k?" is-active is-danger":""}`,onClick:k?w:b,disabled:a&&!k,style:{display:"flex",alignItems:"center",justifyContent:"center",gap:5,padding:"8px 12px",height:32,background:k?"var(--danger-soft)":"none",border:"none",borderRadius:"var(--radius-control)",color:k?"var(--danger)":"var(--text-muted)",cursor:a&&!k?"not-allowed":"pointer",fontSize:12,opacity:a&&!k?.5:1,transition:"background 0.12s, color 0.12s"},onMouseEnter:e=>{(!a||k)&&(e.currentTarget.style.background=k?"var(--danger-soft)":"var(--bg-hover)",e.currentTarget.style.color=k?"var(--danger)":"var(--text)")},onMouseLeave:e=>{e.currentTarget.style.background=k?"var(--danger-soft)":"none",e.currentTarget.style.color=k?"var(--danger)":"var(--text-muted)"},title:k?eg("chat.stopCompaction"):eg("chat.compactContext"),"aria-label":k?eg("chat.stopCompaction"):eg("chat.compactContext"),children:k?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:(0,r.jsx)("rect",{x:"2",y:"2",width:"6",height:"6",rx:"1",fill:"currentColor"})}),(0,r.jsx)("span",{style:{whiteSpace:"nowrap"},children:eg("chat.compacting")})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("polyline",{points:"4 14 10 14 10 20"}),(0,r.jsx)("polyline",{points:"20 10 14 10 14 4"}),(0,r.jsx)("line",{x1:"10",y1:"14",x2:"3",y2:"21"}),(0,r.jsx)("line",{x1:"21",y1:"3",x2:"14",y2:"10"})]}),(0,r.jsx)("span",{style:{whiteSpace:"nowrap"},children:eg("chat.compact")})]})})}),ey&&re,eU&&!ey&&(0,r.jsx)("button",{className:"composer-icon-button is-active",type:"button",title:eg("chat.collapseControls"),"aria-label":eg("chat.collapseControls"),"aria-expanded":!0,onClick:()=>{eO(!1),eD(!1),eB(!1)},style:{display:"flex",alignItems:"center",justifyContent:"center",width:36,height:32,padding:0,marginLeft:0,background:"var(--bg-hover)",border:"none",borderRadius:"0 9px 9px 0",color:"var(--text)",cursor:"pointer",transition:"background 0.12s, color 0.12s"},onMouseEnter:e=>{e.currentTarget.style.background="var(--bg-selected)"},onMouseLeave:e=>{e.currentTarget.style.background="var(--bg-hover)"},children:(0,r.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[(0,r.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,r.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),a&&(0,r.jsxs)("button",{className:"composer-chip is-danger is-active",onClick:t,title:eg("chat.stopAgent"),"aria-label":ey?eg("chat.stopAgent"):void 0,style:{display:"flex",alignItems:"center",justifyContent:"center",gap:6,minWidth:ey?44:void 0,padding:ey?0:"8px 14px",height:32,background:"var(--danger-soft)",border:0,borderRadius:"var(--radius-control)",color:"var(--danger)",cursor:"pointer",fontSize:12,fontWeight:600,whiteSpace:"nowrap",letterSpacing:"-0.01em",transition:"background 0.12s"},onMouseEnter:e=>{e.currentTarget.style.background="var(--bg-hover)"},onMouseLeave:e=>{e.currentTarget.style.background="var(--danger-soft)"},children:[(0,r.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:(0,r.jsx)("rect",{x:"1.5",y:"1.5",width:"7",height:"7",rx:"1.5",fill:"currentColor"})}),ey?null:eg("chat.stop")]}),(0,r.jsx)(dj,{sessionId:en,onEnsureSession:er,onTranscriptPersisted:ei}),!ey&&re]})]})]})]})});function uX({statuses:e}){if(0===e.length)return null;let t=[...e].sort((e,t)=>e.key.localeCompare(t.key)).map(({text:e})=>e.replace(/[\r\n\t]/g," ").replace(/ +/g," ").trim()).join(" "),n=eP(t);return(0,r.jsx)("div",{role:"status","aria-label":n,title:n,style:{display:"flex",alignItems:"center",flexShrink:0,minWidth:0,height:36,padding:"0 12px",background:"transparent"},children:(0,r.jsx)("span",{style:{minWidth:0,overflow:"hidden",color:"var(--text-muted)",fontFamily:"var(--font-mono)",fontSize:11,textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ez(t).map((e,t)=>(0,r.jsx)("span",{style:e.style,children:e.text},t))})})}function u0({phases:e,flow:t,busy:n}){let{t:s}=(0,F.s)(),{st:a}=iw(),[l,o]=(0,i.useState)(!1),[c,d]=(0,i.useState)(!1),[u,h]=(0,i.useState)(!1),p=(0,i.useId)(),m=e??[],{currentPhase:f,activeTask:g,remaining:x,completed:v,total:y,percent:b}=t_(m),w=m.some(e=>e.tasks.some(e=>e.dependsOn?.length)),k=t.steps.length>0,j=function(e,t,n){if(!t||!e.current)return null;let r=n("flow.strip.running",{stage:n(`flow.stage.${e.current}`)});return e.attempt>1?`${r} \xb7 ${n("flow.attempt",{attempt:e.attempt})}`:r}(t,n,a);if(0===y&&null===j)return null;let S=y>0&&0===x;return(0,r.jsxs)("div",{className:`todo-strip${S?" is-done":""}`,children:[(0,r.jsxs)("div",{className:"todo-strip-row",children:[(0,r.jsx)("span",{"aria-hidden":"true",className:"todo-strip-marker",children:S?"✓":"›"}),j&&(0,r.jsx)("span",{className:"todo-strip-lead",role:n?"status":void 0,children:j}),y>0&&(0,r.jsxs)("button",{type:"button",className:"todo-strip-summary","aria-expanded":l,onClick:()=>o(e=>!e),children:[!j&&f&&(0,r.jsx)("span",{className:"todo-strip-phase",children:f.name}),(0,r.jsx)("span",{className:"todo-strip-task",children:S?s("todo.allDone",{count:v}):g?.content??""}),(0,r.jsx)("span",{className:"todo-strip-count",children:S?s("todo.progressDone",{percent:b??0,completed:v,total:y}):s("todo.progress",{percent:b??0,completed:v,total:y,remaining:x})})]}),k&&(0,r.jsxs)("button",{type:"button",className:"todo-strip-flow-toggle","aria-expanded":c,"aria-controls":p,onClick:()=>d(e=>!e),children:[a("flow.toggle"),(0,r.jsx)("svg",{className:"flow-chevron",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,r.jsx)("polyline",{points:"6 9 12 15 18 9"})})]})]}),c&&k&&(0,r.jsx)(oR,{flow:t,live:n,st:a,id:p}),l&&y>0&&(0,r.jsxs)("div",{className:"todo-strip-body",children:[m.map((e,t)=>{let n=e.tasks.filter(e=>u||"completed"!==e.status);return 0===n.length?null:(0,r.jsxs)("div",{className:"todo-checklist-phase",role:"list",children:[m.length>1&&(0,r.jsx)("div",{className:"todo-checklist-phase-name",children:e.name}),n.map((e,t)=>(0,r.jsx)(iN,{task:e,phases:w?m:void 0},`${e.content}-${t}`))]},`${e.name}-${t}`)}),v>0&&(0,r.jsx)("button",{type:"button",className:"todo-strip-completed-toggle","aria-expanded":u,onClick:()=>h(e=>!e),children:s(u?"todo.hideCompleted":"todo.showCompleted",{count:v})})]})]})}function u1(e=document){return"visible"!==e.visibilityState||!e.hasFocus()}function u2(e){switch(e.method){case"select":case"confirm":case"input":case"editor":case"ask":case"form":case"plan_review":return!0;case"custom":return!0!==e.closed;default:return!1}}async function u8(e,t={createWindowNotification:(e,t)=>new Notification(e,t),getServiceWorkerRegistration:"serviceWorker"in navigator?()=>navigator.serviceWorker.getRegistration():null}){let n={body:e.body,...e.tag?{tag:e.tag}:{}};if(t.getServiceWorkerRegistration)try{let r=await t.getServiceWorkerRegistration();if(r)return await r.showNotification(e.title,{...n,data:{url:e.sessionUrl}}),"service-worker"}catch{}try{let r=t.createWindowNotification(e.title,n);return r.onclick=()=>{r.close(),e.onClick()},"window"}catch{return null}}class u4 extends Error{constructor(e,t,n,r){super(e),this.status=t,this.code=n,this.accepted=r,this.name="AgentCommandError"}}async function u5(e,t){let n=await fetch(`/api/agent/${encodeURIComponent(e)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),r=await n.json().catch(()=>({}));if(!n.ok||r.error)throw new u4(r.error??`HTTP ${n.status}`,n.status,r.code,r.accepted);return r.data}let u6="ompweb-update-client-id",u3="ompweb-update-resume-intent-v2",u7="ompweb-update-return-v1",u9="cuelo-restart-return-v1",he="ompweb-update-failure-return-v1",ht="ompweb:update-wake";function hn(e){return null===e?2e4:"running"===e?null:"failed"===e?3e4:8e3}function hr(){let e=sessionStorage.getItem(u6);if(e&&/^[A-Za-z0-9_-]{16,128}$/.test(e))return e;let t="function"==typeof crypto.randomUUID?crypto.randomUUID().replaceAll("-",""):Array.from(crypto.getRandomValues(new Uint8Array(16)),e=>e.toString(16).padStart(2,"0")).join("");return sessionStorage.setItem(u6,t),t}function hi(){sessionStorage.removeItem(u3)}function hs(){let e=sessionStorage.getItem(u7);if(!e)return null;try{let t=JSON.parse(e);if(1!==t.schemaVersion||"string"!=typeof t.requestId||!/^[0-9a-f]{32}$/.test(t.requestId)||"string"!=typeof t.stageHash||!/^[0-9a-f]{64}$/.test(t.stageHash)||"boolean"!=typeof t.dismissed)return null;return t}catch{return null}}function ha(e){let t=hs();if(!t||t.requestId!==e)return t;let n={...t,dismissed:!0};try{sessionStorage.setItem(u7,JSON.stringify(n))}catch{}return n}async function hl(e){let t=await fetch("/api/update-maintenance",{method:"POST",headers:{"Content-Type":"application/json","Cache-Control":"no-cache"},body:JSON.stringify({action:"heartbeat",clientId:hr(),sessionId:e.sessionId,resumeUrl:e.resumeUrl,preservationError:e.preservationError??null,...e.update?{requestId:e.update.requestId,stageHash:e.update.stageHash}:{}}),cache:"no-store"});if(!t.ok)throw Error(`maintenance heartbeat HTTP ${t.status}`);return await t.json()}async function ho(e){if(e.sessionId){let t=await fetch(`/api/sessions/${encodeURIComponent(e.sessionId)}?deferThinking=1&deferMedia=1`,{cache:"no-store",headers:{"Cache-Control":"no-cache"}});if(!t.ok)throw Error(`session resume HTTP ${t.status}`);if((await t.json()).sessionId!==e.sessionId)throw Error("resumed session identity mismatch")}let t=await fetch("/api/update-maintenance",{method:"POST",headers:{"Content-Type":"application/json","Cache-Control":"no-cache"},body:JSON.stringify({action:"resume-confirm",requestId:e.requestId,stageHash:e.stageHash,clientId:e.clientId,sessionId:e.sessionId}),cache:"no-store"});if(!t.ok)throw Error(`resume confirm HTTP ${t.status}`);let n=await t.json().catch(()=>null);!function(e){let t=hs();if(t&&t.requestId===e.requestId&&t.stageHash===e.stageHash)return;let n={schemaVersion:1,requestId:e.requestId,stageHash:e.stageHash,dismissed:!1};try{sessionStorage.setItem(u7,JSON.stringify(n))}catch{}}({requestId:e.requestId,stageHash:e.stageHash}),hi();let r=n?.wake;e.sessionId&&(r?.wake===!0||r?.reason==="already-claimed"||r?.reason==="user-already-active")&&window.dispatchEvent(new CustomEvent(ht,{detail:{sessionId:e.sessionId}}))}async function hc(e){let t=function(e){let t=sessionStorage.getItem(he);if(!t)return null;sessionStorage.removeItem(he);try{let n=JSON.parse(t);if(1!==n.schemaVersion||n.requestId!==e.requestId||n.stageHash!==e.stageHash||n.clientId!==e.clientId)return null;return{wake:!0===n.wake}}catch{return null}}(e);return t?(hi(),t.wake&&e.sessionId&&window.dispatchEvent(new CustomEvent(ht,{detail:{sessionId:e.sessionId}})),"failed"):(await ho(e),"resumed")}function hd(e,t){let n=new Map(e.map(e=>[e.id,e]));for(let e of t)n.set(e.id,function(e,t){return e&&(void 0!==e.parentToolCallId&&void 0!==t.parentToolCallId?e.parentToolCallId===t.parentToolCallId:void 0===e.sessionFile||void 0===t.sessionFile||e.sessionFile===t.sessionFile)?{...t,index:e.index,agent:e.agent,agentSource:e.agentSource,description:e.description??t.description,task:e.task??t.task,assignment:e.assignment??t.assignment,sessionFile:t.sessionFile??e.sessionFile,parentToolCallId:t.parentToolCallId??e.parentToolCallId}:t}(n.get(e.id),e));let r=[...n.values()];return[...r.filter(e=>"pending"===e.status||"running"===e.status).sort((e,t)=>e.index-t.index||e.id.localeCompare(t.id)),...r.filter(e=>"pending"!==e.status&&"running"!==e.status).sort((e,t)=>t.lastUpdate-e.lastUpdate||e.id.localeCompare(t.id))].slice(0,128)}function hu(e,t){switch(t.type){case"start":return{isStreaming:!0,streamingMessage:null};case"update":return{isStreaming:!0,streamingMessage:t.message};case"end":case"reset":return{isStreaming:!1,streamingMessage:null};default:return e}}function hh(e){return{steering:e?.steering??[],followUp:e?.followUp??[]}}function hp(e){if(e&&"boolean"==typeof e.fastModeEnabled)return{enabled:e.fastModeEnabled,active:!0===e.fastModeActive}}function hm(e){return t=>{let n=e?.isCompacting?e.compaction:null;if(!n)return t;let r=Date.now()-n.elapsedMs;return{startedAt:t?Math.min(t.startedAt,r):r,reason:t?.reason??n.reason}}}function hf(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1){let r=e[n],i=t[n];if(!r||!i||r.name!==i.name||r.tasks.length!==i.tasks.length)return!1;for(let e=0;e<r.tasks.length;e+=1){let t=r.tasks[e],n=i.tasks[e];if(!t||!n||t.content!==n.content||t.status!==n.status||t.blocker!==n.blocker||(t.dependsOn?.length??0)!==(n.dependsOn?.length??0)||t.dependsOn?.some((e,t)=>e!==n.dependsOn?.[t]))return!1}}return!0}function hg(e){return"aborted"===e.stopReason?"aborted":"error"===e.stopReason||e.errorMessage?"failed":e.stopReason?"completed":"unknown"}function hx(e,t){for(let n=e.length-1;n>=0;n--){let r=t[n]??null;if(!ta(r??void 0))return{message:e[n],entryId:r}}return null}let hv=new Set(["ArrowUp","ArrowDown","PageUp","PageDown","Home","End"," ","Space","Spacebar"]);class hy extends Error{constructor(e){super("timeout"===e?"Timed out connecting to the agent event stream. Please try again.":"Failed to connect to the agent event stream. Please try again."),this.status=e,this.name="EventStreamConnectionError"}}function hb(){return"u">typeof crypto&&"function"==typeof crypto.randomUUID?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2)}`}function hw(e){return new Promise(t=>setTimeout(t,e))}function hk(e){let t=e.findIndex(e=>!e.exiting);return -1===t?e:e.map((e,n)=>n===t?{...e,exiting:!0}:e)}function hj(e,t){switch(t.type){case"add":if(e.visible.some(e=>e.exiting)||e.visible.length>=5)return{visible:e.visible.some(e=>e.exiting)?e.visible:hk(e.visible),pending:[...e.pending,t.notice]};return{...e,visible:[...e.visible,t.notice]};case"mark_oldest_exiting":return{...e,visible:hk(e.visible)};case"remove":return function(e,t){let n=e,r=t;for(;r.length>0&&n.length<5;){let[e,...t]=r;n=[...n,e],r=t}return r.length>0&&!n.some(e=>e.exiting)&&(n=hk(n)),{visible:n,pending:r}}(e.visible.filter(e=>e.id!==t.id),e.pending);default:return e}}function hS(e){if(!e||"object"!=typeof e||"image"!==e.type)return"";let t=e.source;return t&&"object"==typeof t?["url"===t.type?"url":"base64","string"==typeof t.media_type?t.media_type:"","string"==typeof t.data?t.data:"","string"==typeof t.url?t.url:""].join(":"):["base64","string"==typeof e.mimeType?e.mimeType:"","string"==typeof e.data?e.data:"",""].join(":")}function hC(e){let t,n=e.content;return"string"==typeof n?JSON.stringify({text:n,images:[]}):Array.isArray(n)?JSON.stringify({text:"string"==typeof(t=e.content)?t:Array.isArray(t)?t.map(e=>e&&"object"==typeof e&&"text"===e.type&&"string"==typeof e.text?e.text:"").filter(Boolean).join("\n"):"",images:n.map(hS).filter(Boolean)}):JSON.stringify({text:"",images:[]})}function hN(e){return"user"===e.role?`user:${hC(e)}`:"bashExecution"===e.role?JSON.stringify({role:e.role,command:e.command,output:e.output,exitCode:e.exitCode,cancelled:e.cancelled,truncated:e.truncated,fullOutputPath:e.fullOutputPath,excludeFromContext:e.excludeFromContext}):JSON.stringify({role:e.role,content:e.content,model:e.model,provider:e.provider,customType:e.customType})}function hT(e,t){return e&&"object"==typeof e?"number"!=typeof e.tokensBefore||"number"!=typeof e.estimatedTokensAfter?null:{reason:t,tokensBefore:e.tokensBefore,estimatedTokensAfter:e.estimatedTokensAfter}:null}function hI(e){return e?.map(({data:e,mimeType:t})=>({data:e,mimeType:t}))}function hM(e){nM(e),e.clear()}function hE(e,t,n){for(let r of n??[]){let n=nI(t,r);n&&e.add(n)}}function hR(){let e=document.activeElement;return e instanceof HTMLElement&&(e.isContentEditable||"INPUT"===e.tagName||"SELECT"===e.tagName||"TEXTAREA"===e.tagName)}let h$=!1,hL={width:0,height:0},hP=new Set,hA=null;function h_(){let e=window.visualViewport,t=hR();hL.width!==window.innerWidth?hL={width:window.innerWidth,height:window.innerHeight}:t||(hL.height=Math.max(hL.height,window.innerHeight));let n=function({hasFocusedEditable:e,innerHeight:t,viewportHeight:n,viewportScale:r,baselineHeight:i}){return!(!e||Math.abs(r-1)>=.01)&&(t-n>120||i-t>120)}({hasFocusedEditable:t,innerHeight:window.innerHeight,viewportHeight:e?.height??window.innerHeight,viewportScale:e?.scale??1,baselineHeight:hL.height});if(n!==h$)for(let e of(h$=n,hP))e()}function hF(e){if(hP.add(e),!hA){let e=null,t=()=>{null!==e&&window.cancelAnimationFrame(e),e=window.requestAnimationFrame(()=>{e=null,h_()})},n=window.visualViewport;n?.addEventListener("resize",t),window.addEventListener("resize",t),window.addEventListener("focusin",t),window.addEventListener("focusout",t),h_(),hA=()=>{n?.removeEventListener("resize",t),window.removeEventListener("resize",t),window.removeEventListener("focusin",t),window.removeEventListener("focusout",t),null!==e&&window.cancelAnimationFrame(e)}}return()=>{hP.delete(e),0===hP.size&&hA&&(hA(),hA=null)}}function hO(){return(0,i.useSyncExternalStore)(hF,()=>h$,()=>!1)}let hz={count:50,end:null};function hD(e,t){let n=Math.max(e,0),r=null===t.end?n:Math.min(Math.max(t.end,0),n),i=Math.min(Math.max(t.count,0),r),s=r-i;return{startIndex:s,endIndex:r,hasMore:s>0,hasLater:r<n}}function hW(e,t,n){let{startIndex:r,endIndex:i}=hD(e,n);if(t>=r&&t<i)return n;let s=Math.max(0,t-10),a=Math.max(t+1,s+50);return a>=e?{count:e-s,end:null}:{count:a-s,end:a}}function hH({sticker:e,text:t,tag:n,followRef:s}){let a=(0,i.useRef)(null);return((0,i.useEffect)(()=>{(!s||s.current)&&a.current?.scrollIntoView({block:"nearest",behavior:"smooth"})},[]),e||t)?(0,r.jsxs)("div",{ref:a,className:"cue-bubble-dock",role:"status","aria-live":"polite",children:[e&&(0,r.jsx)("img",{className:"cue-bubble-sticker",src:e,alt:n6[n]}),t&&(0,r.jsx)("p",{className:e?"cue-bubble":"cue-bubble cue-bubble--solo",children:t}),e&&(0,r.jsx)(cT(),{id:"71a4a7cebbc6c842",children:".cue-bubble-sticker{transform-origin:center 75%;animation:cue-sticker-pop 200ms cubic-bezier(0,0,.15,1)both}@keyframes cue-sticker-pop{from{opacity:0;transform:scale(.88)}to{opacity:1;transform:scale(1)}}@media(prefers-reduced-motion:reduce){.cue-bubble-sticker{animation:none}}"})]}):null}function hU(e){if("user"!==e.role)return null;let t="string"==typeof e.content?e.content:e.content.filter(e=>"text"===e.type).map(e=>e.text).join("\n"),n=(iJ(t)?.message??t).trim();return n.length>0?n:null}function hB(e){return`omp-cues:${e}`}function hq(e,t){let n=[];for(let r of t)r.sessionId===e&&null!==r.anchorEntryId&&n.push({id:r.id,anchorEntryId:r.anchorEntryId,sticker:r.sticker,text:r.text,tag:r.tag});try{window.localStorage.setItem(hB(e),JSON.stringify(n.slice(-200)))}catch{}}let hV=[];function hK(e){return`omp-web:interrupted-dismissed:${e}`}let hG=(0,i.memo)(function({messages:e,entryIds:t,toolResultsMap:n,modelNames:s,messageCwd:a,onOpenFile:l,sessionBusy:o,isNew:c,isStreaming:d,handleFork:u,forkingEntryId:h,handleNavigate:p,handleEditContent:m,sessionId:f,main:g,process:x,turnSummaries:v,startIndex:y,endIndex:b,sentinelRef:w,laterSentinelRef:k,flashItem:j,t:S,onProcessLogChange:C,cues:N,cueFollowRef:T}){(0,i.useEffect)(()=>{C({groups:x,messages:e,entryIds:t,toolResults:n,modelNames:s,cwd:a,sessionId:f})},[C,x,e,t,n,s,a,f]);let I=(0,i.useMemo)(()=>(function(e){let t=new Map;for(let n=0;n<e.length;n++){let r=ti(e,n);r>=0&&t.set(r,function(e){let t="string"==typeof e.content?e.content:e.content.map(e=>"text"===e.type?e.text:"").join("\n");if(!t.startsWith("[interpreter] "))return t;let n=t.indexOf("\n\n");return n<0?t:t.slice(n+2)}(e[n]))}return t})(e),[e]),M=(0,i.useMemo)(()=>{let t=new Map;for(let[r,i]of function(e,t,n,r){let i=new Map;e.forEach((e,t)=>{"answer"===e.kind&&i.set(e.idx,t)});let s=new Map,a=new Map;for(let e of t){let t=a.get(e.anchorIdx);for(let l of(t||(t=new Set,a.set(e.anchorIdx,t)),e.entries)){let e=n[l.idx];if(e?.role!=="assistant")continue;let a=Math.max(0,(l.blocks?i.get(l.idx):void 0)??l.afterMainIndex??-1),o=t;!function(e,t,n){for(let r of e){if("toolCall"!==r.type||"learn"!==r.toolName&&"manage_skill"!==r.toolName)continue;let e=t?.get(r.toolCallId);if(!e||e.isError)continue;let i=r.input??{};if("manage_skill"===r.toolName){let e=td(i.action);if(!0===tc[e]){let t={kind:"skill",action:e,name:td(i.name)};n(JSON.stringify(t),t)}continue}let s=td(i.memory),a=i.skill,l=a?{action:td(a.action),name:td(a.name)}:void 0;n(JSON.stringify({kind:"lesson",memory:s,skill:l}),{kind:"lesson",memory:s.length>160?`${s.slice(0,160)}…`:s,...l?{skill:l}:{}})}}(l.blocks??e.content??[],r,(e,t)=>{if(o.has(e))return;o.add(e);let n=s.get(a);n?n.push(t):s.set(a,[t])})}}return s}(g,x,e,n)){let e=i.map(e=>{if("skill"===e.kind)return S("chat.savedSkill",{action:e.action,name:e.name});let t=S("chat.savedLesson",{memory:e.memory});return e.skill?`${t} (${S("chat.savedSkill",e.skill)})`:t});t.set(r,{role:"custom",customType:tn,content:[S("chat.lessonsSaved"),...e.map(e=>`- ${e}`)].join("\n"),display:!0})}return t},[g,x,e,n,S]),E=y>0,R=b<g.length,$=(i,g={})=>{let x=g.messageOverride??e[i],v=i-1;for(;v>=0&&ta(t[v]);)v-=1;let y="user"===x.role&&v>=0&&"assistant"===e[v].role?t[v]:void 0,b=g.keyPrefix??"message",w=!1;if("assistant"===x.role){w=!0;for(let t=i+1;t<e.length;t++){let n=e[t].role;if("user"===n)break;if("assistant"===n){w=!1;break}}w&&d&&i===e.length-1&&(w=!1)}return void 0!==g.showTimestamp&&(w=g.showTimestamp),(0,r.jsx)(sl,{message:x,toolResults:n,modelNames:s,cwd:a,onOpenFile:l,entryId:t[i],onFork:o||c||0===i&&"user"===x.role?void 0:u,forking:h===t[i],onNavigate:o?void 0:p,prevAssistantEntryId:o?void 0:y,onEditContent:m,showTimestamp:w,prevTimestamp:i>0?e[i-1].timestamp:void 0,sessionId:f,writtenFiles:g.writtenFiles,hasTurnSummary:void 0!==g.turnSummary,inputTranslation:"user"===x.role?I.get(i):void 0,recoveredError:eY(e,i)},`${b}-view-${i}`)},L=(t,n)=>{let i=g[t],s="message"===i.kind&&e[i.idx]?.role==="user";return(0,r.jsx)("div",{"data-chat-item":t,"data-chat-question":s?"":void 0,className:j===t?"chat-item chat-jump-flash":"chat-item",children:n})};return(0,r.jsxs)(r.Fragment,{children:[E&&(0,r.jsx)("div",{ref:w,className:"py-3 text-center text-xs text-text-muted",children:S("chat.loadEarlier",{count:y})}),g.slice(y,b).map((s,o)=>{let c=y+o,d="message"===s.kind?s.anchorIdx??s.idx:s.anchorIdx,u=g[c+1],h=u?"message"===u.kind?u.anchorIdx??u.idx:u.anchorIdx:null,p=u?u.idx:1/0,m=N.filter(n=>{let r=null!==n.anchorEntryId?t.indexOf(n.anchorEntryId):Math.min(n.liveIndex??-1,e.length-1);return r>=s.idx&&r<p}).map(e=>(0,r.jsx)(hH,{sticker:e.sticker,text:e.text,tag:e.tag,followRef:T},`cue-${e.id}`)),x=h!==d,b=M.get(c),w=b?(0,r.jsx)(sl,{message:b,cwd:a,onOpenFile:l},`saved-lessons-${c}`):null,k=x?(0,r.jsx)(cP,{turnIndex:d,turnEntryId:t[d],sessionId:f,cwd:a,onOpenFile:l}):null;if("message"===s.kind)return(0,r.jsxs)(i.Fragment,{children:[L(c,$(s.idx)),w,k,m]},`message-${s.idx}`);let j=tM(s.precedingBlocks,n,a),S=v.get(c);return(0,r.jsxs)(i.Fragment,{children:[L(c,$(s.idx,{keyPrefix:`answer-${s.runIndex}`,messageOverride:function(e,t){let n=eK(e,t);if(!e.replyTranslation)return n;let r=e.content.find(e=>"text"===e.type);return r&&t.includes(r)||(n.replyTranslation=void 0,"translated"===e.replyTranslation.kind&&(n.content=t.filter(e=>"text"!==e.type))),n}(e[s.idx],s.blocks),writtenFiles:j,turnSummary:S})),S&&(0,r.jsx)(co,{summary:S,turnKey:c}),w,k,m]},`answer-${s.idx}-${s.runIndex}`)}),R&&(0,r.jsx)("div",{ref:k,className:"py-3 text-center text-xs text-text-muted",children:S("chat.loadLater",{count:g.length-b})})]})});function hJ({session:e,newSessionCwd:t,newSessionAutoWorktree:a,initialSessionData:l,transitioning:o=!1,onAgentEnd:c,onAttentionNeeded:d,onSessionCreated:u,onSessionForked:h,modelsRefreshKey:p,chatInputRef:m,onBranchDataChange:f,onSystemPromptChange:g,onSessionStatsChange:v,onSessionStatsPanelOpen:y,onContextUsageChange:b,onSubagentsChange:w,onLabWidgetsChange:k,onOpenWorkspaceView:j,onOpenSessionList:S,onOpenMaker:C,selectedMaker:N,onProcessLogChange:T,onOpenFile:I,transcriptReplacement:M,onComposerFocusChange:E,onSessionBusyChange:R,onWaitingChange:$,onAttentionChange:L,soundEnabled:P=!0,onSoundToggle:A,playCueSound:_=async()=>({sticker:null,text:null}),preloadCueSound:O,unlockAudio:z,jumpRequest:D=null,onJumpHandled:W,turnInspectorTarget:H=null,onShowTurnInspector:B,turnInspectorFolded:q=!1}){var V,K;let G,J,Y,{t:Z}=(0,F.s)(),Q=hO(),X=U(),et=Q&&X,en=(0,i.useRef)(_);en.current=_;let er=(0,i.useRef)(null),ei=(0,i.useRef)(O);ei.current=O;let[es,el]=(0,i.useState)([]),eo=(0,i.useRef)(es);eo.current=es;let ec=(0,i.useRef)(0),ed=(0,i.useRef)([]),eu=(0,i.useRef)([]),eh=(0,i.useRef)(null),ep=(0,i.useRef)(0),em=(0,i.useRef)(-1),ef=(0,i.useRef)(-1),eg=(0,i.useCallback)(()=>{let e=eh.current?.current;return e?{sessionId:e,turn:ep.current}:null},[]),ex=(0,i.useCallback)(e=>eh.current?.current===e.sessionId&&ep.current===e.turn,[]),ev=(0,i.useCallback)((e,t,n,r)=>{if(!e.sticker&&!e.text)return;ec.current=Math.max(ec.current+1,Date.now());let i={id:ec.current,sticker:e.sticker,text:e.text,tag:t,sessionId:n.sessionId},s="entry"===r.kind?{...i,anchorEntryId:r.entryId}:{...i,anchorEntryId:null,liveIndex:r.liveIndex,intent:r.intent};el(e=>{let t=[...e,s];return null!==s.anchorEntryId&&hq(n.sessionId,t),t})},[]),ey=(0,i.useCallback)((e,t,n,r)=>{let i=()=>ex(n)&&("working"!==t||ef.current!==n.turn);i()&&en.current(e,t,i).then(e=>{null!==t&&null!==r&&i()&&ev(e,t,n,r)}).catch(()=>{})},[ex,ev]),eb=(0,i.useCallback)(async(e,t,n,r)=>{let i=(await ix(e,t,n,r))?.alias??null;return i&&ei.current?.(i),i},[]),ew=(0,i.useCallback)((e,t,n,r,i)=>{let s=function(e,t){let n=e.length-1;if(n<0)return null;let r=Math.min(e.length,t.length);if(n<r)return{kind:"entry",entryId:t[n]};let i=ro(e[n]),s=0;for(let t=r;t<=n;t++)ro(e[t])===i&&(s+=1);return{kind:"pending",liveIndex:n,intent:{baseEntryId:r>0?t[r-1]:null,identity:i,occurrence:s}}}(ed.current,eu.current);eb(t.sessionId,n,r,i).then(n=>{ey(n,e,t,s)})},[ey,eb]),[ek,ej]=(0,i.useState)(0),eS=(0,i.useRef)([]),eC=(0,i.useCallback)(e=>{if(ep.current+=1,null!==re(e.outcome)){let t=e.sessionId;eS.current.push({completion:e,trigger:t?{sessionId:t,turn:ep.current}:null}),ej(e=>e+1)}c?.(e)},[c]);(0,i.useEffect)(()=>{for(let{completion:e,trigger:t}of eS.current.splice(0)){let n=re(e.outcome),r="neutral"===n?null:n;t?ew(r,t,e.provider,e.credentialId,e.model):en.current(null,r).catch(()=>{})}},[ek,ew]);let eN=(0,i.useCallback)(e=>{m?.current?.replaceMessage(e)},[m]),{loading:eT,error:eI,messages:eM,entryIds:eE,streamState:eR,agentRunning:e$,bashRunning:eL,pendingBash:eA,modelNames:e_,modelList:eF,modelError:eO,modelScopeWarnings:ez,modelThinkingLevels:eD,modelThinkingLevelMaps:eW,modelRoles:eH,toolPreset:eU,thinkingLevel:eB,effectiveThinkingLevel:eq,thinkingCeiling:eV,fastMode:eG,fastModeBusy:eX,handleFastModeToggle:e0,retryInfo:e8,contextUsage:e4,forkingEntryId:e6,isCompacting:e3,compaction:tn,compactError:tc,compactResult:td,displayModel:th,modelSwitching:tp,sessionStats:tm,runStateKnown:tf,compactedWork:tg,slashCommands:tx,slashCommandsLoading:tv,deliveryRows:ty,subagents:tb,todoPhases:tw,notices:tk,extensionDialog:tj,extensionResponse:tS,extensionCustomUi:tC,extensionStatuses:tN,extensionWidgets:tT,respondToExtensionUi:tI,sendExtensionCustomInput:tM,isAutoModelSelection:tE,agentPhase:tR,isNew:t$,autoFollowPaused:tL,resumeAutoFollow:tA,pauseAutoFollow:t_,goalStatus:tF,sessionIdRef:tO,messagesEndRef:tD,scrollContainerRef:tW,handleSend:tH,handleAbort:tU,handleFork:tB,handleNavigate:tq,handleModelChange:tV,handleRoleModelChange:tK,handleMainPresetChange:tG,newSessionAccount:tJ,handleCompact:tY,handleSteer:tZ,handleFollowUp:tQ,handlePromptWithStreamingBehavior:tX,handleAbortCompaction:t0,handleRecallQueue:t1,handleRemoveQueuedMessage:t2,handleBuiltinSlashCommand:t8,handleToolPresetChange:t4,handleThinkingLevelChange:t5,loadSlashCommands:t6,ensureNewSession:t3,refreshLiveTranscript:t7}=function(e){let{session:t,newSessionCwd:r,initialData:s,onAgentEnd:a,onAttentionNeeded:l,onSessionCreated:o,onSessionForked:c,modelsRefreshKey:d,onBranchDataChange:u,onSystemPromptChange:h,onSessionStatsPanelOpen:p}=e,m=null===t&&null!==r,f=s&&s.sessionId===t?.id?s:null,[g,x]=(0,i.useState)(f),[v,y]=(0,i.useState)(!m&&!f),[b,w]=(0,i.useState)(null),[k,j]=(0,i.useState)(f?.leafId??null),[S,C]=(0,i.useState)(f?.context.messages??[]),[N,T]=(0,i.useState)(f?.context.entryIds??[]),[I,M]=(0,i.useState)(f?.context.compactedWork??null),[E,R]=(0,i.useReducer)(hu,{isStreaming:!1,streamingMessage:null}),[$,L]=(0,i.useState)(!1),[P,A]=(0,i.useState)(!1),[_,F]=(0,i.useState)(null),[O,z]=(0,i.useState)({}),[D,W]=(0,i.useState)([]),[H,U]=(0,i.useState)(null),[B,q]=(0,i.useState)([]),[V,K]=(0,i.useState)({}),[G,J]=(0,i.useState)({}),[Y,Z]=(0,i.useState)([]),[Q,X]=(0,i.useState)(null),[ee,et]=(0,i.useState)(null),[en,er]=(0,i.useState)(null),[ei,es]=(0,i.useState)("default"),[el,eo]=(0,i.useState)(()=>{let e=f?.context.thinkingLevel;return e&&"off"!==e?e:"auto"}),[ec,ed]=(0,i.useState)(),[eu,eh]=(0,i.useState)(null),[ep,em]=(0,i.useState)(null),[ef,eg]=(0,i.useState)(!1),ex=(0,i.useRef)(0),ev=(0,i.useRef)(0),ey=(0,i.useRef)(""),[eb,ew]=(0,i.useState)(null),[ek,ej]=(0,i.useState)(f?.contextUsage??null),[eS,eC]=(0,i.useState)(null),[eN,eT]=(0,i.useState)(null),[eI,eM]=(0,i.useState)(null),[eE,eR]=(0,i.useState)(null),[e$,eL]=(0,i.useState)(!1),[eA,e_]=(0,i.useState)(!1),[eF,eO]=(0,i.useState)(null),[ez,eD]=(0,i.useState)(null),[eW,eH]=(0,i.useState)(null),eU=(0,i.useRef)(null),[eB,eq]=(0,i.useState)(!1),[eV,eK]=(0,i.useState)(null),[eG,eJ]=(0,i.useState)([]),[eY,eZ]=(0,i.useState)(!1),[eQ,eX]=(0,i.useReducer)(hj,{visible:[],pending:[]}),[e0,e1]=(0,i.useState)(null),[e2,e8]=(0,i.useState)(null),[e4,e5]=(0,i.useState)(null),e6=(0,i.useRef)(null),[e3,e7]=(0,i.useState)(null),[e9,te]=(0,i.useState)([]),[tn,tr]=(0,i.useState)([]),[ti,to]=(0,i.useState)({steering:[],followUp:[]}),[tc,td]=(0,i.useState)([]),[tu,th]=(0,i.useReducer)(lV,[]),tp=(0,i.useRef)(0);(0,i.useEffect)(()=>{th({type:"queue",steering:ti.steering,followUp:ti.followUp})},[ti]),(0,i.useEffect)(()=>{$||th({type:"idle"})},[$]),(0,i.useEffect)(()=>{th({type:"reset"})},[t?.id]);let tm=(0,i.useMemo)(()=>(function(e,t){let n=new Map;for(let t of e){if(!t.inQueue)continue;let e=`${t.kind}\u0000${lB(t)}`;n.set(e,(n.get(e)??0)+1)}let r=[],i=(e,t)=>{t.forEach((t,i)=>{let s=`${e}\u0000${lU(t)}`,a=n.get(s)??0;a>0?n.set(s,a-1):r.push({key:`queue-${e}-${i}`,kind:e,text:t,images:0,stage:"accepted",removable:!0})})};for(let n of(i("steer",t?.steering??[]),i("followUp",t?.followUp??[]),e))r.push({key:`sent-${n.id}`,kind:n.kind,text:n.text,images:n.images,stage:n.stage,removable:n.inQueue});return r})(tu,ti),[tu,ti]),[tf,tg]=(0,i.useState)(null),tx=(0,i.useRef)(null),tv=(0,i.useRef)(null),ty=(0,i.useRef)(null),tb=(0,i.useRef)(null),tw=(0,i.useRef)(null),tk=(0,i.useRef)(0),tj=(0,i.useRef)(!1),tS=(0,i.useRef)(t?.id??null),tC=(0,i.useRef)(f?.leafId??null),tN=(0,i.useRef)(S),tT=(0,i.useRef)(N);tN.current=S,tT.current=N;let tI=(0,i.useRef)({sessionId:t?.id??null,outputs:[],seq:0}),tM=(0,i.useRef)(!1),tE=(0,i.useRef)(new Set);(0,i.useEffect)(()=>()=>hM(tE.current),[]);let tR=(0,i.useRef)(!1),t$=(0,i.useRef)(!1),tL=(0,i.useRef)(-1),tP=(0,i.useRef)("unknown"),tA=(0,i.useRef)(null),t_=(0,i.useRef)(null),tF=(0,i.useRef)(0),tO=(0,i.useRef)(!1),tz=(0,i.useRef)(0),tD=(0,i.useRef)(null),tW=(0,i.useRef)(null),tH=(0,i.useRef)(null),tU=(0,i.useRef)(!1),tB=(0,i.useRef)(!0),[tq,tV]=(0,i.useState)(!1),[tK,tG]=(0,i.useState)(null),tJ=(0,i.useRef)(void 0),tY=(0,i.useRef)(0),tZ=(0,i.useRef)(null),tQ=(0,i.useRef)(0),tX=(0,i.useRef)(()=>{}),t0=(0,i.useRef)(null),t1=(0,i.useRef)(null),t2=(0,i.useRef)(null),t8=(0,i.useRef)(null),t4=(0,i.useRef)(!1),t5=(0,i.useRef)(null),t6=(0,i.useRef)(null),t3=(0,i.useRef)(null),t7=(0,i.useRef)(null),t9=(0,i.useRef)(null),ne=(0,i.useRef)(0),nt=(0,i.useRef)(null),nn=(0,i.useRef)(null),nr=(0,i.useRef)(!1);nr.current=e.transitioning??!1;let ni=(0,i.useRef)(Date.now()),ns=(0,i.useRef)(0),na=(0,i.useRef)(0),nl=(0,i.useRef)(null),no=(0,i.useRef)(!1),nc=(0,i.useRef)(Promise.resolve()),nd=e.setToolPreset??es,nu=eI??g?.context.model??eE??null,nh=m?Q??en:nu,np=(0,i.useMemo)(()=>{if(e0)return{...e0,totalActiveMs:g?.totalActiveMs};let e={input:0,output:0,cacheRead:0,cacheWrite:0,total:0},n=0,r=0,i=0,s=0,a=0;for(let t of S){if("user"===t.role&&(r+=1),"toolResult"===t.role&&(s+=1),"assistant"!==t.role)continue;i+=1;let l=t.usage;a+=t.content.filter(e=>"toolCall"===e.type).length,l&&(e.input+=l.input??0,e.output+=l.output??0,e.cacheRead+=l.cacheRead??0,e.cacheWrite+=l.cacheWrite??0,n+=l.cost?.total??0)}return(e.total=e.input+e.output+e.cacheRead+e.cacheWrite,0===e.total&&0===S.length)?null:{sessionFile:g?.filePath||void 0,sessionId:tS.current??t?.id??"",sessionName:t?.name,userMessages:r,assistantMessages:i,toolCalls:a,toolResults:s,totalMessages:S.length,tokens:e,cost:n,totalActiveMs:g?.totalActiveMs,...ek?{contextUsage:ek}:{}}},[S,e0,ek,g?.filePath,g?.totalActiveMs,t?.id,t?.name]),nm=(0,i.useRef)(0),nf=(0,i.useCallback)((e,t)=>{e&&tS.current===e&&Array.isArray(t)&&(nm.current+=1,tg(n=>n?.sid===e&&hf(n.phases,t)?n:{sid:e,phases:t}))},[]),ng=(0,i.useCallback)((e,t,n)=>{tS.current===e&&nm.current===n&&Array.isArray(t)&&tg(n=>n?.sid===e&&hf(n.phases,t)?n:{sid:e,phases:t})},[]),nx=(0,i.useCallback)(e=>{let t="function"==typeof e?e(tN.current):e;tN.current=t,C(t)},[]),nv=(0,i.useCallback)(e=>{tT.current=e,T(e)},[]),ny=(0,i.useCallback)(async(e,t=!1,n=!1,r)=>{let i=!1;try{t&&y(!0);let s=r??null;if(!s){let n=new URLSearchParams({deferThinking:"1",deferMedia:"1"}),r=await fetch(`/api/sessions/${encodeURIComponent(e)}?${n}`);if(404===r.status)return t&&(x(null),j(null),nx([]),M(null),w(null)),null;if(!r.ok)throw Error(`HTTP ${r.status}`);s=await r.json()}if(tS.current!==e)return null;x(s),j(s.leafId),tC.current=s.leafId??null;let a=tl(s.context.messages,s.context.entryIds??[],tI.current.sessionId===e?tI.current.outputs:[]);nx(a.messages),nv(a.entryIds),M(s.context.compactedWork??null),ej(s.contextUsage??null),eM(e=>no.current?e:null),w(null);let l=!n&&t9.current===e;if(l||(eo(s.context.configuredThinkingLevel??s.context.thinkingLevel??"off"),ed(s.context.thinkingLevel)),eh(s.context.thinkingCeiling??null),i=!0,t&&y(!1),!n){if(l)try{let t=ne.current,n=await fetch(`/api/sessions/${encodeURIComponent(e)}/state`);if(n.ok&&tS.current===e){let r=await n.json();tS.current===e&&ne.current===t&&(r.state?.thinkingLevel!==void 0?(eo(r.state.configuredThinkingLevel??r.state.thinkingLevel),ed(r.state.thinkingLevel)):r.running||(t9.current=null,eo(s.context.configuredThinkingLevel??s.context.thinkingLevel??"off"),ed(s.context.thinkingLevel)))}}catch(e){console.error("Failed to refresh live thinking level:",e)}return null}try{let t=nm.current,n=await fetch(`/api/sessions/${encodeURIComponent(e)}/state`);if(!n.ok)throw Error(`HTTP ${n.status}`);let r=await n.json();if(tS.current!==e)return null;let i=r.state;return i?(void 0!==i.contextUsage&&ej(i.contextUsage??null),void 0!==i.systemPrompt&&eC(i.systemPrompt??null),void 0!==i.thinkingLevel&&(t9.current=e,eo(i.configuredThinkingLevel??i.thinkingLevel),ed(i.thinkingLevel)),void 0!==i.thinkingCeiling&&eh(i.thinkingCeiling??null),void 0!==i.extensionStatuses&&te(i.extensionStatuses??[]),void 0!==i.extensionWidgets&&tr(i.extensionWidgets??[]),void 0!==i.queuedMessages&&to(hh(i.queuedMessages)),void 0!==i.subagents&&td(e=>hd(e,i.subagents??[])),ng(e,i.todoPhases,t)):r.running||to({steering:[],followUp:[]}),r}catch(e){return console.error("Failed to load agent state:",e),null}}catch(e){return w(String(e)),null}finally{t&&!i&&y(!1)}},[ng,nv,nx]),nb=(0,i.useCallback)(e=>{let t=nc.current.then(async()=>{tS.current===e&&await ny(e)});return nc.current=t.catch(()=>{}),t},[ny]),nw=(0,i.useCallback)(async(e,t)=>{let n=++ev.current;try{let r=new URLSearchParams({deferThinking:"1",deferMedia:"1"});t&&r.set("leafId",t);let i=`/api/sessions/${encodeURIComponent(e)}/context?${r}`,s=await fetch(i);if(!s.ok)throw Error(`HTTP ${s.status}`);let a=await s.json();if(ev.current!==n||tS.current!==e)return;tC.current=t;let l=tl(a.context.messages,a.context.entryIds??[],tI.current.sessionId===e?tI.current.outputs:[]);nx(l.messages),nv(l.entryIds),M(a.context.compactedWork??null),ej(a.contextUsage??null)}catch(e){console.error("Failed to load context:",e)}},[nv,nx]),nk=(0,i.useCallback)(async e=>{try{let t=await u5(e,{type:"get_tools"});if(t){let{getPresetFromTools:e}=await Promise.resolve().then(n.bind(n,14755));nd(e(t))}}catch(e){console.error("Failed to load tools:",e)}},[nd]),nj=(0,i.useCallback)((e=0,t="(no messages)")=>{let n=tS.current;if(!m||!r||!n||t4.current)return;let i=t5.current??r;t4.current=!0,o?.({id:n,path:"",cwd:i,...i!==r?{projectRoot:r}:{},name:void 0,created:new Date().toISOString(),modified:new Date().toISOString(),messageCount:e,firstMessage:t,transient:!0})},[m,r,o]),nC=(0,i.useCallback)(async()=>{if(t2.current)return t2.current;let t=tS.current;if(t&&nn.current!==t||!t&&(!m||!r))return t;let n=(async()=>{let n=t;if(!n){let t=t6.current,i=t7.current,s=t3.current;t&&eR(t);let a={cwd:r,type:"ensure_session",toolNames:(0,up.xG)(ei),...void 0!==e.newSessionAutoWorktree?{autoWorktree:e.newSessionAutoWorktree}:{},...t?{provider:t.provider,modelId:t.modelId}:{},...i?{thinkingLevel:i}:{},...t&&null!==s?{oauthPosition:s}:{}},l=JSON.stringify(a),o=t8.current,c=o?.body===l?o.createRequestId:hb();t8.current={body:l,createRequestId:c};let d=await fetch("/api/agent/new",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...a,createRequestId:c})});if(!d.ok)throw Error((await d.json().catch(()=>({}))).error??`HTTP ${d.status}`);let u=await d.json();t8.current=null,n=u.sessionId,tS.current=n,t5.current=u.cwd??r??null,t5.current&&ea(t5.current,u.worktree),null!==nt.current&&(nn.current=n),u.model&&t6.current===t&&(eR(u.model),t||er(u.model)),u.thinkingLevel&&t7.current===i&&(eo(u.configuredThinkingLevel??u.thinkingLevel),ed(u.thinkingLevel))}for(;nn.current===n;){let e=nt.current;await u5(n,{type:"set_thinking_ceiling",ceiling:e}),nt.current===e&&nn.current===n&&(nn.current=null)}return n})();t2.current=n;try{return await n}finally{t2.current=null}},[m,r,ei,e.newSessionAutoWorktree]),nT=(0,i.useCallback)(async()=>{let e=tS.current??await nC();if(!e)return eJ([]),[];eZ(!0);try{let t=await u5(e,{type:"get_commands"}),n=t?.commands??[];return eJ(n),n}catch(e){return console.error("Failed to load slash commands:",e),eJ([]),[]}finally{eZ(!1)}},[nC]),nE=(0,i.useCallback)(()=>{tk.current+=1,tj.current=!1,tw.current&&(clearTimeout(tw.current),tw.current=null)},[]),nR=(0,i.useCallback)(()=>{tx.current?.close(),tx.current=null,tv.current=null,ty.current=null},[]),n$=(0,i.useCallback)(()=>{tb.current?.close(),tb.current=null},[]),nL=(0,i.useCallback)(e=>{n$();let t=new EventSource(`/api/agent/${encodeURIComponent(e)}/events?entries=1`);tb.current=t,t.onmessage=t=>{try{let n=JSON.parse(t.data);"session_snapshot"===n.type?tD.current?.(n):"agent_start"===n.type&&tW.current?.(e)}catch{}}},[n$]),nP=(0,i.useCallback)(e=>{nR();let t=new EventSource(`/api/agent/${encodeURIComponent(e)}/events`);tx.current=t,tv.current=e;let n=new Promise(n=>{let r=!1,i=e=>{r||(r=!0,clearTimeout(s),ty.current?.source===t&&(ty.current.pending=!1),n({status:e,source:t}))},s=setTimeout(()=>i("timeout"),5e3);t.onmessage=e=>{try{let t=JSON.parse(e.data);"update_maintenance"===t.type&&window.dispatchEvent(new CustomEvent("ompweb:update-maintenance",{detail:t})),"connected"===t.type&&i("connected"),tD.current?.(t)}catch{}},t.onerror=()=>{if(t.readyState===EventSource.CLOSED&&(i("closed"),tx.current===t&&(tM.current||tj.current))){tx.current=null,tv.current=null,ty.current=null;let t=tk.current;setTimeout(()=>{t===tk.current&&!tx.current&&(tM.current||tj.current)&&nP(e)},1e3)}}});return ty.current={source:t,promise:n,pending:!0},n},[nR]),nA=(0,i.useCallback)(async e=>{let t=tx.current;if(t&&tv.current===e){if(t.readyState===EventSource.OPEN)return;let e=ty.current;if(e?.source===t&&e.pending&&(await e.promise,tx.current===t&&t.readyState===EventSource.OPEN))return}let n=await nP(e);if("connected"!==n.status&&n.source.readyState!==EventSource.OPEN)throw tx.current===n.source&&(tx.current=null),tv.current===e&&(tv.current=null),ty.current?.source===n.source&&(ty.current=null),n.source.close(),new hy(n.status)},[nP]),n_=(0,i.useCallback)(async(e,t)=>{let n=e6.current;if(n?.id===e.id&&"sending"===n.status)return;let r=tS.current,i=e=>{e6.current=e,e5(e)};if(!r)return void i({id:e.id,status:"failed",error:"no session"});i({id:e.id,status:"sending"});try{await u5(r,{type:"extension_ui_response",id:e.id,...t})}catch(t){i({id:e.id,status:"failed",error:t instanceof Error?t.message:String(t)});return}i(null),e8(t=>t?.id===e.id?null:t)},[]),nF=(0,i.useCallback)(async(e,t)=>{let n=tS.current;if(n)try{await u5(n,{type:"extension_ui_input",id:e.id,data:t})}catch(e){console.error("Failed to send extension custom UI input:",e)}},[]),nO=(0,i.useCallback)(e=>{let t=e.message.trim();t&&eX({type:"add",notice:{id:e.id??hb(),message:t,type:e.type??"info"}})},[]),nz=(0,i.useCallback)(e=>{let t={role:"custom",customType:tt,content:eP(e).trim(),display:!0,timestamp:Date.now()},n=tI.current,r=tS.current;n.sessionId!==r&&(n.sessionId=r,n.outputs=[]);let i=tT.current.slice(0,tN.current.length),s=null;for(let e=i.length-1;e>=0;e--)if(!ta(i[e])){s=i[e];break}n.seq+=1,n.outputs.push({entryId:`${ts}${n.seq}`,baseEntryId:s,message:t});let a=tl(tN.current,tT.current,n.outputs);nx(a.messages),nv(a.entryIds)},[nx,nv]),nD=(0,i.useCallback)(t=>{if("custom"!==t.method&&"closed"in t&&t.closed){e8(e=>e?.id===t.id?null:e),e6.current?.id===t.id&&(e6.current=null,e5(null));return}switch(u2(t)&&l?.(t),t.method){case"select":case"confirm":case"input":case"editor":case"ask":case"form":case"plan_review":e8(t);break;case"notify":nO({id:t.id,message:t.message,type:t.notifyType??"info"});break;case"setStatus":te(e=>{let n=e.filter(e=>e.key!==t.statusKey);return void 0!==t.statusText?[...n,{key:t.statusKey,text:t.statusText}]:n});break;case"setWidget":tr(e=>{let n=e.filter(e=>e.key!==t.widgetKey);return t.widgetLines?[...n,{key:t.widgetKey,lines:t.widgetLines,placement:t.widgetPlacement??"aboveEditor"}]:n});break;case"setTitle":t.title&&(document.title=t.title);break;case"set_editor_text":e.chatInputRef?.current?.insertText(t.text);break;case"custom":e7(e=>t.closed?e?.id===t.id?null:e:t)}},[nO,l,e.chatInputRef]),nW=(0,i.useCallback)(()=>{let e=tM.current;return tM.current=!1,L(!1),eK(null),hM(tE.current),ew(null),R({type:"end"}),e},[]),nH=(0,i.useCallback)(()=>{tP.current="unknown",tA.current=null;let e=hx(tN.current,tT.current);t_.current=e?{entryId:e.entryId,key:hN(e.message)}:null,tF.current+=1},[]),nU=(0,i.useCallback)(()=>{let e=tP.current,t=tA.current;if("unknown"===e){let n=hx(tN.current,tT.current),r=n?.message,i=t_.current;null!==n&&(null===i||(null!==n.entryId&&null!==i.entryId?n.entryId!==i.entryId:hN(n.message)!==i.key))&&r?.role==="assistant"&&r.stopReason&&(e=hg(r),t??={provider:r.provider,...r.model?{model:r.model}:{},...void 0!==r.credentialId?{credentialId:r.credentialId}:{}})}return{outcome:e,sessionId:tS.current,...t?{provider:t.provider,...t.model?{model:t.model}:{},...void 0!==t.credentialId?{credentialId:t.credentialId}:{}}:{}}},[]),nB=(0,i.useCallback)(e=>{let t=nU();if("unknown"!==t.outcome||!e)return void a?.(t);let n=tF.current;e.catch(()=>void 0).then(()=>{let e=tS.current===t.sessionId&&tF.current===n;a?.(e?nU():t)})},[a,nU]),nq=(0,i.useCallback)((e,t)=>tL.current!==e&&(tL.current=e,nB(t),!0),[nB]),nV=(0,i.useCallback)(e=>{nE(),tj.current=!0;let t=tk.current,n=async()=>{if(t===tk.current&&tS.current===e&&tj.current)try{let r=nm.current,i=await fetch(`/api/agent/${encodeURIComponent(e)}`);if(!i.ok)throw Error(`HTTP ${i.status}`);let s=await i.json();if(t!==tk.current||tS.current!==e||!tj.current)return;let a=s.state;if(td(e=>hd(e,a?.subagents??[])),ng(e,a?.todoPhases,r),s.running&&a&&(a.isStreaming||a.isPromptRunning||a.isHandoffRunning)){tj.current=!1,tw.current=null,tR.current=!!a?.isStreaming,t$.current=!!a?.isPromptRunning,tM.current=!0,L(!0),eK(a?.isStreaming?{kind:"waiting_model"}:{kind:"running_command"});return}if(s.running&&a?.isCompacting){e_(!0),eH(hm(a)),tw.current=setTimeout(()=>void n(),600);return}if(s.running&&(a?.subagents?.length??0)>0){tw.current=setTimeout(()=>void n(),1e3);return}tj.current=!1,tw.current=null,nR()}catch{if(t!==tk.current||tS.current!==e||!tj.current)return;tw.current=setTimeout(()=>void n(),600)}};tw.current=setTimeout(()=>void n(),3e4)},[ng,nE,nR]),nK=(0,i.useCallback)(async(e=tS.current,t=ns.current)=>{if(ns.current===t)try{e&&await ny(e)}finally{if(ns.current!==t)return;let n=t$.current,r=tR.current;t$.current=!1,tR.current=!1,nl.current=null;let i=nW();n?nq(t):r&&i&&nB(),e&&nV(e)}},[ny,nB,nq,nV,nW]),nG=(0,i.useCallback)(async(e,t)=>{await hw(800);let n=Date.now();for(;tM.current&&Date.now()-n<2e4;){if(void 0!==t&&ns.current!==t)return;try{let n=await fetch(`/api/agent/${encodeURIComponent(e)}`);if(n.ok){let r=await n.json(),i=r.state;if(!r.running||!i||!i.isStreaming&&!i.isPromptRunning)return void await nK(e,t)}}catch{}await hw(600)}},[nK]),nJ=(0,i.useCallback)(async e=>{let t=tz.current+1;for(tz.current=t;tO.current&&tz.current===t&&tS.current===e;){await hw(1e3);try{let n=await fetch(`/api/agent/${encodeURIComponent(e)}`);if(!n.ok)continue;let r=await n.json();if(r.state?.isBashRunning)continue;if(await ny(e),tz.current!==t||tS.current!==e)return;tO.current=!1,A(!1),F(null);return}catch{}}},[ny]),nY=(0,i.useCallback)(async e=>{if(!tM.current)return;let t=ns.current;try{let n=nm.current,r=await fetch(`/api/agent/${encodeURIComponent(e)}`);if(!r.ok)return;let i=await r.json();if(ns.current!==t)return;let s=i.state;if(e_(s?.isCompacting??!1),eH(hm(s)),to(hh(s?.queuedMessages)),s?.contextUsage!==void 0&&ej(s.contextUsage??null),td(e=>hd(e,s?.subagents??[])),ng(e,s?.todoPhases,n),i.running&&s&&(s.isStreaming||s.isPromptRunning||s.isCompacting||s.isHandoffRunning)||!tM.current)return;s&&(void 0!==s.systemPrompt&&eC(s.systemPrompt??null),void 0!==s.extensionStatuses&&te(s.extensionStatuses??[]),void 0!==s.extensionWidgets&&tr(s.extensionWidgets??[])),await nK(e,t)}catch{}},[ng,nK]),nZ=(0,i.useCallback)(async e=>{let t=await ny(e,!1,!0),n=t?.state;return!!t?.running&&!!n&&tS.current===e&&!tM.current&&!!(n.isStreaming||n.isPromptRunning||n.isHandoffRunning)&&(tR.current=!!n.isStreaming,t$.current=!!n.isPromptRunning,tM.current=!0,L(!0),eK(n.isStreaming?{kind:"waiting_model"}:{kind:"running_command"}),R({type:"start"}),hE(tE.current,e,n.pendingToolCalls),nP(e),!n.isStreaming&&n.isPromptRunning&&nG(e),!0)},[nP,ny,nG]),nQ=(0,i.useCallback)(async(e,t=ns.current)=>{let n=na.current+1;na.current=n;try{let r=await fetch(`/api/agent/${encodeURIComponent(e)}`);if(!r.ok)return;let i=await r.json();if(n!==na.current||tS.current!==e||ns.current!==t)return;i.state?.contextUsage!==void 0&&ej(i.state.contextUsage??null)}catch{}},[]);(0,i.useEffect)(()=>{if(!eA){eU.current=null,eH(null);return}eH(e=>e??{startedAt:Date.now(),reason:eU.current})},[eA]),(0,i.useEffect)(()=>{if(!$&&!eA)return;let e=()=>{let e=tS.current;e&&nQ(e)};e();let t=setInterval(e,1e3);return()=>clearInterval(t)},[$,eA,nQ]),(0,i.useEffect)(()=>{if(!$)return;let e=()=>{let e=tS.current;e&&nY(e)},t=()=>{"visible"===document.visibilityState&&e()},n=setInterval(e,15e3);return document.addEventListener("visibilitychange",t),window.addEventListener("online",e),()=>{clearInterval(n),document.removeEventListener("visibilitychange",t),window.removeEventListener("online",e)}},[$,nY]),(0,i.useEffect)(()=>{if($)return;let e=()=>{let e=tS.current;e&&!tM.current&&nZ(e)},t=()=>{"visible"===document.visibilityState&&e()},n=e=>{let t=tS.current,n=e.detail?.sessionId;t&&n===t&&!tM.current&&nZ(t).then(e=>{e||tS.current!==t||tM.current||ny(t)})};return document.addEventListener("visibilitychange",t),window.addEventListener("online",e),window.addEventListener(ht,n),()=>{document.removeEventListener("visibilitychange",t),window.removeEventListener("online",e),window.removeEventListener(ht,n)}},[$,nZ,ny]),tW.current=e=>{if(tS.current!==e||tM.current||tx.current||tH.current)return;let t=nZ(e).then(async t=>{t||tS.current!==e||tM.current||await ny(e)}).catch(()=>{}).finally(()=>{tH.current===t&&(tH.current=null)});tH.current=t},(0,i.useEffect)(()=>{tM.current=$},[$]),tD.current=(0,i.useCallback)(e=>{var t;switch(e.type){case"session_snapshot":{let t=function(e,t,n,r,i){if("session_snapshot"!==e.type||"string"!=typeof e.sessionId||e.sessionId!==t||"string"!=typeof e.entryId||""===e.entryId||e.entryId===n||!e.context||!Array.isArray(e.context.messages)||!Array.isArray(e.context.entryIds)||e.context.messages.length!==e.context.entryIds.length)return null;let s=e.context.messages,a=new Map;for(let e of s){let t=hN(e);a.set(t,(a.get(t)??0)+1)}let l=Math.min(r.length,i.length);for(let e of r.slice(0,l)){let t=hN(e),n=a.get(t)??0;n>0&&a.set(t,n-1)}let o=r.slice(l).filter(e=>{let t=hN(e),n=a.get(t)??0;return 0===n||(a.set(t,n-1),!1)});return{entryId:e.entryId,messages:[...s,...o],entryIds:[...e.context.entryIds],compactedWork:e.context.compactedWork??null}}(e,tS.current,tC.current,tN.current,tT.current);if(!t)break;tC.current=t.entryId;let n=tl(t.messages,t.entryIds,tI.current.sessionId===tS.current?tI.current.outputs:[]);nx(n.messages),nv(n.entryIds),M(t.compactedWork);break}case"agent_start":{let e=!tM.current;nE(),e&&nH(),tR.current=!0,tM.current=!0,L(!0),eK({kind:"waiting_model"}),R({type:"start"});break}case"agent_end":if(!tM.current)break;if(eK(null),hM(tE.current),ew(null),R({type:"end"}),tS.current){ny(tS.current);let e=nm.current;fetch(`/api/agent/${encodeURIComponent(tS.current)}`).then(e=>e.json()).then(t=>{t.state?.contextUsage!==void 0&&ej(t.state.contextUsage??null),t.state?.systemPrompt!==void 0&&eC(t.state.systemPrompt??null),t.state?.extensionStatuses!==void 0&&te(t.state.extensionStatuses??[]),t.state?.extensionWidgets!==void 0&&tr(t.state.extensionWidgets??[]),t.state?.subagents!==void 0&&td(e=>hd(e,t.state?.subagents??[])),tS.current&&ng(tS.current,t.state?.todoPhases,e),t.state?.goal!==void 0&&tG(t.state.goal??null),to(hh(t.state?.queuedMessages))}).catch(()=>{})}break;case"goal_status":tG(e.status??null);break;case"agent_settled":{let e=tR.current;if(tR.current=!1,!e||t$.current)break;let t=tS.current,n=nW();e_(!1);let r=t?ny(t):void 0;t&&nV(t),n&&nB(r);break}case"prompt_done":{let e=ns.current,t=t$.current;t$.current=!1,nl.current=null;let n=tL.current!==e;if(!t&&!n)break;let r=tS.current;nq(e,r?ny(r):void 0),!tR.current&&(nW(),r&&nV(r))}break;case"prompt_error":tP.current="failed",nO({type:"error",message:e.errorMessage??"Command failed"});break;case"extension_error":tP.current="failed",nO({type:"error",message:e.error??"Extension command failed"});break;case"message_start":case"message_update":{if(!tM.current)break;let t=e.message;if(t?.role!=="assistant")break;t&&R({type:"update",message:oi(t)}),eK(null);break}case"message_end":{if(!tM.current)break;let t=e.message;if(t?.role==="assistant"&&(tA.current={provider:t.provider,...t.model?{model:t.model}:{},...void 0!==t.credentialId?{credentialId:t.credentialId}:{}},tP.current=hg(t)),t&&"user"===t.role){let e=oi(t),n=hC(e),r=nl.current;nl.current=null,nx(t=>{let i=t[t.length-1];return r&&i?.role==="user"&&hC(i)===r?r===n?t:[...t.slice(0,-1),e]:[...t,e]}),r||th({type:"user-message",kind:lG(e),text:lK(e),images:"user"!==e.role||"string"==typeof e.content?0:e.content.filter(e=>"image"===e.type).length})}else t&&nx(e=>[...e,oi(t)]);let n=tS.current;n&&nQ(n),R({type:"reset"}),eK(e=>t?.role==="toolResult"&&e?.kind==="running_tools"?e:{kind:"waiting_model"});break}case"thinking_level_changed":{let t=tS.current,n=e.thinkingLevel;t&&void 0!==n&&(t9.current=t,ne.current+=1,eo(e.configured??n),ed(n));break}case"todo_changed":nf(tS.current,e.phases);break;case"tool_execution_start":{let t=e.toolCallId,n=e.toolName,r=e.args,i=nI(tS.current,t);i&&tE.current.add(i),eK(e=>{let i=e?.kind==="running_tools"?[...e.tools]:[];return i.some(e=>e.id===t)||i.push({id:t,name:n,args:r}),{kind:"running_tools",tools:i}});break}case"tool_execution_update":{let n=nI(tS.current,"string"==typeof e.toolCallId?e.toolCallId:null);n&&tE.current.has(n)&&"string"==typeof e.text&&(t=e.text,nS.get(n)!==t&&(nS.set(n,t),nN()));break}case"tool_execution_end":{let t=e.toolCallId,n=nI(tS.current,t);n&&tE.current.delete(n)&&nM([n]),eK(e=>{if(e?.kind!=="running_tools")return e;let n=e.tools.filter(e=>e.id!==t);return 0===n.length?{kind:"waiting_model"}:{kind:"running_tools",tools:n}});break}case"subagent_lifecycle":{let t=e.payload;if(!t?.id)break;if("started"!==t.status){let e="failed"===t.status?"failed":"aborted"===t.status?"aborted":"completed";td(n=>{let r=n.find(e=>e.id===t.id);return hd(n,[{id:t.id,index:t.index??r?.index??0,agent:t.agent??r?.agent??t.id,agentSource:t.agentSource??r?.agentSource??"bundled",description:t.description??r?.description,status:e,task:r?.task,assignment:r?.assignment,sessionFile:t.sessionFile??r?.sessionFile,parentToolCallId:t.parentToolCallId??r?.parentToolCallId,lastUpdate:Date.now(),progress:r?.progress?{...r.progress,status:e}:void 0}])});break}let n={id:t.id,index:t.index??0,agent:t.agent??t.id,agentSource:t.agentSource??"bundled",description:t.description,status:"running",sessionFile:t.sessionFile,parentToolCallId:t.parentToolCallId,lastUpdate:Date.now()};td(e=>hd(e,[n]));break}case"subagent_progress":{let t=e.payload;if(!t?.progress)break;let n=t.progress,r={id:n.id,index:t.index??n.index,agent:t.agent??n.agent,agentSource:t.agentSource??"bundled",description:n.description,status:n.status,task:t.task??n.task,assignment:t.assignment??n.assignment,sessionFile:t.sessionFile,parentToolCallId:t.parentToolCallId,lastUpdate:Date.now(),progress:n};td(e=>hd(e,[r]));break}case"queue_update":to({steering:[...e.steering??[]],followUp:[...e.followUp??[]]});break;case"auto_retry_start":ew({attempt:e.attempt,maxAttempts:e.maxAttempts,errorMessage:e.errorMessage});break;case"auto_retry_end":ew(null);break;case"auto_compaction_start":case"compaction_start":if("string"==typeof e.reason){eU.current=e.reason;let t=e.reason;eH(e=>e?{...e,reason:t}:e)}e_(!0),eO(null),eD(null);break;case"auto_compaction_end":case"compaction_end":if(e_(!1),e.errorMessage)eO(e.errorMessage),eD(null);else if(!e.aborted){eD(hT(e.result,e.reason??"auto"));let t=tS.current;t&&(ny(t),nQ(t))}break;case"extension_ui_request":nD(e)}},[nO,nf,ng,nE,nD,ny,nB,nq,nQ,nH,nV,nW,nv,nx]);let nX=(0,i.useCallback)(async(n,i,s)=>{let a=n.trim();if(!a&&!i?.length&&!s?.length)return"returned";if(tM.current||tO.current||no.current)return"unknown";let l=iG(n,s??[]),o=!i?.length&&!s?.length&&a.startsWith("/");if(!i?.length&&!s?.length&&a.startsWith("!")){let e=a.startsWith("!!"),t=(e?a.slice(2):a.slice(1)).trim();return t?(await tJ.current?.(t,e),"accepted"):"unknown"}nH();let c=ns.current+1;nE(),t$.current=!0;let d=i?.map(e=>({type:"image",source:{type:"base64",media_type:e.mimeType,data:e.data}})),u={role:"user",content:d?.length?[...l.trim()?[{type:"text",text:l}]:[],...d]:l,timestamp:Date.now()};nx(e=>[...e,u]),nl.current=hC(u),ns.current=c,tM.current=!0,L(!0),eK(o?{kind:"running_command"}:{kind:"waiting_model"}),R({type:"start"}),tX.current(!0);let h=i?.map(e=>({type:"image",data:e.data,mimeType:e.mimeType})),p=null,f=!1,g="unknown";try{if(m&&r){let e=tS.current??await t2.current,t=await nC();t&&(p=t,Q&&(eR(Q),e&&await u5(t,{type:"set_model",provider:Q.provider,modelId:Q.modelId})),await nA(t),f=!0,await u5(t,{type:"prompt",message:l,...h?.length?{images:h}:{}}),nj(1,n),g="accepted")}else t&&(p=t.id,await nA(t.id),f=!0,await u5(t.id,{type:"prompt",message:l,...h?.length?{images:h}:{}}),g="accepted");return o&&p&&nG(p,c),g}catch(l){console.error("Failed to send message:",l);let r=l instanceof u4&&"update_draining"===l.code&&!1===l.accepted;if(!(!f||l instanceof u4&&"prompt_rejected"===l.code&&!1===l.accepted||r)&&p)return nG(p,c),"unknown";t$.current=!1,tM.current=!1,nR();let a=nl.current;return a&&nx(e=>{let t=e[e.length-1];return t?.role==="user"&&hC(t)===a?e.slice(0,-1):e}),nO({type:"error",message:l instanceof Error?l.message:String(l)}),e.chatInputRef?.current?.restoreSubmission?.(n,hI(i),s,t?.id??p??void 0),nl.current=null,L(!1),eK(null),R({type:"end"}),"returned"}},[m,r,Q,t,nC,nA,nj,nG,nO,nE,nR,e.chatInputRef,nH,nx]);tJ.current=(0,i.useCallback)(async(n,r)=>{if(tM.current||tO.current)return;let i=`${r?"!!":"!"}${n}`;tO.current=!0,tX.current(!0),F({command:n,excludeFromContext:r}),A(!0);try{let e=tS.current??t?.id??await nC();if(!e)throw Error("Unable to create a session for the shell command");await u5(e,{type:"bash",command:n,excludeFromContext:r}),await ny(e),nj(1,i)}catch(t){console.error("Failed to execute shell command:",t),nO({type:"error",message:t instanceof Error?t.message:String(t)}),e.chatInputRef?.current?.insertIfEmpty(i)}finally{tO.current=!1,F(null),A(!1)}},[nO,nC,ny,e.chatInputRef,nj,t]);let n0=(0,i.useCallback)(async()=>{let e=tS.current;if(e){if(tO.current){try{await u5(e,{type:"abort_bash"})}catch(e){console.error("Failed to abort bash:",e)}return}try{await u5(e,{type:"abort"}),tP.current="aborted"}catch(e){console.error("Failed to abort:",e)}}},[]),n1=(0,i.useCallback)(async e=>{if(tO.current)return{forked:!1,error:"Cannot fork while a shell command is running"};let t=tS.current;if(!t)return{forked:!1,error:"No active session to fork"};eT(e??null);try{let{cancelled:n,newSessionId:r}=await u5(t,{type:"fork",...e?{entryId:e}:{}})??{};if(!n&&r)return c?.(r),{forked:!0};return{forked:!1,error:"Fork was cancelled"}}catch(e){return console.error("Fork failed:",e),{forked:!1,error:e instanceof Error?e.message:String(e)}}finally{eT(null)}},[c]),n2=(0,i.useCallback)(async e=>{if(tO.current)return;let t=tS.current;t&&(u5(t,{type:"navigate_tree",targetId:e}).catch(()=>{}),j(e),await nw(t,e))},[nw]),n8=(0,i.useCallback)(async e=>{if(tO.current)return;j(e);let t=tS.current;t&&(await nw(t,e),e&&u5(t,{type:"navigate_tree",targetId:e}).catch(()=>{}))},[nw]),n4=(0,i.useCallback)(async(e,t)=>{if(m){let n={provider:e,modelId:t},r=t6.current?.provider===e;t6.current=n,r||(t3.current=null,et(null)),X(n),eR(n);let i=tS.current??await t2.current;if(!i)return;try{await u5(i,{type:"set_model",provider:e,modelId:t})}catch(e){console.error("Failed to set model:",e)}return}let n=tS.current;if(n&&!no.current){no.current=!0,eM({provider:e,modelId:t}),eL(!0);try{await u5(n,{type:"set_model",provider:e,modelId:t}),no.current=!1,await ny(n)}catch(e){console.error("Failed to set model:",e),no.current=!1,eM(eI),nO({type:"error",message:`Failed to switch model: ${e instanceof Error?e.message:String(e)}`}),await ny(n)}finally{no.current=!1,eL(!1)}}},[nO,eI,m,ny,X]),n5=(0,i.useCallback)(async e=>{let t={provider:e.provider,modelId:e.modelId},n=e.oauthPosition,r={type:"set_model",provider:e.provider,modelId:e.modelId,thinkingLevel:"auto",...void 0!==n?{oauthPosition:n}:{}},i=t=>`${e.alias} preset was not applied: ${t instanceof Error?t.message:String(t)}`;if(m){if(no.current)return!1;no.current=!0,eL(!0);let e=t6.current,s=t3.current,a=t7.current;try{t6.current=t,t3.current=n??null,t7.current="auto";let e=tS.current??await t2.current;return e&&await u5(e,r),X(t),et(n??null),eR(t),eo("auto"),ed(void 0),e&&await ny(e),!0}catch(n){console.error("Failed to apply Main preset:",n),t6.current=e,t3.current=s,t7.current=a,nO({type:"error",message:i(n)});let t=tS.current;return t&&await ny(t),!1}finally{no.current=!1,eL(!1)}}let s=tS.current;if(!s||no.current)return!1;no.current=!0,eM(t),eL(!0);try{return await u5(s,r),await ny(s),!0}catch(e){return console.error("Failed to apply Main preset:",e),eM(eI),nO({type:"error",message:i(e)}),await ny(s),!1}finally{no.current=!1,eL(!1)}},[nO,eI,ec,m,ny,X,el]),n6=(0,i.useCallback)(async e=>{let t=Y.find(t=>t.role===e),n=t?.resolved;if(!n)return;if(m){let e={provider:n.provider,modelId:n.modelId},t=n.thinkingLevel;t7.current=t??null,eo(t??"auto"),ed(void 0),t6.current=e,t3.current=null,et(null),X(e),eR(e)}let r=tS.current??(m?await t2.current:null);if(r)try{await u5(r,{type:"set_role_model",role:e}),m||eM({provider:n.provider,modelId:n.modelId})}catch(e){console.error("Failed to set role model:",e)}},[m,Y,X]),n3=(0,i.useCallback)(async()=>{let e=tS.current;if(e&&!eA){eU.current="manual",e_(!0),eO(null),eD(null);try{let t=await u5(e,{type:"compact"});eD(hT(t,"manual")),await ny(e,!0)}catch(e){eO(e instanceof Error?e.message:String(e)),eD(null)}finally{e_(!1)}}},[eA,ny]),n7=(0,i.useCallback)(async e=>{let n=r??t?.cwd??"",i=n?`/api/models?cwd=${encodeURIComponent(n)}`:"/api/models",s=await fetch(i,e?{signal:e}:void 0);if(!s.ok)throw Error(`HTTP ${s.status}`);let a=await s.json();z(a.models),U(a.modelError??null),q(a.modelScopeWarnings??[]),K(a.thinkingLevels??{}),J(a.thinkingLevelMaps??{}),Z(a.roles??[]);let l=a.modelList??[];if(W(l),m&&!tS.current){let e=(a.defaultModel?l.find(e=>e.id===a.defaultModel?.modelId&&e.provider===a.defaultModel?.provider):void 0)??l[0];er(e?{provider:e.provider,modelId:e.id}:null);let t=e&&a.thinkingLevelPins?.[`${e.provider}/${e.id}`];null===t7.current&&eo(t??"auto")}},[m,r,t?.cwd]),n9=(0,i.useCallback)(async e=>{if(!e.startsWith("/"))return{handled:!1};let t=e.match(/^\/([^\s]+)(?:\s+([\s\S]*))?$/);if(!t)return{handled:!1};let[,n,r=""]=t,i=r.trim(),s=await nC(),a=e=>(e.handled&&(e.error?nO({type:"error",message:e.error}):"openSessionStats"!==e.action&&nO({type:"success",message:e.message??"Command completed"})),e);try{switch(n){case"compact":{if(!s||eA)return a({handled:!0,error:"No active session to compact"});eU.current="manual",e_(!0),eO(null),eD(null);let e=await u5(s,{type:"compact",...i?{customInstructions:i}:{}});return eD(hT(e,"manual")),await ny(s,!0)&&nj(),a({handled:!0,message:"Compacted context"})}case"reload":if(!s)return a({handled:!0,error:"No active session to reload"});return await u5(s,{type:"reload"}),await Promise.all([ny(s,!1,!0),nk(s),nT(),n7()]),a({handled:!0,message:"Reloaded session resources"});case"name":if(!s)return a({handled:!0,error:"No active session to name"});if(!i)return a({handled:!0,error:"Usage: /name <name>"});return await u5(s,{type:"set_session_name",name:i}),await ny(s)&&nj(),a({handled:!0,message:`Session renamed to ${i}`});case"session":{if(!s)return a({handled:!0,error:"No active session"});let e=await u5(s,{type:"get_session_stats"});return e&&e1(e),p?.(),a({handled:!0,action:"openSessionStats"})}case"copy":{if(!s)return a({handled:!0,error:"No active session"});let e=await u5(s,{type:"get_last_assistant_text"}),t=e?.text??"";if(!t)return a({handled:!0,error:"No assistant message to copy"});return await navigator.clipboard.writeText(t),a({handled:!0,message:"Copied last assistant message"})}case"fork":{if(!s)return a({handled:!0,error:"No active session to fork"});let e=await n1();if(!e.forked)return a({handled:!0,error:e.error??"Fork failed"});return a({handled:!0,message:"Forked a new session"})}case"goal":{if(!s)return a({handled:!0,error:"No active session"});let e=await u5(s,{type:"goal",args:i});if(tG(e?.status??null),e?.error)return a({handled:!0,error:e.error});if(e?.message&&e.message.includes("\n")){if(nz(e.message),e.prompt)return{handled:!0,prompt:e.prompt};return{handled:!0}}if(e?.prompt)return e.message&&nO({type:"success",message:e.message}),{handled:!0,prompt:e.prompt};return a({handled:!0,message:e?.message??"Command completed"})}case"handoff":if(!s)return a({handled:!0,error:"No active session"});if(tM.current||tO.current)return a({handled:!0,error:"Cannot hand off while the session is busy"});tM.current=!0,L(!0),eK({kind:"running_command"});try{await nA(s);let e=await u5(s,{type:"handoff",...i?{customInstructions:i}:{}});if(!e||e.cancelled)return a({handled:!0,error:"Handoff cancelled"});return await ny(s,!0)&&nj(),a({handled:!0,message:"컨텍스트를 현재 세션에 압축했습니다"})}finally{tM.current=!1,L(!1),eK(null),tS.current===s&&nV(s)}default:{if(!s)return a({handled:!0,error:"No active session"});let t=await u5(s,{type:"execute_slash_command",message:e});if(!t?.handled)return{handled:!1};let n=t.output?.filter(e=>e.trim()).join("\n\n")??"";if(n&&nz(n),t.prompt)return{handled:!0,prompt:t.prompt};if(n)return{handled:!0};return a({handled:!0,message:"Command completed"})}}}catch(e){return a({handled:!0,error:e instanceof Error?e.message:String(e)})}finally{"compact"===n&&e_(!1)}},[nO,nz,nA,nC,n1,eA,n7,ny,nT,nk,nj,p,nV]),re=(0,i.useCallback)(async(t,n,r)=>{let i=tS.current;if(!i)return nO({type:"error",message:"The session is not ready yet, so the message was returned to the composer."}),e.chatInputRef?.current?.restoreSubmission?.(t,hI(n),r),"returned";let s=iG(t,r??[]),a=n?.map(e=>({type:"image",data:e.data,mimeType:e.mimeType})),l=++tp.current;th({type:"submit",id:l,kind:"steer",text:s,images:a?.length??0});try{return await u5(i,{type:"steer",message:s,...a?.length?{images:a}:{}}),th({type:"ack",id:l}),"accepted"}catch(s){return th({type:"fail",id:l}),console.error("Failed to steer:",s),nO({type:"error",message:s instanceof Error?s.message:String(s)}),e.chatInputRef?.current?.restoreSubmission?.(t,hI(n),r,i),"returned"}},[nO,e.chatInputRef]),rt=(0,i.useCallback)(async(t,n,r,i)=>{let s=tS.current;if(!s)return nO({type:"error",message:"The session is not ready yet, so the message was returned to the composer."}),e.chatInputRef?.current?.restoreSubmission?.(t,hI(r),i),"returned";let a=iG(t,i??[]),l=r?.map(e=>({type:"image",data:e.data,mimeType:e.mimeType})),o=++tp.current;th({type:"submit",id:o,kind:n,text:a,images:l?.length??0});try{return await u5(s,{type:"prompt",message:a,streamingBehavior:n,...l?.length?{images:l}:{}}),th({type:"ack",id:o}),"accepted"}catch(n){return th({type:"fail",id:o}),console.error("Failed to queue prompt:",n),nO({type:"error",message:n instanceof Error?n.message:String(n)}),e.chatInputRef?.current?.restoreSubmission?.(t,hI(r),i,s),"returned"}},[nO,e.chatInputRef]),rn=(0,i.useCallback)(async(t,n,r)=>{let i=tS.current;if(!i)return nO({type:"error",message:"The session is not ready yet, so the message was returned to the composer."}),e.chatInputRef?.current?.restoreSubmission?.(t,hI(n),r),"returned";let s=iG(t,r??[]),a=n?.map(e=>({type:"image",data:e.data,mimeType:e.mimeType})),l=++tp.current;th({type:"submit",id:l,kind:"followUp",text:s,images:a?.length??0});try{return await u5(i,{type:"follow_up",message:s,...a?.length?{images:a}:{}}),th({type:"ack",id:l}),"accepted"}catch(s){return th({type:"fail",id:l}),console.error("Failed to follow up:",s),nO({type:"error",message:s instanceof Error?s.message:String(s)}),e.chatInputRef?.current?.restoreSubmission?.(t,hI(n),r,i),"returned"}},[nO,e.chatInputRef]),rr=(0,i.useCallback)(async()=>{let e=tS.current;if(e)try{await u5(e,{type:"abort_compaction"})}catch(e){console.error("Failed to abort compaction:",e)}},[]),ri=(0,i.useCallback)(async()=>{let t=tS.current;if(t)try{var n;let r=await u5(t,{type:"clear_queue"});th({type:"withdraw"}),to({steering:[],followUp:[]});let i={text:(n=[...r?.steering??[],...r?.followUp??[]]).map(({text:e,images:t})=>t?.length&&"[Image]"===e?"":e).filter(e=>e.trim()).join("\n\n"),images:n.flatMap(({images:e})=>e??[]).map(({data:e,mimeType:t})=>({data:e,mimeType:t}))};e.chatInputRef?.current?.restoreSubmission?.(i.text,i.images.length?i.images:void 0,void 0,t)}catch(e){console.error("Failed to recall queued messages:",e),nO({type:"error",message:"Failed to recall queued messages"})}},[e.chatInputRef,nO]),rs=(0,i.useCallback)(async(e,t)=>{let n=tS.current;if(n)try{let r=await u5(n,{type:"remove_queued_message",message:t,queue:e});if(!r?.removed)return;th({type:"withdraw",kind:"steering"===e?"steer":"followUp",text:t}),to(n=>{let r=n[e].indexOf(t);return(r<0&&""===t.trim()&&(r=n[e].indexOf("[Image]")),r<0)?n:{...n,[e]:n[e].filter((e,t)=>t!==r)}})}catch(e){console.error("Failed to remove queued message:",e),nO({type:"error",message:"Failed to remove queued message"})}},[nO]),ra=(0,i.useCallback)(async(e,t=null)=>{let n="auto"===e?t:null,r=n!==eu;eo(e),eh(n),m&&(!tS.current||nn.current===tS.current)&&(t7.current=e,nt.current=n),ed(void 0);let i=tS.current??await t2.current;if(i)try{nn.current===i?await nC():r&&await u5(i,{type:"set_thinking_ceiling",ceiling:n}),await u5(i,{type:"set_thinking_level",level:e}),await ny(i)}catch(e){console.error("Failed to set thinking level:",e),nO({type:"error",message:"Failed to set thinking level"}),await ny(i)}},[m,ny,nO,eu,nC]);ey.current=nh?`${nh.provider}/${nh.modelId}`:"";let rl=e=>e?`${e}|${ey.current}`:null,ro=t?.id??tS.current,rc=rl(ro),rd=ep&&ep.key===rc?ep.value:null;(0,i.useEffect)(()=>{let e=++ex.current;rc&&ro&&!$&&!e$&&fetch(`/api/agent/${encodeURIComponent(ro)}`).then(e=>e.json()).then(t=>{ex.current===e&&rl(tS.current)===rc&&em({key:rc,value:(t.running?hp(t.state):void 0)??null})}).catch(()=>{})},[rc,$,e$]);let ru=(0,i.useCallback)(async()=>{let e=tS.current??await nC(),t=rl(tS.current);if(!e||!t)return;let n=++ex.current,r=()=>ex.current===n&&rl(tS.current)===t,i=e=>{r()&&em({key:t,value:e})};eg(!0);try{let n=ep?.key===t?ep.value?.enabled:void 0;if(void 0===n){let t=hp(await u5(e,{type:"get_state"}));if(!t)throw Error("Could not read the session's Fast state");n=t.enabled}if(!r())return;let s=await u5(e,{type:"set_fast_mode",enabled:!n});i({enabled:s?.enabled===!0,active:s?.active===!0})}catch(t){if(!r())return;nO({type:"error",message:t instanceof Error?t.message:String(t)});try{i(hp(await u5(e,{type:"get_state"}))??null)}catch{i(null)}}finally{eg(!1)}},[nC,ep,nO]),rh=(0,i.useCallback)(async e=>{let t=(0,up.xG)(e);nd(e);let n=tS.current??await t2.current;if(n)try{await u5(n,{type:"set_tools",toolNames:t})}catch(e){console.error("Failed to set tools:",e)}},[nd]),rp=(0,i.useCallback)(e=>{tB.current=e,tV(t=>!e===t?t:!e)},[]);tX.current=e=>{tZ.current=null,rp(e)};let rm=(0,i.useCallback)((e="smooth")=>{tQ.current=Date.now()+700,t0.current?.scrollIntoView({behavior:e})},[]),rf=(0,i.useCallback)(()=>{tY.current=0,tZ.current=null,rp(!0),rm("smooth")},[rm,rp]),rg=(0,i.useCallback)(()=>{tY.current=0,tZ.current=null,rp(!1)},[rp]),rx=(0,i.useCallback)(()=>{if(!tZ.current)return;tZ.current=null;let e=t1.current;e&&rp(e.scrollHeight-e.scrollTop-e.clientHeight<=72)},[rp]),rv=(0,i.useCallback)(e=>{if(e instanceof PointerEvent&&"mouse"===e.pointerType&&1===e.button&&!(e.target instanceof Element&&e.target.closest("a[href], input, textarea"))&&!(e.target instanceof HTMLElement&&e.target.isContentEditable)){if(tZ.current)return void rx();rg();let e=t1.current;return void(tZ.current=e?{top:e.scrollTop,moved:!1,released:!1}:null)}rx(),e instanceof KeyboardEvent&&(!hv.has(e.key)||e.target instanceof Element&&e.target.closest("input, textarea, [contenteditable='true']"))||(tY.current=Date.now()+1200)},[rx,rg]),ry=(0,i.useCallback)(()=>{let e=t1.current;if(!e)return;let t=tZ.current;if(null!==t){let n=t.top;t.moved||=e.scrollTop!==n,t.top=e.scrollTop;return}if(!tM.current&&!tO.current)return;let n=e.scrollHeight-e.scrollTop-e.clientHeight,r=Date.now()<=tY.current;if(!(!r&&Date.now()<tQ.current)){if(n<=72)return void rp(!0);r&&rp(!1)}},[rp]);return(0,i.useEffect)(()=>(tS.current=t?.id??null,tI.current.sessionId!==tS.current&&(tI.current={sessionId:tS.current,outputs:[],seq:0}),t&&ny(t.id,!f,!0,f).then(e=>{if(tS.current!==t.id)return;nL(t.id),e?.running&&(nk(t.id),(e.state?.isStreaming||e.state?.isPromptRunning||e.state?.isHandoffRunning)&&(tR.current=!!e.state.isStreaming,t$.current=!!e.state.isPromptRunning,tM.current=!0,L(!0),eK(e.state.isStreaming?{kind:"waiting_model"}:{kind:"running_command"}),R({type:"start"}),hE(tE.current,t.id,e.state.pendingToolCalls),nP(t.id),!e.state.isStreaming&&e.state.isPromptRunning&&nG(t.id)),e.state?.isBashRunning&&(tO.current=!0,A(!0),nJ(t.id)),(e.state?.subagents?.length??0)>0&&nP(t.id));let n=e?.state;n&&(void 0!==n.isCompacting&&e_(n.isCompacting),eH(hm(n)),void 0!==n.contextUsage&&ej(n.contextUsage??null),void 0!==n.systemPrompt&&eC(n.systemPrompt??null),void 0!==n.thinkingLevel&&(t9.current=t.id,eo(n.configuredThinkingLevel??n.thinkingLevel),ed(n.thinkingLevel)),void 0!==n.thinkingCeiling&&eh(n.thinkingCeiling??null),void 0!==n.extensionStatuses&&te(n.extensionStatuses??[]),void 0!==n.extensionWidgets&&tr(n.extensionWidgets??[]),void 0!==n.queuedMessages&&to(hh(n.queuedMessages)),void 0!==n.subagents&&td(e=>hd(e,n.subagents??[])),void 0!==n.goal&&tG(n.goal??null)),e&&eq(!0)}),()=>{tz.current+=1,nE(),nR(),n$()}),[t?.id]),(0,i.useEffect)(()=>{h?.(eS)},[eS,h]),(0,i.useEffect)(()=>{u&&u(g?.tree??[],k,n8)},[g?.tree,k,n8,u]),(0,i.useEffect)(()=>{let e=e=>{let t=tZ.current;t&&(1!==e.button||t.released||t.moved||!(e.target instanceof Node&&t1.current?.contains(e.target))?rx():t.released=!0)};return window.addEventListener("pointerup",e,!0),window.addEventListener("keydown",rv),()=>{window.removeEventListener("pointerup",e,!0),window.removeEventListener("keydown",rv)}},[rx,rv]),(0,i.useEffect)(()=>{let e=t1.current;if(!e)return;let t=()=>{tZ.current?.moved&&rx()};return e.addEventListener("pointerdown",rv,{passive:!0}),e.addEventListener("wheel",rv,{passive:!0}),e.addEventListener("touchstart",rv,{passive:!0}),e.addEventListener("scroll",ry,{passive:!0}),e.addEventListener("scrollend",t,{passive:!0}),()=>{e.removeEventListener("pointerdown",rv),e.removeEventListener("wheel",rv),e.removeEventListener("touchstart",rv),e.removeEventListener("scroll",ry),e.removeEventListener("scrollend",t)}},[S.length,v,rx,ry,rv]),(0,i.useEffect)(()=>{if(nr.current||!$&&!P||!tB.current)return;let e=t1.current;if(!e)return;let t=requestAnimationFrame(()=>{tB.current&&(tQ.current=Date.now()+700,e.scrollTo({top:e.scrollHeight,behavior:"instant"}))});return()=>cancelAnimationFrame(t)},[$,P,S.length,E.streamingMessage,eV,_,e.transitioning]),(0,i.useLayoutEffect)(()=>{if(0!==S.length){if(!tU.current){tU.current=!0,rm("instant");return}if(!nr.current&&tB.current){let e=Date.now()-ni.current<1500;rm(tM.current||tO.current||e?"instant":"smooth")}}},[S.length,$,P,rm,e.transitioning]),(0,i.useEffect)(()=>{let e=new AbortController;return n7(e.signal).catch(e=>{if(e instanceof DOMException&&"AbortError"===e.name)return}),()=>e.abort()},[n7,d]),(0,i.useEffect)(()=>{if(!ez)return;let e=setTimeout(()=>eD(null),6e3);return()=>clearTimeout(e)},[ez]),(0,i.useEffect)(()=>{if(0===eQ.visible.length)return;let e=eQ.visible.find(e=>e.exiting);if(e){let t=setTimeout(()=>{eX({type:"remove",id:e.id})},180);return()=>clearTimeout(t)}if(!eQ.visible[0])return;let t=setTimeout(()=>{eX({type:"mark_oldest_exiting"})},5e3);return()=>clearTimeout(t)},[eQ.visible]),(0,i.useEffect)(()=>{e1(null)},[S.length,ek?.tokens,ek?.percent,ek?.contextWindow]),{data:g,loading:v,error:b,activeLeafId:k,messages:S,entryIds:N,streamState:E,agentRunning:$,modelNames:O,modelList:D,modelError:H,modelScopeWarnings:B,modelThinkingLevels:V,modelThinkingLevelMaps:G,modelRoles:Y,newSessionModel:Q,toolPreset:ei,thinkingLevel:el,effectiveThinkingLevel:ec,thinkingCeiling:eu,retryInfo:eb,contextUsage:ek,systemPrompt:eS,forkingEntryId:eN,isCompacting:eA,compaction:eW,compactError:eF,compactResult:ez,currentModel:nu,displayModel:nh,modelSwitching:e$,sessionStats:np,runStateKnown:eB,slashCommands:eG,slashCommandsLoading:eY,queuedMessages:ti,deliveryRows:tm,subagents:tc,todoPhases:tf&&tf.sid===tS.current?tf.phases:null,compactedWork:I,notices:eQ.visible,extensionDialog:e2,extensionResponse:e4,extensionCustomUi:e3,extensionStatuses:e9,extensionWidgets:tn,respondToExtensionUi:n_,sendExtensionCustomInput:nF,isAutoModelSelection:m&&null===Q,agentPhase:eV,isNew:m,autoFollowPaused:tq,resumeAutoFollow:rf,pauseAutoFollow:rg,goalStatus:tK,sessionIdRef:tS,eventSourceRef:tx,messagesEndRef:t0,scrollContainerRef:t1,handleSend:nX,handleAbort:n0,handleFork:n1,handleNavigate:n2,handleModelChange:n4,handleRoleModelChange:n6,handleMainPresetChange:n5,newSessionAccount:ee,handleCompact:n3,handleSteer:re,handleFollowUp:rn,handlePromptWithStreamingBehavior:rt,handleAbortCompaction:rr,handleRecallQueue:ri,handleRemoveQueuedMessage:rs,handleBuiltinSlashCommand:n9,handleToolPresetChange:rh,handleThinkingLevelChange:ra,fastMode:rd,fastModeBusy:ef,handleFastModeToggle:ru,loadTools:nk,loadSlashCommands:nT,ensureNewSession:nC,refreshLiveTranscript:nb,setActiveLeafId:j,setData:x,setMessages:C,dispatch:R,setAgentRunning:L,setForkingEntryId:eT,bashRunning:P,pendingBash:_,handleAgentEventRef:tD}}({session:e,newSessionCwd:t,initialData:l,transitioning:o,onAgentEnd:eC,onAttentionNeeded:d,onSessionCreated:u,onSessionForked:h,newSessionAutoWorktree:a,modelsRefreshKey:p,chatInputRef:m,onBranchDataChange:f,onSystemPromptChange:g,onSessionStatsPanelOpen:y}),t9=(0,i.useMemo)(()=>(function(e){let t=null,n=new Map;for(let r=0;r<e.length;r++){let i=e[r],s=te(i);if(!s||"custom"!==i.role)continue;t??=[...e];let a=[];for(let t=0;t<r;t++){let r=e[t];if("assistant"!==r.role)continue;if(void 0===s.sourceHash){r.timestamp===s.sourceTimestamp&&a.push(t);continue}let i=n.get(t);void 0===i&&(i=function(e){let t=e9(e),n=5381;for(let e=0;e<t.length;e++)n=(n<<5)+n+t.charCodeAt(e)|0;return`${t.length}:${n}`}(r.content??[]),n.set(t,i)),i===s.sourceHash&&a.push(t)}a.length>1&&void 0!==s.sourceHash&&void 0!==s.sourceTimestamp&&(a=a.filter(t=>e[t].timestamp===s.sourceTimestamp));let l=1===a.length?t[a[0]]:null;if(l?.role!=="assistant"){t[r]={...i,details:void 0};continue}t[a[0]]={...l,replyTranslation:function(e,t){let n="string"==typeof e.content?e.content:e.content.map(e=>"text"===e.type?e.text:"").join("\n");return n.startsWith(e7)?{kind:"translated",text:n.slice(e7.length),original:t}:n.startsWith("[번역 생략]")?{kind:"skipped",text:n,original:t}:{kind:"failed",text:n,original:t}}(i,e9(l.content??[]))}}return t??e})(eM),[eM]),ne=iv(e?.id,th?.provider,void 0,th?.modelId),nt=ne?.alias;(0,i.useEffect)(()=>{nt&&ei.current?.(nt)},[nt]);let nn=(0,i.useMemo)(()=>{if(!th)return null;let e=t$?tJ:rg.find(e=>e.alias===ne?.alias)?.oauthPosition;return rg.find(t=>t.provider===th.provider&&(void 0===t.oauthPosition?null===ne||ne.seed===t.seed:t.oauthPosition===e))?.alias??null},[th,t$,tJ,ne]),nr=e$||eL,ni=e?.id;ed.current=t9,eu.current=eE,eh.current=tO;let ns=(0,i.useRef)(!0);ns.current=!tL;let na=(0,i.useRef)(!1);(0,i.useEffect)(()=>{e$&&!na.current&&(ep.current+=1),na.current=e$},[e$]),(0,i.useEffect)(()=>()=>{ep.current+=1},[]),(0,i.useEffect)(()=>{el(e=>[...function(e){if(!e)return[];try{let t=JSON.parse(window.localStorage.getItem(hB(e))??"[]");if(!Array.isArray(t))return[];return t.filter(e=>e&&"string"==typeof e.anchorEntryId).map(t=>({..."string"==typeof t.sticker?{...t,sticker:t.sticker.replace(/^(\/stickers\/.+)\.png$/,"$1.webp")}:t,sessionId:e}))}catch{return[]}}(ni),...e.filter(e=>null===e.anchorEntryId&&e.sessionId===ni)])},[ni]),(0,i.useEffect)(()=>{let e=tO.current;e&&eo.current.some(t=>null===t.anchorEntryId&&t.sessionId===e)&&el(t=>{let n=!1,r=[];for(let i of t){if(null!==i.anchorEntryId||!i.intent||i.sessionId!==e){r.push(i);continue}let s=function(e,t,n){let r=Math.min(t.length,n.length),i=0;if(null!==e.baseEntryId){let t=n.indexOf(e.baseEntryId);if(-1===t||t>=r)return{kind:"drop"};i=t+1}let s=0;for(let a=i;a<r;a++)if(ro(t[a])===e.identity&&(s+=1)===e.occurrence)return{kind:"entry",entryId:n[a]};return null}(i.intent,t9,eE);if(null===s){r.push(i);continue}n=!0,"drop"!==s.kind&&("working"===i.tag&&[...t,...r].some(e=>"working"===e.tag&&e.anchorEntryId===s.entryId)||r.push({id:i.id,anchorEntryId:s.entryId,sticker:i.sticker,text:i.text,tag:i.tag,sessionId:i.sessionId}))}return n?(hq(e,r),r):t})},[t9,eE,tO]);let nl=(0,i.useRef)(null);(0,i.useEffect)(()=>{let e=tO.current,t=nl.current;if(nl.current=e?{sessionId:e,entryIds:eE}:null,!e||!t||t.sessionId!==e)return;let n=function(e,t,n){if(0===e.length||t.length<=e.length)return[];for(let n=0;n<e.length;n++)if(e[n]!==t[n])return[];let r=[],i=Math.min(n.length,t.length);for(let s=e.length;s<i;s++){let e=n[s];"assistant"===e.role&&"web6"===e.provider&&e.model===rd&&r.push(t[s])}return r}(t.entryIds,eE,t9),r=eg();if(0===n.length||!r)return;let i=ig(e,"web6",void 0)?.alias??null;for(let e of n)eo.current.some(t=>t.anchorEntryId===e)||ey(i,"done",r,{kind:"entry",entryId:e})},[eE,t9,tO,eg,ey]);let no=e$&&tR?.kind==="running_tools"&&tR.tools.length>0&&tR.tools.every(e=>"wait"===e.name),nc=eT||o,{hideThinkingBlock:nd}=(V=t??e?.cwd??null,G=n1(),(0,i.useEffect)(()=>{n0(V).catch(()=>{})},[V]),G),nu=(0,i.useMemo)(()=>({hideThinking:nd}),[nd]);(0,i.useEffect)(()=>{var e;if(!tj||er.current===tj.id)return;er.current=tj.id;let t=eg();if(!t)return;ef.current=t.turn;let n=eR.streamingMessage?.role==="assistant"?eR.streamingMessage:null,r=rc(ed.current,n,th?.provider,th?.modelId);ew("select"===(e=tj.method)||"ask"===e||"form"===e?"choice":"approval",t,r.provider,r.credentialId,r.model)},[tj,eR.streamingMessage,th?.provider,th?.modelId,eg,ew]),(0,i.useEffect)(()=>(x=nr?tU:null,()=>void(x=null)),[nr,tU]),(0,i.useEffect)(()=>{R?.(nr)},[R,nr]),(0,i.useEffect)(()=>()=>R?.(!1),[R]),(0,i.useEffect)(()=>{$?.(no)},[no,$]),(0,i.useEffect)(()=>()=>$?.(!1),[$]),(0,i.useEffect)(()=>{L?.(null!==tj)},[L,tj]),(0,i.useEffect)(()=>()=>L?.(!1),[L]);let{main:nh,process:np}=(0,i.useMemo)(()=>(function(e,t,n={}){let r=[],i=[],s=-1,a=null,l=(e,t,n)=>{if(0===t.length)return;let s=(a&&a.anchorIdx===e||(a={anchorIdx:e,entries:[],messageCount:0,toolCallCount:0},i.push(a)),a),l=r.length-1;for(let e of t)s.entries.push({...e,afterMainIndex:l});s.messageCount+=t.length,s.toolCallCount+=n},o=e5(e),c=new Map,d=(e,t)=>{let n=c.get(e)??0;c.set(e,n+1),r.push({kind:"answer",anchorIdx:s,idx:e,runIndex:n,blocks:o.attach(t),precedingBlocks:[]})},u=()=>{let e=o.takeRemaining();e&&d(e.idx,e.blocks)};for(let i of t){if("answer"===i.kind){r.push(i);continue}if("process"===i.kind){l(i.anchorIdx,i.entries,i.toolCallCount);continue}let t=e[i.idx];if(!t)continue;if("user"===t.role){u(),s=i.idx,r.push(i);continue}if(tr(t)){r.push(void 0!==i.anchorIdx||s<0?i:{...i,anchorIdx:s});continue}if("assistant"!==t.role){"toolResult"!==t.role&&null===te(t)&&0>ti(e,i.idx)&&l(s,[{idx:i.idx}],0);continue}let a=eZ(t,n);if(eJ(t,n)&&eY(e,i.idx)){let e=a.flatMap(e=>e.blocks);l(s,[{idx:i.idx}],eQ(e)),o.collect(i.idx,e);continue}let c=!1;for(let e of a){if("answer"===e.kind){d(i.idx,e.blocks),c=!0;continue}l(s,[{idx:i.idx,blocks:e.blocks}],eQ(e.blocks)),o.collect(i.idx,e.blocks)}!c&&eJ(t,n)&&d(i.idx,[])}return u(),{main:r,process:i}})(t9,function(e,t={}){let n=-1;for(let t=e.length-1;t>=0;t--)if(to(e[t])){n=t;break}let r=[];for(let i=0;i<e.length;){if(!to(e[i])){r.push({kind:"message",idx:i}),i+=1;continue}let s=i,a=s+1;for(;a<e.length&&!to(e[a]);)a+=1;if((t.sessionBusy||t.isStreaming)&&a===e.length&&s===n||!function(e,t,n){for(let r=t;r<n;r++)if(e[r]?.role==="assistant")return!0;return!1}(e,s+1,a)){for(let e=s;e<a;e++)r.push({kind:"message",idx:e});i=a;continue}for(let n of(r.push({kind:"message",idx:s}),function(e,t,n,r){let i=[],s=[],a=0,l=[],o=0,c=0,d=e5(e.slice(t+1,n)),u=()=>{0!==s.length&&(i.push({kind:"process",anchorIdx:t,idx:s[0].idx,groupIndex:c++,entries:s,messageCount:s.length,toolCallCount:a,turnHasAnswer:!1}),s=[],a=0)},h=(e,n)=>{u(),i.push({kind:"answer",anchorIdx:t,idx:e,runIndex:o++,blocks:d.attach(n),precedingBlocks:l}),l=[]};for(let o=t+1;o<n;o++){let n=e[o];if("assistant"!==n.role){if(null!==te(n)||ti(e,o)>=0)continue;if(tr(n)){u(),i.push({kind:"message",idx:o,anchorIdx:t});continue}"toolResult"!==n.role&&s.push({idx:o});continue}let c=eZ(n,r);if(eJ(n,r)&&eY(e,o)){let e=c.flatMap(e=>e.blocks);for(let t of(s.push({idx:o}),a+=eQ(e),d.collect(o,e),c))"process"===t.kind&&l.push(...t.blocks);continue}let p=c.reduce((e,t)=>"answer"===t.kind?e+1:e,0);for(let e of c){if("answer"===e.kind){h(o,e.blocks);continue}for(let t of(s.push(p>0?{idx:o,blocks:e.blocks}:{idx:o}),a+=eQ(e.blocks),d.collect(o,e.blocks),e.blocks))l.push(t)}0===p&&eJ(n,r)&&h(o,[])}u();let p=d.takeRemaining();p&&i.push({kind:"answer",anchorIdx:t,idx:p.idx,runIndex:o++,blocks:p.blocks,precedingBlocks:[]});let m=i.some(e=>"answer"===e.kind);for(let e of i)"process"===e.kind&&(e.turnHasAnswer=m);return i}(e,s,a,{hideThinking:t.hideThinking})))r.push(n);i=a}return r}(t9,{sessionBusy:nr,isStreaming:eR.isStreaming,hideThinking:nu.hideThinking}),nu),[t9,nr,eR.isStreaming,nu]),nm=(0,i.useMemo)(()=>(function(e,t,n=[]){let r,i,s,a,l,{atCompaction:o}=(r=-1,n.forEach((e,t)=>{"user"===e.role&&(r=t)}),i=n.slice(0,r+1).flatMap(ai),s=n.slice(r+1).flatMap(ai),a=t.findIndex(e=>"user"===e.role),-1===(l=0===s.length?-1:e.findIndex(e=>"answer"===e.kind&&(-1===a||e.idx<a)))?{continuing:null,atCompaction:[...i,...s]}:{continuing:{position:l,calls:s},atCompaction:i});if(0===o.length)return null;let c=-1;t.forEach((e,t)=>{"custom"===e.role&&"compaction"===e.customType&&(c=t)});let d=e.findIndex(e=>e.idx>c);return{position:-1===d?e.length:d,calls:o}})(nh,t9,tg?.messages),[nh,t9,tg]),[nf,ng]=(0,i.useState)(hz),{startIndex:nx,endIndex:nv,hasLater:ny}=hD(nh.length,nf),nb=null!==nf.end&&ny,nw=(0,i.useRef)(nh.length);nw.current=nh.length;let nk=(0,i.useRef)(null),nj=(0,i.useRef)(null),nC=(0,i.useRef)(null);(0,i.useEffect)(()=>{null!==nf.end&&nf.end>=nh.length&&ng(e=>({count:e.count,end:null}))},[nf.end,nh.length]),(0,i.useEffect)(()=>{let e=nk.current,t=tW.current;if(!e||!t)return;let n=new IntersectionObserver(e=>{e[0]?.isIntersecting&&(nC.current=t.scrollHeight-t.scrollTop,ng(e=>(function(e,t=50){return{...e,count:e.count+t}})(e)))},{root:t,threshold:0});return n.observe(e),()=>n.disconnect()},[nf,nh.length,tW]),(0,i.useEffect)(()=>{if(null==nC.current)return;let e=tW.current;if(e){var t;t=e.scrollHeight,e.scrollTop=Math.max(0,t-nC.current),nC.current=null}},[nf.count,tW]),(0,i.useEffect)(()=>{let e=nj.current,t=tW.current;if(!e||!t)return;let n=new IntersectionObserver(e=>{e[0]?.isIntersecting&&ng(e=>(function(e,t,n=50){if(null===t.end)return t;let{startIndex:r,endIndex:i}=hD(e,t),s=i+n;return s>=e?{count:e-r,end:null}:{count:s-r,end:s}})(nw.current,e))},{root:t,threshold:0});return n.observe(e),()=>n.disconnect()},[nf,nh.length,tW]);let[nT,nE]=(0,i.useState)(null),[nR,n$]=(0,i.useState)(0),nL=(0,i.useRef)(null),nP=(0,i.useCallback)(e=>{t_(),nL.current=e,nE(null),ng(t=>hW(nw.current,e,t)),n$(e=>e+1)},[t_]);(0,i.useLayoutEffect)(()=>{let e=nL.current,t=tW.current;if(null===e||!t)return;let n=t.querySelector(`[data-chat-item="${e}"]`);if(!n)return;nL.current=null;let r=document.createRange();r.selectNodeContents(n),t.scrollTop+=r.getBoundingClientRect().top-t.getBoundingClientRect().top-24,nE(e)},[nR,nf,nh,tW]),(0,i.useEffect)(()=>{if(null===nT)return;let e=setTimeout(()=>nE(null),1800);return()=>clearTimeout(e)},[nT]);let nA=(0,i.useCallback)(()=>{(0,s.flushSync)(()=>ng(hz));let e=tW.current;e&&(e.scrollTop=e.scrollHeight)},[tW]),n_=(0,i.useCallback)(()=>{nb&&nA(),tA()},[nb,nA,tA]),nF=(0,i.useRef)(null),[nO,nz]=(0,i.useState)(!1);(0,i.useEffect)(()=>{if(!D||nF.current===D.id||D.sessionId!==e?.id||eT||0===t9.length)return;nF.current=D.id,W?.(D.id);let t=eE.indexOf(D.entryId);if(t<0)return void nz(!0);let n=0;for(let e=0;e<nh.length;e++){let r=nh[e].idx;if(r>t||(n=e,r===t))break}nP(n)},[D,e?.id,eT,t9.length,eE,nh,nP,W]),(0,i.useEffect)(()=>{if(!nO)return;let e=setTimeout(()=>nz(!1),6e3);return()=>clearTimeout(e)},[nO]);let[nD,nW]=(0,i.useState)(!1),[nH,nU]=(0,i.useState)(0),nB=(0,i.useMemo)(()=>nD?nh.map(e=>(function(e,t){if("answer"===e.kind)return tu(e.blocks);let n=t[e.idx];return n&&"content"in n?tu(n.content):""})(e,t9).toLowerCase()):hV,[nD,nh,t9]),nq=(0,i.useCallback)(e=>{t_(),ng(t=>hW(nw.current,e,t))},[t_]),nV=(0,i.useCallback)(()=>nW(!1),[]);(0,i.useEffect)(()=>{let e=e=>{if(e.defaultPrevented||e.isComposing||e.altKey||e.shiftKey||!(e.ctrlKey||e.metaKey)||"f"!==e.key.toLowerCase())return;let t=tW.current;if(!t||!t.checkVisibility({visibilityProperty:!0}))return;let n=e.target instanceof Element?e.target:null;if(n?.closest("[data-capture-keys], [role='dialog']"))return;let r=n?.closest("input, textarea, select, [contenteditable='true']");(!r||r.closest("[data-chat-composer], .chat-find-bar"))&&(e.preventDefault(),nW(!0),nU(e=>e+1))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[tW]);let nK=(0,i.useMemo)(()=>{let e=[];return nh.forEach((t,n)=>{if("message"!==t.kind)return;let r=hU(t9[t.idx]);null!==r&&e.push({item:n,text:r})}),e},[nh,t9]),nG=`${nx}:${nv}`,nJ=eE.length>0?eE[eE.length-1]:null,[nY,nZ]=(0,i.useState)(null),nQ=(0,i.useRef)(!1);(0,i.useEffect)(()=>{nQ.current||!tf||eT||!e?.id||(nQ.current=!0,nr||!nJ||!function(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if("user"===n.role||"toolResult"===n.role)return!0;if("assistant"===n.role){if(!n.stopReason)return!0;if("aborted"===n.stopReason||"error"===n.stopReason||"length"===n.stopReason)break;return n.content.some(e=>"toolCall"===e.type)}}return!1}(t9)||function(e){try{return window.localStorage.getItem(hK(e))}catch{return null}}(e.id)!==nJ&&nZ(nJ))},[tf,eT,e?.id,nr,nJ,t9]);let nX=(0,i.useCallback)(()=>{e?.id&&nY&&function(e,t){try{window.localStorage.setItem(hK(e),t)}catch{}}(e.id,nY),nZ(null)},[e?.id,nY]),n2=null!==nY&&nY===nJ&&!nr&&!nb,n8=tm?[tm.sessionId,tm.sessionFile??"",tm.sessionName??"",tm.userMessages,tm.assistantMessages,tm.toolCalls,tm.toolResults,tm.totalMessages,tm.tokens.input,tm.tokens.output,tm.tokens.cacheRead,tm.tokens.cacheWrite,tm.tokens.total,tm.cost??0,tm.totalActiveMs??0].join("|"):null,n4=(0,i.useRef)(tm);n4.current=tm,(0,i.useEffect)(()=>{v?.(n4.current)},[n8,v]),(0,i.useEffect)(()=>()=>{v?.(null)},[v]);let n5=e4?`${e4.percent??"null"}|${e4.contextWindow}|${e4.tokens??"null"}`:null,n6=(0,i.useRef)(e4);n6.current=e4,(0,i.useEffect)(()=>{b?.(n6.current)},[n5,b]),(0,i.useEffect)(()=>()=>{b?.(null)},[b]),(0,i.useEffect)(()=>{w?.(tb)},[w,tb]),(0,i.useEffect)(()=>()=>{w?.([])},[w]);let{regular:n3,lab:n7}=(0,i.useMemo)(()=>(function(e){let t=[],n=[];for(let i of e){var r;((r=i.key).startsWith(cJ)&&null!==cY(r)?n:t).push(i)}return{regular:t,lab:n}})(tT),[tT]),n9=e?.id??null;(0,i.useEffect)(()=>{k?.(n9,n7)},[k,n9,n7]),(0,i.useEffect)(()=>()=>{k?.(null,[])},[k]);let{isDragOver:rt,handleDragEnter:rn,handleDragOver:rr,handleDragLeave:ri,handleDrop:rs}=function(e){let[t,n]=(0,i.useState)(!1),r=(0,i.useRef)(0),s=(0,i.useCallback)(e=>{Array.from(e.dataTransfer.items).some(e=>"file"===e.kind)&&(e.preventDefault(),r.current+=1,n(!0))},[]),a=(0,i.useCallback)(e=>{Array.from(e.dataTransfer.items).some(e=>"file"===e.kind)&&e.preventDefault()},[]);return{isDragOver:t,handleDragEnter:s,handleDragOver:a,handleDragLeave:(0,i.useCallback)(()=>{r.current-=1,r.current<=0&&(r.current=0,n(!1))},[]),handleDrop:(0,i.useCallback)(t=>{t.preventDefault(),r.current=0,n(!1),e(Array.from(t.dataTransfer.files))},[e])}}((0,i.useCallback)(e=>{nr||m?.current?.addAttachments(e)},[nr,m])),ra=(0,i.useMemo)(()=>{var e;return e=tg?.messages,e&&e.length>0?[...e,...t9]:t9},[tg,t9]),rl=(0,i.useMemo)(()=>{let e=new Map;for(let t of ra)"toolResult"===t.role&&e.set(t.toolCallId,t);return e},[ra]),ru=(0,i.useMemo)(()=>{let e,t,n,r,i,s,a,l,o,c,d;return e=new Map,t=new Map,n=new Map,r=new Map,i=new Map,s=new Map,a=new Map,l=(e,r,i)=>{let s=n.get(e);s&&r&&t.set(s,{status:r,order:i})},o=new Set,c=(e,t)=>{let r=t?n.get(t):void 0,s=s5(e.status);if(!r||o.has(r)||"completed"!==s&&"failed"!==s&&"aborted"!==s)return;o.add(r);let a=s4(e);null!==a&&i.set(r,a)},d=(e,t,r)=>{let i=t?n.get(t):void 0,s=s4(e);i&&"number"==typeof r&&null!==s&&"running"===s5(e.status)&&a.set(i,Math.max(a.get(i)??-1/0,r-s))},ra.forEach((t,i)=>{if("assistant"===t.role){for(let e of t.content??[]){if("toolCall"!==e.type||"task"!==e.toolName)continue;let t=rl.get(e.toolCallId);if(t)for(let i of s3(e,t)??[])n.set(i.agentId,i.key),"number"==typeof t.timestamp&&r.set(i.key,t.timestamp)}return}if("toolResult"===t.role){if("routing_verdict"===t.toolName){let n=function(e){let t=function(e){if(e.isError)return null;let t=e.details?.record;if("object"!=typeof t||null===t)try{let n=JSON.parse(s6(e.content));t=n?.ok===!0?n.record:void 0}catch{return null}return"object"==typeof t&&null!==t?t:null}(e);if(!t)return null;let n=t.verdict;if("accepted"!==n&&"rework"!==n&&"held"!==n)return null;let r=s8(t.assignmentId),i=r?.split("#")??[];if(i.length<3)return null;let s=i[i.length-1],a=i.slice(1,-1).join("#");return/^\d+$/.test(s)&&a?{key:`${a}#${s}`,record:{verdict:n,attempt:"number"==typeof t.attempt?t.attempt:null,reason:s8(t.reason)}}:null}(t);if(!n)return;let r=e.get(n.key)??[];r.push({...n.record,order:i,at:"number"==typeof t.timestamp?t.timestamp:null}),e.set(n.key,r);return}if("wait"===t.toolName){let e=new Set;for(let r of s2(t.details?.jobs)){if("task"!==r.type)continue;let s=s8(r.id);if(s&&l(s,s5(r.status),i),c(r,s),d(r,s,t.timestamp),s&&"running"===s5(r.status)){let t=n.get(s);t&&e.add(t)}}for(let t of e)for(let n of e){if(t===n)continue;let e=s.get(t);e||s.set(t,e=new Set),e.add(n)}}return}if("custom"===t.role&&"async-result"===t.customType){for(let e of s6(t.content).matchAll(s7)){let t=Object.fromEntries([...e[1].matchAll(s9)].map(e=>[e[1],e[2]]));t.id&&l(t.id,s5(t.status),i)}for(let e of s2(t.details?.jobs))"task"===e.type&&c(e,s8(e.jobId))}}),{verdicts:e,runs:t,latestByAgent:n,spawnedAt:r,durations:i,parallelWith:s,runStartedAt:a}},[ra,rl]),rh=(0,i.useMemo)(()=>({ledger:ru,subagents:tb,toolResults:rl,onOpenPanel:j,sessionId:e?.id??null,cwd:e?.cwd??t??void 0,onOpenMaker:C,selectedMaker:N}),[ru,tb,rl,j,e?.id,e?.cwd,t,C,N]),rp=(0,i.useMemo)(()=>{let e=new Set,t=[];for(let n=t9.length-1;n>=0;n-=1){let r=hU(t9[n]);if(!(!r||e.has(r))&&(e.add(r),t.push(r),t.length>=50))break}return t.reverse()},[t9]),rm=(0,i.useMemo)(()=>tP(t9,rl,tw,tg?.todoPhases??null),[t9,rl,tw,tg]),rf=(0,i.useMemo)(()=>cz(eR.streamingMessage).join("|"),[eR.streamingMessage]),rx=(0,i.useMemo)(()=>JSON.stringify(cO(eR.streamingMessage)),[eR.streamingMessage]),rv=(0,i.useMemo)(()=>JSON.stringify(cW(eR.streamingMessage)),[eR.streamingMessage]),ry=(0,i.useMemo)(()=>(function(e,t,n=[],r=[],i=[]){let s=function(e){let t=new Map;for(let n of e){if("toolResult"!==n.role||"write"!==n.toolName)continue;let e=n.details;if(!e||"object"!=typeof e||Array.isArray(e))continue;let r=e.message;if(!r||"object"!=typeof r||Array.isArray(r)||"send"!==r.op)continue;let i=Array.isArray(r.receipts)?r.receipts.filter(e=>"object"==typeof e&&null!==e&&!Array.isArray(e)).map(e=>({to:"string"==typeof e.to?e.to:void 0,outcome:"string"==typeof e.outcome?e.outcome:void 0})):void 0;t.set(n.toolCallId,{from:"string"==typeof r.from?r.from:void 0,receipts:i})}return t}(e),a=[],l=new Map,o=-1;for(let n=0;n<e.length;n+=1){let r=e[n];if("user"===r.role){o=n;continue}let i=cz(r),c=cW(r,s);if(0===i.length&&0===c.length||o<0)continue;let d=cO(r),u=l.get(o);u||(u={index:o,entryId:t[o],taskToolCallIds:[],characterSummons:[],peerSends:[]},l.set(o,u),a.push(u)),u.taskToolCallIds=[...u.taskToolCallIds,...i],u.characterSummons=[...u.characterSummons,...d],u.peerSends=[...u.peerSends,...c]}if(n.length>0||i.length>0){let s=-1;for(let t=e.length-1;t>=0;t-=1)if("user"===e[t].role){s=t;break}if(s>=0){let e=l.get(s);e||(e={index:s,entryId:t[s],taskToolCallIds:[],characterSummons:[],peerSends:[]},l.set(s,e),a.push(e));let o=new Set(e.taskToolCallIds);e.taskToolCallIds=[...e.taskToolCallIds,...n.filter(e=>!o.has(e))];let c=new Set(e.characterSummons.map(e=>`${e.toolCallId} ${e.name??""}`));e.characterSummons=[...e.characterSummons,...r.filter(e=>!c.has(`${e.toolCallId} ${e.name??""}`))];let d=new Set(e.peerSends.map(e=>e.toolCallId));e.peerSends=[...e.peerSends,...i.filter(e=>!d.has(e.toolCallId))]}}return a.sort((e,t)=>e.index-t.index)})(t9,eE,rf.length>0?rf.split("|"):[],JSON.parse(rx),JSON.parse(rv)),[t9,eE,rf,rx,rv]),rb=e?.id??tO.current??void 0,rw=(J=cB(K=(0,i.useMemo)(()=>({sessionId:rb,sessionProvider:th?.provider,turns:ry,messages:t9,subagents:tb}),[rb,th?.provider,ry,t9,tb])),Y=cG(K),(0,i.useMemo)(()=>(function(e){let t=new Map;for(let n of e){let e=t.get(n.turnIndex);e?e.push(n):t.set(n.turnIndex,[n])}return t})(function(e){let t=[];for(let n of e){let e=t[t.length-1];if(e&&e.speakerId===n.speakerId&&e.turnIndex===n.turnIndex&&e.text===n.text){t[t.length-1]=n;continue}t.push(n)}return t}([...J,...Y])),[J,Y])),rk=t$&&0===t9.length&&!eR.isStreaming&&!nr,rj=(0,i.useMemo)(()=>t9.filter(e=>"assistant"===e.role).length,[t9]),rS=function(e,t){let n=(0,i.useRef)(new Map),r=(0,i.useMemo)(()=>{if(!e)return n.current=new Map,0;let t=new Map,r=0;return(e.content??[]).forEach((e,i)=>{let s=e1(e);if(null===s)return;let a=e2(n.current.get(i),s);t.set(i,{text:s,tokens:a}),r+=a}),n.current=t,r},[e]),s=(0,i.useRef)(r);s.current=r;let a=null!==e,l=e?.timestamp,[o,c]=(0,i.useState)(null);return(0,i.useEffect)(()=>{if(!a)return void c(null);let e=l??Date.now(),t=()=>{let t=(Date.now()-e)/1e3;c(t>=.5?s.current/t:0)};t();let n=setInterval(t,1e3);return()=>clearInterval(n)},[a,l,t]),a?o??0:null}(eR.streamingMessage?.role==="assistant"?eR.streamingMessage:null,rj),rC=(0,i.useMemo)(()=>(function(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if("assistant"!==n.role)continue;let{usage:r,timestamp:i,completedAt:s}=n,a=r?.output??0;if(!(a<=0)&&i&&s&&!(s<=i))return a/((s-i)/1e3)}return null})(t9),[t9]),rN=e?.cwd??t??void 0,rT=th?eD[`${th.provider}:${th.modelId}`]??null:null,rI=th?eW[`${th.provider}:${th.modelId}`]??null:null,rM=(0,i.useRef)(null),rE=(0,i.useRef)(null),rR=(0,i.useCallback)(()=>{let e=rM.current?.querySelector("textarea");e&&(e.focus({preventScroll:!0}),e.setSelectionRange(e.value.length,e.value.length))},[]);(0,i.useEffect)(()=>(E?.(rR),()=>E?.(null)),[rR,E]),(0,i.useLayoutEffect)(()=>{let e=rE.current,t=e?.closest(".workspace-shell");if(!e||!t)return;let n=tW.current?.clientHeight??0,r=()=>{let r=Math.ceil(e.getBoundingClientRect().height);r>0&&t.style.setProperty("--omp-dock-h",`${r}px`);let i=tW.current;if(!i)return;let s=n-i.clientHeight;n=i.clientHeight,s<=0||i.scrollHeight-i.scrollTop-i.clientHeight-s<=1&&(i.scrollTop+=s)};r();let i=new ResizeObserver(r);return i.observe(e),()=>i.disconnect()},[eT,tW]);let r$=(0,i.useCallback)((...e)=>(null!==nf.end&&nA(),tH(...e)),[tH,nf.end,nA]),rL=(0,r.jsx)("div",{ref:rM,"data-chat-composer":"",style:{display:"contents"},children:(0,r.jsx)(uQ,{ref:m,sessionId:e?.id??tO.current??void 0,onEnsureSession:t$&&t?t3:void 0,onLiveTranscriptPersisted:t7,onSend:r$,onAbort:tU,onSteer:e$?tZ:void 0,onFollowUp:e$?tQ:void 0,onPromptWithStreamingBehavior:e$?tX:void 0,isStreaming:nr,model:th,isAutoModelSelection:tE,modelNames:e_,modelList:eF,modelError:eO,modelScopeWarnings:ez,onModelChange:tV,onMainPresetChange:e||t$?tG:void 0,mainPresetActiveAlias:nn,modelRoles:eH,onRoleModelChange:tK,modelSwitching:tp,onCompact:e||t$?tY:void 0,onAbortCompaction:t0,isCompacting:e3,compactError:tc,compactResult:td,toolPreset:eU,onToolPresetChange:e||t$?t4:void 0,thinkingLevel:eB,effectiveThinkingLevel:eq,outputTokensPerSecond:rS??rC,outputSpeedLive:null!==rS,thinkingCeiling:eV,onThinkingLevelChange:e||t$?t5:void 0,fastMode:eG,fastModeBusy:eX,onFastModeToggle:e||t$?e0:void 0,availableThinkingLevels:rT,thinkingLevelMap:rI,retryInfo:e8,deliveryRows:ty,inputHistory:rp,onRecallQueue:t1,onRemoveQueuedMessage:t2,slashCommands:tx,slashCommandsLoading:tv,onLoadSlashCommands:t6,onBuiltinCommand:t8,soundEnabled:P,onSoundToggle:A,onAudioUnlock:z,draftKey:e?.id??(t?`new:${t}`:void 0),cwd:e?.cwd??t,sessionTitle:e?.name})}),rP=eR.streamingMessage,rA=(0,i.useMemo)(()=>rP?eZ(rP,{isStreaming:!0}):[],[rP]),r_=(0,i.useMemo)(()=>rA.filter(e=>"answer"===e.kind).flatMap(e=>e.blocks),[rA]),rF=(0,i.useMemo)(()=>rA.filter(e=>"answer"!==e.kind).map(e=>e.blocks),[rA]),rO=rP?.role==="assistant"?rP:null,rz=(0,i.useMemo)(()=>{let e=-1;for(let t=t9.length-1;t>=0;t-=1)if("user"===t9[t].role){e=t;break}let t=e<0?-1:lX(t9,e);return{start:t,blocks:lZ(t9,t+1,t9.length),priorCiHeads:l1(t9,rl,t+1),jobNotices:lQ(t9,t+1,t9.length)}},[t9,rl]),rD=(0,i.useMemo)(()=>lA(rO?[...rz.blocks,...rO.content??[]]:rz.blocks,rl,nr,rz.priorCiHeads,rN,rz.jobNotices),[rz,rO,rl,nr,rN]),rW=(0,i.useMemo)(()=>nr?{...lY(rz.blocks,rl,rN),span:l2(t9,rz.start+1,t9.length)}:null,[nr,rz,rl,rN,t9]),rH=(0,i.useMemo)(()=>rW?{...rW,flow:rD,latest:!0}:null,[rW,rD]),rU=(0,i.useMemo)(()=>{let e=null;if(nr)for(let t of nh)"message"===t.kind&&t9[t.idx]?.role==="user"&&(e=t.idx);return function(e,t,n,r,i,s,a=[]){let l=function(e,t,n){let r=new Map,i=e.filter(e=>"message"===e.kind&&t[e.idx]?.role==="user"&&lX(t,e.idx)===e.idx).map(e=>e.idx),s=null===n?null:lX(t,n),a=new Map;for(let[n,l]of(e.forEach((e,n)=>{"answer"===e.kind&&a.set(lX(t,e.anchorIdx),n)}),a)){if(n===s)continue;let e=i.find(e=>e>n);r.set(l,{from:n+1,to:e??t.length})}return r}(e,t,n),o=-1;for(let e of l.keys())e>o&&(o=e);let c=new Map,d=[],u=0;for(let[e,n]of[...l].sort((e,t)=>e[1].from-t[1].from)){if(l1(t,r,n.from,u,d),u=Math.max(u,n.from),0===n.from&&s){let i=n.to-1;for(;i>=n.from&&ta(a[i]);)i-=1;if(a[i]!==s.throughEntryId)continue;let l=lZ(t,n.from,n.to).filter(e=>"toolCall"===e.type&&"task"===e.toolName),h=l0(t,r,n.from,n.to);c.set(e,{...s.summary,...h?{remaining:lJ(h)}:{},dispatchCalls:l,latest:e===o}),d.push(...s.ciHeads),u=n.to;continue}c.set(e,{...function(e,t,n,r,i,s=[]){let a=lZ(e,n,r),l=l0(e,t,n,r);return{...lY(a,t,i),remaining:l?lJ(l):null,span:l2(e,n,r),flow:lA(a,t,!1,s,i,lQ(e,n,r))}}(t,r,n.from,n.to,i,d),latest:e===o})}return c}(nh,t9,e,rl,rN,tg?.openRequest??null,eE)},[nh,t9,rl,rN,nr,tg,eE]),[rB,rq]=(0,i.useState)(null),rV=e?.id??null;(0,i.useEffect)(()=>{rq(null)},[rV]);let rK=null;for(let e of rU.keys())(null===rK||e>rK)&&(rK=e);let rG=("live"===rB?null!==rH:null!==rB&&rU.has(rB))?rB:rH?"live":rK,rJ="live"===rG?rH:null===rG?null:rU.get(rG)??null,rY=null!==rH,rZ=(0,i.useMemo)(()=>({selected:rG,shown:null!==H,select:e=>{rq(e),B?.()},latestTurn:rY?null:rK,compactedCalls:nm?.calls,onOpenFile:I}),[B,rG,H,rY,rK,nm,I]),rQ=null===rG||"live"===rG||rG===rK,rX=H&&(0,s.createPortal)((0,r.jsx)(as.Provider,{value:rh,children:(0,r.jsx)(cm,{summary:rJ,live:"live"===rG,folded:q,compactedCalls:rQ?nm?.calls:void 0,onOpenFile:I})}),H),r0=e$&&(tR?.kind==="running_tools"||(rO?.content??[]).some(e=>"text"===e.type&&/\S/.test(e.text)||"toolCall"===e.type)),r1=rc(t9,rO,th?.provider,th?.modelId),r2=r1.provider,r8=r1.model,r4=r1.credentialId;(0,i.useEffect)(()=>{if(!r0)return;let e=eg();e&&em.current!==e.turn&&ef.current!==e.turn&&(em.current=e.turn,ew("working",e,r2,r4,r8))},[r0,r2,r8,r4,eg,ew]);let[r5,r6]=(0,i.useState)(null),r3=(0,i.useCallback)(e=>{r6(e)},[]),r7=(0,i.useMemo)(()=>eA?{role:"bashExecution",command:eA.command,output:"",excludeFromContext:eA.excludeFromContext}:null,[eA]),r9=(0,i.useMemo)(()=>{let e=[e$&&!rP&&tR?function(e,t){if(e?.kind==="running_tools"){let n=e.tools.map(e=>e.name);return 0===n.length?t("chat.runningTool"):1===n.length?t("chat.runningNamedTool",{name:n[0]}):n.length<=3?t("chat.runningTools",{names:n.join(", ")}):t("chat.runningToolsMore",{names:n.slice(0,2).join(", "),count:n.length-2})}return e?.kind==="waiting_model"?t("chat.waitingModel"):e?.kind==="running_command"?t("chat.runningCommand"):null}(tR,Z):null,eL&&!eA?Z("chat.runningCommand"):null].filter(e=>!!e);return e.length>0?e.join(" \xb7 "):null},[e$,rP,tR,eL,eA,Z]);(0,i.useEffect)(()=>{if(!r5)return void T?.(null);let e=[],t=[],n=0;if(rP&&rF.length>0){let r=r5.messages.length+e.length;for(let i of(e.push(rP),rF))t.push({idx:r,blocks:i}),n+=eQ(i)}if(r7&&(t.push({idx:r5.messages.length+e.length}),e.push(r7)),0===t.length)return void T?.(r9?{...r5,status:r9}:r5);let r=-1;for(let e=r5.messages.length-1;e>=0;e--)if(to(r5.messages[e])){r=e;break}let i=r5.groups.slice(),s=i.length>0?i[i.length-1]:void 0;s&&s.anchorIdx===r?i[i.length-1]={...s,entries:[...s.entries,...t],messageCount:s.messageCount+t.length,toolCallCount:s.toolCallCount+n}:i.push({anchorIdx:r,entries:t,messageCount:t.length,toolCallCount:n}),T?.({...r5,groups:i,messages:[...r5.messages,...e],status:r9})},[r5,rF,rP,r7,r9,T]),(0,i.useEffect)(()=>()=>T?.(null),[T]);let ie=n3.filter(e=>"belowEditor"!==e.placement),it=n3.filter(e=>"belowEditor"===e.placement);return eI?(0,r.jsx)("div",{className:"flex h-full items-center justify-center text-red-400",children:eI}):(0,r.jsxs)("div",{className:"chat-window relative flex h-full min-w-0 flex-col overflow-hidden","aria-busy":nc,"data-empty-start":rk&&!M?"true":void 0,style:{paddingBottom:"env(safe-area-inset-bottom)"},onDragEnter:rn,onDragOver:rr,onDragLeave:ri,onDrop:rs,children:[nc?(0,r.jsx)("div",{className:"absolute inset-0 z-40 cursor-wait",children:(0,r.jsx)("div",{className:"absolute right-3 top-3 bg-bg-raised px-3 py-2 text-sm text-text-muted shadow-sm",role:"status",children:Z("chat.loadingSession")})}):null,rt&&!nr&&(0,r.jsx)("div",{className:"pointer-events-none absolute inset-0 z-50 flex animate-[drop-zone-in_0.15s_ease_both] items-center justify-center",style:{background:"var(--accent-soft)"},children:(0,r.jsx)("span",{className:"px-3 py-1 text-sm font-medium",style:{background:"var(--bg-raised)",boxShadow:"var(--shadow-float)",borderRadius:"var(--radius-surface)",color:"var(--text)"},children:Z("chat.attachFile")})}),tC&&(0,r.jsx)(h1,{request:tC,onInput:tM}),rk&&!M?(0,r.jsx)("div",{className:"flex flex-1 flex-col items-center overflow-y-auto px-4",children:(0,r.jsxs)("div",{className:"chat-empty-start my-auto w-full max-w-[var(--reading-measure)] py-8",children:[(0,r.jsxs)("div",{className:"mb-3",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,marginLeft:16,marginRight:52,fontFamily:"var(--font-mono)"},children:[(0,r.jsx)("div",{style:{minWidth:0,flex:1,overflow:"hidden"},children:(0,r.jsx)(ee,{})}),(0,r.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-end",gap:2,flexShrink:0},children:[(0,r.jsxs)("span",{style:{fontSize:11,color:"var(--text-muted)"},children:["web ",(0,r.jsxs)("span",{style:{color:"var(--text)"},children:["v","0.10.270"]})]}),(0,r.jsxs)("span",{style:{fontSize:11,color:"var(--text-muted)"},children:["omp ",(0,r.jsxs)("span",{style:{color:"var(--text)"},children:["v","18.20.2"]})]})]})]}),rN&&(0,r.jsxs)("section",{className:"empty-workspace-context","aria-label":Z("chat.emptyProjectLabel"),children:[(0,r.jsxs)("div",{className:"empty-workspace-context-text",children:[(0,r.jsx)("span",{className:"empty-workspace-context-kicker",children:Z("chat.emptyProjectLabel")}),(0,r.jsx)("strong",{children:tz(rN)||rN}),(0,r.jsx)("code",{title:rN,children:rN}),(0,r.jsx)("p",{children:Z("chat.emptyProjectHint")})]}),S&&(0,r.jsx)("button",{type:"button",className:"empty-workspace-context-action",onClick:S,children:Z("chat.openSessionList")})]}),(0,r.jsx)(hQ,{notices:tk,align:"right"})]})}):(0,r.jsxs)(r.Fragment,{children:[M&&(0,r.jsx)("div",{className:"min-h-0 min-w-0 flex-1 overflow-hidden",children:M}),(0,r.jsxs)("div",{className:"relative min-w-0 flex-1 overflow-hidden","aria-hidden":!!M,style:{display:M?"none":"flex"},children:[(0,r.jsx)("div",{style:{position:"absolute",top:12,left:0,right:0,zIndex:40,padding:"0 16px",pointerEvents:"none"},children:(0,r.jsxs)("div",{className:"chat-column-cap",style:{maxWidth:"var(--reading-measure)",margin:"0 auto",display:"flex",flexDirection:"column",alignItems:"flex-end",gap:8},children:[(0,r.jsx)(cy,{open:nD,onClose:nV,containerRef:tW,index:nB,renderedStart:nx,renderedEnd:nv,contentKey:t9,onReveal:nq,onProgrammaticScroll:t_,focusRequest:nH,t:Z}),nO&&(0,r.jsx)("div",{className:"chat-jump-missing",role:"status",children:Z("chat.jumpMissing")}),(0,r.jsx)(hQ,{notices:tk,floating:!0,align:"right"})]})}),(0,r.jsx)("div",{ref:tW,className:"chat-session-scroll relative min-w-0 flex-1 overflow-x-hidden overflow-y-auto pt-4 [scrollbar-width:none]",children:(0,r.jsx)("div",{style:{minWidth:0,padding:"0 16px"},children:(0,r.jsxs)("div",{className:"chat-column-cap",style:{width:"100%",minWidth:0,maxWidth:"var(--reading-measure)",margin:"0 auto"},children:[(0,r.jsx)(hZ,{widgets:ie}),(0,r.jsx)(as.Provider,{value:rh,children:(0,r.jsxs)(ci.Provider,{value:rZ,children:[(0,r.jsx)(cL,{utterances:rw,children:(0,r.jsx)(hG,{messages:t9,entryIds:eE,toolResultsMap:rl,modelNames:e_,messageCwd:rN,onOpenFile:I,sessionBusy:nr,isNew:t$,isStreaming:eR.isStreaming,handleFork:tB,forkingEntryId:e6,handleNavigate:tq,handleEditContent:eN,sessionId:e?.id??tO.current??void 0,main:nh,turnSummaries:rU,process:np,startIndex:nx,endIndex:nv,sentinelRef:nk,laterSentinelRef:nj,flashItem:nT,t:Z,cues:es,cueFollowRef:ns,onProcessLogChange:r3})}),!nb&&eR.isStreaming&&eR.streamingMessage&&r_.length>0&&(0,r.jsx)(sl,{message:eK(eR.streamingMessage,r_),sessionId:e?.id??tO.current??void 0,isStreaming:!0,modelNames:e_,cwd:rN,onOpenFile:I}),!nb&&rH&&(0,r.jsx)(co,{summary:rH,turnKey:"live",live:!0})]})}),n2&&(0,r.jsx)(cC,{onDismiss:nX,t:Z}),(0,r.jsx)("div",{ref:tD})]})})}),(0,r.jsx)(cb,{questions:nK,containerRef:tW,layoutKey:nG,onJump:nP,label:Z("chat.questionRail")}),(nr&&tL||nb)&&(0,r.jsxs)("button",{type:"button",onClick:n_,"aria-label":Z("chat.jumpToBottom"),title:Z("chat.jumpToBottom"),style:{position:"absolute",bottom:16,left:"50%",transform:"translateX(-50%)",zIndex:40,display:"flex",alignItems:"center",gap:6,padding:"6px 12px",minHeight:X?44:void 0,borderRadius:"var(--radius-control)",border:0,background:"var(--bg-raised)",boxShadow:"var(--shadow-float)",color:"var(--text-muted)",fontSize:12,cursor:"pointer"},children:[(0,r.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,r.jsx)("path",{d:"M12 5v14"}),(0,r.jsx)("path",{d:"m19 12-7 7-7-7"})]}),Z("chat.jumpToBottom")]})]})]}),(0,r.jsxs)("div",{ref:rE,className:"relative chat-composer-dock flex min-h-0 flex-col",children:[tj&&(0,r.jsx)("div",{style:{padding:"0 16px"},children:(0,r.jsx)("div",{className:"chat-column-cap",style:{maxWidth:"var(--reading-measure)",margin:"0 auto"},children:(0,r.jsx)(h0,{request:tj,onRespond:tI,onActivity:(e,t)=>void tM(e,t??"activity"),delivery:tS})})}),(0,r.jsx)("div",{className:"min-h-0 overflow-y-auto",style:{padding:"0 16px"},children:(0,r.jsxs)("div",{className:"chat-column-cap",style:{maxWidth:"var(--reading-measure)",margin:"0 auto"},children:[(0,r.jsx)(cS,{compaction:tn,t:Z}),(0,r.jsx)(hY,{goal:tF,t:Z}),(0,r.jsx)(hZ,{widgets:it}),(rm||rD.steps.length>0)&&!et&&(0,r.jsx)(u0,{phases:rm,flow:rD,busy:nr})]})}),q&&!H&&rJ&&null!==rG&&!et&&(0,r.jsx)("div",{className:"turn-peek-dock",style:{padding:"0 16px"},children:(0,r.jsx)("div",{className:"chat-column-cap",children:(0,r.jsx)(as.Provider,{value:rh,children:(0,r.jsx)(cd,{summary:rJ,live:"live"===rG,onOpen:()=>rZ.select(rG)})})})}),rL,(0,r.jsx)(uX,{statuses:tN})]}),rX]})}function hY({goal:e,t}){if(!e)return null;let n=!e.enabled,i=void 0!==e.tokenBudget?t("chat.goalBudgetLeft",{left:nV(Math.max(0,e.tokenBudget-e.tokensUsed))}):t("chat.goalTokensUsed",{used:nV(e.tokensUsed)});return(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8,padding:"5px 10px",border:0,borderRadius:"var(--radius-control)",background:"var(--bg-panel)",color:"var(--text-muted)",fontSize:11,fontFamily:"var(--font-mono)",opacity:n?.7:1},children:[(0,r.jsx)("span",{style:{color:n?"var(--text-dim)":"var(--accent)",fontWeight:700,letterSpacing:"0.06em",textTransform:"uppercase",flexShrink:0},children:t("chat.goalLabel")}),(0,r.jsx)("span",{style:{minWidth:0,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"var(--text)"},children:e.objective}),(0,r.jsx)("span",{style:{flexShrink:0,color:"var(--text-dim)"},children:n?t("chat.goalPaused"):e.status}),(0,r.jsx)("span",{style:{flexShrink:0,color:"var(--text-dim)"},children:i})]})}function hZ({widgets:e}){return 0===e.length?null:(0,r.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:8,marginBottom:10},children:e.map(e=>(0,r.jsxs)("div",{style:{border:0,borderRadius:"var(--radius-surface)",background:"var(--bg-panel)",overflow:"hidden"},children:[(0,r.jsx)("div",{style:{padding:"5px 9px",background:"var(--bg-hover)",color:"var(--text-muted)",fontSize:11,fontFamily:"var(--font-mono)"},children:e.key}),(0,r.jsx)("pre",{style:{margin:0,padding:"8px 9px",color:"var(--text-muted)",fontSize:12,lineHeight:1.5,whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"var(--font-mono)"},children:e.lines.join("\n")})]},e.key))})}function hQ({notices:e,floating:t=!1,align:n="left"}){return 0===e.length?null:(0,r.jsx)("div",{style:{display:"flex",flexDirection:"column",alignItems:"right"===n?"flex-end":"stretch",marginBottom:10*!t},children:e.map((n,i)=>{let s="error"===n.type?"var(--danger)":"warning"===n.type?"var(--warning)":"success"===n.type?"var(--success)":"var(--accent)";return(0,r.jsxs)("div",{className:"notice-shelf-item",style:{display:"flex",alignItems:"center",gap:10,minHeight:60,height:60,maxHeight:60,marginBottom:6*(i!==e.length-1),overflow:"hidden",borderRadius:"var(--seed-radius-r3)",border:0,background:"var(--bg-subtle)",color:"var(--text-muted)",width:"fit-content",maxWidth:"min(100%, 620px)",boxShadow:t?"var(--seed-shadow-s3)":"var(--seed-shadow-s2)",fontSize:18,lineHeight:1.45,transformOrigin:"top center",animation:n.exiting?"notice-shelf-out 0.18s ease-in forwards":"notice-shelf-in 0.18s ease-out both",padding:"0 12px"},children:[(0,r.jsx)("span",{style:{width:7,height:7,borderRadius:"50%",background:s,flexShrink:0}}),(0,r.jsx)("span",{style:{padding:"14px 0",minWidth:0,maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n.message})]},n.id)})})}function hX({focusKey:e,label:t,labelledBy:n,maxBlockSize:s="min(56dvh, 620px)",onCancel:a,delivery:l,children:o}){let{t:c}=(0,F.s)(),d=(0,i.useRef)(null),u=(0,i.useRef)({key:"",element:null});if(u.current.key!==e){let t="u"<typeof document?null:document.activeElement;u.current={key:e,element:t instanceof HTMLElement&&!d.current?.contains(t)?t:null}}return(0,i.useEffect)(()=>{let e=d.current;e&&!e.contains(document.activeElement)&&(e.querySelector('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')??e).focus();let t=u.current.element;return()=>{if(!t?.isConnected)return;let n=document.activeElement;(null===n||n===document.body||e?.contains(n))&&t.focus()}},[e]),(0,r.jsxs)("div",{ref:d,role:"dialog","aria-modal":"false","aria-label":t,"aria-labelledby":n,className:"chat-response-surface",tabIndex:-1,onKeyDown:a?e=>{"Escape"===e.key&&(e.stopPropagation(),a())}:void 0,"aria-busy":l?.status==="sending"||void 0,style:{maxBlockSize:s},children:[l?(0,r.jsx)("p",{className:"chat-response-delivery",role:"failed"===l.status?"alert":"status","data-state":l.status,children:"sending"===l.status?c("chat.responseSending"):`${c("chat.responseFailed")}${l.error?` (${l.error})`:""}`}):null,o]})}function h0({request:e,onRespond:t,onActivity:n,delivery:s}){let{t:a}=(0,F.s)(),[l,o]=(0,i.useState)("editor"===e.method?e.prefill??"":""),[c,d]=(0,i.useState)({selected:{},custom:{}}),[u,h]=(0,i.useState)(""),p=(0,i.useRef)(0),m=(0,i.useCallback)(()=>{if("ask"!==e.method||!e.timeout||!n)return;let t=Date.now();t-p.current<1e3||(p.current=t,n(e))},[e,n]);(0,i.useEffect)(()=>{o("editor"===e.method?e.prefill??"":""),h(""),d("ask"===e.method?function(e){let t={};for(let n of e)t[n.id]=void 0!==n.recommended&&void 0!==n.options[n.recommended]?[n.recommended]:[];return{selected:t,custom:{}}}(e.questions):{selected:{},custom:{}})},[e]);let f=()=>{"confirm"===e.method?t(e,{confirmed:!0}):t(e,{value:l})};if("form"===e.method)return(0,r.jsx)(hX,{focusKey:e.id,label:a("chat.agentQuestion"),delivery:s,children:(0,r.jsx)(ds,{request:e,onRespond:t,onActivity:n,delivery:s},e.id)});if("ask"===e.method){var g;let n=(g=e.questions,g.every(e=>(c.selected[e.id]?.length??0)>0||(c.custom[e.id]?.trim().length??0)>0)),i=()=>{if(n){var r;t(e,{value:(r=e.questions,JSON.stringify({kind:"submit",results:r.map(e=>{let t=c.custom[e.id]?.trim();return{id:e.id,question:e.question,options:e.options.map(e=>e.label),multi:e.multi??!1,selectedOptions:(c.selected[e.id]??[]).map(t=>e.options[t]?.label).filter(e=>void 0!==e),...t?{customInput:t}:{}}})}))})}};return(0,r.jsx)(hX,{focusKey:e.id,label:a("chat.agentQuestion"),onCancel:()=>t(e,{cancelled:!0}),delivery:s,children:(0,r.jsxs)("div",{style:{display:"flex",flexDirection:"column",minHeight:0},children:[(0,r.jsx)("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"12px 16px"},children:(0,r.jsxs)("div",{style:{minWidth:0},children:[(0,r.jsx)("div",{style:{color:"var(--text)",fontSize:"var(--seed-font-size-t4-static)",fontWeight:600},children:a("chat.agentQuestion")}),(0,r.jsx)("div",{style:{marginTop:2,color:"var(--text-muted)",fontSize:"var(--seed-font-size-t3-static)"},children:a("chat.agentQuestionHint")}),e.timeout?(0,r.jsx)("div",{style:{marginTop:2,color:"var(--text-muted)",fontSize:"var(--seed-font-size-t3-static)"},children:a("chat.askAutoSelectHint",{seconds:Math.round(e.timeout/1e3)})}):null]})}),(0,r.jsx)("div",{style:{flex:"1 1 auto",minHeight:0,overflowY:"auto",padding:16},children:(0,r.jsx)("div",{style:{display:"grid",gap:20},children:e.questions.map((t,n)=>{let s=c.selected[t.id]??[];return(0,r.jsxs)("section",{style:{paddingTop:20*(0!==n)},children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:8,marginBottom:10},children:[t.header&&(0,r.jsx)("span",{style:{color:"var(--text-muted)",fontSize:"var(--seed-font-size-t2-static)",fontWeight:600},children:t.header}),e.questions.length>1&&(0,r.jsxs)("span",{style:{marginLeft:"auto",color:"var(--text-muted)",fontSize:"var(--seed-font-size-t2-static)",fontVariantNumeric:"tabular-nums"},children:[n+1,"/",e.questions.length]})]}),(0,r.jsx)("div",{style:{marginBottom:10,color:"var(--text)",fontSize:"var(--seed-font-size-t4-static)",fontWeight:600,lineHeight:1.5},children:t.question}),(0,r.jsx)("div",{role:t.multi?"group":"radiogroup","aria-label":t.question,style:{display:"grid",gap:4},children:t.options.map((e,n)=>{let i=s.includes(n),l=t.recommended===n;return(0,r.jsxs)("button",{type:"button",role:t.multi?"checkbox":"radio","aria-checked":i,onClick:()=>{m(),d(e=>(function(e,t,n){let r=e.selected[t.id]??[];if(t.multi){let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];return{...e,selected:{...e.selected,[t.id]:i}}}return{selected:{...e.selected,[t.id]:[n]},custom:{...e.custom,[t.id]:""}}})(e,t,n))},style:{display:"grid",gridTemplateColumns:"18px minmax(0, 1fr) auto",alignItems:"start",gap:9,width:"100%",minHeight:40,padding:"9px 10px",border:0,borderRadius:"var(--radius-control)",background:i?"var(--bg-selected)":"transparent",color:"var(--text)",cursor:"pointer",textAlign:"left"},children:[(0,r.jsx)("span",{"aria-hidden":"true",style:{display:"grid",placeItems:"center",width:16,height:16,marginTop:1,border:0,borderRadius:t.multi?"var(--radius-control)":"50%",background:i?"var(--seed-color-fg-neutral)":"var(--bg-selected)",color:"var(--seed-color-fg-neutral-inverted)",fontSize:"var(--seed-font-size-t2-static)",lineHeight:1},children:i&&(t.multi?(0,r.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,r.jsx)("polyline",{points:"2 5.2 4.1 7.2 8 2.8"})}):(0,r.jsx)("span",{style:{width:5,height:5,borderRadius:"50%",background:"currentColor"}}))}),(0,r.jsxs)("span",{style:{minWidth:0},children:[(0,r.jsx)("span",{style:{display:"block",fontSize:"var(--seed-font-size-t4-static)",fontWeight:i?600:500},children:e.label}),e.description&&(0,r.jsx)("span",{style:{display:"block",marginTop:3,color:"var(--text-muted)",fontSize:"var(--seed-font-size-t3-static)",lineHeight:1.45},children:e.description}),i&&e.preview&&(0,r.jsx)("span",{style:{display:"block",marginTop:8,padding:"7px 8px",borderRadius:"var(--radius-control)",background:"var(--bg-hover)",color:"var(--text-muted)",fontSize:"var(--seed-font-size-t3-static)",lineHeight:1.5,whiteSpace:"pre-wrap"},children:e.preview})]}),l&&(0,r.jsx)("span",{style:{color:"var(--text-muted)",fontSize:"var(--seed-font-size-t2-static)",fontWeight:600},children:a("chat.recommended")})]},`${t.id}:${n}`)})}),(0,r.jsx)("input",{value:c.custom[t.id]??"",onChange:e=>{m();let n=e.target.value;d(e=>{let r;return r={...e.custom,[t.id]:n},t.multi||0===n.trim().length?{...e,custom:r}:{selected:{...e.selected,[t.id]:[]},custom:r}})},onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&"Enter"===e.key&&i()},placeholder:a("chat.customAnswer"),"aria-label":a("chat.customAnswer"),style:{width:"100%",height:36,marginTop:9,padding:"0 10px",border:0,borderRadius:"var(--radius-control)",background:"var(--bg)",color:"var(--text)",fontFamily:"var(--seed-font-family)",fontSize:"var(--seed-font-size-t4-static)"}})]},t.id)})})}),(0,r.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"flex-end",gap:8,padding:"12px 16px"},children:[(0,r.jsx)("button",{type:"button",onClick:()=>t(e,{cancelled:!0}),style:{minHeight:36,padding:"0 12px",border:0,borderRadius:"var(--radius-control)",background:"var(--bg-hover)",color:"var(--text-muted)",cursor:"pointer"},children:a("chat.cancel")}),(0,r.jsx)("button",{type:"button",onClick:()=>t(e,{value:JSON.stringify({kind:"chat"})}),style:{minHeight:36,padding:"0 12px",border:0,borderRadius:"var(--radius-control)",background:"var(--bg-hover)",color:"var(--text)",cursor:"pointer"},children:a("chat.chatAboutThis")}),(0,r.jsx)("button",{type:"button",disabled:!n||s?.status==="sending",onClick:i,style:{minHeight:36,padding:"0 14px",border:0,borderRadius:"var(--radius-control)",background:n&&s?.status!=="sending"?"var(--seed-color-bg-neutral-inverted)":"var(--seed-color-bg-disabled)",color:n&&s?.status!=="sending"?"var(--seed-color-fg-neutral-inverted)":"var(--seed-color-fg-disabled)",cursor:n&&s?.status!=="sending"?"pointer":"not-allowed",fontWeight:600},children:s?.status==="sending"?a("chat.responseSending"):a("chat.submitAnswer")})]})]})})}return"plan_review"===e.method?(0,r.jsx)(hX,{focusKey:e.id,labelledBy:`plan-review-${e.id}`,maxBlockSize:"min(64dvh, 760px)",delivery:s,children:(0,r.jsxs)("div",{style:{display:"flex",flexDirection:"column",minHeight:0},children:[(0,r.jsxs)("div",{style:{padding:"12px 16px"},children:[(0,r.jsx)("div",{style:{color:"var(--text-muted)",fontSize:"var(--seed-font-size-t2-static)",fontWeight:600},children:a("chat.planApproval")}),(0,r.jsx)("div",{id:`plan-review-${e.id}`,style:{marginTop:4,color:"var(--text)",fontSize:"var(--seed-font-size-t5-static)",fontWeight:600},children:e.title}),(0,r.jsx)("div",{style:{marginTop:5,color:"var(--text-muted)",fontFamily:"var(--font-mono)",fontSize:"var(--seed-font-size-t2-static)",overflowWrap:"anywhere"},children:e.planFilePath})]}),(0,r.jsx)("div",{style:{flex:"1 1 auto",minHeight:0,overflowY:"auto",padding:"18px 20px"},children:(0,r.jsx)(nk,{children:e.planContent})}),(0,r.jsxs)("div",{style:{padding:"12px 16px"},children:[(0,r.jsx)("textarea",{value:u,onChange:e=>h(e.target.value),placeholder:a("chat.planFeedback"),"aria-label":a("chat.planFeedback"),style:{width:"100%",minHeight:64,maxHeight:150,padding:"9px 10px",border:0,borderRadius:"var(--radius-control)",outline:"none",resize:"vertical",background:"var(--bg)",color:"var(--text)",fontFamily:"var(--seed-font-family)",fontSize:"var(--seed-font-size-t4-static)",lineHeight:1.5}}),(0,r.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"flex-end",gap:8,marginTop:9},children:[(0,r.jsx)("button",{type:"button",onClick:()=>t(e,{value:JSON.stringify({action:"refine",feedback:u.trim()})}),style:{minHeight:36,padding:"0 12px",border:0,borderRadius:"var(--radius-control)",background:"var(--bg-hover)",color:"var(--text)",cursor:"pointer"},children:a("chat.refinePlan")}),(0,r.jsx)("button",{type:"button",onClick:()=>t(e,{value:JSON.stringify({action:"approve"})}),style:{minHeight:36,padding:"0 14px",border:0,borderRadius:"var(--radius-control)",background:"var(--seed-color-bg-neutral-inverted)",color:"var(--seed-color-fg-neutral-inverted)",cursor:"pointer",fontWeight:600},children:a("chat.approvePlan")})]})]})]})}):(0,r.jsx)(hX,{focusKey:e.id,labelledBy:`extension-request-${e.id}`,onCancel:()=>t(e,{cancelled:!0}),delivery:s,children:(0,r.jsxs)("div",{style:{display:"flex",flexDirection:"column",minHeight:0},children:[(0,r.jsxs)("div",{style:{padding:"12px 14px"},children:[(0,r.jsx)("div",{id:`extension-request-${e.id}`,style:{color:"var(--text)",fontSize:"var(--seed-font-size-t4-static)",fontWeight:600},children:e.title}),(0,r.jsx)("div",{style:{marginTop:3,color:"var(--text-muted)",fontSize:"var(--seed-font-size-t2-static)",fontFamily:"var(--font-mono)"},children:a("chat.extensionRequest")})]}),(0,r.jsxs)("div",{style:{flex:"1 1 auto",minHeight:0,overflowY:"auto",padding:14},children:["confirm"===e.method&&(0,r.jsx)("div",{style:{color:"var(--text-muted)",fontSize:"var(--seed-font-size-t3-static)",lineHeight:1.6,whiteSpace:"pre-wrap"},children:e.message}),"select"===e.method&&(0,r.jsx)("div",{style:{display:"grid",gap:8},children:e.options.map(n=>(0,r.jsx)("button",{onClick:()=>t(e,{value:n}),style:{width:"100%",minHeight:40,padding:"9px 10px",borderRadius:"var(--radius-control)",border:0,background:"var(--bg-hover)",color:"var(--text)",cursor:"pointer",textAlign:"left",fontSize:"var(--seed-font-size-t4-static)"},children:n},n))}),"input"===e.method&&(0,r.jsx)("input",{autoFocus:!0,value:l,placeholder:e.placeholder,onChange:e=>o(e.target.value),onKeyDown:e=>{"Enter"===e.key&&f()},style:{width:"100%",padding:"9px 10px",borderRadius:"var(--radius-control)",border:0,background:"var(--bg)",color:"var(--text)",outline:"none",fontSize:"var(--seed-font-size-t4-static)"}}),"editor"===e.method&&(0,r.jsx)("textarea",{autoFocus:!0,value:l,onChange:e=>o(e.target.value),onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&"Enter"===e.key&&f()},style:{width:"100%",minHeight:220,padding:10,borderRadius:"var(--radius-control)",border:0,background:"var(--bg)",color:"var(--text)",outline:"none",resize:"vertical",fontSize:"var(--seed-font-size-t3-static)",lineHeight:1.55,fontFamily:"var(--font-mono)"}})]}),(0,r.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"flex-end",gap:8,padding:"12px 14px"},children:[(0,r.jsx)("button",{onClick:()=>t(e,{cancelled:!0}),style:{minHeight:36,padding:"0 12px",borderRadius:"var(--radius-control)",border:0,background:"var(--bg-hover)",color:"var(--text-muted)",cursor:"pointer"},children:a("chat.cancel")}),"confirm"===e.method?(0,r.jsx)("button",{onClick:f,style:{minHeight:36,padding:"0 14px",borderRadius:"var(--radius-control)",border:0,background:"var(--seed-color-bg-neutral-inverted)",color:"var(--seed-color-fg-neutral-inverted)",cursor:"pointer",fontWeight:600},children:a("chat.confirm")}):"select"!==e.method?(0,r.jsx)("button",{onClick:f,style:{minHeight:36,padding:"0 14px",borderRadius:"var(--radius-control)",border:0,background:"var(--seed-color-bg-neutral-inverted)",color:"var(--seed-color-fg-neutral-inverted)",cursor:"pointer",fontWeight:600},children:a("chat.submit")}):null]})]})})}function h1({request:e,onInput:t}){let{t:n}=(0,F.s)(),s=(0,i.useRef)(null),a=(0,i.useRef)(!1),l=eO(e.lines);return(0,i.useEffect)(()=>{s.current?.focus()},[e.id]),(0,r.jsx)("div",{style:{position:"absolute",inset:0,zIndex:95,display:"flex",alignItems:"center",justifyContent:"center",padding:20,background:"var(--seed-color-bg-overlay-muted)"},children:(0,r.jsxs)("div",{role:"dialog","aria-modal":"true",onClick:e=>{e.target.closest("button")||s.current?.focus()},style:{position:"relative",width:"min(920px, 100%)",maxHeight:"min(760px, calc(100vh - 40px))",border:0,borderRadius:"var(--radius-surface)",background:"var(--bg)",boxShadow:"var(--seed-shadow-s3)",overflow:"hidden",outline:"none"},children:[(0,r.jsx)("textarea",{ref:s,"aria-label":n("chat.extensionInput"),autoCapitalize:"off",autoComplete:"off",autoCorrect:"off",spellCheck:!1,onKeyDown:n=>{if(a.current||n.nativeEvent.isComposing)return;let r=function(e){if(e.metaKey||e.ctrlKey&&!e.altKey&&"v"===e.key.toLowerCase())return null;if(e.ctrlKey&&!e.altKey){let t=function(e){if(1!==e.length)return null;let t=e.toUpperCase().charCodeAt(0);return t>=64&&t<=95?String.fromCharCode(31&t):"?"===e?"":null}(e.key);if(t)return t}if(e.altKey&&!e.ctrlKey){if("Backspace"===e.key)return"\x1b\x7f";let t=eW[e.key];if(t)return t;if(1===e.key.length)return`\x1b${e.key}`}return"Enter"===e.key?e.shiftKey?"\n":"\r":"Tab"===e.key?e.shiftKey?"\x1b[Z":" ":eD[e.key]??null}(n);r&&(n.preventDefault(),n.stopPropagation(),t(e,r))},onInput:n=>{if(a.current||n.nativeEvent.isComposing)return;let r=n.currentTarget.value;n.currentTarget.value="",r&&t(e,r)},onCompositionStart:()=>{a.current=!0},onCompositionEnd:n=>{a.current=!1;let r=n.currentTarget;queueMicrotask(()=>{let n=r.value;r.value="",n&&t(e,n)})},onPaste:n=>{n.preventDefault();let r=n.clipboardData.getData("text");r&&t(e,`\x1b[200~${r}\x1b[201~`)},style:{position:"absolute",width:1,height:1,padding:0,border:0,opacity:0,pointerEvents:"none"}}),(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,padding:"10px 12px",background:"var(--bg-panel)"},children:[(0,r.jsx)("div",{style:{color:"var(--text)",fontSize:13,fontWeight:650},children:n("chat.extensionPanel")}),(0,r.jsx)("button",{onClick:()=>t(e,"\x03"),style:{padding:"5px 9px",borderRadius:"var(--radius-control)",border:0,background:"var(--bg-hover)",color:"var(--text-muted)",cursor:"pointer",fontSize:12},children:n("chat.close")})]}),(0,r.jsx)("pre",{style:{margin:0,padding:14,maxHeight:"calc(min(760px, 100vh - 40px) - 48px)",overflow:"auto",background:"var(--bg-panel)",color:"var(--text)",fontFamily:"var(--font-mono)",fontSize:13,lineHeight:1.45,whiteSpace:"pre"},children:(l.length?l:[""]).map((e,t,n)=>{var s;return(0,r.jsxs)(i.Fragment,{children:[(s=`line-${t}`,ez(e).map((e,t)=>Object.keys(e.style).length>0?(0,r.jsx)("span",{style:e.style,children:e.text},`${s}-${t}`):e.text)),t<n.length-1?"\n":null]},t)})})]})})}var h2=n(40960),h8=n.n(h2);function h4({sessionId:e,refreshKey:t,compact:n}){let{t:s}=(0,F.s)(),[a,o]=(0,i.useState)(null),[c,d]=(0,i.useState)(!1),[u,h]=(0,i.useState)(null),p=(0,i.useRef)(e);p.current=e;let m=(0,i.useRef)(0);(0,i.useEffect)(()=>{if(!e)return;let t=!1,n=++m.current;return fetch(`/api/agent/${encodeURIComponent(e)}`).then(e=>e.json()).then(r=>{if(t||n!==m.current)return;let i=r.running?r.state?.computerTakeover:null;o(i?{sessionId:e,state:{enabled:!0===i.enabled,available:!0===i.available}}:null),h(null)}).catch(()=>{}),()=>{t=!0}},[e,t]);let f=(0,i.useCallback)(async e=>{let t=p.current;if(t){d(!0),h(null);try{let n=await fetch(`/api/agent/${encodeURIComponent(t)}/computer-takeover`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({enabled:e})}),r=await n.json();if(!n.ok)throw Error("shared_settings"===r.code?s("computerTakeover.shared"):r.error??n.statusText);p.current===t&&(m.current+=1,o({sessionId:t,state:{enabled:!0===r.enabled,available:!0!==r.enabled}}))}catch(e){p.current===t&&h(s("computerTakeover.failed",{error:e instanceof Error?e.message:String(e)}))}finally{d(!1)}}},[s]),g=a&&a.sessionId===e?a.state:null;if(!g||!g.enabled&&!g.available)return null;let x=g.enabled,v=x?s("computerTakeover.active"):s("computerTakeover.allow"),y=u??(x?s("computerTakeover.activeHint"):s("computerTakeover.allowHint"));return(0,r.jsxs)(l.r,{className:`workspace-header-action workspace-takeover${x?` ${h8().active}`:""}`,variant:x?"neutralWeak":"ghost",size:"small",type:"button",disabled:c,"aria-pressed":x,"aria-label":v,title:y,onClick:()=>void f(!x),children:[(0,r.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,r.jsx)("path",{d:"M5 3l14 7-6 2-2 6-6-15Z"})}),(x||!n)&&(0,r.jsx)("span",{children:v})]})}let h5={folder:(0,r.jsx)("path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"}),"list-ordered":(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("path",{d:"M10 12h11"}),(0,r.jsx)("path",{d:"M10 18h11"}),(0,r.jsx)("path",{d:"M10 6h11"}),(0,r.jsx)("path",{d:"M4 10h2"}),(0,r.jsx)("path",{d:"M4 6h1v4"}),(0,r.jsx)("path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1"})]}),languages:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("path",{d:"m5 8 6 6"}),(0,r.jsx)("path",{d:"m4 14 6-6 2-3"}),(0,r.jsx)("path",{d:"M2 5h12"}),(0,r.jsx)("path",{d:"M7 2h1"}),(0,r.jsx)("path",{d:"m22 22-5-10-5 10"}),(0,r.jsx)("path",{d:"M14 18h6"})]}),repeat:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("path",{d:"m17 2 4 4-4 4"}),(0,r.jsx)("path",{d:"M3 11v-1a4 4 0 0 1 4-4h14"}),(0,r.jsx)("path",{d:"m7 22-4-4 4-4"}),(0,r.jsx)("path",{d:"M21 13v1a4 4 0 0 1-4 4H3"})]}),activity:(0,r.jsx)("path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2"}),settings:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"}),(0,r.jsx)("circle",{cx:"12",cy:"12",r:"3"})]}),"panel-right":(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}),(0,r.jsx)("path",{d:"M15 3v18"})]}),"panel-left":(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}),(0,r.jsx)("path",{d:"M9 3v18"})]}),menu:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("line",{x1:"4",x2:"20",y1:"12",y2:"12"}),(0,r.jsx)("line",{x1:"4",x2:"20",y1:"6",y2:"6"}),(0,r.jsx)("line",{x1:"4",x2:"20",y1:"18",y2:"18"})]}),"chevron-right":(0,r.jsx)("path",{d:"m9 18 6-6-6-6"}),"chevron-up":(0,r.jsx)("path",{d:"m18 15-6-6-6 6"}),"chevron-down":(0,r.jsx)("path",{d:"m6 9 6 6 6-6"}),"circle-check":(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,r.jsx)("path",{d:"m9 12 2 2 4-4"})]}),"circle-alert":(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,r.jsx)("line",{x1:"12",x2:"12",y1:"8",y2:"12"}),(0,r.jsx)("line",{x1:"12",x2:"12.01",y1:"16",y2:"16"})]}),ellipsis:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("circle",{cx:"12",cy:"12",r:"1"}),(0,r.jsx)("circle",{cx:"19",cy:"12",r:"1"}),(0,r.jsx)("circle",{cx:"5",cy:"12",r:"1"})]}),x:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("path",{d:"M18 6 6 18"}),(0,r.jsx)("path",{d:"m6 6 12 12"})]}),check:(0,r.jsx)("path",{d:"M20 6 9 17l-5-5"}),"message-square":(0,r.jsx)("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"}),"messages-square":(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z"}),(0,r.jsx)("path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1"})]}),"list-tree":(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("path",{d:"M21 12h-8"}),(0,r.jsx)("path",{d:"M21 6H8"}),(0,r.jsx)("path",{d:"M21 18h-8"}),(0,r.jsx)("path",{d:"M3 6v4c0 1.1.9 2 2 2h3"}),(0,r.jsx)("path",{d:"M3 10v6c0 1.1.9 2 2 2h3"})]}),bot:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("path",{d:"M12 8V4H8"}),(0,r.jsx)("rect",{width:"16",height:"12",x:"4",y:"8",rx:"2"}),(0,r.jsx)("path",{d:"M2 14h2"}),(0,r.jsx)("path",{d:"M20 14h2"}),(0,r.jsx)("path",{d:"M15 13v2"}),(0,r.jsx)("path",{d:"M9 13v2"})]}),"file-text":(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"}),(0,r.jsx)("path",{d:"M14 2v4a2 2 0 0 0 2 2h4"}),(0,r.jsx)("path",{d:"M10 9H8"}),(0,r.jsx)("path",{d:"M16 13H8"}),(0,r.jsx)("path",{d:"M16 17H8"})]}),users:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),(0,r.jsx)("circle",{cx:"9",cy:"7",r:"4"}),(0,r.jsx)("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),(0,r.jsx)("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]}),"user-round":(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("circle",{cx:"12",cy:"8",r:"5"}),(0,r.jsx)("path",{d:"M20 21a8 8 0 0 0-16 0"})]}),gauge:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("path",{d:"m12 14 4-4"}),(0,r.jsx)("path",{d:"M3.34 19a10 10 0 1 1 17.32 0"})]}),puzzle:(0,r.jsx)("path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z"}),brain:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z"}),(0,r.jsx)("path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z"}),(0,r.jsx)("path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4"}),(0,r.jsx)("path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375"}),(0,r.jsx)("path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5"}),(0,r.jsx)("path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396"}),(0,r.jsx)("path",{d:"M19.938 10.5a4 4 0 0 1 .585.396"}),(0,r.jsx)("path",{d:"M6 18a4 4 0 0 1-1.967-.516"}),(0,r.jsx)("path",{d:"M19.967 17.484A4 4 0 0 1 18 18"})]}),"chart-column":(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}),(0,r.jsx)("path",{d:"M18 17V9"}),(0,r.jsx)("path",{d:"M13 17V5"}),(0,r.jsx)("path",{d:"M8 17v-3"})]}),"maximize-2":(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("polyline",{points:"15 3 21 3 21 9"}),(0,r.jsx)("polyline",{points:"9 21 3 21 3 15"}),(0,r.jsx)("line",{x1:"21",x2:"14",y1:"3",y2:"10"}),(0,r.jsx)("line",{x1:"3",x2:"10",y1:"21",y2:"14"})]}),search:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("circle",{cx:"11",cy:"11",r:"8"}),(0,r.jsx)("path",{d:"m21 21-4.3-4.3"})]})};function h6({name:e,size:t=16}){return(0,r.jsx)("svg",{className:"workbench-icon",width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:h5[e]})}function h3({size:e=28}){return(0,r.jsx)("svg",{className:"workbench-mark",width:e,height:e,viewBox:"0 0 100 100","aria-hidden":"true",focusable:"false",children:(0,r.jsxs)("g",{transform:"translate(15 15) scale(0.7)",children:[(0,r.jsx)("path",{d:"M77.9 30.5 A34 34 0 0 0 16 50 A26 26 0 0 0 68 50",fill:"none",stroke:"currentColor",strokeWidth:"10",strokeLinecap:"round"}),(0,r.jsx)("circle",{cx:"42",cy:"50",r:"8.5",fill:"var(--brand-lamp)"})]})})}function h7({onPick:e,t}){let[n,s]=(0,i.useState)(""),[a,l]=(0,i.useState)({kind:"idle"}),o=(0,i.useRef)(null),c=n.trim();(0,i.useEffect)(()=>{if(c.length<2)return void l({kind:"idle"});let e=new AbortController;l({kind:"loading"});let t=setTimeout(()=>{fetch(`/api/sessions/search?q=${encodeURIComponent(c)}`,{signal:e.signal,cache:"no-store"}).then(async e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);l({kind:"done",data:await e.json()})}).catch(()=>{e.signal.aborted||l({kind:"error"})})},250);return()=>{clearTimeout(t),e.abort()}},[c]);let d=e=>{let t=o.current?.querySelectorAll("button");t&&0!==t.length&&t[Math.max(0,Math.min(t.length-1,e))]?.focus()},u="done"===a.kind?a.data:null,h=u?.truncated?t(`palette.searchTruncated.${u.truncated}`,{scanned:u.scannedSessions,total:u.totalSessions}):null;return(0,r.jsxs)("div",{className:"palette-search",children:[(0,r.jsxs)("div",{className:"palette-search-field",children:[(0,r.jsx)(h6,{name:"search"}),(0,r.jsx)("input",{type:"search",value:n,onChange:e=>s(e.target.value),onKeyDown:t=>{if(!t.nativeEvent.isComposing){if("ArrowDown"===t.key)t.preventDefault(),d(0);else if("Enter"===t.key&&u&&u.hits.length>0){t.preventDefault();let n=u.hits[0],r=u.sessions[n.sessionId];r&&e(r,n,u.query)}}},placeholder:t("palette.searchPlaceholder"),"aria-label":t("palette.searchPlaceholder"),autoComplete:"off",spellCheck:!1}),(0,r.jsx)("kbd",{"aria-hidden":"true",children:"Ctrl K"})]}),c.length>=2&&(0,r.jsxs)("div",{className:"palette-search-results",role:"region","aria-label":t("palette.searchResults"),"aria-busy":"loading"===a.kind,children:[(0,r.jsxs)("p",{className:"palette-search-status","aria-live":"polite",children:["loading"===a.kind&&t("palette.searching"),"error"===a.kind&&t("palette.searchFailed"),u&&(0===u.hits.length?t("palette.searchEmpty"):t("palette.searchHits",{count:u.hits.length})),h?` \xb7 ${h}`:"",u&&u.compactedHits>0?` \xb7 ${t("palette.searchCompacted",{count:u.compactedHits})}`:""]}),u&&u.hits.length>0&&(0,r.jsx)("div",{ref:o,className:"palette-search-list",children:u.hits.map((n,i)=>{let s=u.sessions[n.sessionId],a=n.matchStart+u.query.length;return(0,r.jsxs)("button",{type:"button",disabled:!s,onClick:()=>s&&e(s,n,u.query),onKeyDown:e=>{("ArrowDown"===e.key||"ArrowUp"===e.key)&&(e.preventDefault(),d(i+("ArrowDown"===e.key?1:-1)))},children:[(0,r.jsxs)("span",{className:"palette-search-title",children:[(0,r.jsx)("span",{children:s?s.name?.trim()||s.firstMessage?.trim()||s.id:""}),(0,r.jsx)("small",{children:"user"===n.role?t("palette.searchRoleUser"):t("palette.searchRoleAssistant")})]}),(0,r.jsxs)("span",{className:"palette-search-snippet",children:[n.snippet.slice(0,n.matchStart),(0,r.jsx)("mark",{children:n.snippet.slice(n.matchStart,a)}),n.snippet.slice(a)]})]},`${n.sessionId}:${n.entryId}`)})})]})]})}var h9=n(50640),pe=n(73620);let pt=/^(?:\uFEFF)?---[ \t]*(?:\r\n|\n|\r)/;function pn(e){return function e(t,n){if(null==t)return"";if("string"==typeof t)return t;if("number"==typeof t||"boolean"==typeof t)return String(t);if(Array.isArray(t)){if(n.has(t))return"[Circular]";n.add(t);try{return t.map(t=>e(t,n)).filter(Boolean).join(", ")}finally{n.delete(t)}}if("object"==typeof t)try{return JSON.stringify(t)??Object.prototype.toString.call(t)}catch{return Object.prototype.toString.call(t)}return String(t)}(e,new WeakSet)}let pr=["tags","categories","keywords","tag","category"];function pi({data:e}){var t;if(!e)return null;let n=Object.entries(e);if(0===n.length)return null;let i="string"==typeof(t=e.title)?t.trim()||null:"number"==typeof t||"boolean"==typeof t?String(t):null,s=pr.find(t=>Array.isArray(e[t])),a=s?e[s].map(pn).filter(Boolean):[],l=n.filter(([e])=>e!==s&&("title"!==e||!i));return(0,r.jsxs)("div",{className:"markdown-frontmatter",children:[i&&(0,r.jsx)("div",{className:"markdown-frontmatter-title",children:i}),a.length>0&&(0,r.jsx)("div",{className:"markdown-frontmatter-tags",children:a.map((e,t)=>(0,r.jsx)("span",{className:"markdown-frontmatter-tag",children:e},`${e}-${t}`))}),l.length>0&&(0,r.jsx)("dl",{className:"markdown-frontmatter-rows",children:l.map(([e,t])=>(0,r.jsxs)("div",{className:"markdown-frontmatter-row",children:[(0,r.jsx)("dt",{children:e}),(0,r.jsx)("dd",{children:function(e){let t=pn(e);return t?"string"==typeof e&&/^(https?:\/\/|mailto:)/i.test(e)?(0,r.jsx)("a",{href:e,target:"_blank",rel:"noopener noreferrer",children:t}):t:null}(t)})]},e))})]})}var ps=n(8745);let pa=(0,i.createContext)(null),pl=(0,r.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,r.jsx)("path",{d:"M9.5 2.5h4v4M6.5 13.5h-4v-4M13.5 2.5 9 7M2.5 13.5 7 9"})}),po=(0,r.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,r.jsx)("path",{d:"M13.5 6.5h-4v-4M2.5 9.5h4v4M9.5 6.5l4-4M6.5 9.5l-4 4"})}),pc=(0,r.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,r.jsx)("path",{d:"m10 3-5 5 5 5"})}),pd=(0,r.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round","aria-hidden":"true",children:(0,r.jsx)("path",{d:"m4 4 8 8M12 4l-8 8"})}),pu=(0,r.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:[(0,r.jsx)("circle",{cx:"3.5",cy:"8",r:"1.2"}),(0,r.jsx)("circle",{cx:"8",cy:"8",r:"1.2"}),(0,r.jsx)("circle",{cx:"12.5",cy:"8",r:"1.2"})]});function ph({back:e,title:t,titleTooltip:n,titleRef:i,titleAdornment:s,subtitle:a,subtitleKind:d="text",state:u,viewSwitch:h,actions:p=[],close:m}){let{t:f}=(0,F.s)();return(0,r.jsxs)("header",{className:"panel-header",children:[e&&(0,r.jsx)(l.r,{className:"panel-header-button",variant:"ghost",size:"small",layout:"iconOnly",onClick:e.onClick,"aria-label":e.label,title:e.label,children:(0,r.jsx)(c.In,{size:"16px",svg:pc})}),(0,r.jsxs)("div",{className:"panel-header-heading",children:[(0,r.jsx)("h2",{className:"panel-header-title",title:n,ref:i,tabIndex:i?-1:void 0,children:t}),s,a&&("path"===d?(0,r.jsx)("span",{className:"panel-header-subtitle is-path",title:a,dir:"rtl",children:(0,r.jsx)("bdi",{dir:"ltr",children:a})}):(0,r.jsx)("span",{className:"panel-header-subtitle",title:a,children:a}))]}),u&&(0,r.jsx)("div",{className:"panel-header-state",children:u}),h&&h.options.length>1&&(0,r.jsxs)(ps.A.Root,{className:"panel-header-switch","aria-label":h.label,value:h.value,onValueChange:e=>h.onChange(e),children:[h.options.map(e=>(0,r.jsxs)(ps.A.Item,{value:e.value,title:e.title,children:[(0,r.jsx)(ps.A.ItemHiddenInput,{}),e.label]},e.value)),(0,r.jsx)(ps.A.Indicator,{})]}),p.length>0&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"panel-header-actions",children:p.map(e=>e.href?(0,r.jsx)("a",{className:"panel-header-link-button",href:e.href,download:e.download,"aria-label":e.label,title:e.title??e.label,children:e.icon},e.id):(0,r.jsx)(l.r,{className:"panel-header-button",variant:"ghost",size:"small",layout:"iconOnly",onClick:e.onClick,onPointerDown:e.onPointerDown,disabled:e.disabled,"aria-pressed":e.pressed,"aria-label":e.label,title:e.title??e.label,children:(0,r.jsx)(c.In,{size:"16px",svg:e.icon})},e.id))}),(0,r.jsxs)(o.k.Root,{placement:"bottom-end",strategy:"fixed",children:[(0,r.jsx)(o.k.Trigger,{asChild:!0,children:(0,r.jsx)(l.r,{className:"panel-header-button panel-header-more",variant:"ghost",size:"small",layout:"iconOnly","aria-label":f("panel.more"),title:f("panel.more"),children:(0,r.jsx)(c.In,{size:"16px",svg:pu})})}),(0,r.jsx)(o.k.Positioner,{children:(0,r.jsx)(o.k.Content,{"aria-label":f("panel.more"),children:(0,r.jsx)(o.k.ScrollArea,{children:(0,r.jsx)(o.k.Group,{children:p.map(e=>(0,r.jsx)(o.k.Item,{disabled:e.disabled,onClick:()=>(function(e){if(e.onClick)return void e.onClick();if(!e.href)return;let t=document.createElement("a");t.href=e.href,e.download&&(t.download=e.download),t.click()})(e),children:(0,r.jsx)(o.k.ItemBody,{children:(0,r.jsx)(o.k.ItemLabel,{children:e.label})})},e.id))})})})})]})]}),(0,r.jsx)(pp,{}),m&&(0,r.jsx)(l.r,{className:"panel-header-button",variant:"ghost",size:"small",layout:"iconOnly",onClick:m.onClick,"aria-label":m.label,title:m.label,children:(0,r.jsx)(c.In,{size:"16px",svg:pd})})]})}function pp({className:e="panel-header-button"}){let{t}=(0,F.s)(),n=(0,i.useContext)(pa);if(!n)return null;let s=t(n.expanded?"panel.restore":"panel.expand");return(0,r.jsx)(l.r,{className:e,"data-panel-expand":"",variant:"ghost",size:"small",layout:"iconOnly","aria-pressed":n.expanded,"aria-label":s,title:s,onClick:n.onToggle,children:(0,r.jsx)(c.In,{size:"16px",svg:n.expanded?po:pl})})}let pm="cuelo-html-pick",pf="cuelo-html-pick-exit";function pg(e,t){return"string"==typeof e&&e.length<=t}function px(e){return"number"==typeof e&&Number.isFinite(e)}function pv({content:e,title:t,picking:n,onExitPick:s,onRequestEdit:a}){let{t:o}=(0,F.s)(),c=(0,i.useRef)(null),d=(0,i.useMemo)(()=>{if(!n)return{nonce:"",srcDoc:e};let t=crypto.randomUUID();return{nonce:t,srcDoc:function(e,t){var n;let r=`<script>${(n=t,`(function(){
20
+ ${n}`:e:n,images:a,documents:l}}function dY(e,t,n){if(e===t)return n?dB(n):dV(t);let r=dV(e),i=n&&!dq(n)?dB(n):r??(n?dB(n):null),s=dV(t),a=dM.get(e);if(dM.delete(e),a&&!dM.has(t)&&dM.set(t,a),dG(e),!i)return s;let l=s?dJ(s.value,s.images,i.value,i.images,s.documents,i.documents):i;return dK(t,l),dB(l)}function dZ(e){let t=[];for(let n of e??[])n.attachmentId&&!t.includes(n.attachmentId)&&t.push(n.attachmentId);return t}function dQ(e){dH();let t=dM.get(e);return t||(t=function(){let e=globalThis.crypto;if("function"==typeof e?.randomUUID)return e.randomUUID();let t=e.getRandomValues(new Uint8Array(16));t[6]=15&t[6]|64,t[8]=63&t[8]|128;let n=[...t].map(e=>e.toString(16).padStart(2,"0")).join("");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}(),dM.set(e,t)),t}function dX(e){let t=dZ(dN.get(e)?.documents),n=t.length?dQ(e):dM.get(e);for(let[e,n]of dA){for(let e of t)n.delete(e);0===n.size&&dA.delete(e)}let r=`${n??""}|${t.join(",")}`;dF.get(e)!==r&&(0!==t.length||n?dF.set(e,r):dF.delete(e),d6())}async function d0(e){let t=dQ(e);dP.set(t,(dP.get(t)??0)+1),await dO.get(t);let n=!1;return{draftId:t,end(e){if(n)return;n=!0;let r=(dP.get(t)??1)-1;if(r>0?dP.set(t,r):dP.delete(t),e){let n=dA.get(t)??new Set;n.add(e),dA.set(t,n)}dE.set(t,dR),d6()}}}function d1(e,t){let n=d_.get(e);if(!n)return[];for(let e of t)n.delete(e);return 0===n.size&&d_.delete(e),[...n].sort()}async function d2(){if(!dz)return;let e=[...function(){let e=new Map,t=(t,n)=>{let r=e.get(t)??new Set;for(let e of n)r.add(e);e.set(t,r)};for(let[e,n]of dM)t(n,dZ(dN.get(e)?.documents));for(let{draftId:e,ids:n}of d$.values())t(e,n);for(let[e,n]of dA)t(e,n);for(let e of dE.keys())t(e,[]);for(let e of d_.keys())t(e,[]);return new Map([...e].map(([e,t])=>[e,[...t].sort()]))}()].filter(([e,t])=>{if(dP.has(e))return!1;let n=dE.get(e);return d1(e,t).length>0||(0===t.length?void 0!==n:n!==t.join(","))}),t=dP.size>0,n=!1;for(let[r,i]of[...e.filter(([,e])=>e.length>0),...e.filter(([,e])=>0===e.length)]){if(0===i.length&&t)continue;let e=d1(r,i),s=dz(r,i,e).then(()=>{0===i.length?dE.delete(r):dE.set(r,i.join(","));let t=d_.get(r);if(t){for(let n of e)t.delete(n);0===t.size&&d_.delete(r)}},()=>{n=!0,i.length>0&&(t=!0)});dO.set(r,s),await s,dO.get(r)===s&&dO.delete(r)}n?function(){if(d5)return;d5=!0;let e=setTimeout(()=>{d5=!1,d6()},d4);"object"==typeof e&&"unref"in e&&e.unref(),d4=Math.min(2*d4,6e4)}():d4=d8}let d8=5e3,d4=5e3,d5=!1;function d6(){if(dz){if(dD){dW=!0;return}dD=Promise.resolve().then(d2).finally(()=>{dD=null,dW&&(dW=!1,d6())})}}let d3=Math.floor(Number.MAX_SAFE_INTEGER/1048576),d7=Object.freeze({uploadLimitMb:100,autoCleanupEnabled:!0,orphanGraceDays:7});function d9(e){return"number"==typeof e&&Number.isSafeInteger(e)&&e>=1&&e<=d3}async function ue(e){let t,n=await e.json().catch(()=>null);if(!e.ok||!n||!d9(n.uploadLimitMb)||"boolean"!=typeof n.autoCleanupEnabled)throw Error("string"==typeof n?.error?n.error:`HTTP ${e.status}`);return{uploadLimitMb:d9((t=n&&"object"==typeof n?n:{}).uploadLimitMb)?t.uploadLimitMb:d7.uploadLimitMb,autoCleanupEnabled:"boolean"==typeof t.autoCleanupEnabled?t.autoCleanupEnabled:d7.autoCleanupEnabled,orphanGraceDays:7}}async function ut(e={}){return ue(await fetch("/api/attachment-settings",{cache:"no-store",signal:e.signal}))}async function un(e){return ue(await fetch("/api/attachment-settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}))}function ur(e){let t=/(?:^|\s)@"([^"\n]*)$/.exec(e);if(t)return{start:e.length-(t[1].length+2),query:t[1],quoted:!0};let n=/(?:^|\s)@([^\s"]*)$/.exec(e);return n?{start:e.length-(n[1].length+1),query:n[1],quoted:!1}:null}function ui(e){let t=0;for(let n=0;n<e.length;n++)"/"===e[n]&&t++;return t}function us(e,t){if(!e)return!0;let n=0;for(let r=0;r<t.length&&n<e.length;r++)t[r]===e[n]&&n++;return n===e.length}function ua(e,t){let n=t?`${e}/`:e;return n.includes(" ")?`@"${n}" `:`@${n} `}function ul(e,t,n){let r=Math.max(1,Math.min(t,n)),i=Math.max(1,Math.max(t,n)),s=e.includes(" ")?`@"${e}"`:`@${e}`,a=r===i?`:${r}`:`:${r}-${i}`;return`${s}${a} `}let uo="omp-web:model-picks";function uc(){try{let e=JSON.parse(window.localStorage.getItem(uo)??"{}");if(!e||"object"!=typeof e||Array.isArray(e))return{};let t={};for(let[n,r]of Object.entries(e))"number"==typeof r&&Number.isFinite(r)&&r>0&&(t[n]=Math.floor(r));return t}catch{return{}}}function ud(e,t,n,r,i={}){let s=i.gap??8,a=i.margin??8,l=i.prefer??"above",o=Math.min(i.minHeight??120,Math.max(0,n-2*a)),c=Math.max(0,e-s-a),d=Math.max(0,n-t-s-a),u="above"===l?c:d,h="above"===l?d:c,p=u>=r||u>=h;return{side:p?l:"above"===l?"below":"above",maxHeight:Math.max(o,Math.min(r,p?u:h))}}function uu(e,t,n){return Math.min(e*t,n)}function uh(e,t,n){let{viewportFraction:r,cap:s,gap:a,margin:l,minHeight:o,prefer:c}=n,[d,u]=(0,i.useState)({side:c??"above",maxHeight:s}),h=(0,i.useCallback)(()=>{let t=e.current;if(!t)return;let n=window.visualViewport?.height??window.innerHeight,i=t.getBoundingClientRect(),d=ud(i.top,i.bottom,n,uu(n,r,s),{gap:a,margin:l,minHeight:o,prefer:c});u(e=>e.side===d.side&&e.maxHeight===d.maxHeight?e:d)},[e,s,a,l,o,c,r]);return(0,i.useEffect)(()=>{if(!t)return;h();let n=e.current,r=n?new ResizeObserver(h):null;return n&&r&&r.observe(n),window.addEventListener("resize",h),window.addEventListener("scroll",h,!0),window.visualViewport?.addEventListener("resize",h),window.visualViewport?.addEventListener("scroll",h),()=>{r?.disconnect(),window.removeEventListener("resize",h),window.removeEventListener("scroll",h,!0),window.visualViewport?.removeEventListener("resize",h),window.visualViewport?.removeEventListener("scroll",h)}},[e,h,t]),d}var up=n(14755);let um="omp-web:model-roles-expanded";async function uf(e,t,n,r,i,s,a){let l=e.slice(1).split(/\s/,1)[0];try{let o=t?.length?t:await a?.()??[],c=[...uM,...o].find(e=>e.name===l||"aliases"in e&&e.aliases?.includes(l));if(s&&(!c||"builtin"===c.source))return i(`/${l} cannot run with attachments. Remove them and retry.`),!1;let d=await n?.(e);if(d?.handled){if(d.error)return!1;return d.prompt&&r(d.prompt),!0}if(c&&"builtin"!==c.source)return r(e),!0;return i(`/${l} is not available in this web session.`),!1}catch(e){return i(e instanceof Error?e.message:String(e)),!1}}function ug(e){let t=e.transcription?.state;return"planning"===t||"confirm"===t||"running"===t||"fallback"===t}let ux=["off","default","full"],uv={off:"none",default:"default",full:"full"},uy=up.IN.join(" \xb7 "),ub=up.C1.filter(e=>!up.IN.includes(e)).join(" \xb7 ");function uw(e){return"above"===e?{bottom:"calc(100% + 8px)"}:{top:"calc(100% + 8px)"}}let uk=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"}),uj=0,uS={"text/markdown":"Markdown","text/plain":"Text","application/pdf":"PDF"};function uC(e,t){return uk.compare(e.name||e.modelId,t.name||t.modelId)||uk.compare(e.provider,t.provider)||uk.compare(e.modelId,t.modelId)}let uN=["auto","off","minimal","low","medium","high","xhigh","max"],uT=["low","medium","high","xhigh"],uI={auto:"chat.thinkingAuto",off:"chat.thinkingOff",minimal:"chat.thinkingMinimal",low:"chat.thinkingLow",medium:"chat.thinkingMedium",high:"chat.thinkingHigh",xhigh:"chat.thinkingXhigh",max:"chat.thinkingMax"},uM=[{name:"compact",descriptionKey:"chat.commandCompact",source:"builtin"},{name:"reload",descriptionKey:"chat.commandReload",source:"builtin"},{name:"name",descriptionKey:"chat.commandName",source:"builtin"},{name:"session",descriptionKey:"chat.commandSession",source:"builtin"},{name:"copy",descriptionKey:"chat.commandCopy",source:"builtin"}],uE=["builtin","extension","custom","mcp_prompt","prompt","file","skill"],uR={builtin:"chat.builtIn",extension:"chat.extensions",custom:"chat.customCommands",mcp_prompt:"chat.mcpPrompts",prompt:"chat.prompts",file:"chat.fileCommands",skill:"chat.skills"},u$={builtin:0,extension:1,custom:2,mcp_prompt:3,prompt:4,file:5,skill:6};function uL(e,t,n){let r=e.name.toLowerCase(),i=uP(e,n).toLowerCase();return r===t?0:r.startsWith(t)?1:r.includes(t)?2:i.includes(t)?3:4}function uP(e,t){return"descriptionKey"in e?t(e.descriptionKey):e.description??""}function uA(e,t){return"skill"===e.source&&!!e.name.startsWith("skill:")&&!0===t[e.name.slice(6)]}function u_(e){return{data:e.data,mimeType:e.mimeType}}function uF(e){return{...e,previewUrl:`data:${e.mimeType};base64,${e.data}`}}function uO(e){return(e??[]).filter(nH).slice(0,10).map(uF)}let uz=/^File saved at: (.+)\n\(([^,\n]+), (\d+) bytes\)/,uD="\n\nTranscript of the audio ";function uW(e){return iV(e).map(e=>{let t=iX(e),n="audio"===t&&e.attachmentId&&!e.text.includes(uD)?uz.exec(e.text):null;return{...e,id:++uj,status:"ready",..."audio"===t||"file"===t?{stored:t}:{},...n?{storedInfo:{path:n[1],mimeType:n[2],size:Number(n[3])}}:{}}})}function uH({name:e,mimeType:t,size:n,text:r,attachmentId:i}){return i?{name:e,mimeType:t,size:n,text:r,attachmentId:i}:{name:e,mimeType:t,size:n,text:r}}function uU(e,t){let n=new Map(t.flatMap(e=>e.attachmentId?[[e.attachmentId,e]]:[]));return[...e.map(e=>{let t=e.attachmentId?n.get(e.attachmentId):void 0;return t?(n.delete(e.attachmentId),{...e,id:t.id,sourceSize:t.sourceSize,storedInfo:t.storedInfo??e.storedInfo,transcription:t.transcription}):e}),...t.filter(e=>"ready"!==e.status)]}class uB extends Error{constructor(e,t,n,r,i=null){super(e),this.code=t,this.completedParts=n,this.parts=r,this.offer=i}}let uq="composer:unkeyed";async function uV(e){let t=await e.json().catch(()=>null),n=t&&"object"==typeof t?{...t}:{};if(e.ok)return n;let r="number"==typeof n.completedParts?n.completedParts:null,i="number"==typeof n.parts?n.parts:null,s="fallback_confirmation_required"===n.code&&"string"==typeof n.fallbackToken&&"string"==typeof n.notice&&null!==r&&null!==i?{token:n.fallbackToken,notice:n.notice,completedParts:r,parts:i}:null;throw new uB("string"==typeof n.error?n.error:`HTTP ${e.status}`,"string"==typeof n.code?n.code:null,r,i,s)}function uK(e,t){fetch(`/api/attachments/${encodeURIComponent(e)}/transcription`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({fallbackToken:t,approve:!1})}).catch(()=>void 0)}function uG(e){e.previewUrl.startsWith("blob:")&&URL.revokeObjectURL(e.previewUrl)}function uJ({tone:e,title:t,body:n}){let i="error"===e?"danger":"warning";return(0,r.jsxs)("div",{role:"alert",style:{display:"flex",alignItems:"flex-start",gap:8,maxHeight:120,marginBottom:8,padding:"7px 10px",overflowY:"auto",border:0,borderRadius:"var(--radius-control)",background:`var(--${i}-soft)`,color:`var(--${i})`,fontSize:11,lineHeight:1.45},children:[(0,r.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0,marginTop:1},"aria-hidden":"true",children:[(0,r.jsx)("path",{d:"M10.3 2.9 1.8 17a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 2.9a2 2 0 0 0-3.4 0Z"}),(0,r.jsx)("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),(0,r.jsx)("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),(0,r.jsxs)("div",{style:{minWidth:0},children:[(0,r.jsx)("div",{style:{fontWeight:600},children:t}),(0,r.jsx)("div",{style:{whiteSpace:"pre-wrap",overflowWrap:"anywhere"},children:n})]})]})}function uY({error:e}){return e?(0,r.jsx)(uJ,{tone:"error",title:"Model error",body:e}):null}function uZ({warnings:e}){return e&&0!==e.length?(0,r.jsx)(uJ,{tone:"warning",title:e.length>1?"Model scope warnings":"Model scope warning",body:e.join("\n")}):null}let uQ=(0,i.forwardRef)(function({onSend:e,onAbort:t,onSteer:n,onFollowUp:s,isStreaming:a,model:o,isAutoModelSelection:c,modelNames:d,modelList:u,modelError:h,modelScopeWarnings:p,onModelChange:m,onMainPresetChange:f,mainPresetActiveAlias:g,modelRoles:x,onRoleModelChange:v,modelSwitching:y,onCompact:b,onAbortCompaction:w,isCompacting:k,compactError:j,compactResult:S,toolPreset:C,onToolPresetChange:N,thinkingLevel:T,effectiveThinkingLevel:I,outputTokensPerSecond:M=null,outputSpeedLive:E=!1,thinkingCeiling:R,onThinkingLevelChange:$,availableThinkingLevels:L,thinkingLevelMap:P,fastMode:A=null,fastModeBusy:_=!1,onFastModeToggle:O,retryInfo:z,deliveryRows:D=[],inputHistory:W=[],onRecallQueue:H,onRemoveQueuedMessage:B,slashCommands:q,slashCommandsLoading:V,onLoadSlashCommands:K,onBuiltinCommand:G,soundEnabled:J,onSoundToggle:Y,onAudioUnlock:Z,onPromptWithStreamingBehavior:Q,draftKey:X,cwd:ee,sessionTitle:et,sessionId:en,onEnsureSession:er,onLiveTranscriptPersisted:ei},es){let ea,el,eo,ec,ed,eu,eh,ep,em,ef,{t:eg}=(0,F.s)();iy();let{st:ex}=iw(),ev=D.some(e=>e.removable),ey=U(),[eb,ew]=(0,i.useState)(()=>X?dV(X)?.value??"":""),[ek,ej]=(0,i.useState)(!1),[eS,eC]=(0,i.useState)(null),[eN,eT]=(0,i.useState)(""),[eI,eM]=(0,i.useState)({});(0,i.useEffect)(()=>{ek&&eM(uc())},[ek]);let[eE,eR]=(0,i.useState)(!1);(0,i.useEffect)(()=>{if(ek)try{eR("1"===window.localStorage.getItem(um))}catch{}},[ek]);let e$=()=>{eR(e=>{let t=!e;try{window.localStorage.setItem(um,t?"1":"0")}catch{}return t})},[eL,eP]=(0,i.useState)(!1),[eA,e_]=(0,i.useState)(null),[eF,eO]=(0,i.useState)(!1),[ez,eD]=(0,i.useState)(!1),[eW,eH]=(0,i.useState)(null),[eU,eB]=(0,i.useState)(!1),[eq,eV]=(0,i.useState)(()=>X?uO(dV(X)?.images):[]),[eK,eG]=(0,i.useState)(()=>X?uW(dV(X)?.documents):[]),[eJ,eY]=(0,i.useState)(null),eZ=(0,i.useMemo)(()=>eK.filter(e=>"ready"===e.status),[eK]),eQ=eK.some(e=>"ready"!==e.status||ug(e)),eX=eK.filter(e=>"audio"===e.stored&&e.attachmentId&&e.storedInfo&&(void 0!==e.transcription||!e.text.includes(uD))),e0=eb.trimStart(),e1=0===eq.length&&0===eK.length&&e0.startsWith("!"),e2=e1&&e0.startsWith("!!"),[e8,e4]=(0,i.useState)(!1),[e5,e6]=(0,i.useState)(0),[e3,e7]=(0,i.useState)(null),e9=e3?.value===eb&&e3.draftKey===X?e3.token:null,[te,tt]=(0,i.useState)(!1),[tn,tr]=(0,i.useState)(!1),ti=(0,i.useRef)(null),[ts,ta]=(0,i.useState)(null),[tl,to]=(0,i.useState)(!1),[tc,td]=(0,i.useState)(0),[tu,th]=(0,i.useState)(!1),[tp,tm]=(0,i.useState)(0),[tf,tg]=(0,i.useState)(null),[tx,tv]=(0,i.useState)(!1),[ty,tb]=(0,i.useState)(null),[tw,tk]=(0,i.useState)(null),tj=ee&&tw?.cwd===ee?tw.values:{},tS=(0,i.useRef)(null),tC=(0,i.useRef)(null),tN=(0,i.useRef)(null),tT=(0,i.useRef)(null),tI=(0,i.useRef)(null),tM=(0,i.useRef)(null),tE=(0,i.useRef)(null),tR=(0,i.useRef)(null),t$=(0,i.useRef)(null),tL=(0,i.useRef)(null),tP=(0,i.useRef)(null),tA=(0,i.useRef)(!1),t_=(0,i.useRef)(0),tF=(0,i.useRef)(!1),tO=(0,i.useRef)([]),tz=(0,i.useRef)([]),tD=(0,i.useRef)([]),tW=(0,i.useRef)(null),tH=(0,i.useRef)(null),tU=(0,i.useRef)(X),tB=(0,i.useRef)(eb),tq=(0,i.useRef)(eq),tV=(0,i.useRef)(0),tK=(0,i.useRef)(eK);tB.current=eb,tq.current=eq,tK.current=eK,(0,i.useImperativeHandle)(es,()=>({insertIfEmpty(e){let t=tS.current;(t?t.value:eb).trim()||(tB.current=e,ew(e),ta(null),requestAnimationFrame(()=>{t&&(t.focus(),t.style.height="auto",t.style.height=`${Math.min(t.scrollHeight,200)}px`)}))},replaceMessage(e){let t,n,r=tS.current;if(!function(e,t,n,r=0){return!e.trim()&&0===t&&0===n&&0===r}(r?r.value:eb,tq.current.length,tV.current,tK.current.length))return;let i=(t="string"==typeof e.content?e.content:e.content.filter(e=>"text"===e.type).map(e=>e.text).join("\n"),iJ(t)?.message??t),s=uO("string"==typeof e.content?[]:e.content.flatMap(e=>{if("image"!==e.type)return[];let t=e.source?.type==="base64"?e.source.data:e.data,n=e.source?.type==="base64"?e.source.media_type:e.mimeType;if("string"!=typeof t||"string"!=typeof n)return[];let r={data:t,mimeType:n};return nH(r)?[r]:[]})),a=uW((n="string"==typeof e.content?e.content:e.content.filter(e=>"text"===e.type).map(e=>e.text).join("\n"),iJ(n)?.documents??[]));tB.current=i,tq.current=s,tK.current=a,ew(i),ta(null),th(!1),eV(e=>(e.forEach(uG),s)),eG(a),requestAnimationFrame(()=>{r&&(r.focus(),r.style.height="auto",r.style.height=`${Math.min(r.scrollHeight,200)}px`)})},rekeyDraft(e,t){if(e===t)return;if(tU.current!==e)return void dY(e,t);let n={value:tB.current,images:tq.current.map(u_),documents:tK.current.filter(e=>"ready"===e.status).map(uH)},r=dY(e,t,n)??{value:"",images:[],documents:[]},i=r.value===n.value&&r.images.length===n.images.length&&r.images.every((e,t)=>e.data===n.images[t]?.data&&e.mimeType===n.images[t]?.mimeType)&&r.documents.length===n.documents.length&&r.documents.every((e,t)=>e.name===n.documents[t]?.name&&e.mimeType===n.documents[t]?.mimeType&&e.size===n.documents[t]?.size&&e.text===n.documents[t]?.text&&e.attachmentId===n.documents[t]?.attachmentId);if(tU.current=t,i)return;let s=uO(r.images),a=uU(uW(r.documents),tK.current),l=r.value;tB.current=l,tq.current=s,tK.current=a,ew(l),eV(e=>(e.forEach(uG),s)),eG(a),ta(null),th(!1)},restoreSubmission(e,t,n,r){if(!e.trim()&&!t?.length&&!n?.length)return;let i=tU.current,s=r??i,a=s===i,l=!a&&s?dV(s):null,o=dJ(e,t,a?tB.current:l?.value??"",a?tq.current.map(u_):l?.images??[],n,a?tK.current.filter(e=>"ready"===e.status).map(uH):l?.documents??[]);if(s&&dK(s,o),!a)return;let c=t?.length?[...uO(t).slice(0,Math.max(0,10-tq.current.length)),...tq.current].slice(0,10):tq.current,d=uU(uW(o.documents),tK.current);tB.current=o.value,tq.current=c,tK.current=d,ew(o.value),ta(null),th(!1),t?.length&&eV(e=>{let n=Math.max(0,10-e.length),r=uO(t).slice(0,n),i=r.length>0?[...r,...e]:e;return tq.current=i,i}),eG(d),requestAnimationFrame(()=>{let e=tS.current;e&&(e.focus(),e.setSelectionRange(e.value.length,e.value.length),e.style.height="auto",e.style.height=`${Math.min(e.scrollHeight,200)}px`)})},insertText(e){let t=tS.current;if(!t)return void ew(t=>t+(t?" ":"")+e);let n=t.selectionStart??t.value.length,r=t.selectionEnd??t.value.length,i=t.value.slice(0,n),s=t.value.slice(r),a=i.length>0&&!i.endsWith(" ")?" ":"",l=i+a+e+s;tB.current=l,ew(l),ta(null),requestAnimationFrame(()=>{if(!t)return;let r=n+a.length+e.length;t.setSelectionRange(r,r),t.focus(),t.style.height="auto",t.style.height=`${Math.min(t.scrollHeight,200)}px`})},addAttachments(e){t9(e)}}));let tG=(0,i.useCallback)(async e=>{let t=Math.max(0,10-tq.current.length-tV.current),n=e.filter(e=>e.size>0xa00000);n.length>0&&eY(eg("chat.attachImageTooLarge",{name:n.map(e=>e.name).join(", "),limit:iY(0xa00000)}));let r=e.filter(e=>e.size<=0xa00000),i=r.slice(0,t);if(i.length<r.length&&eY(eg("chat.attachImageLimit",{count:10})),i.length){tV.current+=i.length;try{let e=await Promise.all(i.map(e=>new Promise((t,n)=>{let r=new FileReader;r.onload=()=>{let n=r.result.split(",")[1];t({data:n,mimeType:e.type,previewUrl:URL.createObjectURL(e)})},r.onerror=n,r.readAsDataURL(e)})));eV(t=>{let n=e.slice(0,Math.max(0,10-t.length));e.slice(n.length).forEach(uG);let r=[...t,...n];return tq.current=r,r})}finally{tV.current-=i.length}}},[eg]),tJ=(0,i.useCallback)(async e=>{for(let t of e){let e=iH(t);if(!e)continue;if(tK.current.length>=3){eY(eg("chat.attachLimit",{count:3}));continue}if(t.size>8388608){eY(eg("chat.attachTooLarge",{name:t.name,limit:iY(8388608)}));continue}if(tK.current.reduce((e,t)=>e+t.size,0)+t.size>0x1000000){eY(eg("chat.attachTotalTooLarge",{limit:iY(0x1000000)}));continue}let n={id:++uj,name:t.name,mimeType:iz[e],size:t.size,text:"",status:"extracting"},r=[...tK.current,n];tK.current=r,eG(r);try{let e=await iK(t);if(tK.current.reduce((e,t)=>e+(t.id===n.id?0:t.text.length),0)+e.text.length>24e4)throw new iO("text_too_large","Total extracted text exceeds 240000 characters");let r=tK.current.map(t=>t.id===n.id?{...e,id:t.id,status:"ready"}:t);tK.current=r,eG(r)}catch(i){let e=tK.current.some(e=>e.id===n.id),r=tK.current.filter(e=>e.id!==n.id);if(tK.current=r,eG(r),!e)continue;i instanceof iO?"text_too_large"===i.code?eY(eg("chat.attachTextTooLarge",{name:t.name,limit:12e4.toLocaleString()})):"too_many_pages"===i.code?eY(eg("chat.attachTooManyPages",{name:t.name,limit:250})):"no_extractable_text"===i.code?eY(eg("chat.attachNoPdfText",{name:t.name})):"password_protected"===i.code?eY(eg("chat.attachPasswordProtected",{name:t.name})):eY(eg("chat.attachExtractFailed",{name:t.name})):eY(eg("chat.attachExtractFailed",{name:t.name}))}}},[eg]),tY=(0,i.useCallback)((e,t)=>{if(!tK.current.some(t=>t.id===e))return!1;let n=t?tK.current.map(n=>n.id===e?t:n):tK.current.filter(t=>t.id!==e);return tK.current=n,eG(n),!0},[]),tZ=(0,i.useCallback)((e,t)=>{if(!tK.current.some(t=>t.attachmentId===e))return!1;let n=tK.current.map(n=>n.attachmentId===e?t(n):n);return tK.current=n,eG(n),!0},[]),tQ=(0,i.useCallback)((e,t,n)=>{if(!e||e===tU.current)return;let r=dV(e);r?.documents.some(e=>e.attachmentId===t)&&dK(e,{...r,documents:uW(r.documents).map(e=>e.attachmentId===t?n(e):e).map(uH)})},[]),tX=(0,i.useRef)(new Map),t0=(0,i.useRef)(new Map),t1=(0,i.useRef)(new Set),t2=(0,i.useCallback)((e,t,n)=>{if(!e.storedInfo)return null;let r=Math.min(12e4,24e4-n.reduce((t,n)=>t+(n.attachmentId===e.attachmentId?0:n.text.length),0)),i=i0({...e.storedInfo,transcript:t},r);return i.length>r?null:{...e,text:i,size:new TextEncoder().encode(i).byteLength,transcription:void 0}},[]),t8=(0,i.useCallback)(e=>e instanceof uB&&"media_tool_unavailable"===e.code?eg("chat.transcribeToolMissing"):e instanceof uB&&"fallback_confirmation_expired"===e.code?eg("chat.transcribeFallbackExpired"):e instanceof uB&&"transcription_failed"===e.code&&null!==e.completedParts&&null!==e.parts?eg("chat.transcribePartialFailed",{done:e.completedParts,total:e.parts}):e instanceof Error?e.message:String(e),[eg]),t4=(0,i.useCallback)(async(e,t)=>{let n=tU.current,r=tK.current.find(t=>t.attachmentId===e);if(!r?.storedInfo)return;let i=r.transcription?.state==="confirm"?r.transcription.plan:null;t0.current.get(e)?.abort();let s=new AbortController;t0.current.set(e,s),tZ(e,e=>({...e,transcription:{state:"running",plan:i}}));try{let r=await uV(await fetch(`/api/attachments/${encodeURIComponent(e)}/transcription`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),signal:s.signal}));if("string"!=typeof r.transcript)throw new uB("Invalid transcription result",null,null,null);let i=r.transcript;tZ(e,e=>t2(e,i,tK.current)??{...e,transcription:{state:"failed",error:eg("chat.transcribeTooLong")}})||tQ(n,e,e=>t2(e,i,[])??e)}catch(r){if(s.signal.aborted)return void tZ(e,e=>({...e,transcription:{state:"skipped"}}));if(r instanceof uB&&"confirmation_required"===r.code)return void t5.current?.(e);let t=r instanceof uB?r.offer:null;if(t){let n={state:"fallback",reason:r instanceof Error?r.message:"",...t};tZ(e,e=>({...e,transcription:n}))||uK(e,t.token);return}let n=t8(r);tZ(e,e=>({...e,transcription:{state:"failed",error:n}}))}finally{t0.current.get(e)===s&&t0.current.delete(e)}},[eg,t8,tZ,tQ,t2]),t5=(0,i.useRef)(null),t6=(0,i.useCallback)(async e=>{let t;t0.current.get(e)?.abort();let n=new AbortController;t0.current.set(e,n),tZ(e,e=>({...e,transcription:{state:"planning"}}));try{t=function(e){if("boolean"!=typeof e.requiresConfirmation||"number"!=typeof e.estimatedCalls||"string"!=typeof e.notice||null!==e.durationSeconds&&"number"!=typeof e.durationSeconds||"direct"!==e.processing&&"compress-and-split"!==e.processing)throw new uB("Invalid transcription plan",null,null,null);return{durationSeconds:e.durationSeconds,estimatedCalls:e.estimatedCalls,requiresConfirmation:e.requiresConfirmation,processing:e.processing,notice:e.notice}}(await uV(await fetch(`/api/attachments/${encodeURIComponent(e)}/transcription`,{cache:"no-store",signal:n.signal})))}catch(t){if(n.signal.aborted)tZ(e,e=>({...e,transcription:{state:"skipped"}}));else{let n=t8(t);tZ(e,e=>({...e,transcription:{state:"failed",error:n}}))}return}finally{t0.current.get(e)===n&&t0.current.delete(e)}t.requiresConfirmation?tZ(e,e=>({...e,transcription:{state:"confirm",plan:t}})):await t4(e,{})},[t4,t8,tZ]);t5.current=t6;let t3=(0,i.useCallback)(e=>{let t=t0.current.get(e);if(t)return void t.abort();let n=tK.current.find(t=>t.attachmentId===e)?.transcription;n?.state==="fallback"&&uK(e,n.token),tZ(e,e=>({...e,transcription:{state:"skipped"}}))},[tZ]),t7=(0,i.useCallback)(async(e,t)=>{let n=null;for(let r of e){if(tK.current.length>=3){eY(eg("chat.attachLimit",{count:3}));continue}let e="file"===t&&r.size<=8388608,i={id:++uj,name:r.name,mimeType:"text/plain",size:e?r.size:0,text:"",status:e?"extracting":"uploading",sourceSize:r.size},s=[...tK.current,i];tK.current=s,eG(s);let a=(e,t)=>{let n=tK.current.filter(e=>e.id!==i.id);return e<=12e4&&n.reduce((e,t)=>e+t.text.length,0)+e<=24e4&&n.reduce((e,t)=>e+t.size,0)+t<=0x1000000};if(e){let e=await r.arrayBuffer().then(e=>{var t;return 255===(t=new Uint8Array(e))[0]&&254===t[1]?iq("utf-16le",t.subarray(2)):254===t[0]&&255===t[1]?iq("utf-16be",t.subarray(2)):t.includes(0)?null:iq("utf-8",t)??iq("euc-kr",t)},()=>null);if(null!==e&&a(e.length,r.size)){tY(i.id,{...i,text:e,status:"ready"});continue}}if(null===n&&(n=1048576*(await ut().catch(()=>d7)).uploadLimitMb),r.size>n){tY(i.id,null)&&eY(eg("chat.attachStoredTooLarge",{name:r.name,limit:iY(n)}));continue}let l={...i,stored:t,status:"uploading",size:0};if(!tY(i.id,l))continue;let o=tU.current??uq,c=await d0(o),d=null,u=new AbortController;tX.current.set(i.id,u);try{if(t1.current.has(i.id))continue;let e=await i1(r,{sessionId:en,draftId:c.draftId,signal:u.signal}),n=tK.current.filter(e=>e.id!==i.id).reduce((e,t)=>e+t.text.length,0),s=i0({path:e.path,size:e.size,mimeType:e.mimeType},Math.min(12e4,24e4-n)),h=new TextEncoder().encode(s).byteLength;if(!a(s.length,h)){tY(i.id,null)&&eY(eg("chat.attachTotalTooLarge",{limit:iY(0x1000000)}));continue}let p={...l,attachmentId:e.id,text:s,size:h,status:"ready",storedInfo:{path:e.path,size:e.size,mimeType:e.mimeType},..."audio"===t?{transcription:{state:"planning"}}:{}};if(tY(i.id,p))d=e.id;else if(!t1.current.has(i.id)&&o!==tU.current){let t=dV(o)??{value:"",images:[],documents:[]};dK(o,{...t,documents:[...t.documents,uH(p)]}),d=e.id}}catch(e){if(u.signal.aborted)continue;tY(i.id,null)&&eY(eg("chat.attachUploadFailed",{name:r.name,error:e instanceof Error?e.message:String(e)}))}finally{tX.current.delete(i.id),c.end(d)}d&&"audio"===t&&tK.current.some(e=>e.attachmentId===d)&&t6(d)}},[tY,t6,en,eg]),t9=(0,i.useCallback)(async e=>{eY(null);let{images:t,documents:n,audio:r,files:i}=function(e){let t=[],n=[],r=[],i=[];for(let s of e)s.type.startsWith("image/")?t.push(s):null!==iH(s)?n.push(s):iB(s)?r.push(s):i.push(s);return{images:t,documents:n,audio:r,files:i}}(e),s=n.filter(e=>e.size>8388608);await Promise.all([tG(t),tJ(n.filter(e=>e.size<=8388608)),t7(r,"audio"),t7([...i,...s],"file")])},[tJ,t7,tG]),ne=(0,i.useCallback)(e=>{eV(t=>{let n=[...t],[r]=n.splice(e,1);return r&&uG(r),tq.current=n,n})},[]),nt=(0,i.useCallback)(e=>{let t=tK.current.find(t=>t.id===e);if(t1.current.add(e),tX.current.get(e)?.abort(),t?.attachmentId){t0.current.get(t.attachmentId)?.abort(),t.transcription?.state==="fallback"&&uK(t.attachmentId,t.transcription.token);var n=t.attachmentId;for(let[e,t]of dA)t.delete(n)&&(0===t.size&&dA.delete(e),d6())}let r=tK.current.filter(t=>t.id!==e);tK.current=r,eG(r)},[]),nn=(0,i.useCallback)(()=>{tq.current=[],eV(e=>(e.forEach(uG),[]))},[]),nr=(0,i.useCallback)(()=>{tK.current=[],eG([])},[]),ni=(0,i.useCallback)(()=>{tB.current="",ew(""),ta(null),e7(null),tt(!1),th(!1),X&&dG(X),tU.current&&tU.current!==X&&dG(tU.current),nn(),nr(),eY(null),tS.current&&(tS.current.style.height="auto")},[nr,nn,X]);(0,i.useEffect)(()=>{X&&tU.current===X&&dK(X,{value:eb,images:eq.map(u_),documents:eZ.map(uH)})},[eq,X,eZ,eb]),(0,i.useEffect)(()=>{let e=tU.current;if(e===X)return;e&&dK(e,{value:tB.current,images:tq.current.map(u_),documents:tK.current.filter(e=>"ready"===e.status).map(uH)});let t=X?dV(X):null;tU.current=X;let n=t?.value??"",r=uO(t?.images),i=uW(t?.documents);tB.current=n,tq.current=r,tK.current=i,ew(n),ta(null),th(!1),eV(e=>(e.forEach(uG),r)),eG(i)},[X]),(0,i.useEffect)(()=>{let e=tS.current;e&&(e.style.height="auto",eb&&(e.style.height=`${Math.min(e.scrollHeight,200)}px`))},[eb]),(0,i.useEffect)(()=>()=>{tq.current.forEach(uG)},[]);let ns=(0,i.useCallback)((e,t)=>{let n=function(e,t){let n=dZ(t);if(0===n.length)return()=>{};let r=++dL;return d$.set(r,{draftId:dQ(e),ids:n}),e=>{if("accepted"!==e&&"returned"!==e)return;let t=d$.get(r);if(t){if(d$.delete(r),"accepted"===e){let e=d_.get(t.draftId)??new Set;for(let n of t.ids)e.add(n);d_.set(t.draftId,e)}d6()}}}(tU.current??uq,e);Promise.resolve(t()).then(e=>n("accepted"===e||"returned"===e?e:void 0),()=>void 0)},[]),na=(0,i.useCallback)(async()=>{let t=eb.trim(),n=e0.trim(),r=n.startsWith("/")||n.startsWith("!")?n:t;if(!r&&!eq.length&&!eZ.length||a||eQ)return;Z?.();let i=eq.length?eq:void 0,s=eZ.length?eZ:void 0;if(r.startsWith("/")){await uf(r,q,G,t=>ns(s,()=>e(t,i,s)),eY,!!(i||s),K)&&ni();return}ni(),ns(s,()=>e(r,i,s))},[eb,e0,eq,eZ,eQ,a,G,q,K,e,ni,Z,ns]),nl=!e0.startsWith("/")||e0.startsWith("//")||/\s/.test(e0.slice(1))?null:e0.slice(1).toLowerCase(),no=(()=>{if(null===nl)return[];let e=[...a?[]:uM,...q??[]],t=new Set;return[...e].filter(e=>{let t=e.name.toLowerCase(),n=uP(e,eg).toLowerCase();return t.includes(nl)||n.includes(nl)}).sort((e,t)=>{let n=uL(e,nl,eg)-uL(t,nl,eg);return 0!==n?n:u$[e.source]-u$[t.source]||uk.compare(e.name,t.name)}).filter(e=>{let n=e.name.toLowerCase();return!t.has(n)&&(t.add(n),!0)})})(),{commands:nc,groups:nd}=(ea=0,{commands:(el=uE.map(e=>{let t=no.filter(t=>t.source===e),n="skill"===e?[...t.filter(e=>!uA(e,tj)),...t.filter(e=>uA(e,tj))]:t;return{source:e,items:n.map(e=>({command:e,index:ea++}))}}).filter(e=>e.items.length>0)).flatMap(e=>e.items.map(({command:e})=>e)),groups:el}),nu=1===no.length?eg(nl?"chat.match":"chat.command"):eg(nl?"chat.matches":"chat.commands",{count:no.length}),nh=!!eb.trim(),np=!eQ&&(nh||eq.length>0||eZ.length>0),nm=(0,i.useCallback)((e,t)=>{let n=function(e,t){let n=Math.max(0,Math.min(e.length,t)),r=/(?:^|\s)(\/\/[^\s]*)$/.exec(e.slice(0,n));if(!r)return null;let i=n-r[1].length,s=/^\S*/.exec(e.slice(n))[0];return{start:i,end:n+s.length,query:e.slice(i+2,n)}}(e,t??e.length);if(e7(n?{value:e,draftKey:X,token:n}:null),tr(!1),!ee)return void ta(null);let r=t??e.length;ta(ur(e.slice(0,r)))},[ee,X]),nf=ts?.query??null,ng=i.useMemo(()=>null!==nf&&tf&&tf.cwd===ee?function(e,t,n=20){let r=t.toLowerCase();if(!r)return e.slice(0,n);let i=[];for(let t of e){let e=function(e,t){let n=e.path.toLowerCase(),r=0;if(t.includes("/"))n===t?r=100:n.startsWith(t)?r=80:n.includes(t)?r=50:us(t,n)&&(r=10);else{let e=n.lastIndexOf("/"),i=-1===e?n:n.slice(e+1);i===t?r=100:i.startsWith(t)?r=80:i.includes(t)?r=50:n.includes(t)?r=30:us(t,n)&&(r=10)}return e.isDir&&r>0&&(r+=10),r}(t,r);e>0&&i.push({entry:t,score:e})}return i.sort((e,t)=>t.score-e.score||ui(e.entry.path)-ui(t.entry.path)||e.entry.path.localeCompare(t.entry.path)),i.slice(0,n).map(e=>e.entry)}(tf.entries,nf):[],[nf,tf,ee]),nx=!!(nf&&tf?.truncated&&tf.cwd===ee);(0,i.useEffect)(()=>{if(!nx||!ee||!nf)return;let e=setTimeout(()=>{fetch(`/api/file-index?cwd=${encodeURIComponent(ee)}&q=${encodeURIComponent(nf)}`).then(e=>{if(!e.ok)throw Error(`file search failed: ${e.status}`);return e.json()}).then(e=>tb({cwd:ee,query:nf,matches:e.matches??[]})).catch(()=>{})},150);return()=>clearTimeout(e)},[nx,nf,ee]);let nv=nx&&null!==ty&&ty.cwd===ee&&ty.query===nf,ny=nv?ty.matches:ng,nb=null===ts?null:`${ts.start}:${+!!ts.quoted}:${ts.query}`;(0,i.useEffect)(()=>{if(null===nb){to(!1),td(0);return}to(!0),td(0)},[nb]);let nw=null!==ts,nk=uh(tL,tu,{viewportFraction:.44,cap:360}),nj=uh(tL,e8,{viewportFraction:.56,cap:460}),nS=uh(tL,tl,{viewportFraction:.48,cap:400}),nC=uh(tL,te,{viewportFraction:.48,cap:400}),nN=e9?`${e9.start}:${e9.end}:${e9.query}`:null;(0,i.useEffect)(()=>{tt(null!==nN)},[nN]);let nT=(0,i.useCallback)((e,t,n,r=!1)=>{tB.current===e&&tU.current===X&&(tB.current=t,ew(t),e7(null),tt(!1),tr(r),requestAnimationFrame(()=>{let e=tS.current;e&&(e.focus(),e.setSelectionRange(n,n),e.style.height="auto",e.style.height=`${Math.min(e.scrollHeight,200)}px`)}))},[X]);(0,i.useEffect)(()=>{if(!nw||!ee)return;let e=tW.current;e&&e.cwd===ee&&Date.now()-e.fetchedAt<1e4||tH.current===ee||(tH.current=ee,tv(!0),fetch(`/api/file-index?cwd=${encodeURIComponent(ee)}`).then(e=>{if(!e.ok)throw Error(`file index failed: ${e.status}`);return e.json()}).then(e=>{tg({cwd:ee,entries:function(e){let t=new Set;for(let n of e){let e=n.indexOf("/");for(;-1!==e;)t.add(n.slice(0,e)),e=n.indexOf("/",e+1)}let n=[];for(let e of t)n.push({path:e,isDir:!0});for(let t of e)t&&n.push({path:t,isDir:!1});return n.sort((e,t)=>ui(e.path)-ui(t.path)||e.path.localeCompare(t.path)),n}(e.files??[]),truncated:!!e.truncated}),tW.current={cwd:ee,fetchedAt:Date.now()}}).catch(()=>{tW.current=null}).finally(()=>{tH.current=null,tv(!1)}))},[nw,ee]);let nI=(0,i.useCallback)(e=>{if(!ts)return;let t=tS.current,n=t?.selectionStart??eb.length,r=eb.slice(0,ts.start),i=eb.slice(n);ts.quoted&&i.startsWith('"')&&(i=i.slice(1));let s=function(e,t,n=!1){let r=t?`${e}/`:e,i=n||r.includes(" ");if(t){let e=i?`@"${r}"`:`@${r}`;return{text:e,cursorOffset:i?e.length-1:e.length}}let s=i?`@"${r}" `:`@${r} `;return{text:s,cursorOffset:s.length}}(e.path,e.isDir,ts.quoted),a=r+s.text+i,l=r.length+s.cursorOffset;ew(a),ta(ur(a.slice(0,l))),requestAnimationFrame(()=>{let e=tS.current;e&&(e.focus(),e.setSelectionRange(l,l),e.style.height="auto",e.style.height=`${Math.min(e.scrollHeight,200)}px`)})},[ts,eb]);(0,i.useEffect)(()=>{tc>=ny.length&&td(Math.max(0,ny.length-1))},[ny.length,tc]),(0,i.useEffect)(()=>{tz.current.length=ny.length},[ny.length]),(0,i.useEffect)(()=>{tl&&tz.current[tc]?.scrollIntoView({block:"nearest",inline:"nearest"})},[tc,tl]),(0,i.useEffect)(()=>{tp>=W.length&&tm(Math.max(0,W.length-1))},[W.length,tp]),(0,i.useEffect)(()=>{tD.current.length=W.length},[W.length]),(0,i.useEffect)(()=>{tu&&tD.current[tp]?.scrollIntoView({block:"nearest",inline:"nearest"})},[tp,tu]);let nM=(0,i.useCallback)(e=>{tB.current=e,ew(e),th(!1),tm(0),ta(null),requestAnimationFrame(()=>{let t=tS.current;t&&(t.focus(),t.setSelectionRange(e.length,e.length),t.style.height="auto",t.style.height=`${Math.min(t.scrollHeight,200)}px`)})},[]),nE=(0,i.useCallback)(e=>{let t=`/${e.name} `;tB.current=t,ew(t),e4(!1),e6(0),requestAnimationFrame(()=>{let e=tS.current;e&&(e.focus(),e.setSelectionRange(t.length,t.length),e.style.height="auto",e.style.height=`${Math.min(e.scrollHeight,200)}px`)})},[]),nR=(0,i.useCallback)(async e=>{let t=eb.trim(),r=e0.trim(),i=r.startsWith("/")||r.startsWith("!")?r:t,a=eQ||!i&&0===eq.length&&0===eZ.length?null:{message:i,images:eq.length?eq:void 0,documents:eZ.length?eZ:void 0};if(!a)return;Z?.();let l="steer"===e?"steer":"followUp";if(i.startsWith("/")){await uf(i,q,G,e=>{if(!Q)throw Error("Cannot queue this command while the session is busy.");ns(a.documents,()=>Q(e,l,a.images,a.documents))},eY,!!(a.images?.length||a.documents?.length),K)&&ni();return}ni(),"steer"===e&&n?ns(a.documents,()=>n(a.message,a.images,a.documents)):"followup"===e&&s&&ns(a.documents,()=>s(a.message,a.images,a.documents))},[eb,e0,eq,eZ,eQ,q,K,G,Q,n,s,ni,Z,ns]),n$=(0,i.useCallback)(e=>{let t=nc.length-1;if(t<0)return 0;if("left"===e)return Math.max(0,e5-1);if("right"===e)return Math.min(t,e5+1);let n=tO.current[e5];if(!n)return"down"===e?Math.min(t,e5+1):Math.max(0,e5-1);let r=n.getBoundingClientRect(),i=r.left+r.width/2,s=r.top+r.height/2,a=-1,l=1/0;for(let n=0;n<=t;n+=1){if(n===e5)continue;let t=tO.current[n];if(!t)continue;let r=t.getBoundingClientRect(),o=r.top+r.height/2-s;if("down"===e?o<=4:o>=-4)continue;let c=1e3*Math.abs(o)+Math.abs(r.left+r.width/2-i);c<l&&(a=n,l=c)}return a>=0?a:"down"===e?Math.min(t,e5+1):Math.max(0,e5-1)},[nc.length,e5]),nL=(0,i.useCallback)(e=>{let r=e.nativeEvent,i=Date.now()-t_.current<100,l=tA.current||r.isComposing||229===r.keyCode;if("Enter"===e.key&&!e.shiftKey&&(l||i)){i&&e.preventDefault();return}if(tu&&!l){if("ArrowDown"===e.key){e.preventDefault(),tm(e=>Math.min(Math.max(0,W.length-1),e+1));return}if("ArrowUp"===e.key){e.preventDefault(),tm(e=>Math.max(0,e-1));return}if("Escape"===e.key){e.preventDefault(),th(!1);return}if(("Tab"===e.key||"Enter"===e.key&&!e.shiftKey)&&W[tp]){e.preventDefault(),nM(W[tp]);return}}if(!(te&&e9&&!l&&ti.current?.handleKeyDown(e))){if(e8&&null!==nl){if("ArrowDown"===e.key){e.preventDefault(),e6(n$("down"));return}if("ArrowUp"===e.key){e.preventDefault(),e6(n$("up"));return}if("ArrowRight"===e.key){e.preventDefault(),e6(n$("right"));return}if("ArrowLeft"===e.key){e.preventDefault(),e6(n$("left"));return}if("Escape"===e.key){e.preventDefault(),e4(!1);return}if(("Tab"===e.key||"Enter"===e.key&&!e.shiftKey)&&nc[e5]){e.preventDefault(),nE(nc[e5]);return}}if(tl&&null!==ts&&!l){if("ArrowDown"===e.key){e.preventDefault(),td(e=>Math.min(Math.max(0,ny.length-1),e+1));return}if("ArrowUp"===e.key){e.preventDefault(),td(e=>Math.max(0,e-1));return}if("Escape"===e.key){e.preventDefault(),to(!1);return}if(("Tab"===e.key||"Enter"===e.key&&!e.shiftKey)&&ny[tc]){e.preventDefault(),nI(ny[tc]);return}}if("ArrowUp"===e.key&&!l&&!a&&W.length>0&&0===eb.trim().length){e.preventDefault(),e4(!1),to(!1),tm(W.length-1),th(!0);return}if("Escape"===e.key&&!l&&a&&t){e.preventDefault(),t();return}"Enter"!==e.key||e.shiftKey||(e.preventDefault(),a&&(n||s)?nR(n?"steer":"followup"):na())}},[a,n,s,t,e8,nl,nc,e5,nE,nR,na,n$,tl,ts,ny,tc,nI,tu,W,tp,nM,eb,te,e9]),nP=(0,i.useCallback)(()=>{let e=tS.current;e&&(e.style.height="auto",e.style.height=`${Math.min(e.scrollHeight,200)}px`)},[]),nA=(0,i.useCallback)(e=>{let t=function(e){let t=Array.from(e.files??[]);if(t.length>0)return t;let n=[];for(let t of Array.from(e.items??[])){if("file"!==t.kind)continue;let e=t.getAsFile();e&&n.push(e)}return n}(e.clipboardData);t.length&&(e.preventDefault(),t9(t))},[t9]);(0,i.useEffect)(()=>{if(null===nl){e4(!1),e6(0),tF.current=!1;return}e4(!0),e6(0),!tF.current&&K&&(tF.current=!0,Promise.resolve(K()).catch(()=>{tF.current=!1}))},[nl,K]),(0,i.useEffect)(()=>{if(!e8||!ee)return;let e=!1;return tk({cwd:ee,values:{}}),fetch(`/api/skills?cwd=${encodeURIComponent(ee)}`).then(e=>{if(!e.ok)throw Error(`skills fetch failed: ${e.status}`);return e.json()}).then(t=>{if(e)return;let n={};for(let e of t.skills??[])n[e.name]=e.disableModelInvocation;tk({cwd:ee,values:n})}).catch(()=>{e||tk({cwd:ee,values:{}})}),()=>{e=!0}},[e8,ee]),(0,i.useEffect)(()=>{e5>=nc.length&&e6(Math.max(0,nc.length-1))},[nc.length,e5]),(0,i.useEffect)(()=>{tO.current.length=nc.length},[nc.length]),(0,i.useEffect)(()=>{e8&&tO.current[e5]?.scrollIntoView({block:"nearest",inline:"nearest"})},[e5,e8]);let n_=u&&u.length>0?u.map(e=>({provider:e.provider,modelId:e.id,name:e.name})).sort(uC):Object.entries(d??{}).map(([e,t])=>({provider:o?.provider??"unknown",modelId:e,name:t})).sort(uC),nF=g??null,nO=rg.find(e=>e.alias===nF)?.provider??null,nz=nO?n_.filter(e=>e.provider===nO):n_,nD=(eo=eN.trim().toLocaleLowerCase())?nz.filter(e=>`${e.name} ${e.modelId}`.toLocaleLowerCase().includes(eo)):nz,nW=nz.length>8,nU=[];for(let e of nD){let t=nU.find(t=>t.provider===e.provider);t?t.options.push(e):nU.push({provider:e.provider,options:[e]})}let nB=nO?[]:(x??[]).filter(e=>!e.hidden&&e.resolved),nq=o?nB.find(e=>e.resolved?.provider===o.provider&&e.resolved?.modelId===o.modelId):void 0,nK=eN.trim()?[]:nz.map((e,t)=>{var n,r;return{option:e,order:t,count:eI[n=e.provider,r=e.modelId,`${n}/${r}`]??0}}).filter(e=>e.count>=2).sort((e,t)=>t.count-e.count||e.order-t.order).slice(0,5).map(({option:e,count:t})=>({option:e,count:t})),nG=(e,t,n)=>{let i=e.modelId===o?.modelId&&e.provider===o?.provider;return(0,r.jsxs)("button",{onClick:()=>{if(ej(!1),eT(""),!i||c){var t,n;let r=function(e,t){let n={...e,[t]:(e[t]??0)+1},r=Object.keys(n);if(r.length<=30)return n;for(let e of(r.sort((e,t)=>n[e]-n[t]),r)){if(Object.keys(n).length<=30)break;e!==t&&delete n[e]}return n}(uc(),(t=e.provider,n=e.modelId,`${t}/${n}`));try{window.localStorage.setItem(uo,JSON.stringify(r))}catch{}eM(r),m?.(e.provider,e.modelId)}},style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"7px 12px",background:i?"var(--bg-selected)":"none",border:"none",color:i?"var(--text)":"var(--text-muted)",cursor:"pointer",fontSize:12,textAlign:"left",fontWeight:i?600:400,whiteSpace:"nowrap"},onMouseEnter:e=>{i||(e.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:e=>{i||(e.currentTarget.style.background="none")},children:[i?(0,r.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:(0,r.jsx)("polyline",{points:"1.5 5 4 7.5 8.5 2.5"})}):(0,r.jsx)("span",{style:{width:10,flexShrink:0}}),e.name,void 0!==n&&n>=2&&(0,r.jsx)("span",{style:{marginLeft:"auto",paddingLeft:12,color:"var(--text-dim)",fontFamily:"var(--font-mono)",fontSize:10.5},children:eg("chat.modelPickCount",{count:n})})]},`${t}:${e.provider}:${e.modelId}`)},nJ=o?n_.find(e=>e.modelId===o.modelId&&e.provider===o.provider)?.name??o.modelId:null,nY=S?Math.max(0,S.tokensBefore-S.estimatedTokensAfter):0,nZ=S?`${S.reason&&"manual"!==S.reason?`${S.reason[0].toUpperCase()}${S.reason.slice(1)} `:eg("chat.compacted")} ${nV(S.tokensBefore)} -> ${nV(S.estimatedTokensAfter)} tokens (${eg("chat.tokensSaved",{saved:nV(nY)})})`:null,nQ=e=>{let t=P?.[e];return null!=t&&t!==e?t:null},nX="auto"===(ec=T??"auto")?R?`auto ≤ ${nQ(R)??R}`:"auto":P?P[ec]??ec:ec,n0=(T??"auto")==="auto"&&I&&"auto"!==I?P?.[I]??I:null,n1=$&&n0?eg("chat.currentReasoning",{level:n0}):null,n2=e=>!L||L.includes(e),n8=[{level:"auto",ceiling:null},...uT.filter(n2).map(e=>({level:"auto",ceiling:e})),...uN.filter(e=>"auto"!==e&&n2(e)).map(e=>({level:e,ceiling:null}))],n4=Object.entries(uv).find(([,e])=>e===(C??"default"))?.[0]??"default";(0,i.useEffect)(()=>{let e=e=>{tC.current&&!tC.current.contains(e.target)&&tN.current&&!tN.current.contains(e.target)&&(ej(!1),eT("")),tT.current&&!tT.current.contains(e.target)&&tI.current&&!tI.current.contains(e.target)&&eP(!1),tM.current&&!tM.current.contains(e.target)&&eO(!1),tE.current&&!tE.current.contains(e.target)&&eD(!1),tR.current&&!tR.current.contains(e.target)&&eB(!1),!t$.current||t$.current.contains(e.target)||tS.current?.contains(e.target)||th(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),(0,i.useEffect)(()=>{ey||eB(!1)},[ey]);let n5=(0,r.jsx)("button",{type:"button",className:`composer-icon-button${eq.length||eK.length?" is-active":""}`,onClick:()=>tP.current?.click(),title:eg("chat.attachFile"),"aria-label":eg("chat.attachFile"),style:{flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",width:32,height:32,padding:0,background:"none",border:"none",borderRadius:"var(--radius-control)",color:eq.length||eK.length?"var(--accent)":"var(--text-muted)",cursor:"pointer",opacity:1,transition:"background 0.12s, color 0.12s"},onMouseEnter:e=>{e.currentTarget.style.background="var(--bg-hover)",e.currentTarget.style.color=eq.length||eK.length?"var(--accent)":"var(--text)"},onMouseLeave:e=>{e.currentTarget.style.background="none",e.currentTarget.style.color=eq.length||eK.length?"var(--accent)":"var(--text-muted)"},children:(0,r.jsxs)("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),(0,r.jsx)("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),(0,r.jsx)("polyline",{points:"21 15 16 10 5 21"})]})}),n6=f&&rg.length>0?(0,r.jsxs)("div",{ref:tT,style:{position:"relative",flexShrink:+!!ey,minWidth:0},children:[(0,r.jsxs)("button",{className:`${ey?"composer-icon-button":"composer-chip"}${eL?" is-active":""}`,onClick:e=>{let t=e.currentTarget.getBoundingClientRect();e_({top:t.top,bottom:t.bottom,left:t.left,width:t.width}),ej(!1),eT(""),eP(e=>!e)},disabled:a||y,"aria-haspopup":"menu","aria-expanded":eL,onKeyDown:e=>{"Escape"===e.key&&eL&&(e.stopPropagation(),eP(!1))},style:{display:"flex",alignItems:"center",gap:6,maxWidth:"100%",padding:"4px 8px",background:eL?"var(--bg-hover)":"none",border:"none",borderRadius:"var(--radius-control)",color:"var(--text-muted)",cursor:a||y?"not-allowed":"pointer",fontSize:12,opacity:a?.5:1,transition:"background 0.12s, color 0.12s"},onMouseEnter:e=>{a||y||(e.currentTarget.style.background="var(--bg-hover)",e.currentTarget.style.color="var(--text)")},onMouseLeave:e=>{e.currentTarget.style.background=eL?"var(--bg-hover)":"none",e.currentTarget.style.color="var(--text-muted)"},title:eg("chat.mainPreset"),"aria-label":eg("chat.mainPreset"),children:[(0,r.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},"aria-hidden":"true",children:(0,r.jsx)("path",{d:"M12 3l2.2 5.1 5.6.5-4.2 3.7 1.2 5.5L12 15l-4.8 2.8 1.2-5.5L4.2 8.6l5.6-.5z"})}),ey?null:(0,r.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},children:eg("chat.mainPreset")})]}),eL&&eA&&(()=>{let e=window.visualViewport?.height??window.innerHeight,{side:t,maxHeight:n}=ud(eA.top,eA.bottom,e,uu(e,.6,460),{gap:6,prefer:"above"}),i="above"===t?{bottom:e-eA.top+6}:{top:eA.bottom+6},s=ey?{left:8,right:8,maxWidth:"calc(100vw - 16px)"}:{left:eA.left,width:"max-content",minWidth:eA.width};return(0,r.jsx)("div",{ref:tI,role:"menu","aria-label":eg("chat.mainPreset"),onKeyDown:e=>{"Escape"===e.key&&(eP(!1),tT.current?.querySelector("button")?.focus())},style:{position:"fixed",...i,...s,zIndex:500,background:"var(--bg-raised)",border:0,borderRadius:"var(--radius-surface)",boxShadow:"var(--seed-shadow-s2)",overflow:"hidden",maxHeight:n,display:"flex",flexDirection:"column"},children:(0,r.jsx)("div",{style:{minHeight:0,overflowY:"auto"},children:rg.map(e=>{let t=e.alias===nF;return(0,r.jsxs)("button",{role:"menuitemradio","aria-checked":t,onClick:()=>{eP(!1),f({alias:e.alias,provider:e.provider,modelId:e.model,...void 0!==e.oauthPosition?{oauthPosition:e.oauthPosition}:{}})},title:`${e.provider}/${e.model}`,style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"7px 12px",background:t?"var(--bg-selected)":"none",border:"none",color:t?"var(--text)":"var(--text-muted)",cursor:"pointer",fontSize:12,textAlign:"left",fontWeight:t?600:400,whiteSpace:"nowrap"},onMouseEnter:e=>{t||(e.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:e=>{t||(e.currentTarget.style.background="none")},children:[t?(0,r.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:(0,r.jsx)("polyline",{points:"1.5 5 4 7.5 8.5 2.5"})}):(0,r.jsx)("span",{style:{width:10,flexShrink:0}}),(0,r.jsx)("img",{className:"account-avatar",src:rV(e.seed),width:20,height:20,alt:"","aria-hidden":"true",draggable:!1}),(0,r.jsx)("span",{children:r_(e.alias)}),(0,r.jsxs)("span",{style:{marginLeft:"auto",paddingLeft:12,color:"var(--text-dim)",fontSize:11,overflow:"hidden",textOverflow:"ellipsis"},children:[e.provider,"/",e.model,void 0!==e.oauthPosition?` \xb7 OAuth ${e.oauthPosition}`:""]})]},e.alias)})})})})()]}):null,n3=$?(0,r.jsxs)("div",{ref:tE,style:{position:"relative",flexShrink:0,minWidth:0},children:[(0,r.jsxs)("button",{type:"button",className:`${ey?"composer-icon-button":"composer-chip"}${ez?" is-active":""}`,onClick:e=>{let t=e.currentTarget.getBoundingClientRect();eH({top:t.top,bottom:t.bottom,left:t.left,width:t.width}),ej(!1),eT(""),eP(!1),eD(e=>!e)},disabled:a||y,"aria-haspopup":"menu","aria-expanded":ez,onKeyDown:e=>{"Escape"===e.key&&ez&&(e.stopPropagation(),eD(!1))},title:eg("chat.changeReasoning",{level:nX}),"aria-label":eg("chat.changeReasoning",{level:nX}),style:{display:"flex",alignItems:"center",justifyContent:"center",gap:5,padding:ey?0:"8px 12px",height:32,background:ez?"var(--bg-hover)":"none",border:"none",borderRadius:"var(--radius-control)",color:"var(--text-muted)",cursor:a||y?"not-allowed":"pointer",fontSize:12,opacity:a?.5:1,transition:"background 0.12s, color 0.12s"},onMouseEnter:e=>{a||y||(e.currentTarget.style.background="var(--bg-hover)",e.currentTarget.style.color="var(--text)")},onMouseLeave:e=>{e.currentTarget.style.background=ez?"var(--bg-hover)":"none",e.currentTarget.style.color="var(--text-muted)"},children:[(0,r.jsxs)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},"aria-hidden":"true",children:[(0,r.jsx)("path",{d:"M9.5 2A5.5 5.5 0 0 0 4 7.5c0 1.7.78 3.21 2 4.21V14a1 1 0 0 0 1 1h5a1 1 0 0 0 1-1v-2.29c1.22-1 2-2.51 2-4.21A5.5 5.5 0 0 0 9.5 2z"}),(0,r.jsx)("line",{x1:"7",y1:"18",x2:"12",y2:"18"}),(0,r.jsx)("line",{x1:"8",y1:"21",x2:"11",y2:"21"})]}),ey?null:(0,r.jsx)("span",{style:{whiteSpace:"nowrap"},children:nX})]}),ez&&eW&&(()=>{let e=window.visualViewport?.height??window.innerHeight,{side:t,maxHeight:n}=ud(eW.top,eW.bottom,e,uu(e,.6,460),{gap:6,prefer:"above"}),i="above"===t?{bottom:e-eW.top+6}:{top:eW.bottom+6},s=ey?{left:8,right:8,maxWidth:"calc(100vw - 16px)"}:{left:eW.left,width:"max-content",minWidth:Math.max(180,eW.width)};return(0,r.jsx)("div",{role:"menu","aria-label":eg("chat.changeReasoningLabel"),onKeyDown:e=>{"Escape"===e.key&&(eD(!1),tE.current?.querySelector("button")?.focus())},style:{position:"fixed",...i,...s,zIndex:500,background:"var(--bg-raised)",border:0,borderRadius:"var(--radius-surface)",boxShadow:"var(--seed-shadow-s2)",overflowY:"auto",maxHeight:n},children:n8.map(({level:e,ceiling:t})=>{let n=(T??"auto")===e&&("auto"!==e||(R??null)===t),i=t??e,s="auto"===e&&null===t?null:nQ(i),a=t?`auto ≤ ${s??t}`:s??e,l=t?eg("chat.thinkingAutoCapped",{level:s??t}):eg(uI[e]);return(0,r.jsxs)("button",{type:"button",role:"menuitemradio","aria-checked":n,onClick:()=>{eD(!1),$(e,t)},style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"7px 12px",background:n?"var(--bg-selected)":"none",border:"none",color:n?"var(--text)":"var(--text-muted)",cursor:"pointer",fontSize:12,textAlign:"left",fontWeight:n?600:400,whiteSpace:"nowrap"},onMouseEnter:e=>{n||(e.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:e=>{n||(e.currentTarget.style.background="none")},children:[n?(0,r.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:(0,r.jsx)("polyline",{points:"1.5 5 4 7.5 8.5 2.5"})}):(0,r.jsx)("span",{style:{width:10,flexShrink:0}}),(0,r.jsxs)("span",{style:{flex:1},children:[a,null!==s&&(0,r.jsxs)("span",{style:{fontSize:10,color:"var(--text-dim)",fontFamily:"var(--font-mono)",marginLeft:5},children:["(",i,")"]})]}),(0,r.jsx)("span",{style:{fontSize:11,color:"var(--text-dim)",marginLeft:8},children:l})]},t?`auto-${t}`:e)})})})()]}):null,n7=O?(ed=_?eg("chat.fastModeBusy"):null===A?eg("chat.fastModeUnknown"):A.active?eg("chat.fastModeActive"):A.enabled?eg("chat.fastModeInactive"):eg("chat.fastModeOff"),eu=_||a||y,eh=A?.enabled===!0,(0,r.jsx)("button",{type:"button",className:`composer-icon-button${A?.active?" is-active":""}`,onClick:O,disabled:eu,"aria-pressed":null===A?void 0:A.enabled,"aria-busy":_||void 0,title:ed,"aria-label":ed,style:{flexShrink:0,opacity:a?.5:1},children:(0,r.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:A?.active?"var(--accent)":"none",stroke:eh?"var(--accent)":"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",strokeDasharray:null===A?"3 2":void 0,style:{opacity:eh&&!A?.active?.6:1},"aria-hidden":"true",children:(0,r.jsx)("path",{d:"M13 2 4 14h7l-1 8 9-12h-7l1-8z"})})})):null,n9=(0,r.jsxs)(r.Fragment,{children:[n&&(0,r.jsxs)("button",{className:"composer-stream-action is-warning",onClick:()=>nR("steer"),disabled:!np,title:eQ?eg("chat.attachExtractingWait"):eg("chat.steerTitle"),style:{display:"flex",alignItems:"center",gap:5,padding:"7px 12px",background:np?"var(--warning-soft)":"var(--bg-hover)",border:0,borderRadius:"var(--radius-control)",color:np?"var(--warning)":"var(--text-dim)",cursor:np?"pointer":"not-allowed",fontSize:13,fontWeight:600,letterSpacing:"-0.01em",transition:"background 0.12s"},children:[(0,r.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("path",{d:"M5 1 L9 5 L5 9"}),(0,r.jsx)("line",{x1:"1",y1:"5",x2:"9",y2:"5"})]}),eg("chat.steer")]}),s&&(0,r.jsxs)("button",{className:"composer-stream-action is-followup",onClick:()=>nR("followup"),disabled:!np,title:eQ?eg("chat.attachExtractingWait"):eg("chat.followUpTitle"),style:{display:"flex",alignItems:"center",gap:5,padding:"7px 12px",background:np?"var(--bg-selected)":"var(--bg-hover)",border:0,borderRadius:"var(--radius-control)",color:np?"var(--text)":"var(--text-dim)",cursor:np?"pointer":"not-allowed",fontSize:13,fontWeight:600,letterSpacing:"-0.01em",transition:"background 0.12s"},children:[(0,r.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("line",{x1:"5",y1:"1",x2:"5",y2:"6"}),(0,r.jsx)("polyline",{points:"2.5 3.5 5 1 7.5 3.5"}),(0,r.jsx)("line",{x1:"2",y1:"9",x2:"8",y2:"9"})]}),eg("chat.followUp")]})]}),re=void 0!==Y?(0,r.jsx)(dm,{soundEnabled:J??!0,onToggle:Y}):null;return(0,r.jsxs)("div",{className:"chat-composer",style:{flexShrink:0,background:"transparent",padding:"0 16px 8px"},children:[(0,r.jsx)("input",{ref:tP,type:"file",multiple:!0,style:{display:"none"},onChange:e=>{t9(Array.from(e.target.files??[])),e.target.value=""}}),(0,r.jsxs)("div",{className:"chat-column-cap",style:{maxWidth:"var(--reading-measure)",margin:"0 auto"},children:[(0,r.jsx)(uY,{error:h}),(0,r.jsx)(uZ,{warnings:p}),D.length>0&&(0,r.jsxs)("div",{style:{marginBottom:8,border:0,borderRadius:"var(--radius-control)",background:"var(--bg-subtle)",padding:"5px 0"},children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,padding:"2px 8px 4px 10px"},children:[(0,r.jsx)("span",{style:{fontSize:12,fontWeight:600,color:"var(--text-muted)"},children:ex("delivery.title",{count:D.length})}),H&&ev&&(0,r.jsxs)("button",{onClick:H,title:eg("chat.recallTitle"),style:{display:"flex",alignItems:"center",gap:6,padding:"4px 12px",fontSize:12,color:"var(--text)",background:"var(--bg-hover)",border:0,borderRadius:"var(--radius-control)",cursor:"pointer",transition:"background 0.12s",whiteSpace:"nowrap"},onMouseEnter:e=>{e.currentTarget.style.background="var(--bg-selected)"},onMouseLeave:e=>{e.currentTarget.style.background="var(--bg-hover)"},children:[(0,r.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("polyline",{points:"9 14 4 9 9 4"}),(0,r.jsx)("path",{d:"M20 20v-7a4 4 0 0 0-4-4H4"})]}),eg("chat.recall")]})]}),(0,r.jsx)(dc,{rows:D,removeLabel:eg("chat.queueRemove"),onRemove:B?(e,t)=>B("steer"===e?"steering":"followUp",t):void 0})]}),z&&(0,r.jsxs)("div",{style:{marginBottom:8,padding:"5px 10px",background:"var(--warning-soft)",border:0,borderRadius:"var(--radius-control)",fontSize:12,color:"var(--warning)",display:"flex",alignItems:"center",gap:6},children:[(0,r.jsxs)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[(0,r.jsx)("path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}),(0,r.jsx)("path",{d:"M3 3v5h5"})]}),eg("chat.retrying",{attempt:z.attempt,max:z.maxAttempts}),z.errorMessage&&(0,r.jsxs)("span",{style:{opacity:.7,marginLeft:4},children:["— ",z.errorMessage]})]}),nZ&&(0,r.jsxs)("div",{style:{marginBottom:8,padding:"5px 10px",background:"var(--success-soft)",border:0,borderRadius:"var(--radius-control)",fontSize:12,color:"var(--success)",display:"flex",alignItems:"center",gap:6},children:[(0,r.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:(0,r.jsx)("polyline",{points:"20 6 9 17 4 12"})}),nZ]}),j&&(0,r.jsx)("div",{role:"alert",style:{marginBottom:8,padding:"7px 10px",background:"var(--danger-soft)",border:0,borderRadius:"var(--radius-control)",color:"var(--danger)",fontFamily:"var(--font-mono)",fontSize:12,lineHeight:1.5,whiteSpace:"pre-wrap",overflowWrap:"anywhere"},children:j}),eJ&&(0,r.jsxs)("div",{role:"alert",style:{display:"flex",alignItems:"center",gap:8,marginBottom:8,padding:"7px 10px",background:"var(--danger-soft)",border:0,borderRadius:"var(--radius-control)",color:"var(--danger)",fontSize:12,lineHeight:1.5},children:[(0,r.jsx)("span",{style:{flex:1,minWidth:0,overflowWrap:"anywhere"},children:eJ}),(0,r.jsx)("button",{type:"button",onClick:()=>eY(null),"aria-label":eg("i18n.close"),title:eg("i18n.close"),style:{flexShrink:0,width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",padding:0,border:"none",background:"transparent",color:"inherit",cursor:"pointer"},children:(0,r.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round","aria-hidden":"true",children:[(0,r.jsx)("line",{x1:"2",y1:"2",x2:"10",y2:"10"}),(0,r.jsx)("line",{x1:"10",y1:"2",x2:"2",y2:"10"})]})})]}),(eq.length>0||eK.length>0)&&(0,r.jsxs)("div",{role:"list","aria-label":eg("chat.attachments"),style:{display:"flex",alignItems:"center",gap:6,marginBottom:6,flexWrap:"wrap"},children:[eq.map((e,t)=>(0,r.jsxs)("div",{role:"listitem",style:{position:"relative",flexShrink:0},children:[(0,r.jsx)("img",{src:e.previewUrl,alt:"",style:{width:56,height:56,objectFit:"cover",borderRadius:"var(--radius-control)",display:"block"}}),(0,r.jsx)("button",{type:"button","aria-label":eg("chat.removeImage",{index:t+1}),onClick:()=>ne(t),style:{position:"absolute",top:-4,right:-4,width:16,height:16,borderRadius:"50%",background:"var(--bg-raised)",border:0,boxShadow:"var(--shadow-float)",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",padding:0,color:"var(--text-muted)"},children:(0,r.jsxs)("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round","aria-hidden":"true",children:[(0,r.jsx)("line",{x1:"1",y1:"1",x2:"7",y2:"7"}),(0,r.jsx)("line",{x1:"7",y1:"1",x2:"1",y2:"7"})]})})]},`image-${t}`)),eK.map(e=>(0,r.jsxs)("div",{className:"composer-chip",role:"listitem","aria-busy":"ready"!==e.status||ug(e)||void 0,style:{display:"flex",alignItems:"center",gap:7,minWidth:0,maxWidth:320,height:32,padding:"0 7px 0 9px"},children:["ready"!==e.status||e.transcription?.state==="planning"||e.transcription?.state==="running"?(0,r.jsx)("span",{"aria-hidden":"true",className:"workbench-lamp",style:{animation:"lamp-breathe 1.2s ease-in-out infinite"}}):i$(e.name,14),(0,r.jsxs)("span",{style:{minWidth:0,display:"flex",flexDirection:"column",lineHeight:1.15},children:[(0,r.jsx)("span",{title:e.name,style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"var(--text)",fontSize:12},children:e.name}),(0,r.jsxs)("span",{style:{color:"var(--text-dim)",fontSize:10},children:["audio"===e.stored?eg("chat.attachKindAudio"):"file"===e.stored?eg("chat.attachKindFile"):uS[e.mimeType]," \xb7 ",iY(e.sourceSize??e.size),"extracting"===e.status?` \xb7 ${eg("chat.attachExtracting")}`:"","uploading"===e.status?` \xb7 ${eg("chat.attachUploading")}`:"",e.transcription?.state==="planning"?` \xb7 ${eg("chat.transcribeChecking")}`:"",e.transcription?.state==="confirm"||e.transcription?.state==="fallback"?` \xb7 ${eg("chat.attachTranscribePending")}`:"",e.transcription?.state==="running"?` \xb7 ${eg("chat.attachTranscribing")}`:"",e.transcription?.state==="failed"&&(0,r.jsx)("span",{style:{color:"var(--danger)"},children:` \xb7 ${eg("chat.attachTranscribeFailed")}`})]})]}),(0,r.jsx)("button",{type:"button",onClick:()=>nt(e.id),"aria-label":eg("chat.removeAttachment",{name:e.name}),title:eg("chat.removeAttachment",{name:e.name}),style:{width:24,height:24,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",padding:0,border:"none",background:"transparent",color:"var(--text-muted)",cursor:"pointer"},children:(0,r.jsxs)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round","aria-hidden":"true",children:[(0,r.jsx)("line",{x1:"1.5",y1:"1.5",x2:"8.5",y2:"8.5"}),(0,r.jsx)("line",{x1:"8.5",y1:"1.5",x2:"1.5",y2:"8.5"})]})})]},e.id))]}),eX.length>0&&(0,r.jsx)("div",{role:"group","aria-label":eg("chat.transcribeGroup"),"aria-live":"polite",style:{display:"flex",flexDirection:"column",gap:6,marginBottom:6},children:eX.map(e=>{let t,n,i,s,a=e.attachmentId,o=e.transcription,c=o?.state==="confirm"||o?.state==="running"?o.plan:null,d=c?eg("chat.transcribePlanSummary",{duration:null===c.durationSeconds?eg("chat.transcribeDurationUnknown"):(n=Math.floor((t=Math.round(c.durationSeconds))/3600),i=Math.floor(t%3600/60),s=String(t%60).padStart(2,"0"),n>0?`${n}:${String(i).padStart(2,"0")}:${s}`:`${i}:${s}`),calls:c.estimatedCalls}):null,u=o?.state==="confirm"?eg("chat.transcribeConfirmTitle",{name:e.name}):o?.state==="fallback"?eg("chat.transcribeFallbackTitle",{name:e.name}):o?.state==="running"?eg("chat.transcribeRunning",{name:e.name}):o?.state==="planning"?`${e.name} \xb7 ${eg("chat.transcribeChecking")}`:o?.state==="failed"?eg("chat.transcribeFailedRow",{name:e.name,error:o.error}):eg("chat.transcribeSkipped",{name:e.name});return(0,r.jsxs)("div",{"data-transcription-state":o?.state??"idle",style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:8,padding:"7px 10px",border:0,borderRadius:"var(--radius-control)",background:o?.state==="failed"?"var(--danger-soft)":"var(--bg-panel)",fontSize:12,lineHeight:1.45},children:[(0,r.jsxs)("div",{style:{flex:"1 1 220px",minWidth:0},children:[(0,r.jsx)("div",{style:{color:o?.state==="failed"?"var(--danger)":"var(--text)",overflowWrap:"anywhere"},children:u}),d&&(0,r.jsx)("div",{style:{color:"var(--text-dim)",fontVariantNumeric:"tabular-nums"},children:d}),o?.state==="confirm"&&(0,r.jsxs)(r.Fragment,{children:[o.plan.notice&&(0,r.jsx)("div",{style:{color:"var(--text-dim)",overflowWrap:"anywhere"},children:o.plan.notice}),(0,r.jsx)("div",{style:{color:"var(--text-dim)"},children:eg("chat.transcribeUsageNotice")})]}),o?.state==="fallback"&&(0,r.jsxs)(r.Fragment,{children:[o.reason&&(0,r.jsx)("div",{style:{color:"var(--text-dim)",overflowWrap:"anywhere"},children:o.reason}),o.completedParts>0&&(0,r.jsx)("div",{style:{color:"var(--text-dim)",fontVariantNumeric:"tabular-nums"},children:eg("chat.transcribeFallbackProgress",{done:o.completedParts,total:o.parts})}),(0,r.jsx)("div",{style:{color:"var(--text-dim)",overflowWrap:"anywhere"},children:o.notice}),(0,r.jsx)("div",{style:{color:"var(--text-dim)"},children:eg("chat.transcribeFallbackUsageNotice")})]})]}),(0,r.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:[o?.state==="confirm"&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(l.r,{type:"button",variant:"neutralSolid",size:"small",onClick:()=>void t4(a,{confirmed:!0}),children:eg("chat.transcribeStart")}),(0,r.jsx)(l.r,{type:"button",variant:"neutralWeak",size:"small",onClick:()=>t3(a),children:eg("chat.transcribeSkip")})]}),o?.state==="fallback"&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(l.r,{type:"button",variant:"neutralSolid",size:"small",onClick:()=>void t4(a,{fallbackToken:o.token,approve:!0}),children:eg("chat.transcribeFallbackStart")}),(0,r.jsx)(l.r,{type:"button",variant:"neutralWeak",size:"small",onClick:()=>t3(a),children:eg("chat.transcribeSkip")})]}),(o?.state==="planning"||o?.state==="running")&&(0,r.jsx)(l.r,{type:"button",variant:"neutralWeak",size:"small",onClick:()=>t3(a),children:eg("chat.transcribeCancel")}),(void 0===o||"skipped"===o.state||"failed"===o.state)&&(0,r.jsx)(l.r,{type:"button",variant:"neutralWeak",size:"small",onClick:()=>void t6(a),children:eg(o?.state==="failed"?"chat.transcribeRetry":"chat.transcribeAction")})]})]},e.id)})}),(0,r.jsxs)("div",{ref:tL,style:{position:"relative",minWidth:0},children:[tu&&W.length>0&&(0,r.jsxs)("div",{ref:t$,style:{position:"absolute",left:0,right:0,...uw(nk.side),zIndex:120,background:"var(--bg-raised)",border:0,borderRadius:"var(--radius-surface)",boxShadow:"var(--seed-shadow-s3)",overflow:"hidden",maxHeight:nk.maxHeight},children:[(0,r.jsx)("div",{title:"Input history",style:{height:30,padding:"0 10px",background:"var(--bg-subtle)",display:"flex",alignItems:"center",color:"var(--text-dim)"},children:(0,r.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,r.jsx)("path",{d:"M3 12a9 9 0 1 0 3-6.7"}),(0,r.jsx)("path",{d:"M3 4v5h5"}),(0,r.jsx)("path",{d:"M12 7v5l3 2"})]})}),(0,r.jsx)("div",{style:{maxHeight:Math.max(0,nk.maxHeight-31),overflowY:"auto",padding:4},children:W.map((e,t)=>{let n=t===tp;return(0,r.jsxs)("button",{ref:e=>{tD.current[t]=e},type:"button",onMouseDown:t=>{t.preventDefault(),nM(e)},onMouseEnter:()=>tm(t),style:{width:"100%",display:"flex",alignItems:"flex-start",gap:8,padding:"7px 8px",border:"none",borderRadius:"var(--radius-control)",background:n?"var(--bg-selected)":"none",color:"var(--text)",cursor:"pointer",textAlign:"left",fontSize:12.5,lineHeight:1.45},children:[(0,r.jsx)("span",{style:{flexShrink:0,fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-dim)",paddingTop:1},children:t+1}),(0,r.jsx)("span",{style:{minWidth:0,display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:2,overflow:"hidden",overflowWrap:"anywhere"},children:e})]},`${t}:${e}`)})})]}),tn&&(0,r.jsx)("div",{role:"status",style:{fontSize:12,color:"var(--text-dim)",padding:"4px 8px"},children:eg("savedPrompts.saved")}),te&&e9&&(0,r.jsx)(du,{ref:ti,value:eb,token:e9,cwd:ee,sessionTitle:et,style:uw(nC.side),maxHeight:nC.maxHeight,onReplace:nT,onClose:()=>tt(!1)}),e8&&null!==nl&&(0,r.jsxs)("div",{style:{position:"absolute",left:0,right:0,...uw(nj.side),zIndex:120,background:"var(--bg-raised)",border:0,borderRadius:"var(--radius-surface)",boxShadow:"var(--seed-shadow-s3)",overflow:"hidden",maxHeight:nj.maxHeight},children:[(0,r.jsxs)("div",{style:{padding:"8px 10px",background:"var(--bg-subtle)",display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,fontSize:11,color:"var(--text-dim)"},children:[(0,r.jsx)("span",{children:V?eg("chat.loadingCommands"):eg("chat.slashCommands",{label:nu})}),(0,r.jsx)("span",{style:{fontFamily:"var(--font-mono)"},children:eg("chat.tabEnter")})]}),(0,r.jsx)("div",{style:{maxHeight:Math.max(0,nj.maxHeight-34),overflowY:"auto",padding:10},children:V||0!==no.length?nd.map(e=>(0,r.jsxs)("section",{style:{marginBottom:12},children:[(0,r.jsxs)("div",{style:{position:"sticky",top:-10,zIndex:1,display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,padding:"4px 0 6px",background:"var(--bg)",color:"var(--text-dim)",fontSize:10,fontWeight:600,textTransform:"uppercase"},children:[(0,r.jsx)("span",{children:eg(uR[e.source])}),(0,r.jsx)("span",{style:{fontFamily:"var(--font-mono)",fontWeight:500},children:e.items.length})]}),(0,r.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",gap:8},children:e.items.map(({command:e,index:t})=>{let n=t===e5,i=uA(e,tj);return(0,r.jsxs)("button",{ref:e=>{tO.current[t]=e},type:"button",onMouseDown:t=>{t.preventDefault(),nE(e)},onMouseEnter:()=>e6(t),style:{width:"100%",minWidth:0,minHeight:58,display:"flex",flexDirection:"column",gap:4,justifyContent:"center",padding:"9px 10px",border:0,borderRadius:"var(--radius-control)",background:n?"var(--bg-selected)":"var(--bg-subtle)",color:"var(--text)",cursor:"pointer",textAlign:"left"},children:[(0,r.jsxs)("span",{style:{fontSize:13,fontFamily:"var(--font-mono)",overflowWrap:"anywhere",wordBreak:"break-word",color:i?"var(--text-dim)":void 0},children:["/",e.name,i&&(0,r.jsx)("span",{style:{marginLeft:6,padding:"0 4px",background:"var(--bg-hover)",borderRadius:"var(--radius-control)",fontSize:9,color:"var(--text-dim)",whiteSpace:"nowrap"},children:eg("chat.dormant")})]}),uP(e,eg)&&(0,r.jsx)("span",{style:{display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:2,overflow:"hidden",fontSize:11,lineHeight:1.35,color:"var(--text-dim)"},children:uP(e,eg)})]},`${e.source}:${e.name}`)})})]},e.source)):(0,r.jsx)("div",{style:{padding:"2px 2px 4px",fontSize:12,color:"var(--text-dim)"},children:eg("chat.noCommands")})})]}),tl&&null!==ts&&(ep=tx&&(!tf||tf.cwd!==ee),em=1===ny.length?eg("chat.match"):eg("chat.matches",{count:ny.length}),ef=tf?.truncated&&!nv?ts.query?eg("chat.searchingAll"):eg("chat.indexTruncated"):"",(0,r.jsxs)("div",{style:{position:"absolute",left:0,right:0,...uw(nS.side),zIndex:120,background:"var(--bg-raised)",border:0,borderRadius:"var(--radius-surface)",boxShadow:"var(--seed-shadow-s3)",overflow:"hidden",maxHeight:nS.maxHeight},children:[(0,r.jsxs)("div",{style:{padding:"8px 10px",background:"var(--bg-subtle)",display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,fontSize:11,color:"var(--text-dim)"},children:[(0,r.jsx)("span",{children:ep?eg("chat.loadingFiles"):eg("chat.files",{label:em,hint:ef})}),(0,r.jsx)("span",{style:{fontFamily:"var(--font-mono)"},children:eg("chat.tabEnter")})]}),(0,r.jsx)("div",{style:{maxHeight:Math.max(0,nS.maxHeight-34),overflowY:"auto",padding:4},children:ep||0!==ny.length?ny.map((e,t)=>{let n=t===tc,i=e.path.split("/").pop()??e.path,s=e.path.slice(0,e.path.length-i.length);return(0,r.jsxs)("button",{ref:e=>{tz.current[t]=e},type:"button",onMouseDown:t=>{t.preventDefault(),nI(e)},onMouseEnter:()=>td(t),style:{width:"100%",display:"flex",alignItems:"center",gap:8,padding:"6px 8px",border:"none",borderRadius:"var(--radius-control)",background:n?"var(--bg-selected)":"none",color:"var(--text)",cursor:"pointer",textAlign:"left",fontSize:12.5,fontFamily:"var(--font-mono)"},children:[(0,r.jsx)("span",{style:{flexShrink:0,display:"flex",alignItems:"center"},children:e.isDir?(0,r.jsx)(iM,{size:14}):i$(i,14)}),(0,r.jsxs)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[s&&(0,r.jsx)("span",{style:{color:"var(--text-dim)"},children:s}),i,e.isDir&&(0,r.jsx)("span",{style:{color:"var(--text-dim)"},children:"/"})]})]},`${e.isDir?"d":"f"}:${e.path}`)}):(0,r.jsx)("div",{style:{padding:"6px 8px",fontSize:12,color:"var(--text-dim)"},children:nx&&!nv?eg("chat.searching"):eg("chat.noMatchingFiles")})})]})),(0,r.jsxs)("div",{className:`chat-composer-field${e1?" is-bash":""}${a?" is-streaming":""}`,style:{minWidth:0,display:"flex",gap:8,alignItems:"center",background:"var(--bg)",border:0,borderRadius:"var(--seed-radius-r3)",padding:"10px 10px 10px 14px",transition:"background 0.15s"},children:[(0,r.jsx)("textarea",{className:"chat-composer-textarea",ref:tS,"aria-controls":te?"saved-prompt-menu":void 0,value:eb,onChange:e=>{tB.current=e.target.value,ew(e.target.value),th(!1),nm(e.target.value,e.target.selectionStart)},onSelect:e=>{let t=e.currentTarget;nm(t.value,t.selectionStart)},onKeyDown:nL,onCompositionStart:()=>{tA.current=!0},onCompositionEnd:e=>{tA.current=!1,t_.current=Date.now();let t=e.currentTarget;nm(t.value,t.selectionStart)},onInput:nP,onPaste:nA,placeholder:a&&(n||s)?eg("chat.steerPlaceholder"):a?eg("chat.agentPlaceholder"):eg("chat.messagePlaceholder"),rows:1,style:{flex:1,minWidth:0,width:"100%",background:"none",border:"none",outline:"none",resize:"none",color:"var(--text)",fontSize:14,lineHeight:1.6,fontFamily:"inherit",minHeight:24,maxHeight:200,overflow:"auto"}}),a?ey?null:(0,r.jsx)("div",{style:{display:"flex",alignItems:"center",gap:6,flexShrink:0,alignSelf:"flex-end"},children:n9}):(0,r.jsxs)("button",{className:"chat-composer-send",onClick:na,disabled:!np,"aria-busy":eQ||void 0,"aria-label":ey?eg("chat.send"):void 0,title:eQ?eg("chat.attachExtractingWait"):void 0,style:{flexShrink:0,alignSelf:"flex-end",display:"flex",alignItems:"center",justifyContent:"center",gap:6,minWidth:ey?44:void 0,padding:ey?0:"7px 14px",background:np?"var(--accent-soft)":"var(--bg-raised)",border:"none",borderRadius:"var(--radius-control)",color:np?"var(--accent-hover)":"var(--text-dim)",cursor:np?"pointer":"not-allowed",fontSize:13,fontWeight:600,letterSpacing:"-0.01em",transition:"background 0.15s, color 0.15s"},children:[(0,r.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("line",{x1:"2",y1:"7",x2:"11",y2:"7"}),(0,r.jsx)("polyline",{points:"7.5 3 12 7 7.5 11"})]}),ey?null:eg("chat.send")]})]})]}),e1&&(0,r.jsxs)("div",{className:"text-xs px-2 py-1",style:{color:e2?"var(--text-muted)":"var(--accent)",marginTop:4},children:[eg("chat.shell")," \xb7 ",e2?eg("chat.outputLocal"):eg("chat.outputModel")]}),(0,r.jsxs)("div",{className:"composer-action-bar",style:{marginTop:8,display:"flex",alignItems:"center",gap:6},children:[(0,r.jsxs)("div",{style:{flex:ey?"1 1 0%":"0 0 auto",minWidth:ey?"min-content":0,display:"flex",alignItems:"center",gap:2},children:[(!ey||!a)&&n5,!ey&&n6,!(ey&&a)&&(n_.length>0||nJ||h)&&m&&(0,r.jsxs)("div",{ref:tC,style:{position:"relative",flex:ey?"1 1 0%":void 0,width:ey?0:void 0,minWidth:44*!!ey},children:[(0,r.jsxs)("button",{className:`composer-chip${ek?" is-active":""}`,onClick:e=>{let t=e.currentTarget.getBoundingClientRect();eC({top:t.top,bottom:t.bottom,left:t.left,width:t.width}),ej(e=>(e&&eT(""),!e))},disabled:a||y,"aria-busy":y||void 0,style:{display:"flex",alignItems:"center",gap:6,justifyContent:ey?"flex-start":void 0,padding:ey?"8px 10px":"8px 12px",height:32,width:ey?"100%":void 0,maxWidth:ey?"100%":220,overflow:"hidden",background:ek?"var(--bg-hover)":"none",border:"none",borderRadius:"var(--radius-control)",color:"var(--text-muted)",cursor:a||y?"not-allowed":"pointer",fontSize:12,opacity:a?.5:1,transition:"background 0.12s, color 0.12s"},onMouseEnter:e=>{a||y||(e.currentTarget.style.background="var(--bg-hover)",e.currentTarget.style.color="var(--text)")},onMouseLeave:e=>{e.currentTarget.style.background=ek?"var(--bg-hover)":"none",e.currentTarget.style.color="var(--text-muted)"},title:y?"Switching model":n_.length>0?"Change model":"No available models",children:[y?(0,r.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",style:{animation:"spin 0.8s linear infinite",flexShrink:0},"aria-hidden":"true",children:(0,r.jsx)("path",{d:"M21 12a9 9 0 1 1-2.64-6.36"})}):(0,r.jsxs)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"}),(0,r.jsx)("rect",{x:"9",y:"9",width:"6",height:"6"}),(0,r.jsx)("line",{x1:"9",y1:"1",x2:"9",y2:"4"}),(0,r.jsx)("line",{x1:"15",y1:"1",x2:"15",y2:"4"}),(0,r.jsx)("line",{x1:"9",y1:"20",x2:"9",y2:"23"}),(0,r.jsx)("line",{x1:"15",y1:"20",x2:"15",y2:"23"}),(0,r.jsx)("line",{x1:"20",y1:"9",x2:"23",y2:"9"}),(0,r.jsx)("line",{x1:"20",y1:"14",x2:"23",y2:"14"}),(0,r.jsx)("line",{x1:"1",y1:"9",x2:"4",y2:"9"}),(0,r.jsx)("line",{x1:"1",y1:"14",x2:"4",y2:"14"})]}),(0,r.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},children:nJ??(n_.length>0?"Select model":"No models")})]}),ek&&eS&&(()=>{let e=window.visualViewport?.height??window.innerHeight,{side:t,maxHeight:n}=ud(eS.top,eS.bottom,e,uu(e,.6,460),{gap:6,prefer:"above"}),i="above"===t?{bottom:e-eS.top+6}:{top:eS.bottom+6},s=ey?{left:8,right:8,maxWidth:"calc(100vw - 16px)"}:{left:eS.left,width:"max-content",minWidth:eS.width};return(0,r.jsxs)("div",{ref:tN,style:{position:"fixed",...i,...s,zIndex:500,background:"var(--bg-raised)",border:0,borderRadius:"var(--radius-surface)",boxShadow:"var(--seed-shadow-s2)",overflow:"hidden",maxHeight:n,display:"flex",flexDirection:"column"},children:[nW&&(0,r.jsx)("div",{style:{padding:"6px 8px",flexShrink:0},children:(0,r.jsx)("input",{value:eN,onChange:e=>eT(e.target.value),onKeyDown:e=>{"Escape"===e.key&&(eT(""),ej(!1))},placeholder:eg("chat.filterModels"),"aria-label":eg("chat.filterModels"),autoFocus:!0,autoComplete:"off",spellCheck:!1,style:{width:"100%",minWidth:220*!ey,fontSize:11,fontFamily:"var(--font-mono)",padding:"5px 8px",border:0,borderRadius:"var(--radius-control)",outline:"none",background:"var(--bg)",color:"var(--text)",boxSizing:"border-box"}})}),(0,r.jsxs)("div",{style:{minHeight:0,overflowY:"auto"},children:[nK.length>0&&(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{style:{padding:"6px 12px 4px",fontSize:10,fontWeight:600,color:"var(--text-dim)",textTransform:"uppercase",letterSpacing:"0.07em"},children:eg("chat.frequentModels")}),nK.map(({option:e,count:t})=>nG(e,"frequent",t))]}),nB.length>0&&!eN.trim()&&v&&(0,r.jsxs)("div",{style:{marginTop:6*(nK.length>0)},children:[(0,r.jsxs)("button",{type:"button",className:"model-role-disclosure","aria-expanded":eE,"aria-controls":"model-role-rows",onClick:e$,style:{display:"flex",alignItems:"center",gap:6,width:"100%",minHeight:32,padding:"6px 12px 4px",background:"none",border:"none",cursor:"pointer",textAlign:"left",fontSize:10,fontWeight:600,color:"var(--text-dim)",letterSpacing:"0.07em",whiteSpace:"nowrap"},children:[(0,r.jsx)("svg",{width:"8",height:"8",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{flexShrink:0,transform:eE?"rotate(90deg)":"none",transition:"transform 120ms"},children:(0,r.jsx)("polyline",{points:"3 1.5 7 5 3 8.5"})}),(0,r.jsx)("span",{style:{textTransform:"uppercase"},children:eg("chat.modelRoles")}),(0,r.jsx)("span",{style:{fontFamily:"var(--font-mono)"},children:nB.length}),nq&&(0,r.jsxs)("span",{style:{marginLeft:"auto",overflow:"hidden",textOverflow:"ellipsis",color:"var(--text-muted)",letterSpacing:0},children:[(0,r.jsx)("span",{style:{fontFamily:"var(--font-mono)",color:"var(--accent)",marginRight:6},children:nq.tag??nq.role.toUpperCase()}),nq.name]})]}),(0,r.jsx)("div",{id:"model-role-rows",hidden:!eE,children:nB.map(e=>{let t=nq?.role===e.role,n=e.resolved?.name??e.resolved?.modelId??"";return(0,r.jsxs)("button",{onClick:()=>{ej(!1),eT(""),v(e.role)},title:e.selector??n,style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"7px 12px",background:t?"var(--bg-selected)":"none",border:"none",color:t?"var(--text)":"var(--text-muted)",cursor:"pointer",fontSize:12,textAlign:"left",whiteSpace:"nowrap"},onMouseEnter:e=>{t||(e.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:e=>{t||(e.currentTarget.style.background="none")},children:[t?(0,r.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:(0,r.jsx)("polyline",{points:"1.5 5 4 7.5 8.5 2.5"})}):(0,r.jsx)("span",{style:{width:10,flexShrink:0}}),(0,r.jsx)("span",{style:{flexShrink:0,minWidth:58,padding:"1px 6px",borderRadius:"var(--radius-control)",border:0,background:"var(--bg-hover)",color:t?"var(--accent)":"var(--text-dim)",fontFamily:"var(--font-mono)",fontSize:9.5,fontWeight:700,letterSpacing:"0.06em",textAlign:"center"},children:e.tag??e.role.toUpperCase()}),(0,r.jsx)("span",{style:{fontWeight:t?600:500},children:e.name}),(0,r.jsxs)("span",{style:{marginLeft:"auto",paddingLeft:12,color:"var(--text-dim)",fontSize:11,overflow:"hidden",textOverflow:"ellipsis"},children:[n,e.resolved?.thinkingLevel?` \xb7 ${e.resolved.thinkingLevel}`:""]})]},e.role)})}),(0,r.jsx)("div",{style:{padding:"6px 12px 4px",fontSize:11,fontWeight:600,color:"var(--text-muted)",marginTop:4},children:eg("chat.allModels")})]}),0===nU.length?(0,r.jsx)("div",{style:{padding:"8px 12px",color:"var(--text-dim)",fontSize:12,whiteSpace:"nowrap"},children:eN.trim()?eg("chat.noMatchingModels"):"No available models"}):nU.map((e,t)=>(0,r.jsxs)("div",{children:[nU.length>1&&(0,r.jsx)("div",{style:{padding:"6px 12px 4px",fontSize:10,fontWeight:600,color:"var(--text-dim)",textTransform:"uppercase",letterSpacing:"0.07em",marginTop:6*(t>0)},children:e.provider}),e.options.map(e=>nG(e,"all"))]},e.provider))]})]})})()]}),ey&&a&&(0,r.jsx)("div",{style:{display:"flex",alignItems:"center",gap:6,minWidth:0},children:n9}),!ey&&n3,!ey&&n7,!ey&&n1&&(0,r.jsx)("span",{style:{flexShrink:0,padding:"0 6px",fontSize:12,color:"var(--text-muted)",whiteSpace:"nowrap"},children:n1}),!ey&&null!==M&&(0,r.jsx)("span",{title:eg(E?"chat.outputSpeedLiveTitle":"chat.outputSpeedTitle"),style:{flexShrink:0,padding:"0 6px",fontSize:12,color:"var(--text-muted)",whiteSpace:"nowrap",fontVariantNumeric:"tabular-nums"},children:eg(E?"chat.outputSpeedLive":"chat.outputSpeed",{rate:M>=10?Math.round(M):M.toFixed(1)})}),(0,r.jsx)(dC,{sessionId:en})]}),(0,r.jsxs)("div",{ref:tR,style:{flex:"0 1 auto",minWidth:0,display:"flex",alignItems:"center",justifyContent:"flex-end",position:"relative",marginLeft:"auto",gap:ey?4:2},children:[ey?(0,r.jsx)("button",{type:"button",className:`composer-icon-button${eU?" is-active":""}`,title:eg("chat.moreControls"),"aria-label":eg("chat.moreControls"),"aria-expanded":eU,onClick:()=>{ej(!1),eT(""),eB(e=>!e)},children:(0,r.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:[(0,r.jsx)("line",{x1:"4",y1:"7",x2:"20",y2:"7"}),(0,r.jsx)("line",{x1:"4",y1:"17",x2:"20",y2:"17"}),(0,r.jsx)("circle",{cx:"10",cy:"7",r:"2.2"}),(0,r.jsx)("circle",{cx:"16",cy:"17",r:"2.2"})]})}):(0,r.jsx)(l.r,{type:"button",variant:"neutralWeak",size:"small",layout:"withText",title:eU?void 0:eg("chat.moreControls"),"aria-label":eg("chat.moreControls"),"aria-expanded":eU,onClick:()=>{ej(!1),eT(""),eB(e=>!e)},children:eg("chat.moreControls")}),(0,r.jsxs)("div",{className:"composer-run-options",role:"group","aria-label":eg("chat.moreControls"),style:{display:eU?ey?"grid":"flex":"none",gridTemplateColumns:ey?"repeat(3, minmax(0, max-content))":void 0,alignItems:"center",gap:1,position:"absolute",right:0,bottom:"100%",marginBottom:"var(--seed-dimension-x1)",zIndex:60,padding:1,width:"max-content",maxWidth:"calc(100vw - 32px)",flexWrap:"wrap",justifyContent:"flex-end",border:0,borderRadius:"var(--seed-radius-r2)",background:"var(--bg-raised)",boxShadow:"var(--seed-shadow-s2)"},children:[ey&&(0,r.jsxs)(r.Fragment,{children:[a&&n5,n6,n3,n7]}),!a&&N&&(0,r.jsxs)("div",{ref:tM,style:{position:"relative"},children:[(0,r.jsxs)("button",{className:`composer-chip${eF?" is-active":""}`,onClick:()=>!a&&eO(e=>!e),disabled:a,title:eg("chat.changeToolPreset")+`: ${n4}`,"aria-label":eg("chat.changeToolPreset"),style:{display:"flex",alignItems:"center",justifyContent:"center",gap:5,padding:"8px 12px",height:32,background:eF?"var(--bg-hover)":"none",border:"none",borderRadius:"var(--radius-control)",color:"var(--text-muted)",cursor:a?"not-allowed":"pointer",fontSize:12,opacity:a?.5:1,transition:"background 0.12s, color 0.12s"},onMouseEnter:e=>{a||(e.currentTarget.style.background="var(--bg-hover)",e.currentTarget.style.color="var(--text)")},onMouseLeave:e=>{e.currentTarget.style.background=eF?"var(--bg-hover)":"none",e.currentTarget.style.color="var(--text-muted)"},children:[(0,r.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,r.jsx)("path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"})}),(0,r.jsx)("span",{style:{whiteSpace:"nowrap"},children:n4})]}),eF&&(0,r.jsx)("div",{style:{position:"absolute",bottom:"calc(100% + 6px)",right:0,zIndex:100,background:"var(--bg-raised)",border:0,borderRadius:"var(--radius-surface)",boxShadow:"var(--seed-shadow-s2)",overflow:"hidden",minWidth:120},children:ux.map(e=>{let t=uv[e],n=(C??"default")===t,i="off"===e?eg("chat.noTools"):"default"===e?eg("chat.builtInTools",{tools:uy}):eg("chat.allBuiltInTools",{tools:`${uy} + ${ub}`});return(0,r.jsxs)("button",{onClick:()=>{eO(!1),n||N(t)},style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"7px 12px",background:n?"var(--bg-selected)":"none",border:"none",color:n?"var(--text)":"var(--text-muted)",cursor:"pointer",fontSize:12,textAlign:"left",fontWeight:n?600:400,whiteSpace:"nowrap"},onMouseEnter:e=>{n||(e.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:e=>{n||(e.currentTarget.style.background="none")},children:[n?(0,r.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:(0,r.jsx)("polyline",{points:"1.5 5 4 7.5 8.5 2.5"})}):(0,r.jsx)("span",{style:{width:10,flexShrink:0}}),(0,r.jsx)("span",{style:{flex:1},children:e}),(0,r.jsx)("span",{style:{fontSize:11,color:"var(--text-dim)",marginLeft:8},children:i})]},e)})})]}),!a&&b&&(0,r.jsx)("div",{children:(0,r.jsx)("button",{className:`composer-chip${k?" is-active is-danger":""}`,onClick:k?w:b,disabled:a&&!k,style:{display:"flex",alignItems:"center",justifyContent:"center",gap:5,padding:"8px 12px",height:32,background:k?"var(--danger-soft)":"none",border:"none",borderRadius:"var(--radius-control)",color:k?"var(--danger)":"var(--text-muted)",cursor:a&&!k?"not-allowed":"pointer",fontSize:12,opacity:a&&!k?.5:1,transition:"background 0.12s, color 0.12s"},onMouseEnter:e=>{(!a||k)&&(e.currentTarget.style.background=k?"var(--danger-soft)":"var(--bg-hover)",e.currentTarget.style.color=k?"var(--danger)":"var(--text)")},onMouseLeave:e=>{e.currentTarget.style.background=k?"var(--danger-soft)":"none",e.currentTarget.style.color=k?"var(--danger)":"var(--text-muted)"},title:k?eg("chat.stopCompaction"):eg("chat.compactContext"),"aria-label":k?eg("chat.stopCompaction"):eg("chat.compactContext"),children:k?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:(0,r.jsx)("rect",{x:"2",y:"2",width:"6",height:"6",rx:"1",fill:"currentColor"})}),(0,r.jsx)("span",{style:{whiteSpace:"nowrap"},children:eg("chat.compacting")})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("polyline",{points:"4 14 10 14 10 20"}),(0,r.jsx)("polyline",{points:"20 10 14 10 14 4"}),(0,r.jsx)("line",{x1:"10",y1:"14",x2:"3",y2:"21"}),(0,r.jsx)("line",{x1:"21",y1:"3",x2:"14",y2:"10"})]}),(0,r.jsx)("span",{style:{whiteSpace:"nowrap"},children:eg("chat.compact")})]})})}),ey&&re,eU&&!ey&&(0,r.jsx)("button",{className:"composer-icon-button is-active",type:"button",title:eg("chat.collapseControls"),"aria-label":eg("chat.collapseControls"),"aria-expanded":!0,onClick:()=>{eO(!1),eD(!1),eB(!1)},style:{display:"flex",alignItems:"center",justifyContent:"center",width:36,height:32,padding:0,marginLeft:0,background:"var(--bg-hover)",border:"none",borderRadius:"0 9px 9px 0",color:"var(--text)",cursor:"pointer",transition:"background 0.12s, color 0.12s"},onMouseEnter:e=>{e.currentTarget.style.background="var(--bg-selected)"},onMouseLeave:e=>{e.currentTarget.style.background="var(--bg-hover)"},children:(0,r.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[(0,r.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,r.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),a&&(0,r.jsxs)("button",{className:"composer-chip is-danger is-active",onClick:t,title:eg("chat.stopAgent"),"aria-label":ey?eg("chat.stopAgent"):void 0,style:{display:"flex",alignItems:"center",justifyContent:"center",gap:6,minWidth:ey?44:void 0,padding:ey?0:"8px 14px",height:32,background:"var(--danger-soft)",border:0,borderRadius:"var(--radius-control)",color:"var(--danger)",cursor:"pointer",fontSize:12,fontWeight:600,whiteSpace:"nowrap",letterSpacing:"-0.01em",transition:"background 0.12s"},onMouseEnter:e=>{e.currentTarget.style.background="var(--bg-hover)"},onMouseLeave:e=>{e.currentTarget.style.background="var(--danger-soft)"},children:[(0,r.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:(0,r.jsx)("rect",{x:"1.5",y:"1.5",width:"7",height:"7",rx:"1.5",fill:"currentColor"})}),ey?null:eg("chat.stop")]}),(0,r.jsx)(dj,{sessionId:en,onEnsureSession:er,onTranscriptPersisted:ei}),!ey&&re]})]})]})]})});function uX({statuses:e}){if(0===e.length)return null;let t=[...e].sort((e,t)=>e.key.localeCompare(t.key)).map(({text:e})=>e.replace(/[\r\n\t]/g," ").replace(/ +/g," ").trim()).join(" "),n=eP(t);return(0,r.jsx)("div",{role:"status","aria-label":n,title:n,style:{display:"flex",alignItems:"center",flexShrink:0,minWidth:0,height:36,padding:"0 12px",background:"transparent"},children:(0,r.jsx)("span",{style:{minWidth:0,overflow:"hidden",color:"var(--text-muted)",fontFamily:"var(--font-mono)",fontSize:11,textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ez(t).map((e,t)=>(0,r.jsx)("span",{style:e.style,children:e.text},t))})})}function u0({phases:e,flow:t,busy:n}){let{t:s}=(0,F.s)(),{st:a}=iw(),[l,o]=(0,i.useState)(!1),[c,d]=(0,i.useState)(!1),[u,h]=(0,i.useState)(!1),p=(0,i.useId)(),m=e??[],{currentPhase:f,activeTask:g,remaining:x,completed:v,total:y,percent:b}=t_(m),w=m.some(e=>e.tasks.some(e=>e.dependsOn?.length)),k=t.steps.length>0,j=function(e,t,n){if(!t||!e.current)return null;let r=n("flow.strip.running",{stage:n(`flow.stage.${e.current}`)});return e.attempt>1?`${r} \xb7 ${n("flow.attempt",{attempt:e.attempt})}`:r}(t,n,a);if(0===y&&null===j)return null;let S=y>0&&0===x;return(0,r.jsxs)("div",{className:`todo-strip${S?" is-done":""}`,children:[(0,r.jsxs)("div",{className:"todo-strip-row",children:[(0,r.jsx)("span",{"aria-hidden":"true",className:"todo-strip-marker",children:S?"✓":"›"}),j&&(0,r.jsx)("span",{className:"todo-strip-lead",role:n?"status":void 0,children:j}),y>0&&(0,r.jsxs)("button",{type:"button",className:"todo-strip-summary","aria-expanded":l,onClick:()=>o(e=>!e),children:[!j&&f&&(0,r.jsx)("span",{className:"todo-strip-phase",children:f.name}),(0,r.jsx)("span",{className:"todo-strip-task",children:S?s("todo.allDone",{count:v}):g?.content??""}),(0,r.jsx)("span",{className:"todo-strip-count",children:S?s("todo.progressDone",{percent:b??0,completed:v,total:y}):s("todo.progress",{percent:b??0,completed:v,total:y,remaining:x})})]}),k&&(0,r.jsxs)("button",{type:"button",className:"todo-strip-flow-toggle","aria-expanded":c,"aria-controls":p,onClick:()=>d(e=>!e),children:[a("flow.toggle"),(0,r.jsx)("svg",{className:"flow-chevron",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,r.jsx)("polyline",{points:"6 9 12 15 18 9"})})]})]}),c&&k&&(0,r.jsx)(oR,{flow:t,live:n,st:a,id:p}),l&&y>0&&(0,r.jsxs)("div",{className:"todo-strip-body",children:[m.map((e,t)=>{let n=e.tasks.filter(e=>u||"completed"!==e.status);return 0===n.length?null:(0,r.jsxs)("div",{className:"todo-checklist-phase",role:"list",children:[m.length>1&&(0,r.jsx)("div",{className:"todo-checklist-phase-name",children:e.name}),n.map((e,t)=>(0,r.jsx)(iN,{task:e,phases:w?m:void 0},`${e.content}-${t}`))]},`${e.name}-${t}`)}),v>0&&(0,r.jsx)("button",{type:"button",className:"todo-strip-completed-toggle","aria-expanded":u,onClick:()=>h(e=>!e),children:s(u?"todo.hideCompleted":"todo.showCompleted",{count:v})})]})]})}function u1(e=document){return"visible"!==e.visibilityState||!e.hasFocus()}function u2(e){switch(e.method){case"select":case"confirm":case"input":case"editor":case"ask":case"form":case"plan_review":return!0;case"custom":return!0!==e.closed;default:return!1}}async function u8(e,t={createWindowNotification:(e,t)=>new Notification(e,t),getServiceWorkerRegistration:"serviceWorker"in navigator?()=>navigator.serviceWorker.getRegistration():null}){let n={body:e.body,...e.tag?{tag:e.tag}:{}};if(t.getServiceWorkerRegistration)try{let r=await t.getServiceWorkerRegistration();if(r)return await r.showNotification(e.title,{...n,data:{url:e.sessionUrl}}),"service-worker"}catch{}try{let r=t.createWindowNotification(e.title,n);return r.onclick=()=>{r.close(),e.onClick()},"window"}catch{return null}}class u4 extends Error{constructor(e,t,n,r){super(e),this.status=t,this.code=n,this.accepted=r,this.name="AgentCommandError"}}async function u5(e,t){let n=await fetch(`/api/agent/${encodeURIComponent(e)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),r=await n.json().catch(()=>({}));if(!n.ok||r.error)throw new u4(r.error??`HTTP ${n.status}`,n.status,r.code,r.accepted);return r.data}let u6="ompweb-update-client-id",u3="ompweb-update-resume-intent-v2",u7="ompweb-update-return-v1",u9="cuelo-restart-return-v1",he="ompweb-update-failure-return-v1",ht="ompweb:update-wake";function hn(e){return null===e?2e4:"running"===e?null:"failed"===e?3e4:8e3}function hr(){let e=sessionStorage.getItem(u6);if(e&&/^[A-Za-z0-9_-]{16,128}$/.test(e))return e;let t="function"==typeof crypto.randomUUID?crypto.randomUUID().replaceAll("-",""):Array.from(crypto.getRandomValues(new Uint8Array(16)),e=>e.toString(16).padStart(2,"0")).join("");return sessionStorage.setItem(u6,t),t}function hi(){sessionStorage.removeItem(u3)}function hs(){let e=sessionStorage.getItem(u7);if(!e)return null;try{let t=JSON.parse(e);if(1!==t.schemaVersion||"string"!=typeof t.requestId||!/^[0-9a-f]{32}$/.test(t.requestId)||"string"!=typeof t.stageHash||!/^[0-9a-f]{64}$/.test(t.stageHash)||"boolean"!=typeof t.dismissed)return null;return t}catch{return null}}function ha(e){let t=hs();if(!t||t.requestId!==e)return t;let n={...t,dismissed:!0};try{sessionStorage.setItem(u7,JSON.stringify(n))}catch{}return n}async function hl(e){let t=await fetch("/api/update-maintenance",{method:"POST",headers:{"Content-Type":"application/json","Cache-Control":"no-cache"},body:JSON.stringify({action:"heartbeat",clientId:hr(),sessionId:e.sessionId,resumeUrl:e.resumeUrl,preservationError:e.preservationError??null,...e.update?{requestId:e.update.requestId,stageHash:e.update.stageHash}:{}}),cache:"no-store"});if(!t.ok)throw Error(`maintenance heartbeat HTTP ${t.status}`);return await t.json()}async function ho(e){if(e.sessionId){let t=await fetch(`/api/sessions/${encodeURIComponent(e.sessionId)}?deferThinking=1&deferMedia=1`,{cache:"no-store",headers:{"Cache-Control":"no-cache"}});if(!t.ok)throw Error(`session resume HTTP ${t.status}`);if((await t.json()).sessionId!==e.sessionId)throw Error("resumed session identity mismatch")}let t=await fetch("/api/update-maintenance",{method:"POST",headers:{"Content-Type":"application/json","Cache-Control":"no-cache"},body:JSON.stringify({action:"resume-confirm",requestId:e.requestId,stageHash:e.stageHash,clientId:e.clientId,sessionId:e.sessionId}),cache:"no-store"});if(!t.ok)throw Error(`resume confirm HTTP ${t.status}`);let n=await t.json().catch(()=>null);!function(e){let t=hs();if(t&&t.requestId===e.requestId&&t.stageHash===e.stageHash)return;let n={schemaVersion:1,requestId:e.requestId,stageHash:e.stageHash,dismissed:!1};try{sessionStorage.setItem(u7,JSON.stringify(n))}catch{}}({requestId:e.requestId,stageHash:e.stageHash}),hi();let r=n?.wake;e.sessionId&&(r?.wake===!0||r?.reason==="already-claimed"||r?.reason==="user-already-active")&&window.dispatchEvent(new CustomEvent(ht,{detail:{sessionId:e.sessionId}}))}async function hc(e){let t=function(e){let t=sessionStorage.getItem(he);if(!t)return null;sessionStorage.removeItem(he);try{let n=JSON.parse(t);if(1!==n.schemaVersion||n.requestId!==e.requestId||n.stageHash!==e.stageHash||n.clientId!==e.clientId)return null;return{wake:!0===n.wake}}catch{return null}}(e);return t?(hi(),t.wake&&e.sessionId&&window.dispatchEvent(new CustomEvent(ht,{detail:{sessionId:e.sessionId}})),"failed"):(await ho(e),"resumed")}function hd(e,t){let n=new Map(e.map(e=>[e.id,e]));for(let e of t)n.set(e.id,function(e,t){return e&&(void 0!==e.parentToolCallId&&void 0!==t.parentToolCallId?e.parentToolCallId===t.parentToolCallId:void 0===e.sessionFile||void 0===t.sessionFile||e.sessionFile===t.sessionFile)?{...t,index:e.index,agent:e.agent,agentSource:e.agentSource,description:e.description??t.description,task:e.task??t.task,assignment:e.assignment??t.assignment,sessionFile:t.sessionFile??e.sessionFile,parentToolCallId:t.parentToolCallId??e.parentToolCallId}:t}(n.get(e.id),e));let r=[...n.values()];return[...r.filter(e=>"pending"===e.status||"running"===e.status).sort((e,t)=>e.index-t.index||e.id.localeCompare(t.id)),...r.filter(e=>"pending"!==e.status&&"running"!==e.status).sort((e,t)=>t.lastUpdate-e.lastUpdate||e.id.localeCompare(t.id))].slice(0,128)}function hu(e,t){switch(t.type){case"start":return{isStreaming:!0,streamingMessage:null};case"update":return{isStreaming:!0,streamingMessage:t.message};case"end":case"reset":return{isStreaming:!1,streamingMessage:null};default:return e}}function hh(e){return{steering:e?.steering??[],followUp:e?.followUp??[]}}function hp(e){if(e&&"boolean"==typeof e.fastModeEnabled)return{enabled:e.fastModeEnabled,active:!0===e.fastModeActive}}function hm(e){return t=>{let n=e?.isCompacting?e.compaction:null;if(!n)return t;let r=Date.now()-n.elapsedMs;return{startedAt:t?Math.min(t.startedAt,r):r,reason:t?.reason??n.reason}}}function hf(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1){let r=e[n],i=t[n];if(!r||!i||r.name!==i.name||r.tasks.length!==i.tasks.length)return!1;for(let e=0;e<r.tasks.length;e+=1){let t=r.tasks[e],n=i.tasks[e];if(!t||!n||t.content!==n.content||t.status!==n.status||t.blocker!==n.blocker||(t.dependsOn?.length??0)!==(n.dependsOn?.length??0)||t.dependsOn?.some((e,t)=>e!==n.dependsOn?.[t]))return!1}}return!0}function hg(e){return"aborted"===e.stopReason?"aborted":"error"===e.stopReason||e.errorMessage?"failed":e.stopReason?"completed":"unknown"}function hx(e,t){for(let n=e.length-1;n>=0;n--){let r=t[n]??null;if(!ta(r??void 0))return{message:e[n],entryId:r}}return null}let hv=new Set(["ArrowUp","ArrowDown","PageUp","PageDown","Home","End"," ","Space","Spacebar"]);class hy extends Error{constructor(e){super("timeout"===e?"Timed out connecting to the agent event stream. Please try again.":"Failed to connect to the agent event stream. Please try again."),this.status=e,this.name="EventStreamConnectionError"}}function hb(){return"u">typeof crypto&&"function"==typeof crypto.randomUUID?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2)}`}function hw(e){return new Promise(t=>setTimeout(t,e))}function hk(e){let t=e.findIndex(e=>!e.exiting);return -1===t?e:e.map((e,n)=>n===t?{...e,exiting:!0}:e)}function hj(e,t){switch(t.type){case"add":if(e.visible.some(e=>e.exiting)||e.visible.length>=5)return{visible:e.visible.some(e=>e.exiting)?e.visible:hk(e.visible),pending:[...e.pending,t.notice]};return{...e,visible:[...e.visible,t.notice]};case"mark_oldest_exiting":return{...e,visible:hk(e.visible)};case"remove":return function(e,t){let n=e,r=t;for(;r.length>0&&n.length<5;){let[e,...t]=r;n=[...n,e],r=t}return r.length>0&&!n.some(e=>e.exiting)&&(n=hk(n)),{visible:n,pending:r}}(e.visible.filter(e=>e.id!==t.id),e.pending);default:return e}}function hS(e){if(!e||"object"!=typeof e||"image"!==e.type)return"";let t=e.source;return t&&"object"==typeof t?["url"===t.type?"url":"base64","string"==typeof t.media_type?t.media_type:"","string"==typeof t.data?t.data:"","string"==typeof t.url?t.url:""].join(":"):["base64","string"==typeof e.mimeType?e.mimeType:"","string"==typeof e.data?e.data:"",""].join(":")}function hC(e){let t,n=e.content;return"string"==typeof n?JSON.stringify({text:n,images:[]}):Array.isArray(n)?JSON.stringify({text:"string"==typeof(t=e.content)?t:Array.isArray(t)?t.map(e=>e&&"object"==typeof e&&"text"===e.type&&"string"==typeof e.text?e.text:"").filter(Boolean).join("\n"):"",images:n.map(hS).filter(Boolean)}):JSON.stringify({text:"",images:[]})}function hN(e){return"user"===e.role?`user:${hC(e)}`:"bashExecution"===e.role?JSON.stringify({role:e.role,command:e.command,output:e.output,exitCode:e.exitCode,cancelled:e.cancelled,truncated:e.truncated,fullOutputPath:e.fullOutputPath,excludeFromContext:e.excludeFromContext}):JSON.stringify({role:e.role,content:e.content,model:e.model,provider:e.provider,customType:e.customType})}function hT(e,t){return e&&"object"==typeof e?"number"!=typeof e.tokensBefore||"number"!=typeof e.estimatedTokensAfter?null:{reason:t,tokensBefore:e.tokensBefore,estimatedTokensAfter:e.estimatedTokensAfter}:null}function hI(e){return e?.map(({data:e,mimeType:t})=>({data:e,mimeType:t}))}function hM(e){nM(e),e.clear()}function hE(e,t,n){for(let r of n??[]){let n=nI(t,r);n&&e.add(n)}}function hR(){let e=document.activeElement;return e instanceof HTMLElement&&(e.isContentEditable||"INPUT"===e.tagName||"SELECT"===e.tagName||"TEXTAREA"===e.tagName)}let h$=!1,hL={width:0,height:0},hP=new Set,hA=null;function h_(){let e=window.visualViewport,t=hR();hL.width!==window.innerWidth?hL={width:window.innerWidth,height:window.innerHeight}:t||(hL.height=Math.max(hL.height,window.innerHeight));let n=function({hasFocusedEditable:e,innerHeight:t,viewportHeight:n,viewportScale:r,baselineHeight:i}){return!(!e||Math.abs(r-1)>=.01)&&(t-n>120||i-t>120)}({hasFocusedEditable:t,innerHeight:window.innerHeight,viewportHeight:e?.height??window.innerHeight,viewportScale:e?.scale??1,baselineHeight:hL.height});if(n!==h$)for(let e of(h$=n,hP))e()}function hF(e){if(hP.add(e),!hA){let e=null,t=()=>{null!==e&&window.cancelAnimationFrame(e),e=window.requestAnimationFrame(()=>{e=null,h_()})},n=window.visualViewport;n?.addEventListener("resize",t),window.addEventListener("resize",t),window.addEventListener("focusin",t),window.addEventListener("focusout",t),h_(),hA=()=>{n?.removeEventListener("resize",t),window.removeEventListener("resize",t),window.removeEventListener("focusin",t),window.removeEventListener("focusout",t),null!==e&&window.cancelAnimationFrame(e)}}return()=>{hP.delete(e),0===hP.size&&hA&&(hA(),hA=null)}}function hO(){return(0,i.useSyncExternalStore)(hF,()=>h$,()=>!1)}let hz={count:50,end:null};function hD(e,t){let n=Math.max(e,0),r=null===t.end?n:Math.min(Math.max(t.end,0),n),i=Math.min(Math.max(t.count,0),r),s=r-i;return{startIndex:s,endIndex:r,hasMore:s>0,hasLater:r<n}}function hW(e,t,n){let{startIndex:r,endIndex:i}=hD(e,n);if(t>=r&&t<i)return n;let s=Math.max(0,t-10),a=Math.max(t+1,s+50);return a>=e?{count:e-s,end:null}:{count:a-s,end:a}}function hH({sticker:e,text:t,tag:n,followRef:s}){let a=(0,i.useRef)(null);return((0,i.useEffect)(()=>{(!s||s.current)&&a.current?.scrollIntoView({block:"nearest",behavior:"smooth"})},[]),e||t)?(0,r.jsxs)("div",{ref:a,className:"cue-bubble-dock",role:"status","aria-live":"polite",children:[e&&(0,r.jsx)("img",{className:"cue-bubble-sticker",src:e,alt:n6[n]}),t&&(0,r.jsx)("p",{className:e?"cue-bubble":"cue-bubble cue-bubble--solo",children:t}),e&&(0,r.jsx)(cT(),{id:"71a4a7cebbc6c842",children:".cue-bubble-sticker{transform-origin:center 75%;animation:cue-sticker-pop 200ms cubic-bezier(0,0,.15,1)both}@keyframes cue-sticker-pop{from{opacity:0;transform:scale(.88)}to{opacity:1;transform:scale(1)}}@media(prefers-reduced-motion:reduce){.cue-bubble-sticker{animation:none}}"})]}):null}function hU(e){if("user"!==e.role)return null;let t="string"==typeof e.content?e.content:e.content.filter(e=>"text"===e.type).map(e=>e.text).join("\n"),n=(iJ(t)?.message??t).trim();return n.length>0?n:null}function hB(e){return`omp-cues:${e}`}function hq(e,t){let n=[];for(let r of t)r.sessionId===e&&null!==r.anchorEntryId&&n.push({id:r.id,anchorEntryId:r.anchorEntryId,sticker:r.sticker,text:r.text,tag:r.tag});try{window.localStorage.setItem(hB(e),JSON.stringify(n.slice(-200)))}catch{}}let hV=[];function hK(e){return`omp-web:interrupted-dismissed:${e}`}let hG=(0,i.memo)(function({messages:e,entryIds:t,toolResultsMap:n,modelNames:s,messageCwd:a,onOpenFile:l,sessionBusy:o,isNew:c,isStreaming:d,handleFork:u,forkingEntryId:h,handleNavigate:p,handleEditContent:m,sessionId:f,main:g,process:x,turnSummaries:v,startIndex:y,endIndex:b,sentinelRef:w,laterSentinelRef:k,flashItem:j,t:S,onProcessLogChange:C,cues:N,cueFollowRef:T}){(0,i.useEffect)(()=>{C({groups:x,messages:e,entryIds:t,toolResults:n,modelNames:s,cwd:a,sessionId:f})},[C,x,e,t,n,s,a,f]);let I=(0,i.useMemo)(()=>(function(e){let t=new Map;for(let n=0;n<e.length;n++){let r=ti(e,n);r>=0&&t.set(r,function(e){let t="string"==typeof e.content?e.content:e.content.map(e=>"text"===e.type?e.text:"").join("\n");if(!t.startsWith("[interpreter] "))return t;let n=t.indexOf("\n\n");return n<0?t:t.slice(n+2)}(e[n]))}return t})(e),[e]),M=(0,i.useMemo)(()=>{let t=new Map;for(let[r,i]of function(e,t,n,r){let i=new Map;e.forEach((e,t)=>{"answer"===e.kind&&i.set(e.idx,t)});let s=new Map,a=new Map;for(let e of t){let t=a.get(e.anchorIdx);for(let l of(t||(t=new Set,a.set(e.anchorIdx,t)),e.entries)){let e=n[l.idx];if(e?.role!=="assistant")continue;let a=Math.max(0,(l.blocks?i.get(l.idx):void 0)??l.afterMainIndex??-1),o=t;!function(e,t,n){for(let r of e){if("toolCall"!==r.type||"learn"!==r.toolName&&"manage_skill"!==r.toolName)continue;let e=t?.get(r.toolCallId);if(!e||e.isError)continue;let i=r.input??{};if("manage_skill"===r.toolName){let e=td(i.action);if(!0===tc[e]){let t={kind:"skill",action:e,name:td(i.name)};n(JSON.stringify(t),t)}continue}let s=td(i.memory),a=i.skill,l=a?{action:td(a.action),name:td(a.name)}:void 0;n(JSON.stringify({kind:"lesson",memory:s,skill:l}),{kind:"lesson",memory:s.length>160?`${s.slice(0,160)}…`:s,...l?{skill:l}:{}})}}(l.blocks??e.content??[],r,(e,t)=>{if(o.has(e))return;o.add(e);let n=s.get(a);n?n.push(t):s.set(a,[t])})}}return s}(g,x,e,n)){let e=i.map(e=>{if("skill"===e.kind)return S("chat.savedSkill",{action:e.action,name:e.name});let t=S("chat.savedLesson",{memory:e.memory});return e.skill?`${t} (${S("chat.savedSkill",e.skill)})`:t});t.set(r,{role:"custom",customType:tn,content:[S("chat.lessonsSaved"),...e.map(e=>`- ${e}`)].join("\n"),display:!0})}return t},[g,x,e,n,S]),E=y>0,R=b<g.length,$=(i,g={})=>{let x=g.messageOverride??e[i],v=i-1;for(;v>=0&&ta(t[v]);)v-=1;let y="user"===x.role&&v>=0&&"assistant"===e[v].role?t[v]:void 0,b=g.keyPrefix??"message",w=!1;if("assistant"===x.role){w=!0;for(let t=i+1;t<e.length;t++){let n=e[t].role;if("user"===n)break;if("assistant"===n){w=!1;break}}w&&d&&i===e.length-1&&(w=!1)}return void 0!==g.showTimestamp&&(w=g.showTimestamp),(0,r.jsx)(sl,{message:x,toolResults:n,modelNames:s,cwd:a,onOpenFile:l,entryId:t[i],onFork:o||c||0===i&&"user"===x.role?void 0:u,forking:h===t[i],onNavigate:o?void 0:p,prevAssistantEntryId:o?void 0:y,onEditContent:m,showTimestamp:w,prevTimestamp:i>0?e[i-1].timestamp:void 0,sessionId:f,writtenFiles:g.writtenFiles,hasTurnSummary:void 0!==g.turnSummary,inputTranslation:"user"===x.role?I.get(i):void 0,recoveredError:eY(e,i)},`${b}-view-${i}`)},L=(t,n)=>{let i=g[t],s="message"===i.kind&&e[i.idx]?.role==="user";return(0,r.jsx)("div",{"data-chat-item":t,"data-chat-question":s?"":void 0,className:j===t?"chat-item chat-jump-flash":"chat-item",children:n})};return(0,r.jsxs)(r.Fragment,{children:[E&&(0,r.jsx)("div",{ref:w,className:"py-3 text-center text-xs text-text-muted",children:S("chat.loadEarlier",{count:y})}),g.slice(y,b).map((s,o)=>{let c=y+o,d="message"===s.kind?s.anchorIdx??s.idx:s.anchorIdx,u=g[c+1],h=u?"message"===u.kind?u.anchorIdx??u.idx:u.anchorIdx:null,p=u?u.idx:1/0,m=N.filter(n=>{let r=null!==n.anchorEntryId?t.indexOf(n.anchorEntryId):Math.min(n.liveIndex??-1,e.length-1);return r>=s.idx&&r<p}).map(e=>(0,r.jsx)(hH,{sticker:e.sticker,text:e.text,tag:e.tag,followRef:T},`cue-${e.id}`)),x=h!==d,b=M.get(c),w=b?(0,r.jsx)(sl,{message:b,cwd:a,onOpenFile:l},`saved-lessons-${c}`):null,k=x?(0,r.jsx)(cP,{turnIndex:d,turnEntryId:t[d],sessionId:f,cwd:a,onOpenFile:l}):null;if("message"===s.kind)return(0,r.jsxs)(i.Fragment,{children:[L(c,$(s.idx)),w,k,m]},`message-${s.idx}`);let j=tM(s.precedingBlocks,n,a),S=v.get(c);return(0,r.jsxs)(i.Fragment,{children:[L(c,$(s.idx,{keyPrefix:`answer-${s.runIndex}`,messageOverride:function(e,t){let n=eK(e,t);if(!e.replyTranslation)return n;let r=e.content.find(e=>"text"===e.type);return r&&t.includes(r)||(n.replyTranslation=void 0,"translated"===e.replyTranslation.kind&&(n.content=t.filter(e=>"text"!==e.type))),n}(e[s.idx],s.blocks),writtenFiles:j,turnSummary:S})),S&&(0,r.jsx)(co,{summary:S,turnKey:c}),w,k,m]},`answer-${s.idx}-${s.runIndex}`)}),R&&(0,r.jsx)("div",{ref:k,className:"py-3 text-center text-xs text-text-muted",children:S("chat.loadLater",{count:g.length-b})})]})});function hJ({session:e,newSessionCwd:t,newSessionAutoWorktree:a,initialSessionData:l,transitioning:o=!1,onAgentEnd:c,onAttentionNeeded:d,onSessionCreated:u,onSessionForked:h,modelsRefreshKey:p,chatInputRef:m,onBranchDataChange:f,onSystemPromptChange:g,onSessionStatsChange:v,onSessionStatsPanelOpen:y,onContextUsageChange:b,onSubagentsChange:w,onLabWidgetsChange:k,onOpenWorkspaceView:j,onOpenSessionList:S,onOpenMaker:C,selectedMaker:N,onProcessLogChange:T,onOpenFile:I,transcriptReplacement:M,onComposerFocusChange:E,onSessionBusyChange:R,onWaitingChange:$,onAttentionChange:L,soundEnabled:P=!0,onSoundToggle:A,playCueSound:_=async()=>({sticker:null,text:null}),preloadCueSound:O,unlockAudio:z,jumpRequest:D=null,onJumpHandled:W,turnInspectorTarget:H=null,onShowTurnInspector:B,turnInspectorFolded:q=!1}){var V,K;let G,J,Y,{t:Z}=(0,F.s)(),Q=hO(),X=U(),et=Q&&X,en=(0,i.useRef)(_);en.current=_;let er=(0,i.useRef)(null),ei=(0,i.useRef)(O);ei.current=O;let[es,el]=(0,i.useState)([]),eo=(0,i.useRef)(es);eo.current=es;let ec=(0,i.useRef)(0),ed=(0,i.useRef)([]),eu=(0,i.useRef)([]),eh=(0,i.useRef)(null),ep=(0,i.useRef)(0),em=(0,i.useRef)(-1),ef=(0,i.useRef)(-1),eg=(0,i.useCallback)(()=>{let e=eh.current?.current;return e?{sessionId:e,turn:ep.current}:null},[]),ex=(0,i.useCallback)(e=>eh.current?.current===e.sessionId&&ep.current===e.turn,[]),ev=(0,i.useCallback)((e,t,n,r)=>{if(!e.sticker&&!e.text)return;ec.current=Math.max(ec.current+1,Date.now());let i={id:ec.current,sticker:e.sticker,text:e.text,tag:t,sessionId:n.sessionId},s="entry"===r.kind?{...i,anchorEntryId:r.entryId}:{...i,anchorEntryId:null,liveIndex:r.liveIndex,intent:r.intent};el(e=>{let t=[...e,s];return null!==s.anchorEntryId&&hq(n.sessionId,t),t})},[]),ey=(0,i.useCallback)((e,t,n,r)=>{let i=()=>ex(n)&&("working"!==t||ef.current!==n.turn);i()&&en.current(e,t,i).then(e=>{null!==t&&null!==r&&i()&&ev(e,t,n,r)}).catch(()=>{})},[ex,ev]),eb=(0,i.useCallback)(async(e,t,n,r)=>{let i=(await ix(e,t,n,r))?.alias??null;return i&&ei.current?.(i),i},[]),ew=(0,i.useCallback)((e,t,n,r,i)=>{let s=function(e,t){let n=e.length-1;if(n<0)return null;let r=Math.min(e.length,t.length);if(n<r)return{kind:"entry",entryId:t[n]};let i=ro(e[n]),s=0;for(let t=r;t<=n;t++)ro(e[t])===i&&(s+=1);return{kind:"pending",liveIndex:n,intent:{baseEntryId:r>0?t[r-1]:null,identity:i,occurrence:s}}}(ed.current,eu.current);eb(t.sessionId,n,r,i).then(n=>{ey(n,e,t,s)})},[ey,eb]),[ek,ej]=(0,i.useState)(0),eS=(0,i.useRef)([]),eC=(0,i.useCallback)(e=>{if(ep.current+=1,null!==re(e.outcome)){let t=e.sessionId;eS.current.push({completion:e,trigger:t?{sessionId:t,turn:ep.current}:null}),ej(e=>e+1)}c?.(e)},[c]);(0,i.useEffect)(()=>{for(let{completion:e,trigger:t}of eS.current.splice(0)){let n=re(e.outcome),r="neutral"===n?null:n;t?ew(r,t,e.provider,e.credentialId,e.model):en.current(null,r).catch(()=>{})}},[ek,ew]);let eN=(0,i.useCallback)(e=>{m?.current?.replaceMessage(e)},[m]),{loading:eT,error:eI,messages:eM,entryIds:eE,streamState:eR,agentRunning:e$,bashRunning:eL,pendingBash:eA,modelNames:e_,modelList:eF,modelError:eO,modelScopeWarnings:ez,modelThinkingLevels:eD,modelThinkingLevelMaps:eW,modelRoles:eH,toolPreset:eU,thinkingLevel:eB,effectiveThinkingLevel:eq,thinkingCeiling:eV,fastMode:eG,fastModeBusy:eX,handleFastModeToggle:e0,retryInfo:e8,contextUsage:e4,forkingEntryId:e6,isCompacting:e3,compaction:tn,compactError:tc,compactResult:td,displayModel:th,modelSwitching:tp,sessionStats:tm,runStateKnown:tf,compactedWork:tg,slashCommands:tx,slashCommandsLoading:tv,deliveryRows:ty,subagents:tb,todoPhases:tw,notices:tk,extensionDialog:tj,extensionResponse:tS,extensionCustomUi:tC,extensionStatuses:tN,extensionWidgets:tT,respondToExtensionUi:tI,sendExtensionCustomInput:tM,isAutoModelSelection:tE,agentPhase:tR,isNew:t$,autoFollowPaused:tL,resumeAutoFollow:tA,pauseAutoFollow:t_,goalStatus:tF,sessionIdRef:tO,messagesEndRef:tD,scrollContainerRef:tW,handleSend:tH,handleAbort:tU,handleFork:tB,handleNavigate:tq,handleModelChange:tV,handleRoleModelChange:tK,handleMainPresetChange:tG,newSessionAccount:tJ,handleCompact:tY,handleSteer:tZ,handleFollowUp:tQ,handlePromptWithStreamingBehavior:tX,handleAbortCompaction:t0,handleRecallQueue:t1,handleRemoveQueuedMessage:t2,handleBuiltinSlashCommand:t8,handleToolPresetChange:t4,handleThinkingLevelChange:t5,loadSlashCommands:t6,ensureNewSession:t3,refreshLiveTranscript:t7}=function(e){let{session:t,newSessionCwd:r,initialData:s,onAgentEnd:a,onAttentionNeeded:l,onSessionCreated:o,onSessionForked:c,modelsRefreshKey:d,onBranchDataChange:u,onSystemPromptChange:h,onSessionStatsPanelOpen:p}=e,m=null===t&&null!==r,f=s&&s.sessionId===t?.id?s:null,[g,x]=(0,i.useState)(f),[v,y]=(0,i.useState)(!m&&!f),[b,w]=(0,i.useState)(null),[k,j]=(0,i.useState)(f?.leafId??null),[S,C]=(0,i.useState)(f?.context.messages??[]),[N,T]=(0,i.useState)(f?.context.entryIds??[]),[I,M]=(0,i.useState)(f?.context.compactedWork??null),[E,R]=(0,i.useReducer)(hu,{isStreaming:!1,streamingMessage:null}),[$,L]=(0,i.useState)(!1),[P,A]=(0,i.useState)(!1),[_,F]=(0,i.useState)(null),[O,z]=(0,i.useState)({}),[D,W]=(0,i.useState)([]),[H,U]=(0,i.useState)(null),[B,q]=(0,i.useState)([]),[V,K]=(0,i.useState)({}),[G,J]=(0,i.useState)({}),[Y,Z]=(0,i.useState)([]),[Q,X]=(0,i.useState)(null),[ee,et]=(0,i.useState)(null),[en,er]=(0,i.useState)(null),[ei,es]=(0,i.useState)("default"),[el,eo]=(0,i.useState)(()=>{let e=f?.context.thinkingLevel;return e&&"off"!==e?e:"auto"}),[ec,ed]=(0,i.useState)(),[eu,eh]=(0,i.useState)(null),[ep,em]=(0,i.useState)(null),[ef,eg]=(0,i.useState)(!1),ex=(0,i.useRef)(0),ev=(0,i.useRef)(0),ey=(0,i.useRef)(""),[eb,ew]=(0,i.useState)(null),[ek,ej]=(0,i.useState)(f?.contextUsage??null),[eS,eC]=(0,i.useState)(null),[eN,eT]=(0,i.useState)(null),[eI,eM]=(0,i.useState)(null),[eE,eR]=(0,i.useState)(null),[e$,eL]=(0,i.useState)(!1),[eA,e_]=(0,i.useState)(!1),[eF,eO]=(0,i.useState)(null),[ez,eD]=(0,i.useState)(null),[eW,eH]=(0,i.useState)(null),eU=(0,i.useRef)(null),[eB,eq]=(0,i.useState)(!1),[eV,eK]=(0,i.useState)(null),[eG,eJ]=(0,i.useState)([]),[eY,eZ]=(0,i.useState)(!1),[eQ,eX]=(0,i.useReducer)(hj,{visible:[],pending:[]}),[e0,e1]=(0,i.useState)(null),[e2,e8]=(0,i.useState)(null),[e4,e5]=(0,i.useState)(null),e6=(0,i.useRef)(null),[e3,e7]=(0,i.useState)(null),[e9,te]=(0,i.useState)([]),[tn,tr]=(0,i.useState)([]),[ti,to]=(0,i.useState)({steering:[],followUp:[]}),[tc,td]=(0,i.useState)([]),[tu,th]=(0,i.useReducer)(lV,[]),tp=(0,i.useRef)(0);(0,i.useEffect)(()=>{th({type:"queue",steering:ti.steering,followUp:ti.followUp})},[ti]),(0,i.useEffect)(()=>{$||th({type:"idle"})},[$]),(0,i.useEffect)(()=>{th({type:"reset"})},[t?.id]);let tm=(0,i.useMemo)(()=>(function(e,t){let n=new Map;for(let t of e){if(!t.inQueue)continue;let e=`${t.kind}\u0000${lB(t)}`;n.set(e,(n.get(e)??0)+1)}let r=[],i=(e,t)=>{t.forEach((t,i)=>{let s=`${e}\u0000${lU(t)}`,a=n.get(s)??0;a>0?n.set(s,a-1):r.push({key:`queue-${e}-${i}`,kind:e,text:t,images:0,stage:"accepted",removable:!0})})};for(let n of(i("steer",t?.steering??[]),i("followUp",t?.followUp??[]),e))r.push({key:`sent-${n.id}`,kind:n.kind,text:n.text,images:n.images,stage:n.stage,removable:n.inQueue});return r})(tu,ti),[tu,ti]),[tf,tg]=(0,i.useState)(null),tx=(0,i.useRef)(null),tv=(0,i.useRef)(null),ty=(0,i.useRef)(null),tb=(0,i.useRef)(null),tw=(0,i.useRef)(null),tk=(0,i.useRef)(0),tj=(0,i.useRef)(!1),tS=(0,i.useRef)(t?.id??null),tC=(0,i.useRef)(f?.leafId??null),tN=(0,i.useRef)(S),tT=(0,i.useRef)(N);tN.current=S,tT.current=N;let tI=(0,i.useRef)({sessionId:t?.id??null,outputs:[],seq:0}),tM=(0,i.useRef)(!1),tE=(0,i.useRef)(new Set);(0,i.useEffect)(()=>()=>hM(tE.current),[]);let tR=(0,i.useRef)(!1),t$=(0,i.useRef)(!1),tL=(0,i.useRef)(-1),tP=(0,i.useRef)("unknown"),tA=(0,i.useRef)(null),t_=(0,i.useRef)(null),tF=(0,i.useRef)(0),tO=(0,i.useRef)(!1),tz=(0,i.useRef)(0),tD=(0,i.useRef)(null),tW=(0,i.useRef)(null),tH=(0,i.useRef)(null),tU=(0,i.useRef)(!1),tB=(0,i.useRef)(!0),[tq,tV]=(0,i.useState)(!1),[tK,tG]=(0,i.useState)(null),tJ=(0,i.useRef)(void 0),tY=(0,i.useRef)(0),tZ=(0,i.useRef)(null),tQ=(0,i.useRef)(0),tX=(0,i.useRef)(()=>{}),t0=(0,i.useRef)(null),t1=(0,i.useRef)(null),t2=(0,i.useRef)(null),t8=(0,i.useRef)(null),t4=(0,i.useRef)(!1),t5=(0,i.useRef)(null),t6=(0,i.useRef)(null),t3=(0,i.useRef)(null),t7=(0,i.useRef)(null),t9=(0,i.useRef)(null),ne=(0,i.useRef)(0),nt=(0,i.useRef)(null),nn=(0,i.useRef)(null),nr=(0,i.useRef)(!1);nr.current=e.transitioning??!1;let ni=(0,i.useRef)(Date.now()),ns=(0,i.useRef)(0),na=(0,i.useRef)(0),nl=(0,i.useRef)(null),no=(0,i.useRef)(!1),nc=(0,i.useRef)(Promise.resolve()),nd=e.setToolPreset??es,nu=eI??g?.context.model??eE??null,nh=m?Q??en:nu,np=(0,i.useMemo)(()=>{if(e0)return{...e0,totalActiveMs:g?.totalActiveMs};let e={input:0,output:0,cacheRead:0,cacheWrite:0,total:0},n=0,r=0,i=0,s=0,a=0;for(let t of S){if("user"===t.role&&(r+=1),"toolResult"===t.role&&(s+=1),"assistant"!==t.role)continue;i+=1;let l=t.usage;a+=t.content.filter(e=>"toolCall"===e.type).length,l&&(e.input+=l.input??0,e.output+=l.output??0,e.cacheRead+=l.cacheRead??0,e.cacheWrite+=l.cacheWrite??0,n+=l.cost?.total??0)}return(e.total=e.input+e.output+e.cacheRead+e.cacheWrite,0===e.total&&0===S.length)?null:{sessionFile:g?.filePath||void 0,sessionId:tS.current??t?.id??"",sessionName:t?.name,userMessages:r,assistantMessages:i,toolCalls:a,toolResults:s,totalMessages:S.length,tokens:e,cost:n,totalActiveMs:g?.totalActiveMs,...ek?{contextUsage:ek}:{}}},[S,e0,ek,g?.filePath,g?.totalActiveMs,t?.id,t?.name]),nm=(0,i.useRef)(0),nf=(0,i.useCallback)((e,t)=>{e&&tS.current===e&&Array.isArray(t)&&(nm.current+=1,tg(n=>n?.sid===e&&hf(n.phases,t)?n:{sid:e,phases:t}))},[]),ng=(0,i.useCallback)((e,t,n)=>{tS.current===e&&nm.current===n&&Array.isArray(t)&&tg(n=>n?.sid===e&&hf(n.phases,t)?n:{sid:e,phases:t})},[]),nx=(0,i.useCallback)(e=>{let t="function"==typeof e?e(tN.current):e;tN.current=t,C(t)},[]),nv=(0,i.useCallback)(e=>{tT.current=e,T(e)},[]),ny=(0,i.useCallback)(async(e,t=!1,n=!1,r)=>{let i=!1;try{t&&y(!0);let s=r??null;if(!s){let n=new URLSearchParams({deferThinking:"1",deferMedia:"1"}),r=await fetch(`/api/sessions/${encodeURIComponent(e)}?${n}`);if(404===r.status)return t&&(x(null),j(null),nx([]),M(null),w(null)),null;if(!r.ok)throw Error(`HTTP ${r.status}`);s=await r.json()}if(tS.current!==e)return null;x(s),j(s.leafId),tC.current=s.leafId??null;let a=tl(s.context.messages,s.context.entryIds??[],tI.current.sessionId===e?tI.current.outputs:[]);nx(a.messages),nv(a.entryIds),M(s.context.compactedWork??null),ej(s.contextUsage??null),eM(e=>no.current?e:null),w(null);let l=!n&&t9.current===e;if(l||(eo(s.context.configuredThinkingLevel??s.context.thinkingLevel??"off"),ed(s.context.thinkingLevel)),eh(s.context.thinkingCeiling??null),i=!0,t&&y(!1),!n){if(l)try{let t=ne.current,n=await fetch(`/api/sessions/${encodeURIComponent(e)}/state`);if(n.ok&&tS.current===e){let r=await n.json();tS.current===e&&ne.current===t&&(r.state?.thinkingLevel!==void 0?(eo(r.state.configuredThinkingLevel??r.state.thinkingLevel),ed(r.state.thinkingLevel)):r.running||(t9.current=null,eo(s.context.configuredThinkingLevel??s.context.thinkingLevel??"off"),ed(s.context.thinkingLevel)))}}catch(e){console.error("Failed to refresh live thinking level:",e)}return null}try{let t=nm.current,n=await fetch(`/api/sessions/${encodeURIComponent(e)}/state`);if(!n.ok)throw Error(`HTTP ${n.status}`);let r=await n.json();if(tS.current!==e)return null;let i=r.state;return i?(void 0!==i.contextUsage&&ej(i.contextUsage??null),void 0!==i.systemPrompt&&eC(i.systemPrompt??null),void 0!==i.thinkingLevel&&(t9.current=e,eo(i.configuredThinkingLevel??i.thinkingLevel),ed(i.thinkingLevel)),void 0!==i.thinkingCeiling&&eh(i.thinkingCeiling??null),void 0!==i.extensionStatuses&&te(i.extensionStatuses??[]),void 0!==i.extensionWidgets&&tr(i.extensionWidgets??[]),void 0!==i.queuedMessages&&to(hh(i.queuedMessages)),void 0!==i.subagents&&td(e=>hd(e,i.subagents??[])),ng(e,i.todoPhases,t)):r.running||to({steering:[],followUp:[]}),r}catch(e){return console.error("Failed to load agent state:",e),null}}catch(e){return w(String(e)),null}finally{t&&!i&&y(!1)}},[ng,nv,nx]),nb=(0,i.useCallback)(e=>{let t=nc.current.then(async()=>{tS.current===e&&await ny(e)});return nc.current=t.catch(()=>{}),t},[ny]),nw=(0,i.useCallback)(async(e,t)=>{let n=++ev.current;try{let r=new URLSearchParams({deferThinking:"1",deferMedia:"1"});t&&r.set("leafId",t);let i=`/api/sessions/${encodeURIComponent(e)}/context?${r}`,s=await fetch(i);if(!s.ok)throw Error(`HTTP ${s.status}`);let a=await s.json();if(ev.current!==n||tS.current!==e)return;tC.current=t;let l=tl(a.context.messages,a.context.entryIds??[],tI.current.sessionId===e?tI.current.outputs:[]);nx(l.messages),nv(l.entryIds),M(a.context.compactedWork??null),ej(a.contextUsage??null)}catch(e){console.error("Failed to load context:",e)}},[nv,nx]),nk=(0,i.useCallback)(async e=>{try{let t=await u5(e,{type:"get_tools"});if(t){let{getPresetFromTools:e}=await Promise.resolve().then(n.bind(n,14755));nd(e(t))}}catch(e){console.error("Failed to load tools:",e)}},[nd]),nj=(0,i.useCallback)((e=0,t="(no messages)")=>{let n=tS.current;if(!m||!r||!n||t4.current)return;let i=t5.current??r;t4.current=!0,o?.({id:n,path:"",cwd:i,...i!==r?{projectRoot:r}:{},name:void 0,created:new Date().toISOString(),modified:new Date().toISOString(),messageCount:e,firstMessage:t,transient:!0})},[m,r,o]),nC=(0,i.useCallback)(async()=>{if(t2.current)return t2.current;let t=tS.current;if(t&&nn.current!==t||!t&&(!m||!r))return t;let n=(async()=>{let n=t;if(!n){let t=t6.current,i=t7.current,s=t3.current;t&&eR(t);let a={cwd:r,type:"ensure_session",toolNames:(0,up.xG)(ei),...void 0!==e.newSessionAutoWorktree?{autoWorktree:e.newSessionAutoWorktree}:{},...t?{provider:t.provider,modelId:t.modelId}:{},...i?{thinkingLevel:i}:{},...t&&null!==s?{oauthPosition:s}:{}},l=JSON.stringify(a),o=t8.current,c=o?.body===l?o.createRequestId:hb();t8.current={body:l,createRequestId:c};let d=await fetch("/api/agent/new",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...a,createRequestId:c})});if(!d.ok)throw Error((await d.json().catch(()=>({}))).error??`HTTP ${d.status}`);let u=await d.json();t8.current=null,n=u.sessionId,tS.current=n,t5.current=u.cwd??r??null,t5.current&&ea(t5.current,u.worktree),null!==nt.current&&(nn.current=n),u.model&&t6.current===t&&(eR(u.model),t||er(u.model)),u.thinkingLevel&&t7.current===i&&(eo(u.configuredThinkingLevel??u.thinkingLevel),ed(u.thinkingLevel))}for(;nn.current===n;){let e=nt.current;await u5(n,{type:"set_thinking_ceiling",ceiling:e}),nt.current===e&&nn.current===n&&(nn.current=null)}return n})();t2.current=n;try{return await n}finally{t2.current=null}},[m,r,ei,e.newSessionAutoWorktree]),nT=(0,i.useCallback)(async()=>{let e=tS.current??await nC();if(!e)return eJ([]),[];eZ(!0);try{let t=await u5(e,{type:"get_commands"}),n=t?.commands??[];return eJ(n),n}catch(e){return console.error("Failed to load slash commands:",e),eJ([]),[]}finally{eZ(!1)}},[nC]),nE=(0,i.useCallback)(()=>{tk.current+=1,tj.current=!1,tw.current&&(clearTimeout(tw.current),tw.current=null)},[]),nR=(0,i.useCallback)(()=>{tx.current?.close(),tx.current=null,tv.current=null,ty.current=null},[]),n$=(0,i.useCallback)(()=>{tb.current?.close(),tb.current=null},[]),nL=(0,i.useCallback)(e=>{n$();let t=new EventSource(`/api/agent/${encodeURIComponent(e)}/events?entries=1`);tb.current=t,t.onmessage=t=>{try{let n=JSON.parse(t.data);"session_snapshot"===n.type?tD.current?.(n):"agent_start"===n.type&&tW.current?.(e)}catch{}}},[n$]),nP=(0,i.useCallback)(e=>{nR();let t=new EventSource(`/api/agent/${encodeURIComponent(e)}/events`);tx.current=t,tv.current=e;let n=new Promise(n=>{let r=!1,i=e=>{r||(r=!0,clearTimeout(s),ty.current?.source===t&&(ty.current.pending=!1),n({status:e,source:t}))},s=setTimeout(()=>i("timeout"),5e3);t.onmessage=e=>{try{let t=JSON.parse(e.data);"update_maintenance"===t.type&&window.dispatchEvent(new CustomEvent("ompweb:update-maintenance",{detail:t})),"connected"===t.type&&i("connected"),tD.current?.(t)}catch{}},t.onerror=()=>{if(t.readyState===EventSource.CLOSED&&(i("closed"),tx.current===t&&(tM.current||tj.current))){tx.current=null,tv.current=null,ty.current=null;let t=tk.current;setTimeout(()=>{t===tk.current&&!tx.current&&(tM.current||tj.current)&&nP(e)},1e3)}}});return ty.current={source:t,promise:n,pending:!0},n},[nR]),nA=(0,i.useCallback)(async e=>{let t=tx.current;if(t&&tv.current===e){if(t.readyState===EventSource.OPEN)return;let e=ty.current;if(e?.source===t&&e.pending&&(await e.promise,tx.current===t&&t.readyState===EventSource.OPEN))return}let n=await nP(e);if("connected"!==n.status&&n.source.readyState!==EventSource.OPEN)throw tx.current===n.source&&(tx.current=null),tv.current===e&&(tv.current=null),ty.current?.source===n.source&&(ty.current=null),n.source.close(),new hy(n.status)},[nP]),n_=(0,i.useCallback)(async(e,t)=>{let n=e6.current;if(n?.id===e.id&&"sending"===n.status)return;let r=tS.current,i=e=>{e6.current=e,e5(e)};if(!r)return void i({id:e.id,status:"failed",error:"no session"});i({id:e.id,status:"sending"});try{await u5(r,{type:"extension_ui_response",id:e.id,...t})}catch(t){i({id:e.id,status:"failed",error:t instanceof Error?t.message:String(t)});return}i(null),e8(t=>t?.id===e.id?null:t)},[]),nF=(0,i.useCallback)(async(e,t)=>{let n=tS.current;if(n)try{await u5(n,{type:"extension_ui_input",id:e.id,data:t})}catch(e){console.error("Failed to send extension custom UI input:",e)}},[]),nO=(0,i.useCallback)(e=>{let t=e.message.trim();t&&eX({type:"add",notice:{id:e.id??hb(),message:t,type:e.type??"info"}})},[]),nz=(0,i.useCallback)(e=>{let t={role:"custom",customType:tt,content:eP(e).trim(),display:!0,timestamp:Date.now()},n=tI.current,r=tS.current;n.sessionId!==r&&(n.sessionId=r,n.outputs=[]);let i=tT.current.slice(0,tN.current.length),s=null;for(let e=i.length-1;e>=0;e--)if(!ta(i[e])){s=i[e];break}n.seq+=1,n.outputs.push({entryId:`${ts}${n.seq}`,baseEntryId:s,message:t});let a=tl(tN.current,tT.current,n.outputs);nx(a.messages),nv(a.entryIds)},[nx,nv]),nD=(0,i.useCallback)(t=>{if("custom"!==t.method&&"closed"in t&&t.closed){e8(e=>e?.id===t.id?null:e),e6.current?.id===t.id&&(e6.current=null,e5(null));return}switch(u2(t)&&l?.(t),t.method){case"select":case"confirm":case"input":case"editor":case"ask":case"form":case"plan_review":e8(t);break;case"notify":nO({id:t.id,message:t.message,type:t.notifyType??"info"});break;case"setStatus":te(e=>{let n=e.filter(e=>e.key!==t.statusKey);return void 0!==t.statusText?[...n,{key:t.statusKey,text:t.statusText}]:n});break;case"setWidget":tr(e=>{let n=e.filter(e=>e.key!==t.widgetKey);return t.widgetLines?[...n,{key:t.widgetKey,lines:t.widgetLines,placement:t.widgetPlacement??"aboveEditor"}]:n});break;case"setTitle":t.title&&(document.title=t.title);break;case"set_editor_text":e.chatInputRef?.current?.insertText(t.text);break;case"custom":e7(e=>t.closed?e?.id===t.id?null:e:t)}},[nO,l,e.chatInputRef]),nW=(0,i.useCallback)(()=>{let e=tM.current;return tM.current=!1,L(!1),eK(null),hM(tE.current),ew(null),R({type:"end"}),e},[]),nH=(0,i.useCallback)(()=>{tP.current="unknown",tA.current=null;let e=hx(tN.current,tT.current);t_.current=e?{entryId:e.entryId,key:hN(e.message)}:null,tF.current+=1},[]),nU=(0,i.useCallback)(()=>{let e=tP.current,t=tA.current;if("unknown"===e){let n=hx(tN.current,tT.current),r=n?.message,i=t_.current;null!==n&&(null===i||(null!==n.entryId&&null!==i.entryId?n.entryId!==i.entryId:hN(n.message)!==i.key))&&r?.role==="assistant"&&r.stopReason&&(e=hg(r),t??={provider:r.provider,...r.model?{model:r.model}:{},...void 0!==r.credentialId?{credentialId:r.credentialId}:{}})}return{outcome:e,sessionId:tS.current,...t?{provider:t.provider,...t.model?{model:t.model}:{},...void 0!==t.credentialId?{credentialId:t.credentialId}:{}}:{}}},[]),nB=(0,i.useCallback)(e=>{let t=nU();if("unknown"!==t.outcome||!e)return void a?.(t);let n=tF.current;e.catch(()=>void 0).then(()=>{let e=tS.current===t.sessionId&&tF.current===n;a?.(e?nU():t)})},[a,nU]),nq=(0,i.useCallback)((e,t)=>tL.current!==e&&(tL.current=e,nB(t),!0),[nB]),nV=(0,i.useCallback)(e=>{nE(),tj.current=!0;let t=tk.current,n=async()=>{if(t===tk.current&&tS.current===e&&tj.current)try{let r=nm.current,i=await fetch(`/api/agent/${encodeURIComponent(e)}`);if(!i.ok)throw Error(`HTTP ${i.status}`);let s=await i.json();if(t!==tk.current||tS.current!==e||!tj.current)return;let a=s.state;if(td(e=>hd(e,a?.subagents??[])),ng(e,a?.todoPhases,r),s.running&&a&&(a.isStreaming||a.isPromptRunning||a.isHandoffRunning)){tj.current=!1,tw.current=null,tR.current=!!a?.isStreaming,t$.current=!!a?.isPromptRunning,tM.current=!0,L(!0),eK(a?.isStreaming?{kind:"waiting_model"}:{kind:"running_command"});return}if(s.running&&a?.isCompacting){e_(!0),eH(hm(a)),tw.current=setTimeout(()=>void n(),600);return}if(s.running&&(a?.subagents?.length??0)>0){tw.current=setTimeout(()=>void n(),1e3);return}tj.current=!1,tw.current=null,nR()}catch{if(t!==tk.current||tS.current!==e||!tj.current)return;tw.current=setTimeout(()=>void n(),600)}};tw.current=setTimeout(()=>void n(),3e4)},[ng,nE,nR]),nK=(0,i.useCallback)(async(e=tS.current,t=ns.current)=>{if(ns.current===t)try{e&&await ny(e)}finally{if(ns.current!==t)return;let n=t$.current,r=tR.current;t$.current=!1,tR.current=!1,nl.current=null;let i=nW();n?nq(t):r&&i&&nB(),e&&nV(e)}},[ny,nB,nq,nV,nW]),nG=(0,i.useCallback)(async(e,t)=>{await hw(800);let n=Date.now();for(;tM.current&&Date.now()-n<2e4;){if(void 0!==t&&ns.current!==t)return;try{let n=await fetch(`/api/agent/${encodeURIComponent(e)}`);if(n.ok){let r=await n.json(),i=r.state;if(!r.running||!i||!i.isStreaming&&!i.isPromptRunning)return void await nK(e,t)}}catch{}await hw(600)}},[nK]),nJ=(0,i.useCallback)(async e=>{let t=tz.current+1;for(tz.current=t;tO.current&&tz.current===t&&tS.current===e;){await hw(1e3);try{let n=await fetch(`/api/agent/${encodeURIComponent(e)}`);if(!n.ok)continue;let r=await n.json();if(r.state?.isBashRunning)continue;if(await ny(e),tz.current!==t||tS.current!==e)return;tO.current=!1,A(!1),F(null);return}catch{}}},[ny]),nY=(0,i.useCallback)(async e=>{if(!tM.current)return;let t=ns.current;try{let n=nm.current,r=await fetch(`/api/agent/${encodeURIComponent(e)}`);if(!r.ok)return;let i=await r.json();if(ns.current!==t)return;let s=i.state;if(e_(s?.isCompacting??!1),eH(hm(s)),to(hh(s?.queuedMessages)),s?.contextUsage!==void 0&&ej(s.contextUsage??null),td(e=>hd(e,s?.subagents??[])),ng(e,s?.todoPhases,n),i.running&&s&&(s.isStreaming||s.isPromptRunning||s.isCompacting||s.isHandoffRunning)||!tM.current)return;s&&(void 0!==s.systemPrompt&&eC(s.systemPrompt??null),void 0!==s.extensionStatuses&&te(s.extensionStatuses??[]),void 0!==s.extensionWidgets&&tr(s.extensionWidgets??[])),await nK(e,t)}catch{}},[ng,nK]),nZ=(0,i.useCallback)(async e=>{let t=await ny(e,!1,!0),n=t?.state;return!!t?.running&&!!n&&tS.current===e&&!tM.current&&!!(n.isStreaming||n.isPromptRunning||n.isHandoffRunning)&&(tR.current=!!n.isStreaming,t$.current=!!n.isPromptRunning,tM.current=!0,L(!0),eK(n.isStreaming?{kind:"waiting_model"}:{kind:"running_command"}),R({type:"start"}),hE(tE.current,e,n.pendingToolCalls),nP(e),!n.isStreaming&&n.isPromptRunning&&nG(e),!0)},[nP,ny,nG]),nQ=(0,i.useCallback)(async(e,t=ns.current)=>{let n=na.current+1;na.current=n;try{let r=await fetch(`/api/agent/${encodeURIComponent(e)}`);if(!r.ok)return;let i=await r.json();if(n!==na.current||tS.current!==e||ns.current!==t)return;i.state?.contextUsage!==void 0&&ej(i.state.contextUsage??null)}catch{}},[]);(0,i.useEffect)(()=>{if(!eA){eU.current=null,eH(null);return}eH(e=>e??{startedAt:Date.now(),reason:eU.current})},[eA]),(0,i.useEffect)(()=>{if(!$&&!eA)return;let e=()=>{let e=tS.current;e&&nQ(e)};e();let t=setInterval(e,1e3);return()=>clearInterval(t)},[$,eA,nQ]),(0,i.useEffect)(()=>{if(!$)return;let e=()=>{let e=tS.current;e&&nY(e)},t=()=>{"visible"===document.visibilityState&&e()},n=setInterval(e,15e3);return document.addEventListener("visibilitychange",t),window.addEventListener("online",e),()=>{clearInterval(n),document.removeEventListener("visibilitychange",t),window.removeEventListener("online",e)}},[$,nY]),(0,i.useEffect)(()=>{if($)return;let e=()=>{let e=tS.current;e&&!tM.current&&nZ(e)},t=()=>{"visible"===document.visibilityState&&e()},n=e=>{let t=tS.current,n=e.detail?.sessionId;t&&n===t&&!tM.current&&nZ(t).then(e=>{e||tS.current!==t||tM.current||ny(t)})};return document.addEventListener("visibilitychange",t),window.addEventListener("online",e),window.addEventListener(ht,n),()=>{document.removeEventListener("visibilitychange",t),window.removeEventListener("online",e),window.removeEventListener(ht,n)}},[$,nZ,ny]),tW.current=e=>{if(tS.current!==e||tM.current||tx.current||tH.current)return;let t=nZ(e).then(async t=>{t||tS.current!==e||tM.current||await ny(e)}).catch(()=>{}).finally(()=>{tH.current===t&&(tH.current=null)});tH.current=t},(0,i.useEffect)(()=>{tM.current=$},[$]),tD.current=(0,i.useCallback)(e=>{var t;switch(e.type){case"session_snapshot":{let t=function(e,t,n,r,i){if("session_snapshot"!==e.type||"string"!=typeof e.sessionId||e.sessionId!==t||"string"!=typeof e.entryId||""===e.entryId||e.entryId===n||!e.context||!Array.isArray(e.context.messages)||!Array.isArray(e.context.entryIds)||e.context.messages.length!==e.context.entryIds.length)return null;let s=e.context.messages,a=new Map;for(let e of s){let t=hN(e);a.set(t,(a.get(t)??0)+1)}let l=Math.min(r.length,i.length);for(let e of r.slice(0,l)){let t=hN(e),n=a.get(t)??0;n>0&&a.set(t,n-1)}let o=r.slice(l).filter(e=>{let t=hN(e),n=a.get(t)??0;return 0===n||(a.set(t,n-1),!1)});return{entryId:e.entryId,messages:[...s,...o],entryIds:[...e.context.entryIds],compactedWork:e.context.compactedWork??null}}(e,tS.current,tC.current,tN.current,tT.current);if(!t)break;tC.current=t.entryId;let n=tl(t.messages,t.entryIds,tI.current.sessionId===tS.current?tI.current.outputs:[]);nx(n.messages),nv(n.entryIds),M(t.compactedWork);break}case"agent_start":{let e=!tM.current;nE(),e&&nH(),tR.current=!0,tM.current=!0,L(!0),eK({kind:"waiting_model"}),R({type:"start"});break}case"agent_end":if(!tM.current)break;if(eK(null),hM(tE.current),ew(null),R({type:"end"}),tS.current){ny(tS.current);let e=nm.current;fetch(`/api/agent/${encodeURIComponent(tS.current)}`).then(e=>e.json()).then(t=>{t.state?.contextUsage!==void 0&&ej(t.state.contextUsage??null),t.state?.systemPrompt!==void 0&&eC(t.state.systemPrompt??null),t.state?.extensionStatuses!==void 0&&te(t.state.extensionStatuses??[]),t.state?.extensionWidgets!==void 0&&tr(t.state.extensionWidgets??[]),t.state?.subagents!==void 0&&td(e=>hd(e,t.state?.subagents??[])),tS.current&&ng(tS.current,t.state?.todoPhases,e),t.state?.goal!==void 0&&tG(t.state.goal??null),to(hh(t.state?.queuedMessages))}).catch(()=>{})}break;case"goal_status":tG(e.status??null);break;case"agent_settled":{let e=tR.current;if(tR.current=!1,!e||t$.current)break;let t=tS.current,n=nW();e_(!1);let r=t?ny(t):void 0;t&&nV(t),n&&nB(r);break}case"prompt_done":{let e=ns.current,t=t$.current;t$.current=!1,nl.current=null;let n=tL.current!==e;if(!t&&!n)break;let r=tS.current;nq(e,r?ny(r):void 0),!tR.current&&(nW(),r&&nV(r))}break;case"prompt_error":tP.current="failed",nO({type:"error",message:e.errorMessage??"Command failed"});break;case"extension_error":tP.current="failed",nO({type:"error",message:e.error??"Extension command failed"});break;case"message_start":case"message_update":{if(!tM.current)break;let t=e.message;if(t?.role!=="assistant")break;t&&R({type:"update",message:oi(t)}),eK(null);break}case"message_end":{if(!tM.current)break;let t=e.message;if(t?.role==="assistant"&&(tA.current={provider:t.provider,...t.model?{model:t.model}:{},...void 0!==t.credentialId?{credentialId:t.credentialId}:{}},tP.current=hg(t)),t&&"user"===t.role){let e=oi(t),n=hC(e),r=nl.current;nl.current=null,nx(t=>{let i=t[t.length-1];return r&&i?.role==="user"&&hC(i)===r?r===n?t:[...t.slice(0,-1),e]:[...t,e]}),r||th({type:"user-message",kind:lG(e),text:lK(e),images:"user"!==e.role||"string"==typeof e.content?0:e.content.filter(e=>"image"===e.type).length})}else t&&nx(e=>[...e,oi(t)]);let n=tS.current;n&&nQ(n),R({type:"reset"}),eK(e=>t?.role==="toolResult"&&e?.kind==="running_tools"?e:{kind:"waiting_model"});break}case"thinking_level_changed":{let t=tS.current,n=e.thinkingLevel;t&&void 0!==n&&(t9.current=t,ne.current+=1,eo(e.configured??n),ed(n));break}case"todo_changed":nf(tS.current,e.phases);break;case"tool_execution_start":{let t=e.toolCallId,n=e.toolName,r=e.args,i=nI(tS.current,t);i&&tE.current.add(i),eK(e=>{let i=e?.kind==="running_tools"?[...e.tools]:[];return i.some(e=>e.id===t)||i.push({id:t,name:n,args:r}),{kind:"running_tools",tools:i}});break}case"tool_execution_update":{let n=nI(tS.current,"string"==typeof e.toolCallId?e.toolCallId:null);n&&tE.current.has(n)&&"string"==typeof e.text&&(t=e.text,nS.get(n)!==t&&(nS.set(n,t),nN()));break}case"tool_execution_end":{let t=e.toolCallId,n=nI(tS.current,t);n&&tE.current.delete(n)&&nM([n]),eK(e=>{if(e?.kind!=="running_tools")return e;let n=e.tools.filter(e=>e.id!==t);return 0===n.length?{kind:"waiting_model"}:{kind:"running_tools",tools:n}});break}case"subagent_lifecycle":{let t=e.payload;if(!t?.id)break;if("started"!==t.status){let e="failed"===t.status?"failed":"aborted"===t.status?"aborted":"completed";td(n=>{let r=n.find(e=>e.id===t.id);return hd(n,[{id:t.id,index:t.index??r?.index??0,agent:t.agent??r?.agent??t.id,agentSource:t.agentSource??r?.agentSource??"bundled",description:t.description??r?.description,status:e,task:r?.task,assignment:r?.assignment,sessionFile:t.sessionFile??r?.sessionFile,parentToolCallId:t.parentToolCallId??r?.parentToolCallId,lastUpdate:Date.now(),progress:r?.progress?{...r.progress,status:e}:void 0}])});break}let n={id:t.id,index:t.index??0,agent:t.agent??t.id,agentSource:t.agentSource??"bundled",description:t.description,status:"running",sessionFile:t.sessionFile,parentToolCallId:t.parentToolCallId,lastUpdate:Date.now()};td(e=>hd(e,[n]));break}case"subagent_progress":{let t=e.payload;if(!t?.progress)break;let n=t.progress,r={id:n.id,index:t.index??n.index,agent:t.agent??n.agent,agentSource:t.agentSource??"bundled",description:n.description,status:n.status,task:t.task??n.task,assignment:t.assignment??n.assignment,sessionFile:t.sessionFile,parentToolCallId:t.parentToolCallId,lastUpdate:Date.now(),progress:n};td(e=>hd(e,[r]));break}case"queue_update":to({steering:[...e.steering??[]],followUp:[...e.followUp??[]]});break;case"auto_retry_start":ew({attempt:e.attempt,maxAttempts:e.maxAttempts,errorMessage:e.errorMessage});break;case"auto_retry_end":ew(null);break;case"auto_compaction_start":case"compaction_start":if("string"==typeof e.reason){eU.current=e.reason;let t=e.reason;eH(e=>e?{...e,reason:t}:e)}e_(!0),eO(null),eD(null);break;case"auto_compaction_end":case"compaction_end":if(e_(!1),e.errorMessage)eO(e.errorMessage),eD(null);else if(!e.aborted){eD(hT(e.result,e.reason??"auto"));let t=tS.current;t&&(ny(t),nQ(t))}break;case"extension_ui_request":nD(e)}},[nO,nf,ng,nE,nD,ny,nB,nq,nQ,nH,nV,nW,nv,nx]);let nX=(0,i.useCallback)(async(n,i,s)=>{let a=n.trim();if(!a&&!i?.length&&!s?.length)return"returned";if(tM.current||tO.current||no.current)return"unknown";let l=iG(n,s??[]),o=!i?.length&&!s?.length&&a.startsWith("/");if(!i?.length&&!s?.length&&a.startsWith("!")){let e=a.startsWith("!!"),t=(e?a.slice(2):a.slice(1)).trim();return t?(await tJ.current?.(t,e),"accepted"):"unknown"}nH();let c=ns.current+1;nE(),t$.current=!0;let d=i?.map(e=>({type:"image",source:{type:"base64",media_type:e.mimeType,data:e.data}})),u={role:"user",content:d?.length?[...l.trim()?[{type:"text",text:l}]:[],...d]:l,timestamp:Date.now()};nx(e=>[...e,u]),nl.current=hC(u),ns.current=c,tM.current=!0,L(!0),eK(o?{kind:"running_command"}:{kind:"waiting_model"}),R({type:"start"}),tX.current(!0);let h=i?.map(e=>({type:"image",data:e.data,mimeType:e.mimeType})),p=null,f=!1,g="unknown";try{if(m&&r){let e=tS.current??await t2.current,t=await nC();t&&(p=t,Q&&(eR(Q),e&&await u5(t,{type:"set_model",provider:Q.provider,modelId:Q.modelId})),await nA(t),f=!0,await u5(t,{type:"prompt",message:l,...h?.length?{images:h}:{}}),nj(1,n),g="accepted")}else t&&(p=t.id,await nA(t.id),f=!0,await u5(t.id,{type:"prompt",message:l,...h?.length?{images:h}:{}}),g="accepted");return o&&p&&nG(p,c),g}catch(l){console.error("Failed to send message:",l);let r=l instanceof u4&&"update_draining"===l.code&&!1===l.accepted;if(!(!f||l instanceof u4&&"prompt_rejected"===l.code&&!1===l.accepted||r)&&p)return nG(p,c),"unknown";t$.current=!1,tM.current=!1,nR();let a=nl.current;return a&&nx(e=>{let t=e[e.length-1];return t?.role==="user"&&hC(t)===a?e.slice(0,-1):e}),nO({type:"error",message:l instanceof Error?l.message:String(l)}),e.chatInputRef?.current?.restoreSubmission?.(n,hI(i),s,t?.id??p??void 0),nl.current=null,L(!1),eK(null),R({type:"end"}),"returned"}},[m,r,Q,t,nC,nA,nj,nG,nO,nE,nR,e.chatInputRef,nH,nx]);tJ.current=(0,i.useCallback)(async(n,r)=>{if(tM.current||tO.current)return;let i=`${r?"!!":"!"}${n}`;tO.current=!0,tX.current(!0),F({command:n,excludeFromContext:r}),A(!0);try{let e=tS.current??t?.id??await nC();if(!e)throw Error("Unable to create a session for the shell command");await u5(e,{type:"bash",command:n,excludeFromContext:r}),await ny(e),nj(1,i)}catch(t){console.error("Failed to execute shell command:",t),nO({type:"error",message:t instanceof Error?t.message:String(t)}),e.chatInputRef?.current?.insertIfEmpty(i)}finally{tO.current=!1,F(null),A(!1)}},[nO,nC,ny,e.chatInputRef,nj,t]);let n0=(0,i.useCallback)(async()=>{let e=tS.current;if(e){if(tO.current){try{await u5(e,{type:"abort_bash"})}catch(e){console.error("Failed to abort bash:",e)}return}try{await u5(e,{type:"abort"}),tP.current="aborted"}catch(e){console.error("Failed to abort:",e)}}},[]),n1=(0,i.useCallback)(async e=>{if(tO.current)return{forked:!1,error:"Cannot fork while a shell command is running"};let t=tS.current;if(!t)return{forked:!1,error:"No active session to fork"};eT(e??null);try{let{cancelled:n,newSessionId:r}=await u5(t,{type:"fork",...e?{entryId:e}:{}})??{};if(!n&&r)return c?.(r),{forked:!0};return{forked:!1,error:"Fork was cancelled"}}catch(e){return console.error("Fork failed:",e),{forked:!1,error:e instanceof Error?e.message:String(e)}}finally{eT(null)}},[c]),n2=(0,i.useCallback)(async e=>{if(tO.current)return;let t=tS.current;t&&(u5(t,{type:"navigate_tree",targetId:e}).catch(()=>{}),j(e),await nw(t,e))},[nw]),n8=(0,i.useCallback)(async e=>{if(tO.current)return;j(e);let t=tS.current;t&&(await nw(t,e),e&&u5(t,{type:"navigate_tree",targetId:e}).catch(()=>{}))},[nw]),n4=(0,i.useCallback)(async(e,t)=>{if(m){let n={provider:e,modelId:t},r=t6.current?.provider===e;t6.current=n,r||(t3.current=null,et(null)),X(n),eR(n);let i=tS.current??await t2.current;if(!i)return;try{await u5(i,{type:"set_model",provider:e,modelId:t})}catch(e){console.error("Failed to set model:",e)}return}let n=tS.current;if(n&&!no.current){no.current=!0,eM({provider:e,modelId:t}),eL(!0);try{await u5(n,{type:"set_model",provider:e,modelId:t}),no.current=!1,await ny(n)}catch(e){console.error("Failed to set model:",e),no.current=!1,eM(eI),nO({type:"error",message:`Failed to switch model: ${e instanceof Error?e.message:String(e)}`}),await ny(n)}finally{no.current=!1,eL(!1)}}},[nO,eI,m,ny,X]),n5=(0,i.useCallback)(async e=>{let t={provider:e.provider,modelId:e.modelId},n=e.oauthPosition,r={type:"set_model",provider:e.provider,modelId:e.modelId,thinkingLevel:"auto",...void 0!==n?{oauthPosition:n}:{}},i=t=>`${e.alias} preset was not applied: ${t instanceof Error?t.message:String(t)}`;if(m){if(no.current)return!1;no.current=!0,eL(!0);let e=t6.current,s=t3.current,a=t7.current;try{t6.current=t,t3.current=n??null,t7.current="auto";let e=tS.current??await t2.current;return e&&await u5(e,r),X(t),et(n??null),eR(t),eo("auto"),ed(void 0),e&&await ny(e),!0}catch(n){console.error("Failed to apply Main preset:",n),t6.current=e,t3.current=s,t7.current=a,nO({type:"error",message:i(n)});let t=tS.current;return t&&await ny(t),!1}finally{no.current=!1,eL(!1)}}let s=tS.current;if(!s||no.current)return!1;no.current=!0,eM(t),eL(!0);try{return await u5(s,r),await ny(s),!0}catch(e){return console.error("Failed to apply Main preset:",e),eM(eI),nO({type:"error",message:i(e)}),await ny(s),!1}finally{no.current=!1,eL(!1)}},[nO,eI,ec,m,ny,X,el]),n6=(0,i.useCallback)(async e=>{let t=Y.find(t=>t.role===e),n=t?.resolved;if(!n)return;if(m){let e={provider:n.provider,modelId:n.modelId},t=n.thinkingLevel;t7.current=t??null,eo(t??"auto"),ed(void 0),t6.current=e,t3.current=null,et(null),X(e),eR(e)}let r=tS.current??(m?await t2.current:null);if(r)try{await u5(r,{type:"set_role_model",role:e}),m||eM({provider:n.provider,modelId:n.modelId})}catch(e){console.error("Failed to set role model:",e)}},[m,Y,X]),n3=(0,i.useCallback)(async()=>{let e=tS.current;if(e&&!eA){eU.current="manual",e_(!0),eO(null),eD(null);try{let t=await u5(e,{type:"compact"});eD(hT(t,"manual")),await ny(e,!0)}catch(e){eO(e instanceof Error?e.message:String(e)),eD(null)}finally{e_(!1)}}},[eA,ny]),n7=(0,i.useCallback)(async e=>{let n=r??t?.cwd??"",i=n?`/api/models?cwd=${encodeURIComponent(n)}`:"/api/models",s=await fetch(i,e?{signal:e}:void 0);if(!s.ok)throw Error(`HTTP ${s.status}`);let a=await s.json();z(a.models),U(a.modelError??null),q(a.modelScopeWarnings??[]),K(a.thinkingLevels??{}),J(a.thinkingLevelMaps??{}),Z(a.roles??[]);let l=a.modelList??[];if(W(l),m&&!tS.current){let e=(a.defaultModel?l.find(e=>e.id===a.defaultModel?.modelId&&e.provider===a.defaultModel?.provider):void 0)??l[0];er(e?{provider:e.provider,modelId:e.id}:null);let t=e&&a.thinkingLevelPins?.[`${e.provider}/${e.id}`];null===t7.current&&eo(t??"auto")}},[m,r,t?.cwd]),n9=(0,i.useCallback)(async e=>{if(!e.startsWith("/"))return{handled:!1};let t=e.match(/^\/([^\s]+)(?:\s+([\s\S]*))?$/);if(!t)return{handled:!1};let[,n,r=""]=t,i=r.trim(),s=await nC(),a=e=>(e.handled&&(e.error?nO({type:"error",message:e.error}):"openSessionStats"!==e.action&&nO({type:"success",message:e.message??"Command completed"})),e);try{switch(n){case"compact":{if(!s||eA)return a({handled:!0,error:"No active session to compact"});eU.current="manual",e_(!0),eO(null),eD(null);let e=await u5(s,{type:"compact",...i?{customInstructions:i}:{}});return eD(hT(e,"manual")),await ny(s,!0)&&nj(),a({handled:!0,message:"Compacted context"})}case"reload":if(!s)return a({handled:!0,error:"No active session to reload"});return await u5(s,{type:"reload"}),await Promise.all([ny(s,!1,!0),nk(s),nT(),n7()]),a({handled:!0,message:"Reloaded session resources"});case"name":if(!s)return a({handled:!0,error:"No active session to name"});if(!i)return a({handled:!0,error:"Usage: /name <name>"});return await u5(s,{type:"set_session_name",name:i}),await ny(s)&&nj(),a({handled:!0,message:`Session renamed to ${i}`});case"session":{if(!s)return a({handled:!0,error:"No active session"});let e=await u5(s,{type:"get_session_stats"});return e&&e1(e),p?.(),a({handled:!0,action:"openSessionStats"})}case"copy":{if(!s)return a({handled:!0,error:"No active session"});let e=await u5(s,{type:"get_last_assistant_text"}),t=e?.text??"";if(!t)return a({handled:!0,error:"No assistant message to copy"});return await navigator.clipboard.writeText(t),a({handled:!0,message:"Copied last assistant message"})}case"fork":{if(!s)return a({handled:!0,error:"No active session to fork"});let e=await n1();if(!e.forked)return a({handled:!0,error:e.error??"Fork failed"});return a({handled:!0,message:"Forked a new session"})}case"goal":{if(!s)return a({handled:!0,error:"No active session"});let e=await u5(s,{type:"goal",args:i});if(tG(e?.status??null),e?.error)return a({handled:!0,error:e.error});if(e?.message&&e.message.includes("\n")){if(nz(e.message),e.prompt)return{handled:!0,prompt:e.prompt};return{handled:!0}}if(e?.prompt)return e.message&&nO({type:"success",message:e.message}),{handled:!0,prompt:e.prompt};return a({handled:!0,message:e?.message??"Command completed"})}case"handoff":if(!s)return a({handled:!0,error:"No active session"});if(tM.current||tO.current)return a({handled:!0,error:"Cannot hand off while the session is busy"});tM.current=!0,L(!0),eK({kind:"running_command"});try{await nA(s);let e=await u5(s,{type:"handoff",...i?{customInstructions:i}:{}});if(!e||e.cancelled)return a({handled:!0,error:"Handoff cancelled"});return await ny(s,!0)&&nj(),a({handled:!0,message:"컨텍스트를 현재 세션에 압축했습니다"})}finally{tM.current=!1,L(!1),eK(null),tS.current===s&&nV(s)}default:{if(!s)return a({handled:!0,error:"No active session"});let t=await u5(s,{type:"execute_slash_command",message:e});if(!t?.handled)return{handled:!1};let n=t.output?.filter(e=>e.trim()).join("\n\n")??"";if(n&&nz(n),t.prompt)return{handled:!0,prompt:t.prompt};if(n)return{handled:!0};return a({handled:!0,message:"Command completed"})}}}catch(e){return a({handled:!0,error:e instanceof Error?e.message:String(e)})}finally{"compact"===n&&e_(!1)}},[nO,nz,nA,nC,n1,eA,n7,ny,nT,nk,nj,p,nV]),re=(0,i.useCallback)(async(t,n,r)=>{let i=tS.current;if(!i)return nO({type:"error",message:"The session is not ready yet, so the message was returned to the composer."}),e.chatInputRef?.current?.restoreSubmission?.(t,hI(n),r),"returned";let s=iG(t,r??[]),a=n?.map(e=>({type:"image",data:e.data,mimeType:e.mimeType})),l=++tp.current;th({type:"submit",id:l,kind:"steer",text:s,images:a?.length??0});try{return await u5(i,{type:"steer",message:s,...a?.length?{images:a}:{}}),th({type:"ack",id:l}),"accepted"}catch(s){return th({type:"fail",id:l}),console.error("Failed to steer:",s),nO({type:"error",message:s instanceof Error?s.message:String(s)}),e.chatInputRef?.current?.restoreSubmission?.(t,hI(n),r,i),"returned"}},[nO,e.chatInputRef]),rt=(0,i.useCallback)(async(t,n,r,i)=>{let s=tS.current;if(!s)return nO({type:"error",message:"The session is not ready yet, so the message was returned to the composer."}),e.chatInputRef?.current?.restoreSubmission?.(t,hI(r),i),"returned";let a=iG(t,i??[]),l=r?.map(e=>({type:"image",data:e.data,mimeType:e.mimeType})),o=++tp.current;th({type:"submit",id:o,kind:n,text:a,images:l?.length??0});try{return await u5(s,{type:"prompt",message:a,streamingBehavior:n,...l?.length?{images:l}:{}}),th({type:"ack",id:o}),"accepted"}catch(n){return th({type:"fail",id:o}),console.error("Failed to queue prompt:",n),nO({type:"error",message:n instanceof Error?n.message:String(n)}),e.chatInputRef?.current?.restoreSubmission?.(t,hI(r),i,s),"returned"}},[nO,e.chatInputRef]),rn=(0,i.useCallback)(async(t,n,r)=>{let i=tS.current;if(!i)return nO({type:"error",message:"The session is not ready yet, so the message was returned to the composer."}),e.chatInputRef?.current?.restoreSubmission?.(t,hI(n),r),"returned";let s=iG(t,r??[]),a=n?.map(e=>({type:"image",data:e.data,mimeType:e.mimeType})),l=++tp.current;th({type:"submit",id:l,kind:"followUp",text:s,images:a?.length??0});try{return await u5(i,{type:"follow_up",message:s,...a?.length?{images:a}:{}}),th({type:"ack",id:l}),"accepted"}catch(s){return th({type:"fail",id:l}),console.error("Failed to follow up:",s),nO({type:"error",message:s instanceof Error?s.message:String(s)}),e.chatInputRef?.current?.restoreSubmission?.(t,hI(n),r,i),"returned"}},[nO,e.chatInputRef]),rr=(0,i.useCallback)(async()=>{let e=tS.current;if(e)try{await u5(e,{type:"abort_compaction"})}catch(e){console.error("Failed to abort compaction:",e)}},[]),ri=(0,i.useCallback)(async()=>{let t=tS.current;if(t)try{var n;let r=await u5(t,{type:"clear_queue"});th({type:"withdraw"}),to({steering:[],followUp:[]});let i={text:(n=[...r?.steering??[],...r?.followUp??[]]).map(({text:e,images:t})=>t?.length&&"[Image]"===e?"":e).filter(e=>e.trim()).join("\n\n"),images:n.flatMap(({images:e})=>e??[]).map(({data:e,mimeType:t})=>({data:e,mimeType:t}))};e.chatInputRef?.current?.restoreSubmission?.(i.text,i.images.length?i.images:void 0,void 0,t)}catch(e){console.error("Failed to recall queued messages:",e),nO({type:"error",message:"Failed to recall queued messages"})}},[e.chatInputRef,nO]),rs=(0,i.useCallback)(async(e,t)=>{let n=tS.current;if(n)try{let r=await u5(n,{type:"remove_queued_message",message:t,queue:e});if(!r?.removed)return;th({type:"withdraw",kind:"steering"===e?"steer":"followUp",text:t}),to(n=>{let r=n[e].indexOf(t);return(r<0&&""===t.trim()&&(r=n[e].indexOf("[Image]")),r<0)?n:{...n,[e]:n[e].filter((e,t)=>t!==r)}})}catch(e){console.error("Failed to remove queued message:",e),nO({type:"error",message:"Failed to remove queued message"})}},[nO]),ra=(0,i.useCallback)(async(e,t=null)=>{let n="auto"===e?t:null,r=n!==eu;eo(e),eh(n),m&&(!tS.current||nn.current===tS.current)&&(t7.current=e,nt.current=n),ed(void 0);let i=tS.current??await t2.current;if(i)try{nn.current===i?await nC():r&&await u5(i,{type:"set_thinking_ceiling",ceiling:n}),await u5(i,{type:"set_thinking_level",level:e}),await ny(i)}catch(e){console.error("Failed to set thinking level:",e),nO({type:"error",message:"Failed to set thinking level"}),await ny(i)}},[m,ny,nO,eu,nC]);ey.current=nh?`${nh.provider}/${nh.modelId}`:"";let rl=e=>e?`${e}|${ey.current}`:null,ro=t?.id??tS.current,rc=rl(ro),rd=ep&&ep.key===rc?ep.value:null;(0,i.useEffect)(()=>{let e=++ex.current;rc&&ro&&!$&&!e$&&fetch(`/api/agent/${encodeURIComponent(ro)}`).then(e=>e.json()).then(t=>{ex.current===e&&rl(tS.current)===rc&&em({key:rc,value:(t.running?hp(t.state):void 0)??null})}).catch(()=>{})},[rc,$,e$]);let ru=(0,i.useCallback)(async()=>{let e=tS.current??await nC(),t=rl(tS.current);if(!e||!t)return;let n=++ex.current,r=()=>ex.current===n&&rl(tS.current)===t,i=e=>{r()&&em({key:t,value:e})};eg(!0);try{let n=ep?.key===t?ep.value?.enabled:void 0;if(void 0===n){let t=hp(await u5(e,{type:"get_state"}));if(!t)throw Error("Could not read the session's Fast state");n=t.enabled}if(!r())return;let s=await u5(e,{type:"set_fast_mode",enabled:!n});i({enabled:s?.enabled===!0,active:s?.active===!0})}catch(t){if(!r())return;nO({type:"error",message:t instanceof Error?t.message:String(t)});try{i(hp(await u5(e,{type:"get_state"}))??null)}catch{i(null)}}finally{eg(!1)}},[nC,ep,nO]),rh=(0,i.useCallback)(async e=>{let t=(0,up.xG)(e);nd(e);let n=tS.current??await t2.current;if(n)try{await u5(n,{type:"set_tools",toolNames:t})}catch(e){console.error("Failed to set tools:",e)}},[nd]),rp=(0,i.useCallback)(e=>{tB.current=e,tV(t=>!e===t?t:!e)},[]);tX.current=e=>{tZ.current=null,rp(e)};let rm=(0,i.useCallback)((e="smooth")=>{tQ.current=Date.now()+700,t0.current?.scrollIntoView({behavior:e})},[]),rf=(0,i.useCallback)(()=>{tY.current=0,tZ.current=null,rp(!0),rm("smooth")},[rm,rp]),rg=(0,i.useCallback)(()=>{tY.current=0,tZ.current=null,rp(!1)},[rp]),rx=(0,i.useCallback)(()=>{if(!tZ.current)return;tZ.current=null;let e=t1.current;e&&rp(e.scrollHeight-e.scrollTop-e.clientHeight<=72)},[rp]),rv=(0,i.useCallback)(e=>{if(e instanceof PointerEvent&&"mouse"===e.pointerType&&1===e.button&&!(e.target instanceof Element&&e.target.closest("a[href], input, textarea"))&&!(e.target instanceof HTMLElement&&e.target.isContentEditable)){if(tZ.current)return void rx();rg();let e=t1.current;return void(tZ.current=e?{top:e.scrollTop,moved:!1,released:!1}:null)}rx(),e instanceof KeyboardEvent&&(!hv.has(e.key)||e.target instanceof Element&&e.target.closest("input, textarea, [contenteditable='true']"))||(tY.current=Date.now()+1200)},[rx,rg]),ry=(0,i.useCallback)(()=>{let e=t1.current;if(!e)return;let t=tZ.current;if(null!==t){let n=t.top;t.moved||=e.scrollTop!==n,t.top=e.scrollTop;return}if(!tM.current&&!tO.current)return;let n=e.scrollHeight-e.scrollTop-e.clientHeight,r=Date.now()<=tY.current;if(!(!r&&Date.now()<tQ.current)){if(n<=72)return void rp(!0);r&&rp(!1)}},[rp]);return(0,i.useEffect)(()=>(tS.current=t?.id??null,tI.current.sessionId!==tS.current&&(tI.current={sessionId:tS.current,outputs:[],seq:0}),t&&ny(t.id,!f,!0,f).then(e=>{if(tS.current!==t.id)return;nL(t.id),e?.running&&(nk(t.id),(e.state?.isStreaming||e.state?.isPromptRunning||e.state?.isHandoffRunning)&&(tR.current=!!e.state.isStreaming,t$.current=!!e.state.isPromptRunning,tM.current=!0,L(!0),eK(e.state.isStreaming?{kind:"waiting_model"}:{kind:"running_command"}),R({type:"start"}),hE(tE.current,t.id,e.state.pendingToolCalls),nP(t.id),!e.state.isStreaming&&e.state.isPromptRunning&&nG(t.id)),e.state?.isBashRunning&&(tO.current=!0,A(!0),nJ(t.id)),(e.state?.subagents?.length??0)>0&&nP(t.id));let n=e?.state;n&&(void 0!==n.isCompacting&&e_(n.isCompacting),eH(hm(n)),void 0!==n.contextUsage&&ej(n.contextUsage??null),void 0!==n.systemPrompt&&eC(n.systemPrompt??null),void 0!==n.thinkingLevel&&(t9.current=t.id,eo(n.configuredThinkingLevel??n.thinkingLevel),ed(n.thinkingLevel)),void 0!==n.thinkingCeiling&&eh(n.thinkingCeiling??null),void 0!==n.extensionStatuses&&te(n.extensionStatuses??[]),void 0!==n.extensionWidgets&&tr(n.extensionWidgets??[]),void 0!==n.queuedMessages&&to(hh(n.queuedMessages)),void 0!==n.subagents&&td(e=>hd(e,n.subagents??[])),void 0!==n.goal&&tG(n.goal??null)),e&&eq(!0)}),()=>{tz.current+=1,nE(),nR(),n$()}),[t?.id]),(0,i.useEffect)(()=>{h?.(eS)},[eS,h]),(0,i.useEffect)(()=>{u&&u(g?.tree??[],k,n8)},[g?.tree,k,n8,u]),(0,i.useEffect)(()=>{let e=e=>{let t=tZ.current;t&&(1!==e.button||t.released||t.moved||!(e.target instanceof Node&&t1.current?.contains(e.target))?rx():t.released=!0)};return window.addEventListener("pointerup",e,!0),window.addEventListener("keydown",rv),()=>{window.removeEventListener("pointerup",e,!0),window.removeEventListener("keydown",rv)}},[rx,rv]),(0,i.useEffect)(()=>{let e=t1.current;if(!e)return;let t=()=>{tZ.current?.moved&&rx()};return e.addEventListener("pointerdown",rv,{passive:!0}),e.addEventListener("wheel",rv,{passive:!0}),e.addEventListener("touchstart",rv,{passive:!0}),e.addEventListener("scroll",ry,{passive:!0}),e.addEventListener("scrollend",t,{passive:!0}),()=>{e.removeEventListener("pointerdown",rv),e.removeEventListener("wheel",rv),e.removeEventListener("touchstart",rv),e.removeEventListener("scroll",ry),e.removeEventListener("scrollend",t)}},[S.length,v,rx,ry,rv]),(0,i.useEffect)(()=>{if(nr.current||!$&&!P||!tB.current)return;let e=t1.current;if(!e)return;let t=requestAnimationFrame(()=>{tB.current&&(tQ.current=Date.now()+700,e.scrollTo({top:e.scrollHeight,behavior:"instant"}))});return()=>cancelAnimationFrame(t)},[$,P,S.length,E.streamingMessage,eV,_,e.transitioning]),(0,i.useLayoutEffect)(()=>{if(0!==S.length){if(!tU.current){tU.current=!0,rm("instant");return}if(!nr.current&&tB.current){let e=Date.now()-ni.current<1500;rm(tM.current||tO.current||e?"instant":"smooth")}}},[S.length,$,P,rm,e.transitioning]),(0,i.useEffect)(()=>{let e=new AbortController;return n7(e.signal).catch(e=>{if(e instanceof DOMException&&"AbortError"===e.name)return}),()=>e.abort()},[n7,d]),(0,i.useEffect)(()=>{if(!ez)return;let e=setTimeout(()=>eD(null),6e3);return()=>clearTimeout(e)},[ez]),(0,i.useEffect)(()=>{if(0===eQ.visible.length)return;let e=eQ.visible.find(e=>e.exiting);if(e){let t=setTimeout(()=>{eX({type:"remove",id:e.id})},180);return()=>clearTimeout(t)}if(!eQ.visible[0])return;let t=setTimeout(()=>{eX({type:"mark_oldest_exiting"})},5e3);return()=>clearTimeout(t)},[eQ.visible]),(0,i.useEffect)(()=>{e1(null)},[S.length,ek?.tokens,ek?.percent,ek?.contextWindow]),{data:g,loading:v,error:b,activeLeafId:k,messages:S,entryIds:N,streamState:E,agentRunning:$,modelNames:O,modelList:D,modelError:H,modelScopeWarnings:B,modelThinkingLevels:V,modelThinkingLevelMaps:G,modelRoles:Y,newSessionModel:Q,toolPreset:ei,thinkingLevel:el,effectiveThinkingLevel:ec,thinkingCeiling:eu,retryInfo:eb,contextUsage:ek,systemPrompt:eS,forkingEntryId:eN,isCompacting:eA,compaction:eW,compactError:eF,compactResult:ez,currentModel:nu,displayModel:nh,modelSwitching:e$,sessionStats:np,runStateKnown:eB,slashCommands:eG,slashCommandsLoading:eY,queuedMessages:ti,deliveryRows:tm,subagents:tc,todoPhases:tf&&tf.sid===tS.current?tf.phases:null,compactedWork:I,notices:eQ.visible,extensionDialog:e2,extensionResponse:e4,extensionCustomUi:e3,extensionStatuses:e9,extensionWidgets:tn,respondToExtensionUi:n_,sendExtensionCustomInput:nF,isAutoModelSelection:m&&null===Q,agentPhase:eV,isNew:m,autoFollowPaused:tq,resumeAutoFollow:rf,pauseAutoFollow:rg,goalStatus:tK,sessionIdRef:tS,eventSourceRef:tx,messagesEndRef:t0,scrollContainerRef:t1,handleSend:nX,handleAbort:n0,handleFork:n1,handleNavigate:n2,handleModelChange:n4,handleRoleModelChange:n6,handleMainPresetChange:n5,newSessionAccount:ee,handleCompact:n3,handleSteer:re,handleFollowUp:rn,handlePromptWithStreamingBehavior:rt,handleAbortCompaction:rr,handleRecallQueue:ri,handleRemoveQueuedMessage:rs,handleBuiltinSlashCommand:n9,handleToolPresetChange:rh,handleThinkingLevelChange:ra,fastMode:rd,fastModeBusy:ef,handleFastModeToggle:ru,loadTools:nk,loadSlashCommands:nT,ensureNewSession:nC,refreshLiveTranscript:nb,setActiveLeafId:j,setData:x,setMessages:C,dispatch:R,setAgentRunning:L,setForkingEntryId:eT,bashRunning:P,pendingBash:_,handleAgentEventRef:tD}}({session:e,newSessionCwd:t,initialData:l,transitioning:o,onAgentEnd:eC,onAttentionNeeded:d,onSessionCreated:u,onSessionForked:h,newSessionAutoWorktree:a,modelsRefreshKey:p,chatInputRef:m,onBranchDataChange:f,onSystemPromptChange:g,onSessionStatsPanelOpen:y}),t9=(0,i.useMemo)(()=>(function(e){let t=null,n=new Map;for(let r=0;r<e.length;r++){let i=e[r],s=te(i);if(!s||"custom"!==i.role)continue;t??=[...e];let a=[];for(let t=0;t<r;t++){let r=e[t];if("assistant"!==r.role)continue;if(void 0===s.sourceHash){r.timestamp===s.sourceTimestamp&&a.push(t);continue}let i=n.get(t);void 0===i&&(i=function(e){let t=e9(e),n=5381;for(let e=0;e<t.length;e++)n=(n<<5)+n+t.charCodeAt(e)|0;return`${t.length}:${n}`}(r.content??[]),n.set(t,i)),i===s.sourceHash&&a.push(t)}a.length>1&&void 0!==s.sourceHash&&void 0!==s.sourceTimestamp&&(a=a.filter(t=>e[t].timestamp===s.sourceTimestamp));let l=1===a.length?t[a[0]]:null;if(l?.role!=="assistant"){t[r]={...i,details:void 0};continue}t[a[0]]={...l,replyTranslation:function(e,t){let n="string"==typeof e.content?e.content:e.content.map(e=>"text"===e.type?e.text:"").join("\n");return n.startsWith(e7)?{kind:"translated",text:n.slice(e7.length),original:t}:n.startsWith("[번역 생략]")?{kind:"skipped",text:n,original:t}:{kind:"failed",text:n,original:t}}(i,e9(l.content??[]))}}return t??e})(eM),[eM]),ne=iv(e?.id,th?.provider,void 0,th?.modelId),nt=ne?.alias;(0,i.useEffect)(()=>{nt&&ei.current?.(nt)},[nt]);let nn=(0,i.useMemo)(()=>{if(!th)return null;let e=t$?tJ:rg.find(e=>e.alias===ne?.alias)?.oauthPosition;return rg.find(t=>t.provider===th.provider&&(void 0===t.oauthPosition?null===ne||ne.seed===t.seed:t.oauthPosition===e))?.alias??null},[th,t$,tJ,ne]),nr=e$||eL,ni=e?.id;ed.current=t9,eu.current=eE,eh.current=tO;let ns=(0,i.useRef)(!0);ns.current=!tL;let na=(0,i.useRef)(!1);(0,i.useEffect)(()=>{e$&&!na.current&&(ep.current+=1),na.current=e$},[e$]),(0,i.useEffect)(()=>()=>{ep.current+=1},[]),(0,i.useEffect)(()=>{el(e=>[...function(e){if(!e)return[];try{let t=JSON.parse(window.localStorage.getItem(hB(e))??"[]");if(!Array.isArray(t))return[];return t.filter(e=>e&&"string"==typeof e.anchorEntryId).map(t=>({..."string"==typeof t.sticker?{...t,sticker:t.sticker.replace(/^(\/stickers\/.+)\.png$/,"$1.webp")}:t,sessionId:e}))}catch{return[]}}(ni),...e.filter(e=>null===e.anchorEntryId&&e.sessionId===ni)])},[ni]),(0,i.useEffect)(()=>{let e=tO.current;e&&eo.current.some(t=>null===t.anchorEntryId&&t.sessionId===e)&&el(t=>{let n=!1,r=[];for(let i of t){if(null!==i.anchorEntryId||!i.intent||i.sessionId!==e){r.push(i);continue}let s=function(e,t,n){let r=Math.min(t.length,n.length),i=0;if(null!==e.baseEntryId){let t=n.indexOf(e.baseEntryId);if(-1===t||t>=r)return{kind:"drop"};i=t+1}let s=0;for(let a=i;a<r;a++)if(ro(t[a])===e.identity&&(s+=1)===e.occurrence)return{kind:"entry",entryId:n[a]};return null}(i.intent,t9,eE);if(null===s){r.push(i);continue}n=!0,"drop"!==s.kind&&("working"===i.tag&&[...t,...r].some(e=>"working"===e.tag&&e.anchorEntryId===s.entryId)||r.push({id:i.id,anchorEntryId:s.entryId,sticker:i.sticker,text:i.text,tag:i.tag,sessionId:i.sessionId}))}return n?(hq(e,r),r):t})},[t9,eE,tO]);let nl=(0,i.useRef)(null);(0,i.useEffect)(()=>{let e=tO.current,t=nl.current;if(nl.current=e?{sessionId:e,entryIds:eE}:null,!e||!t||t.sessionId!==e)return;let n=function(e,t,n){if(0===e.length||t.length<=e.length)return[];for(let n=0;n<e.length;n++)if(e[n]!==t[n])return[];let r=[],i=Math.min(n.length,t.length);for(let s=e.length;s<i;s++){let e=n[s];"assistant"===e.role&&"web6"===e.provider&&e.model===rd&&r.push(t[s])}return r}(t.entryIds,eE,t9),r=eg();if(0===n.length||!r)return;let i=ig(e,"web6",void 0)?.alias??null;for(let e of n)eo.current.some(t=>t.anchorEntryId===e)||ey(i,"done",r,{kind:"entry",entryId:e})},[eE,t9,tO,eg,ey]);let no=e$&&tR?.kind==="running_tools"&&tR.tools.length>0&&tR.tools.every(e=>"wait"===e.name),nc=eT||o,{hideThinkingBlock:nd}=(V=t??e?.cwd??null,G=n1(),(0,i.useEffect)(()=>{n0(V).catch(()=>{})},[V]),G),nu=(0,i.useMemo)(()=>({hideThinking:nd}),[nd]);(0,i.useEffect)(()=>{var e;if(!tj||er.current===tj.id)return;er.current=tj.id;let t=eg();if(!t)return;ef.current=t.turn;let n=eR.streamingMessage?.role==="assistant"?eR.streamingMessage:null,r=rc(ed.current,n,th?.provider,th?.modelId);ew("select"===(e=tj.method)||"ask"===e||"form"===e?"choice":"approval",t,r.provider,r.credentialId,r.model)},[tj,eR.streamingMessage,th?.provider,th?.modelId,eg,ew]),(0,i.useEffect)(()=>(x=nr?tU:null,()=>void(x=null)),[nr,tU]),(0,i.useEffect)(()=>{R?.(nr)},[R,nr]),(0,i.useEffect)(()=>()=>R?.(!1),[R]),(0,i.useEffect)(()=>{$?.(no)},[no,$]),(0,i.useEffect)(()=>()=>$?.(!1),[$]),(0,i.useEffect)(()=>{L?.(null!==tj)},[L,tj]),(0,i.useEffect)(()=>()=>L?.(!1),[L]);let{main:nh,process:np}=(0,i.useMemo)(()=>(function(e,t,n={}){let r=[],i=[],s=-1,a=null,l=(e,t,n)=>{if(0===t.length)return;let s=(a&&a.anchorIdx===e||(a={anchorIdx:e,entries:[],messageCount:0,toolCallCount:0},i.push(a)),a),l=r.length-1;for(let e of t)s.entries.push({...e,afterMainIndex:l});s.messageCount+=t.length,s.toolCallCount+=n},o=e5(e),c=new Map,d=(e,t)=>{let n=c.get(e)??0;c.set(e,n+1),r.push({kind:"answer",anchorIdx:s,idx:e,runIndex:n,blocks:o.attach(t),precedingBlocks:[]})},u=()=>{let e=o.takeRemaining();e&&d(e.idx,e.blocks)};for(let i of t){if("answer"===i.kind){r.push(i);continue}if("process"===i.kind){l(i.anchorIdx,i.entries,i.toolCallCount);continue}let t=e[i.idx];if(!t)continue;if("user"===t.role){u(),s=i.idx,r.push(i);continue}if(tr(t)){r.push(void 0!==i.anchorIdx||s<0?i:{...i,anchorIdx:s});continue}if("assistant"!==t.role){"toolResult"!==t.role&&null===te(t)&&0>ti(e,i.idx)&&l(s,[{idx:i.idx}],0);continue}let a=eZ(t,n);if(eJ(t,n)&&eY(e,i.idx)){let e=a.flatMap(e=>e.blocks);l(s,[{idx:i.idx}],eQ(e)),o.collect(i.idx,e);continue}let c=!1;for(let e of a){if("answer"===e.kind){d(i.idx,e.blocks),c=!0;continue}l(s,[{idx:i.idx,blocks:e.blocks}],eQ(e.blocks)),o.collect(i.idx,e.blocks)}!c&&eJ(t,n)&&d(i.idx,[])}return u(),{main:r,process:i}})(t9,function(e,t={}){let n=-1;for(let t=e.length-1;t>=0;t--)if(to(e[t])){n=t;break}let r=[];for(let i=0;i<e.length;){if(!to(e[i])){r.push({kind:"message",idx:i}),i+=1;continue}let s=i,a=s+1;for(;a<e.length&&!to(e[a]);)a+=1;if((t.sessionBusy||t.isStreaming)&&a===e.length&&s===n||!function(e,t,n){for(let r=t;r<n;r++)if(e[r]?.role==="assistant")return!0;return!1}(e,s+1,a)){for(let e=s;e<a;e++)r.push({kind:"message",idx:e});i=a;continue}for(let n of(r.push({kind:"message",idx:s}),function(e,t,n,r){let i=[],s=[],a=0,l=[],o=0,c=0,d=e5(e.slice(t+1,n)),u=()=>{0!==s.length&&(i.push({kind:"process",anchorIdx:t,idx:s[0].idx,groupIndex:c++,entries:s,messageCount:s.length,toolCallCount:a,turnHasAnswer:!1}),s=[],a=0)},h=(e,n)=>{u(),i.push({kind:"answer",anchorIdx:t,idx:e,runIndex:o++,blocks:d.attach(n),precedingBlocks:l}),l=[]};for(let o=t+1;o<n;o++){let n=e[o];if("assistant"!==n.role){if(null!==te(n)||ti(e,o)>=0)continue;if(tr(n)){u(),i.push({kind:"message",idx:o,anchorIdx:t});continue}"toolResult"!==n.role&&s.push({idx:o});continue}let c=eZ(n,r);if(eJ(n,r)&&eY(e,o)){let e=c.flatMap(e=>e.blocks);for(let t of(s.push({idx:o}),a+=eQ(e),d.collect(o,e),c))"process"===t.kind&&l.push(...t.blocks);continue}let p=c.reduce((e,t)=>"answer"===t.kind?e+1:e,0);for(let e of c){if("answer"===e.kind){h(o,e.blocks);continue}for(let t of(s.push(p>0?{idx:o,blocks:e.blocks}:{idx:o}),a+=eQ(e.blocks),d.collect(o,e.blocks),e.blocks))l.push(t)}0===p&&eJ(n,r)&&h(o,[])}u();let p=d.takeRemaining();p&&i.push({kind:"answer",anchorIdx:t,idx:p.idx,runIndex:o++,blocks:p.blocks,precedingBlocks:[]});let m=i.some(e=>"answer"===e.kind);for(let e of i)"process"===e.kind&&(e.turnHasAnswer=m);return i}(e,s,a,{hideThinking:t.hideThinking})))r.push(n);i=a}return r}(t9,{sessionBusy:nr,isStreaming:eR.isStreaming,hideThinking:nu.hideThinking}),nu),[t9,nr,eR.isStreaming,nu]),nm=(0,i.useMemo)(()=>(function(e,t,n=[]){let r,i,s,a,l,{atCompaction:o}=(r=-1,n.forEach((e,t)=>{"user"===e.role&&(r=t)}),i=n.slice(0,r+1).flatMap(ai),s=n.slice(r+1).flatMap(ai),a=t.findIndex(e=>"user"===e.role),-1===(l=0===s.length?-1:e.findIndex(e=>"answer"===e.kind&&(-1===a||e.idx<a)))?{continuing:null,atCompaction:[...i,...s]}:{continuing:{position:l,calls:s},atCompaction:i});if(0===o.length)return null;let c=-1;t.forEach((e,t)=>{"custom"===e.role&&"compaction"===e.customType&&(c=t)});let d=e.findIndex(e=>e.idx>c);return{position:-1===d?e.length:d,calls:o}})(nh,t9,tg?.messages),[nh,t9,tg]),[nf,ng]=(0,i.useState)(hz),{startIndex:nx,endIndex:nv,hasLater:ny}=hD(nh.length,nf),nb=null!==nf.end&&ny,nw=(0,i.useRef)(nh.length);nw.current=nh.length;let nk=(0,i.useRef)(null),nj=(0,i.useRef)(null),nC=(0,i.useRef)(null);(0,i.useEffect)(()=>{null!==nf.end&&nf.end>=nh.length&&ng(e=>({count:e.count,end:null}))},[nf.end,nh.length]),(0,i.useEffect)(()=>{let e=nk.current,t=tW.current;if(!e||!t)return;let n=new IntersectionObserver(e=>{e[0]?.isIntersecting&&(nC.current=t.scrollHeight-t.scrollTop,ng(e=>(function(e,t=50){return{...e,count:e.count+t}})(e)))},{root:t,threshold:0});return n.observe(e),()=>n.disconnect()},[nf,nh.length,tW]),(0,i.useEffect)(()=>{if(null==nC.current)return;let e=tW.current;if(e){var t;t=e.scrollHeight,e.scrollTop=Math.max(0,t-nC.current),nC.current=null}},[nf.count,tW]),(0,i.useEffect)(()=>{let e=nj.current,t=tW.current;if(!e||!t)return;let n=new IntersectionObserver(e=>{e[0]?.isIntersecting&&ng(e=>(function(e,t,n=50){if(null===t.end)return t;let{startIndex:r,endIndex:i}=hD(e,t),s=i+n;return s>=e?{count:e-r,end:null}:{count:s-r,end:s}})(nw.current,e))},{root:t,threshold:0});return n.observe(e),()=>n.disconnect()},[nf,nh.length,tW]);let[nT,nE]=(0,i.useState)(null),[nR,n$]=(0,i.useState)(0),nL=(0,i.useRef)(null),nP=(0,i.useCallback)(e=>{t_(),nL.current=e,nE(null),ng(t=>hW(nw.current,e,t)),n$(e=>e+1)},[t_]);(0,i.useLayoutEffect)(()=>{let e=nL.current,t=tW.current;if(null===e||!t)return;let n=t.querySelector(`[data-chat-item="${e}"]`);if(!n)return;nL.current=null;let r=document.createRange();r.selectNodeContents(n),t.scrollTop+=r.getBoundingClientRect().top-t.getBoundingClientRect().top-24,nE(e)},[nR,nf,nh,tW]),(0,i.useEffect)(()=>{if(null===nT)return;let e=setTimeout(()=>nE(null),1800);return()=>clearTimeout(e)},[nT]);let nA=(0,i.useCallback)(()=>{(0,s.flushSync)(()=>ng(hz));let e=tW.current;e&&(e.scrollTop=e.scrollHeight)},[tW]),n_=(0,i.useCallback)(()=>{nb&&nA(),tA()},[nb,nA,tA]),nF=(0,i.useRef)(null),[nO,nz]=(0,i.useState)(!1);(0,i.useEffect)(()=>{if(!D||nF.current===D.id||D.sessionId!==e?.id||eT||0===t9.length)return;nF.current=D.id,W?.(D.id);let t=eE.indexOf(D.entryId);if(t<0)return void nz(!0);let n=0;for(let e=0;e<nh.length;e++){let r=nh[e].idx;if(r>t||(n=e,r===t))break}nP(n)},[D,e?.id,eT,t9.length,eE,nh,nP,W]),(0,i.useEffect)(()=>{if(!nO)return;let e=setTimeout(()=>nz(!1),6e3);return()=>clearTimeout(e)},[nO]);let[nD,nW]=(0,i.useState)(!1),[nH,nU]=(0,i.useState)(0),nB=(0,i.useMemo)(()=>nD?nh.map(e=>(function(e,t){if("answer"===e.kind)return tu(e.blocks);let n=t[e.idx];return n&&"content"in n?tu(n.content):""})(e,t9).toLowerCase()):hV,[nD,nh,t9]),nq=(0,i.useCallback)(e=>{t_(),ng(t=>hW(nw.current,e,t))},[t_]),nV=(0,i.useCallback)(()=>nW(!1),[]);(0,i.useEffect)(()=>{let e=e=>{if(e.defaultPrevented||e.isComposing||e.altKey||e.shiftKey||!(e.ctrlKey||e.metaKey)||"f"!==e.key.toLowerCase())return;let t=tW.current;if(!t||!t.checkVisibility({visibilityProperty:!0}))return;let n=e.target instanceof Element?e.target:null;if(n?.closest("[data-capture-keys], [role='dialog']"))return;let r=n?.closest("input, textarea, select, [contenteditable='true']");(!r||r.closest("[data-chat-composer], .chat-find-bar"))&&(e.preventDefault(),nW(!0),nU(e=>e+1))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[tW]);let nK=(0,i.useMemo)(()=>{let e=[];return nh.forEach((t,n)=>{if("message"!==t.kind)return;let r=hU(t9[t.idx]);null!==r&&e.push({item:n,text:r})}),e},[nh,t9]),nG=`${nx}:${nv}`,nJ=eE.length>0?eE[eE.length-1]:null,[nY,nZ]=(0,i.useState)(null),nQ=(0,i.useRef)(!1);(0,i.useEffect)(()=>{nQ.current||!tf||eT||!e?.id||(nQ.current=!0,nr||!nJ||!function(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if("user"===n.role||"toolResult"===n.role)return!0;if("assistant"===n.role){if(!n.stopReason)return!0;if("aborted"===n.stopReason||"error"===n.stopReason||"length"===n.stopReason)break;return n.content.some(e=>"toolCall"===e.type)}}return!1}(t9)||function(e){try{return window.localStorage.getItem(hK(e))}catch{return null}}(e.id)!==nJ&&nZ(nJ))},[tf,eT,e?.id,nr,nJ,t9]);let nX=(0,i.useCallback)(()=>{e?.id&&nY&&function(e,t){try{window.localStorage.setItem(hK(e),t)}catch{}}(e.id,nY),nZ(null)},[e?.id,nY]),n2=null!==nY&&nY===nJ&&!nr&&!nb,n8=tm?[tm.sessionId,tm.sessionFile??"",tm.sessionName??"",tm.userMessages,tm.assistantMessages,tm.toolCalls,tm.toolResults,tm.totalMessages,tm.tokens.input,tm.tokens.output,tm.tokens.cacheRead,tm.tokens.cacheWrite,tm.tokens.total,tm.cost??0,tm.totalActiveMs??0].join("|"):null,n4=(0,i.useRef)(tm);n4.current=tm,(0,i.useEffect)(()=>{v?.(n4.current)},[n8,v]),(0,i.useEffect)(()=>()=>{v?.(null)},[v]);let n5=e4?`${e4.percent??"null"}|${e4.contextWindow}|${e4.tokens??"null"}`:null,n6=(0,i.useRef)(e4);n6.current=e4,(0,i.useEffect)(()=>{b?.(n6.current)},[n5,b]),(0,i.useEffect)(()=>()=>{b?.(null)},[b]),(0,i.useEffect)(()=>{w?.(tb)},[w,tb]),(0,i.useEffect)(()=>()=>{w?.([])},[w]);let{regular:n3,lab:n7}=(0,i.useMemo)(()=>(function(e){let t=[],n=[];for(let i of e){var r;((r=i.key).startsWith(cJ)&&null!==cY(r)?n:t).push(i)}return{regular:t,lab:n}})(tT),[tT]),n9=e?.id??null;(0,i.useEffect)(()=>{k?.(n9,n7)},[k,n9,n7]),(0,i.useEffect)(()=>()=>{k?.(null,[])},[k]);let{isDragOver:rt,handleDragEnter:rn,handleDragOver:rr,handleDragLeave:ri,handleDrop:rs}=function(e){let[t,n]=(0,i.useState)(!1),r=(0,i.useRef)(0),s=(0,i.useCallback)(e=>{Array.from(e.dataTransfer.items).some(e=>"file"===e.kind)&&(e.preventDefault(),r.current+=1,n(!0))},[]),a=(0,i.useCallback)(e=>{Array.from(e.dataTransfer.items).some(e=>"file"===e.kind)&&e.preventDefault()},[]);return{isDragOver:t,handleDragEnter:s,handleDragOver:a,handleDragLeave:(0,i.useCallback)(()=>{r.current-=1,r.current<=0&&(r.current=0,n(!1))},[]),handleDrop:(0,i.useCallback)(t=>{t.preventDefault(),r.current=0,n(!1),e(Array.from(t.dataTransfer.files))},[e])}}((0,i.useCallback)(e=>{nr||m?.current?.addAttachments(e)},[nr,m])),ra=(0,i.useMemo)(()=>{var e;return e=tg?.messages,e&&e.length>0?[...e,...t9]:t9},[tg,t9]),rl=(0,i.useMemo)(()=>{let e=new Map;for(let t of ra)"toolResult"===t.role&&e.set(t.toolCallId,t);return e},[ra]),ru=(0,i.useMemo)(()=>{let e,t,n,r,i,s,a,l,o,c,d;return e=new Map,t=new Map,n=new Map,r=new Map,i=new Map,s=new Map,a=new Map,l=(e,r,i)=>{let s=n.get(e);s&&r&&t.set(s,{status:r,order:i})},o=new Set,c=(e,t)=>{let r=t?n.get(t):void 0,s=s5(e.status);if(!r||o.has(r)||"completed"!==s&&"failed"!==s&&"aborted"!==s)return;o.add(r);let a=s4(e);null!==a&&i.set(r,a)},d=(e,t,r)=>{let i=t?n.get(t):void 0,s=s4(e);i&&"number"==typeof r&&null!==s&&"running"===s5(e.status)&&a.set(i,Math.max(a.get(i)??-1/0,r-s))},ra.forEach((t,i)=>{if("assistant"===t.role){for(let e of t.content??[]){if("toolCall"!==e.type||"task"!==e.toolName)continue;let t=rl.get(e.toolCallId);if(t)for(let i of s3(e,t)??[])n.set(i.agentId,i.key),"number"==typeof t.timestamp&&r.set(i.key,t.timestamp)}return}if("toolResult"===t.role){if("routing_verdict"===t.toolName){let n=function(e){let t=function(e){if(e.isError)return null;let t=e.details?.record;if("object"!=typeof t||null===t)try{let n=JSON.parse(s6(e.content));t=n?.ok===!0?n.record:void 0}catch{return null}return"object"==typeof t&&null!==t?t:null}(e);if(!t)return null;let n=t.verdict;if("accepted"!==n&&"rework"!==n&&"held"!==n)return null;let r=s8(t.assignmentId),i=r?.split("#")??[];if(i.length<3)return null;let s=i[i.length-1],a=i.slice(1,-1).join("#");return/^\d+$/.test(s)&&a?{key:`${a}#${s}`,record:{verdict:n,attempt:"number"==typeof t.attempt?t.attempt:null,reason:s8(t.reason)}}:null}(t);if(!n)return;let r=e.get(n.key)??[];r.push({...n.record,order:i,at:"number"==typeof t.timestamp?t.timestamp:null}),e.set(n.key,r);return}if("wait"===t.toolName){let e=new Set;for(let r of s2(t.details?.jobs)){if("task"!==r.type)continue;let s=s8(r.id);if(s&&l(s,s5(r.status),i),c(r,s),d(r,s,t.timestamp),s&&"running"===s5(r.status)){let t=n.get(s);t&&e.add(t)}}for(let t of e)for(let n of e){if(t===n)continue;let e=s.get(t);e||s.set(t,e=new Set),e.add(n)}}return}if("custom"===t.role&&"async-result"===t.customType){for(let e of s6(t.content).matchAll(s7)){let t=Object.fromEntries([...e[1].matchAll(s9)].map(e=>[e[1],e[2]]));t.id&&l(t.id,s5(t.status),i)}for(let e of s2(t.details?.jobs))"task"===e.type&&c(e,s8(e.jobId))}}),{verdicts:e,runs:t,latestByAgent:n,spawnedAt:r,durations:i,parallelWith:s,runStartedAt:a}},[ra,rl]),rh=(0,i.useMemo)(()=>({ledger:ru,subagents:tb,toolResults:rl,onOpenPanel:j,sessionId:e?.id??null,cwd:e?.cwd??t??void 0,onOpenMaker:C,selectedMaker:N}),[ru,tb,rl,j,e?.id,e?.cwd,t,C,N]),rp=(0,i.useMemo)(()=>{let e=new Set,t=[];for(let n=t9.length-1;n>=0;n-=1){let r=hU(t9[n]);if(!(!r||e.has(r))&&(e.add(r),t.push(r),t.length>=50))break}return t.reverse()},[t9]),rm=(0,i.useMemo)(()=>tP(t9,rl,tw,tg?.todoPhases??null),[t9,rl,tw,tg]),rf=(0,i.useMemo)(()=>cz(eR.streamingMessage).join("|"),[eR.streamingMessage]),rx=(0,i.useMemo)(()=>JSON.stringify(cO(eR.streamingMessage)),[eR.streamingMessage]),rv=(0,i.useMemo)(()=>JSON.stringify(cW(eR.streamingMessage)),[eR.streamingMessage]),ry=(0,i.useMemo)(()=>(function(e,t,n=[],r=[],i=[]){let s=function(e){let t=new Map;for(let n of e){if("toolResult"!==n.role||"write"!==n.toolName)continue;let e=n.details;if(!e||"object"!=typeof e||Array.isArray(e))continue;let r=e.message;if(!r||"object"!=typeof r||Array.isArray(r)||"send"!==r.op)continue;let i=Array.isArray(r.receipts)?r.receipts.filter(e=>"object"==typeof e&&null!==e&&!Array.isArray(e)).map(e=>({to:"string"==typeof e.to?e.to:void 0,outcome:"string"==typeof e.outcome?e.outcome:void 0})):void 0;t.set(n.toolCallId,{from:"string"==typeof r.from?r.from:void 0,receipts:i})}return t}(e),a=[],l=new Map,o=-1;for(let n=0;n<e.length;n+=1){let r=e[n];if("user"===r.role){o=n;continue}let i=cz(r),c=cW(r,s);if(0===i.length&&0===c.length||o<0)continue;let d=cO(r),u=l.get(o);u||(u={index:o,entryId:t[o],taskToolCallIds:[],characterSummons:[],peerSends:[]},l.set(o,u),a.push(u)),u.taskToolCallIds=[...u.taskToolCallIds,...i],u.characterSummons=[...u.characterSummons,...d],u.peerSends=[...u.peerSends,...c]}if(n.length>0||i.length>0){let s=-1;for(let t=e.length-1;t>=0;t-=1)if("user"===e[t].role){s=t;break}if(s>=0){let e=l.get(s);e||(e={index:s,entryId:t[s],taskToolCallIds:[],characterSummons:[],peerSends:[]},l.set(s,e),a.push(e));let o=new Set(e.taskToolCallIds);e.taskToolCallIds=[...e.taskToolCallIds,...n.filter(e=>!o.has(e))];let c=new Set(e.characterSummons.map(e=>`${e.toolCallId} ${e.name??""}`));e.characterSummons=[...e.characterSummons,...r.filter(e=>!c.has(`${e.toolCallId} ${e.name??""}`))];let d=new Set(e.peerSends.map(e=>e.toolCallId));e.peerSends=[...e.peerSends,...i.filter(e=>!d.has(e.toolCallId))]}}return a.sort((e,t)=>e.index-t.index)})(t9,eE,rf.length>0?rf.split("|"):[],JSON.parse(rx),JSON.parse(rv)),[t9,eE,rf,rx,rv]),rb=e?.id??tO.current??void 0,rw=(J=cB(K=(0,i.useMemo)(()=>({sessionId:rb,sessionProvider:th?.provider,turns:ry,messages:t9,subagents:tb}),[rb,th?.provider,ry,t9,tb])),Y=cG(K),(0,i.useMemo)(()=>(function(e){let t=new Map;for(let n of e){let e=t.get(n.turnIndex);e?e.push(n):t.set(n.turnIndex,[n])}return t})(function(e){let t=[];for(let n of e){let e=t[t.length-1];if(e&&e.speakerId===n.speakerId&&e.turnIndex===n.turnIndex&&e.text===n.text){t[t.length-1]=n;continue}t.push(n)}return t}([...J,...Y])),[J,Y])),rk=t$&&0===t9.length&&!eR.isStreaming&&!nr,rj=(0,i.useMemo)(()=>t9.filter(e=>"assistant"===e.role).length,[t9]),rS=function(e,t){let n=(0,i.useRef)(new Map),r=(0,i.useMemo)(()=>{if(!e)return n.current=new Map,0;let t=new Map,r=0;return(e.content??[]).forEach((e,i)=>{let s=e1(e);if(null===s)return;let a=e2(n.current.get(i),s);t.set(i,{text:s,tokens:a}),r+=a}),n.current=t,r},[e]),s=(0,i.useRef)(r);s.current=r;let a=null!==e,l=e?.timestamp,[o,c]=(0,i.useState)(null);return(0,i.useEffect)(()=>{if(!a)return void c(null);let e=l??Date.now(),t=()=>{let t=(Date.now()-e)/1e3;c(t>=.5?s.current/t:0)};t();let n=setInterval(t,1e3);return()=>clearInterval(n)},[a,l,t]),a?o??0:null}(eR.streamingMessage?.role==="assistant"?eR.streamingMessage:null,rj),rC=(0,i.useMemo)(()=>(function(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if("assistant"!==n.role)continue;let{usage:r,timestamp:i,completedAt:s}=n,a=r?.output??0;if(!(a<=0)&&i&&s&&!(s<=i))return a/((s-i)/1e3)}return null})(t9),[t9]),rN=e?.cwd??t??void 0,rT=th?eD[`${th.provider}:${th.modelId}`]??null:null,rI=th?eW[`${th.provider}:${th.modelId}`]??null:null,rM=(0,i.useRef)(null),rE=(0,i.useRef)(null),rR=(0,i.useCallback)(()=>{let e=rM.current?.querySelector("textarea");e&&(e.focus({preventScroll:!0}),e.setSelectionRange(e.value.length,e.value.length))},[]);(0,i.useEffect)(()=>(E?.(rR),()=>E?.(null)),[rR,E]),(0,i.useLayoutEffect)(()=>{let e=rE.current,t=e?.closest(".workspace-shell");if(!e||!t)return;let n=tW.current?.clientHeight??0,r=()=>{let r=Math.ceil(e.getBoundingClientRect().height);r>0&&t.style.setProperty("--omp-dock-h",`${r}px`);let i=tW.current;if(!i)return;let s=n-i.clientHeight;n=i.clientHeight,s<=0||i.scrollHeight-i.scrollTop-i.clientHeight-s<=1&&(i.scrollTop+=s)};r();let i=new ResizeObserver(r);return i.observe(e),()=>i.disconnect()},[eT,tW]);let r$=(0,i.useCallback)((...e)=>(null!==nf.end&&nA(),tH(...e)),[tH,nf.end,nA]),rL=(0,r.jsx)("div",{ref:rM,"data-chat-composer":"",style:{display:"contents"},children:(0,r.jsx)(uQ,{ref:m,sessionId:e?.id??tO.current??void 0,onEnsureSession:t$&&t?t3:void 0,onLiveTranscriptPersisted:t7,onSend:r$,onAbort:tU,onSteer:e$?tZ:void 0,onFollowUp:e$?tQ:void 0,onPromptWithStreamingBehavior:e$?tX:void 0,isStreaming:nr,model:th,isAutoModelSelection:tE,modelNames:e_,modelList:eF,modelError:eO,modelScopeWarnings:ez,onModelChange:tV,onMainPresetChange:e||t$?tG:void 0,mainPresetActiveAlias:nn,modelRoles:eH,onRoleModelChange:tK,modelSwitching:tp,onCompact:e||t$?tY:void 0,onAbortCompaction:t0,isCompacting:e3,compactError:tc,compactResult:td,toolPreset:eU,onToolPresetChange:e||t$?t4:void 0,thinkingLevel:eB,effectiveThinkingLevel:eq,outputTokensPerSecond:rS??rC,outputSpeedLive:null!==rS,thinkingCeiling:eV,onThinkingLevelChange:e||t$?t5:void 0,fastMode:eG,fastModeBusy:eX,onFastModeToggle:e||t$?e0:void 0,availableThinkingLevels:rT,thinkingLevelMap:rI,retryInfo:e8,deliveryRows:ty,inputHistory:rp,onRecallQueue:t1,onRemoveQueuedMessage:t2,slashCommands:tx,slashCommandsLoading:tv,onLoadSlashCommands:t6,onBuiltinCommand:t8,soundEnabled:P,onSoundToggle:A,onAudioUnlock:z,draftKey:e?.id??(t?`new:${t}`:void 0),cwd:e?.cwd??t,sessionTitle:e?.name})}),rP=eR.streamingMessage,rA=(0,i.useMemo)(()=>rP?eZ(rP,{isStreaming:!0}):[],[rP]),r_=(0,i.useMemo)(()=>rA.filter(e=>"answer"===e.kind).flatMap(e=>e.blocks),[rA]),rF=(0,i.useMemo)(()=>rA.filter(e=>"answer"!==e.kind).map(e=>e.blocks),[rA]),rO=rP?.role==="assistant"?rP:null,rz=(0,i.useMemo)(()=>{let e=-1;for(let t=t9.length-1;t>=0;t-=1)if("user"===t9[t].role){e=t;break}let t=e<0?-1:lX(t9,e);return{start:t,blocks:lZ(t9,t+1,t9.length),priorCiHeads:l1(t9,rl,t+1),jobNotices:lQ(t9,t+1,t9.length)}},[t9,rl]),rD=(0,i.useMemo)(()=>lA(rO?[...rz.blocks,...rO.content??[]]:rz.blocks,rl,nr,rz.priorCiHeads,rN,rz.jobNotices),[rz,rO,rl,nr,rN]),rW=(0,i.useMemo)(()=>nr?{...lY(rz.blocks,rl,rN),span:l2(t9,rz.start+1,t9.length)}:null,[nr,rz,rl,rN,t9]),rH=(0,i.useMemo)(()=>rW?{...rW,flow:rD,latest:!0}:null,[rW,rD]),rU=(0,i.useMemo)(()=>{let e=null;if(nr)for(let t of nh)"message"===t.kind&&t9[t.idx]?.role==="user"&&(e=t.idx);return function(e,t,n,r,i,s,a=[]){let l=function(e,t,n){let r=new Map,i=e.filter(e=>"message"===e.kind&&t[e.idx]?.role==="user"&&lX(t,e.idx)===e.idx).map(e=>e.idx),s=null===n?null:lX(t,n),a=new Map;for(let[n,l]of(e.forEach((e,n)=>{"answer"===e.kind&&a.set(lX(t,e.anchorIdx),n)}),a)){if(n===s)continue;let e=i.find(e=>e>n);r.set(l,{from:n+1,to:e??t.length})}return r}(e,t,n),o=-1;for(let e of l.keys())e>o&&(o=e);let c=new Map,d=[],u=0;for(let[e,n]of[...l].sort((e,t)=>e[1].from-t[1].from)){if(l1(t,r,n.from,u,d),u=Math.max(u,n.from),0===n.from&&s){let i=n.to-1;for(;i>=n.from&&ta(a[i]);)i-=1;if(a[i]!==s.throughEntryId)continue;let l=lZ(t,n.from,n.to).filter(e=>"toolCall"===e.type&&"task"===e.toolName),h=l0(t,r,n.from,n.to);c.set(e,{...s.summary,...h?{remaining:lJ(h)}:{},dispatchCalls:l,latest:e===o}),d.push(...s.ciHeads),u=n.to;continue}c.set(e,{...function(e,t,n,r,i,s=[]){let a=lZ(e,n,r),l=l0(e,t,n,r);return{...lY(a,t,i),remaining:l?lJ(l):null,span:l2(e,n,r),flow:lA(a,t,!1,s,i,lQ(e,n,r))}}(t,r,n.from,n.to,i,d),latest:e===o})}return c}(nh,t9,e,rl,rN,tg?.openRequest??null,eE)},[nh,t9,rl,rN,nr,tg,eE]),[rB,rq]=(0,i.useState)(null),rV=e?.id??null;(0,i.useEffect)(()=>{rq(null)},[rV]);let rK=null;for(let e of rU.keys())(null===rK||e>rK)&&(rK=e);let rG=("live"===rB?null!==rH:null!==rB&&rU.has(rB))?rB:rH?"live":rK,rJ="live"===rG?rH:null===rG?null:rU.get(rG)??null,rY=null!==rH,rZ=(0,i.useMemo)(()=>({selected:rG,shown:null!==H,select:e=>{rq(e),B?.()},latestTurn:rY?null:rK,compactedCalls:nm?.calls,onOpenFile:I}),[B,rG,H,rY,rK,nm,I]),rQ=null===rG||"live"===rG||rG===rK,rX=H&&(0,s.createPortal)((0,r.jsx)(as.Provider,{value:rh,children:(0,r.jsx)(cm,{summary:rJ,live:"live"===rG,folded:q,compactedCalls:rQ?nm?.calls:void 0,onOpenFile:I})}),H),r0=e$&&(tR?.kind==="running_tools"||(rO?.content??[]).some(e=>"text"===e.type&&/\S/.test(e.text)||"toolCall"===e.type)),r1=rc(t9,rO,th?.provider,th?.modelId),r2=r1.provider,r8=r1.model,r4=r1.credentialId;(0,i.useEffect)(()=>{if(!r0)return;let e=eg();e&&em.current!==e.turn&&ef.current!==e.turn&&(em.current=e.turn,ew("working",e,r2,r4,r8))},[r0,r2,r8,r4,eg,ew]);let[r5,r6]=(0,i.useState)(null),r3=(0,i.useCallback)(e=>{r6(e)},[]),r7=(0,i.useMemo)(()=>eA?{role:"bashExecution",command:eA.command,output:"",excludeFromContext:eA.excludeFromContext}:null,[eA]),r9=(0,i.useMemo)(()=>{let e=[e$&&!rP&&tR?function(e,t){if(e?.kind==="running_tools"){let n=e.tools.map(e=>e.name);return 0===n.length?t("chat.runningTool"):1===n.length?t("chat.runningNamedTool",{name:n[0]}):n.length<=3?t("chat.runningTools",{names:n.join(", ")}):t("chat.runningToolsMore",{names:n.slice(0,2).join(", "),count:n.length-2})}return e?.kind==="waiting_model"?t("chat.waitingModel"):e?.kind==="running_command"?t("chat.runningCommand"):null}(tR,Z):null,eL&&!eA?Z("chat.runningCommand"):null].filter(e=>!!e);return e.length>0?e.join(" \xb7 "):null},[e$,rP,tR,eL,eA,Z]);(0,i.useEffect)(()=>{if(!r5)return void T?.(null);let e=[],t=[],n=0;if(rP&&rF.length>0){let r=r5.messages.length+e.length;for(let i of(e.push(rP),rF))t.push({idx:r,blocks:i}),n+=eQ(i)}if(r7&&(t.push({idx:r5.messages.length+e.length}),e.push(r7)),0===t.length)return void T?.(r9?{...r5,status:r9}:r5);let r=-1;for(let e=r5.messages.length-1;e>=0;e--)if(to(r5.messages[e])){r=e;break}let i=r5.groups.slice(),s=i.length>0?i[i.length-1]:void 0;s&&s.anchorIdx===r?i[i.length-1]={...s,entries:[...s.entries,...t],messageCount:s.messageCount+t.length,toolCallCount:s.toolCallCount+n}:i.push({anchorIdx:r,entries:t,messageCount:t.length,toolCallCount:n}),T?.({...r5,groups:i,messages:[...r5.messages,...e],status:r9})},[r5,rF,rP,r7,r9,T]),(0,i.useEffect)(()=>()=>T?.(null),[T]);let ie=n3.filter(e=>"belowEditor"!==e.placement),it=n3.filter(e=>"belowEditor"===e.placement);return eI?(0,r.jsx)("div",{className:"flex h-full items-center justify-center text-red-400",children:eI}):(0,r.jsxs)("div",{className:"chat-window relative flex h-full min-w-0 flex-col overflow-hidden","aria-busy":nc,"data-empty-start":rk&&!M?"true":void 0,style:{paddingBottom:"env(safe-area-inset-bottom)"},onDragEnter:rn,onDragOver:rr,onDragLeave:ri,onDrop:rs,children:[nc?(0,r.jsx)("div",{className:"absolute inset-0 z-40 cursor-wait",children:(0,r.jsx)("div",{className:"absolute right-3 top-3 bg-bg-raised px-3 py-2 text-sm text-text-muted shadow-sm",role:"status",children:Z("chat.loadingSession")})}):null,rt&&!nr&&(0,r.jsx)("div",{className:"pointer-events-none absolute inset-0 z-50 flex animate-[drop-zone-in_0.15s_ease_both] items-center justify-center",style:{background:"var(--accent-soft)"},children:(0,r.jsx)("span",{className:"px-3 py-1 text-sm font-medium",style:{background:"var(--bg-raised)",boxShadow:"var(--shadow-float)",borderRadius:"var(--radius-surface)",color:"var(--text)"},children:Z("chat.attachFile")})}),tC&&(0,r.jsx)(h1,{request:tC,onInput:tM}),rk&&!M?(0,r.jsx)("div",{className:"flex flex-1 flex-col items-center overflow-y-auto px-4",children:(0,r.jsxs)("div",{className:"chat-empty-start my-auto w-full max-w-[var(--reading-measure)] py-8",children:[(0,r.jsxs)("div",{className:"mb-3",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,marginLeft:16,marginRight:52,fontFamily:"var(--font-mono)"},children:[(0,r.jsx)("div",{style:{minWidth:0,flex:1,overflow:"hidden"},children:(0,r.jsx)(ee,{})}),(0,r.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-end",gap:2,flexShrink:0},children:[(0,r.jsxs)("span",{style:{fontSize:11,color:"var(--text-muted)"},children:["web ",(0,r.jsxs)("span",{style:{color:"var(--text)"},children:["v","0.10.271"]})]}),(0,r.jsxs)("span",{style:{fontSize:11,color:"var(--text-muted)"},children:["omp ",(0,r.jsxs)("span",{style:{color:"var(--text)"},children:["v","18.20.2"]})]})]})]}),rN&&(0,r.jsxs)("section",{className:"empty-workspace-context","aria-label":Z("chat.emptyProjectLabel"),children:[(0,r.jsxs)("div",{className:"empty-workspace-context-text",children:[(0,r.jsx)("span",{className:"empty-workspace-context-kicker",children:Z("chat.emptyProjectLabel")}),(0,r.jsx)("strong",{children:tz(rN)||rN}),(0,r.jsx)("code",{title:rN,children:rN}),(0,r.jsx)("p",{children:Z("chat.emptyProjectHint")})]}),S&&(0,r.jsx)("button",{type:"button",className:"empty-workspace-context-action",onClick:S,children:Z("chat.openSessionList")})]}),(0,r.jsx)(hQ,{notices:tk,align:"right"})]})}):(0,r.jsxs)(r.Fragment,{children:[M&&(0,r.jsx)("div",{className:"min-h-0 min-w-0 flex-1 overflow-hidden",children:M}),(0,r.jsxs)("div",{className:"relative min-w-0 flex-1 overflow-hidden","aria-hidden":!!M,style:{display:M?"none":"flex"},children:[(0,r.jsx)("div",{style:{position:"absolute",top:12,left:0,right:0,zIndex:40,padding:"0 16px",pointerEvents:"none"},children:(0,r.jsxs)("div",{className:"chat-column-cap",style:{maxWidth:"var(--reading-measure)",margin:"0 auto",display:"flex",flexDirection:"column",alignItems:"flex-end",gap:8},children:[(0,r.jsx)(cy,{open:nD,onClose:nV,containerRef:tW,index:nB,renderedStart:nx,renderedEnd:nv,contentKey:t9,onReveal:nq,onProgrammaticScroll:t_,focusRequest:nH,t:Z}),nO&&(0,r.jsx)("div",{className:"chat-jump-missing",role:"status",children:Z("chat.jumpMissing")}),(0,r.jsx)(hQ,{notices:tk,floating:!0,align:"right"})]})}),(0,r.jsx)("div",{ref:tW,className:"chat-session-scroll relative min-w-0 flex-1 overflow-x-hidden overflow-y-auto pt-4 [scrollbar-width:none]",children:(0,r.jsx)("div",{style:{minWidth:0,padding:"0 16px"},children:(0,r.jsxs)("div",{className:"chat-column-cap",style:{width:"100%",minWidth:0,maxWidth:"var(--reading-measure)",margin:"0 auto"},children:[(0,r.jsx)(hZ,{widgets:ie}),(0,r.jsx)(as.Provider,{value:rh,children:(0,r.jsxs)(ci.Provider,{value:rZ,children:[(0,r.jsx)(cL,{utterances:rw,children:(0,r.jsx)(hG,{messages:t9,entryIds:eE,toolResultsMap:rl,modelNames:e_,messageCwd:rN,onOpenFile:I,sessionBusy:nr,isNew:t$,isStreaming:eR.isStreaming,handleFork:tB,forkingEntryId:e6,handleNavigate:tq,handleEditContent:eN,sessionId:e?.id??tO.current??void 0,main:nh,turnSummaries:rU,process:np,startIndex:nx,endIndex:nv,sentinelRef:nk,laterSentinelRef:nj,flashItem:nT,t:Z,cues:es,cueFollowRef:ns,onProcessLogChange:r3})}),!nb&&eR.isStreaming&&eR.streamingMessage&&r_.length>0&&(0,r.jsx)(sl,{message:eK(eR.streamingMessage,r_),sessionId:e?.id??tO.current??void 0,isStreaming:!0,modelNames:e_,cwd:rN,onOpenFile:I}),!nb&&rH&&(0,r.jsx)(co,{summary:rH,turnKey:"live",live:!0})]})}),n2&&(0,r.jsx)(cC,{onDismiss:nX,t:Z}),(0,r.jsx)("div",{ref:tD})]})})}),(0,r.jsx)(cb,{questions:nK,containerRef:tW,layoutKey:nG,onJump:nP,label:Z("chat.questionRail")}),(nr&&tL||nb)&&(0,r.jsxs)("button",{type:"button",onClick:n_,"aria-label":Z("chat.jumpToBottom"),title:Z("chat.jumpToBottom"),style:{position:"absolute",bottom:16,left:"50%",transform:"translateX(-50%)",zIndex:40,display:"flex",alignItems:"center",gap:6,padding:"6px 12px",minHeight:X?44:void 0,borderRadius:"var(--radius-control)",border:0,background:"var(--bg-raised)",boxShadow:"var(--shadow-float)",color:"var(--text-muted)",fontSize:12,cursor:"pointer"},children:[(0,r.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,r.jsx)("path",{d:"M12 5v14"}),(0,r.jsx)("path",{d:"m19 12-7 7-7-7"})]}),Z("chat.jumpToBottom")]})]})]}),(0,r.jsxs)("div",{ref:rE,className:"relative chat-composer-dock flex min-h-0 flex-col",children:[tj&&(0,r.jsx)("div",{style:{padding:"0 16px"},children:(0,r.jsx)("div",{className:"chat-column-cap",style:{maxWidth:"var(--reading-measure)",margin:"0 auto"},children:(0,r.jsx)(h0,{request:tj,onRespond:tI,onActivity:(e,t)=>void tM(e,t??"activity"),delivery:tS})})}),(0,r.jsx)("div",{className:"min-h-0 overflow-y-auto",style:{padding:"0 16px"},children:(0,r.jsxs)("div",{className:"chat-column-cap",style:{maxWidth:"var(--reading-measure)",margin:"0 auto"},children:[(0,r.jsx)(cS,{compaction:tn,t:Z}),(0,r.jsx)(hY,{goal:tF,t:Z}),(0,r.jsx)(hZ,{widgets:it}),(rm||rD.steps.length>0)&&!et&&(0,r.jsx)(u0,{phases:rm,flow:rD,busy:nr})]})}),q&&!H&&rJ&&null!==rG&&!et&&(0,r.jsx)("div",{className:"turn-peek-dock",style:{padding:"0 16px"},children:(0,r.jsx)("div",{className:"chat-column-cap",children:(0,r.jsx)(as.Provider,{value:rh,children:(0,r.jsx)(cd,{summary:rJ,live:"live"===rG,onOpen:()=>rZ.select(rG)})})})}),rL,(0,r.jsx)(uX,{statuses:tN})]}),rX]})}function hY({goal:e,t}){if(!e)return null;let n=!e.enabled,i=void 0!==e.tokenBudget?t("chat.goalBudgetLeft",{left:nV(Math.max(0,e.tokenBudget-e.tokensUsed))}):t("chat.goalTokensUsed",{used:nV(e.tokensUsed)});return(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8,padding:"5px 10px",border:0,borderRadius:"var(--radius-control)",background:"var(--bg-panel)",color:"var(--text-muted)",fontSize:11,fontFamily:"var(--font-mono)",opacity:n?.7:1},children:[(0,r.jsx)("span",{style:{color:n?"var(--text-dim)":"var(--accent)",fontWeight:700,letterSpacing:"0.06em",textTransform:"uppercase",flexShrink:0},children:t("chat.goalLabel")}),(0,r.jsx)("span",{style:{minWidth:0,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"var(--text)"},children:e.objective}),(0,r.jsx)("span",{style:{flexShrink:0,color:"var(--text-dim)"},children:n?t("chat.goalPaused"):e.status}),(0,r.jsx)("span",{style:{flexShrink:0,color:"var(--text-dim)"},children:i})]})}function hZ({widgets:e}){return 0===e.length?null:(0,r.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:8,marginBottom:10},children:e.map(e=>(0,r.jsxs)("div",{style:{border:0,borderRadius:"var(--radius-surface)",background:"var(--bg-panel)",overflow:"hidden"},children:[(0,r.jsx)("div",{style:{padding:"5px 9px",background:"var(--bg-hover)",color:"var(--text-muted)",fontSize:11,fontFamily:"var(--font-mono)"},children:e.key}),(0,r.jsx)("pre",{style:{margin:0,padding:"8px 9px",color:"var(--text-muted)",fontSize:12,lineHeight:1.5,whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"var(--font-mono)"},children:e.lines.join("\n")})]},e.key))})}function hQ({notices:e,floating:t=!1,align:n="left"}){return 0===e.length?null:(0,r.jsx)("div",{style:{display:"flex",flexDirection:"column",alignItems:"right"===n?"flex-end":"stretch",marginBottom:10*!t},children:e.map((n,i)=>{let s="error"===n.type?"var(--danger)":"warning"===n.type?"var(--warning)":"success"===n.type?"var(--success)":"var(--accent)";return(0,r.jsxs)("div",{className:"notice-shelf-item",style:{display:"flex",alignItems:"center",gap:10,minHeight:60,height:60,maxHeight:60,marginBottom:6*(i!==e.length-1),overflow:"hidden",borderRadius:"var(--seed-radius-r3)",border:0,background:"var(--bg-subtle)",color:"var(--text-muted)",width:"fit-content",maxWidth:"min(100%, 620px)",boxShadow:t?"var(--seed-shadow-s3)":"var(--seed-shadow-s2)",fontSize:18,lineHeight:1.45,transformOrigin:"top center",animation:n.exiting?"notice-shelf-out 0.18s ease-in forwards":"notice-shelf-in 0.18s ease-out both",padding:"0 12px"},children:[(0,r.jsx)("span",{style:{width:7,height:7,borderRadius:"50%",background:s,flexShrink:0}}),(0,r.jsx)("span",{style:{padding:"14px 0",minWidth:0,maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n.message})]},n.id)})})}function hX({focusKey:e,label:t,labelledBy:n,maxBlockSize:s="min(56dvh, 620px)",onCancel:a,delivery:l,children:o}){let{t:c}=(0,F.s)(),d=(0,i.useRef)(null),u=(0,i.useRef)({key:"",element:null});if(u.current.key!==e){let t="u"<typeof document?null:document.activeElement;u.current={key:e,element:t instanceof HTMLElement&&!d.current?.contains(t)?t:null}}return(0,i.useEffect)(()=>{let e=d.current;e&&!e.contains(document.activeElement)&&(e.querySelector('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')??e).focus();let t=u.current.element;return()=>{if(!t?.isConnected)return;let n=document.activeElement;(null===n||n===document.body||e?.contains(n))&&t.focus()}},[e]),(0,r.jsxs)("div",{ref:d,role:"dialog","aria-modal":"false","aria-label":t,"aria-labelledby":n,className:"chat-response-surface",tabIndex:-1,onKeyDown:a?e=>{"Escape"===e.key&&(e.stopPropagation(),a())}:void 0,"aria-busy":l?.status==="sending"||void 0,style:{maxBlockSize:s},children:[l?(0,r.jsx)("p",{className:"chat-response-delivery",role:"failed"===l.status?"alert":"status","data-state":l.status,children:"sending"===l.status?c("chat.responseSending"):`${c("chat.responseFailed")}${l.error?` (${l.error})`:""}`}):null,o]})}function h0({request:e,onRespond:t,onActivity:n,delivery:s}){let{t:a}=(0,F.s)(),[l,o]=(0,i.useState)("editor"===e.method?e.prefill??"":""),[c,d]=(0,i.useState)({selected:{},custom:{}}),[u,h]=(0,i.useState)(""),p=(0,i.useRef)(0),m=(0,i.useCallback)(()=>{if("ask"!==e.method||!e.timeout||!n)return;let t=Date.now();t-p.current<1e3||(p.current=t,n(e))},[e,n]);(0,i.useEffect)(()=>{o("editor"===e.method?e.prefill??"":""),h(""),d("ask"===e.method?function(e){let t={};for(let n of e)t[n.id]=void 0!==n.recommended&&void 0!==n.options[n.recommended]?[n.recommended]:[];return{selected:t,custom:{}}}(e.questions):{selected:{},custom:{}})},[e]);let f=()=>{"confirm"===e.method?t(e,{confirmed:!0}):t(e,{value:l})};if("form"===e.method)return(0,r.jsx)(hX,{focusKey:e.id,label:a("chat.agentQuestion"),delivery:s,children:(0,r.jsx)(ds,{request:e,onRespond:t,onActivity:n,delivery:s},e.id)});if("ask"===e.method){var g;let n=(g=e.questions,g.every(e=>(c.selected[e.id]?.length??0)>0||(c.custom[e.id]?.trim().length??0)>0)),i=()=>{if(n){var r;t(e,{value:(r=e.questions,JSON.stringify({kind:"submit",results:r.map(e=>{let t=c.custom[e.id]?.trim();return{id:e.id,question:e.question,options:e.options.map(e=>e.label),multi:e.multi??!1,selectedOptions:(c.selected[e.id]??[]).map(t=>e.options[t]?.label).filter(e=>void 0!==e),...t?{customInput:t}:{}}})}))})}};return(0,r.jsx)(hX,{focusKey:e.id,label:a("chat.agentQuestion"),onCancel:()=>t(e,{cancelled:!0}),delivery:s,children:(0,r.jsxs)("div",{style:{display:"flex",flexDirection:"column",minHeight:0},children:[(0,r.jsx)("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"12px 16px"},children:(0,r.jsxs)("div",{style:{minWidth:0},children:[(0,r.jsx)("div",{style:{color:"var(--text)",fontSize:"var(--seed-font-size-t4-static)",fontWeight:600},children:a("chat.agentQuestion")}),(0,r.jsx)("div",{style:{marginTop:2,color:"var(--text-muted)",fontSize:"var(--seed-font-size-t3-static)"},children:a("chat.agentQuestionHint")}),e.timeout?(0,r.jsx)("div",{style:{marginTop:2,color:"var(--text-muted)",fontSize:"var(--seed-font-size-t3-static)"},children:a("chat.askAutoSelectHint",{seconds:Math.round(e.timeout/1e3)})}):null]})}),(0,r.jsx)("div",{style:{flex:"1 1 auto",minHeight:0,overflowY:"auto",padding:16},children:(0,r.jsx)("div",{style:{display:"grid",gap:20},children:e.questions.map((t,n)=>{let s=c.selected[t.id]??[];return(0,r.jsxs)("section",{style:{paddingTop:20*(0!==n)},children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:8,marginBottom:10},children:[t.header&&(0,r.jsx)("span",{style:{color:"var(--text-muted)",fontSize:"var(--seed-font-size-t2-static)",fontWeight:600},children:t.header}),e.questions.length>1&&(0,r.jsxs)("span",{style:{marginLeft:"auto",color:"var(--text-muted)",fontSize:"var(--seed-font-size-t2-static)",fontVariantNumeric:"tabular-nums"},children:[n+1,"/",e.questions.length]})]}),(0,r.jsx)("div",{style:{marginBottom:10,color:"var(--text)",fontSize:"var(--seed-font-size-t4-static)",fontWeight:600,lineHeight:1.5},children:t.question}),(0,r.jsx)("div",{role:t.multi?"group":"radiogroup","aria-label":t.question,style:{display:"grid",gap:4},children:t.options.map((e,n)=>{let i=s.includes(n),l=t.recommended===n;return(0,r.jsxs)("button",{type:"button",role:t.multi?"checkbox":"radio","aria-checked":i,onClick:()=>{m(),d(e=>(function(e,t,n){let r=e.selected[t.id]??[];if(t.multi){let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];return{...e,selected:{...e.selected,[t.id]:i}}}return{selected:{...e.selected,[t.id]:[n]},custom:{...e.custom,[t.id]:""}}})(e,t,n))},style:{display:"grid",gridTemplateColumns:"18px minmax(0, 1fr) auto",alignItems:"start",gap:9,width:"100%",minHeight:40,padding:"9px 10px",border:0,borderRadius:"var(--radius-control)",background:i?"var(--bg-selected)":"transparent",color:"var(--text)",cursor:"pointer",textAlign:"left"},children:[(0,r.jsx)("span",{"aria-hidden":"true",style:{display:"grid",placeItems:"center",width:16,height:16,marginTop:1,border:0,borderRadius:t.multi?"var(--radius-control)":"50%",background:i?"var(--seed-color-fg-neutral)":"var(--bg-selected)",color:"var(--seed-color-fg-neutral-inverted)",fontSize:"var(--seed-font-size-t2-static)",lineHeight:1},children:i&&(t.multi?(0,r.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,r.jsx)("polyline",{points:"2 5.2 4.1 7.2 8 2.8"})}):(0,r.jsx)("span",{style:{width:5,height:5,borderRadius:"50%",background:"currentColor"}}))}),(0,r.jsxs)("span",{style:{minWidth:0},children:[(0,r.jsx)("span",{style:{display:"block",fontSize:"var(--seed-font-size-t4-static)",fontWeight:i?600:500},children:e.label}),e.description&&(0,r.jsx)("span",{style:{display:"block",marginTop:3,color:"var(--text-muted)",fontSize:"var(--seed-font-size-t3-static)",lineHeight:1.45},children:e.description}),i&&e.preview&&(0,r.jsx)("span",{style:{display:"block",marginTop:8,padding:"7px 8px",borderRadius:"var(--radius-control)",background:"var(--bg-hover)",color:"var(--text-muted)",fontSize:"var(--seed-font-size-t3-static)",lineHeight:1.5,whiteSpace:"pre-wrap"},children:e.preview})]}),l&&(0,r.jsx)("span",{style:{color:"var(--text-muted)",fontSize:"var(--seed-font-size-t2-static)",fontWeight:600},children:a("chat.recommended")})]},`${t.id}:${n}`)})}),(0,r.jsx)("input",{value:c.custom[t.id]??"",onChange:e=>{m();let n=e.target.value;d(e=>{let r;return r={...e.custom,[t.id]:n},t.multi||0===n.trim().length?{...e,custom:r}:{selected:{...e.selected,[t.id]:[]},custom:r}})},onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&"Enter"===e.key&&i()},placeholder:a("chat.customAnswer"),"aria-label":a("chat.customAnswer"),style:{width:"100%",height:36,marginTop:9,padding:"0 10px",border:0,borderRadius:"var(--radius-control)",background:"var(--bg)",color:"var(--text)",fontFamily:"var(--seed-font-family)",fontSize:"var(--seed-font-size-t4-static)"}})]},t.id)})})}),(0,r.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"flex-end",gap:8,padding:"12px 16px"},children:[(0,r.jsx)("button",{type:"button",onClick:()=>t(e,{cancelled:!0}),style:{minHeight:36,padding:"0 12px",border:0,borderRadius:"var(--radius-control)",background:"var(--bg-hover)",color:"var(--text-muted)",cursor:"pointer"},children:a("chat.cancel")}),(0,r.jsx)("button",{type:"button",onClick:()=>t(e,{value:JSON.stringify({kind:"chat"})}),style:{minHeight:36,padding:"0 12px",border:0,borderRadius:"var(--radius-control)",background:"var(--bg-hover)",color:"var(--text)",cursor:"pointer"},children:a("chat.chatAboutThis")}),(0,r.jsx)("button",{type:"button",disabled:!n||s?.status==="sending",onClick:i,style:{minHeight:36,padding:"0 14px",border:0,borderRadius:"var(--radius-control)",background:n&&s?.status!=="sending"?"var(--seed-color-bg-neutral-inverted)":"var(--seed-color-bg-disabled)",color:n&&s?.status!=="sending"?"var(--seed-color-fg-neutral-inverted)":"var(--seed-color-fg-disabled)",cursor:n&&s?.status!=="sending"?"pointer":"not-allowed",fontWeight:600},children:s?.status==="sending"?a("chat.responseSending"):a("chat.submitAnswer")})]})]})})}return"plan_review"===e.method?(0,r.jsx)(hX,{focusKey:e.id,labelledBy:`plan-review-${e.id}`,maxBlockSize:"min(64dvh, 760px)",delivery:s,children:(0,r.jsxs)("div",{style:{display:"flex",flexDirection:"column",minHeight:0},children:[(0,r.jsxs)("div",{style:{padding:"12px 16px"},children:[(0,r.jsx)("div",{style:{color:"var(--text-muted)",fontSize:"var(--seed-font-size-t2-static)",fontWeight:600},children:a("chat.planApproval")}),(0,r.jsx)("div",{id:`plan-review-${e.id}`,style:{marginTop:4,color:"var(--text)",fontSize:"var(--seed-font-size-t5-static)",fontWeight:600},children:e.title}),(0,r.jsx)("div",{style:{marginTop:5,color:"var(--text-muted)",fontFamily:"var(--font-mono)",fontSize:"var(--seed-font-size-t2-static)",overflowWrap:"anywhere"},children:e.planFilePath})]}),(0,r.jsx)("div",{style:{flex:"1 1 auto",minHeight:0,overflowY:"auto",padding:"18px 20px"},children:(0,r.jsx)(nk,{children:e.planContent})}),(0,r.jsxs)("div",{style:{padding:"12px 16px"},children:[(0,r.jsx)("textarea",{value:u,onChange:e=>h(e.target.value),placeholder:a("chat.planFeedback"),"aria-label":a("chat.planFeedback"),style:{width:"100%",minHeight:64,maxHeight:150,padding:"9px 10px",border:0,borderRadius:"var(--radius-control)",outline:"none",resize:"vertical",background:"var(--bg)",color:"var(--text)",fontFamily:"var(--seed-font-family)",fontSize:"var(--seed-font-size-t4-static)",lineHeight:1.5}}),(0,r.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"flex-end",gap:8,marginTop:9},children:[(0,r.jsx)("button",{type:"button",onClick:()=>t(e,{value:JSON.stringify({action:"refine",feedback:u.trim()})}),style:{minHeight:36,padding:"0 12px",border:0,borderRadius:"var(--radius-control)",background:"var(--bg-hover)",color:"var(--text)",cursor:"pointer"},children:a("chat.refinePlan")}),(0,r.jsx)("button",{type:"button",onClick:()=>t(e,{value:JSON.stringify({action:"approve"})}),style:{minHeight:36,padding:"0 14px",border:0,borderRadius:"var(--radius-control)",background:"var(--seed-color-bg-neutral-inverted)",color:"var(--seed-color-fg-neutral-inverted)",cursor:"pointer",fontWeight:600},children:a("chat.approvePlan")})]})]})]})}):(0,r.jsx)(hX,{focusKey:e.id,labelledBy:`extension-request-${e.id}`,onCancel:()=>t(e,{cancelled:!0}),delivery:s,children:(0,r.jsxs)("div",{style:{display:"flex",flexDirection:"column",minHeight:0},children:[(0,r.jsxs)("div",{style:{padding:"12px 14px"},children:[(0,r.jsx)("div",{id:`extension-request-${e.id}`,style:{color:"var(--text)",fontSize:"var(--seed-font-size-t4-static)",fontWeight:600},children:e.title}),(0,r.jsx)("div",{style:{marginTop:3,color:"var(--text-muted)",fontSize:"var(--seed-font-size-t2-static)",fontFamily:"var(--font-mono)"},children:a("chat.extensionRequest")})]}),(0,r.jsxs)("div",{style:{flex:"1 1 auto",minHeight:0,overflowY:"auto",padding:14},children:["confirm"===e.method&&(0,r.jsx)("div",{style:{color:"var(--text-muted)",fontSize:"var(--seed-font-size-t3-static)",lineHeight:1.6,whiteSpace:"pre-wrap"},children:e.message}),"select"===e.method&&(0,r.jsx)("div",{style:{display:"grid",gap:8},children:e.options.map(n=>(0,r.jsx)("button",{onClick:()=>t(e,{value:n}),style:{width:"100%",minHeight:40,padding:"9px 10px",borderRadius:"var(--radius-control)",border:0,background:"var(--bg-hover)",color:"var(--text)",cursor:"pointer",textAlign:"left",fontSize:"var(--seed-font-size-t4-static)"},children:n},n))}),"input"===e.method&&(0,r.jsx)("input",{autoFocus:!0,value:l,placeholder:e.placeholder,onChange:e=>o(e.target.value),onKeyDown:e=>{"Enter"===e.key&&f()},style:{width:"100%",padding:"9px 10px",borderRadius:"var(--radius-control)",border:0,background:"var(--bg)",color:"var(--text)",outline:"none",fontSize:"var(--seed-font-size-t4-static)"}}),"editor"===e.method&&(0,r.jsx)("textarea",{autoFocus:!0,value:l,onChange:e=>o(e.target.value),onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&"Enter"===e.key&&f()},style:{width:"100%",minHeight:220,padding:10,borderRadius:"var(--radius-control)",border:0,background:"var(--bg)",color:"var(--text)",outline:"none",resize:"vertical",fontSize:"var(--seed-font-size-t3-static)",lineHeight:1.55,fontFamily:"var(--font-mono)"}})]}),(0,r.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"flex-end",gap:8,padding:"12px 14px"},children:[(0,r.jsx)("button",{onClick:()=>t(e,{cancelled:!0}),style:{minHeight:36,padding:"0 12px",borderRadius:"var(--radius-control)",border:0,background:"var(--bg-hover)",color:"var(--text-muted)",cursor:"pointer"},children:a("chat.cancel")}),"confirm"===e.method?(0,r.jsx)("button",{onClick:f,style:{minHeight:36,padding:"0 14px",borderRadius:"var(--radius-control)",border:0,background:"var(--seed-color-bg-neutral-inverted)",color:"var(--seed-color-fg-neutral-inverted)",cursor:"pointer",fontWeight:600},children:a("chat.confirm")}):"select"!==e.method?(0,r.jsx)("button",{onClick:f,style:{minHeight:36,padding:"0 14px",borderRadius:"var(--radius-control)",border:0,background:"var(--seed-color-bg-neutral-inverted)",color:"var(--seed-color-fg-neutral-inverted)",cursor:"pointer",fontWeight:600},children:a("chat.submit")}):null]})]})})}function h1({request:e,onInput:t}){let{t:n}=(0,F.s)(),s=(0,i.useRef)(null),a=(0,i.useRef)(!1),l=eO(e.lines);return(0,i.useEffect)(()=>{s.current?.focus()},[e.id]),(0,r.jsx)("div",{style:{position:"absolute",inset:0,zIndex:95,display:"flex",alignItems:"center",justifyContent:"center",padding:20,background:"var(--seed-color-bg-overlay-muted)"},children:(0,r.jsxs)("div",{role:"dialog","aria-modal":"true",onClick:e=>{e.target.closest("button")||s.current?.focus()},style:{position:"relative",width:"min(920px, 100%)",maxHeight:"min(760px, calc(100vh - 40px))",border:0,borderRadius:"var(--radius-surface)",background:"var(--bg)",boxShadow:"var(--seed-shadow-s3)",overflow:"hidden",outline:"none"},children:[(0,r.jsx)("textarea",{ref:s,"aria-label":n("chat.extensionInput"),autoCapitalize:"off",autoComplete:"off",autoCorrect:"off",spellCheck:!1,onKeyDown:n=>{if(a.current||n.nativeEvent.isComposing)return;let r=function(e){if(e.metaKey||e.ctrlKey&&!e.altKey&&"v"===e.key.toLowerCase())return null;if(e.ctrlKey&&!e.altKey){let t=function(e){if(1!==e.length)return null;let t=e.toUpperCase().charCodeAt(0);return t>=64&&t<=95?String.fromCharCode(31&t):"?"===e?"":null}(e.key);if(t)return t}if(e.altKey&&!e.ctrlKey){if("Backspace"===e.key)return"\x1b\x7f";let t=eW[e.key];if(t)return t;if(1===e.key.length)return`\x1b${e.key}`}return"Enter"===e.key?e.shiftKey?"\n":"\r":"Tab"===e.key?e.shiftKey?"\x1b[Z":" ":eD[e.key]??null}(n);r&&(n.preventDefault(),n.stopPropagation(),t(e,r))},onInput:n=>{if(a.current||n.nativeEvent.isComposing)return;let r=n.currentTarget.value;n.currentTarget.value="",r&&t(e,r)},onCompositionStart:()=>{a.current=!0},onCompositionEnd:n=>{a.current=!1;let r=n.currentTarget;queueMicrotask(()=>{let n=r.value;r.value="",n&&t(e,n)})},onPaste:n=>{n.preventDefault();let r=n.clipboardData.getData("text");r&&t(e,`\x1b[200~${r}\x1b[201~`)},style:{position:"absolute",width:1,height:1,padding:0,border:0,opacity:0,pointerEvents:"none"}}),(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,padding:"10px 12px",background:"var(--bg-panel)"},children:[(0,r.jsx)("div",{style:{color:"var(--text)",fontSize:13,fontWeight:650},children:n("chat.extensionPanel")}),(0,r.jsx)("button",{onClick:()=>t(e,"\x03"),style:{padding:"5px 9px",borderRadius:"var(--radius-control)",border:0,background:"var(--bg-hover)",color:"var(--text-muted)",cursor:"pointer",fontSize:12},children:n("chat.close")})]}),(0,r.jsx)("pre",{style:{margin:0,padding:14,maxHeight:"calc(min(760px, 100vh - 40px) - 48px)",overflow:"auto",background:"var(--bg-panel)",color:"var(--text)",fontFamily:"var(--font-mono)",fontSize:13,lineHeight:1.45,whiteSpace:"pre"},children:(l.length?l:[""]).map((e,t,n)=>{var s;return(0,r.jsxs)(i.Fragment,{children:[(s=`line-${t}`,ez(e).map((e,t)=>Object.keys(e.style).length>0?(0,r.jsx)("span",{style:e.style,children:e.text},`${s}-${t}`):e.text)),t<n.length-1?"\n":null]},t)})})]})})}var h2=n(40960),h8=n.n(h2);function h4({sessionId:e,refreshKey:t,compact:n}){let{t:s}=(0,F.s)(),[a,o]=(0,i.useState)(null),[c,d]=(0,i.useState)(!1),[u,h]=(0,i.useState)(null),p=(0,i.useRef)(e);p.current=e;let m=(0,i.useRef)(0);(0,i.useEffect)(()=>{if(!e)return;let t=!1,n=++m.current;return fetch(`/api/agent/${encodeURIComponent(e)}`).then(e=>e.json()).then(r=>{if(t||n!==m.current)return;let i=r.running?r.state?.computerTakeover:null;o(i?{sessionId:e,state:{enabled:!0===i.enabled,available:!0===i.available}}:null),h(null)}).catch(()=>{}),()=>{t=!0}},[e,t]);let f=(0,i.useCallback)(async e=>{let t=p.current;if(t){d(!0),h(null);try{let n=await fetch(`/api/agent/${encodeURIComponent(t)}/computer-takeover`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({enabled:e})}),r=await n.json();if(!n.ok)throw Error("shared_settings"===r.code?s("computerTakeover.shared"):r.error??n.statusText);p.current===t&&(m.current+=1,o({sessionId:t,state:{enabled:!0===r.enabled,available:!0!==r.enabled}}))}catch(e){p.current===t&&h(s("computerTakeover.failed",{error:e instanceof Error?e.message:String(e)}))}finally{d(!1)}}},[s]),g=a&&a.sessionId===e?a.state:null;if(!g||!g.enabled&&!g.available)return null;let x=g.enabled,v=x?s("computerTakeover.active"):s("computerTakeover.allow"),y=u??(x?s("computerTakeover.activeHint"):s("computerTakeover.allowHint"));return(0,r.jsxs)(l.r,{className:`workspace-header-action workspace-takeover${x?` ${h8().active}`:""}`,variant:x?"neutralWeak":"ghost",size:"small",type:"button",disabled:c,"aria-pressed":x,"aria-label":v,title:y,onClick:()=>void f(!x),children:[(0,r.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,r.jsx)("path",{d:"M5 3l14 7-6 2-2 6-6-15Z"})}),(x||!n)&&(0,r.jsx)("span",{children:v})]})}let h5={folder:(0,r.jsx)("path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"}),"list-ordered":(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("path",{d:"M10 12h11"}),(0,r.jsx)("path",{d:"M10 18h11"}),(0,r.jsx)("path",{d:"M10 6h11"}),(0,r.jsx)("path",{d:"M4 10h2"}),(0,r.jsx)("path",{d:"M4 6h1v4"}),(0,r.jsx)("path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1"})]}),languages:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("path",{d:"m5 8 6 6"}),(0,r.jsx)("path",{d:"m4 14 6-6 2-3"}),(0,r.jsx)("path",{d:"M2 5h12"}),(0,r.jsx)("path",{d:"M7 2h1"}),(0,r.jsx)("path",{d:"m22 22-5-10-5 10"}),(0,r.jsx)("path",{d:"M14 18h6"})]}),repeat:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("path",{d:"m17 2 4 4-4 4"}),(0,r.jsx)("path",{d:"M3 11v-1a4 4 0 0 1 4-4h14"}),(0,r.jsx)("path",{d:"m7 22-4-4 4-4"}),(0,r.jsx)("path",{d:"M21 13v1a4 4 0 0 1-4 4H3"})]}),activity:(0,r.jsx)("path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2"}),settings:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"}),(0,r.jsx)("circle",{cx:"12",cy:"12",r:"3"})]}),"panel-right":(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}),(0,r.jsx)("path",{d:"M15 3v18"})]}),"panel-left":(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}),(0,r.jsx)("path",{d:"M9 3v18"})]}),menu:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("line",{x1:"4",x2:"20",y1:"12",y2:"12"}),(0,r.jsx)("line",{x1:"4",x2:"20",y1:"6",y2:"6"}),(0,r.jsx)("line",{x1:"4",x2:"20",y1:"18",y2:"18"})]}),"chevron-right":(0,r.jsx)("path",{d:"m9 18 6-6-6-6"}),"chevron-up":(0,r.jsx)("path",{d:"m18 15-6-6-6 6"}),"chevron-down":(0,r.jsx)("path",{d:"m6 9 6 6 6-6"}),"circle-check":(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,r.jsx)("path",{d:"m9 12 2 2 4-4"})]}),"circle-alert":(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,r.jsx)("line",{x1:"12",x2:"12",y1:"8",y2:"12"}),(0,r.jsx)("line",{x1:"12",x2:"12.01",y1:"16",y2:"16"})]}),ellipsis:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("circle",{cx:"12",cy:"12",r:"1"}),(0,r.jsx)("circle",{cx:"19",cy:"12",r:"1"}),(0,r.jsx)("circle",{cx:"5",cy:"12",r:"1"})]}),x:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("path",{d:"M18 6 6 18"}),(0,r.jsx)("path",{d:"m6 6 12 12"})]}),check:(0,r.jsx)("path",{d:"M20 6 9 17l-5-5"}),"message-square":(0,r.jsx)("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"}),"messages-square":(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z"}),(0,r.jsx)("path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1"})]}),"list-tree":(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("path",{d:"M21 12h-8"}),(0,r.jsx)("path",{d:"M21 6H8"}),(0,r.jsx)("path",{d:"M21 18h-8"}),(0,r.jsx)("path",{d:"M3 6v4c0 1.1.9 2 2 2h3"}),(0,r.jsx)("path",{d:"M3 10v6c0 1.1.9 2 2 2h3"})]}),bot:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("path",{d:"M12 8V4H8"}),(0,r.jsx)("rect",{width:"16",height:"12",x:"4",y:"8",rx:"2"}),(0,r.jsx)("path",{d:"M2 14h2"}),(0,r.jsx)("path",{d:"M20 14h2"}),(0,r.jsx)("path",{d:"M15 13v2"}),(0,r.jsx)("path",{d:"M9 13v2"})]}),"file-text":(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"}),(0,r.jsx)("path",{d:"M14 2v4a2 2 0 0 0 2 2h4"}),(0,r.jsx)("path",{d:"M10 9H8"}),(0,r.jsx)("path",{d:"M16 13H8"}),(0,r.jsx)("path",{d:"M16 17H8"})]}),users:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),(0,r.jsx)("circle",{cx:"9",cy:"7",r:"4"}),(0,r.jsx)("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),(0,r.jsx)("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]}),"user-round":(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("circle",{cx:"12",cy:"8",r:"5"}),(0,r.jsx)("path",{d:"M20 21a8 8 0 0 0-16 0"})]}),gauge:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("path",{d:"m12 14 4-4"}),(0,r.jsx)("path",{d:"M3.34 19a10 10 0 1 1 17.32 0"})]}),puzzle:(0,r.jsx)("path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z"}),brain:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z"}),(0,r.jsx)("path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z"}),(0,r.jsx)("path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4"}),(0,r.jsx)("path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375"}),(0,r.jsx)("path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5"}),(0,r.jsx)("path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396"}),(0,r.jsx)("path",{d:"M19.938 10.5a4 4 0 0 1 .585.396"}),(0,r.jsx)("path",{d:"M6 18a4 4 0 0 1-1.967-.516"}),(0,r.jsx)("path",{d:"M19.967 17.484A4 4 0 0 1 18 18"})]}),"chart-column":(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}),(0,r.jsx)("path",{d:"M18 17V9"}),(0,r.jsx)("path",{d:"M13 17V5"}),(0,r.jsx)("path",{d:"M8 17v-3"})]}),"maximize-2":(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("polyline",{points:"15 3 21 3 21 9"}),(0,r.jsx)("polyline",{points:"9 21 3 21 3 15"}),(0,r.jsx)("line",{x1:"21",x2:"14",y1:"3",y2:"10"}),(0,r.jsx)("line",{x1:"3",x2:"10",y1:"21",y2:"14"})]}),search:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("circle",{cx:"11",cy:"11",r:"8"}),(0,r.jsx)("path",{d:"m21 21-4.3-4.3"})]})};function h6({name:e,size:t=16}){return(0,r.jsx)("svg",{className:"workbench-icon",width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:h5[e]})}function h3({size:e=28}){return(0,r.jsx)("svg",{className:"workbench-mark",width:e,height:e,viewBox:"0 0 100 100","aria-hidden":"true",focusable:"false",children:(0,r.jsxs)("g",{transform:"translate(15 15) scale(0.7)",children:[(0,r.jsx)("path",{d:"M77.9 30.5 A34 34 0 0 0 16 50 A26 26 0 0 0 68 50",fill:"none",stroke:"currentColor",strokeWidth:"10",strokeLinecap:"round"}),(0,r.jsx)("circle",{cx:"42",cy:"50",r:"8.5",fill:"var(--brand-lamp)"})]})})}function h7({onPick:e,t}){let[n,s]=(0,i.useState)(""),[a,l]=(0,i.useState)({kind:"idle"}),o=(0,i.useRef)(null),c=n.trim();(0,i.useEffect)(()=>{if(c.length<2)return void l({kind:"idle"});let e=new AbortController;l({kind:"loading"});let t=setTimeout(()=>{fetch(`/api/sessions/search?q=${encodeURIComponent(c)}`,{signal:e.signal,cache:"no-store"}).then(async e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);l({kind:"done",data:await e.json()})}).catch(()=>{e.signal.aborted||l({kind:"error"})})},250);return()=>{clearTimeout(t),e.abort()}},[c]);let d=e=>{let t=o.current?.querySelectorAll("button");t&&0!==t.length&&t[Math.max(0,Math.min(t.length-1,e))]?.focus()},u="done"===a.kind?a.data:null,h=u?.truncated?t(`palette.searchTruncated.${u.truncated}`,{scanned:u.scannedSessions,total:u.totalSessions}):null;return(0,r.jsxs)("div",{className:"palette-search",children:[(0,r.jsxs)("div",{className:"palette-search-field",children:[(0,r.jsx)(h6,{name:"search"}),(0,r.jsx)("input",{type:"search",value:n,onChange:e=>s(e.target.value),onKeyDown:t=>{if(!t.nativeEvent.isComposing){if("ArrowDown"===t.key)t.preventDefault(),d(0);else if("Enter"===t.key&&u&&u.hits.length>0){t.preventDefault();let n=u.hits[0],r=u.sessions[n.sessionId];r&&e(r,n,u.query)}}},placeholder:t("palette.searchPlaceholder"),"aria-label":t("palette.searchPlaceholder"),autoComplete:"off",spellCheck:!1}),(0,r.jsx)("kbd",{"aria-hidden":"true",children:"Ctrl K"})]}),c.length>=2&&(0,r.jsxs)("div",{className:"palette-search-results",role:"region","aria-label":t("palette.searchResults"),"aria-busy":"loading"===a.kind,children:[(0,r.jsxs)("p",{className:"palette-search-status","aria-live":"polite",children:["loading"===a.kind&&t("palette.searching"),"error"===a.kind&&t("palette.searchFailed"),u&&(0===u.hits.length?t("palette.searchEmpty"):t("palette.searchHits",{count:u.hits.length})),h?` \xb7 ${h}`:"",u&&u.compactedHits>0?` \xb7 ${t("palette.searchCompacted",{count:u.compactedHits})}`:""]}),u&&u.hits.length>0&&(0,r.jsx)("div",{ref:o,className:"palette-search-list",children:u.hits.map((n,i)=>{let s=u.sessions[n.sessionId],a=n.matchStart+u.query.length;return(0,r.jsxs)("button",{type:"button",disabled:!s,onClick:()=>s&&e(s,n,u.query),onKeyDown:e=>{("ArrowDown"===e.key||"ArrowUp"===e.key)&&(e.preventDefault(),d(i+("ArrowDown"===e.key?1:-1)))},children:[(0,r.jsxs)("span",{className:"palette-search-title",children:[(0,r.jsx)("span",{children:s?s.name?.trim()||s.firstMessage?.trim()||s.id:""}),(0,r.jsx)("small",{children:"user"===n.role?t("palette.searchRoleUser"):t("palette.searchRoleAssistant")})]}),(0,r.jsxs)("span",{className:"palette-search-snippet",children:[n.snippet.slice(0,n.matchStart),(0,r.jsx)("mark",{children:n.snippet.slice(n.matchStart,a)}),n.snippet.slice(a)]})]},`${n.sessionId}:${n.entryId}`)})})]})]})}var h9=n(50640),pe=n(73620);let pt=/^(?:\uFEFF)?---[ \t]*(?:\r\n|\n|\r)/;function pn(e){return function e(t,n){if(null==t)return"";if("string"==typeof t)return t;if("number"==typeof t||"boolean"==typeof t)return String(t);if(Array.isArray(t)){if(n.has(t))return"[Circular]";n.add(t);try{return t.map(t=>e(t,n)).filter(Boolean).join(", ")}finally{n.delete(t)}}if("object"==typeof t)try{return JSON.stringify(t)??Object.prototype.toString.call(t)}catch{return Object.prototype.toString.call(t)}return String(t)}(e,new WeakSet)}let pr=["tags","categories","keywords","tag","category"];function pi({data:e}){var t;if(!e)return null;let n=Object.entries(e);if(0===n.length)return null;let i="string"==typeof(t=e.title)?t.trim()||null:"number"==typeof t||"boolean"==typeof t?String(t):null,s=pr.find(t=>Array.isArray(e[t])),a=s?e[s].map(pn).filter(Boolean):[],l=n.filter(([e])=>e!==s&&("title"!==e||!i));return(0,r.jsxs)("div",{className:"markdown-frontmatter",children:[i&&(0,r.jsx)("div",{className:"markdown-frontmatter-title",children:i}),a.length>0&&(0,r.jsx)("div",{className:"markdown-frontmatter-tags",children:a.map((e,t)=>(0,r.jsx)("span",{className:"markdown-frontmatter-tag",children:e},`${e}-${t}`))}),l.length>0&&(0,r.jsx)("dl",{className:"markdown-frontmatter-rows",children:l.map(([e,t])=>(0,r.jsxs)("div",{className:"markdown-frontmatter-row",children:[(0,r.jsx)("dt",{children:e}),(0,r.jsx)("dd",{children:function(e){let t=pn(e);return t?"string"==typeof e&&/^(https?:\/\/|mailto:)/i.test(e)?(0,r.jsx)("a",{href:e,target:"_blank",rel:"noopener noreferrer",children:t}):t:null}(t)})]},e))})]})}var ps=n(8745);let pa=(0,i.createContext)(null),pl=(0,r.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,r.jsx)("path",{d:"M9.5 2.5h4v4M6.5 13.5h-4v-4M13.5 2.5 9 7M2.5 13.5 7 9"})}),po=(0,r.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,r.jsx)("path",{d:"M13.5 6.5h-4v-4M2.5 9.5h4v4M9.5 6.5l4-4M6.5 9.5l-4 4"})}),pc=(0,r.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,r.jsx)("path",{d:"m10 3-5 5 5 5"})}),pd=(0,r.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round","aria-hidden":"true",children:(0,r.jsx)("path",{d:"m4 4 8 8M12 4l-8 8"})}),pu=(0,r.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:[(0,r.jsx)("circle",{cx:"3.5",cy:"8",r:"1.2"}),(0,r.jsx)("circle",{cx:"8",cy:"8",r:"1.2"}),(0,r.jsx)("circle",{cx:"12.5",cy:"8",r:"1.2"})]});function ph({back:e,title:t,titleTooltip:n,titleRef:i,titleAdornment:s,subtitle:a,subtitleKind:d="text",state:u,viewSwitch:h,actions:p=[],close:m}){let{t:f}=(0,F.s)();return(0,r.jsxs)("header",{className:"panel-header",children:[e&&(0,r.jsx)(l.r,{className:"panel-header-button",variant:"ghost",size:"small",layout:"iconOnly",onClick:e.onClick,"aria-label":e.label,title:e.label,children:(0,r.jsx)(c.In,{size:"16px",svg:pc})}),(0,r.jsxs)("div",{className:"panel-header-heading",children:[(0,r.jsx)("h2",{className:"panel-header-title",title:n,ref:i,tabIndex:i?-1:void 0,children:t}),s,a&&("path"===d?(0,r.jsx)("span",{className:"panel-header-subtitle is-path",title:a,dir:"rtl",children:(0,r.jsx)("bdi",{dir:"ltr",children:a})}):(0,r.jsx)("span",{className:"panel-header-subtitle",title:a,children:a}))]}),u&&(0,r.jsx)("div",{className:"panel-header-state",children:u}),h&&h.options.length>1&&(0,r.jsxs)(ps.A.Root,{className:"panel-header-switch","aria-label":h.label,value:h.value,onValueChange:e=>h.onChange(e),children:[h.options.map(e=>(0,r.jsxs)(ps.A.Item,{value:e.value,title:e.title,children:[(0,r.jsx)(ps.A.ItemHiddenInput,{}),e.label]},e.value)),(0,r.jsx)(ps.A.Indicator,{})]}),p.length>0&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"panel-header-actions",children:p.map(e=>e.href?(0,r.jsx)("a",{className:"panel-header-link-button",href:e.href,download:e.download,"aria-label":e.label,title:e.title??e.label,children:e.icon},e.id):(0,r.jsx)(l.r,{className:"panel-header-button",variant:"ghost",size:"small",layout:"iconOnly",onClick:e.onClick,onPointerDown:e.onPointerDown,disabled:e.disabled,"aria-pressed":e.pressed,"aria-label":e.label,title:e.title??e.label,children:(0,r.jsx)(c.In,{size:"16px",svg:e.icon})},e.id))}),(0,r.jsxs)(o.k.Root,{placement:"bottom-end",strategy:"fixed",children:[(0,r.jsx)(o.k.Trigger,{asChild:!0,children:(0,r.jsx)(l.r,{className:"panel-header-button panel-header-more",variant:"ghost",size:"small",layout:"iconOnly","aria-label":f("panel.more"),title:f("panel.more"),children:(0,r.jsx)(c.In,{size:"16px",svg:pu})})}),(0,r.jsx)(o.k.Positioner,{children:(0,r.jsx)(o.k.Content,{"aria-label":f("panel.more"),children:(0,r.jsx)(o.k.ScrollArea,{children:(0,r.jsx)(o.k.Group,{children:p.map(e=>(0,r.jsx)(o.k.Item,{disabled:e.disabled,onClick:()=>(function(e){if(e.onClick)return void e.onClick();if(!e.href)return;let t=document.createElement("a");t.href=e.href,e.download&&(t.download=e.download),t.click()})(e),children:(0,r.jsx)(o.k.ItemBody,{children:(0,r.jsx)(o.k.ItemLabel,{children:e.label})})},e.id))})})})})]})]}),(0,r.jsx)(pp,{}),m&&(0,r.jsx)(l.r,{className:"panel-header-button",variant:"ghost",size:"small",layout:"iconOnly",onClick:m.onClick,"aria-label":m.label,title:m.label,children:(0,r.jsx)(c.In,{size:"16px",svg:pd})})]})}function pp({className:e="panel-header-button"}){let{t}=(0,F.s)(),n=(0,i.useContext)(pa);if(!n)return null;let s=t(n.expanded?"panel.restore":"panel.expand");return(0,r.jsx)(l.r,{className:e,"data-panel-expand":"",variant:"ghost",size:"small",layout:"iconOnly","aria-pressed":n.expanded,"aria-label":s,title:s,onClick:n.onToggle,children:(0,r.jsx)(c.In,{size:"16px",svg:n.expanded?po:pl})})}let pm="cuelo-html-pick",pf="cuelo-html-pick-exit";function pg(e,t){return"string"==typeof e&&e.length<=t}function px(e){return"number"==typeof e&&Number.isFinite(e)}function pv({content:e,title:t,picking:n,onExitPick:s,onRequestEdit:a}){let{t:o}=(0,F.s)(),c=(0,i.useRef)(null),d=(0,i.useMemo)(()=>{if(!n)return{nonce:"",srcDoc:e};let t=crypto.randomUUID();return{nonce:t,srcDoc:function(e,t){var n;let r=`<script>${(n=t,`(function(){
21
21
  var NONCE=${JSON.stringify(n)},TYPE=${JSON.stringify(pm)},EXIT=${JSON.stringify(pf)};
22
22
  var host=window.parent;
23
23
  if(document.currentScript)document.currentScript.remove();