cc-viewer 1.6.190 → 1.6.192

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 (134) hide show
  1. package/dist/assets/App-DuGHwadX.js +31 -0
  2. package/dist/assets/AppHeader.module-CozRDKfP.js +573 -0
  3. package/dist/assets/Mobile-Bab634xx.js +10 -0
  4. package/dist/assets/_baseUniq-DJPPdHyT.js +1 -0
  5. package/dist/assets/arc-DZ3Bjq-l.js +1 -0
  6. package/dist/assets/architectureDiagram-Q4EWVU46-xy0J2lr0.js +36 -0
  7. package/dist/assets/blockDiagram-DXYQGD6D-CoUm8UC5.js +132 -0
  8. package/dist/assets/c4Diagram-AHTNJAMY-CFHX4Dfx.js +10 -0
  9. package/dist/assets/channel-G3S1FOvm.js +1 -0
  10. package/dist/assets/chunk-4BX2VUAB-CiktxOyY.js +1 -0
  11. package/dist/assets/chunk-4TB4RGXK-DHl7ZlQV.js +206 -0
  12. package/dist/assets/chunk-55IACEB6-DcgWxDD5.js +1 -0
  13. package/dist/assets/chunk-EDXVE4YY-DeUzWpQx.js +1 -0
  14. package/dist/assets/{chunk-FMBD7UC4-DYA85HUy.js → chunk-FMBD7UC4-BCaKpugk.js} +2 -2
  15. package/dist/assets/chunk-OYMX7WX6-DKMEMbG9.js +231 -0
  16. package/dist/assets/chunk-QZHKN3VN-BREApeQ-.js +1 -0
  17. package/dist/assets/chunk-YZCP3GAM-BYW1PNda.js +1 -0
  18. package/dist/assets/classDiagram-6PBFFD2Q-B0-7EUsz.js +1 -0
  19. package/dist/assets/classDiagram-v2-HSJHXN6E-B0-7EUsz.js +1 -0
  20. package/dist/assets/clone-CX_D5SrR.js +1 -0
  21. package/dist/assets/cose-bilkent-S5V4N54A-DpwiMCiq.js +1 -0
  22. package/dist/assets/cytoscape.esm-BMgRe88L.js +331 -0
  23. package/dist/assets/dagre-KV5264BT-Dc7qbya2.js +4 -0
  24. package/dist/assets/defaultLocale-CcTwRAjA.js +1 -0
  25. package/dist/assets/diagram-5BDNPKRD-v7FsHeLQ.js +10 -0
  26. package/dist/assets/diagram-G4DWMVQ6-BhKNBlcE.js +24 -0
  27. package/dist/assets/diagram-MMDJMWI5-C-3cRdzG.js +43 -0
  28. package/dist/assets/diagram-TYMM5635-HfNcJIfT.js +24 -0
  29. package/dist/assets/erDiagram-SMLLAGMA-Ckj0dkk7.js +85 -0
  30. package/dist/assets/flowDiagram-DWJPFMVM-yf315tJr.js +162 -0
  31. package/dist/assets/ganttDiagram-T4ZO3ILL-Ch2bINVC.js +292 -0
  32. package/dist/assets/gitGraphDiagram-UUTBAWPF-CesdgsJi.js +106 -0
  33. package/dist/assets/graph-CRpmapJV.js +1 -0
  34. package/dist/assets/html2canvas.esm-B8c0f9Wq.js +22 -0
  35. package/dist/assets/index-DJ0iGKLy.js +2 -0
  36. package/dist/assets/infoDiagram-42DDH7IO-CuD16P9Y.js +2 -0
  37. package/dist/assets/init-C7FSzFHJ.js +1 -0
  38. package/dist/assets/ishikawaDiagram-UXIWVN3A-4y8aG54G.js +70 -0
  39. package/dist/assets/journeyDiagram-VCZTEJTY-B6TtR2Zk.js +139 -0
  40. package/dist/assets/kanban-definition-6JOO6SKY-DTcNHYUS.js +89 -0
  41. package/dist/assets/katex-CJRKSY_b.js +257 -0
  42. package/dist/assets/layout-CX5hpkD2.js +1 -0
  43. package/dist/assets/linear-tWlC-NXc.js +1 -0
  44. package/dist/assets/mermaid.core-DNvsWVDx.js +308 -0
  45. package/dist/assets/min-CDExe3RN.js +1 -0
  46. package/dist/assets/mindmap-definition-QFDTVHPH-CW0yNQcb.js +96 -0
  47. package/dist/assets/ordinal-aRyHI6gl.js +1 -0
  48. package/dist/assets/pieDiagram-DEJITSTG-DNrnOqmz.js +30 -0
  49. package/dist/assets/quadrantDiagram-34T5L4WZ-Cl176vnh.js +7 -0
  50. package/dist/assets/requirementDiagram-MS252O5E-DKp3A5f_.js +84 -0
  51. package/dist/assets/sankeyDiagram-XADWPNL6-BMV0lAz8.js +10 -0
  52. package/dist/assets/sequenceDiagram-FGHM5R23-CQ4preep.js +157 -0
  53. package/dist/assets/stateDiagram-FHFEXIEX-BKqYYN8H.js +1 -0
  54. package/dist/assets/stateDiagram-v2-QKLJ7IA2-C1W1ECmZ.js +1 -0
  55. package/dist/assets/timeline-definition-GMOUNBTQ-4kgeuumv.js +120 -0
  56. package/dist/assets/vendor-antd-Dk5s46Ag.js +406 -0
  57. package/dist/assets/vendor-codemirror-DxvDOrio.js +46 -0
  58. package/dist/assets/vendor-highlight-DVwgAdJY.js +3 -0
  59. package/dist/assets/vendor-markdown-DO-Ppp4f.js +60 -0
  60. package/dist/assets/vendor-qrcode-hI5wlAgK.js +9 -0
  61. package/dist/assets/vendor-virtuoso-HW77kTCh.js +1 -0
  62. package/dist/assets/vendor-xterm-D2cUrYEx.js +140 -0
  63. package/dist/assets/vennDiagram-DHZGUBPP-CqBcUIdK.js +34 -0
  64. package/dist/assets/wardley-RL74JXVD-CbEnkKx8.js +162 -0
  65. package/dist/assets/wardleyDiagram-NUSXRM2D-BJrjkZMg.js +20 -0
  66. package/dist/assets/xychartDiagram-5P7HB3ND-D8aBEz8e.js +7 -0
  67. package/dist/index.html +3 -3
  68. package/package.json +1 -1
  69. package/server.js +13 -4
  70. package/dist/assets/App-zWgquirU.js +0 -31
  71. package/dist/assets/AppHeader.module-BO_W974X.js +0 -573
  72. package/dist/assets/Mobile-mC2D8w-e.js +0 -10
  73. package/dist/assets/_baseUniq-CEgwAVBk.js +0 -1
  74. package/dist/assets/arc-MEHrGoSV.js +0 -1
  75. package/dist/assets/architectureDiagram-Q4EWVU46-BPjoqhJM.js +0 -36
  76. package/dist/assets/blockDiagram-DXYQGD6D-C6E6qAiA.js +0 -132
  77. package/dist/assets/c4Diagram-AHTNJAMY-DCaaelvP.js +0 -10
  78. package/dist/assets/channel-2Rqd2l4n.js +0 -1
  79. package/dist/assets/chunk-4BX2VUAB-DOFHXLhh.js +0 -1
  80. package/dist/assets/chunk-4TB4RGXK-B-NPhf57.js +0 -206
  81. package/dist/assets/chunk-55IACEB6-DliOMqkO.js +0 -1
  82. package/dist/assets/chunk-EDXVE4YY-DGe6csqF.js +0 -1
  83. package/dist/assets/chunk-OYMX7WX6-BnQZKCXr.js +0 -231
  84. package/dist/assets/chunk-QZHKN3VN-BFjJqewT.js +0 -1
  85. package/dist/assets/chunk-YZCP3GAM-BNw1WaZX.js +0 -1
  86. package/dist/assets/classDiagram-6PBFFD2Q-kdtHORjS.js +0 -1
  87. package/dist/assets/classDiagram-v2-HSJHXN6E-kdtHORjS.js +0 -1
  88. package/dist/assets/clone-D28eZRit.js +0 -1
  89. package/dist/assets/cose-bilkent-S5V4N54A-Caf2YU2_.js +0 -1
  90. package/dist/assets/cytoscape.esm-DxGcaOPV.js +0 -331
  91. package/dist/assets/dagre-KV5264BT-Ci7hNUg6.js +0 -4
  92. package/dist/assets/defaultLocale-DX6XiGOO.js +0 -1
  93. package/dist/assets/diagram-5BDNPKRD-CVbF4uma.js +0 -10
  94. package/dist/assets/diagram-G4DWMVQ6-Bp90W3vP.js +0 -24
  95. package/dist/assets/diagram-MMDJMWI5-B3sqDX6G.js +0 -43
  96. package/dist/assets/diagram-TYMM5635-DASTGzUc.js +0 -24
  97. package/dist/assets/erDiagram-SMLLAGMA-BHeKI98s.js +0 -85
  98. package/dist/assets/flowDiagram-DWJPFMVM-CVXMRNNP.js +0 -162
  99. package/dist/assets/ganttDiagram-T4ZO3ILL-DEVtZmK6.js +0 -292
  100. package/dist/assets/gitGraphDiagram-UUTBAWPF-O48YFRyc.js +0 -106
  101. package/dist/assets/graph-C4C79Ynh.js +0 -1
  102. package/dist/assets/html2canvas.esm-QH1iLAAe.js +0 -22
  103. package/dist/assets/index-Bf88itOf.js +0 -2
  104. package/dist/assets/infoDiagram-42DDH7IO-B53T3cTl.js +0 -2
  105. package/dist/assets/init-Gi6I4Gst.js +0 -1
  106. package/dist/assets/ishikawaDiagram-UXIWVN3A-DsBR1H4d.js +0 -70
  107. package/dist/assets/journeyDiagram-VCZTEJTY-C5Qx-MWC.js +0 -139
  108. package/dist/assets/kanban-definition-6JOO6SKY-DdUA1Jqj.js +0 -89
  109. package/dist/assets/katex-DkKDou_j.js +0 -257
  110. package/dist/assets/layout-8zCmZc2v.js +0 -1
  111. package/dist/assets/linear-iU1fIm4D.js +0 -1
  112. package/dist/assets/mermaid.core-DEH9vF8h.js +0 -308
  113. package/dist/assets/min-CYrNSou-.js +0 -1
  114. package/dist/assets/mindmap-definition-QFDTVHPH-t4p9Tkms.js +0 -96
  115. package/dist/assets/ordinal-Cboi1Yqb.js +0 -1
  116. package/dist/assets/pieDiagram-DEJITSTG-CLcGF3ux.js +0 -30
  117. package/dist/assets/quadrantDiagram-34T5L4WZ-neqUyyc6.js +0 -7
  118. package/dist/assets/requirementDiagram-MS252O5E-C2D_UGIy.js +0 -84
  119. package/dist/assets/sankeyDiagram-XADWPNL6-DZz_PSNE.js +0 -10
  120. package/dist/assets/sequenceDiagram-FGHM5R23-q7qU3aaX.js +0 -157
  121. package/dist/assets/stateDiagram-FHFEXIEX-DYaI8H2Q.js +0 -1
  122. package/dist/assets/stateDiagram-v2-QKLJ7IA2-BwkgJKS3.js +0 -1
  123. package/dist/assets/timeline-definition-GMOUNBTQ-CIlZ_lpo.js +0 -120
  124. package/dist/assets/vendor-antd-CtdKd5xs.js +0 -406
  125. package/dist/assets/vendor-codemirror-CdXaVX4e.js +0 -46
  126. package/dist/assets/vendor-highlight-D4ATuRwX.js +0 -3
  127. package/dist/assets/vendor-markdown-CO-jRjTB.js +0 -60
  128. package/dist/assets/vendor-qrcode-D05RfzwB.js +0 -9
  129. package/dist/assets/vendor-virtuoso-BhnFrbmh.js +0 -1
  130. package/dist/assets/vendor-xterm-DWMOrwSy.js +0 -140
  131. package/dist/assets/vennDiagram-DHZGUBPP-BGi2p57m.js +0 -34
  132. package/dist/assets/wardley-RL74JXVD-BGn0fLga.js +0 -162
  133. package/dist/assets/wardleyDiagram-NUSXRM2D-Clpxmp21.js +0 -20
  134. package/dist/assets/xychartDiagram-5P7HB3ND-Fnlog8mH.js +0 -7
@@ -0,0 +1,31 @@
1
+ var __defProp=Object.defineProperty;var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value;var __publicField=(obj,key,value)=>__defNormalProp(obj,typeof key!="symbol"?key+"":key,value);import{j as jsxRuntimeExports}from"./vendor-codemirror-DxvDOrio.js";import{a as reactExports,I as Icon,b as _extends,R as React,i as Select,o as Collapse,s as staticMethods,M as Modal,S as Spin,p as RefIcon$9,q as Space,D as Dropdown,P as Popover,T as Tag,d as Button,h as Switch,t as Input,u as RefIcon$a,v as RefIcon$b,j as RefIcon$c,w as Tabs,x as Drawer,y as Radio,e as RefIcon$d,z as RefIcon$e,f as RefIcon$f,F as ForwardTable,A as RefIcon$g,E as RefIcon$h,G as RefIcon$i,H as Empty,L as List,J as Tooltip,K as Typography,N as RefIcon$j,O as RefIcon$k,C as ConfigProvider,Q as Layout,U as Alert,V as Checkbox}from"./vendor-antd-Dk5s46Ag.js";import{a as apiUrl,t,m as isSystemText,n as classifyUserContent,o as isMainAgent,e as computeTokenStats,g as computeToolUsageStats,h as computeSkillUsageStats,s as styles$6,l as formatTokenCount,C as ConceptHelp,x as extractCachedContent,y as parseCachedTools,j as computeCacheRebuildStats,z as resolveTeammateNames,k as classifyRequest,q as getModelMaxTokens,B as setLang,D as getLang,O as OpenFolderIcon,E as getModelShort,G as formatRequestTag,H as renderMarkdown,J as restoreSlimmedEntry,K as stripPrivateKeys,L as isClaudeMdReminder,M as isSkillsReminder,N as hasClaudeMdReminder,P as hasSkillsReminder,A as AppBase,Q as filterRelevantRequests,S as findPrevMainAgentTimestamp,u as uploadFileAndGetPath,p as styles$7,R as RefIcon$l,v as ChatView}from"./AppHeader.module-CozRDKfP.js";import{s as setViewMode,b as isMobile}from"./index-DJ0iGKLy.js";import{Q as QRCodeCanvas}from"./vendor-qrcode-hI5wlAgK.js";import"./vendor-markdown-DO-Ppp4f.js";import"./vendor-xterm-D2cUrYEx.js";import"./vendor-highlight-DVwgAdJY.js";import"./vendor-virtuoso-HW77kTCh.js";var ApiOutlined$1={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M917.7 148.8l-42.4-42.4c-1.6-1.6-3.6-2.3-5.7-2.3s-4.1.8-5.7 2.3l-76.1 76.1a199.27 199.27 0 00-112.1-34.3c-51.2 0-102.4 19.5-141.5 58.6L432.3 308.7a8.03 8.03 0 000 11.3L704 591.7c1.6 1.6 3.6 2.3 5.7 2.3 2 0 4.1-.8 5.7-2.3l101.9-101.9c68.9-69 77-175.7 24.3-253.5l76.1-76.1c3.1-3.2 3.1-8.3 0-11.4zM769.1 441.7l-59.4 59.4-186.8-186.8 59.4-59.4c24.9-24.9 58.1-38.7 93.4-38.7 35.3 0 68.4 13.7 93.4 38.7 24.9 24.9 38.7 58.1 38.7 93.4 0 35.3-13.8 68.4-38.7 93.4zm-190.2 105a8.03 8.03 0 00-11.3 0L501 613.3 410.7 523l66.7-66.7c3.1-3.1 3.1-8.2 0-11.3L441 408.6a8.03 8.03 0 00-11.3 0L363 475.3l-43-43a7.85 7.85 0 00-5.7-2.3c-2 0-4.1.8-5.7 2.3L206.8 534.2c-68.9 69-77 175.7-24.3 253.5l-76.1 76.1a8.03 8.03 0 000 11.3l42.4 42.4c1.6 1.6 3.6 2.3 5.7 2.3s4.1-.8 5.7-2.3l76.1-76.1c33.7 22.9 72.9 34.3 112.1 34.3 51.2 0 102.4-19.5 141.5-58.6l101.9-101.9c3.1-3.1 3.1-8.2 0-11.3l-43-43 66.7-66.7c3.1-3.1 3.1-8.2 0-11.3l-36.6-36.2zM441.7 769.1a131.32 131.32 0 01-93.4 38.7c-35.3 0-68.4-13.7-93.4-38.7a131.32 131.32 0 01-38.7-93.4c0-35.3 13.7-68.4 38.7-93.4l59.4-59.4 186.8 186.8-59.4 59.4z"}}]},name:"api",theme:"outlined"},ApiOutlined=function(props,ref){return reactExports.createElement(Icon,_extends({},props,{ref,icon:ApiOutlined$1}))},RefIcon$8=reactExports.forwardRef(ApiOutlined),BarChartOutlined$1={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M888 792H200V168c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v688c0 4.4 3.6 8 8 8h752c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm-600-80h56c4.4 0 8-3.6 8-8V560c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v144c0 4.4 3.6 8 8 8zm152 0h56c4.4 0 8-3.6 8-8V384c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v320c0 4.4 3.6 8 8 8zm152 0h56c4.4 0 8-3.6 8-8V462c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v242c0 4.4 3.6 8 8 8zm152 0h56c4.4 0 8-3.6 8-8V304c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v400c0 4.4 3.6 8 8 8z"}}]},name:"bar-chart",theme:"outlined"},BarChartOutlined=function(props,ref){return reactExports.createElement(Icon,_extends({},props,{ref,icon:BarChartOutlined$1}))},RefIcon$7=reactExports.forwardRef(BarChartOutlined),CloudDownloadOutlined$1={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M624 706.3h-74.1V464c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v242.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.7a8 8 0 0012.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9z"}},{tag:"path",attrs:{d:"M811.4 366.7C765.6 245.9 648.9 160 512.2 160S258.8 245.8 213 366.6C127.3 389.1 64 467.2 64 560c0 110.5 89.5 200 199.9 200H304c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8h-40.1c-33.7 0-65.4-13.4-89-37.7-23.5-24.2-36-56.8-34.9-90.6.9-26.4 9.9-51.2 26.2-72.1 16.7-21.3 40.1-36.8 66.1-43.7l37.9-9.9 13.9-36.6c8.6-22.8 20.6-44.1 35.7-63.4a245.6 245.6 0 0152.4-49.9c41.1-28.9 89.5-44.2 140-44.2s98.9 15.3 140 44.2c19.9 14 37.5 30.8 52.4 49.9 15.1 19.3 27.1 40.7 35.7 63.4l13.8 36.5 37.8 10C846.1 454.5 884 503.8 884 560c0 33.1-12.9 64.3-36.3 87.7a123.07 123.07 0 01-87.6 36.3H720c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h40.1C870.5 760 960 670.5 960 560c0-92.7-63.1-170.7-148.6-193.3z"}}]},name:"cloud-download",theme:"outlined"},CloudDownloadOutlined=function(props,ref){return reactExports.createElement(Icon,_extends({},props,{ref,icon:CloudDownloadOutlined$1}))},RefIcon$6=reactExports.forwardRef(CloudDownloadOutlined),CodeOutlined$1={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M516 673c0 4.4 3.4 8 7.5 8h185c4.1 0 7.5-3.6 7.5-8v-48c0-4.4-3.4-8-7.5-8h-185c-4.1 0-7.5 3.6-7.5 8v48zm-194.9 6.1l192-161c3.8-3.2 3.8-9.1 0-12.3l-192-160.9A7.95 7.95 0 00308 351v62.7c0 2.4 1 4.6 2.9 6.1L420.7 512l-109.8 92.2a8.1 8.1 0 00-2.9 6.1V673c0 6.8 7.9 10.5 13.1 6.1zM880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z"}}]},name:"code",theme:"outlined"},CodeOutlined=function(props,ref){return reactExports.createElement(Icon,_extends({},props,{ref,icon:CodeOutlined$1}))},RefIcon$5=reactExports.forwardRef(CodeOutlined),DashboardOutlined$1={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M924.8 385.6a446.7 446.7 0 00-96-142.4 446.7 446.7 0 00-142.4-96C631.1 123.8 572.5 112 512 112s-119.1 11.8-174.4 35.2a446.7 446.7 0 00-142.4 96 446.7 446.7 0 00-96 142.4C75.8 440.9 64 499.5 64 560c0 132.7 58.3 257.7 159.9 343.1l1.7 1.4c5.8 4.8 13.1 7.5 20.6 7.5h531.7c7.5 0 14.8-2.7 20.6-7.5l1.7-1.4C901.7 817.7 960 692.7 960 560c0-60.5-11.9-119.1-35.2-174.4zM761.4 836H262.6A371.12 371.12 0 01140 560c0-99.4 38.7-192.8 109-263 70.3-70.3 163.7-109 263-109 99.4 0 192.8 38.7 263 109 70.3 70.3 109 163.7 109 263 0 105.6-44.5 205.5-122.6 276zM623.5 421.5a8.03 8.03 0 00-11.3 0L527.7 506c-18.7-5-39.4-.2-54.1 14.5a55.95 55.95 0 000 79.2 55.95 55.95 0 0079.2 0 55.87 55.87 0 0014.5-54.1l84.5-84.5c3.1-3.1 3.1-8.2 0-11.3l-28.3-28.3zM490 320h44c4.4 0 8-3.6 8-8v-80c0-4.4-3.6-8-8-8h-44c-4.4 0-8 3.6-8 8v80c0 4.4 3.6 8 8 8zm260 218v44c0 4.4 3.6 8 8 8h80c4.4 0 8-3.6 8-8v-44c0-4.4-3.6-8-8-8h-80c-4.4 0-8 3.6-8 8zm12.7-197.2l-31.1-31.1a8.03 8.03 0 00-11.3 0l-56.6 56.6a8.03 8.03 0 000 11.3l31.1 31.1c3.1 3.1 8.2 3.1 11.3 0l56.6-56.6c3.1-3.1 3.1-8.2 0-11.3zm-458.6-31.1a8.03 8.03 0 00-11.3 0l-31.1 31.1a8.03 8.03 0 000 11.3l56.6 56.6c3.1 3.1 8.2 3.1 11.3 0l31.1-31.1c3.1-3.1 3.1-8.2 0-11.3l-56.6-56.6zM262 530h-80c-4.4 0-8 3.6-8 8v44c0 4.4 3.6 8 8 8h80c4.4 0 8-3.6 8-8v-44c0-4.4-3.6-8-8-8z"}}]},name:"dashboard",theme:"outlined"},DashboardOutlined=function(props,ref){return reactExports.createElement(Icon,_extends({},props,{ref,icon:DashboardOutlined$1}))},RefIcon$4=reactExports.forwardRef(DashboardOutlined),ExportOutlined$1={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 912H144c-17.7 0-32-14.3-32-32V144c0-17.7 14.3-32 32-32h360c4.4 0 8 3.6 8 8v56c0 4.4-3.6 8-8 8H184v656h656V520c0-4.4 3.6-8 8-8h56c4.4 0 8 3.6 8 8v360c0 17.7-14.3 32-32 32zM770.87 199.13l-52.2-52.2a8.01 8.01 0 014.7-13.6l179.4-21c5.1-.6 9.5 3.7 8.9 8.9l-21 179.4c-.8 6.6-8.9 9.4-13.6 4.7l-52.4-52.4-256.2 256.2a8.03 8.03 0 01-11.3 0l-42.4-42.4a8.03 8.03 0 010-11.3l256.1-256.3z"}}]},name:"export",theme:"outlined"},ExportOutlined=function(props,ref){return reactExports.createElement(Icon,_extends({},props,{ref,icon:ExportOutlined$1}))},RefIcon$3=reactExports.forwardRef(ExportOutlined),ImportOutlined$1={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 912H144c-17.7 0-32-14.3-32-32V144c0-17.7 14.3-32 32-32h360c4.4 0 8 3.6 8 8v56c0 4.4-3.6 8-8 8H184v656h656V520c0-4.4 3.6-8 8-8h56c4.4 0 8 3.6 8 8v360c0 17.7-14.3 32-32 32zM653.3 424.6l52.2 52.2a8.01 8.01 0 01-4.7 13.6l-179.4 21c-5.1.6-9.5-3.7-8.9-8.9l21-179.4c.8-6.6 8.9-9.4 13.6-4.7l52.4 52.4 256.2-256.2c3.1-3.1 8.2-3.1 11.3 0l42.4 42.4c3.1 3.1 3.1 8.2 0 11.3L653.3 424.6z"}}]},name:"import",theme:"outlined"},ImportOutlined=function(props,ref){return reactExports.createElement(Icon,_extends({},props,{ref,icon:ImportOutlined$1}))},RefIcon$2=reactExports.forwardRef(ImportOutlined),MessageOutlined$1={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M464 512a48 48 0 1096 0 48 48 0 10-96 0zm200 0a48 48 0 1096 0 48 48 0 10-96 0zm-400 0a48 48 0 1096 0 48 48 0 10-96 0zm661.2-173.6c-22.6-53.7-55-101.9-96.3-143.3a444.35 444.35 0 00-143.3-96.3C630.6 75.7 572.2 64 512 64h-2c-60.6.3-119.3 12.3-174.5 35.9a445.35 445.35 0 00-142 96.5c-40.9 41.3-73 89.3-95.2 142.8-23 55.4-34.6 114.3-34.3 174.9A449.4 449.4 0 00112 714v152a46 46 0 0046 46h152.1A449.4 449.4 0 00510 960h2.1c59.9 0 118-11.6 172.7-34.3a444.48 444.48 0 00142.8-95.2c41.3-40.9 73.8-88.7 96.5-142 23.6-55.2 35.6-113.9 35.9-174.5.3-60.9-11.5-120-34.8-175.6zm-151.1 438C704 845.8 611 884 512 884h-1.7c-60.3-.3-120.2-15.3-173.1-43.5l-8.4-4.5H188V695.2l-4.5-8.4C155.3 633.9 140.3 574 140 513.7c-.4-99.7 37.7-193.3 107.6-263.8 69.8-70.5 163.1-109.5 262.8-109.9h1.7c50 0 98.5 9.7 144.2 28.9 44.6 18.7 84.6 45.6 119 80 34.3 34.3 61.3 74.4 80 119 19.4 46.2 29.1 95.2 28.9 145.8-.6 99.6-39.7 192.9-110.1 262.7z"}}]},name:"message",theme:"outlined"},MessageOutlined=function(props,ref){return reactExports.createElement(Icon,_extends({},props,{ref,icon:MessageOutlined$1}))},RefIcon$1=reactExports.forwardRef(MessageOutlined),SettingOutlined$1={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M924.8 625.7l-65.5-56c3.1-19 4.7-38.4 4.7-57.8s-1.6-38.8-4.7-57.8l65.5-56a32.03 32.03 0 009.3-35.2l-.9-2.6a443.74 443.74 0 00-79.7-137.9l-1.8-2.1a32.12 32.12 0 00-35.1-9.5l-81.3 28.9c-30-24.6-63.5-44-99.7-57.6l-15.7-85a32.05 32.05 0 00-25.8-25.7l-2.7-.5c-52.1-9.4-106.9-9.4-159 0l-2.7.5a32.05 32.05 0 00-25.8 25.7l-15.8 85.4a351.86 351.86 0 00-99 57.4l-81.9-29.1a32 32 0 00-35.1 9.5l-1.8 2.1a446.02 446.02 0 00-79.7 137.9l-.9 2.6c-4.5 12.5-.8 26.5 9.3 35.2l66.3 56.6c-3.1 18.8-4.6 38-4.6 57.1 0 19.2 1.5 38.4 4.6 57.1L99 625.5a32.03 32.03 0 00-9.3 35.2l.9 2.6c18.1 50.4 44.9 96.9 79.7 137.9l1.8 2.1a32.12 32.12 0 0035.1 9.5l81.9-29.1c29.8 24.5 63.1 43.9 99 57.4l15.8 85.4a32.05 32.05 0 0025.8 25.7l2.7.5a449.4 449.4 0 00159 0l2.7-.5a32.05 32.05 0 0025.8-25.7l15.7-85a350 350 0 0099.7-57.6l81.3 28.9a32 32 0 0035.1-9.5l1.8-2.1c34.8-41.1 61.6-87.5 79.7-137.9l.9-2.6c4.5-12.3.8-26.3-9.3-35zM788.3 465.9c2.5 15.1 3.8 30.6 3.8 46.1s-1.3 31-3.8 46.1l-6.6 40.1 74.7 63.9a370.03 370.03 0 01-42.6 73.6L721 702.8l-31.4 25.8c-23.9 19.6-50.5 35-79.3 45.8l-38.1 14.3-17.9 97a377.5 377.5 0 01-85 0l-17.9-97.2-37.8-14.5c-28.5-10.8-55-26.2-78.7-45.7l-31.4-25.9-93.4 33.2c-17-22.9-31.2-47.6-42.6-73.6l75.5-64.5-6.5-40c-2.4-14.9-3.7-30.3-3.7-45.5 0-15.3 1.2-30.6 3.7-45.5l6.5-40-75.5-64.5c11.3-26.1 25.6-50.7 42.6-73.6l93.4 33.2 31.4-25.9c23.7-19.5 50.2-34.9 78.7-45.7l37.9-14.3 17.9-97.2c28.1-3.2 56.8-3.2 85 0l17.9 97 38.1 14.3c28.7 10.8 55.4 26.2 79.3 45.8l31.4 25.8 92.8-32.9c17 22.9 31.2 47.6 42.6 73.6L781.8 426l6.5 39.9zM512 326c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm79.2 255.2A111.6 111.6 0 01512 614c-29.9 0-58-11.7-79.2-32.8A111.6 111.6 0 01400 502c0-29.9 11.7-58 32.8-79.2C454 401.6 482.1 390 512 390c29.9 0 58 11.6 79.2 32.8A111.6 111.6 0 01624 502c0 29.9-11.7 58-32.8 79.2z"}}]},name:"setting",theme:"outlined"},SettingOutlined=function(props,ref){return reactExports.createElement(Icon,_extends({},props,{ref,icon:SettingOutlined$1}))},RefIcon=reactExports.forwardRef(SettingOutlined);const calibrationModels=[{label:"Auto",value:"auto"},{label:"Opus 4.7 (1M)",value:"opus-4.7-1m",tokens:1e6},{label:"Sonnet 4.6",value:"sonnet-4.6",tokens:2e5},{label:"GLM5",value:"glm5",tokens:2e5},{label:"Kimi K2.5",value:"kimi-k2.5",tokens:2e5},{label:"MiniMax 2.1",value:"minimax-2.1",tokens:2e5},{label:"Qwen 3.5",value:"Qwen 3.5",tokens:2e5}],appConfig={calibrationModels},CALIBRATION_MODELS=appConfig.calibrationModels,LANG_OPTIONS=[{value:"zh",short:"zh",label:"简体中文"},{value:"en",short:"en",label:"English"},{value:"zh-TW",short:"zh-TW",label:"繁體中文"},{value:"ko",short:"ko",label:"한국어"},{value:"ja",short:"ja",label:"日本語"},{value:"de",short:"de",label:"Deutsch"},{value:"es",short:"es",label:"Español"},{value:"fr",short:"fr",label:"Français"},{value:"it",short:"it",label:"Italiano"},{value:"da",short:"da",label:"Dansk"},{value:"pl",short:"pl",label:"Polski"},{value:"ru",short:"ru",label:"Русский"},{value:"ar",short:"ar",label:"العربية"},{value:"no",short:"no",label:"Norsk"},{value:"pt-BR",short:"pt-BR",label:"Português (Brasil)"},{value:"th",short:"th",label:"ไทย"},{value:"tr",short:"tr",label:"Türkçe"},{value:"uk",short:"uk",label:"Українська"}],countryToFlag=code=>{const toFlag=c2=>c2.toUpperCase().split("").map(c=>String.fromCodePoint(127462+c.charCodeAt(0)-65)).join("");return!code||code.length!==2?toFlag("CN"):toFlag(code)},_AppHeader=class _AppHeader extends React.Component{constructor(props){super(props);__publicField(this,"handleShowPrompts",()=>{this.setState({promptModalVisible:!0,promptData:this.extractUserPrompts()})});__publicField(this,"handleExportPromptsTxt",()=>{const prompts=this.state.promptData;if(!prompts||prompts.length===0)return;const blocks=[];for(const p of prompts){const lines=[],ts=p.timestamp?new Date(p.timestamp).toLocaleString():"";ts&&lines.push(`${ts}:
2
+ `);const textParts=(p.segments||[]).filter(seg=>seg.type==="text").map(seg=>seg.content);textParts.length>0&&lines.push(textParts.join(`
3
+ `)),blocks.push(lines.join(`
4
+ `))}if(blocks.length===0)return;const blob=new Blob([blocks.join(`
5
+
6
+
7
+
8
+ `)],{type:"text/plain;charset=utf-8"}),url=URL.createObjectURL(blob),a=document.createElement("a");a.href=url,a.download=`user-prompts-${new Date().toISOString().slice(0,10)}.txt`,a.click(),URL.revokeObjectURL(url)});__publicField(this,"handleCalibrationModelChange",value=>{this.setState({calibrationModel:value}),localStorage.setItem("ccv_calibrationModel",value)});__publicField(this,"handleShowProjectStats",()=>{this.setState({projectStatsVisible:!0,projectStatsLoading:!0}),fetch(apiUrl("/api/project-stats")).then(res=>{if(!res.ok)throw new Error("not found");return res.json()}).then(data=>this.setState({projectStats:data,projectStatsLoading:!1})).catch(()=>this.setState({projectStats:null,projectStatsLoading:!1}))});__publicField(this,"fetchPlugins",()=>fetch(apiUrl("/api/plugins")).then(r=>{if(!r.ok)throw new Error(r.status);return r.json()}).then(data=>{this.setState({pluginsList:data.plugins||[],pluginsDir:data.pluginsDir||""})}).catch(()=>{}));__publicField(this,"handleShowPlugins",()=>{this.setState({pluginModalVisible:!0}),this.fetchPlugins()});__publicField(this,"handleTogglePlugin",(name,enabled)=>{fetch(apiUrl("/api/preferences")).then(r=>r.json()).then(prefs=>{let disabledPlugins=Array.isArray(prefs.disabledPlugins)?[...prefs.disabledPlugins]:[];return enabled?disabledPlugins=disabledPlugins.filter(n=>n!==name):disabledPlugins.includes(name)||disabledPlugins.push(name),fetch(apiUrl("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({disabledPlugins})})}).then(()=>fetch(apiUrl("/api/plugins/reload"),{method:"POST"})).then(r=>{if(!r.ok)throw new Error(r.status);return r.json()}).then(data=>{this.setState({pluginsList:data.plugins||[],pluginsDir:data.pluginsDir||""})}).catch(()=>{})});__publicField(this,"handleDeletePlugin",(file,name)=>{this.setState({deleteConfirmVisible:!0,deleteTarget:{file,name}})});__publicField(this,"handleDeletePluginConfirm",()=>{const{file}=this.state.deleteTarget||{};file&&(this.setState({deleteConfirmVisible:!1,deleteTarget:null}),fetch(apiUrl(`/api/plugins?file=${encodeURIComponent(file)}`),{method:"DELETE"}).then(r=>{if(!r.ok)throw new Error(r.status);return r.json()}).then(data=>{data.plugins&&this.setState({pluginsList:data.plugins,pluginsDir:data.pluginsDir||""})}).catch(()=>{}))});__publicField(this,"handleReloadPlugins",()=>{fetch(apiUrl("/api/plugins/reload"),{method:"POST"}).then(r=>{if(!r.ok)throw new Error(r.status);return r.json()}).then(data=>{this.setState({pluginsList:data.plugins||[],pluginsDir:data.pluginsDir||""})}).catch(()=>{})});__publicField(this,"handleAddPlugin",()=>{const input=document.createElement("input");input.type="file",input.accept=".js,.mjs",input.multiple=!0,input.onchange=()=>{const fileHandles=input.files;if(!fileHandles||fileHandles.length===0)return;for(const f of fileHandles)if(!f.name.endsWith(".js")&&!f.name.endsWith(".mjs")){staticMethods.error(t("ui.plugins.invalidFile"));return}const readPromises=Array.from(fileHandles).map(f=>new Promise((resolve,reject)=>{const reader=new FileReader;reader.onload=()=>resolve({name:f.name,content:reader.result}),reader.onerror=()=>reject(new Error(`Failed to read ${f.name}`)),reader.readAsText(f)}));Promise.all(readPromises).then(files=>fetch(apiUrl("/api/plugins/upload"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files})})).then(r=>r.ok?r.json():r.text().then(text=>{try{return JSON.parse(text)}catch{throw new Error(t("ui.plugins.serverError",{status:r.status}))}})).then(data=>{data.error?staticMethods.error(t("ui.plugins.addFailed",{reason:data.error})):data.plugins&&(this.setState({pluginsList:data.plugins,pluginsDir:data.pluginsDir||""}),staticMethods.success(t("ui.plugins.addSuccess")))}).catch(err=>{staticMethods.error(err.message)})},input.click()});__publicField(this,"handleShowCdnModal",()=>{this.setState({cdnModalVisible:!0,cdnUrl:"",cdnLoading:!1})});__publicField(this,"handleCdnUrlChange",e=>{this.setState({cdnUrl:e.target.value})});__publicField(this,"handleCdnInstall",()=>{const{cdnUrl}=this.state;if(!cdnUrl.trim()){staticMethods.error(t("ui.plugins.cdnUrlRequired"));return}try{new URL(cdnUrl)}catch{staticMethods.error(t("ui.plugins.cdnInvalidUrl"));return}this.setState({cdnLoading:!0}),fetch(apiUrl("/api/plugins/install-from-url"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:cdnUrl.trim()})}).then(r=>r.json()).then(data=>{data.error?staticMethods.error(t("ui.plugins.cdnInstallFailed",{reason:data.error})):(staticMethods.success(t("ui.plugins.cdnInstallSuccess")),data.plugins&&this.setState({pluginsList:data.plugins,pluginsDir:data.pluginsDir||""}),this.setState({cdnModalVisible:!1,cdnUrl:""}))}).catch(err=>{staticMethods.error(t("ui.plugins.cdnInstallFailed",{reason:err.message||"Network error"}))}).finally(()=>{this.setState({cdnLoading:!1})})});__publicField(this,"handleCdnCancel",()=>{this.setState({cdnModalVisible:!1,cdnUrl:"",cdnLoading:!1})});__publicField(this,"fetchProcesses",()=>{this.setState({processLoading:!0}),fetch(apiUrl("/api/ccv-processes")).then(r=>r.json()).then(data=>{this.setState({processList:data.processes||[],processLoading:!1})}).catch(()=>{this.setState({processList:[],processLoading:!1})})});__publicField(this,"handleShowProcesses",()=>{this.setState({processModalVisible:!0}),this.fetchProcesses()});__publicField(this,"handleKillProcess",pid=>{Modal.confirm({title:t("ui.processManagement.killConfirm"),onOk:()=>{fetch(apiUrl("/api/ccv-processes/kill"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pid})}).then(r=>r.json()).then(data=>{data.ok?(staticMethods.success(t("ui.processManagement.killed")),this.fetchProcesses()):staticMethods.error(data.error||t("ui.processManagement.killFailed"))}).catch(()=>{staticMethods.error(t("ui.processManagement.killFailed"))})}})});this.state={countdownText:"",countryFlag:null,countryInfo:null,promptModalVisible:!1,promptData:[],promptViewMode:"original",settingsDrawerVisible:!1,globalSettingsVisible:!1,projectStatsVisible:!1,projectStats:null,projectStatsLoading:!1,localUrl:"",pluginModalVisible:!1,pluginsList:[],pluginsDir:"",deleteConfirmVisible:!1,deleteTarget:null,processModalVisible:!1,processList:[],processLoading:!1,logoDropdownOpen:!1,cacheHighlightIdx:null,cacheHighlightFading:!1,cdnModalVisible:!1,cdnUrl:"",cdnLoading:!1,calibrationModel:(v=>CALIBRATION_MODELS.some(m=>m.value===v)?v:"auto")(localStorage.getItem("ccv_calibrationModel")||"auto"),proxyModalVisible:!1,editingProxy:null,editForm:{name:"",baseURL:"",apiKey:"",models:"",activeModel:""},logDirDraft:null},this._countdownTimer=null,this._expiredTimer=null,this.updateCountdown=this.updateCountdown.bind(this)}componentDidMount(){this.startCountdown(),fetch(apiUrl("/api/local-url")).then(r=>r.json()).then(data=>{data.url&&this.setState({localUrl:data.url})}).catch(()=>{}),fetch(apiUrl("/api/claude-settings")).then(r=>r.json()).then(data=>{data.model&&this.setState({settingsModel:data.model})}).catch(()=>{}),fetch("https://ipinfo.io/json",{signal:AbortSignal.timeout(5e3)}).then(r=>r.json()).then(data=>{data.country&&this.setState({countryFlag:countryToFlag(data.country),countryInfo:data})}).catch(()=>{})}componentDidUpdate(prevProps){prevProps.cacheExpireAt!==this.props.cacheExpireAt&&this.startCountdown()}shouldComponentUpdate(nextProps,nextState){return nextProps.requests!==this.props.requests||nextProps.requestCount!==this.props.requestCount||nextProps.viewMode!==this.props.viewMode||nextProps.cacheExpireAt!==this.props.cacheExpireAt||nextProps.cacheType!==this.props.cacheType||nextProps.isLocalLog!==this.props.isLocalLog||nextProps.localLogFile!==this.props.localLogFile||nextProps.projectName!==this.props.projectName||nextProps.collapseToolResults!==this.props.collapseToolResults||nextProps.expandThinking!==this.props.expandThinking||nextProps.showFullToolContent!==this.props.showFullToolContent||nextProps.expandDiff!==this.props.expandDiff||nextProps.filterIrrelevant!==this.props.filterIrrelevant||nextProps.logDir!==this.props.logDir||nextProps.updateInfo!==this.props.updateInfo||nextProps.cliMode!==this.props.cliMode||nextProps.sdkMode!==this.props.sdkMode||nextProps.terminalVisible!==this.props.terminalVisible||nextProps.contextWindow!==this.props.contextWindow||nextProps.serverCachedContent!==this.props.serverCachedContent||nextProps.resumeAutoChoice!==this.props.resumeAutoChoice||nextProps.themeColor!==this.props.themeColor||nextProps.autoApproveSeconds!==this.props.autoApproveSeconds||nextProps.proxyProfiles!==this.props.proxyProfiles||nextProps.activeProxyId!==this.props.activeProxyId||nextProps.defaultConfig!==this.props.defaultConfig||nextState!==this.state}componentWillUnmount(){this._countdownTimer&&clearTimeout(this._countdownTimer),this._expiredTimer&&clearTimeout(this._expiredTimer),this._cacheFadeClearTimer&&clearTimeout(this._cacheFadeClearTimer),this._cacheScrollSettleTimer&&clearTimeout(this._cacheScrollSettleTimer),this._cacheAutoFadeTimer&&clearTimeout(this._cacheAutoFadeTimer),this._cacheHighlightDelayTimer&&clearTimeout(this._cacheHighlightDelayTimer),this._cacheUnbindScrollFade()}startCountdown(){if(this._countdownTimer&&clearTimeout(this._countdownTimer),this._expiredTimer&&clearTimeout(this._expiredTimer),!this.props.cacheExpireAt){this.state.countdownText!==""&&this.setState({countdownText:""});return}this.updateCountdown()}updateCountdown(){const{cacheExpireAt}=this.props;if(!cacheExpireAt){this.state.countdownText!==""&&this.setState({countdownText:""});return}const now=Date.now(),remaining=Math.max(0,cacheExpireAt-now);if(remaining<=0){const expired=t("ui.cacheExpired");this.state.countdownText!==expired&&this.setState({countdownText:expired}),this._expiredTimer=setTimeout(()=>{this.state.countdownText!==""&&this.setState({countdownText:""})},5e3);return}const totalSec=Math.ceil(remaining/1e3);let text;if(totalSec>=60){const m=Math.floor(totalSec/60),s=totalSec%60;text=t("ui.minuteSecond",{m,s:String(s).padStart(2,"0")})}else text=t("ui.second",{s:totalSec});text!==this.state.countdownText&&this.setState({countdownText:text});const delay=1e3-now%1e3;this._countdownTimer=setTimeout(this.updateCountdown,delay)}static parseSegments(text){const segments=[],regex=/<([a-zA-Z_][\w-]*)(?:\s[^>]*)?>[\s\S]*?<\/\1>/g;let lastIndex=0,match;for(;(match=regex.exec(text))!==null;){const before=text.slice(lastIndex,match.index).trim();before&&segments.push({type:"text",content:before});const tagName=match[1];if(lastIndex=match.index+match[0].length,_AppHeader.COMMAND_TAGS.has(tagName))continue;const innerRegex=new RegExp(`^<${tagName}(?:\\s[^>]*)?>([\\s\\S]*)<\\/${tagName}>$`),innerMatch=match[0].match(innerRegex),content2=innerMatch?innerMatch[1].trim():match[0].trim();segments.push({type:"system",content:content2,label:tagName})}const after=text.slice(lastIndex).trim();return after&&segments.push({type:"text",content:after}),segments}static extractUserTexts(messages){const userMsgs=[],fullTexts=[];let slashCmd=null;for(const msg of messages)if(msg.role==="user"){if(typeof msg.content=="string"){const text=msg.content.trim();if(!text)continue;if(!isSystemText(text)){if(/Implement the following plan:/i.test(text))continue;userMsgs.push(text),fullTexts.push(text)}}else if(Array.isArray(msg.content)){const{commands,textBlocks}=classifyUserContent(msg.content);commands.length>0&&(slashCmd=commands[commands.length-1]);const userParts=[];for(const b of textBlocks)/Implement the following plan:/i.test((b.text||"").trim())||userParts.push(b.text.trim());const allParts=msg.content.filter(b=>{var _a;return b.type==="text"&&((_a=b.text)==null?void 0:_a.trim())}).map(b=>b.text.trim());userParts.length>0&&(userMsgs.push(userParts.join(`
9
+ `)),fullTexts.push(allParts.join(`
10
+ `)))}}return{userMsgs,fullTexts,slashCmd}}extractUserPrompts(){var _a;const{requests=[]}=this.props,prompts=[],seen=new Set;let prevSlashCmd=null;const mainAgentRequests=requests.filter(r=>isMainAgent(r));for(let ri=0;ri<mainAgentRequests.length;ri++){const req=mainAgentRequests[ri],messages=((_a=req.body)==null?void 0:_a.messages)||[],timestamp=req.timestamp||"",{userMsgs,fullTexts,slashCmd}=_AppHeader.extractUserTexts(messages);slashCmd&&slashCmd!=="/compact"&&slashCmd!==prevSlashCmd&&prompts.push({type:"prompt",segments:[{type:"text",content:slashCmd}],timestamp}),prevSlashCmd=slashCmd;for(let i=0;i<userMsgs.length;i++){const key=userMsgs[i];if(seen.has(key))continue;seen.add(key);const raw=fullTexts[i]||key;prompts.push({type:"prompt",segments:_AppHeader.parseSegments(raw),timestamp})}}return prompts}renderTokenStats(){const{requests=[]}=this.props,{cacheHighlightIdx,cacheHighlightFading}=this.state;if(this._tokenStatsCache&&this._tokenStatsCacheReq===requests&&this._tokenStatsCacheHl===cacheHighlightIdx&&this._tokenStatsCacheFade===cacheHighlightFading)return this._tokenStatsCache;const byModel=computeTokenStats(requests),models=Object.keys(byModel),toolStats=computeToolUsageStats(requests),skillStats=computeSkillUsageStats(requests);if(models.length===0&&toolStats.length===0)return jsxRuntimeExports.jsx("div",{className:styles$6.tokenStatsEmpty,children:"暂无 token 数据"});const tokenColumn=jsxRuntimeExports.jsx("div",{className:styles$6.tokenStatsColumn,children:models.map(model=>{const s=byModel[model],totalInput=s.input+s.cacheCreation+s.cacheRead,cacheHitRate=totalInput>0?(s.cacheRead/totalInput*100).toFixed(1):"0.0";return jsxRuntimeExports.jsxs("div",{className:models.length>1?styles$6.modelCardSpaced:styles$6.modelCard,children:[jsxRuntimeExports.jsx("div",{className:styles$6.modelName,children:model}),jsxRuntimeExports.jsx("table",{className:styles$6.statsTable,children:jsxRuntimeExports.jsxs("tbody",{children:[jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("td",{className:styles$6.label,children:"Token"}),jsxRuntimeExports.jsx("td",{className:styles$6.th,children:"input"}),jsxRuntimeExports.jsx("td",{className:styles$6.th,children:"output"})]}),jsxRuntimeExports.jsxs("tr",{className:styles$6.rowBorder,children:[jsxRuntimeExports.jsx("td",{className:styles$6.label}),jsxRuntimeExports.jsx("td",{className:styles$6.td,children:formatTokenCount(totalInput)}),jsxRuntimeExports.jsx("td",{className:styles$6.td,children:formatTokenCount(s.output)})]}),jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("td",{className:styles$6.label,children:"Cache"}),jsxRuntimeExports.jsx("td",{className:styles$6.th,children:"create"}),jsxRuntimeExports.jsx("td",{className:styles$6.th,children:"read"})]}),jsxRuntimeExports.jsxs("tr",{className:styles$6.rowBorder,children:[jsxRuntimeExports.jsx("td",{className:styles$6.label}),jsxRuntimeExports.jsx("td",{className:styles$6.td,children:formatTokenCount(s.cacheCreation)}),jsxRuntimeExports.jsx("td",{className:styles$6.td,children:formatTokenCount(s.cacheRead)})]}),jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("td",{className:styles$6.label,children:t("ui.hitRate")}),jsxRuntimeExports.jsxs("td",{colSpan:2,className:styles$6.td,children:[cacheHitRate,"%"]})]})]})})]},model)})}),cacheRebuildColumn=this.renderCacheRebuildStats(),toolColumn=toolStats.length>0?jsxRuntimeExports.jsx("div",{className:styles$6.toolStatsColumn,children:jsxRuntimeExports.jsxs("div",{className:styles$6.modelCard,children:[jsxRuntimeExports.jsx("div",{className:styles$6.modelName,children:t("ui.toolUsageStats")}),jsxRuntimeExports.jsxs("table",{className:styles$6.statsTable,children:[jsxRuntimeExports.jsx("thead",{children:jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("td",{className:`${styles$6.th} ${styles$6.thLeft}`,children:"Tool"}),jsxRuntimeExports.jsx("td",{className:styles$6.th,children:t("ui.cacheRebuild.count")})]})}),jsxRuntimeExports.jsxs("tbody",{children:[toolStats.map(([name,count])=>jsxRuntimeExports.jsxs("tr",{className:styles$6.rowBorder,children:[jsxRuntimeExports.jsxs("td",{className:styles$6.label,children:[name," ",jsxRuntimeExports.jsx(ConceptHelp,{doc:`Tool-${name}`})]}),jsxRuntimeExports.jsx("td",{className:styles$6.td,children:count})]},name)),toolStats.length>1&&jsxRuntimeExports.jsxs("tr",{className:styles$6.rebuildTotalRow,children:[jsxRuntimeExports.jsx("td",{className:styles$6.label,children:"Total"}),jsxRuntimeExports.jsx("td",{className:styles$6.td,children:toolStats.reduce((s,e)=>s+e[1],0)})]})]})]})]})}):null,skillColumn=skillStats.length>0?jsxRuntimeExports.jsx("div",{className:styles$6.toolStatsColumn,children:jsxRuntimeExports.jsxs("div",{className:styles$6.modelCard,children:[jsxRuntimeExports.jsx("div",{className:styles$6.modelName,children:t("ui.skillUsageStats")}),jsxRuntimeExports.jsxs("table",{className:styles$6.statsTable,children:[jsxRuntimeExports.jsx("thead",{children:jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("td",{className:`${styles$6.th} ${styles$6.thLeft}`,children:"Skill"}),jsxRuntimeExports.jsx("td",{className:styles$6.th,children:t("ui.cacheRebuild.count")})]})}),jsxRuntimeExports.jsxs("tbody",{children:[skillStats.map(([name,count])=>jsxRuntimeExports.jsxs("tr",{className:styles$6.rowBorder,children:[jsxRuntimeExports.jsx("td",{className:styles$6.label,children:name}),jsxRuntimeExports.jsx("td",{className:styles$6.td,children:count})]},name)),skillStats.length>1&&jsxRuntimeExports.jsxs("tr",{className:styles$6.rebuildTotalRow,children:[jsxRuntimeExports.jsx("td",{className:styles$6.label,children:"Total"}),jsxRuntimeExports.jsx("td",{className:styles$6.td,children:skillStats.reduce((s,e)=>s+e[1],0)})]})]})]})]})}):null,result=jsxRuntimeExports.jsxs("div",{className:styles$6.tokenStatsContainer,children:[tokenColumn,cacheRebuildColumn,toolColumn,skillColumn]});return this._tokenStatsCache=result,this._tokenStatsCacheReq=requests,this._tokenStatsCacheHl=cacheHighlightIdx,this._tokenStatsCacheFade=cacheHighlightFading,result}_cacheUnbindScrollFade(){this._cacheOnScrollFade&&this._cacheScrollEl&&(this._cacheScrollEl.removeEventListener("scroll",this._cacheOnScrollFade),this._cacheOnScrollFade=null)}_cacheBindScrollFade(){this._cacheUnbindScrollFade();const el=this._cacheScrollEl;el&&(this._cacheOnScrollFade=()=>{clearTimeout(this._cacheAutoFadeTimer),this.setState({cacheHighlightFading:!0}),this._cacheFadeClearTimer=setTimeout(()=>{this.setState({cacheHighlightIdx:null,cacheHighlightFading:!1})},3e3),this._cacheUnbindScrollFade()},el.addEventListener("scroll",this._cacheOnScrollFade,{passive:!0}))}scrollToCacheMsg(idx){if(this.props.viewMode==="raw"&&this.props.onNavigateCacheMsg&&this.props.onNavigateCacheMsg(idx),(this.state._cacheSectionCollapsed||{}).messages){this.setState(prev=>({_cacheSectionCollapsed:{...prev._cacheSectionCollapsed||{},messages:!1}}),()=>this.scrollToCacheMsg(idx));return}const el=this._cacheScrollEl;if(!el)return;const target=el.querySelector(`[data-msg-idx="${idx}"]`);if(!target)return;clearTimeout(this._cacheScrollSettleTimer),clearTimeout(this._cacheFadeClearTimer),clearTimeout(this._cacheAutoFadeTimer),clearTimeout(this._cacheHighlightDelayTimer),this._cacheUnbindScrollFade(),this._cacheScrollEndHandler&&el.removeEventListener("scrollend",this._cacheScrollEndHandler),this.setState({cacheHighlightIdx:null,cacheHighlightFading:!1});let scrollDone=!1,minPassed=!1;const showHighlight=()=>{!scrollDone||!minPassed||(this.setState({cacheHighlightIdx:idx,cacheHighlightFading:!1}),this._cacheScrollSettleTimer=setTimeout(()=>this._cacheBindScrollFade(),200),this._cacheAutoFadeTimer=setTimeout(()=>{this.state.cacheHighlightIdx===idx&&!this.state.cacheHighlightFading&&(this.setState({cacheHighlightFading:!0}),this._cacheFadeClearTimer=setTimeout(()=>{this.setState({cacheHighlightIdx:null,cacheHighlightFading:!1})},3e3),this._cacheUnbindScrollFade())},3e3))};this._cacheScrollEndHandler=()=>{el.removeEventListener("scrollend",this._cacheScrollEndHandler),scrollDone=!0,showHighlight()},el.addEventListener("scrollend",this._cacheScrollEndHandler,{once:!0}),this._cacheScrollSettleTimer=setTimeout(()=>{el.removeEventListener("scrollend",this._cacheScrollEndHandler),scrollDone=!0,showHighlight()},800),this._cacheHighlightDelayTimer=setTimeout(()=>{minPassed=!0,showHighlight()},500),target.scrollIntoView({behavior:"smooth",block:"center"})}renderCacheContentPopover(contextPercent){const{requests=[],serverCachedContent}=this.props,cached=serverCachedContent||extractCachedContent(requests);cached&&(cached.cacheCreateTokens>0||cached.cacheReadTokens>0)&&(this._lastCachedTokens={cacheCreateTokens:cached.cacheCreateTokens,cacheReadTokens:cached.cacheReadTokens}),contextPercent>0&&(this._lastContextPercent=contextPercent);const toolsArr=Array.isArray(cached==null?void 0:cached.tools)?cached.tools:null;let parsed;toolsArr===this._lastToolsRef&&this._lastParsedTools?parsed=this._lastParsedTools:(parsed=parseCachedTools(toolsArr),this._lastToolsRef=toolsArr,this._lastParsedTools=parsed);const{builtin,mcpByServer}=parsed,hasBuiltin=builtin.length>0,hasMcp=mcpByServer.size>0,renderBuiltinChip=({name,description})=>{const title=[name,description].filter(Boolean).join(`
11
+
12
+ `),chip=jsxRuntimeExports.jsx("span",{className:styles$6.cacheToolChip,title,children:name});return jsxRuntimeExports.jsx(ConceptHelp,{doc:`Tool-${name}`,children:chip},name)},renderMcpChip=({name,fullName,description})=>{const title=[fullName,description].filter(Boolean).join(`
13
+
14
+ `);return jsxRuntimeExports.jsx("span",{className:styles$6.cacheToolChip,title,children:name},fullName)},renderGroup=(sectionKey,titleKey,count,defaultCollapsed,body)=>{const state=(this.state._cacheSectionCollapsed||{})[sectionKey],collapsed=state!==void 0?!!state:defaultCollapsed,toggle=()=>this.setState(prev=>({_cacheSectionCollapsed:{...prev._cacheSectionCollapsed||{},[sectionKey]:!collapsed}}));return jsxRuntimeExports.jsxs("div",{className:styles$6.cacheSection,children:[jsxRuntimeExports.jsxs("button",{type:"button",className:styles$6.cacheSectionTitle,onClick:toggle,"aria-expanded":!collapsed,children:[jsxRuntimeExports.jsx("span",{className:styles$6.cacheSectionArrow,children:collapsed?"▶":"▼"}),t(titleKey)," (",count,")"]}),!collapsed&&body]})},builtinBody=jsxRuntimeExports.jsx("div",{className:styles$6.toolChipGrid,children:builtin.map(renderBuiltinChip)}),mcpBody=jsxRuntimeExports.jsx("div",{className:styles$6.toolChipGridVertical,children:Array.from(mcpByServer.entries()).map(([server,tools])=>jsxRuntimeExports.jsxs("div",{className:styles$6.mcpServerGroup,children:[jsxRuntimeExports.jsxs("div",{className:styles$6.mcpServerName,children:[server," (",tools.length,")"]}),jsxRuntimeExports.jsx("div",{className:styles$6.toolChipGrid,children:tools.map(renderMcpChip)})]},server))}),ctxColor=contextPercent>=80?"var(--color-error-light)":contextPercent>=60?"var(--color-warning-light)":"var(--color-success)";return jsxRuntimeExports.jsxs("div",{className:styles$6.cachePopover,children:[jsxRuntimeExports.jsx("div",{className:styles$6.cachePopoverHeader,children:jsxRuntimeExports.jsxs("div",{className:styles$6.cachePopoverTitle,children:[jsxRuntimeExports.jsxs("span",{className:styles$6.cachePercent,style:{color:ctxColor},children:[contextPercent,"%"]}),jsxRuntimeExports.jsx("span",{className:styles$6.cacheCalibrationLabel,children:t("ui.calibrationModelLabel")}),jsxRuntimeExports.jsx(Select,{size:"small",value:this.state.calibrationModel,onChange:this.handleCalibrationModelChange,options:CALIBRATION_MODELS,className:styles$6.calibrationSelect,popupMatchSelectWidth:!1})]})}),(hasBuiltin||hasMcp)&&jsxRuntimeExports.jsxs("div",{className:styles$6.cacheScrollArea,children:[hasBuiltin&&renderGroup("tools_builtin","ui.builtinTools",builtin.length,!0,builtinBody),hasMcp&&renderGroup("tools_mcp","ui.mcpTools",Array.from(mcpByServer.values()).reduce((n,arr)=>n+arr.length,0),!1,mcpBody)]})]})}renderCacheRebuildStats(){const{requests=[]}=this.props,stats=computeCacheRebuildStats(requests),reasonKeys=["ttl","system_change","tools_change","model_change","msg_truncated","msg_modified","key_change"],i18nMap={ttl:"cacheLoss.ttl",system_change:"cacheLoss.systemChange",tools_change:"cacheLoss.toolsChange",model_change:"cacheLoss.modelChange",msg_truncated:"cacheLoss.msgTruncated",msg_modified:"cacheLoss.msgModified",key_change:"cacheLoss.keyChange"},activeReasons=reasonKeys.filter(k=>stats[k].count>0),totalCount=activeReasons.reduce((sum,k)=>sum+stats[k].count,0),totalCache=activeReasons.reduce((sum,k)=>sum+stats[k].cacheCreate,0);resolveTeammateNames(requests);const subAgentCounts={},teammateCounts={};for(let i=0;i<requests.length;i++){const cls=classifyRequest(requests[i],requests[i+1]);if(cls.type==="SubAgent"){const label=cls.subType||"Other";subAgentCounts[label]=(subAgentCounts[label]||0)+1}else if(cls.type==="Teammate"){const label=cls.subType||"Teammate";teammateCounts[label]=(teammateCounts[label]||0)+1}}const subAgentEntries=Object.entries(subAgentCounts).sort((a,b)=>b[1]-a[1]),teammateEntries=Object.entries(teammateCounts).sort((a,b)=>b[1]-a[1]),hasCacheStats=activeReasons.length>0,hasSubAgentStats=subAgentEntries.length>0,hasTeammateStats=teammateEntries.length>0;return!hasCacheStats&&!hasSubAgentStats&&!hasTeammateStats?null:jsxRuntimeExports.jsxs("div",{className:styles$6.toolStatsColumn,children:[hasCacheStats&&jsxRuntimeExports.jsxs("div",{className:hasSubAgentStats||hasTeammateStats?styles$6.modelCardSpaced:styles$6.modelCard,children:[jsxRuntimeExports.jsxs("div",{className:styles$6.modelName,children:["MainAgent",jsxRuntimeExports.jsx(ConceptHelp,{doc:"MainAgent"})," ",t("ui.cacheRebuildStats"),jsxRuntimeExports.jsx(ConceptHelp,{doc:"CacheRebuild"})]}),jsxRuntimeExports.jsxs("table",{className:styles$6.statsTable,children:[jsxRuntimeExports.jsx("thead",{children:jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("td",{className:`${styles$6.th} ${styles$6.thLeft}`,children:t("ui.cacheRebuild.reason")}),jsxRuntimeExports.jsx("td",{className:styles$6.th,children:t("ui.cacheRebuild.count")}),jsxRuntimeExports.jsx("td",{className:styles$6.th,children:t("ui.cacheRebuild.cacheCreate")})]})}),jsxRuntimeExports.jsxs("tbody",{children:[activeReasons.map(k=>jsxRuntimeExports.jsxs("tr",{className:styles$6.rowBorder,children:[jsxRuntimeExports.jsx("td",{className:styles$6.label,children:t(`ui.${i18nMap[k]}`)}),jsxRuntimeExports.jsx("td",{className:styles$6.td,children:stats[k].count}),jsxRuntimeExports.jsx("td",{className:styles$6.td,children:formatTokenCount(stats[k].cacheCreate)})]},k)),activeReasons.length>1&&jsxRuntimeExports.jsxs("tr",{className:styles$6.rebuildTotalRow,children:[jsxRuntimeExports.jsx("td",{className:styles$6.label,children:"Total"}),jsxRuntimeExports.jsx("td",{className:styles$6.td,children:totalCount}),jsxRuntimeExports.jsx("td",{className:styles$6.td,children:formatTokenCount(totalCache)})]})]})]})]}),hasSubAgentStats&&jsxRuntimeExports.jsxs("div",{className:hasTeammateStats?styles$6.modelCardSpaced:styles$6.modelCard,children:[jsxRuntimeExports.jsx("div",{className:styles$6.modelName,children:t("ui.subAgentStats")}),jsxRuntimeExports.jsxs("table",{className:styles$6.statsTable,children:[jsxRuntimeExports.jsx("thead",{children:jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("td",{className:`${styles$6.th} ${styles$6.thLeft}`,children:"SubAgent"}),jsxRuntimeExports.jsx("td",{className:styles$6.th,children:t("ui.cacheRebuild.count")})]})}),jsxRuntimeExports.jsxs("tbody",{children:[subAgentEntries.map(([name,count])=>jsxRuntimeExports.jsxs("tr",{className:styles$6.rowBorder,children:[jsxRuntimeExports.jsxs("td",{className:styles$6.label,children:[name," ",jsxRuntimeExports.jsx(ConceptHelp,{doc:`SubAgent-${name}`})]}),jsxRuntimeExports.jsx("td",{className:styles$6.td,children:count})]},name)),subAgentEntries.length>1&&jsxRuntimeExports.jsxs("tr",{className:styles$6.rebuildTotalRow,children:[jsxRuntimeExports.jsx("td",{className:styles$6.label,children:"Total"}),jsxRuntimeExports.jsx("td",{className:styles$6.td,children:subAgentEntries.reduce((s,e)=>s+e[1],0)})]})]})]})]}),hasTeammateStats&&jsxRuntimeExports.jsxs("div",{className:styles$6.modelCard,children:[jsxRuntimeExports.jsxs("div",{className:styles$6.modelName,children:["Teammate",jsxRuntimeExports.jsx(ConceptHelp,{doc:"Teammate"})]}),jsxRuntimeExports.jsxs("table",{className:styles$6.statsTable,children:[jsxRuntimeExports.jsx("thead",{children:jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("td",{className:`${styles$6.th} ${styles$6.thLeft}`,children:"Name"}),jsxRuntimeExports.jsx("td",{className:styles$6.th,children:t("ui.cacheRebuild.count")})]})}),jsxRuntimeExports.jsxs("tbody",{children:[teammateEntries.map(([name,count])=>jsxRuntimeExports.jsxs("tr",{className:styles$6.rowBorder,children:[jsxRuntimeExports.jsx("td",{className:styles$6.label,children:name}),jsxRuntimeExports.jsx("td",{className:styles$6.td,children:count})]},name)),teammateEntries.length>1&&jsxRuntimeExports.jsxs("tr",{className:styles$6.rebuildTotalRow,children:[jsxRuntimeExports.jsx("td",{className:styles$6.label,children:"Total"}),jsxRuntimeExports.jsx("td",{className:styles$6.td,children:teammateEntries.reduce((s,e)=>s+e[1],0)})]})]})]})]})]})}renderTextPrompt(p){return jsxRuntimeExports.jsx("div",{className:styles$6.textPromptCard,children:p.segments.map((seg,j)=>seg.type==="text"?jsxRuntimeExports.jsx("pre",{className:styles$6.preText,children:seg.content},j):jsxRuntimeExports.jsx(Collapse,{size:"small",className:styles$6.systemCollapse,items:[{key:`sys-${j}`,label:jsxRuntimeExports.jsx("span",{className:styles$6.systemLabel,children:seg.label}),children:jsxRuntimeExports.jsx("pre",{className:styles$6.preSys,children:seg.content})}]},j))})}renderOriginalPrompt(p){const textSegments=p.segments.filter(seg=>seg.type==="text");return textSegments.length===0?null:jsxRuntimeExports.jsx("div",{className:styles$6.textPromptCard,children:textSegments.map((seg,j)=>jsxRuntimeExports.jsx("pre",{className:styles$6.preText,children:seg.content},j))})}buildTextModeContent(){const{promptData}=this.state,blocks=[];for(const p of promptData){const textParts=(p.segments||[]).filter(seg=>seg.type==="text").map(seg=>seg.content);textParts.length>0&&blocks.push(textParts.join(`
15
+ `))}return blocks.join(`
16
+
17
+
18
+ `)}renderProjectStatsContent(){const{projectStats,projectStatsLoading}=this.state;if(projectStatsLoading)return jsxRuntimeExports.jsx("div",{className:styles$6.projectStatsCenter,children:jsxRuntimeExports.jsx(Spin,{})});if(!projectStats)return jsxRuntimeExports.jsx("div",{className:styles$6.projectStatsEmpty,children:t("ui.projectStats.noData")});const{summary,models,updatedAt}=projectStats;models&&Object.entries(models).sort((a,b)=>b[1]-a[1]);const modelTokens={};if(projectStats.files){for(const fStats of Object.values(projectStats.files))if(fStats.models)for(const[model,data]of Object.entries(fStats.models))modelTokens[model]||(modelTokens[model]={input:0,output:0,cacheRead:0,cacheCreation:0,count:0}),modelTokens[model].input+=data.input_tokens||0,modelTokens[model].output+=data.output_tokens||0,modelTokens[model].cacheRead+=data.cache_read_input_tokens||0,modelTokens[model].cacheCreation+=data.cache_creation_input_tokens||0,modelTokens[model].count+=data.count||0}const modelTokenEntries=Object.entries(modelTokens).sort((a,b)=>b[1].count-a[1].count);return jsxRuntimeExports.jsxs("div",{className:styles$6.projectStatsContent,children:[updatedAt&&jsxRuntimeExports.jsx("div",{className:styles$6.projectStatsUpdated,children:t("ui.projectStats.updatedAt",{time:new Date(updatedAt).toLocaleString()})}),jsxRuntimeExports.jsxs("div",{className:styles$6.projectStatsSummary,children:[jsxRuntimeExports.jsxs("div",{className:styles$6.projectStatCard,children:[jsxRuntimeExports.jsx("div",{className:styles$6.projectStatValue,children:(summary==null?void 0:summary.requestCount)??0}),jsxRuntimeExports.jsx("div",{className:styles$6.projectStatLabel,children:t("ui.projectStats.totalRequests")})]}),jsxRuntimeExports.jsxs("div",{className:styles$6.projectStatCard,children:[jsxRuntimeExports.jsx("div",{className:styles$6.projectStatValue,children:(summary==null?void 0:summary.turnCount)??(summary==null?void 0:summary.sessionCount)??0}),jsxRuntimeExports.jsx("div",{className:styles$6.projectStatLabel,children:t("ui.projectStats.turnCount")})]}),jsxRuntimeExports.jsxs("div",{className:styles$6.projectStatCard,children:[jsxRuntimeExports.jsx("div",{className:styles$6.projectStatValue,children:(summary==null?void 0:summary.fileCount)??0}),jsxRuntimeExports.jsx("div",{className:styles$6.projectStatLabel,children:t("ui.projectStats.totalFiles")})]}),jsxRuntimeExports.jsxs("div",{className:styles$6.projectStatCard,children:[jsxRuntimeExports.jsx("div",{className:styles$6.projectStatValue,children:formatTokenCount(summary==null?void 0:summary.input_tokens)}),jsxRuntimeExports.jsx("div",{className:styles$6.projectStatLabel,children:"Input Tokens"})]}),jsxRuntimeExports.jsxs("div",{className:styles$6.projectStatCard,children:[jsxRuntimeExports.jsx("div",{className:styles$6.projectStatValue,children:formatTokenCount(summary==null?void 0:summary.output_tokens)}),jsxRuntimeExports.jsx("div",{className:styles$6.projectStatLabel,children:"Output Tokens"})]})]}),modelTokenEntries.length>0&&jsxRuntimeExports.jsxs("div",{className:styles$6.projectStatsSection,children:[jsxRuntimeExports.jsx("div",{className:styles$6.projectStatsSectionTitle,children:t("ui.projectStats.modelUsage")}),modelTokenEntries.map(([model,data])=>{const totalInput=data.input+data.cacheRead+data.cacheCreation,cacheHitRate=totalInput>0?(data.cacheRead/totalInput*100).toFixed(1):"0.0";return jsxRuntimeExports.jsxs("div",{className:styles$6.projectStatsModelCard,children:[jsxRuntimeExports.jsxs("div",{className:styles$6.projectStatsModelHeader,children:[jsxRuntimeExports.jsx("span",{className:styles$6.projectStatsModelName,children:model}),jsxRuntimeExports.jsxs("span",{className:styles$6.projectStatsModelCount,children:[data.count," reqs"]})]}),jsxRuntimeExports.jsx("table",{className:styles$6.statsTable,children:jsxRuntimeExports.jsxs("tbody",{children:[jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("td",{className:styles$6.label,children:"Token"}),jsxRuntimeExports.jsx("td",{className:styles$6.th,children:"input"}),jsxRuntimeExports.jsx("td",{className:styles$6.th,children:"output"})]}),jsxRuntimeExports.jsxs("tr",{className:styles$6.rowBorder,children:[jsxRuntimeExports.jsx("td",{className:styles$6.label}),jsxRuntimeExports.jsx("td",{className:styles$6.td,children:formatTokenCount(totalInput)}),jsxRuntimeExports.jsx("td",{className:styles$6.td,children:formatTokenCount(data.output)})]}),jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("td",{className:styles$6.label,children:"Cache"}),jsxRuntimeExports.jsx("td",{className:styles$6.th,children:"create"}),jsxRuntimeExports.jsx("td",{className:styles$6.th,children:"read"})]}),jsxRuntimeExports.jsxs("tr",{className:styles$6.rowBorder,children:[jsxRuntimeExports.jsx("td",{className:styles$6.label}),jsxRuntimeExports.jsx("td",{className:styles$6.td,children:formatTokenCount(data.cacheCreation)}),jsxRuntimeExports.jsx("td",{className:styles$6.td,children:formatTokenCount(data.cacheRead)})]}),jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("td",{className:styles$6.label,children:t("ui.hitRate")}),jsxRuntimeExports.jsxs("td",{colSpan:2,className:styles$6.td,children:[cacheHitRate,"%"]})]})]})})]},model)})]})]})}render(){var _a;const{requestCount,requests=[],viewMode,cacheType,onToggleViewMode,onImportLocalLogs,onLangChange,isLocalLog,localLogFile,projectName,collapseToolResults,onCollapseToolResultsChange,expandThinking,onExpandThinkingChange,showFullToolContent,onShowFullToolContentChange,expandDiff,onExpandDiffChange,filterIrrelevant,onFilterIrrelevantChange,logDir,onLogDirChange,updateInfo,onDismissUpdate,cliMode,terminalVisible,onToggleTerminal,onReturnToWorkspaces,contextWindow,serverCachedContent,resumeAutoChoice,onResumeAutoChoiceToggle,onResumeAutoChoiceChange,themeColor,onThemeColorChange,autoApproveSeconds,onAutoApproveChange}=this.props,{countdownText}=this.state,menuItems=[{key:"import-local",icon:jsxRuntimeExports.jsx(RefIcon$2,{}),label:t("ui.importLocalLogs"),onClick:onImportLocalLogs},{key:"export-prompts",icon:jsxRuntimeExports.jsx(RefIcon$3,{}),label:t("ui.exportPrompts"),onClick:this.handleShowPrompts},{key:"plugin-management",icon:jsxRuntimeExports.jsx(RefIcon$8,{}),label:t("ui.pluginManagement"),onClick:this.handleShowPlugins},{key:"switch-workspace",icon:jsxRuntimeExports.jsx(RefIcon$2,{className:styles$6.iconMirror}),label:jsxRuntimeExports.jsx("span",{className:styles$6.disabledMenuItem,children:t("ui.switchWorkspace")}),disabled:!0},{key:"process-management",icon:jsxRuntimeExports.jsx(RefIcon$4,{}),label:t("ui.processManagement"),onClick:this.handleShowProcesses},{key:"proxy-switch",icon:jsxRuntimeExports.jsx(RefIcon$9,{}),label:t("ui.proxySwitch"),onClick:()=>this.setState({proxyModalVisible:!0})},{type:"divider"},{key:"project-stats",icon:jsxRuntimeExports.jsx(RefIcon$7,{}),label:t("ui.projectStats"),onClick:this.handleShowProjectStats},...viewMode==="raw"?[{key:"global-settings",icon:jsxRuntimeExports.jsx(RefIcon,{}),label:t("ui.globalSettings"),onClick:()=>this.setState({globalSettingsVisible:!0})}]:[],...viewMode==="chat"?[{key:"display-settings",icon:jsxRuntimeExports.jsx(RefIcon,{}),label:t("ui.settings"),onClick:()=>this.setState({settingsDrawerVisible:!0})}]:[]];return jsxRuntimeExports.jsxs("div",{className:styles$6.headerBar,children:[jsxRuntimeExports.jsxs(Space,{size:"middle",children:[jsxRuntimeExports.jsx(Dropdown,{menu:{items:menuItems,className:"logo-dropdown-menu"},trigger:["hover"],onOpenChange:open=>this.setState({logoDropdownOpen:open}),align:{offset:[-4,0]},children:jsxRuntimeExports.jsx("span",{className:`${styles$6.logoWrap}${this.state.logoDropdownOpen?` ${styles$6.logoWrapActive}`:""}`,children:jsxRuntimeExports.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:`${styles$6.logoImage}${this.state.logoDropdownOpen?` ${styles$6.logoImageActive}`:""}`,children:[jsxRuntimeExports.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),jsxRuntimeExports.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),jsxRuntimeExports.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]})})}),jsxRuntimeExports.jsx(Popover,{content:()=>this.renderTokenStats(),trigger:"hover",placement:"bottomLeft",overlayInnerStyle:{background:"var(--bg-elevated)",border:"1px solid var(--border-hover)",borderRadius:8,padding:"8px 8px",maxHeight:"80vh",overflowY:"auto"},children:jsxRuntimeExports.jsxs(Tag,{className:styles$6.tokenStatsTag,children:[jsxRuntimeExports.jsx(RefIcon$4,{className:styles$6.tokenStatsIcon}),t("ui.tokenStats")]})}),this.props.activeProxyId&&this.props.activeProxyId!=="max"&&(()=>{const p=(this.props.proxyProfiles||[]).find(x=>x.id===this.props.activeProxyId);return p?jsxRuntimeExports.jsxs(Tag,{className:styles$6.proxyProfileTag,onClick:()=>this.setState({proxyModalVisible:!0}),children:[jsxRuntimeExports.jsx(RefIcon$9,{className:styles$6.proxySwapIcon}),p.name,p.activeModel?` · ${p.activeModel}`:""]}):null})(),(()=>{var _a2,_b,_c,_d,_e;let contextPercent=0;const calibration=CALIBRATION_MODELS.find(m=>m.value===this.state.calibrationModel),calibrationTokens=calibration==null?void 0:calibration.tokens;if(!isLocalLog){if(calibrationTokens&&(contextWindow==null?void 0:contextWindow.used_percentage)!=null){const getTotal=req=>{var _a3,_b2;const u=(_b2=(_a3=req.response)==null?void 0:_a3.body)==null?void 0:_b2.usage;return((u==null?void 0:u.input_tokens)||0)+((u==null?void 0:u.cache_creation_input_tokens)||0)+((u==null?void 0:u.cache_read_input_tokens)||0)};let total=0;for(let i=requests.length-1;i>=0;i--)if(isMainAgent(requests[i])&&((_b=(_a2=requests[i].response)==null?void 0:_a2.body)!=null&&_b.usage)){total=getTotal(requests[i]);break}if(total>0){const usable=calibrationTokens*.835;contextPercent=Math.min(100,Math.max(0,Math.round(total/usable*100)))}else{const origMax=contextWindow.context_window_size||2e5;contextPercent=Math.min(100,Math.max(0,Math.round(contextWindow.used_percentage*origMax/calibrationTokens/83.5*100)))}}else if((contextWindow==null?void 0:contextWindow.used_percentage)!=null){const settingsTokens=this.state.settingsModel?getModelMaxTokens(this.state.settingsModel):0,detectedMax=contextWindow.context_window_size||2e5;settingsTokens&&settingsTokens!==detectedMax?contextPercent=Math.min(100,Math.max(0,Math.round(contextWindow.used_percentage*detectedMax/settingsTokens/83.5*100))):contextPercent=Math.min(100,Math.max(0,Math.round(contextWindow.used_percentage/83.5*100)))}else if(requests.length>0){const getTotal=req=>{var _a3,_b2;const u=(_b2=(_a3=req.response)==null?void 0:_a3.body)==null?void 0:_b2.usage;return((u==null?void 0:u.input_tokens)||0)+((u==null?void 0:u.cache_creation_input_tokens)||0)+((u==null?void 0:u.cache_read_input_tokens)||0)};for(let i=requests.length-1;i>=0;i--)if(isMainAgent(requests[i])&&((_d=(_c=requests[i].response)==null?void 0:_c.body)!=null&&_d.usage)){const total=getTotal(requests[i]),usable=(calibrationTokens||(contextWindow==null?void 0:contextWindow.context_window_size)||getModelMaxTokens(((_e=requests[i].body)==null?void 0:_e.model)||this.state.settingsModel))*.835;usable>0&&total>0&&(contextPercent=Math.min(100,Math.max(0,Math.round(total/usable*100))));break}}}contextPercent===0&&this._lastContextPercent>0&&(contextPercent=this._lastContextPercent);const ctxColor=contextPercent>=80?"var(--color-error-light)":contextPercent>=60?"var(--color-warning-light)":"var(--color-success)";return isLocalLog?jsxRuntimeExports.jsx(Tag,{className:`${styles$6.liveTag} ${styles$6.liveTagHistory}`,children:jsxRuntimeExports.jsx("span",{className:styles$6.liveTagText,children:t("ui.historyLog",{file:localLogFile})})}):jsxRuntimeExports.jsx(Popover,{content:this.state._cachePopoverOpen?this.renderCacheContentPopover(contextPercent):jsxRuntimeExports.jsx("div",{className:styles$6.cachePopoverPlaceholder}),trigger:"hover",placement:"bottomLeft",overlayInnerStyle:{background:"var(--bg-elevated)",border:"1px solid var(--border-hover)",borderRadius:8,padding:"8px 8px"},onOpenChange:open=>{this.setState({_cachePopoverOpen:open}),open||(this._cacheScrollInited=!1)},children:jsxRuntimeExports.jsxs("span",{className:styles$6.liveTag,style:{borderColor:ctxColor,color:ctxColor},children:[jsxRuntimeExports.jsx("span",{className:styles$6.liveTagFill,style:{width:`${contextPercent}%`,backgroundColor:ctxColor}}),jsxRuntimeExports.jsx("span",{className:styles$6.liveTagContent,children:jsxRuntimeExports.jsxs("span",{className:styles$6.liveTagText,children:[t("ui.liveMonitoring"),projectName?`:${projectName}`:""]})})]})})})(),updateInfo&&jsxRuntimeExports.jsx(Tag,{color:updateInfo.type==="completed"?"green":"orange",closable:!0,onClose:()=>onDismissUpdate&&onDismissUpdate(),children:updateInfo.type==="completed"?t("ui.update.completed",{version:updateInfo.version}):t("ui.update.majorAvailable",{version:updateInfo.version})})]}),jsxRuntimeExports.jsxs(Space,{size:"middle",children:[countdownText&&viewMode==="raw"&&jsxRuntimeExports.jsxs(Tag,{style:{background:"var(--bg-surface)",border:"1px solid var(--border-hover)",color:countdownText===t("ui.cacheExpired")?"var(--color-error-light)":"var(--text-secondary)"},children:[t("ui.cacheCountdown",{type:cacheType?`(${cacheType})`:""}),jsxRuntimeExports.jsx("strong",{className:styles$6.countdownStrong,children:countdownText})]}),viewMode==="chat"&&cliMode&&!isLocalLog&&this.state.localUrl&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[this.state.countryFlag&&((_a=this.state.countryInfo)==null?void 0:_a.country)!=="CN"&&jsxRuntimeExports.jsx(Popover,{content:this.state.countryInfo?jsxRuntimeExports.jsxs("div",{className:styles$6.countryInfoPopover,children:[jsxRuntimeExports.jsxs("div",{children:[this.state.countryFlag," ",this.state.countryInfo.country]}),this.state.countryInfo.region&&jsxRuntimeExports.jsx("div",{children:this.state.countryInfo.region}),this.state.countryInfo.city&&jsxRuntimeExports.jsx("div",{children:this.state.countryInfo.city}),this.state.countryInfo.org&&jsxRuntimeExports.jsx("div",{className:styles$6.countryInfoMeta,children:this.state.countryInfo.org}),this.state.countryInfo.ip&&jsxRuntimeExports.jsx("div",{className:styles$6.countryInfoMeta,children:this.state.countryInfo.ip})]}):null,trigger:"hover",placement:"bottomRight",overlayInnerStyle:{background:"var(--bg-elevated)",border:"1px solid var(--border-hover)",borderRadius:8,padding:"8px 12px"},children:jsxRuntimeExports.jsx(Button,{className:styles$6.compactBtnNoBorder,icon:jsxRuntimeExports.jsx("span",{className:styles$6.countryFlagIcon,children:this.state.countryFlag})})}),jsxRuntimeExports.jsx(Switch,{checked:themeColor==="light",onChange:checked=>onThemeColorChange&&onThemeColorChange(checked?"light":"dark"),checkedChildren:"雪山白",unCheckedChildren:"曜石黑"}),jsxRuntimeExports.jsx(Popover,{content:jsxRuntimeExports.jsxs("div",{className:styles$6.qrcodePopover,children:[jsxRuntimeExports.jsxs("div",{className:styles$6.qrcodeTitle,children:[t("ui.scanToCoding")," ",jsxRuntimeExports.jsx(ConceptHelp,{doc:"QRCode"})]}),jsxRuntimeExports.jsx(QRCodeCanvas,{value:this.state.localUrl,size:200,bgColor:themeColor==="light"?"#ffffff":"#141414",fgColor:themeColor==="light"?"#1a1a1a":"#d9d9d9",level:"M"}),jsxRuntimeExports.jsx(Input,{readOnly:!0,value:this.state.localUrl,className:styles$6.qrcodeUrlInput,suffix:jsxRuntimeExports.jsx(RefIcon$a,{className:styles$6.qrcodeUrlCopy,onClick:()=>{navigator.clipboard.writeText(this.state.localUrl).then(()=>{staticMethods.success(t("ui.copied"))}).catch(()=>{})}})})]}),trigger:"hover",placement:"bottomRight",overlayInnerStyle:{background:"var(--bg-elevated)",border:"1px solid var(--border-hover)",borderRadius:8,padding:"8px 8px"},children:jsxRuntimeExports.jsx(Button,{className:styles$6.compactBtnNoBorder,icon:jsxRuntimeExports.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",style:{verticalAlign:"middle"},children:jsxRuntimeExports.jsx("path",{fillRule:"evenodd",d:"M0 0h10v10H0zM2 2v6h6V2zM3 3h4v4H3zM14 0h10v10H14zM16 2v6h6V2zM17 3h4v4H17zM0 14h10v10H0zM2 16v6h6v-6zM3 17h4v4H3zM14 14h3v3h-3zM20 14h3v3h-3zM17 17h3v3h-3zM14 20h3v3h-3zM20 20h3v3h-3z"})})})})]}),cliMode&&viewMode==="chat"&&!isLocalLog&&jsxRuntimeExports.jsx(Button,{className:styles$6.compactBtn,type:terminalVisible?"primary":"default",ghost:terminalVisible,icon:jsxRuntimeExports.jsx(RefIcon$5,{}),onClick:onToggleTerminal,children:t("ui.terminal")}),jsxRuntimeExports.jsx(Button,{className:styles$6.compactBtn,type:viewMode==="raw"?"primary":"default",icon:viewMode==="raw"?jsxRuntimeExports.jsx(RefIcon$1,{}):jsxRuntimeExports.jsx(RefIcon$b,{}),onClick:onToggleViewMode,children:viewMode==="raw"?t("ui.chatMode"):t("ui.rawMode")})]}),jsxRuntimeExports.jsxs(Modal,{title:`${t("ui.userPrompt")} (${this.state.promptData.length}${t("ui.promptCountUnit")})`,open:this.state.promptModalVisible,onCancel:()=>this.setState({promptModalVisible:!1}),footer:null,width:700,children:[jsxRuntimeExports.jsx("div",{className:styles$6.promptExportBar,children:jsxRuntimeExports.jsx(Button,{icon:jsxRuntimeExports.jsx(RefIcon$c,{}),onClick:this.handleExportPromptsTxt,children:t("ui.exportPromptsTxt")})}),jsxRuntimeExports.jsx(Tabs,{activeKey:this.state.promptViewMode,onChange:key=>this.setState({promptViewMode:key}),size:"small",items:[{key:"original",label:t("ui.promptModeOriginal")},{key:"context",label:t("ui.promptModeContext")},{key:"text",label:t("ui.promptModeText")}]}),this.state.promptViewMode==="text"?jsxRuntimeExports.jsx("textarea",{readOnly:!0,className:styles$6.promptTextarea,value:this.buildTextModeContent()}):jsxRuntimeExports.jsxs("div",{className:styles$6.promptScrollArea,children:[this.state.promptData.length===0&&jsxRuntimeExports.jsx("div",{className:styles$6.promptEmpty,children:t("ui.noPrompt")}),this.state.promptData.map((p,i)=>{const ts=p.timestamp?new Date(p.timestamp).toLocaleString():t("ui.unknownTime");return jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsxs("div",{className:styles$6.promptTimestamp,children:[ts,":"]}),this.state.promptViewMode==="original"?this.renderOriginalPrompt(p):this.renderTextPrompt(p)]},i)})]})]}),jsxRuntimeExports.jsxs(Drawer,{title:t("ui.settings"),placement:"left",width:360,open:this.state.settingsDrawerVisible,onClose:()=>this.setState({settingsDrawerVisible:!1}),children:[jsxRuntimeExports.jsxs("div",{className:styles$6.settingsGroupBox,children:[jsxRuntimeExports.jsx("div",{className:styles$6.settingsGroupTitle,children:t("ui.chatDisplaySwitches")}),jsxRuntimeExports.jsxs("div",{className:styles$6.settingsItem,children:[jsxRuntimeExports.jsx("span",{className:styles$6.settingsLabel,children:t("ui.collapseToolResults")}),jsxRuntimeExports.jsx(Switch,{checked:!!collapseToolResults,onChange:checked=>onCollapseToolResultsChange&&onCollapseToolResultsChange(checked)})]}),jsxRuntimeExports.jsxs("div",{className:styles$6.settingsItem,children:[jsxRuntimeExports.jsx("span",{className:styles$6.settingsLabel,children:t("ui.expandThinking")}),jsxRuntimeExports.jsx(Switch,{checked:!!expandThinking,onChange:checked=>onExpandThinkingChange&&onExpandThinkingChange(checked)})]}),jsxRuntimeExports.jsxs("div",{className:styles$6.settingsItem,children:[jsxRuntimeExports.jsx("span",{className:styles$6.settingsLabel,children:t("ui.showFullToolContent")}),jsxRuntimeExports.jsx(Switch,{checked:!!showFullToolContent,onChange:checked=>onShowFullToolContentChange&&onShowFullToolContentChange(checked)})]})]}),jsxRuntimeExports.jsxs("div",{className:styles$6.settingsGroupBox,children:[jsxRuntimeExports.jsx("div",{className:styles$6.settingsGroupTitle,children:t("ui.userPreferences")}),jsxRuntimeExports.jsxs("div",{className:styles$6.settingsItem,children:[jsxRuntimeExports.jsx("span",{className:styles$6.settingsLabel,children:t("ui.resumeAutoChoice")}),jsxRuntimeExports.jsx(Switch,{checked:!!resumeAutoChoice,onChange:checked=>onResumeAutoChoiceToggle&&onResumeAutoChoiceToggle(checked)})]}),resumeAutoChoice&&jsxRuntimeExports.jsx("div",{className:styles$6.settingsItem,children:jsxRuntimeExports.jsxs(Radio.Group,{value:resumeAutoChoice,onChange:e=>onResumeAutoChoiceChange&&onResumeAutoChoiceChange(e.target.value),size:"small",children:[jsxRuntimeExports.jsx(Radio,{value:"continue",children:t("ui.resumeAutoChoice.continue")}),jsxRuntimeExports.jsx(Radio,{value:"new",children:t("ui.resumeAutoChoice.new")})]})}),jsxRuntimeExports.jsxs("div",{className:styles$6.settingsItem,children:[jsxRuntimeExports.jsx("span",{className:styles$6.settingsLabel,children:t("ui.permission.autoApprove.setting")}),jsxRuntimeExports.jsx(Select,{size:"small",value:autoApproveSeconds||0,onChange:value=>onAutoApproveChange&&onAutoApproveChange(value),options:[{label:t("ui.permission.autoApprove.off"),value:0},{label:"3s",value:3},{label:"5s",value:5},{label:"10s",value:10},{label:"15s",value:15},{label:"20s",value:20},{label:"30s",value:30},{label:"60s",value:60}],style:{width:100}})]})]}),jsxRuntimeExports.jsx("div",{className:styles$6.settingsGroupBox,children:jsxRuntimeExports.jsxs("div",{className:styles$6.settingsItem,children:[jsxRuntimeExports.jsx("span",{className:styles$6.settingsLabel,children:t("ui.themeColor")}),jsxRuntimeExports.jsx(Select,{size:"small",value:themeColor||"dark",onChange:value=>onThemeColorChange&&onThemeColorChange(value),options:[{label:t("ui.themeColor.dark"),value:"dark"},{label:t("ui.themeColor.light"),value:"light"}],style:{width:140}})]})}),jsxRuntimeExports.jsx("div",{className:styles$6.settingsGroupBox,children:jsxRuntimeExports.jsxs("div",{className:styles$6.settingsItem,children:[jsxRuntimeExports.jsx("span",{className:styles$6.settingsLabel,children:t("ui.languageSettings")}),jsxRuntimeExports.jsx(Select,{size:"small",value:getLang(),onChange:value=>{setLang(value),onLangChange&&onLangChange()},options:LANG_OPTIONS.map(o=>({label:o.label,value:o.value})),style:{width:140}})]})})]}),jsxRuntimeExports.jsxs(Drawer,{title:jsxRuntimeExports.jsxs("span",{children:[t("ui.globalSettings")," ",jsxRuntimeExports.jsx(ConceptHelp,{doc:"GlobalSettings"})]}),placement:"left",width:400,open:this.state.globalSettingsVisible,onClose:()=>this.setState({globalSettingsVisible:!1}),children:[jsxRuntimeExports.jsxs("div",{className:styles$6.settingsItem,children:[jsxRuntimeExports.jsx("span",{className:styles$6.settingsLabel,children:t("ui.filterIrrelevant")}),jsxRuntimeExports.jsx(Switch,{checked:!!filterIrrelevant,onChange:checked=>onFilterIrrelevantChange&&onFilterIrrelevantChange(checked)})]}),jsxRuntimeExports.jsxs("div",{className:styles$6.settingsItem,children:[jsxRuntimeExports.jsx("span",{className:styles$6.settingsLabel,children:t("ui.expandDiff")}),jsxRuntimeExports.jsx(Switch,{checked:!!expandDiff,onChange:checked=>onExpandDiffChange&&onExpandDiffChange(checked)})]}),jsxRuntimeExports.jsx("div",{className:styles$6.settingsDivider}),jsxRuntimeExports.jsx("div",{className:styles$6.settingsLabel,children:t("ui.logDirTitle")}),jsxRuntimeExports.jsx(Input,{className:styles$6.logDirInput,value:this.state.logDirDraft??logDir,onChange:e=>this.setState({logDirDraft:e.target.value}),onBlur:()=>{const val=this.state.logDirDraft;val!=null&&val!==logDir&&(onLogDirChange==null||onLogDirChange(val)),this.setState({logDirDraft:null})},onPressEnter:()=>{const val=this.state.logDirDraft;val!=null&&val!==logDir&&(onLogDirChange==null||onLogDirChange(val)),this.setState({logDirDraft:null})},placeholder:"~/.claude/cc-viewer"})]}),jsxRuntimeExports.jsx(Drawer,{title:jsxRuntimeExports.jsxs("span",{children:[jsxRuntimeExports.jsx(RefIcon$7,{className:styles$6.titleIcon}),t("ui.projectStats")]}),placement:"left",width:400,open:this.state.projectStatsVisible,onClose:()=>this.setState({projectStatsVisible:!1}),children:this.renderProjectStatsContent()}),jsxRuntimeExports.jsxs(Modal,{title:jsxRuntimeExports.jsxs("span",{children:[jsxRuntimeExports.jsx(RefIcon$8,{className:styles$6.titleIcon}),t("ui.pluginManagement")]}),open:this.state.pluginModalVisible,onCancel:()=>this.setState({pluginModalVisible:!1}),footer:jsxRuntimeExports.jsxs("div",{className:styles$6.pluginModalFooter,children:[jsxRuntimeExports.jsxs("div",{className:styles$6.pluginModalFooterLeft,children:[jsxRuntimeExports.jsx(Button,{icon:jsxRuntimeExports.jsx(RefIcon$e,{}),onClick:this.handleAddPlugin,children:t("ui.plugins.add")}),jsxRuntimeExports.jsx(Button,{icon:jsxRuntimeExports.jsx(RefIcon$6,{}),onClick:this.handleShowCdnModal,children:t("ui.plugins.cdnInstall")})]}),jsxRuntimeExports.jsx(Button,{icon:jsxRuntimeExports.jsx(RefIcon$f,{}),onClick:this.handleReloadPlugins,children:t("ui.plugins.reload")})]}),width:560,children:[this.state.pluginsDir&&jsxRuntimeExports.jsxs("div",{className:styles$6.pluginDirHint,children:[jsxRuntimeExports.jsxs("span",{className:styles$6.pluginDirLabel,children:[t("ui.plugins.pluginsDir"),":"]})," ",jsxRuntimeExports.jsx("code",{className:styles$6.pluginDirPath,onClick:()=>{navigator.clipboard.writeText(this.state.pluginsDir).then(()=>{staticMethods.success(t("ui.copied"))}).catch(()=>{})},children:this.state.pluginsDir})]}),this.state.pluginsList.length===0?jsxRuntimeExports.jsxs("div",{className:styles$6.pluginEmpty,children:[jsxRuntimeExports.jsx("div",{className:styles$6.pluginEmptyTitle,children:t("ui.plugins.empty")}),jsxRuntimeExports.jsx("div",{className:styles$6.pluginEmptyHint,children:t("ui.plugins.emptyHint")})]}):jsxRuntimeExports.jsx("div",{className:styles$6.pluginList,children:this.state.pluginsList.map(p=>jsxRuntimeExports.jsxs("div",{className:styles$6.pluginItem,children:[jsxRuntimeExports.jsxs("div",{className:styles$6.pluginInfo,children:[jsxRuntimeExports.jsx("span",{className:styles$6.pluginName,children:p.name}),jsxRuntimeExports.jsx("span",{className:styles$6.pluginFile,children:p.file}),p.hooks.length>0&&jsxRuntimeExports.jsx("span",{className:styles$6.pluginHooks,children:p.hooks.map(h=>jsxRuntimeExports.jsx("span",{className:styles$6.pluginHookTag,children:h},h))})]}),jsxRuntimeExports.jsxs("div",{className:styles$6.pluginActions,children:[jsxRuntimeExports.jsx(Switch,{size:"small",checked:p.enabled,onChange:checked=>this.handleTogglePlugin(p.name,checked)}),jsxRuntimeExports.jsx(Button,{type:"text",size:"small",danger:!0,icon:jsxRuntimeExports.jsx(RefIcon$d,{}),onClick:()=>this.handleDeletePlugin(p.file,p.name)})]})]},p.file))})]}),jsxRuntimeExports.jsx(Modal,{title:t("ui.plugins.delete"),open:this.state.deleteConfirmVisible,onCancel:()=>this.setState({deleteConfirmVisible:!1,deleteTarget:null}),onOk:this.handleDeletePluginConfirm,okType:"danger",okText:"OK",cancelText:"Cancel",children:jsxRuntimeExports.jsx("p",{children:this.state.deleteTarget?t("ui.plugins.deleteConfirm",{name:this.state.deleteTarget.name}):""})}),jsxRuntimeExports.jsx(Modal,{title:jsxRuntimeExports.jsxs("span",{children:[jsxRuntimeExports.jsx(RefIcon$6,{className:styles$6.titleIcon}),t("ui.plugins.cdnInstall")]}),open:this.state.cdnModalVisible,onCancel:this.handleCdnCancel,onOk:this.handleCdnInstall,confirmLoading:this.state.cdnLoading,okText:t("ui.plugins.cdnInstallBtn"),cancelText:t("ui.cancel"),width:480,children:jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("div",{className:styles$6.cdnUrlLabel,children:t("ui.plugins.cdnUrl")}),jsxRuntimeExports.jsx(Input,{placeholder:t("ui.plugins.cdnUrlPlaceholder"),value:this.state.cdnUrl,onChange:this.handleCdnUrlChange,onPressEnter:this.handleCdnInstall,className:styles$6.cdnInput})]})}),jsxRuntimeExports.jsx(Modal,{title:jsxRuntimeExports.jsxs("span",{children:[jsxRuntimeExports.jsx(RefIcon$4,{className:styles$6.titleIcon}),t("ui.processManagement")]}),open:this.state.processModalVisible,onCancel:()=>this.setState({processModalVisible:!1}),footer:jsxRuntimeExports.jsx(Button,{icon:jsxRuntimeExports.jsx(RefIcon$f,{}),onClick:this.fetchProcesses,loading:this.state.processLoading,children:t("ui.processManagement.refresh")}),width:780,children:jsxRuntimeExports.jsx(ForwardTable,{dataSource:this.state.processList,rowKey:"pid",loading:this.state.processLoading,size:"middle",pagination:!1,columns:[{title:t("ui.processManagement.port"),dataIndex:"port",width:80,render:text=>text?jsxRuntimeExports.jsx("a",{href:`${window.location.protocol}//127.0.0.1:${text}`,target:"_blank",rel:"noopener noreferrer",children:text}):""},{title:"PID",dataIndex:"pid",width:80},{title:t("ui.processManagement.command"),dataIndex:"command",ellipsis:!0},{title:t("ui.processManagement.startTime"),dataIndex:"startTime",width:200},{title:t("ui.processManagement.action"),width:100,render:(_,record)=>record.isCurrent?jsxRuntimeExports.jsx(Button,{size:"small",className:styles$6.currentProcessBtn,children:t("ui.processManagement.current")}):jsxRuntimeExports.jsx(Button,{size:"small",danger:!0,onClick:()=>this.handleKillProcess(record.pid),children:t("ui.processManagement.kill")})}]})}),jsxRuntimeExports.jsx(Modal,{title:jsxRuntimeExports.jsxs("span",{children:[jsxRuntimeExports.jsx(OpenFolderIcon,{apiEndpoint:apiUrl("/api/open-profile-dir"),title:t("ui.proxy.openConfigDir"),size:16})," ",t("ui.proxySwitch")," ",jsxRuntimeExports.jsx(ConceptHelp,{doc:"ProxySwitch",zIndex:1100})]}),open:this.state.proxyModalVisible,onCancel:()=>this.setState({proxyModalVisible:!1,editingProxy:null}),footer:null,width:520,children:this.renderProxyProfileList()})]})}renderProxyProfileList(){const profiles=this.props.proxyProfiles||[],activeId=this.props.activeProxyId||"max",{editingProxy,editForm}=this.state;return jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsxs("div",{className:styles$6.proxyWarning,children:["⚠️ ",t("ui.proxy.maxWarning")]}),jsxRuntimeExports.jsx("div",{className:styles$6.proxyList,children:profiles.map(p=>{var _a;return jsxRuntimeExports.jsxs("div",{className:`${styles$6.proxyItem} ${p.id===activeId?styles$6.proxyItemActive:""}`,children:[jsxRuntimeExports.jsxs("div",{className:styles$6.proxyItemMain,onClick:()=>{if(p.id!==activeId){const data={active:p.id,profiles};this.props.onProxyProfileChange(data)}},children:[jsxRuntimeExports.jsx(Radio,{checked:p.id===activeId,style:{marginRight:8}}),jsxRuntimeExports.jsxs("div",{className:styles$6.proxyItemInfo,children:[jsxRuntimeExports.jsxs("div",{className:styles$6.proxyItemNameRow,children:[jsxRuntimeExports.jsx("span",{className:styles$6.proxyItemName,children:p.name}),p.id==="max"&&jsxRuntimeExports.jsx(Tag,{className:styles$6.proxyBuiltinTag,children:t("ui.proxy.builtin")})]}),p.id==="max"&&this.props.defaultConfig&&jsxRuntimeExports.jsxs("div",{className:styles$6.proxyItemDetail,children:[(()=>{try{return new URL(this.props.defaultConfig.origin).host}catch{return this.props.defaultConfig.origin}})(),this.props.defaultConfig.authType?` · ${this.props.defaultConfig.authType}`:"",this.props.defaultConfig.apiKey?` · ${this.props.defaultConfig.apiKey}`:"",this.props.defaultConfig.model?` · ${this.props.defaultConfig.model}`:""]}),p.id!=="max"&&p.baseURL&&jsxRuntimeExports.jsxs("div",{className:styles$6.proxyItemDetail,children:[(()=>{try{return new URL(p.baseURL).host}catch{return p.baseURL}})(),p.activeModel?` · ${p.activeModel}`:(_a=p.models)!=null&&_a.length?` · ${p.models[0]}`:""]})]})]}),p.id!=="max"&&jsxRuntimeExports.jsxs("div",{className:styles$6.proxyItemActions,children:[jsxRuntimeExports.jsx(Button,{type:"text",size:"small",icon:jsxRuntimeExports.jsx(RefIcon$g,{}),onClick:()=>this.setState({editingProxy:p.id,editForm:{name:p.name||"",baseURL:p.baseURL||"",apiKey:p.apiKey||"",models:(p.models||[]).join(", "),activeModel:p.activeModel||""}})}),jsxRuntimeExports.jsx(Button,{type:"text",size:"small",danger:!0,icon:jsxRuntimeExports.jsx(RefIcon$d,{}),onClick:()=>{Modal.confirm({title:t("ui.proxy.deleteProxy"),content:t("ui.proxy.deleteConfirm",{name:p.name}),okType:"danger",onOk:()=>{const newProfiles=profiles.filter(x=>x.id!==p.id),newActive=activeId===p.id?"max":activeId;this.props.onProxyProfileChange({active:newActive,profiles:newProfiles})}})}})]})]},p.id)})}),editingProxy&&jsxRuntimeExports.jsxs("div",{className:styles$6.proxyEditForm,children:[jsxRuntimeExports.jsxs("div",{className:styles$6.proxyEditRow,children:[jsxRuntimeExports.jsxs("label",{children:[t("ui.proxy.name")," ",jsxRuntimeExports.jsx("span",{className:styles$6.proxyRequired,children:"*"})]}),jsxRuntimeExports.jsx(Input,{size:"small",value:editForm.name,onChange:e=>{const v=e.target.value;this.setState(prev=>({editForm:{...prev.editForm,name:v}}))}})]}),jsxRuntimeExports.jsxs("div",{className:styles$6.proxyEditRow,children:[jsxRuntimeExports.jsxs("label",{children:[t("ui.proxy.baseURL")," ",jsxRuntimeExports.jsx("span",{className:styles$6.proxyRequired,children:"*"})]}),jsxRuntimeExports.jsx(Input,{size:"small",value:editForm.baseURL,onChange:e=>{const v=e.target.value;this.setState(prev=>({editForm:{...prev.editForm,baseURL:v}}))},placeholder:"https://api.example.com"})]}),jsxRuntimeExports.jsxs("div",{className:styles$6.proxyEditRow,children:[jsxRuntimeExports.jsxs("label",{children:[t("ui.proxy.apiKey")," ",jsxRuntimeExports.jsx("span",{className:styles$6.proxyRequired,children:"*"})]}),jsxRuntimeExports.jsx(Input.Password,{size:"small",value:editForm.apiKey,onChange:e=>{const v=e.target.value;this.setState(prev=>({editForm:{...prev.editForm,apiKey:v}}))},placeholder:"sk-..."})]}),jsxRuntimeExports.jsx("div",{className:styles$6.proxyEditDivider}),jsxRuntimeExports.jsxs("div",{className:styles$6.proxyEditRow,children:[jsxRuntimeExports.jsx("label",{children:t("ui.proxy.models")}),jsxRuntimeExports.jsx(Input,{size:"small",value:editForm.models,onChange:e=>{const v=e.target.value;this.setState(prev=>({editForm:{...prev.editForm,models:v}}))},placeholder:"model-1, model-2"})]}),jsxRuntimeExports.jsxs("div",{className:styles$6.proxyEditRow,children:[jsxRuntimeExports.jsx("label",{children:t("ui.proxy.activeModel")}),jsxRuntimeExports.jsx(Select,{size:"small",className:styles$6.fullWidthSelect,value:editForm.activeModel||void 0,onChange:v=>this.setState(prev=>({editForm:{...prev.editForm,activeModel:v}})),placeholder:t("ui.proxy.activeModel"),children:(editForm.models||"").split(",").map(m=>m.trim()).filter(Boolean).map(m=>jsxRuntimeExports.jsx(Select.Option,{value:m,children:m},m))})]}),jsxRuntimeExports.jsxs("div",{className:styles$6.proxyEditBtns,children:[jsxRuntimeExports.jsx(Button,{size:"small",icon:jsxRuntimeExports.jsx(RefIcon$h,{}),type:"primary",onClick:()=>{var _a,_b,_c;if(!((_a=editForm.name)!=null&&_a.trim())||!((_b=editForm.baseURL)!=null&&_b.trim())||!((_c=editForm.apiKey)!=null&&_c.trim())){staticMethods.warning(t("ui.proxy.requiredFields"));return}const models=(editForm.models||"").split(",").map(m=>m.trim()).filter(Boolean),updated={id:editingProxy==="__new__"?`proxy_${Date.now()}`:editingProxy,name:editForm.name.trim(),baseURL:editForm.baseURL.trim(),apiKey:editForm.apiKey.trim(),models,activeModel:editForm.activeModel||models[0]||""};let newProfiles;editingProxy==="__new__"?newProfiles=[...profiles,updated]:newProfiles=profiles.map(p=>p.id===editingProxy?{...p,...updated,id:p.id}:p),this.props.onProxyProfileChange({active:activeId,profiles:newProfiles}),this.setState({editingProxy:null})},children:t("ui.proxy.save")}),jsxRuntimeExports.jsx(Button,{size:"small",icon:jsxRuntimeExports.jsx(RefIcon$i,{}),onClick:()=>this.setState({editingProxy:null}),children:t("ui.proxy.cancel")})]})]}),!editingProxy&&jsxRuntimeExports.jsx(Button,{block:!0,type:"dashed",icon:jsxRuntimeExports.jsx(RefIcon$e,{}),style:{marginTop:12},onClick:()=>this.setState({editingProxy:"__new__",editForm:{name:"",baseURL:"",apiKey:"",models:"",activeModel:""}}),children:t("ui.proxy.addProxy")})]})}};__publicField(_AppHeader,"COMMAND_TAGS",new Set(["command-name","command-message","command-args","local-command-caveat","local-command-stdout"]));let AppHeader=_AppHeader;const centerEmpty="_centerEmpty_midza_1",scrollContainer="_scrollContainer_midza_8",listItem="_listItem_midza_15",listItemActive="_listItemActive_midza_29",itemContent$1="_itemContent_midza_46",itemHeader="_itemHeader_midza_51",tagNoMargin="_tagNoMargin_midza_59",modelName="_modelName_midza_64",modelNameMain="_modelNameMain_midza_69",time="_time_midza_73",detailRow="_detailRow_midza_79",urlText$1="_urlText_midza_86",duration="_duration_midza_95",statusOk="_statusOk_midza_100",statusErr="_statusErr_midza_106",statusDefault="_statusDefault_midza_111",usageBox="_usageBox_midza_116",cacheDot="_cacheDot_midza_126",cacheDotLoss="_cacheDotLoss_midza_135",cacheDotNormal="_cacheDotNormal_midza_140",tagMainAgent="_tagMainAgent_midza_144",tagPlan="_tagPlan_midza_150",tagMuted="_tagMuted_midza_156",tooltipPreLine="_tooltipPreLine_midza_162",styles$5={centerEmpty,scrollContainer,listItem,listItemActive,itemContent:itemContent$1,itemHeader,tagNoMargin,modelName,modelNameMain,time,detailRow,urlText:urlText$1,duration,statusOk,statusErr,statusDefault,usageBox,cacheDot,cacheDotLoss,cacheDotNormal,tagMainAgent,tagPlan,tagMuted,tooltipPreLine};class RequestList extends React.Component{constructor(props){super(props);__publicField(this,"handleKeyDown",e=>{if(e.key!=="ArrowUp"&&e.key!=="ArrowDown")return;const{requests,selectedIndex,onSelect}=this.props;if(!requests.length)return;e.preventDefault();const current=selectedIndex??0,next=e.key==="ArrowUp"?Math.max(0,current-1):Math.min(requests.length-1,current+1);next!==current&&onSelect(next)});this.activeItemRef=React.createRef()}componentDidMount(){this.scrollToSelected(!0)}shouldComponentUpdate(nextProps){return nextProps.requests!==this.props.requests||nextProps.selectedIndex!==this.props.selectedIndex||nextProps.scrollCenter!==this.props.scrollCenter||nextProps.cacheLossMap!==this.props.cacheLossMap}componentDidUpdate(prevProps){this.props.scrollCenter&&prevProps.selectedIndex!==this.props.selectedIndex?this.scrollToSelected(!0):prevProps.selectedIndex!==this.props.selectedIndex&&(this.scrollToSelected(!1),this.activeItemRef.current&&this.activeItemRef.current.focus({preventScroll:!0}))}scrollToSelected(center){this.activeItemRef.current&&(this.activeItemRef.current.scrollIntoView({block:center?"center":"nearest",behavior:"instant"}),center&&this.props.onScrollDone&&this.props.onScrollDone())}render(){const{requests,selectedIndex,onSelect}=this.props;return requests.length===0?jsxRuntimeExports.jsx("div",{className:styles$5.centerEmpty,children:jsxRuntimeExports.jsx(Empty,{description:t("ui.waitingRequests")})}):jsxRuntimeExports.jsx("div",{className:styles$5.scrollContainer,onKeyDown:this.handleKeyDown,children:jsxRuntimeExports.jsx(List,{dataSource:requests,size:"small",split:!1,renderItem:(req,index)=>{var _a,_b,_c;const time2=new Date(req.timestamp).toLocaleTimeString("zh-CN"),isActive=index===selectedIndex,statusOk2=req.response&&req.response.status<400,statusErr2=req.response&&req.response.status>=400,model=getModelShort((_a=req.body)==null?void 0:_a.model),nextReq=index+1<requests.length?requests[index+1]:null,{type:reqType,subType}=classifyRequest(req,nextReq),usage=(_c=(_b=req.response)==null?void 0:_b.body)==null?void 0:_c.usage,inputTokens=usage?(usage.input_tokens||0)+(usage.cache_read_input_tokens||0)+(usage.cache_creation_input_tokens||0):null,outputTokens=(usage==null?void 0:usage.output_tokens)||null,cacheRead=(usage==null?void 0:usage.cache_read_input_tokens)||0,cacheCreate=(usage==null?void 0:usage.cache_creation_input_tokens)||0;let urlShort=req.url;try{const u=new URL(req.url);urlShort=u.host+u.pathname}catch{}return jsxRuntimeExports.jsx(List.Item,{ref:isActive?this.activeItemRef:void 0,tabIndex:0,onClick:()=>onSelect(index),className:`${styles$5.listItem} ${isActive?styles$5.listItemActive:""}`,children:jsxRuntimeExports.jsxs("div",{className:styles$5.itemContent,children:[jsxRuntimeExports.jsxs("div",{className:styles$5.itemHeader,children:[reqType==="MainAgent"?jsxRuntimeExports.jsx(Tag,{className:`${styles$5.tagNoMargin} ${styles$5.tagMainAgent}`,children:"MainAgent"}):reqType==="Plan"?jsxRuntimeExports.jsx(Tag,{className:`${styles$5.tagNoMargin} ${styles$5.tagPlan}`,children:formatRequestTag(reqType,subType)}):reqType==="Count"||reqType==="Preflight"?jsxRuntimeExports.jsx(Tag,{className:`${styles$5.tagNoMargin} ${styles$5.tagMuted}`,children:reqType}):jsxRuntimeExports.jsx(Tag,{className:styles$5.tagNoMargin,children:formatRequestTag(reqType,subType)}),model&&jsxRuntimeExports.jsx("span",{className:`${styles$5.modelName} ${reqType==="MainAgent"?styles$5.modelNameMain:""}`,children:model}),jsxRuntimeExports.jsx("span",{className:styles$5.time,children:time2})]}),jsxRuntimeExports.jsxs("div",{className:styles$5.detailRow,children:[jsxRuntimeExports.jsx("span",{className:styles$5.urlText,title:req.url,children:urlShort}),req.duration&&jsxRuntimeExports.jsxs("span",{className:styles$5.duration,children:[req.duration,"ms"]}),req.response&&jsxRuntimeExports.jsx("span",{className:statusOk2?styles$5.statusOk:statusErr2?styles$5.statusErr:styles$5.statusDefault,children:req.response.status})]}),usage&&jsxRuntimeExports.jsxs("div",{className:styles$5.usageBox,children:[jsxRuntimeExports.jsxs("div",{children:["token: output:",formatTokenCount(outputTokens)||0,", input: ",formatTokenCount(inputTokens)||0]}),(cacheRead>0||cacheCreate>0)&&jsxRuntimeExports.jsx("div",{children:(()=>{var _a2;const loss=(_a2=this.props.cacheLossMap)==null?void 0:_a2.get(index),reasonI18nMap={ttl:"ui.cacheLoss.ttl",system_change:"ui.cacheLoss.systemChange",tools_change:"ui.cacheLoss.toolsChange",model_change:"ui.cacheLoss.modelChange",msg_truncated:"ui.cacheLoss.msgTruncated",msg_modified:"ui.cacheLoss.msgModified",key_change:"ui.cacheLoss.keyChange"};let dot;if(loss){const tooltipText=(loss.reasons||[loss.reason]).map(r=>t(reasonI18nMap[r]||reasonI18nMap.key_change)).join(`
19
+ `);dot=jsxRuntimeExports.jsx(Tooltip,{title:jsxRuntimeExports.jsx("span",{className:styles$5.tooltipPreLine,children:tooltipText}),children:jsxRuntimeExports.jsx("span",{className:`${styles$5.cacheDot} ${styles$5.cacheDotLoss}`})})}else dot=jsxRuntimeExports.jsx("span",{className:`${styles$5.cacheDot} ${styles$5.cacheDotNormal}`});return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:["cache",dot,": ",cacheRead>0?`read:${formatTokenCount(cacheRead)}`:"",cacheRead>0&&cacheCreate>0?", ":"",cacheCreate>0?`create:${formatTokenCount(cacheCreate)}`:""]})})()})]})]})})}})})}}const isBoolean=data=>typeof data=="boolean"||data instanceof Boolean,isNumber=data=>typeof data=="number"||data instanceof Number,isBigInt=data=>typeof data=="bigint"||data instanceof BigInt,isDate=data=>!!data&&data instanceof Date,isString=data=>typeof data=="string"||data instanceof String,isArray=data=>Array.isArray(data),isObject=data=>typeof data=="object"&&data!==null,isFunction=data=>!!data&&data instanceof Object&&typeof data=="function";function quoteString(value,quoted){return quoted===void 0&&(quoted=!1),!value||quoted?`"${value}"`:value}function quoteStringValue(value,quoted,stringify){return stringify?JSON.stringify(value):quoted?`"${value}"`:value}function ExpandableObject(_ref){let{field,value,data,lastElement,openBracket,closeBracket,level,style,shouldExpandNode,clickToExpandNode,outerRef,beforeExpandChange}=_ref;const shouldExpandNodeCalledRef=reactExports.useRef(!1),[expanded,setExpanded]=reactExports.useState(()=>shouldExpandNode(level,value,field)),expanderButtonRef=reactExports.useRef(null);reactExports.useEffect(()=>{shouldExpandNodeCalledRef.current?setExpanded(shouldExpandNode(level,value,field)):shouldExpandNodeCalledRef.current=!0},[shouldExpandNode]);const contentsId=reactExports.useId();if(data.length===0)return EmptyObject({field,openBracket,closeBracket,lastElement,style});const expanderIconStyle=expanded?style.collapseIcon:style.expandIcon,ariaLabel=expanded?style.ariaLables.collapseJson:style.ariaLables.expandJson,childLevel=level+1,lastIndex=data.length-1,setExpandWithCallback=newExpandValue=>{expanded!==newExpandValue&&(!beforeExpandChange||beforeExpandChange({level,value,field,newExpandValue}))&&setExpanded(newExpandValue)},onKeyDown=e=>{if(e.key==="ArrowRight"||e.key==="ArrowLeft")e.preventDefault(),setExpandWithCallback(e.key==="ArrowRight");else if(e.key==="ArrowUp"||e.key==="ArrowDown"){e.preventDefault();const direction=e.key==="ArrowUp"?-1:1;if(!outerRef.current)return;const buttonElements=outerRef.current.querySelectorAll("[role=button]");let currentIndex=-1;for(let i=0;i<buttonElements.length;i++)if(buttonElements[i].tabIndex===0){currentIndex=i;break}if(currentIndex<0)return;const nextIndex=(currentIndex+direction+buttonElements.length)%buttonElements.length;buttonElements[currentIndex].tabIndex=-1,buttonElements[nextIndex].tabIndex=0,buttonElements[nextIndex].focus()}},onClick=()=>{var _outerRef$current;setExpandWithCallback(!expanded);const buttonElement=expanderButtonRef.current;if(!buttonElement)return;const prevButtonElement=(_outerRef$current=outerRef.current)===null||_outerRef$current===void 0?void 0:_outerRef$current.querySelector('[role=button][tabindex="0"]');prevButtonElement&&(prevButtonElement.tabIndex=-1),buttonElement.tabIndex=0,buttonElement.focus()};return reactExports.createElement("div",{className:style.basicChildStyle,role:"treeitem","aria-expanded":expanded,"aria-selected":void 0},reactExports.createElement("span",{className:expanderIconStyle,onClick,onKeyDown,role:"button","aria-label":ariaLabel,"aria-expanded":expanded,"aria-controls":expanded?contentsId:void 0,ref:expanderButtonRef,tabIndex:level===0?0:-1}),(field||field==="")&&(clickToExpandNode?reactExports.createElement("span",{className:style.clickableLabel,onClick,onKeyDown},quoteString(field,style.quotesForFieldNames),":"):reactExports.createElement("span",{className:style.label},quoteString(field,style.quotesForFieldNames),":")),reactExports.createElement("span",{className:style.punctuation},openBracket),expanded?reactExports.createElement("ul",{id:contentsId,role:"group",className:style.childFieldsContainer},data.map((dataElement,index)=>reactExports.createElement(DataRender,{key:dataElement[0]||index,field:dataElement[0],value:dataElement[1],style,lastElement:index===lastIndex,level:childLevel,shouldExpandNode,clickToExpandNode,beforeExpandChange,outerRef}))):reactExports.createElement("span",{className:style.collapsedContent,onClick,onKeyDown}),reactExports.createElement("span",{className:style.punctuation},closeBracket),!lastElement&&reactExports.createElement("span",{className:style.punctuation},","))}function EmptyObject(_ref2){let{field,openBracket,closeBracket,lastElement,style}=_ref2;return reactExports.createElement("div",{className:style.basicChildStyle,role:"treeitem","aria-selected":void 0},(field||field==="")&&reactExports.createElement("span",{className:style.label},quoteString(field,style.quotesForFieldNames),":"),reactExports.createElement("span",{className:style.punctuation},openBracket),reactExports.createElement("span",{className:style.punctuation},closeBracket),!lastElement&&reactExports.createElement("span",{className:style.punctuation},","))}function JsonObject(_ref3){let{field,value,style,lastElement,shouldExpandNode,clickToExpandNode,level,outerRef,beforeExpandChange}=_ref3;return ExpandableObject({field,value,lastElement:lastElement||!1,level,openBracket:"{",closeBracket:"}",style,shouldExpandNode,clickToExpandNode,data:Object.keys(value).map(key=>[key,value[key]]),outerRef,beforeExpandChange})}function JsonArray(_ref4){let{field,value,style,lastElement,level,shouldExpandNode,clickToExpandNode,outerRef,beforeExpandChange}=_ref4;return ExpandableObject({field,value,lastElement:lastElement||!1,level,openBracket:"[",closeBracket:"]",style,shouldExpandNode,clickToExpandNode,data:value.map(element=>[void 0,element]),outerRef,beforeExpandChange})}function JsonPrimitiveValue(_ref5){let{field,value,style,lastElement}=_ref5,stringValue,valueStyle=style.otherValue;return value===null?(stringValue="null",valueStyle=style.nullValue):value===void 0?(stringValue="undefined",valueStyle=style.undefinedValue):isString(value)?(stringValue=quoteStringValue(value,!style.noQuotesForStringValues,style.stringifyStringValues),valueStyle=style.stringValue):isBoolean(value)?(stringValue=value?"true":"false",valueStyle=style.booleanValue):isNumber(value)?(stringValue=value.toString(),valueStyle=style.numberValue):isBigInt(value)?(stringValue=`${value.toString()}n`,valueStyle=style.numberValue):isDate(value)?stringValue=value.toISOString():isFunction(value)?stringValue="function() { }":stringValue=value.toString(),reactExports.createElement("div",{className:style.basicChildStyle,role:"treeitem","aria-selected":void 0},(field||field==="")&&reactExports.createElement("span",{className:style.label},quoteString(field,style.quotesForFieldNames),":"),reactExports.createElement("span",{className:valueStyle},stringValue),!lastElement&&reactExports.createElement("span",{className:style.punctuation},","))}function DataRender(props){const value=props.value;return isArray(value)?reactExports.createElement(JsonArray,Object.assign({},props)):isObject(value)&&!isDate(value)&&!isFunction(value)?reactExports.createElement(JsonObject,Object.assign({},props)):reactExports.createElement(JsonPrimitiveValue,Object.assign({},props))}var styles$4={"container-light":"_2IvMF _GzYRV","basic-element-style":"_2bkNM","child-fields-container":"_1BXBN","label-light":"_1MGIk","clickable-label-light":"_2YKJg _1MGIk _1MFti","punctuation-light":"_3uHL6 _3eOF8","value-null-light":"_2T6PJ","value-undefined-light":"_1Gho6","value-string-light":"_vGjyY","value-number-light":"_1bQdo","value-boolean-light":"_3zQKs","value-other-light":"_1xvuR","collapse-icon-light":"_oLqym _f10Tu _1MFti _1LId0","expand-icon-light":"_2AXVT _f10Tu _1MFti _1UmXx","collapsed-content-light":"_2KJWg _1pNG9 _1MFti","container-dark":"_11RoI _GzYRV","expand-icon-dark":"_17H2C _f10Tu _1MFti _1UmXx","collapse-icon-dark":"_3QHg2 _f10Tu _1MFti _1LId0","collapsed-content-dark":"_3fDAz _1pNG9 _1MFti","label-dark":"_2bSDX","clickable-label-dark":"_1RQEj _2bSDX _1MFti","punctuation-dark":"_gsbQL _3eOF8","value-null-dark":"_LaAZe","value-undefined-dark":"_GTKgm","value-string-dark":"_Chy1W","value-number-dark":"_2bveF","value-boolean-dark":"_2vRm-","value-other-dark":"_1prJR"};const defaultAriaLables={collapseJson:"collapse JSON",expandJson:"expand JSON"},defaultStyles={container:styles$4["container-light"],basicChildStyle:styles$4["basic-element-style"],childFieldsContainer:styles$4["child-fields-container"],label:styles$4["label-light"],clickableLabel:styles$4["clickable-label-light"],nullValue:styles$4["value-null-light"],undefinedValue:styles$4["value-undefined-light"],stringValue:styles$4["value-string-light"],booleanValue:styles$4["value-boolean-light"],numberValue:styles$4["value-number-light"],otherValue:styles$4["value-other-light"],punctuation:styles$4["punctuation-light"],collapseIcon:styles$4["collapse-icon-light"],expandIcon:styles$4["expand-icon-light"],collapsedContent:styles$4["collapsed-content-light"],noQuotesForStringValues:!1,quotesForFieldNames:!1,ariaLables:defaultAriaLables,stringifyStringValues:!1},darkStyles={container:styles$4["container-dark"],basicChildStyle:styles$4["basic-element-style"],childFieldsContainer:styles$4["child-fields-container"],label:styles$4["label-dark"],clickableLabel:styles$4["clickable-label-dark"],nullValue:styles$4["value-null-dark"],undefinedValue:styles$4["value-undefined-dark"],stringValue:styles$4["value-string-dark"],booleanValue:styles$4["value-boolean-dark"],numberValue:styles$4["value-number-dark"],otherValue:styles$4["value-other-dark"],punctuation:styles$4["punctuation-dark"],collapseIcon:styles$4["collapse-icon-dark"],expandIcon:styles$4["expand-icon-dark"],collapsedContent:styles$4["collapsed-content-dark"],noQuotesForStringValues:!1,quotesForFieldNames:!1,ariaLables:defaultAriaLables,stringifyStringValues:!1},allExpanded=()=>!0,JsonView=_ref=>{let{data,style=defaultStyles,shouldExpandNode=allExpanded,clickToExpandNode=!1,beforeExpandChange,compactTopLevel,...ariaAttrs}=_ref;const outerRef=reactExports.useRef(null);return reactExports.createElement("div",Object.assign({"aria-label":"JSON view"},ariaAttrs,{className:style.container,ref:outerRef,role:"tree"}),compactTopLevel&&isObject(data)?Object.entries(data).map(_ref2=>{let[key,value]=_ref2;return reactExports.createElement(DataRender,{key,field:key,value,style:{...defaultStyles,...style},lastElement:!0,level:1,shouldExpandNode,clickToExpandNode,beforeExpandChange,outerRef})}):reactExports.createElement(DataRender,{value:data,style:{...defaultStyles,...style},lastElement:!0,level:0,shouldExpandNode,clickToExpandNode,outerRef,beforeExpandChange}))},container$1="_container_qeuid_1",styles$3={container:container$1};class JsonViewer extends React.Component{shouldComponentUpdate(nextProps){return nextProps.data!==this.props.data||nextProps.defaultExpand!==this.props.defaultExpand||nextProps.expandNode!==this.props.expandNode}render(){const{data,defaultExpand,expandNode}=this.props,customStyles={...typeof document<"u"&&document.documentElement.getAttribute("data-theme")!=="light"?darkStyles:defaultStyles,container:"rjv-container"};if(data==null)return null;const shouldExpandNode=typeof expandNode=="function"?expandNode:defaultExpand==="all"?()=>!0:defaultExpand==="root"?level=>level<2:level=>level<1;return jsxRuntimeExports.jsx("div",{className:styles$3.container,children:jsxRuntimeExports.jsx(JsonView,{data,shouldExpandNode,style:customStyles})})}}function getContextSidebarArrowNavigation({currentId,visibleIds=[],key}){if(key!=="ArrowUp"&&key!=="ArrowDown")return null;const currentIndex=visibleIds.findIndex(id=>id===currentId),delta=key==="ArrowUp"?-1:1;return currentIndex>=0?visibleIds[currentIndex+delta]??null:null}const root="_root_17dqd_1",sidebar="_sidebar_17dqd_9",section="_section_17dqd_18",sectionHeader="_sectionHeader_17dqd_22",arrow="_arrow_17dqd_48",sectionTitle="_sectionTitle_17dqd_54",sectionCount="_sectionCount_17dqd_62",sectionBody="_sectionBody_17dqd_71",historyToggle="_historyToggle_17dqd_76",historyToggleLabel="_historyToggleLabel_17dqd_102",item="_item_17dqd_107",itemActive="_itemActive_17dqd_135",itemContent="_itemContent_17dqd_142",itemLabel="_itemLabel_17dqd_148",itemSublabel="_itemSublabel_17dqd_156",itemTime="_itemTime_17dqd_165",content="_content_17dqd_174",contentEmpty="_contentEmpty_17dqd_182",contentInner="_contentInner_17dqd_189",emptyWrap="_emptyWrap_17dqd_193",roleHeader="_roleHeader_17dqd_201",roleBadge="_roleBadge_17dqd_209",role_user="_role_user_17dqd_218",role_assistant="_role_assistant_17dqd_224",roleLabel="_roleLabel_17dqd_230",contentTime="_contentTime_17dqd_237",turnDivider="_turnDivider_17dqd_245",textBlock="_textBlock_17dqd_252",textBlockBar="_textBlockBar_17dqd_259",textBlockBody="_textBlockBody_17dqd_268",textBlockCompact="_textBlockCompact_17dqd_276",textBlockCompactFloat="_textBlockCompactFloat_17dqd_283",thinkingBlock="_thinkingBlock_17dqd_290",thinkingHeader="_thinkingHeader_17dqd_298",thinkingPreview="_thinkingPreview_17dqd_313",thinkingBody="_thinkingBody_17dqd_323",toolBlock="_toolBlock_17dqd_329",toolBlockResult="_toolBlockResult_17dqd_336",toolBlockError="_toolBlockError_17dqd_340",toolBlockHeader="_toolBlockHeader_17dqd_344",toolBlockBody="_toolBlockBody_17dqd_355",toolName="_toolName_17dqd_360",toolId="_toolId_17dqd_366",errorLabel="_errorLabel_17dqd_373",blockTag="_blockTag_17dqd_383",blockTagText="_blockTagText_17dqd_396",blockTagThinking="_blockTagThinking_17dqd_402",blockTagResult="_blockTagResult_17dqd_408",blockTagError="_blockTagError_17dqd_414",jsonBlock="_jsonBlock_17dqd_421",jsonBlockLabel="_jsonBlockLabel_17dqd_428",blockSeparator="_blockSeparator_17dqd_438",markdownBody="_markdownBody_17dqd_445",styles$2={root,sidebar,section,sectionHeader,arrow,sectionTitle,sectionCount,sectionBody,historyToggle,historyToggleLabel,item,itemActive,itemContent,itemLabel,itemSublabel,itemTime,content,contentEmpty,contentInner,emptyWrap,roleHeader,roleBadge,role_user,role_assistant,roleLabel,contentTime,turnDivider,textBlock,textBlockBar,textBlockBody,textBlockCompact,textBlockCompactFloat,thinkingBlock,thinkingHeader,thinkingPreview,thinkingBody,toolBlock,toolBlockResult,toolBlockError,toolBlockHeader,toolBlockBody,toolName,toolId,errorLabel,blockTag,blockTagText,blockTagThinking,blockTagResult,blockTagError,jsonBlock,jsonBlockLabel,blockSeparator,markdownBody},{Text:Text$1}=Typography;function parseContentBlocks(content2){if(content2==null)return[];if(typeof content2=="string"){const trimmed=content2.trim();return trimmed?[{type:"markdown",text:trimmed}]:[]}if(Array.isArray(content2)){const blocks=[];for(const block of content2)if(block)if(block.type==="text"){const trimmed=(block.text||"").trim();trimmed&&blocks.push({type:"markdown",text:trimmed})}else if(block.type==="tool_use")blocks.push({type:"tool_use",name:block.name||"unknown",id:block.id||"",input:block.input??{}});else if(block.type==="tool_result"){const inner=parseResultContent(block.content);blocks.push({type:"tool_result",tool_use_id:block.tool_use_id||"",is_error:block.is_error,content:inner})}else if(block.type==="thinking"){const text=block.thinking||"";text.trim()&&blocks.push({type:"thinking",text})}else block.type==="image"?blocks.push({type:"json",label:"image",data:block}):blocks.push({type:"json",label:block.type||"block",data:block});return blocks}return[{type:"json",label:"content",data:content2}]}function parseResultContent(content2){if(content2==null)return[];if(typeof content2=="string"){const trimmed=content2.trim();return trimmed?[{type:"markdown",text:trimmed}]:[]}return Array.isArray(content2)?content2.flatMap(c=>{if(!c)return[];if(c.type==="text"){const trimmed=(c.text||"").trim();return trimmed?[{type:"markdown",text:trimmed}]:[]}return[{type:"json",label:c.type||"block",data:c}]}):[{type:"json",label:"content",data:content2}]}function parseSystemBlocks(system){if(!system)return null;if(typeof system=="string")return[{type:"markdown",text:system}];if(Array.isArray(system)){const blocks=[];return system.forEach((item2,i)=>{i>0&&blocks.push({type:"separator"}),item2&&(typeof item2=="string"?blocks.push({type:"markdown",text:item2}):item2.type==="text"?blocks.push({type:"markdown",text:item2.text||""}):blocks.push({type:"json",label:item2.type||"item",data:item2}))}),blocks}return[{type:"json",label:"system",data:system}]}function parseToolBlocks(tool){const blocks=[],name=(tool==null?void 0:tool.name)||"unknown",desc=(tool==null?void 0:tool.description)||"";let md=`### ${name}
20
+
21
+ `;desc&&(md+=`${desc}
22
+
23
+ `),blocks.push({type:"markdown",text:md});const schema=(tool==null?void 0:tool.input_schema)||(tool==null?void 0:tool.parameters)||null;return schema&&blocks.push({type:"json",label:"Parameters",data:schema}),blocks}function extractPreviewText(content2){var _a;if(typeof content2=="string")return content2.slice(0,60).replace(/\n/g," ");if(Array.isArray(content2)){for(const block of content2)if((block==null?void 0:block.type)==="text"&&((_a=block.text)!=null&&_a.trim()))return block.text.trim().slice(0,60).replace(/\n/g," ")}return""}function groupMessagesIntoTurns(messages){var _a;const turns=[];let i=0;for(;i<messages.length;){const userMsg=messages[i];if((userMsg==null?void 0:userMsg.role)!=="user"){i++;continue}const assistantMsg=((_a=messages[i+1])==null?void 0:_a.role)==="assistant"?messages[i+1]:null;turns.push({id:`turn__${i}`,isTurn:!0,turnIndex:turns.length,timestamp:userMsg._timestamp||null,assistantTimestamp:(assistantMsg==null?void 0:assistantMsg._timestamp)||null,userBlocks:parseContentBlocks(userMsg==null?void 0:userMsg.content),assistantBlocks:assistantMsg?parseContentBlocks(assistantMsg.content):null,preview:extractPreviewText(userMsg==null?void 0:userMsg.content)}),i+=assistantMsg?2:1}return turns}function formatTurnTime(isoStr){try{return new Date(isoStr).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}catch{return null}}function TranslatableMarkdown({text,compact}){const displayHtml=renderMarkdown(text);return compact?jsxRuntimeExports.jsx("div",{className:styles$2.textBlockCompact,children:jsxRuntimeExports.jsx("div",{className:`chat-md ${styles$2.markdownBody}`,dangerouslySetInnerHTML:{__html:displayHtml}})}):jsxRuntimeExports.jsxs("div",{className:styles$2.textBlock,children:[jsxRuntimeExports.jsx("div",{className:styles$2.textBlockBar,children:jsxRuntimeExports.jsx("span",{className:`${styles$2.blockTag} ${styles$2.blockTagText}`,children:"text"})}),jsxRuntimeExports.jsx("div",{className:`chat-md ${styles$2.textBlockBody}`,dangerouslySetInnerHTML:{__html:displayHtml}})]})}function ThinkingBlock({block}){const[expanded,setExpanded]=reactExports.useState(!0),preview=block.text.length>60?block.text.slice(0,60).replace(/\n/g," ")+"…":block.text.replace(/\n/g," ");return jsxRuntimeExports.jsxs("div",{className:styles$2.thinkingBlock,children:[jsxRuntimeExports.jsxs("div",{className:styles$2.thinkingHeader,onClick:()=>setExpanded(v=>!v),children:[expanded?jsxRuntimeExports.jsx(RefIcon$j,{className:styles$2.arrow}):jsxRuntimeExports.jsx(RefIcon$k,{className:styles$2.arrow}),jsxRuntimeExports.jsx("span",{className:`${styles$2.blockTag} ${styles$2.blockTagThinking}`,children:"thinking"}),!expanded&&jsxRuntimeExports.jsx("span",{className:styles$2.thinkingPreview,children:preview})]}),expanded&&jsxRuntimeExports.jsx("div",{className:styles$2.thinkingBody,children:jsxRuntimeExports.jsx("div",{className:`chat-md ${styles$2.markdownBody}`,dangerouslySetInnerHTML:{__html:renderMarkdown(block.text)}})})]})}function RenderBlocks({blocks,compact}){return!blocks||blocks.length===0?null:jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:blocks.map((block,i)=>jsxRuntimeExports.jsx(RenderBlock,{block,compact},i))})}function RenderBlock({block,compact}){var _a;return block.type==="separator"?jsxRuntimeExports.jsx("hr",{className:styles$2.blockSeparator}):block.type==="markdown"?(_a=block.text)!=null&&_a.trim()?jsxRuntimeExports.jsx(TranslatableMarkdown,{text:block.text,compact}):null:block.type==="thinking"?jsxRuntimeExports.jsx(ThinkingBlock,{block}):block.type==="tool_use"?jsxRuntimeExports.jsxs("div",{className:styles$2.toolBlock,children:[jsxRuntimeExports.jsxs("div",{className:styles$2.toolBlockHeader,children:[jsxRuntimeExports.jsx("span",{className:styles$2.blockTag,children:"tool_use"}),jsxRuntimeExports.jsx("span",{className:styles$2.toolName,children:block.name}),block.id&&jsxRuntimeExports.jsx("span",{className:styles$2.toolId,children:block.id})]}),jsxRuntimeExports.jsx("div",{className:styles$2.toolBlockBody,children:jsxRuntimeExports.jsx(JsonViewer,{data:block.input,defaultExpand:"root"})})]}):block.type==="tool_result"?jsxRuntimeExports.jsxs("div",{className:`${styles$2.toolBlock} ${block.is_error?styles$2.toolBlockError:styles$2.toolBlockResult}`,children:[jsxRuntimeExports.jsxs("div",{className:styles$2.toolBlockHeader,children:[jsxRuntimeExports.jsx("span",{className:`${styles$2.blockTag} ${block.is_error?styles$2.blockTagError:styles$2.blockTagResult}`,children:"tool_result"}),block.tool_use_id&&jsxRuntimeExports.jsx("span",{className:styles$2.toolId,children:block.tool_use_id}),block.is_error&&jsxRuntimeExports.jsx("span",{className:styles$2.errorLabel,children:"error"})]}),jsxRuntimeExports.jsx("div",{className:styles$2.toolBlockBody,children:jsxRuntimeExports.jsx(RenderBlocks,{blocks:block.content,compact:!0})})]}):block.type==="json"?jsxRuntimeExports.jsxs("div",{className:styles$2.jsonBlock,children:[block.label&&jsxRuntimeExports.jsx("div",{className:styles$2.jsonBlockLabel,children:block.label}),jsxRuntimeExports.jsx(JsonViewer,{data:block.data,defaultExpand:"root"})]}):null}function TurnContent({turn}){const timeStr=turn.timestamp?formatTurnTime(turn.timestamp):null,assistantTimeStr=turn.assistantTimestamp?formatTurnTime(turn.assistantTimestamp):null;return jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsxs("div",{className:styles$2.roleHeader,children:[jsxRuntimeExports.jsx("span",{className:`${styles$2.roleBadge} ${styles$2.role_user}`,children:"user"}),jsxRuntimeExports.jsx("span",{className:styles$2.roleLabel,children:`Turn ${turn.turnIndex+1}`}),timeStr&&jsxRuntimeExports.jsx("span",{className:styles$2.contentTime,children:timeStr})]}),jsxRuntimeExports.jsx(RenderBlocks,{blocks:turn.userBlocks}),turn.assistantBlocks&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:styles$2.turnDivider}),jsxRuntimeExports.jsxs("div",{className:styles$2.roleHeader,children:[jsxRuntimeExports.jsx("span",{className:`${styles$2.roleBadge} ${styles$2.role_assistant}`,children:"assistant"}),assistantTimeStr&&jsxRuntimeExports.jsx("span",{className:styles$2.contentTime,children:assistantTimeStr})]}),jsxRuntimeExports.jsx(RenderBlocks,{blocks:turn.assistantBlocks})]})]})}function AccordionSection({sectionKey,title,items,historyItems=[],onSelect,onSelectById,selectedId,sidebarRef}){const[open,setOpen]=reactExports.useState(sectionKey!=="tools"),[historyOpen,setHistoryOpen]=reactExports.useState(!1),totalCount=items.length+historyItems.length,historyToggleId=`${sectionKey}__history_toggle`;function focusControl(controlId){var _a;const el=(_a=sidebarRef.current)==null?void 0:_a.querySelector(`[data-context-sidebar-control="${controlId}"]`);el&&(el.focus(),el.scrollIntoView({block:"nearest"}))}function handleControlKeyDown(event,controlId){var _a;const visibleIds=Array.from(((_a=sidebarRef.current)==null?void 0:_a.querySelectorAll("[data-context-sidebar-control]"))||[]).map(el=>el.dataset.contextSidebarControl).filter(Boolean),nextId=getContextSidebarArrowNavigation({currentId:controlId,visibleIds,key:event.key});nextId&&(event.preventDefault(),typeof window<"u"&&window.requestAnimationFrame(()=>{var _a2;focusControl(nextId);const nextEl=(_a2=sidebarRef.current)==null?void 0:_a2.querySelector(`[data-context-sidebar-control="${nextId}"]`);(nextEl==null?void 0:nextEl.dataset.controlType)==="item"&&onSelectById(nextId)}))}function renderItem(item2){const active=selectedId===item2.id;return jsxRuntimeExports.jsxs("button",{type:"button",className:`${styles$2.item} ${active?styles$2.itemActive:""}`,onClick:()=>onSelect(item2),onKeyDown:event=>handleControlKeyDown(event,item2.id),"aria-current":active?"true":void 0,"data-context-sidebar-control":item2.id,"data-control-type":"item",children:[jsxRuntimeExports.jsxs("div",{className:styles$2.itemContent,children:[jsxRuntimeExports.jsx("span",{className:styles$2.itemLabel,children:item2.label}),item2.sublabel&&!active&&jsxRuntimeExports.jsx("div",{className:styles$2.itemSublabel,children:item2.sublabel})]}),item2.time&&jsxRuntimeExports.jsx("span",{className:styles$2.itemTime,children:item2.time})]},item2.id)}return jsxRuntimeExports.jsxs("div",{className:styles$2.section,children:[jsxRuntimeExports.jsxs("button",{type:"button",className:styles$2.sectionHeader,onClick:()=>setOpen(v=>!v),"aria-expanded":open,children:[open?jsxRuntimeExports.jsx(RefIcon$j,{className:styles$2.arrow}):jsxRuntimeExports.jsx(RefIcon$k,{className:styles$2.arrow}),jsxRuntimeExports.jsx("span",{className:styles$2.sectionTitle,children:title}),jsxRuntimeExports.jsx("span",{className:styles$2.sectionCount,children:totalCount})]}),open&&jsxRuntimeExports.jsxs("div",{className:styles$2.sectionBody,children:[historyItems.length>0&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("button",{type:"button",className:styles$2.historyToggle,onClick:()=>setHistoryOpen(v=>!v),onKeyDown:event=>handleControlKeyDown(event,historyToggleId),"aria-expanded":historyOpen,"data-context-sidebar-control":historyToggleId,"data-control-type":"toggle",children:[historyOpen?jsxRuntimeExports.jsx(RefIcon$j,{className:styles$2.arrow}):jsxRuntimeExports.jsx(RefIcon$k,{className:styles$2.arrow}),jsxRuntimeExports.jsxs("span",{className:styles$2.historyToggleLabel,children:[t("ui.context.history")," (",historyItems.length,")"]})]}),historyOpen&&historyItems.map(renderItem)]}),items.map(renderItem)]})]})}function ContextTab({body,response}){const[selectedItem,setSelectedItem]=reactExports.useState(null),sidebarRef=reactExports.useRef(null),turns=reactExports.useMemo(()=>{if(!Array.isArray(body==null?void 0:body.messages))return[];const allTurns=groupMessagesIntoTurns(body.messages);if(allTurns.length===0)return allTurns;const last=allTurns[allTurns.length-1],responseBlocks=response!=null&&response.content?parseContentBlocks(response.content):null;return[...allTurns.slice(0,-1),{...last,assistantBlocks:responseBlocks??last.assistantBlocks}]},[body,response]);if(reactExports.useEffect(()=>{turns.length>0?setSelectedItem(turns[turns.length-1]):setSelectedItem(null)},[body,response]),!body||typeof body!="object")return jsxRuntimeExports.jsx("div",{className:styles$2.emptyWrap,children:jsxRuntimeExports.jsx(Empty,{description:t("ui.context.noData")})});const accordionSections=[];Array.isArray(body.tools)&&body.tools.length>0&&accordionSections.push({key:"tools",title:jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[t("ui.context.tools")," ",jsxRuntimeExports.jsx(ConceptHelp,{doc:"ToolsFirst"})]}),items:body.tools.map((tool,i)=>({id:`tool__${i}`,label:(tool==null?void 0:tool.name)||`Tool ${i}`,blocks:parseToolBlocks(tool)}))});const systemBlocks=parseSystemBlocks(body.system);if(systemBlocks!=null&&accordionSections.push({key:"system",title:t("ui.context.systemPrompt"),items:[{id:"system__0",label:t("ui.context.systemPrompt"),blocks:systemBlocks}]}),turns.length>0){const toHistoryItem=turn=>({...turn,label:t("ui.context.historyTurnNoTime",{n:turn.turnIndex+1}),time:turn.timestamp?formatTurnTime(turn.timestamp):null,sublabel:turn.preview||void 0}),toCurrentItem=turn=>({...turn,label:t("ui.context.currentTurn"),sublabel:turn.preview||void 0}),historyTurns=turns.slice(0,-1).map(toHistoryItem),currentTurn=toCurrentItem(turns[turns.length-1]);accordionSections.push({key:"messages",title:t("ui.context.messages"),historyItems:historyTurns.length>0?historyTurns:void 0,items:[currentTurn]})}if(accordionSections.length===0)return jsxRuntimeExports.jsx("div",{className:styles$2.emptyWrap,children:jsxRuntimeExports.jsx(Empty,{description:t("ui.context.noFields")})});const currentSelectedItem=selectedItem!=null&&selectedItem.isTurn?turns.find(turn=>turn.id===selectedItem.id)??null:selectedItem,itemMap=new Map;return accordionSections.forEach(section2=>{(section2.historyItems||[]).forEach(item2=>itemMap.set(item2.id,item2)),section2.items.forEach(item2=>itemMap.set(item2.id,item2))}),jsxRuntimeExports.jsxs("div",{className:styles$2.root,children:[jsxRuntimeExports.jsx("div",{ref:sidebarRef,className:styles$2.sidebar,children:accordionSections.map(sec=>jsxRuntimeExports.jsx(AccordionSection,{sectionKey:sec.key,title:sec.title,items:sec.items,historyItems:sec.historyItems,selectedId:currentSelectedItem==null?void 0:currentSelectedItem.id,onSelect:item2=>setSelectedItem(item2),onSelectById:itemId=>{const nextItem=itemMap.get(itemId);nextItem&&setSelectedItem(nextItem)},sidebarRef},sec.key))}),jsxRuntimeExports.jsx("div",{className:styles$2.content,children:currentSelectedItem==null?jsxRuntimeExports.jsx("div",{className:styles$2.contentEmpty,children:jsxRuntimeExports.jsx(Text$1,{type:"secondary",children:t("ui.context.selectPrompt")})}):jsxRuntimeExports.jsx("div",{className:styles$2.contentInner,children:currentSelectedItem.isTurn?jsxRuntimeExports.jsx(TurnContent,{turn:currentSelectedItem}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[currentSelectedItem.role&&jsxRuntimeExports.jsxs("div",{className:styles$2.roleHeader,children:[jsxRuntimeExports.jsx("span",{className:`${styles$2.roleBadge} ${styles$2[`role_${currentSelectedItem.role}`]||""}`,children:currentSelectedItem.role}),jsxRuntimeExports.jsx("span",{className:styles$2.roleLabel,children:currentSelectedItem.label})]}),jsxRuntimeExports.jsx(RenderBlocks,{blocks:currentSelectedItem.blocks})]})},currentSelectedItem.id)})]})}const container="_container_rg6mx_1",emptyState="_emptyState_rg6mx_10",urlSection="_urlSection_rg6mx_17",urlLeft="_urlLeft_rg6mx_25",tokenStatsBox="_tokenStatsBox_rg6mx_30",tokenGrid="_tokenGrid_rg6mx_37",tokenRows="_tokenRows_rg6mx_47",tokenRow="_tokenRow_rg6mx_47",tokenRowBorder="_tokenRowBorder_rg6mx_55",tokenLabel="_tokenLabel_rg6mx_59",tokenTd="_tokenTd_rg6mx_66",tokenHitRate="_tokenHitRate_rg6mx_75",tokenHitRateLabel="_tokenHitRateLabel_rg6mx_88",urlText="_urlText_rg6mx_98",metaText="_metaText_rg6mx_105",headersContainer="_headersContainer_rg6mx_109",headerRow="_headerRow_rg6mx_113",headerKey="_headerKey_rg6mx_119",headerValue="_headerValue_rg6mx_124",streamingBox="_streamingBox_rg6mx_129",rawTextPre="_rawTextPre_rg6mx_142",tabContent="_tabContent_rg6mx_155",bodyLabel="_bodyLabel_rg6mx_167",bodyHeader="_bodyHeader_rg6mx_171",diffSection="_diffSection_rg6mx_178",diffToggle="_diffToggle_rg6mx_182",diffIcon="_diffIcon_rg6mx_188",reminderSelect="_reminderSelect_rg6mx_214",diffHeaderRow="_diffHeaderRow_rg6mx_233",diffSpaceRight="_diffSpaceRight_rg6mx_239",reminderFilterWrapper="_reminderFilterWrapper_rg6mx_243",reminderLabel="_reminderLabel_rg6mx_249",cacheTabContent="_cacheTabContent_rg6mx_255",userPromptList="_userPromptList_rg6mx_260",userPromptItem="_userPromptItem_rg6mx_266",userPromptNavBtn="_userPromptNavBtn_rg6mx_277",cacheContent="_cacheContent_rg6mx_288",cacheTokenBar="_cacheTokenBar_rg6mx_295",cacheTokenWrite="_cacheTokenWrite_rg6mx_305",cacheTokenRead="_cacheTokenRead_rg6mx_309",cacheCopyIcon="_cacheCopyIcon_rg6mx_313",cacheScrollArea="_cacheScrollArea_rg6mx_320",cacheSectionBlock="_cacheSectionBlock_rg6mx_326",cacheSectionHeader="_cacheSectionHeader_rg6mx_330",cacheCollapseArrow="_cacheCollapseArrow_rg6mx_342",cachePre="_cachePre_rg6mx_348",cacheHighlightSvg="_cacheHighlightSvg_rg6mx_362",cachePreSystem="_cachePreSystem_rg6mx_371",styles$1={container,emptyState,urlSection,urlLeft,tokenStatsBox,tokenGrid,tokenRows,tokenRow,tokenRowBorder,tokenLabel,tokenTd,tokenHitRate,tokenHitRateLabel,urlText,metaText,headersContainer,headerRow,headerKey,headerValue,streamingBox,rawTextPre,tabContent,bodyLabel,bodyHeader,diffSection,diffToggle,diffIcon,reminderSelect,diffHeaderRow,diffSpaceRight,reminderFilterWrapper,reminderLabel,cacheTabContent,userPromptList,userPromptItem,userPromptNavBtn,cacheContent,cacheTokenBar,cacheTokenWrite,cacheTokenRead,cacheCopyIcon,cacheScrollArea,cacheSectionBlock,cacheSectionHeader,cacheCollapseArrow,cachePre,cacheHighlightSvg,cachePreSystem},{Text,Paragraph}=Typography;class DetailPanel extends React.Component{constructor(props){super(props),this.state={bodyViewMode:{request:"json",response:"json",diff:"json"},diffExpanded:!1,requestHeadersExpanded:!1,responseHeadersExpanded:!1,reminderFilters:null,cacheHighlightIdx:null,cacheHighlightFading:!1,cacheCollapsed:{tools:!1,system:!1,messages:!1}}}_cacheUnbindScrollFade(){this._cacheOnScrollFade&&this._cacheScrollEl&&(this._cacheScrollEl.removeEventListener("scroll",this._cacheOnScrollFade),this._cacheOnScrollFade=null)}_cacheClearAllTimers(){clearTimeout(this._cacheScrollSettleTimer),clearTimeout(this._cacheFadeClearTimer),clearTimeout(this._cacheAutoFadeTimer),clearTimeout(this._cacheHighlightDelayTimer),this._cacheUnbindScrollFade(),this._cacheScrollEndHandler&&this._cacheScrollEl&&(this._cacheScrollEl.removeEventListener("scrollend",this._cacheScrollEndHandler),this._cacheScrollEndHandler=null)}componentWillUnmount(){this._cacheClearAllTimers()}_cacheBindScrollFade(){this._cacheUnbindScrollFade();const el=this._cacheScrollEl;el&&(this._cacheOnScrollFade=()=>{clearTimeout(this._cacheAutoFadeTimer),this.setState({cacheHighlightFading:!0}),this._cacheFadeClearTimer=setTimeout(()=>{this.setState({cacheHighlightIdx:null,cacheHighlightFading:!1})},3e3),this._cacheUnbindScrollFade()},el.addEventListener("scroll",this._cacheOnScrollFade,{passive:!0}))}scrollToCacheMsg(idx){if(this.state.cacheCollapsed.messages){this.setState(prev=>({cacheCollapsed:{...prev.cacheCollapsed,messages:!1}}),()=>this.scrollToCacheMsg(idx));return}const el=this._cacheScrollEl;if(!el)return;const target=el.querySelector(`[data-msg-idx="${idx}"]`);if(!target)return;clearTimeout(this._cacheScrollSettleTimer),clearTimeout(this._cacheFadeClearTimer),clearTimeout(this._cacheAutoFadeTimer),clearTimeout(this._cacheHighlightDelayTimer),this._cacheUnbindScrollFade(),this._cacheScrollEndHandler&&el.removeEventListener("scrollend",this._cacheScrollEndHandler),this.setState({cacheHighlightIdx:null,cacheHighlightFading:!1});let scrollDone=!1,minPassed=!1;const showHighlight=()=>{!scrollDone||!minPassed||(this.setState({cacheHighlightIdx:idx,cacheHighlightFading:!1}),this._cacheScrollSettleTimer=setTimeout(()=>this._cacheBindScrollFade(),200),this._cacheAutoFadeTimer=setTimeout(()=>{this.state.cacheHighlightIdx===idx&&!this.state.cacheHighlightFading&&(this.setState({cacheHighlightFading:!0}),this._cacheFadeClearTimer=setTimeout(()=>{this.setState({cacheHighlightIdx:null,cacheHighlightFading:!1})},3e3),this._cacheUnbindScrollFade())},3e3))};this._cacheScrollEndHandler=()=>{el.removeEventListener("scrollend",this._cacheScrollEndHandler),scrollDone=!0,showHighlight()},el.addEventListener("scrollend",this._cacheScrollEndHandler,{once:!0}),this._cacheScrollSettleTimer=setTimeout(()=>{el.removeEventListener("scrollend",this._cacheScrollEndHandler),scrollDone=!0,showHighlight()},800),this._cacheHighlightDelayTimer=setTimeout(()=>{minPassed=!0,showHighlight()},500),target.scrollIntoView({behavior:"smooth",block:"center"})}shouldComponentUpdate(nextProps,nextState){if(nextProps.request!==this.props.request){const isMA=isMainAgent(nextProps.request);this.setState({diffExpanded:isMA&&!!nextProps.expandDiff,requestHeadersExpanded:!1,responseHeadersExpanded:!1,reminderFilters:null}),this._cacheClearAllTimers()}const onCacheTab=nextProps.currentTab==="kv-cache-text";return nextProps.request!==this.props.request||nextProps.currentTab!==this.props.currentTab||nextProps.onTabChange!==this.props.onTabChange||nextProps.selectedIndex!==this.props.selectedIndex||nextProps.expandDiff!==this.props.expandDiff||nextProps.pendingCacheHighlight!==this.props.pendingCacheHighlight||nextState.bodyViewMode!==this.state.bodyViewMode||onCacheTab&&nextState.cacheHighlightIdx!==this.state.cacheHighlightIdx||onCacheTab&&nextState.cacheHighlightFading!==this.state.cacheHighlightFading||nextState.diffExpanded!==this.state.diffExpanded||nextState.requestHeadersExpanded!==this.state.requestHeadersExpanded||nextState.responseHeadersExpanded!==this.state.responseHeadersExpanded||nextState.reminderFilters!==this.state.reminderFilters||onCacheTab&&nextState.cacheCollapsed!==this.state.cacheCollapsed}componentDidUpdate(prevProps){const pch=this.props.pendingCacheHighlight;pch&&pch!==prevProps.pendingCacheHighlight&&setTimeout(()=>{var _a,_b;this.scrollToCacheMsg(pch.msgIdx),(_b=(_a=this.props).onCacheHighlightDone)==null||_b.call(_a)},150)}getCurrentRequest(){const{request,allRequests,requests}=this.props;return request?request._slimmed?restoreSlimmedEntry(request,allRequests||requests||[]):request:null}toggleBodyViewMode(type){this.setState(prev=>({bodyViewMode:{...prev.bodyViewMode,[type]:prev.bodyViewMode[type]==="json"?"text":"json"}}))}copyBody(type){var _a;const request=this.getCurrentRequest();if(!request)return;let data;if(type==="diff"?data=this._lastDiffResult:data=type==="request"?request.body:(_a=request.response)==null?void 0:_a.body,data==null)return;const clean=typeof data=="object"?stripPrivateKeys(data):data,text=typeof clean=="string"?clean:JSON.stringify(clean,null,2);navigator.clipboard.writeText(text).then(()=>staticMethods.success(t("ui.copySuccess")))}renderHeaders(headers){return!headers||Object.keys(headers).length===0?jsxRuntimeExports.jsx(Text,{type:"secondary",children:t("ui.noHeaders")}):jsxRuntimeExports.jsx("div",{className:styles$1.headersContainer,children:Object.entries(headers).map(([key,value])=>jsxRuntimeExports.jsxs("div",{className:styles$1.headerRow,children:[jsxRuntimeExports.jsx(Text,{code:!0,className:styles$1.headerKey,children:key}),key==="authorization"&&jsxRuntimeExports.jsx(ConceptHelp,{doc:"TranslateContextPollution"}),jsxRuntimeExports.jsx(Text,{type:"secondary",className:styles$1.headerValue,children:String(value)})]},key))})}getRequestExpandNode(data,type){if(type!=="request"||!data||typeof data!="object")return;const{request,requests,selectedIndex}=this.props;if(!request)return;const nextReq=requests&&selectedIndex!=null?requests[selectedIndex+1]:null,{type:reqType}=classifyRequest(request,nextReq);let claudeMdExpandSet=null;if(this.state.reminderFilters==="claudeMd"&&Array.isArray(data.messages)){claudeMdExpandSet=new Set,claudeMdExpandSet.add(data.messages);for(const msg of data.messages){if(!msg||typeof msg!="object")continue;const content2=msg.content;if(typeof content2=="string")isClaudeMdReminder(content2)&&claudeMdExpandSet.add(msg);else if(Array.isArray(content2)){let hasMatch=!1;for(const block of content2)block&&block.type==="text"&&isClaudeMdReminder(block.text)&&(claudeMdExpandSet.add(block),hasMatch=!0);hasMatch&&(claudeMdExpandSet.add(msg),claudeMdExpandSet.add(content2))}}}let skillsExpandSet=null;if(this.state.reminderFilters==="skills"&&Array.isArray(data.messages)){skillsExpandSet=new Set,skillsExpandSet.add(data.messages);for(const msg of data.messages){if(!msg||typeof msg!="object")continue;const content2=msg.content;if(typeof content2=="string")isSkillsReminder(content2)&&skillsExpandSet.add(msg);else if(Array.isArray(content2)){let hasMatch=!1;for(const block of content2)block&&block.type==="text"&&isSkillsReminder(block.text)&&(skillsExpandSet.add(block),hasMatch=!0);hasMatch&&(skillsExpandSet.add(msg),skillsExpandSet.add(content2))}}}const filterExpandSet=claudeMdExpandSet||skillsExpandSet;if(reqType==="Preflight"){const expandRefs=new Set,collectAll=obj=>{obj&&typeof obj=="object"&&(expandRefs.add(obj),Array.isArray(obj)?obj.forEach(collectAll):Object.values(obj).forEach(collectAll))};return Array.isArray(data.messages)&&collectAll(data.messages),Array.isArray(data.system)&&data.system.length>=3&&collectAll(data.system[2]),(level,value,field)=>!!(level<2||expandRefs.has(value)||filterExpandSet&&filterExpandSet.has(value)||level===1&&field==="system")}if(reqType==="MainAgent"&&Array.isArray(data.messages)&&data.messages.length===1){const msg=data.messages[0],contentArr=msg&&Array.isArray(msg.content)?msg.content:null,lastContent=contentArr&&contentArr.length>0?contentArr[contentArr.length-1]:null,expandRefs=new Set,collectAll=obj=>{obj&&typeof obj=="object"&&(expandRefs.add(obj),Array.isArray(obj)?obj.forEach(collectAll):Object.values(obj).forEach(collectAll))};return lastContent&&collectAll(lastContent),expandRefs.add(data.messages),msg&&typeof msg=="object"&&expandRefs.add(msg),contentArr&&expandRefs.add(contentArr),(level,value,field)=>!!(level<2||expandRefs.has(value)||filterExpandSet&&filterExpandSet.has(value))}if(filterExpandSet)return(level,value,field)=>!!(level<2||filterExpandSet.has(value))}renderBody(data,type){const{bodyViewMode}=this.state;if(data==null)return jsxRuntimeExports.jsx(Text,{type:"secondary",children:t("ui.noBody")});if(typeof data=="string"&&data.includes("Streaming Response"))return jsxRuntimeExports.jsx("div",{className:styles$1.streamingBox,children:jsxRuntimeExports.jsx(Text,{type:"secondary",children:t("ui.streamingResponse")})});const clean=typeof data=="object"?stripPrivateKeys(data):data,isJsonMode=bodyViewMode[type]==="json",expandNode=this.getRequestExpandNode(clean,type);return jsxRuntimeExports.jsx("div",{children:isJsonMode?jsxRuntimeExports.jsx(JsonViewer,{data:clean,defaultExpand:type==="response"?"all":"root",expandNode}):jsxRuntimeExports.jsx("pre",{className:styles$1.rawTextPre,children:typeof clean=="string"?clean:JSON.stringify(clean,null,2)})})}getPrevMainAgentRequest(){const{requests,selectedIndex}=this.props;if(!requests||selectedIndex==null)return null;for(let i=selectedIndex-1;i>=0;i--)if(isMainAgent(requests[i])){const r=requests[i];return r._slimmed?restoreSlimmedEntry(r,this.props.allRequests||requests):r}return null}computeDiff(prev,curr){if(prev==null||curr==null||typeof prev!="object"||typeof curr!="object")return null;const result={},allKeys=new Set([...Object.keys(prev),...Object.keys(curr)]);for(const key of allKeys)if(!key.startsWith("_"))if(!(key in prev))result[key]=curr[key];else if(key in curr){const pStr=JSON.stringify(prev[key]),cStr=JSON.stringify(curr[key]);pStr!==cStr&&(key==="messages"&&Array.isArray(prev[key])&&Array.isArray(curr[key])&&curr[key].length>prev[key].length?result[key]=curr[key].slice(prev[key].length):result[key]=curr[key])}else continue;return Object.keys(result).length?result:null}render(){var _a,_b,_c;let request=this.getCurrentRequest();const{currentTab,onTabChange}=this.props;if(!request)return jsxRuntimeExports.jsx("div",{className:styles$1.emptyState,children:jsxRuntimeExports.jsx(Empty,{description:"选择一个请求查看详情"})});const time2=new Date(request.timestamp).toLocaleString("zh-CN"),statusOk2=request.response&&request.response.status<400;let diffBlock=null;if(isMainAgent(request)){const prevRequest=this.getPrevMainAgentRequest();if(prevRequest){const currSize=JSON.stringify(request.body).length,prevSize=JSON.stringify(prevRequest.body).length;if(currSize<prevSize)diffBlock=jsxRuntimeExports.jsxs("div",{className:styles$1.diffSection,children:[jsxRuntimeExports.jsxs(Text,{strong:!0,className:styles$1.diffToggle,onClick:()=>this.setState(prev=>({diffExpanded:!prev.diffExpanded})),children:["Body Diff JSON ",jsxRuntimeExports.jsx(ConceptHelp,{doc:"BodyDiffJSON"})," ",this.state.diffExpanded?jsxRuntimeExports.jsx(RefIcon$j,{className:styles$1.diffIcon}):jsxRuntimeExports.jsx(RefIcon$k,{className:styles$1.diffIcon})]}),this.state.diffExpanded&&jsxRuntimeExports.jsx(Text,{type:"secondary",children:t("ui.diffSessionChanged")})]});else{const diffResult=stripPrivateKeys(this.computeDiff(prevRequest.body,request.body));diffResult&&(this._lastDiffResult=diffResult,diffBlock=jsxRuntimeExports.jsxs("div",{className:styles$1.diffSection,children:[jsxRuntimeExports.jsxs("div",{className:styles$1.diffHeaderRow,children:[jsxRuntimeExports.jsxs(Text,{strong:!0,className:styles$1.diffToggle,onClick:()=>this.setState(prev=>({diffExpanded:!prev.diffExpanded})),children:["Body Diff JSON ",jsxRuntimeExports.jsx(ConceptHelp,{doc:"BodyDiffJSON"})," ",this.state.diffExpanded?jsxRuntimeExports.jsx(RefIcon$j,{className:styles$1.diffIcon}):jsxRuntimeExports.jsx(RefIcon$k,{className:styles$1.diffIcon})]}),this.state.diffExpanded&&jsxRuntimeExports.jsxs(Space,{size:"small",className:styles$1.diffSpaceRight,children:[jsxRuntimeExports.jsx(Button,{size:"small",icon:this.state.bodyViewMode.diff==="json"?jsxRuntimeExports.jsx(RefIcon$b,{}):jsxRuntimeExports.jsx(RefIcon$5,{}),onClick:()=>this.toggleBodyViewMode("diff"),children:this.state.bodyViewMode.diff==="json"?"Text":"JSON"}),jsxRuntimeExports.jsx(Button,{size:"small",icon:jsxRuntimeExports.jsx(RefIcon$a,{}),onClick:()=>this.copyBody("diff"),children:t("ui.copy")})]})]}),this.state.diffExpanded&&jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:this.state.bodyViewMode.diff==="json"?jsxRuntimeExports.jsx(JsonViewer,{data:diffResult,defaultExpand:"all"}):jsxRuntimeExports.jsx("pre",{className:styles$1.rawTextPre,children:JSON.stringify(diffResult,null,2)})})]}))}}}const hasClaudeMd=hasClaudeMdReminder(request.body),hasSkills=hasSkillsReminder(request.body),tabItems=[{key:"request",label:"Request",children:jsxRuntimeExports.jsxs("div",{className:styles$1.tabContent,children:[jsxRuntimeExports.jsxs("div",{className:styles$1.diffSection,children:[jsxRuntimeExports.jsxs(Text,{strong:!0,className:styles$1.diffToggle,onClick:()=>this.setState(prev=>({requestHeadersExpanded:!prev.requestHeadersExpanded})),children:["Headers ",this.state.requestHeadersExpanded?jsxRuntimeExports.jsx(RefIcon$j,{className:styles$1.diffIcon}):jsxRuntimeExports.jsx(RefIcon$k,{className:styles$1.diffIcon})]}),this.state.requestHeadersExpanded&&this.renderHeaders(request.headers)]}),diffBlock,jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsxs("div",{className:styles$1.bodyHeader,children:[jsxRuntimeExports.jsxs(Text,{strong:!0,className:styles$1.bodyLabel,children:["Body",jsxRuntimeExports.jsx(ConceptHelp,{doc:"BodyFields"})]}),jsxRuntimeExports.jsxs(Space,{size:"small",children:[(hasClaudeMd||hasSkills)&&jsxRuntimeExports.jsxs("span",{className:styles$1.reminderFilterWrapper,children:[jsxRuntimeExports.jsx("span",{className:styles$1.reminderLabel,children:"system-reminder:"}),jsxRuntimeExports.jsx(Select,{size:"small",className:styles$1.reminderSelect,placeholder:"filter",value:this.state.reminderFilters||void 0,onChange:val=>this.setState({reminderFilters:val||null}),options:[{label:"CLAUDE.md",value:"claudeMd",disabled:!hasClaudeMd},{label:"Skills",value:"skills",disabled:!hasSkills}],popupMatchSelectWidth:!1,allowClear:!0})]}),jsxRuntimeExports.jsx(Button,{size:"small",icon:this.state.bodyViewMode.request==="json"?jsxRuntimeExports.jsx(RefIcon$b,{}):jsxRuntimeExports.jsx(RefIcon$5,{}),onClick:()=>this.toggleBodyViewMode("request"),children:this.state.bodyViewMode.request==="json"?"Text":"JSON"}),jsxRuntimeExports.jsx(Button,{size:"small",icon:jsxRuntimeExports.jsx(RefIcon$a,{}),onClick:()=>this.copyBody("request"),children:t("ui.copy")})]})]}),this.renderBody(request.body,"request")]})]})},{key:"response",label:"Response",children:jsxRuntimeExports.jsx("div",{className:styles$1.tabContent,children:request.response?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:styles$1.diffSection,children:[jsxRuntimeExports.jsxs(Text,{strong:!0,className:styles$1.diffToggle,onClick:()=>this.setState(prev=>({responseHeadersExpanded:!prev.responseHeadersExpanded})),children:["Headers ",this.state.responseHeadersExpanded?jsxRuntimeExports.jsx(RefIcon$j,{className:styles$1.diffIcon}):jsxRuntimeExports.jsx(RefIcon$k,{className:styles$1.diffIcon})]}),this.state.responseHeadersExpanded&&this.renderHeaders(request.response.headers)]}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsxs("div",{className:styles$1.bodyHeader,children:[jsxRuntimeExports.jsxs(Text,{strong:!0,className:styles$1.bodyLabel,children:["Body",jsxRuntimeExports.jsx(ConceptHelp,{doc:"ResponseFields"})]}),jsxRuntimeExports.jsxs(Space,{size:"small",children:[jsxRuntimeExports.jsx(Button,{size:"small",icon:this.state.bodyViewMode.response==="json"?jsxRuntimeExports.jsx(RefIcon$b,{}):jsxRuntimeExports.jsx(RefIcon$5,{}),onClick:()=>this.toggleBodyViewMode("response"),children:this.state.bodyViewMode.response==="json"?"Text":"JSON"}),jsxRuntimeExports.jsx(Button,{size:"small",icon:jsxRuntimeExports.jsx(RefIcon$a,{}),onClick:()=>this.copyBody("response"),children:t("ui.copy")})]})]}),this.renderBody(request.response.body,"response")]})]}):jsxRuntimeExports.jsx(Empty,{description:t("ui.responseNotCaptured")})})},{key:"kv-cache-text",label:jsxRuntimeExports.jsxs("span",{children:["KV-Cache-Text ",jsxRuntimeExports.jsx(ConceptHelp,{doc:"KVCacheContent"})]}),children:jsxRuntimeExports.jsx("div",{className:`${styles$1.tabContent} ${styles$1.cacheTabContent}`,children:(()=>{const cached=extractCachedContent([request]),reqKey=request.timestamp+"|"+request.url;if(cached&&(cached.cacheCreateTokens>0||cached.cacheReadTokens>0)&&(this._lastCachedTokensKey=reqKey,this._lastCachedTokens={cacheCreateTokens:cached.cacheCreateTokens,cacheReadTokens:cached.cacheReadTokens}),!cached||cached.system.length===0&&cached.messages.length===0&&cached.tools.length===0)return jsxRuntimeExports.jsx(Empty,{description:t("ui.noCachedContent"),image:Empty.PRESENTED_IMAGE_SIMPLE});const buildPlainText=()=>{const parts=[];return cached.tools.length>0&&(parts.push(`=== ${t("ui.tools")} ===`),cached.tools.forEach(t2=>parts.push(t2))),cached.system.length>0&&(parts.push(`
24
+ === ${t("ui.systemPrompt")} ===`),cached.system.forEach(t2=>parts.push(t2))),cached.messages.length>0&&(parts.push(`
25
+ === ${t("ui.messages")} ===`),cached.messages.forEach(t2=>parts.push(t2))),parts.join(`
26
+
27
+ `)},userPrompts=cached.messages.map((text,i)=>({text,msgIdx:i})).filter(({text})=>text.startsWith("[user]")).map(({text,msgIdx})=>{const raw=text.replace(/^\[user\]\s*/,"").trim();return!raw||isSystemText(raw)?{cleaned:"",msgIdx}:{cleaned:AppHeader.parseSegments(raw).filter(s=>s.type==="text").map(s=>s.content.trim()).filter(s=>s&&!isSystemText(s)).join(" ").trim(),msgIdx}}).filter(({cleaned})=>!(!cleaned||/Implement the following plan:/i.test(cleaned))),userPromptNavList=userPrompts.length>0?jsxRuntimeExports.jsx("div",{className:styles$1.userPromptList,children:userPrompts.map(({cleaned,msgIdx})=>jsxRuntimeExports.jsx("div",{className:styles$1.userPromptItem,onMouseEnter:e=>{e.currentTarget.style.background="var(--color-primary-bg-lighter)",e.currentTarget.style.color="var(--text-white)"},onMouseLeave:e=>{e.currentTarget.style.background="",e.currentTarget.style.color="var(--text-secondary)"},onClick:()=>this.scrollToCacheMsg(msgIdx),children:cleaned},msgIdx))}):null;return jsxRuntimeExports.jsxs("div",{className:styles$1.cacheContent,children:[(()=>{const displayTokens=cached.cacheCreateTokens>0||cached.cacheReadTokens>0?cached:this._lastCachedTokensKey===reqKey?this._lastCachedTokens:null;return displayTokens||userPromptNavList?jsxRuntimeExports.jsxs("div",{className:styles$1.cacheTokenBar,children:[displayTokens&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[t("ui.tokens"),": ",jsxRuntimeExports.jsxs("span",{className:styles$1.cacheTokenWrite,children:["write ",formatTokenCount(displayTokens.cacheCreateTokens)]})," / ",jsxRuntimeExports.jsxs("span",{className:styles$1.cacheTokenRead,children:["read ",formatTokenCount(displayTokens.cacheReadTokens)]}),jsxRuntimeExports.jsx(Tooltip,{title:t("ui.copyAllCacheText"),children:jsxRuntimeExports.jsx(RefIcon$a,{className:styles$1.cacheCopyIcon,onClick:()=>{navigator.clipboard.writeText(buildPlainText()).then(()=>{staticMethods.success(t("ui.copied"))}).catch(()=>{})}})})]}),userPromptNavList&&jsxRuntimeExports.jsx(Popover,{content:userPromptNavList,trigger:"hover",placement:"left",children:jsxRuntimeExports.jsx("span",{className:styles$1.userPromptNavBtn,children:t("ui.userPromptNav")})})]}):null})(),jsxRuntimeExports.jsxs("div",{className:styles$1.cacheScrollArea,ref:el=>{this._cacheScrollEl=el},children:[cached.tools.length>0&&jsxRuntimeExports.jsxs("div",{className:styles$1.cacheSectionBlock,children:[jsxRuntimeExports.jsxs("div",{className:styles$1.cacheSectionHeader,onClick:()=>this.setState(prev=>({cacheCollapsed:{...prev.cacheCollapsed,tools:!prev.cacheCollapsed.tools}})),children:[jsxRuntimeExports.jsx("span",{className:styles$1.cacheCollapseArrow,style:{transform:this.state.cacheCollapsed.tools?"rotate(-90deg)":"rotate(0deg)"},children:"▼"}),t("ui.tools")," (",cached.tools.length,")"]}),!this.state.cacheCollapsed.tools&&cached.tools.map((text,i)=>jsxRuntimeExports.jsx("pre",{className:styles$1.cachePre,children:text},i))]}),cached.system.length>0&&jsxRuntimeExports.jsxs("div",{className:styles$1.cacheSectionBlock,children:[jsxRuntimeExports.jsxs("div",{className:styles$1.cacheSectionHeader,onClick:()=>this.setState(prev=>({cacheCollapsed:{...prev.cacheCollapsed,system:!prev.cacheCollapsed.system}})),children:[jsxRuntimeExports.jsx("span",{className:styles$1.cacheCollapseArrow,style:{transform:this.state.cacheCollapsed.system?"rotate(-90deg)":"rotate(0deg)"},children:"▼"}),t("ui.systemPrompt")," (",cached.system.length,")"]}),!this.state.cacheCollapsed.system&&cached.system.map((text,i)=>jsxRuntimeExports.jsx("pre",{className:styles$1.cachePreSystem,children:text},i))]}),cached.messages.length>0&&jsxRuntimeExports.jsxs("div",{className:styles$1.cacheSectionBlock,children:[jsxRuntimeExports.jsxs("div",{className:styles$1.cacheSectionHeader,onClick:()=>this.setState(prev=>({cacheCollapsed:{...prev.cacheCollapsed,messages:!prev.cacheCollapsed.messages}})),children:[jsxRuntimeExports.jsx("span",{className:styles$1.cacheCollapseArrow,style:{transform:this.state.cacheCollapsed.messages?"rotate(-90deg)":"rotate(0deg)"},children:"▼"}),t("ui.messages")," (",cached.messages.length,")"]}),!this.state.cacheCollapsed.messages&&cached.messages.map((text,i)=>{const isHl=i===this.state.cacheHighlightIdx,hlStyle=isHl?this.state.cacheHighlightFading?{boxShadow:"0 0 10px rgba(22,104,220,0)",transition:"box-shadow 3s ease-out",position:"relative"}:{boxShadow:"0 0 10px rgba(22,104,220,0.6)",transition:"box-shadow 0.2s ease-in",position:"relative"}:{};return jsxRuntimeExports.jsxs("pre",{"data-msg-idx":i,className:styles$1.cachePre,style:hlStyle,children:[isHl&&jsxRuntimeExports.jsx("svg",{className:styles$1.cacheHighlightSvg,style:{opacity:this.state.cacheHighlightFading?0:1,transition:this.state.cacheHighlightFading?"opacity 3s ease-out":void 0},preserveAspectRatio:"none",children:jsxRuntimeExports.jsx("rect",{x:"0.5",y:"0.5",width:"calc(100% - 1px)",height:"calc(100% - 1px)",rx:"4",ry:"4",fill:"none",stroke:"#1668dc",strokeWidth:"1",strokeDasharray:"6 4",children:jsxRuntimeExports.jsx("animate",{attributeName:"stroke-dashoffset",from:"0",to:"-100",dur:"4s",repeatCount:"indefinite"})})}),text]},i)})]})]})]})})()})},{key:"context",label:"Context",children:jsxRuntimeExports.jsx("div",{className:`${styles$1.tabContent} ${styles$1.cacheTabContent}`,children:jsxRuntimeExports.jsx(ContextTab,{body:request.body,response:(_a=request.response)==null?void 0:_a.body})})}],usage=(_c=(_b=request.response)==null?void 0:_b.body)==null?void 0:_c.usage,tokenStats=usage?(()=>{const input=usage.input_tokens||0,output=usage.output_tokens||0,cacheCreate=usage.cache_creation_input_tokens||0,cacheRead=usage.cache_read_input_tokens||0,totalInput=input+cacheCreate+cacheRead,hitRate=totalInput>0?(cacheRead/totalInput*100).toFixed(1):"0.0";return{input,output,cacheCreate,cacheRead,hitRate}})():null;return jsxRuntimeExports.jsxs("div",{className:styles$1.container,children:[jsxRuntimeExports.jsxs("div",{className:styles$1.urlSection,children:[jsxRuntimeExports.jsxs("div",{className:styles$1.urlLeft,children:[jsxRuntimeExports.jsx(Paragraph,{className:styles$1.urlText,ellipsis:{rows:2,expandable:!0},children:request.url}),jsxRuntimeExports.jsxs(Space,{size:"small",wrap:!0,children:[jsxRuntimeExports.jsx(Tag,{color:request.method==="POST"?"blue":"green",children:request.method}),jsxRuntimeExports.jsxs(Text,{type:"secondary",className:styles$1.metaText,children:["🕐 ",time2]}),request.duration&&jsxRuntimeExports.jsxs(Text,{type:"secondary",className:styles$1.metaText,children:["⏱️ ",request.duration,"ms"]}),request.response&&jsxRuntimeExports.jsxs(Tag,{color:statusOk2?"success":"error",children:["HTTP ",request.response.status]})]})]}),tokenStats&&jsxRuntimeExports.jsx("div",{className:styles$1.tokenStatsBox,children:jsxRuntimeExports.jsxs("div",{className:styles$1.tokenGrid,children:[jsxRuntimeExports.jsxs("div",{className:styles$1.tokenRows,children:[jsxRuntimeExports.jsxs("div",{className:styles$1.tokenRow,children:[jsxRuntimeExports.jsx("span",{className:styles$1.tokenLabel,children:"Token"}),jsxRuntimeExports.jsxs("span",{className:styles$1.tokenTd,children:["input: ",formatTokenCount(tokenStats.input)]}),jsxRuntimeExports.jsxs("span",{className:styles$1.tokenTd,children:["output: ",formatTokenCount(tokenStats.output)]})]}),jsxRuntimeExports.jsxs("div",{className:`${styles$1.tokenRow} ${styles$1.tokenRowBorder}`,children:[jsxRuntimeExports.jsx("span",{className:styles$1.tokenLabel,children:"Cache"}),jsxRuntimeExports.jsxs("span",{className:styles$1.tokenTd,children:["create: ",formatTokenCount(tokenStats.cacheCreate)]}),jsxRuntimeExports.jsxs("span",{className:styles$1.tokenTd,children:["read: ",formatTokenCount(tokenStats.cacheRead)]})]})]}),jsxRuntimeExports.jsxs("div",{className:styles$1.tokenHitRate,children:[jsxRuntimeExports.jsxs("div",{children:[tokenStats.hitRate,"%"]}),jsxRuntimeExports.jsx("div",{className:styles$1.tokenHitRateLabel,children:t("ui.hitRate")})]})]})})]}),jsxRuntimeExports.jsx(Tabs,{activeKey:currentTab,onChange:onTabChange,items:tabItems,size:"small"})]})}}const resizer="_resizer_pzn4b_1",styles={resizer};class PanelResizer extends React.Component{constructor(props){super(props),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this)}handleMouseDown(e){e.preventDefault(),document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("mouseup",this.handleMouseUp)}handleMouseMove(e){this.props.onResize&&this.props.onResize(e.clientX)}handleMouseUp(){document.body.style.cursor="",document.body.style.userSelect="",document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp)}componentWillUnmount(){document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp)}render(){return jsxRuntimeExports.jsx("div",{onMouseDown:this.handleMouseDown,className:styles.resizer})}}class App extends AppBase{constructor(props){super(props);__publicField(this,"handleViewRequest",index=>{this.setState({viewMode:"raw",selectedIndex:index,scrollCenter:!0})});__publicField(this,"handleViewInChat",()=>{this.setState(prev=>{const selectedReq=(prev.showAll?prev.requests:filterRelevantRequests(prev.requests))[prev.selectedIndex];if(!selectedReq)return null;let targetTs=null;if(isMainAgent(selectedReq)&&selectedReq.timestamp)targetTs=selectedReq.timestamp;else{const cls=classifyRequest(selectedReq);if((cls.type==="SubAgent"||cls.type==="Teammate")&&selectedReq.timestamp)targetTs=selectedReq.timestamp;else{const idx=prev.requests.indexOf(selectedReq);idx>=0&&(targetTs=findPrevMainAgentTimestamp(prev.requests,idx))}targetTs||staticMethods.info(t("ui.cannotMap"))}return{viewMode:"chat",chatScrollToTs:targetTs}})});__publicField(this,"handleToggleViewMode",()=>{this.setState(prev=>{const newMode=prev.viewMode==="raw"?"chat":"raw";if(newMode==="raw"){if(prev.selectedIndex===null){const filtered2=prev.showAll?prev.requests:filterRelevantRequests(prev.requests);return{viewMode:newMode,selectedIndex:filtered2.length>0?filtered2.length-1:null,scrollCenter:!0}}return{viewMode:newMode,scrollCenter:!0}}const filtered=prev.showAll?prev.requests:filterRelevantRequests(prev.requests),selectedReq=prev.selectedIndex!=null?filtered[prev.selectedIndex]:null;if(selectedReq){let targetTs=null;if(isMainAgent(selectedReq)&&selectedReq.timestamp)targetTs=selectedReq.timestamp;else{const cls=classifyRequest(selectedReq);if((cls.type==="SubAgent"||cls.type==="Teammate")&&selectedReq.timestamp)targetTs=selectedReq.timestamp;else{const idx=prev.requests.indexOf(selectedReq);idx>=0&&(targetTs=findPrevMainAgentTimestamp(prev.requests,idx)),targetTs||staticMethods.info(t("ui.cannotMap"))}}return{viewMode:newMode,chatScrollToTs:targetTs}}return{viewMode:newMode,chatScrollToTs:null}},()=>{this.state.viewMode==="chat"&&this.state.terminalVisible&&this.state.cliMode&&!isMobile&&requestAnimationFrame(()=>{const ta=document.querySelector(".xterm-helper-textarea");ta&&ta.focus()})})});__publicField(this,"handleTabChange",key=>{this.setState({currentTab:key})});__publicField(this,"handleCacheHighlightDone",()=>{this.setState({pendingCacheHighlight:null})});__publicField(this,"handleNavigateCacheMsg",msgIdx=>{const filteredRequests=this.state.showAll?this.state.requests:filterRelevantRequests(this.state.requests);let targetIdx=-1;for(let i=filteredRequests.length-1;i>=0;i--)if(isMainAgent(filteredRequests[i])){targetIdx=i;break}targetIdx<0||this.setState({selectedIndex:targetIdx,scrollCenter:!0,currentTab:"kv-cache-text",pendingCacheHighlight:{msgIdx,key:Date.now()}})});__publicField(this,"handleResize",clientX=>{const container2=this.mainContainerRef.current;if(!container2)return;const rect=container2.getBoundingClientRect(),newWidth=clientX-rect.left;newWidth>=250&&newWidth<=800&&this.setState({leftPanelWidth:newWidth})});__publicField(this,"handleLoadLocalJsonlFile",()=>{const input=document.createElement("input");input.type="file",input.accept=".jsonl",input.multiple=!0,input.onchange=e=>{const files=Array.from(e.target.files);if(files.length===0)return;if(files.reduce((s,f)=>s+f.size,0)>500*1024*1024){staticMethods.error(t("ui.fileTooLarge"));return}this.setState({fileLoading:!0,fileLoadingCount:0});let readCount=0;const allEntries=[],fileNames=[];files.forEach(file=>{const reader=new FileReader;reader.onload=ev=>{try{const entries=ev.target.result.split(`
28
+ ---
29
+ `).filter(line=>line.trim()).map(entry=>{try{return JSON.parse(entry)}catch{return null}}).filter(Boolean);allEntries.push(...entries),fileNames.push(file.name)}catch{}readCount++,readCount===files.length&&this._finishLocalLoad(allEntries,fileNames)},reader.readAsText(file)})},input.click()});__publicField(this,"_processJsonlFiles",files=>{if(!files||files.length===0)return;if(files.reduce((s,f)=>s+f.size,0)>500*1024*1024){staticMethods.error(t("ui.fileTooLarge"));return}this.setState({fileLoading:!0,fileLoadingCount:0});let readCount=0;const allEntries=[],fileNames=[];files.forEach(file=>{const reader=new FileReader;reader.onload=ev=>{try{const entries=ev.target.result.split(`
30
+ ---
31
+ `).filter(line=>line.trim()).map(entry=>{try{return JSON.parse(entry)}catch{return null}}).filter(Boolean);allEntries.push(...entries),fileNames.push(file.name)}catch{}readCount++,readCount===files.length&&this._finishLocalLoad(allEntries,fileNames)},reader.readAsText(file)})});__publicField(this,"_isInternalDrag",e=>e.dataTransfer.types.includes("text/x-preset-reorder"));__publicField(this,"_onDragOver",e=>{if(e.preventDefault(),this._isInternalDrag(e))return;if(e.target.closest&&e.target.closest("[data-file-explorer]")){this.state.isDragging&&this.setState({isDragging:!1});return}this.state.isDragging||this.setState({isDragging:!0})});__publicField(this,"_onDragLeave",e=>{const layout=this._layoutRef.current;layout&&!layout.contains(e.relatedTarget)&&this.setState({isDragging:!1})});__publicField(this,"_onDrop",e=>{if(e.preventDefault(),this._isInternalDrag(e))return;this.setState({isDragging:!1});const files=Array.from(e.dataTransfer.files);files.length&&Promise.all(files.map(file=>uploadFileAndGetPath(file).then(path=>({name:file.name,path})).catch(err=>(staticMethods.error(`${file.name}: ${err.message}`),null)))).then(results=>{const paths=results.filter(Boolean).map(r=>`"${r.path}"`);paths.length>0&&this.setState(prev=>({pendingUploadPaths:[...prev.pendingUploadPaths||[],...paths]}))})});__publicField(this,"handleUploadPathsConsumed",()=>{this.setState({pendingUploadPaths:[]})});Object.assign(this.state,{leftPanelWidth:380,terminalVisible:!0,currentTab:"context",pendingCacheHighlight:null})}componentDidMount(){super.componentDidMount(),this._mqlNarrow=window.matchMedia("(max-width: 600px)"),this._modeSwitchDialog=null,this._onNarrowChange=e=>{e.matches?this._modeSwitchDialog=Modal.confirm({title:t("ui.modeSwitchTitle"),content:t("ui.modeSwitchToSidebar"),okText:t("ui.ok"),onOk:()=>{this._modeSwitchDialog=null,setViewMode("pad")},onCancel:()=>{this._modeSwitchDialog=null}}):this._modeSwitchDialog&&(this._modeSwitchDialog.destroy(),this._modeSwitchDialog=null)},this._mqlNarrow.addEventListener("change",this._onNarrowChange)}componentWillUnmount(){this._mqlNarrow&&this._mqlNarrow.removeEventListener("change",this._onNarrowChange),this._modeSwitchDialog&&(this._modeSwitchDialog.destroy(),this._modeSwitchDialog=null),super.componentWillUnmount()}render(){const{filteredRequests,selectedRequest,fileLoading,fileLoadingCount,mainAgentSessions,viewMode}=this.renderPrepare(),{selectedIndex,leftPanelWidth,currentTab}=this.state;return this.state.workspaceMode?this.renderWorkspaceMode():jsxRuntimeExports.jsxs(ConfigProvider,{theme:this.themeConfig,children:[fileLoading&&jsxRuntimeExports.jsx("div",{className:styles$7.loadingOverlay,children:jsxRuntimeExports.jsxs("div",{className:styles$7.loadingText,children:["Loading...(",fileLoadingCount,")"]})}),this.state.isDragging&&jsxRuntimeExports.jsx("div",{className:styles$7.dragOverlay,children:jsxRuntimeExports.jsxs("div",{className:styles$7.dragOverlayContent,children:[jsxRuntimeExports.jsx(RefIcon$l,{className:styles$7.dragIcon}),jsxRuntimeExports.jsx("p",{children:t("ui.dragDropHint")})]})}),jsxRuntimeExports.jsxs(Layout,{className:styles$7.layout,ref:this._layoutRef,onDragOver:this._onDragOver,onDragLeave:this._onDragLeave,onDrop:this._onDrop,children:[jsxRuntimeExports.jsx(Layout.Header,{className:styles$7.header,children:jsxRuntimeExports.jsx(AppHeader,{requestCount:filteredRequests.length,requests:filteredRequests,viewMode,cacheExpireAt:this.state.cacheExpireAt,cacheType:this.state.cacheType,onToggleViewMode:this.handleToggleViewMode,onLangChange:this.handleLangChange,onImportLocalLogs:this.handleImportLocalLogs,isLocalLog:!!this._isLocalLog,localLogFile:this._localLogFile,projectName:this.state.projectName,collapseToolResults:this.state.collapseToolResults,onCollapseToolResultsChange:this.handleCollapseToolResultsChange,expandThinking:this.state.expandThinking,onExpandThinkingChange:this.handleExpandThinkingChange,showFullToolContent:this.state.showFullToolContent,onShowFullToolContentChange:this.handleShowFullToolContentChange,expandDiff:this.state.expandDiff,onExpandDiffChange:this.handleExpandDiffChange,filterIrrelevant:!this.state.showAll,onFilterIrrelevantChange:this.handleFilterIrrelevantChange,logDir:this.state.logDir,onLogDirChange:this.handleLogDirChange,updateInfo:this.state.updateInfo,onDismissUpdate:()=>this.setState({updateInfo:null}),cliMode:this.state.cliMode,sdkMode:this.state.sdkMode,terminalVisible:this.state.sdkMode?!1:this.state.terminalVisible,onToggleTerminal:()=>this.setState(prev=>({terminalVisible:!prev.terminalVisible})),onReturnToWorkspaces:this.state.cliMode?this.handleReturnToWorkspaces:null,contextWindow:this.state.contextWindow,onNavigateCacheMsg:this.handleNavigateCacheMsg,serverCachedContent:this.state.serverCachedContent||this._lastKvCacheContent,resumeAutoChoice:this.state.resumeAutoChoice,onResumeAutoChoiceToggle:this.handleResumeAutoChoiceToggle,onResumeAutoChoiceChange:this.handleResumeAutoChoiceChange,themeColor:this.state.themeColor,onThemeColorChange:this.handleThemeColorChange,autoApproveSeconds:this.state.autoApproveSeconds,onAutoApproveChange:this.handleAutoApproveChange,proxyProfiles:this.state.proxyProfiles,activeProxyId:this.state.activeProxyId,defaultConfig:this.state.defaultConfig,onProxyProfileChange:this.handleProxyProfileChange})}),this.state.claudeMissing&&jsxRuntimeExports.jsx(Alert,{type:"warning",showIcon:!0,banner:!0,message:t("ui.claudeMissing.title"),description:jsxRuntimeExports.jsxs("span",{children:[t("ui.claudeMissing.desc"),jsxRuntimeExports.jsx("br",{}),jsxRuntimeExports.jsx("code",{style:{background:"var(--bg-code)",padding:"2px 6px",borderRadius:3},children:"npm install -g @anthropic-ai/claude-code"})," ",jsxRuntimeExports.jsx("span",{style:{color:"var(--text-muted)",margin:"0 4px"},children:t("ui.claudeMissing.or")})," ",jsxRuntimeExports.jsx("a",{href:"https://claude.ai/download",target:"_blank",rel:"noopener noreferrer",style:{color:"var(--color-primary-light)"},children:t("ui.claudeMissing.native")})]})}),jsxRuntimeExports.jsxs(Layout.Content,{className:styles$7.content,children:[viewMode==="raw"&&(filteredRequests.length===0?jsxRuntimeExports.jsx("div",{className:styles$7.guideContainer,children:jsxRuntimeExports.jsxs("div",{className:styles$7.guideContent,children:[jsxRuntimeExports.jsx("h2",{className:styles$7.guideTitle,children:t("ui.guide.title")}),jsxRuntimeExports.jsxs("div",{className:styles$7.guideStep,children:[jsxRuntimeExports.jsx("div",{className:styles$7.guideStepNum,children:"1"}),jsxRuntimeExports.jsxs("div",{className:styles$7.guideStepBody,children:[jsxRuntimeExports.jsx("p",{className:styles$7.guideText,children:t("ui.guide.step1")}),jsxRuntimeExports.jsx("code",{className:styles$7.guideCode,children:t("ui.guide.exampleQuestion")})]})]}),jsxRuntimeExports.jsxs("div",{className:styles$7.guideStep,children:[jsxRuntimeExports.jsx("div",{className:styles$7.guideStepNum,children:"2"}),jsxRuntimeExports.jsxs("div",{className:styles$7.guideStepBody,children:[jsxRuntimeExports.jsx("p",{className:styles$7.guideText,children:t("ui.guide.step2")}),jsxRuntimeExports.jsx("code",{className:styles$7.guideCode,children:t("ui.guide.troubleshootCmd")})]})]}),jsxRuntimeExports.jsxs("div",{className:styles$7.guideStep,children:[jsxRuntimeExports.jsx("div",{className:styles$7.guideStepNum,children:"3"}),jsxRuntimeExports.jsxs("div",{className:styles$7.guideStepBody,children:[jsxRuntimeExports.jsx("p",{className:styles$7.guideText,children:t("ui.guide.step3")}),jsxRuntimeExports.jsx("code",{className:styles$7.guideCode,children:"npm install -g @anthropic-ai/claude-code"})]})]})]})}):jsxRuntimeExports.jsxs("div",{ref:this.mainContainerRef,className:styles$7.mainContainer,children:[jsxRuntimeExports.jsxs("div",{className:styles$7.leftPanel,style:{width:leftPanelWidth},children:[jsxRuntimeExports.jsxs("div",{className:styles$7.leftPanelHeader,children:[jsxRuntimeExports.jsx("span",{children:t("ui.requestList")}),jsxRuntimeExports.jsx("span",{className:styles$7.leftPanelCount,children:t("ui.totalRequests",{count:filteredRequests.length})})]}),jsxRuntimeExports.jsx("div",{className:styles$7.leftPanelBody,children:jsxRuntimeExports.jsx(RequestList,{requests:filteredRequests,selectedIndex,scrollCenter:this.state.scrollCenter,onSelect:this.handleSelectRequest,onScrollDone:this.handleScrollDone,cacheLossMap:this._cacheLossMap})})]}),jsxRuntimeExports.jsx(PanelResizer,{onResize:this.handleResize}),jsxRuntimeExports.jsx("div",{className:styles$7.rightPanel,children:jsxRuntimeExports.jsx(DetailPanel,{request:selectedRequest,requests:filteredRequests,allRequests:this.state.requests,selectedIndex,currentTab,onTabChange:this.handleTabChange,onViewInChat:this.handleViewInChat,expandDiff:this.state.expandDiff,pendingCacheHighlight:this.state.pendingCacheHighlight,onCacheHighlightDone:this.handleCacheHighlightDone})})]})),jsxRuntimeExports.jsx("div",{className:styles$7.chatViewWrapper,style:{display:viewMode==="chat"?"flex":"none"},children:jsxRuntimeExports.jsx(ChatView,{requests:filteredRequests,mainAgentSessions,streamingLatest:this.state.streamingLatest,userProfile:this.state.userProfile,collapseToolResults:this.state.collapseToolResults,expandThinking:this.state.expandThinking,showFullToolContent:this.state.showFullToolContent,showThinkingSummaries:this.state.showThinkingSummaries,onViewRequest:this.handleViewRequest,scrollToTimestamp:this.state.chatScrollToTs,onScrollTsDone:this.handleScrollTsDone,cliMode:this._isLocalLog?!1:this.state.cliMode,sdkMode:this._isLocalLog?!1:this.state.sdkMode,terminalVisible:this._isLocalLog||this.state.sdkMode?!1:this.state.terminalVisible,onToggleTerminal:()=>this.setState(prev=>({terminalVisible:!prev.terminalVisible})),pendingUploadPaths:this.state.pendingUploadPaths,onUploadPathsConsumed:this.handleUploadPathsConsumed,fileLoading:this.state.fileLoading,isStreaming:this.state.isStreaming,hasMoreHistory:this.state.hasMoreHistory,loadingMore:this.state.loadingMore,onLoadMoreHistory:()=>this.loadMoreHistory(),loadingSessionId:this.state.loadingSessionId,onLoadSession:sid=>this.loadSession(sid),lang:this.state.lang,autoApproveSeconds:this.state.autoApproveSeconds,onAutoApproveChange:this.handleAutoApproveChange})})]}),jsxRuntimeExports.jsx("div",{className:styles$7.footer,children:jsxRuntimeExports.jsxs("div",{className:styles$7.footerRight,children:[jsxRuntimeExports.jsxs("a",{href:"https://github.com/weiesky/cc-viewer",target:"_blank",rel:"noopener noreferrer",className:styles$7.footerLink,children:[jsxRuntimeExports.jsx("svg",{className:styles$7.footerIcon,viewBox:"0 0 16 16",fill:"currentColor",children:jsxRuntimeExports.jsx("path",{d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"})}),"GitHub",this.state.githubStars!=null?` ★ ${this.state.githubStars}`:""]}),jsxRuntimeExports.jsx("span",{className:styles$7.footerSep,children:"|"}),jsxRuntimeExports.jsxs("span",{className:`${styles$7.footerVersion}${this.state.updateInfo?` ${styles$7.footerVersionNew}`:""}`,onClick:()=>this.setState({updateModalVisible:!0}),style:{cursor:"pointer"},children:["v","1.6.192",this.state.updateInfo&&jsxRuntimeExports.jsxs("svg",{className:styles$7.newBadge,width:"28",height:"12",viewBox:"0 0 28 12",children:[jsxRuntimeExports.jsx("rect",{width:"28",height:"12",rx:"3",fill:"currentColor",opacity:"0.25"}),jsxRuntimeExports.jsx("text",{x:"14",y:"9",textAnchor:"middle",fill:"currentColor",fontSize:"8",fontWeight:"600",fontFamily:"system-ui",children:"NEW"})]})]})]})})]}),jsxRuntimeExports.jsx(Modal,{title:t("ui.update.title"),open:this.state.updateModalVisible,onCancel:()=>this.setState({updateModalVisible:!1}),footer:null,width:480,children:jsxRuntimeExports.jsxs("div",{style:{lineHeight:1.8},children:[jsxRuntimeExports.jsxs("p",{children:[jsxRuntimeExports.jsxs("strong",{children:[t("ui.update.current"),":"]})," v","1.6.192"]}),this.state.updateInfo&&jsxRuntimeExports.jsxs("p",{children:[jsxRuntimeExports.jsxs("strong",{children:[t("ui.update.latest"),":"]})," v",this.state.updateInfo.version]}),jsxRuntimeExports.jsx("p",{style:{marginTop:12},children:jsxRuntimeExports.jsx("strong",{children:t("ui.update.npm")})}),jsxRuntimeExports.jsx("code",{style:{display:"block",background:"var(--bg-code)",padding:"8px 12px",borderRadius:6,fontSize:13},children:"npm update -g cc-viewer"}),typeof window<"u"&&window.electronAPI&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("p",{style:{marginTop:16},children:jsxRuntimeExports.jsx("strong",{children:t("ui.update.electron")})}),jsxRuntimeExports.jsx("p",{style:{color:"var(--text-tertiary)",fontSize:13},children:t("ui.update.electronDesc")}),jsxRuntimeExports.jsxs("ol",{style:{color:"var(--text-tertiary)",fontSize:13,paddingLeft:20,margin:"6px 0"},children:[jsxRuntimeExports.jsx("li",{children:t("ui.update.step1")}),jsxRuntimeExports.jsx("li",{children:t("ui.update.step2")}),jsxRuntimeExports.jsx("li",{children:t("ui.update.step3")})]})]}),jsxRuntimeExports.jsx("div",{style:{marginTop:16,textAlign:"right"},children:jsxRuntimeExports.jsx(Button,{type:"primary",href:"https://github.com/weiesky/cc-viewer/releases",target:"_blank",rel:"noopener noreferrer",children:t("ui.update.goReleases")})})]})}),jsxRuntimeExports.jsx(Modal,{title:t("ui.resume.title"),open:this.state.resumeModalVisible,closable:!1,maskClosable:!1,keyboard:!1,footer:jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsxs("div",{className:styles$7.resumeFooterRight,children:[jsxRuntimeExports.jsx(Button,{type:"primary",onClick:()=>this.handleResumeChoice("continue"),className:styles$7.btnMarginRight,children:t("ui.resume.continue")},"continue"),jsxRuntimeExports.jsx(Button,{onClick:()=>this.handleResumeChoice("new"),children:t("ui.resume.new")},"new")]}),jsxRuntimeExports.jsx("div",{className:styles$7.resumeFooterLeft,children:jsxRuntimeExports.jsx(Checkbox,{checked:this.state.resumeRememberChoice,onChange:e=>this.setState({resumeRememberChoice:e.target.checked}),className:styles$7.resumeCheckboxOpacity,children:jsxRuntimeExports.jsx("span",{className:styles$7.resumeCheckboxOpacity,children:t("ui.resume.remember")})})})]}),children:jsxRuntimeExports.jsx("p",{children:t("ui.resume.message",{file:this.state.resumeFileName})})}),jsxRuntimeExports.jsxs(Modal,{title:jsxRuntimeExports.jsxs("span",{className:styles$7.modalTitleInline,children:[jsxRuntimeExports.jsx(OpenFolderIcon,{apiEndpoint:apiUrl("/api/open-log-dir"),title:t("ui.openLogDir"),size:16}),t("ui.importLocalLogs")]}),open:this.state.importModalVisible,onCancel:this.handleCloseImportModal,footer:null,width:1e3,styles:{body:{overflow:"hidden"}},children:[jsxRuntimeExports.jsxs("div",{className:styles$7.modalActions,children:[jsxRuntimeExports.jsx(Button,{icon:jsxRuntimeExports.jsx(RefIcon$l,{}),onClick:this.handleLoadLocalJsonlFile,children:t("ui.loadLocalJsonl")}),jsxRuntimeExports.jsx(Button,{size:"small",type:this.state.selectedLogs.size>1?"primary":"default",disabled:this.state.selectedLogs.size<2,onClick:this.handleMergeLogs,className:styles$7.btnMarginLeft,children:t("ui.mergeLogs")}),jsxRuntimeExports.jsx(Button,{size:"small",danger:!0,icon:jsxRuntimeExports.jsx(RefIcon$d,{}),disabled:this.state.selectedLogs.size===0,onClick:this.handleDeleteLogs,className:styles$7.btnMarginLeft,children:t("ui.deleteLogs")}),jsxRuntimeExports.jsx(Button,{size:"small",icon:jsxRuntimeExports.jsx(RefIcon$f,{spin:this.state.refreshingStats}),loading:this.state.refreshingStats,onClick:this.handleRefreshStats,className:styles$7.btnMarginLeft,children:t("ui.refreshStats")})]}),this.state.localLogsLoading?jsxRuntimeExports.jsx("div",{className:styles$7.spinCenter,children:jsxRuntimeExports.jsx(Spin,{})}):(()=>{const currentLogs=this.state.localLogs[this.state.currentProject];return!currentLogs||currentLogs.length===0?jsxRuntimeExports.jsx("div",{className:styles$7.emptyCenter,children:t("ui.noLogs")}):jsxRuntimeExports.jsx("div",{className:styles$7.logListContainer,children:this.renderLogTable(currentLogs,!1)})})()]})]})}}export{App as default};