@organizaone/o1-code 0.14.1 → 0.15.1

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 (277) hide show
  1. package/bundled/qc-helper/docs/configuration/settings.md +9 -4
  2. package/bundled/qc-helper/docs/features/commands.md +45 -44
  3. package/bundled/qc-helper/docs/features/remote-sessions.md +102 -0
  4. package/bundled/qc-helper/docs/support/troubleshooting.md +4 -0
  5. package/chunks/{MaxSizedBox-K6LS4AHI.js → MaxSizedBox-WCIHTA5J.js} +20 -20
  6. package/chunks/{StandaloneSessionPicker-VAKM7ZGE.js → StandaloneSessionPicker-FPZOMXZZ.js} +37 -37
  7. package/chunks/{acp-subagent-executor-VUIOR2ET.js → acp-subagent-executor-NZEXVO6C.js} +22 -22
  8. package/chunks/{acpAgent-NJVBZXCP.js → acpAgent-5C3S3EXK.js} +63 -63
  9. package/chunks/{agent-VHLE7AET.js → agent-OUKS3KJA.js} +11 -11
  10. package/chunks/{agent-headless-BJF6NKGR.js → agent-headless-MXWPFKRF.js} +11 -11
  11. package/chunks/{all-providers-3TZIHJW7.js → all-providers-U3R3R6E7.js} +2 -2
  12. package/chunks/{anthropicContentGenerator-VB7JA4B3.js → anthropicContentGenerator-HSU2Y3YE.js} +5 -5
  13. package/chunks/{bridge-3FUGH7LN.js → bridge-JHBIMGIY.js} +22 -22
  14. package/chunks/{chunk-M6VRFWLT.js → chunk-25JT53JK.js} +2 -2
  15. package/chunks/{chunk-N5LF4EE4.js → chunk-2EAL2FHY.js} +4 -4
  16. package/chunks/{chunk-HBB3LYMT.js → chunk-2IMNI647.js} +1 -1
  17. package/chunks/{chunk-MFPRAXI5.js → chunk-2SSQSUD7.js} +1 -1
  18. package/chunks/{chunk-KCHIGNQ3.js → chunk-3AF7X2MG.js} +1 -1
  19. package/chunks/{chunk-YPFJPIKO.js → chunk-3HY7YVUK.js} +202 -31
  20. package/chunks/{chunk-RBN3RLF6.js → chunk-3XGM4GXG.js} +13 -13
  21. package/chunks/{chunk-JNEJLREI.js → chunk-3ZMBFNPV.js} +1 -1
  22. package/chunks/{chunk-A643DATS.js → chunk-4WWJCEWY.js} +9 -6
  23. package/chunks/{chunk-AWE7GF4J.js → chunk-54M5TQ2R.js} +3 -3
  24. package/chunks/{chunk-SMZJAMZI.js → chunk-56HAFFVR.js} +7 -7
  25. package/chunks/{chunk-6VO6YKJ3.js → chunk-5KPMPTTM.js} +1 -1
  26. package/chunks/{chunk-YSK3J7RQ.js → chunk-6JA47LCQ.js} +1 -1
  27. package/chunks/{chunk-2EGCBKYN.js → chunk-6JTVWRDH.js} +1 -1
  28. package/chunks/{chunk-5WA2C3YU.js → chunk-75RB6EGS.js} +1 -1
  29. package/chunks/{chunk-I4J3GC2D.js → chunk-7TWCFU7L.js} +1 -1
  30. package/chunks/{chunk-XS3QHNTA.js → chunk-7XOIEIK2.js} +4 -4
  31. package/chunks/{chunk-TIYFDYIF.js → chunk-AEGEUWVC.js} +1 -1
  32. package/chunks/{chunk-WORDJV7E.js → chunk-AYCEQ2OH.js} +2 -2
  33. package/chunks/{chunk-3C53Y3EH.js → chunk-BAY2S4AG.js} +5 -5
  34. package/chunks/{chunk-3HS7IEMU.js → chunk-BIINRKJD.js} +1 -1
  35. package/chunks/{chunk-5EQBVEDH.js → chunk-BL4MZ3ZG.js} +3 -3
  36. package/chunks/{chunk-HVXQBQY4.js → chunk-C4SR35GB.js} +1 -1
  37. package/chunks/{chunk-TM5ELIJT.js → chunk-CO3SD65V.js} +3 -3
  38. package/chunks/{chunk-5RGWMVLI.js → chunk-CPQMNYBE.js} +2 -2
  39. package/chunks/{chunk-VJCVMHU2.js → chunk-CYDSNNR5.js} +7 -7
  40. package/chunks/{chunk-Q3275KQT.js → chunk-DA4GEY74.js} +12 -2
  41. package/chunks/{chunk-4OYDPQIT.js → chunk-DPVWZLJW.js} +3 -3
  42. package/chunks/{chunk-DKDXWZAA.js → chunk-DTJHPTCP.js} +2 -2
  43. package/chunks/{chunk-KXUAXTBE.js → chunk-DWX6K4EP.js} +1 -1
  44. package/chunks/{chunk-5LMV3DCZ.js → chunk-ECBJ5FS3.js} +2 -2
  45. package/chunks/{chunk-2V7HIDQH.js → chunk-F3TYA6UD.js} +2 -2
  46. package/chunks/{chunk-JIF2TEKH.js → chunk-FBXM55GQ.js} +1 -1
  47. package/chunks/{chunk-32O4NVPN.js → chunk-FO2XIE6X.js} +13 -13
  48. package/chunks/{chunk-ND36AMUP.js → chunk-FQSMZJTY.js} +1 -1
  49. package/chunks/{chunk-5VNWNZZ4.js → chunk-G3GZR2GB.js} +1 -1
  50. package/chunks/{chunk-MZ3XMTPL.js → chunk-G3TMBRML.js} +1 -1
  51. package/chunks/{chunk-4ENDHWP4.js → chunk-G7JLEAIF.js} +55 -2
  52. package/chunks/{chunk-JSAYXOQE.js → chunk-GBEDSUAL.js} +2 -2
  53. package/chunks/{chunk-3UNHYRK5.js → chunk-H656RRY6.js} +8 -8
  54. package/chunks/{chunk-GVGCZY46.js → chunk-HGUMEOGA.js} +4 -4
  55. package/chunks/{chunk-CSPWXNJC.js → chunk-HWUZG6HM.js} +2 -2
  56. package/chunks/{chunk-GHM4HUC7.js → chunk-IKQ3LPTK.js} +3 -3
  57. package/chunks/{chunk-SGMEBT6K.js → chunk-IN4QTEKF.js} +2 -2
  58. package/chunks/{chunk-DBH5ZQ3X.js → chunk-JAPK5MIN.js} +3 -3
  59. package/chunks/{chunk-WBPIFM2X.js → chunk-JKXGHDQ2.js} +551 -5
  60. package/chunks/{chunk-ZZVIBILR.js → chunk-KEPNWFUD.js} +9 -1
  61. package/chunks/{chunk-URRLGWTK.js → chunk-LFUSSHHB.js} +1 -1
  62. package/chunks/{chunk-ZHJX6KFO.js → chunk-M2W6Q7ZY.js} +8 -2
  63. package/chunks/{chunk-74D4F6ZR.js → chunk-M5PBINBK.js} +1 -1
  64. package/chunks/{chunk-YSHODLWP.js → chunk-MDXRSVFU.js} +3 -3
  65. package/chunks/{chunk-7N5GDAXK.js → chunk-MLAF3GLB.js} +3 -0
  66. package/chunks/{chunk-JFWM2L2S.js → chunk-MMM4JHDL.js} +2 -2
  67. package/chunks/{chunk-VVJHO662.js → chunk-MXUFKTRV.js} +3 -3
  68. package/chunks/{chunk-HHMGHAVL.js → chunk-NAURON7F.js} +1 -1
  69. package/chunks/{chunk-WB2AB6LU.js → chunk-NC333V4Q.js} +2 -2
  70. package/chunks/{chunk-SHIS7KCU.js → chunk-NQHJ4XI4.js} +2 -2
  71. package/chunks/{chunk-XX4IZ2SW.js → chunk-NTATN4NC.js} +5 -5
  72. package/chunks/{chunk-LPFK3TO2.js → chunk-O6GD6SFV.js} +4 -0
  73. package/chunks/{chunk-P2AKC25G.js → chunk-OQ5UCQEU.js} +1 -1
  74. package/chunks/{chunk-ACVOTRTG.js → chunk-PB4JDMEU.js} +73 -33
  75. package/chunks/{chunk-EJWEWKFL.js → chunk-PZA6OK5U.js} +2 -2
  76. package/chunks/{chunk-T7FPP3WA.js → chunk-QCKD7NUE.js} +293 -62
  77. package/chunks/{chunk-62X5BQMO.js → chunk-QHZJAK26.js} +5 -5
  78. package/chunks/{chunk-MPL3BISR.js → chunk-QINR3BPI.js} +3 -3
  79. package/chunks/{chunk-R2EIRELD.js → chunk-QJOAE3MY.js} +2 -2
  80. package/chunks/{chunk-XFQMTQBE.js → chunk-QPATMMH6.js} +10 -10
  81. package/chunks/{chunk-N6MH3XSG.js → chunk-THF6QN43.js} +2 -2
  82. package/chunks/{chunk-NSHGO4SD.js → chunk-TIJEMBWQ.js} +1 -1
  83. package/chunks/{chunk-Q27JDWE5.js → chunk-TPTKSRDS.js} +2 -2
  84. package/chunks/{chunk-7OFHGQYG.js → chunk-TSWAMCTA.js} +2 -2
  85. package/chunks/{chunk-BFCJISSV.js → chunk-U3TAPXNY.js} +2 -2
  86. package/chunks/{chunk-DXNQVFM7.js → chunk-UBBF6OHF.js} +1 -1
  87. package/chunks/{chunk-QXTSKDFW.js → chunk-UUYHAE7L.js} +2 -2
  88. package/chunks/{chunk-5A5PF6UU.js → chunk-UZO5EWDY.js} +1 -1
  89. package/chunks/{chunk-BWSTJ4LI.js → chunk-V5FMJGT3.js} +3 -3
  90. package/chunks/{chunk-XUJZPD2H.js → chunk-VCR2ZMBJ.js} +3 -3
  91. package/chunks/{chunk-XS3WCMRG.js → chunk-VOC5JURN.js} +1 -1
  92. package/chunks/{chunk-ACL45DSG.js → chunk-VOHQDSSM.js} +5 -5
  93. package/chunks/{chunk-URNH2X7M.js → chunk-VT4QNRKU.js} +4 -4
  94. package/chunks/{chunk-X7TMJR6A.js → chunk-VWNJNOMV.js} +4 -4
  95. package/chunks/{chunk-SRDLL4JM.js → chunk-W5MVK3CY.js} +3 -3
  96. package/chunks/{chunk-5YPMVUV3.js → chunk-WN5SRYTJ.js} +5 -5
  97. package/chunks/{chunk-NQH5WCUX.js → chunk-WSJ2ZA4C.js} +7 -7
  98. package/chunks/{chunk-JJPU5RIJ.js → chunk-Y3JWAVRJ.js} +1 -1
  99. package/chunks/{chunk-JDJVJMXU.js → chunk-YOQXJIDM.js} +2 -2
  100. package/chunks/{chunk-GAEZNPGF.js → chunk-YSXZMF2B.js} +3 -3
  101. package/chunks/{chunk-R2Q36SDT.js → chunk-ZHEOV5HE.js} +1 -1
  102. package/chunks/{chunk-Z277EETV.js → chunk-ZIULS3Z4.js} +1 -1
  103. package/chunks/{chunk-NWQNQ2JQ.js → chunk-ZLILADLQ.js} +5 -5
  104. package/chunks/{chunk-FUA6Z2U4.js → chunk-ZZTHZM2I.js} +1 -1
  105. package/chunks/{codex-subagent-executor-NGTRWYIK.js → codex-subagent-executor-AHUDSG4Y.js} +22 -22
  106. package/chunks/{contextCommand-7GVOH5VF.js → contextCommand-XGDON2S3.js} +22 -22
  107. package/chunks/{core-runtime-POJAS25N.js → core-runtime-TBFHSDHQ.js} +20 -20
  108. package/chunks/{create-sub-session-QCYXUHFL.js → create-sub-session-I5GYJEYY.js} +21 -21
  109. package/chunks/{daemon-git-worktree-guard-D3RHUHVC.js → daemon-git-worktree-guard-ZOB5RPFK.js} +20 -20
  110. package/chunks/{daemon-status-provider-R3KRR4AS.js → daemon-status-provider-FGZH6W4M.js} +26 -26
  111. package/chunks/{daemon-trust-policy-5NYWDYOB.js → daemon-trust-policy-QFXVDRS7.js} +27 -27
  112. package/chunks/{daemon-trust-policy-monitor-I73M3BZX.js → daemon-trust-policy-monitor-XEGSMSQ2.js} +27 -27
  113. package/chunks/{deferred-core-runtime-S2JMS2IS.js → deferred-core-runtime-NRNCEWYK.js} +20 -20
  114. package/chunks/{edit-FAI2CHTP.js → edit-RTNEVAS4.js} +13 -13
  115. package/chunks/{en-SHMOSKM6.js → en-IMODPCQQ.js} +49 -1
  116. package/chunks/{enterPlanMode-KX7IPPYT.js → enterPlanMode-CDLYJQDN.js} +11 -11
  117. package/chunks/{environment-MVOVD7JZ.js → environment-NXOZD6YO.js} +23 -23
  118. package/chunks/{errors-DSEHKEKP.js → errors-Z5K742KC.js} +22 -22
  119. package/chunks/{execution-tool-XRAFGCPA.js → execution-tool-AEINPRPE.js} +13 -13
  120. package/chunks/{execution-worker-VKPVJNIG.js → execution-worker-5KA2DSDN.js} +16 -16
  121. package/chunks/{exitPlanMode-3TY5ONOY.js → exitPlanMode-PQ57IF6L.js} +11 -11
  122. package/chunks/{fast-path-NAKYI5AD.js → fast-path-YBLVVROI.js} +3 -3
  123. package/chunks/{fast-path-settings-YKLDHHCG.js → fast-path-settings-FIMIXD3V.js} +2 -2
  124. package/chunks/{glob-7WS7EQ5K.js → glob-CTWTSEIV.js} +11 -11
  125. package/chunks/{goal-tools-5WVEBKPG.js → goal-tools-54BPLUQN.js} +11 -11
  126. package/chunks/{handleAutoUpdate-PDYNM2OD.js → handleAutoUpdate-Z4SSSZ2E.js} +23 -23
  127. package/chunks/{i18n-C475G3CR.js → i18n-YZNEGDIL.js} +21 -21
  128. package/chunks/{initializer-U77RJ3RD.js → initializer-3OVUOMDI.js} +27 -27
  129. package/chunks/{installationInfo-KJT5UHT6.js → installationInfo-ELJ2EVAQ.js} +20 -20
  130. package/chunks/{list-B5DL4CMZ.js → list-HOPL7DZF.js} +29 -29
  131. package/chunks/{list-agents-NYXZC74C.js → list-agents-A7UJ6VXZ.js} +2 -2
  132. package/chunks/{llm-V3GR2JCY.js → llm-V2XIIRDV.js} +53 -53
  133. package/chunks/{llm-content-generator-WSOLYSIS.js → llm-content-generator-5YWGTM5P.js} +4 -4
  134. package/chunks/{loadedSettingsAdapter-RUVHFDOM.js → loadedSettingsAdapter-CJLTFJ4N.js} +27 -27
  135. package/chunks/{local-execution-environment-ODOGTJ6F.js → local-execution-environment-EIWDLRAH.js} +16 -16
  136. package/chunks/{loggingContentGenerator-DLRB334C.js → loggingContentGenerator-7BF4GJCS.js} +12 -12
  137. package/chunks/{managed-npm-update-NQTZYPEF.js → managed-npm-update-WITECQFC.js} +20 -20
  138. package/chunks/{mcp-WCOE7Y3F.js → mcp-T4PROT4K.js} +27 -27
  139. package/chunks/{model-call-collection-X2EWPR6V.js → model-call-collection-XR3R3VVM.js} +1 -1
  140. package/chunks/{model-configuration-BUJWNHTG.js → model-configuration-HMBGB7SA.js} +28 -28
  141. package/chunks/{modelConfigUtils-HLTTOLV5.js → modelConfigUtils-3CK424YK.js} +22 -22
  142. package/chunks/{monitor-R5SGEUKX.js → monitor-6OK5CF7B.js} +11 -11
  143. package/chunks/{nonInteractiveCli-TKBS5ML2.js → nonInteractiveCli-RIK2HQON.js} +55 -55
  144. package/chunks/{nonInteractiveToolExecutor-JJFTNXHA.js → nonInteractiveToolExecutor-MC2XGWHT.js} +12 -12
  145. package/chunks/{notebook-edit-33OGSCHE.js → notebook-edit-IIZUM2QQ.js} +12 -12
  146. package/chunks/{omni-CMDCQ3UQ.js → omni-ZNA6SYTJ.js} +9 -9
  147. package/chunks/{openaiContentGenerator-M5UV2BQJ.js → openaiContentGenerator-UU7GV5FP.js} +7 -7
  148. package/chunks/{openaiResponsesContentGenerator-S5ECTVDG.js → openaiResponsesContentGenerator-BCC47KF7.js} +4 -4
  149. package/chunks/{processUtils-GDZ7TOHZ.js → processUtils-PHZAU2FF.js} +2 -2
  150. package/chunks/{prompt-terminal-ledger-PGEHFQ7H.js → prompt-terminal-ledger-DTT42BN5.js} +21 -21
  151. package/chunks/{pt-IU7FRCNS.js → pt-JCXCCW4Y.js} +49 -1
  152. package/chunks/{reactive-degrade-ASMEPJ5Z.js → reactive-degrade-IO4MRXRH.js} +8 -8
  153. package/chunks/{read-file-2EDHAVNT.js → read-file-5ACDU2YQ.js} +1 -1
  154. package/chunks/{resumeHistoryUtils-QW3OYHXI.js → resumeHistoryUtils-K4TUEBRE.js} +24 -24
  155. package/chunks/{ripGrep-76TJJQGO.js → ripGrep-WLW256L7.js} +1 -1
  156. package/chunks/{run-o1-code-serve-WIDKXLJF.js → run-o1-code-serve-XNXL6BGH.js} +34 -34
  157. package/chunks/{sandboxConfig-R3UG3IOZ.js → sandboxConfig-6ERJ2VSP.js} +20 -20
  158. package/chunks/{scheduled-tasks-4UBCLNXS.js → scheduled-tasks-IQLWO7QP.js} +25 -25
  159. package/chunks/{scheduler-AH4TSEXQ.js → scheduler-YM3RUYQT.js} +22 -22
  160. package/chunks/{send-message-OSS7K7GE.js → send-message-H6B5EST3.js} +2 -2
  161. package/chunks/{serve-A4BJAAZE.js → serve-Q5A4XGNN.js} +27 -27
  162. package/chunks/{server-ZDI6GJOC.js → server-DUQGQKW7.js} +52 -52
  163. package/chunks/{session-DK3CRCPB.js → session-L7J2BJ4B.js} +56 -56
  164. package/chunks/{session-J5MWNWYV.js → session-MECHV24O.js} +2 -2
  165. package/chunks/{session-attachments-root-44FEUUR2.js → session-attachments-root-T6YBSJ3U.js} +20 -20
  166. package/chunks/{session-pr-refresh-ZGKQBFME.js → session-pr-refresh-HHPFHEXI.js} +24 -24
  167. package/chunks/{settings-FAWXGNOI.js → settings-PQ7U5ALA.js} +26 -26
  168. package/chunks/{shell-2TAJP2XL.js → shell-CVULXL34.js} +11 -11
  169. package/chunks/{skill-DNIK7OZQ.js → skill-TA4CALBL.js} +1 -1
  170. package/chunks/{skill-settings-AK7CSZAS.js → skill-settings-5CMBXYNQ.js} +26 -26
  171. package/chunks/{spawnChannel-IOCLK2X3.js → spawnChannel-LT5O6P3J.js} +21 -21
  172. package/chunks/{standalone-update-DVOARXLA.js → standalone-update-ITMWGCH5.js} +22 -22
  173. package/chunks/{startInteractiveUI-NTVZYIDU.js → startInteractiveUI-JB2KE65F.js} +3881 -2676
  174. package/chunks/{team-create-XP7DRQAK.js → team-create-FAWOEYNL.js} +11 -11
  175. package/chunks/{team-plan-approval-GOAS57I3.js → team-plan-approval-3T7EVWTL.js} +11 -11
  176. package/chunks/{terminal-image-renderer-YCLREPL4.js → terminal-image-renderer-VHUUIAKF.js} +20 -20
  177. package/chunks/{theme-manager-XVYTKW34.js → theme-manager-ZFTUPCOT.js} +20 -20
  178. package/chunks/{tool-result-media-RGRXVT5T.js → tool-result-media-77JB2L2U.js} +9 -9
  179. package/chunks/{tool-search-ZMAKKG5I.js → tool-search-QHLD7GJT.js} +1 -1
  180. package/chunks/{total-session-admission-I5UDK7FQ.js → total-session-admission-6XKHQLLL.js} +22 -22
  181. package/chunks/{trustedFolders-QTPG7HMS.js → trustedFolders-XTVMYO3M.js} +21 -21
  182. package/chunks/{update-relaunch-SGPQQMNN.js → update-relaunch-2DU52FES.js} +5 -5
  183. package/chunks/{updateCheck-T5ZZGRHM.js → updateCheck-7KC26GUX.js} +22 -22
  184. package/chunks/{upload-config-EZ62EOKL.js → upload-config-HMSU4CZP.js} +6 -6
  185. package/chunks/{useAutoAcceptIndicator-JF6JC7LL.js → useAutoAcceptIndicator-NRR52JRP.js} +29 -29
  186. package/chunks/{validateNonInterActiveAuth-S6X4XLNK.js → validateNonInterActiveAuth-VVX3IIDW.js} +52 -52
  187. package/chunks/{version-7F4SOHPI.js → version-EBHPPTUN.js} +1 -1
  188. package/chunks/{web-fetch-OO7L367T.js → web-fetch-DB6YX73X.js} +1 -1
  189. package/chunks/{web-search-VN7PBUQ6.js → web-search-5N6YFNQL.js} +7 -7
  190. package/chunks/{workflow-IWSW5MOB.js → workflow-2U3MBIGP.js} +12 -12
  191. package/chunks/{workspace-providers-status-ZVH5MCVN.js → workspace-providers-status-P34L7WWU.js} +31 -31
  192. package/chunks/{workspace-registration-store-ROZOUOYK.js → workspace-registration-store-DRQK7E65.js} +1 -1
  193. package/chunks/{workspace-registry-CROM24XQ.js → workspace-registry-6IQR6KH7.js} +22 -22
  194. package/chunks/{workspace-runtime-coordinator-NAE37OW5.js → workspace-runtime-coordinator-UY5H2H6F.js} +22 -22
  195. package/chunks/{workspace-service-VUQF5IQG.js → workspace-service-T4U4M57B.js} +30 -30
  196. package/chunks/{workspace-skills-status-DLRICTEZ.js → workspace-skills-status-EZB7FZDA.js} +27 -27
  197. package/chunks/{workspace-trust-reconciler-ZUL5PMCB.js → workspace-trust-reconciler-FW7PNFE7.js} +29 -29
  198. package/chunks/{write-file-5SDNS6TZ.js → write-file-4IU4MIDG.js} +13 -13
  199. package/chunks/{zoom-image-PCKYJ2PJ.js → zoom-image-AIPZJAB4.js} +1 -1
  200. package/cli.js +13 -13
  201. package/execution-worker.js +1 -1
  202. package/export-transcript-document.js +1 -1
  203. package/locales/en.js +75 -0
  204. package/locales/pt.js +77 -0
  205. package/package.json +2 -2
  206. package/release-notes.json +11 -0
  207. package/vendor/o1-connect/.lintstagedrc.mjs +7 -0
  208. package/vendor/o1-connect/README.md +9 -8
  209. package/vendor/o1-connect/VENDOR.json +4 -4
  210. package/vendor/o1-connect/lib.d.mts +124 -2
  211. package/vendor/o1-connect/lib.mjs +532 -7
  212. package/vendor/tree-sitter/tree-sitter-bash.wasm +0 -0
  213. package/vendor/tree-sitter/tree-sitter.wasm +0 -0
  214. package/web-shell/assets/{abnfDiagram-VCTEODGH-BbovwPw2.js → abnfDiagram-VCTEODGH-8zBYfkj0.js} +1 -1
  215. package/web-shell/assets/{arc-Wui7aPtG.js → arc-Dr7frfgI.js} +1 -1
  216. package/web-shell/assets/{architectureDiagram-5GKGNRK7-3WH5ESB7.js → architectureDiagram-5GKGNRK7-Dw0TobFx.js} +1 -1
  217. package/web-shell/assets/{blockDiagram-NRAW4CY4-C36UiMl-.js → blockDiagram-NRAW4CY4-vKHZF19g.js} +1 -1
  218. package/web-shell/assets/{c4Diagram-UCG6FXSJ-DdnwgcM1.js → c4Diagram-UCG6FXSJ-BTDDLR0b.js} +1 -1
  219. package/web-shell/assets/channel-BDp9YKm9.js +1 -0
  220. package/web-shell/assets/{chunk-2Q5K7J3B-khFNk3ao.js → chunk-2Q5K7J3B-Boqx2Q3v.js} +1 -1
  221. package/web-shell/assets/{chunk-5VM5RSS4-DDLDZsfl.js → chunk-5VM5RSS4-tKCWS0Nx.js} +1 -1
  222. package/web-shell/assets/{chunk-F27PBJKO-aLJmSbub.js → chunk-F27PBJKO-C6NkGIMe.js} +1 -1
  223. package/web-shell/assets/{chunk-G27WJ6UU-B_GSvc5F.js → chunk-G27WJ6UU-ChQxnaEI.js} +1 -1
  224. package/web-shell/assets/{chunk-JWPE2WC7-d8m9ubln.js → chunk-JWPE2WC7-DAhrR7V5.js} +1 -1
  225. package/web-shell/assets/{chunk-LCL6LL3I-Bf5h6VmG.js → chunk-LCL6LL3I-DQgb43EV.js} +1 -1
  226. package/web-shell/assets/{chunk-POPQ4Y6H-Czd6y3Dp.js → chunk-POPQ4Y6H-DdSgsFCr.js} +1 -1
  227. package/web-shell/assets/{chunk-SVP7TREG-B03axGPa.js → chunk-SVP7TREG-CsyENxwm.js} +1 -1
  228. package/web-shell/assets/{chunk-XXDRQBXY-N33vsGyF.js → chunk-XXDRQBXY-h3qkgMY3.js} +1 -1
  229. package/web-shell/assets/classDiagram-DTDB5LWJ-DOReB-DE.js +1 -0
  230. package/web-shell/assets/classDiagram-v2-JRS7N3AN-DOReB-DE.js +1 -0
  231. package/web-shell/assets/{cose-bilkent-JH36ORCC-CH_b8j1f.js → cose-bilkent-JH36ORCC-Bzh-NzMt.js} +1 -1
  232. package/web-shell/assets/{cynefin-OW5HDTMX-CpdeeUn4.js → cynefin-OW5HDTMX-C4_P_Yoc.js} +1 -1
  233. package/web-shell/assets/{cynefinDiagram-5FMLGOSQ-CpTzaCzt.js → cynefinDiagram-5FMLGOSQ-BuW621YL.js} +1 -1
  234. package/web-shell/assets/{dagre-3AP2YEHR-BTtggthC.js → dagre-3AP2YEHR-DEYS83zL.js} +1 -1
  235. package/web-shell/assets/{diagram-S7CK7UJ4-BKgOiJsS.js → diagram-S7CK7UJ4-BMtjGmDg.js} +1 -1
  236. package/web-shell/assets/{diagram-UQ7AKVKN-I12M4b-_.js → diagram-UQ7AKVKN-BzxkP09r.js} +1 -1
  237. package/web-shell/assets/{diagram-VSXAHHWV-C5EuyQ1H.js → diagram-VSXAHHWV-EMYvU-cZ.js} +1 -1
  238. package/web-shell/assets/{diagram-VX7I27RA-CcsSRsvO.js → diagram-VX7I27RA-CnspBccH.js} +1 -1
  239. package/web-shell/assets/{diagram-Z3DM3KII-tNMV05Fn.js → diagram-Z3DM3KII-0NFTLr1f.js} +1 -1
  240. package/web-shell/assets/{ebnfDiagram-PWID7BFC-liAtArsc.js → ebnfDiagram-PWID7BFC-Cn16enHu.js} +1 -1
  241. package/web-shell/assets/{erDiagram-SSCWMZ5O-I4lmr_zI.js → erDiagram-SSCWMZ5O-Cti58N5W.js} +1 -1
  242. package/web-shell/assets/{flowDiagram-A5DVABFB-nEXpsOvo.js → flowDiagram-A5DVABFB-CigLfgUP.js} +1 -1
  243. package/web-shell/assets/{ganttDiagram-EL5Y4UJY-Dw75s1-O.js → ganttDiagram-EL5Y4UJY-CjuMs_pK.js} +1 -1
  244. package/web-shell/assets/{gitGraphDiagram-WWUBYQGX-DiLeptZ9.js → gitGraphDiagram-WWUBYQGX-DOxl_2_x.js} +1 -1
  245. package/web-shell/assets/{index-BrTCjwfu.js → index-By0dekuz.js} +3 -3
  246. package/web-shell/assets/{index-BH44b2De.js → index-H7LsVN_M.js} +1 -1
  247. package/web-shell/assets/{infoDiagram-RXCK75RN-DCcJ_WXa.js → infoDiagram-RXCK75RN-D0XQbjRi.js} +1 -1
  248. package/web-shell/assets/{ishikawaDiagram-5VMMS53U-Cj6CqTSd.js → ishikawaDiagram-5VMMS53U-DOliT3Hm.js} +1 -1
  249. package/web-shell/assets/{journeyDiagram-EYS64GPL-CJXzA_hz.js → journeyDiagram-EYS64GPL-DF6vvHQf.js} +1 -1
  250. package/web-shell/assets/{kanban-definition-3QL26DDD-DdNe_a61.js → kanban-definition-3QL26DDD-BY_17qoo.js} +1 -1
  251. package/web-shell/assets/{layout-DaXP6yO1.js → layout-B91ME8fF.js} +1 -1
  252. package/web-shell/assets/{linear-B-jZU9Hq.js → linear-BEgEyRkI.js} +1 -1
  253. package/web-shell/assets/{mermaid.core-CIdivnr2.js → mermaid.core-BBo02LMd.js} +6 -6
  254. package/web-shell/assets/{mindmap-definition-FBJOCRG2-D0W4HbAm.js → mindmap-definition-FBJOCRG2-C1Jh0DIu.js} +1 -1
  255. package/web-shell/assets/{pegDiagram-XKGWAZYB-BXa0Luv-.js → pegDiagram-XKGWAZYB-DOt-0tX-.js} +1 -1
  256. package/web-shell/assets/{pieDiagram-E7YTZNPT-CWQYQAXk.js → pieDiagram-E7YTZNPT-D_Pnb6KK.js} +1 -1
  257. package/web-shell/assets/{quadrantDiagram-AXDQQJYC-C2rr5v8g.js → quadrantDiagram-AXDQQJYC-0tTq4TDV.js} +1 -1
  258. package/web-shell/assets/{railroadDiagram-O6MQD6OU-Ixq2-sNq.js → railroadDiagram-O6MQD6OU-D8sT8HBX.js} +1 -1
  259. package/web-shell/assets/{requirementDiagram-EFPCY7ZU-Bkiw-rJU.js → requirementDiagram-EFPCY7ZU-zmn8P5S5.js} +1 -1
  260. package/web-shell/assets/{sankeyDiagram-P5KCCOFB-fdyaOOD3.js → sankeyDiagram-P5KCCOFB-DIdIBb9D.js} +1 -1
  261. package/web-shell/assets/{sequenceDiagram-WJ2MYXX4-DwyYk-Nn.js → sequenceDiagram-WJ2MYXX4-DR0z10JW.js} +1 -1
  262. package/web-shell/assets/{sizeCapture-X5ZJPWSS-73pmJ9p5.js → sizeCapture-X5ZJPWSS-BAoZUB5z.js} +1 -1
  263. package/web-shell/assets/{stateDiagram-HBIQ2CUA-BuVhfbnT.js → stateDiagram-HBIQ2CUA-A_BJS30R.js} +1 -1
  264. package/web-shell/assets/stateDiagram-v2-4QOOHH4V-DsZg5hvr.js +1 -0
  265. package/web-shell/assets/{swimlanes-XN3QIQJK-CzJEsLmd.js → swimlanes-XN3QIQJK-DoHKDejp.js} +1 -1
  266. package/web-shell/assets/swimlanesDiagram-VK2B7HYN-xB_iuHcQ.js +8 -0
  267. package/web-shell/assets/{timeline-definition-24CTP7MA-DY2tlsbK.js → timeline-definition-24CTP7MA-DIgaU8qe.js} +1 -1
  268. package/web-shell/assets/{vennDiagram-4TSXK5OY-jOnpk6UN.js → vennDiagram-4TSXK5OY-DinP1LiH.js} +1 -1
  269. package/web-shell/assets/{wardleyDiagram-VM6X3IG4-ns8qvGAq.js → wardleyDiagram-VM6X3IG4-Bl_eYQSI.js} +1 -1
  270. package/web-shell/assets/{xychartDiagram-S5SC5T6Z-BVvufFM8.js → xychartDiagram-S5SC5T6Z-CeovOG8L.js} +1 -1
  271. package/web-shell/index.html +1 -1
  272. package/web-shell/sw.js +1 -1
  273. package/web-shell/assets/channel-laaanioB.js +0 -1
  274. package/web-shell/assets/classDiagram-DTDB5LWJ-vy7HfQpt.js +0 -1
  275. package/web-shell/assets/classDiagram-v2-JRS7N3AN-vy7HfQpt.js +0 -1
  276. package/web-shell/assets/stateDiagram-v2-4QOOHH4V-Behbwxmi.js +0 -1
  277. package/web-shell/assets/swimlanesDiagram-VK2B7HYN-xalmucUq.js +0 -8
@@ -1091,7 +1091,7 @@ ${n}`:n}function xQ(e){const t=e.data.indexOf(","),n=e.data.startsWith("data:")&
1091
1091
  </head><body><iframe title="${G3(t)}" src="${G3(e.href)}" sandbox="allow-scripts allow-same-origin allow-forms" referrerpolicy="no-referrer"></iframe></body></html>`}function GG(e,t){const n=qP(t);if(KG.has(n))return"Audio";switch(n){case".htm":case".html":return"HTML";case".md":case".markdown":case".mdx":return"Markdown";case".pdf":return"PDF";case".avif":case".bmp":case".gif":case".ico":case".jpeg":case".jpg":case".png":case".svg":case".webp":return"Image";case".mov":case".mp4":case".webm":return"Video";case".doc":case".docx":case".docm":case".dotx":case".odt":return"Word";case".xls":case".xlsx":case".xlsm":case".xlsb":case".ods":return"Excel";case".ppt":case".pptx":case".pptm":case".odp":return"PowerPoint";case".csv":return"CSV"}switch(e){case"html":return"HTML";case"pdf":return"PDF";case"notebook":return"Notebook";case"document":return"Document";default:return e||"artifact"}}const rVe=new Set([".doc",".docx",".docm",".dotx",".xls",".xlsx",".xlsm",".xlsb",".ppt",".pptx",".pptm",".odt",".ods",".odp"]),KG=new Set([".m4a",".mp3",".ogg",".wav"]),oVe=new Set([...rVe,...KG,".pdf",".mp4",".mov",".webm"]);function swe(e){const t=qP(e.workspacePath),n=ub(e.mimeType);return t===".svg"||n==="image/svg+xml"||oVe.has(t)?!0:owe(e)||t===".md"||t===".markdown"||t===".html"||t===".htm"||n==="text/markdown"||n==="text/html"?!1:e.kind==="image"||e.kind==="document"||e.kind==="pdf"||e.kind==="video"||e.kind==="audio"}function qP(e){const n=(e??"").split(/[?#]/,1)[0].split(/[/\\]/).pop()??"",s=n.lastIndexOf(".");return s>=0?n.slice(s).toLowerCase():""}function iVe(e,t){return KG.has(qP(e))||ub(t).startsWith("audio/")}const aVe="o1code.workspace.sha256";function xte(e){const t=e.metadata?.[aVe],n=typeof t=="string"?t:"";return`${e.status}:${e.updatedAt}:${n}`}function lVe(e){const t=e.metadata?.artifactType;return typeof t=="string"&&t?t:GG(e.kind,e.workspacePath??e.url??e.title)}function VP(e){return e===void 0?"":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}const rwe={avif:"image/avif",bmp:"image/bmp",gif:"image/gif",ico:"image/x-icon",jpeg:"image/jpeg",jpg:"image/jpeg",png:"image/png",webp:"image/webp"},cVe=100*1024*1024,uVe=256*1024;function ub(e){return e?.split(";",1)[0]?.trim().toLowerCase()??""}function owe(e){const t=ub(e.mimeType);return t.startsWith("image/")?t==="image/jpg"?"image/jpeg":Object.values(rwe).includes(t)?t:void 0:FS(e.workspacePath??"")}function FS(e){const t=e.toLowerCase(),n=t.includes(".")?t.split(".").pop():void 0;return n?rwe[n]:void 0}function dVe(e){return/\.html?$/i.test(e)?"text/html":"text/markdown"}async function _4(e,t,n,s){const r=[],o=s.maxBytes??cVe,i=await s.statFile(t);if(s.isCancelled?.())throw new Error("File loading was cancelled.");if(i.type==="directory")throw new Error("Directories cannot be opened or downloaded as artifacts.");if(i.sizeBytes>o)throw new Error("File is too large to preview or download.");let l=0;for(;;){if(s.isCancelled?.())throw new Error("File loading was cancelled.");const c=await e(t,{offset:l,maxBytes:uVe});if(s.isCancelled?.())throw new Error("File loading was cancelled.");if(c.sizeBytes!==i.sizeBytes)throw new Error("File changed while loading. Please retry.");if(c.returnedBytes<=0&&l<i.sizeBytes)throw new Error("File loading made no progress.");const u=atob(c.contentBase64),h=new Uint8Array(u.length);for(let f=0;f<u.length;f++)h[f]=u.charCodeAt(f);if(r.push(h),l=c.offset+c.returnedBytes,l>=i.sizeBytes){const f=await s.statFile(t);if(s.isCancelled?.())throw new Error("File loading was cancelled.");if(f.sizeBytes!==i.sizeBytes||f.modifiedMs!==i.modifiedMs)throw new Error("File changed while loading. Please retry.");return new Blob(r,{type:n})}}}async function GP(e,t,n="application/octet-stream",s){const r=await _4((i,l)=>e.readFileBytes(i,l),t,n,{statFile:i=>e.stat(i),isCancelled:s}),o=URL.createObjectURL(r);try{const i=document.createElement("a");i.href=o,i.download=db(t).split("/").at(-1)??t,document.body.appendChild(i),i.click(),i.remove()}finally{URL.revokeObjectURL(o)}}function iwe(e){return e.workspacePath??e.url??e.managedId??""}function db(e){const t=(e??"").replaceAll("\\","/").replace(/^\.\//,"").replace(/\/+$/,""),n=t.startsWith("/"),s=[];for(const o of t.split("/"))if(!(!o||o===".")){if(o===".."){s.length>0&&s.at(-1)!==".."?s.pop():n||s.push(o);continue}s.push(o)}const r=s.join("/");return n?`/${r}`:r}function $E(e,t){const n=db(e),s=db(t);if(!s)return n;if(n===s)return n.split("/").pop()??n;const r=`${s}/`;return n.startsWith(r)?n.slice(r.length):n}function YG(e,t,n){const s=$E(e??"",n),r=$E(t??"",n);return!!s&&s===r}const xH="default-src 'none'; base-uri 'none'; form-action 'none'; script-src 'unsafe-inline' data:; style-src 'unsafe-inline' data:; img-src data: blob:; font-src data:; media-src data:;";function awe(e,t){return kH(_H(e),t)}function kH(e,t){return`<!doctype html><html><head>
1092
1092
  <meta http-equiv="Content-Security-Policy" content="${xH} frame-src 'none';">
1093
1093
  <style>html,body,iframe{width:100%;height:100%;margin:0;border:0;display:block;overflow:hidden}</style>
1094
- </head><body><iframe title="${G3(t)}" sandbox="allow-scripts" referrerpolicy="no-referrer" srcdoc="${G3(e)}"></iframe></body></html>`}let Mj;async function hVe(e,t,n){if(Mj?.content===e&&Mj.title===t)return Mj.document;const s=await fVe(e,t,n);return Mj={content:e,title:t,document:s},s}async function fVe(e,t,n){if(typeof DOMParser>"u")return awe(e,t);const s=new DOMParser().parseFromString(e,"text/html");if(!s.querySelector('script#transcript-document[type="application/json"]'))return kH(_H(s),t);const r=new AbortController,o=()=>r.abort();n.addEventListener("abort",o,{once:!0}),n.aborted&&r.abort();try{await Promise.all([["script#transcript-renderer","src","js","text/javascript"],['link#transcript-stylesheet[rel="stylesheet"]',"href","css","text/css"]].map(async([i,l,c,u])=>{const h=s.querySelector(i),f=h?.getAttribute(l)??"",m=h?.getAttribute("integrity")??"";if(!h)return;const g=`https://unpkg.com/@organizaone/o1-code@0.14.1/export-transcript-document.${c}`;if(f!==g||!/^sha384-[A-Za-z0-9+/]{64}$/.test(m))throw new Error("Unsupported export preview resource; use an export matching the current Web Shell version.");const w=await fetch(f,{integrity:m,signal:r.signal,credentials:"omit",referrerPolicy:"no-referrer",redirect:"error"});if(!w.ok)throw new Error(`Could not load export renderer (${w.status}).`);const y=new Blob([await w.arrayBuffer()],{type:u}),x=await new Promise((k,_)=>{const S=new FileReader;S.onload=()=>k(S.result),S.onerror=()=>_(S.error),S.readAsDataURL(y)});h.setAttribute(l,x),h.removeAttribute("integrity"),h.removeAttribute("crossorigin")}))}finally{n.removeEventListener("abort",o),r.abort()}return kH(_H(s),t)}function _H(e){if(typeof e=="string"&&typeof DOMParser>"u")return`<!doctype html><html><head><meta http-equiv="Content-Security-Policy" content="${xH}"></head><body>${pVe(e)}</body></html>`;const t=typeof e=="string"?new DOMParser().parseFromString(e,"text/html"):e;t.querySelectorAll('noscript, meta[http-equiv="refresh" i], meta[http-equiv="Content-Security-Policy" i]').forEach(s=>s.remove());const n=t.createElement("meta");return n.httpEquiv="Content-Security-Policy",n.content=xH,t.head.prepend(n),`<!doctype html>${t.documentElement.outerHTML}`}function pVe(e){return e.replace(/<noscript\b[^>]*>[\s\S]*?<\/noscript>/gi,"").replace(/<meta\b(?=[^>]*\bhttp-equiv\s*=\s*["']?refresh["']?)[^>]*>/gi,"").replace(/<meta\b(?=[^>]*\bhttp-equiv\s*=\s*["']?Content-Security-Policy["']?)[^>]*>/gi,"")}const lwe={csv:Gqe,file:Kqe,html:Yqe,image:Xqe,link:Zqe,md:Jqe,pdf:Qqe,spreadsheet:eVe,video:tVe,word:nVe},mVe={csv:"csv",html:"html",image:"image",link:"link",markdown:"md",md:"md",pdf:"pdf",spreadsheet:"spreadsheet",video:"video",word:"word"},gVe={audio:HG,document:k4,notebook:_We},kte={avif:"image",bmp:"image",csv:"csv",doc:"word",docm:"word",docx:"word",dotx:"word",gif:"image",htm:"html",html:"html",ico:"image",jpeg:"image",jpg:"image",md:"md",markdown:"md",mdx:"md",mov:"video",mp4:"video",ods:"spreadsheet",odt:"word",pdf:"pdf",png:"image",svg:"image",webm:"video",webp:"image",xls:"spreadsheet",xlsb:"spreadsheet",xlsm:"spreadsheet",xlsx:"spreadsheet"};function cwe(e){if(!e)return"file";const t=e.workspacePath??e.url??e.title,n=qP(t).slice(1);if(n&&kte[n])return kte[n];const s=ub(e.mimeType);return s==="application/pdf"?"pdf":s.startsWith("image/")?"image":s.startsWith("video/")?"video":s==="text/csv"?"csv":s.includes("spreadsheet")||s.includes("ms-excel")?"spreadsheet":s.includes("wordprocessingml")||s==="application/msword"?"word":s==="text/html"?"html":s==="text/markdown"?"md":mVe[e.kind]??"file"}function uwe({artifact:e,className:t}){const{artifact:n}=Th(),s=e?n?.renderImage?.(e):void 0;if(s!=null&&s!==!1)return s;const r=cwe(e),o=e?e.workspacePath??e.url??e.title:void 0,i=r==="file"&&e?iVe(o,e.mimeType)?"audio":e.kind:void 0,l=i?gVe[i]:void 0;return l?a.jsx(l,{className:t,"data-artifact-icon":i,"aria-hidden":"true"}):a.jsx("img",{className:t,src:lwe[r],"data-artifact-icon":r,alt:""})}const vVe=[[new Set(["json","jsonl","geojson"]),tHe],[new Set(["js","jsx","ts","tsx","mjs","cjs","css","html","htm","xml","svg","py","rb","go","rs","java","c","cc","cpp","h","hpp","sh","sql","yaml","yml","toml"]),Q8],[new Set(["zip","tar","gz","tgz","bz2","xz","7z","rar"]),eUe],[new Set(["csv","tsv","xls","xlsx","ods"]),aUe],[new Set(["ppt","pptx","odp"]),zWe],[new Set(["png","jpg","jpeg","gif","webp","bmp","ico","tif","tiff"]),Dve],[new Set(["mp3","wav","ogg","m4a","aac","flac"]),HG],[new Set(["mp4","mov","webm","avi","mkv"]),Ove],[new Set(["txt","md","mdx","log","pdf","doc","docx","rtf"]),k4]];function wVe(e,t){const n=e.split(".").pop()?.toLowerCase()??"";for(const[s,r]of vVe)if(s.has(n))return r;return t?.startsWith("image/")?Dve:t?.startsWith("audio/")?HG:t?.startsWith("video/")?Ove:t?.startsWith("text/")?k4:$ve}function U0({name:e,mimeType:t,size:n=24,absoluteStrokeWidth:s,...r}){const o=wVe(e,t),i=cwe({kind:"file",title:e.replace(/[?#]/g,"_"),mimeType:t});return i!=="file"||o===$ve?a.jsx("svg",{width:n,height:n,...r,"data-file-type-icon":i,children:a.jsx("image",{href:lwe[i],width:"100%",height:"100%"})}):a.jsx(o,{size:n,absoluteStrokeWidth:s,...r})}const yVe="_panel_19vsn_1",bVe="_floating_19vsn_16",xVe="_section_19vsn_26",kVe="_sectionHeader_19vsn_40",_Ve="_sectionHeaderRow_19vsn_59",SVe="_sectionAction_19vsn_70",CVe="_sectionContent_19vsn_111",TVe="_row_19vsn_115",IVe="_workspaceIcon_19vsn_158",RVe="_rowActionIcon_19vsn_162",EVe="_label_19vsn_168",AVe="_branchName_19vsn_173",jVe="_value_19vsn_181",NVe="_tasks_19vsn_191",MVe="_task_19vsn_191",PVe="_taskIcon_19vsn_229",LVe="_taskLabel_19vsn_240",DVe="_agentName_19vsn_248",OVe="_taskName_19vsn_249",$Ve="_agentColor_19vsn_260",BVe="_agentTag_19vsn_269",FVe="_taskStatus_19vsn_280",zVe="_statusRunning_19vsn_301",HVe="_attachmentFiles_19vsn_311",UVe="_attachmentFile_19vsn_311",WVe="_attachmentFileIcon_19vsn_344",qVe="_attachmentFileName_19vsn_348",VVe="_emptyDescription_19vsn_356",GVe="_sourceTitle_19vsn_363",Hr={panel:yVe,floating:bVe,section:xVe,sectionHeader:kVe,sectionHeaderRow:_Ve,sectionAction:SVe,sectionContent:CVe,row:TVe,workspaceIcon:IVe,rowActionIcon:RVe,label:EVe,branchName:AVe,value:jVe,tasks:NVe,task:MVe,taskIcon:PVe,taskLabel:LVe,agentName:DVe,taskName:OVe,agentColor:$Ve,agentTag:BVe,taskStatus:FVe,statusRunning:zVe,attachmentFiles:HVe,attachmentFile:UVe,attachmentFileIcon:WVe,attachmentFileName:qVe,emptyDescription:VVe,sourceTitle:GVe};function dwe({entries:e,onOpen:t}){const{t:n}=Ct();return a.jsx("ul",{className:Hr.attachmentFiles,children:e.map(s=>a.jsx("li",{children:a.jsxs("button",{type:"button",className:Hr.attachmentFile,title:wte(s),"aria-label":s.type==="source"?`${n("sources.open")} ${vte(s)}`:void 0,disabled:!t,onClick:()=>t?.(s),children:[s.type==="source"&&s.source.kind==="link"?a.jsx(Fve,{size:16,strokeWidth:1.7,className:Hr.attachmentFileIcon}):a.jsx(U0,{name:wte(s),mimeType:s.type==="attachment"?s.attachment.mimeType:void 0,size:16,strokeWidth:1.7,className:Hr.attachmentFileIcon,"aria-hidden":"true"}),a.jsx("span",{className:Hr.attachmentFileName,children:vte(s)})]})},AM(s)))})}function ow({className:e,...t}){return a.jsx("div",{"data-slot":"skeleton",className:cs("animate-pulse rounded-md bg-muted",e),...t})}function KVe(){return typeof window>"u"?!1:new URLSearchParams(window.location.search).get("addSource")==="1"}function YVe({hidden:e=!1,state:t,attachments:n=[],attachmentsLoading:s=!1,attachmentsError:r,onRetryAttachments:o,onOpen:i,retryRegistration:l,onDialogOpenChange:c,onReadImage:u,onImagePreview:h,onAttachmentPreview:f,onAttachmentPreviewError:m}){const{t:g}=Ct(),[w,y]=d.useState(!1),[x,k]=d.useState(!1);d.useEffect(()=>{e&&k(!1)},[e]),d.useEffect(()=>{k(!1),y(!1)},[t?.owner,t?.supported]),d.useEffect(()=>(c?.(x&&t?.supported===!0),()=>c?.(!1)),[x,c,t?.supported]);const _=t?.supported?t.sources:[],S=Qve(_,n);if(!t?.supported&&!S.length&&!s&&!r)return null;const I=s||t?.supported&&t.loading;return a.jsxs("section",{className:Hr.section,"aria-label":g("sources.title"),"data-testid":"sources-section",children:[a.jsxs("div",{className:Hr.sectionHeaderRow,children:[a.jsxs("h3",{className:`${Hr.sectionHeader} ${Hr.sourceTitle}`,children:[g("sources.title")," ",a.jsx("span",{className:"text-muted-foreground",children:S.length})]}),t?.supported&&KVe()&&a.jsx("button",{type:"button",className:Hr.sectionAction,"aria-label":g("sources.add"),onClick:()=>k(!0),children:a.jsx(Qf,{})})]}),l&&a.jsxs("div",{className:Hr.emptyDescription,role:"alert",children:[g("sources.registrationFailed")," ",a.jsx(Wt,{size:"sm",variant:"link",onClick:()=>void l(),children:g("common.retry")})]}),t?.supported&&t.error&&a.jsxs("div",{className:"mt-2 text-xs text-destructive",role:"alert",children:[t.error," ",a.jsx(Wt,{size:"sm",variant:"link",onClick:()=>void t.refresh(),children:g("common.retry")})]}),r&&a.jsxs("div",{className:"mt-2 text-xs text-destructive",role:"alert",children:[g("sources.attachmentsLoadFailed",{error:r})," ",a.jsx(Wt,{size:"sm",variant:"link",onClick:o,children:g("common.retry")})]}),a.jsx(dwe,{entries:w?S:S.slice(0,3),onOpen:E=>hwe(E,{onOpen:i,onReadImage:u,onImagePreview:h,onAttachmentPreview:f,onAttachmentPreviewError:m})}),I&&!S.length&&a.jsx("ul",{className:Hr.attachmentFiles,"data-testid":"environment-file-list-skeleton",role:"status","aria-label":g("common.loading"),children:[72,88,64].map(E=>a.jsxs("li",{className:Hr.attachmentFile,children:[a.jsx(ow,{className:"size-4 shrink-0 rounded-sm"}),a.jsx(ow,{className:"h-4",style:{width:`${E}%`}})]},E))}),!I&&!S.length&&t?.hydrated&&!t.error&&!r&&a.jsx("p",{className:Hr.emptyDescription,children:g("sources.empty")}),S.length>3&&a.jsx("button",{type:"button",className:Hr.attachmentFile,"aria-expanded":w,onClick:()=>y(E=>!E),children:g(w?"common.collapse":"sources.viewAll")}),x&&t?.supported&&a.jsx(XVe,{state:t,onClose:()=>k(!1)})]})}function XVe({state:e,onClose:t}){const{t:n}=Ct(),[s,r]=d.useState("workspace_file"),[o,i]=d.useState(""),[l,c]=d.useState(""),[u,h]=d.useState(""),[f,m]=d.useState(),[g,w]=d.useState(!1),y=async()=>{w(!0),m(void 0);try{const x=s==="url"?new URL(o).hostname:o.split(/[\\/]/).at(-1)||o,k=s==="workspace_file"?{type:s,workspacePath:o}:{type:s,url:o};await e.upsert({title:l.trim()||x.trim().slice(0,200),locator:k,...u?{description:u}:{}}),e.owner.isCurrent()&&t()}catch(x){e.owner.isCurrent()&&m(x instanceof Error?x.message:String(x))}finally{e.owner.isCurrent()&&w(!1)}};return a.jsx(Wa,{title:n("sources.add"),subtitle:n("sources.explanation"),onClose:t,size:"sm",children:a.jsxs("form",{className:"flex flex-col gap-3",onSubmit:x=>{x.preventDefault(),y()},children:[a.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[n("sources.type"),a.jsxs("select",{className:"h-8 rounded-lg border border-input bg-background px-2",value:s,onChange:x=>{r(x.target.value),i(""),m(void 0)},children:[a.jsx("option",{value:"workspace_file",children:n("sources.workspaceFile")}),a.jsx("option",{value:"url",children:n("sources.link")})]})]}),a.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[n("sources.location"),a.jsx(hi,{value:o,onChange:x=>i(x.target.value),required:!0,maxLength:s==="url"?2048:500,placeholder:s==="url"?"https://example.com":"docs/requirements.md"})]}),a.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[n("sources.name"),a.jsx(hi,{value:l,maxLength:200,onChange:x=>c(x.target.value)})]}),a.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[n("sources.description"),a.jsx(hi,{value:u,maxLength:1e3,onChange:x=>h(x.target.value)})]}),f&&a.jsx("div",{role:"alert",className:"text-xs text-destructive",children:f}),a.jsx(Wt,{type:"submit",disabled:g||!o,children:n("sources.add")})]})})}function hwe(e,t){if(e.type==="source"){t.onOpen?.(e.source);return}const n=e.attachment;if(n.type==="image"){t.onReadImage?.(n.attachmentId).then(s=>t.onImagePreview?.(s,n.attachmentId,{kind:"attachment",attachmentId:n.attachmentId})).catch(s=>t.onAttachmentPreviewError?.(s));return}t.onAttachmentPreview?.({name:n.attachmentId,mimeType:n.mimeType,attachmentId:n.attachmentId})}/**
1094
+ </head><body><iframe title="${G3(t)}" sandbox="allow-scripts" referrerpolicy="no-referrer" srcdoc="${G3(e)}"></iframe></body></html>`}let Mj;async function hVe(e,t,n){if(Mj?.content===e&&Mj.title===t)return Mj.document;const s=await fVe(e,t,n);return Mj={content:e,title:t,document:s},s}async function fVe(e,t,n){if(typeof DOMParser>"u")return awe(e,t);const s=new DOMParser().parseFromString(e,"text/html");if(!s.querySelector('script#transcript-document[type="application/json"]'))return kH(_H(s),t);const r=new AbortController,o=()=>r.abort();n.addEventListener("abort",o,{once:!0}),n.aborted&&r.abort();try{await Promise.all([["script#transcript-renderer","src","js","text/javascript"],['link#transcript-stylesheet[rel="stylesheet"]',"href","css","text/css"]].map(async([i,l,c,u])=>{const h=s.querySelector(i),f=h?.getAttribute(l)??"",m=h?.getAttribute("integrity")??"";if(!h)return;const g=`https://unpkg.com/@organizaone/o1-code@0.15.1/export-transcript-document.${c}`;if(f!==g||!/^sha384-[A-Za-z0-9+/]{64}$/.test(m))throw new Error("Unsupported export preview resource; use an export matching the current Web Shell version.");const w=await fetch(f,{integrity:m,signal:r.signal,credentials:"omit",referrerPolicy:"no-referrer",redirect:"error"});if(!w.ok)throw new Error(`Could not load export renderer (${w.status}).`);const y=new Blob([await w.arrayBuffer()],{type:u}),x=await new Promise((k,_)=>{const S=new FileReader;S.onload=()=>k(S.result),S.onerror=()=>_(S.error),S.readAsDataURL(y)});h.setAttribute(l,x),h.removeAttribute("integrity"),h.removeAttribute("crossorigin")}))}finally{n.removeEventListener("abort",o),r.abort()}return kH(_H(s),t)}function _H(e){if(typeof e=="string"&&typeof DOMParser>"u")return`<!doctype html><html><head><meta http-equiv="Content-Security-Policy" content="${xH}"></head><body>${pVe(e)}</body></html>`;const t=typeof e=="string"?new DOMParser().parseFromString(e,"text/html"):e;t.querySelectorAll('noscript, meta[http-equiv="refresh" i], meta[http-equiv="Content-Security-Policy" i]').forEach(s=>s.remove());const n=t.createElement("meta");return n.httpEquiv="Content-Security-Policy",n.content=xH,t.head.prepend(n),`<!doctype html>${t.documentElement.outerHTML}`}function pVe(e){return e.replace(/<noscript\b[^>]*>[\s\S]*?<\/noscript>/gi,"").replace(/<meta\b(?=[^>]*\bhttp-equiv\s*=\s*["']?refresh["']?)[^>]*>/gi,"").replace(/<meta\b(?=[^>]*\bhttp-equiv\s*=\s*["']?Content-Security-Policy["']?)[^>]*>/gi,"")}const lwe={csv:Gqe,file:Kqe,html:Yqe,image:Xqe,link:Zqe,md:Jqe,pdf:Qqe,spreadsheet:eVe,video:tVe,word:nVe},mVe={csv:"csv",html:"html",image:"image",link:"link",markdown:"md",md:"md",pdf:"pdf",spreadsheet:"spreadsheet",video:"video",word:"word"},gVe={audio:HG,document:k4,notebook:_We},kte={avif:"image",bmp:"image",csv:"csv",doc:"word",docm:"word",docx:"word",dotx:"word",gif:"image",htm:"html",html:"html",ico:"image",jpeg:"image",jpg:"image",md:"md",markdown:"md",mdx:"md",mov:"video",mp4:"video",ods:"spreadsheet",odt:"word",pdf:"pdf",png:"image",svg:"image",webm:"video",webp:"image",xls:"spreadsheet",xlsb:"spreadsheet",xlsm:"spreadsheet",xlsx:"spreadsheet"};function cwe(e){if(!e)return"file";const t=e.workspacePath??e.url??e.title,n=qP(t).slice(1);if(n&&kte[n])return kte[n];const s=ub(e.mimeType);return s==="application/pdf"?"pdf":s.startsWith("image/")?"image":s.startsWith("video/")?"video":s==="text/csv"?"csv":s.includes("spreadsheet")||s.includes("ms-excel")?"spreadsheet":s.includes("wordprocessingml")||s==="application/msword"?"word":s==="text/html"?"html":s==="text/markdown"?"md":mVe[e.kind]??"file"}function uwe({artifact:e,className:t}){const{artifact:n}=Th(),s=e?n?.renderImage?.(e):void 0;if(s!=null&&s!==!1)return s;const r=cwe(e),o=e?e.workspacePath??e.url??e.title:void 0,i=r==="file"&&e?iVe(o,e.mimeType)?"audio":e.kind:void 0,l=i?gVe[i]:void 0;return l?a.jsx(l,{className:t,"data-artifact-icon":i,"aria-hidden":"true"}):a.jsx("img",{className:t,src:lwe[r],"data-artifact-icon":r,alt:""})}const vVe=[[new Set(["json","jsonl","geojson"]),tHe],[new Set(["js","jsx","ts","tsx","mjs","cjs","css","html","htm","xml","svg","py","rb","go","rs","java","c","cc","cpp","h","hpp","sh","sql","yaml","yml","toml"]),Q8],[new Set(["zip","tar","gz","tgz","bz2","xz","7z","rar"]),eUe],[new Set(["csv","tsv","xls","xlsx","ods"]),aUe],[new Set(["ppt","pptx","odp"]),zWe],[new Set(["png","jpg","jpeg","gif","webp","bmp","ico","tif","tiff"]),Dve],[new Set(["mp3","wav","ogg","m4a","aac","flac"]),HG],[new Set(["mp4","mov","webm","avi","mkv"]),Ove],[new Set(["txt","md","mdx","log","pdf","doc","docx","rtf"]),k4]];function wVe(e,t){const n=e.split(".").pop()?.toLowerCase()??"";for(const[s,r]of vVe)if(s.has(n))return r;return t?.startsWith("image/")?Dve:t?.startsWith("audio/")?HG:t?.startsWith("video/")?Ove:t?.startsWith("text/")?k4:$ve}function U0({name:e,mimeType:t,size:n=24,absoluteStrokeWidth:s,...r}){const o=wVe(e,t),i=cwe({kind:"file",title:e.replace(/[?#]/g,"_"),mimeType:t});return i!=="file"||o===$ve?a.jsx("svg",{width:n,height:n,...r,"data-file-type-icon":i,children:a.jsx("image",{href:lwe[i],width:"100%",height:"100%"})}):a.jsx(o,{size:n,absoluteStrokeWidth:s,...r})}const yVe="_panel_19vsn_1",bVe="_floating_19vsn_16",xVe="_section_19vsn_26",kVe="_sectionHeader_19vsn_40",_Ve="_sectionHeaderRow_19vsn_59",SVe="_sectionAction_19vsn_70",CVe="_sectionContent_19vsn_111",TVe="_row_19vsn_115",IVe="_workspaceIcon_19vsn_158",RVe="_rowActionIcon_19vsn_162",EVe="_label_19vsn_168",AVe="_branchName_19vsn_173",jVe="_value_19vsn_181",NVe="_tasks_19vsn_191",MVe="_task_19vsn_191",PVe="_taskIcon_19vsn_229",LVe="_taskLabel_19vsn_240",DVe="_agentName_19vsn_248",OVe="_taskName_19vsn_249",$Ve="_agentColor_19vsn_260",BVe="_agentTag_19vsn_269",FVe="_taskStatus_19vsn_280",zVe="_statusRunning_19vsn_301",HVe="_attachmentFiles_19vsn_311",UVe="_attachmentFile_19vsn_311",WVe="_attachmentFileIcon_19vsn_344",qVe="_attachmentFileName_19vsn_348",VVe="_emptyDescription_19vsn_356",GVe="_sourceTitle_19vsn_363",Hr={panel:yVe,floating:bVe,section:xVe,sectionHeader:kVe,sectionHeaderRow:_Ve,sectionAction:SVe,sectionContent:CVe,row:TVe,workspaceIcon:IVe,rowActionIcon:RVe,label:EVe,branchName:AVe,value:jVe,tasks:NVe,task:MVe,taskIcon:PVe,taskLabel:LVe,agentName:DVe,taskName:OVe,agentColor:$Ve,agentTag:BVe,taskStatus:FVe,statusRunning:zVe,attachmentFiles:HVe,attachmentFile:UVe,attachmentFileIcon:WVe,attachmentFileName:qVe,emptyDescription:VVe,sourceTitle:GVe};function dwe({entries:e,onOpen:t}){const{t:n}=Ct();return a.jsx("ul",{className:Hr.attachmentFiles,children:e.map(s=>a.jsx("li",{children:a.jsxs("button",{type:"button",className:Hr.attachmentFile,title:wte(s),"aria-label":s.type==="source"?`${n("sources.open")} ${vte(s)}`:void 0,disabled:!t,onClick:()=>t?.(s),children:[s.type==="source"&&s.source.kind==="link"?a.jsx(Fve,{size:16,strokeWidth:1.7,className:Hr.attachmentFileIcon}):a.jsx(U0,{name:wte(s),mimeType:s.type==="attachment"?s.attachment.mimeType:void 0,size:16,strokeWidth:1.7,className:Hr.attachmentFileIcon,"aria-hidden":"true"}),a.jsx("span",{className:Hr.attachmentFileName,children:vte(s)})]})},AM(s)))})}function ow({className:e,...t}){return a.jsx("div",{"data-slot":"skeleton",className:cs("animate-pulse rounded-md bg-muted",e),...t})}function KVe(){return typeof window>"u"?!1:new URLSearchParams(window.location.search).get("addSource")==="1"}function YVe({hidden:e=!1,state:t,attachments:n=[],attachmentsLoading:s=!1,attachmentsError:r,onRetryAttachments:o,onOpen:i,retryRegistration:l,onDialogOpenChange:c,onReadImage:u,onImagePreview:h,onAttachmentPreview:f,onAttachmentPreviewError:m}){const{t:g}=Ct(),[w,y]=d.useState(!1),[x,k]=d.useState(!1);d.useEffect(()=>{e&&k(!1)},[e]),d.useEffect(()=>{k(!1),y(!1)},[t?.owner,t?.supported]),d.useEffect(()=>(c?.(x&&t?.supported===!0),()=>c?.(!1)),[x,c,t?.supported]);const _=t?.supported?t.sources:[],S=Qve(_,n);if(!t?.supported&&!S.length&&!s&&!r)return null;const I=s||t?.supported&&t.loading;return a.jsxs("section",{className:Hr.section,"aria-label":g("sources.title"),"data-testid":"sources-section",children:[a.jsxs("div",{className:Hr.sectionHeaderRow,children:[a.jsxs("h3",{className:`${Hr.sectionHeader} ${Hr.sourceTitle}`,children:[g("sources.title")," ",a.jsx("span",{className:"text-muted-foreground",children:S.length})]}),t?.supported&&KVe()&&a.jsx("button",{type:"button",className:Hr.sectionAction,"aria-label":g("sources.add"),onClick:()=>k(!0),children:a.jsx(Qf,{})})]}),l&&a.jsxs("div",{className:Hr.emptyDescription,role:"alert",children:[g("sources.registrationFailed")," ",a.jsx(Wt,{size:"sm",variant:"link",onClick:()=>void l(),children:g("common.retry")})]}),t?.supported&&t.error&&a.jsxs("div",{className:"mt-2 text-xs text-destructive",role:"alert",children:[t.error," ",a.jsx(Wt,{size:"sm",variant:"link",onClick:()=>void t.refresh(),children:g("common.retry")})]}),r&&a.jsxs("div",{className:"mt-2 text-xs text-destructive",role:"alert",children:[g("sources.attachmentsLoadFailed",{error:r})," ",a.jsx(Wt,{size:"sm",variant:"link",onClick:o,children:g("common.retry")})]}),a.jsx(dwe,{entries:w?S:S.slice(0,3),onOpen:E=>hwe(E,{onOpen:i,onReadImage:u,onImagePreview:h,onAttachmentPreview:f,onAttachmentPreviewError:m})}),I&&!S.length&&a.jsx("ul",{className:Hr.attachmentFiles,"data-testid":"environment-file-list-skeleton",role:"status","aria-label":g("common.loading"),children:[72,88,64].map(E=>a.jsxs("li",{className:Hr.attachmentFile,children:[a.jsx(ow,{className:"size-4 shrink-0 rounded-sm"}),a.jsx(ow,{className:"h-4",style:{width:`${E}%`}})]},E))}),!I&&!S.length&&t?.hydrated&&!t.error&&!r&&a.jsx("p",{className:Hr.emptyDescription,children:g("sources.empty")}),S.length>3&&a.jsx("button",{type:"button",className:Hr.attachmentFile,"aria-expanded":w,onClick:()=>y(E=>!E),children:g(w?"common.collapse":"sources.viewAll")}),x&&t?.supported&&a.jsx(XVe,{state:t,onClose:()=>k(!1)})]})}function XVe({state:e,onClose:t}){const{t:n}=Ct(),[s,r]=d.useState("workspace_file"),[o,i]=d.useState(""),[l,c]=d.useState(""),[u,h]=d.useState(""),[f,m]=d.useState(),[g,w]=d.useState(!1),y=async()=>{w(!0),m(void 0);try{const x=s==="url"?new URL(o).hostname:o.split(/[\\/]/).at(-1)||o,k=s==="workspace_file"?{type:s,workspacePath:o}:{type:s,url:o};await e.upsert({title:l.trim()||x.trim().slice(0,200),locator:k,...u?{description:u}:{}}),e.owner.isCurrent()&&t()}catch(x){e.owner.isCurrent()&&m(x instanceof Error?x.message:String(x))}finally{e.owner.isCurrent()&&w(!1)}};return a.jsx(Wa,{title:n("sources.add"),subtitle:n("sources.explanation"),onClose:t,size:"sm",children:a.jsxs("form",{className:"flex flex-col gap-3",onSubmit:x=>{x.preventDefault(),y()},children:[a.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[n("sources.type"),a.jsxs("select",{className:"h-8 rounded-lg border border-input bg-background px-2",value:s,onChange:x=>{r(x.target.value),i(""),m(void 0)},children:[a.jsx("option",{value:"workspace_file",children:n("sources.workspaceFile")}),a.jsx("option",{value:"url",children:n("sources.link")})]})]}),a.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[n("sources.location"),a.jsx(hi,{value:o,onChange:x=>i(x.target.value),required:!0,maxLength:s==="url"?2048:500,placeholder:s==="url"?"https://example.com":"docs/requirements.md"})]}),a.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[n("sources.name"),a.jsx(hi,{value:l,maxLength:200,onChange:x=>c(x.target.value)})]}),a.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[n("sources.description"),a.jsx(hi,{value:u,maxLength:1e3,onChange:x=>h(x.target.value)})]}),f&&a.jsx("div",{role:"alert",className:"text-xs text-destructive",children:f}),a.jsx(Wt,{type:"submit",disabled:g||!o,children:n("sources.add")})]})})}function hwe(e,t){if(e.type==="source"){t.onOpen?.(e.source);return}const n=e.attachment;if(n.type==="image"){t.onReadImage?.(n.attachmentId).then(s=>t.onImagePreview?.(s,n.attachmentId,{kind:"attachment",attachmentId:n.attachmentId})).catch(s=>t.onAttachmentPreviewError?.(s));return}t.onAttachmentPreview?.({name:n.attachmentId,mimeType:n.mimeType,attachmentId:n.attachmentId})}/**
1095
1095
  * @license
1096
1096
  * Copyright 2026 Qwen Team
1097
1097
  * SPDX-License-Identifier: Apache-2.0
@@ -1615,7 +1615,7 @@ License: MIT
1615
1615
  })();`,qct=`<!doctype html>
1616
1616
  <html><head><meta charset="utf-8"><meta http-equiv="Content-Security-Policy" content="${Hct}"></head>
1617
1617
  <body><script>${Wct}<\/script></body></html>`;function Vct(){const e=globalThis.crypto;if(!e?.getRandomValues)throw new sr("LEGACY_SANDBOX_UNAVAILABLE","Secure random values are required by the temporary legacy sandbox");const t=new Uint32Array(4);return e.getRandomValues(t),Array.from(t,n=>n.toString(16).padStart(8,"0")).join("")}function Zse(){return new DOMException("The temporary legacy chart operation was aborted","AbortError")}function Gct(e){if(e.signal.aborted)return Promise.reject(Zse());if(!Number.isSafeInteger(e.timeoutMs)||e.timeoutMs<=0)return Promise.reject(new sr("SCHEMA_INVALID","Legacy sandbox timeout must be a positive safe integer"));if(typeof document>"u"||!document.body)return Promise.reject(new sr("LEGACY_SANDBOX_UNAVAILABLE","The temporary legacy sandbox requires a browser document body"));const t=Vct(),n=document.createElement("iframe");return n.hidden=!0,n.setAttribute("aria-hidden","true"),n.setAttribute("title","Temporary chart sandbox"),n.setAttribute("sandbox","allow-scripts"),n.srcdoc=qct,new Promise((s,r)=>{let o=!1,i=!1,l;const c=()=>{window.removeEventListener("message",m),e.signal.removeEventListener("abort",f),n.onload=null,n.onerror=null,l!==void 0&&clearTimeout(l),n.remove()},u=(g,w)=>{o||(o=!0,c(),g(w))},h=g=>{o||(o=!0,c(),r(g))},f=()=>h(Zse()),m=g=>{if(!(g.source!==n.contentWindow||!ja(g.data))&&!(g.data.channel!==xU||g.data.requestId!==t)){if(g.data.type==="error"){h(new sr("LEGACY_SANDBOX_EXECUTION_FAILED","Temporary legacy chart source failed in the isolated worker"));return}if(g.data.type==="result")try{const w=hye(g.data.option);if(!ja(w))throw new sr("SCHEMA_INVALID","Temporary legacy chart source must produce a JSON object option");u(s,w)}catch(w){h(w)}}};window.addEventListener("message",m),e.signal.addEventListener("abort",f,{once:!0}),n.onerror=()=>h(new sr("LEGACY_SANDBOX_EXECUTION_FAILED","Temporary legacy chart sandbox failed to load")),n.onload=()=>{if(!i){if(i=!0,n.onload=null,o||e.signal.aborted){f();return}n.contentWindow?.postMessage({channel:xU,type:"execute",requestId:t,source:e.source,inputData:e.inputData},"*")}},l=setTimeout(()=>h(new sr("LEGACY_SANDBOX_TIMEOUT",`Temporary legacy chart sandbox exceeded ${e.timeoutMs}ms`)),e.timeoutMs),document.body.append(n)})}var X1e=class extends Error{constructor(t,n,s){super(n,s&&"cause"in s?{cause:s.cause}:void 0);rt(this,"code");rt(this,"cause");this.name="LegacySandboxError",this.code=t,this.cause=s?.cause}},Kct=Object.freeze({maxArtifactContentBytes:5*1024*1024,maxRows:2e3,maxColumns:200,maxCells:4e4,executionTimeoutMs:5e3});function Yct(e,t){const n={...Kct,...e,...t};for(const[s,r]of Object.entries(n))if(!Number.isSafeInteger(r)||r<=0)throw new sr("SCHEMA_INVALID",`legacyArtifactLimits.${s} must be a positive safe integer`);return n}async function Z1e(e){let t;try{t=await e.resolveContent()}catch(o){throw e.signal.aborted||e.preserveLegacySandboxError&&o instanceof X1e?o:new sr("REF_RESOLUTION_FAILED",e.resolutionError,{cause:o})}if(typeof t!="string")throw new sr("SCHEMA_INVALID",e.returnTypeError);if(e.signal.aborted)throw new DOMException("The temporary legacy chart operation was aborted","AbortError");const n=$ct(t,e.limits),s=zct(e.source);if(!s)throw new sr("SCHEMA_INVALID","Temporary legacy chart source is empty after sanitization");const r=await Gct({source:s,inputData:n.source,signal:e.signal,timeoutMs:e.limits.executionTimeoutMs});return{data:n,spec:r}}async function Xct(e){return Z1e({source:e.block.source,signal:e.signal,limits:e.limits,resolveContent:()=>e.resolveArtifactContent({language:e.block.language,jobId:e.block.jobId,index:e.block.index,signal:e.signal}),resolutionError:"The temporary ChatBI ArtifactContent could not be resolved",returnTypeError:"resolveLegacyArtifactContent must return the raw CSV ArtifactContent string",preserveLegacySandboxError:e.preserveLegacySandboxError===!0})}async function Zct(e){return Z1e({source:e.block.source,signal:e.signal,limits:e.limits,resolveContent:()=>e.resolveSandboxFileContent({language:e.block.language,filePath:e.block.filePath,signal:e.signal}),resolutionError:"The temporary ChatBI sandbox file could not be resolved",returnTypeError:"resolveLegacySandboxFileContent must return a raw CSV string",preserveLegacySandboxError:e.preserveLegacySandboxError===!0})}var Jct=Object.freeze({maxRows:2e3,maxCells:4e4,maxSeries:100,maxDepth:40,maxNodes:1e5}),Qct=new Set(["angleAxis","aria","animation","animationDelay","animationDelayUpdate","animationDuration","animationDurationUpdate","animationEasing","animationEasingUpdate","animationThreshold","axisPointer","backgroundColor","blendMode","brush","calendar","color","darkMode","dataset","dataZoom","geo","grid","hoverLayerThreshold","legend","parallel","parallelAxis","polar","progressive","progressiveChunkMode","progressiveThreshold","radar","radiusAxis","series","singleAxis","stateAnimation","textStyle","title","tooltip","useUTC","visualMap","xAxis","yAxis"]),eut=new Set(["__proto__","prototype","constructor","extracsstext","renderitem","graphic","image","toolbox","dataview","transform","link","sublink","href","src","url"]),tut=/(?:url|uri|href|src|link)$/i,nut=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/,Jse=/(?:^|[\s("'=])(?:https?:|file:|ftp:|blob:|data:|javascript:|vbscript:|\/\/|image:\/\/)/i,sut=/\burl\s*\(/i,rut=/<\s*\/?\s*[a-z][^>]*>/i,out=/&(?:#\d+|#x[\da-f]+|[a-z][\da-z]+);/i,iut=/^[A-Za-z_][A-Za-z0-9_]*$/;function Ka(e){throw new sr("SCHEMA_INVALID",e)}function kU(e,t,n){for(const s of Object.keys(e))t.has(s)||Ka(`${n}.${s} is not allowed`)}function Qse(e,t){if(!Array.isArray(e)||e.length===0)return Ka(`${t} must be a non-empty array`);const n=e.map((s,r)=>typeof s!="string"||!iut.test(s)?Ka(`${t}[${r}] must be a stable ASCII identifier`):s);return new Set(n).size!==n.length?Ka(`${t} must not contain duplicate dimensions`):n}function aut(e,t){if(!ja(e)||typeof e.kind!="string")return Ka("echarts-fulldata.data must be an inline or ref dataset object");if(e.kind==="inline"){kU(e,new Set(["kind","dimensions","source"]),"echarts-fulldata.data");const n=Qse(e.dimensions,"echarts-fulldata.data.dimensions");if(!Array.isArray(e.source))return Ka("echarts-fulldata.data.source must be an array");e.source.forEach((r,o)=>{Array.isArray(r)||Ka(`echarts-fulldata.data.source[${o}] must be an array`),r.length!==n.length&&Ka(`echarts-fulldata.data.source[${o}] must contain ${n.length} cells`)});const s=wL(e.source,t,"echarts-fulldata.data.source");return{kind:"inline",dimensions:n,source:s}}if(e.kind==="ref"){if(kU(e,new Set(["kind","ref","format","dimensions"]),"echarts-fulldata.data"),typeof e.ref!="string"||e.ref.trim().length===0)return Ka("echarts-fulldata.data.ref must be a non-empty string");if(e.format!=="csv"&&e.format!=="json")return Ka("echarts-fulldata.data.format must be csv or json");const n=Qse(e.dimensions,"echarts-fulldata.data.dimensions");return{kind:"ref",ref:e.ref,format:e.format,dimensions:n}}return Ka(`Unsupported echarts-fulldata.data.kind: ${e.kind}`)}function J1e(e){const t=Array.isArray(e.title),n=t?e.title:[e.title];for(const[s,r]of n.entries()){if(!ja(r)||typeof r.text!="string")continue;const o=r.text.trim();if(o)return{index:s,isArray:t,title:r,text:o}}}function lut(e){return J1e(e)?.text}function cut(e,t){const n=J1e(e);if(!(!n||n.text!==t.trim())){if(Object.prototype.hasOwnProperty.call(n.title,"subtext")){delete n.title.text;return}if(n.isArray){e.title.splice(n.index,1);return}delete e.title}}function fb(e){return Array.isArray(e)?e.map(t=>fb(t)):ja(e)?Object.fromEntries(Object.entries(e).map(([t,n])=>[t,fb(n)])):e}function Q1e(e,t){if(e!==void 0)return(!Array.isArray(e)||e.some(n=>typeof n!="string"||n.length===0))&&Ka(`${t} must be an array of non-empty strings`),[...e]}function wL(e,t,n){if(Array.isArray(e)||Ka(`${n} must be an array`),e.length>t.maxRows)throw new sr("LIMIT_EXCEEDED",`${n} exceeds the ${t.maxRows} row limit`);let s=0;const r=e.map((o,i)=>{if(Array.isArray(o)){const l=o.map((c,u)=>(c!==null&&!["string","number","boolean"].includes(typeof c)&&Ka(`${n}[${i}][${u}] must be a JSON scalar`),c));return s+=l.length,l}if(ja(o)){const l={};for(const[c,u]of Object.entries(o))u!==null&&!["string","number","boolean"].includes(typeof u)&&Ka(`${n}[${i}].${c} must be a JSON scalar`),l[c]=u,s+=1;return l}return Ka(`${n}[${i}] must be an array or object`)});if(s>t.maxCells)throw new sr("LIMIT_EXCEEDED",`${n} exceeds the ${t.maxCells} cell limit`);return r}function uut(e,t){if(!ja(e)||typeof e.kind!="string")return Ka("echarts.data must be an inline or ref dataset object");const n=Q1e(e.dimensions,"echarts.data.dimensions");if(e.kind==="inline"){const s=wL(e.source,t,"echarts.data.source");return n?{kind:"inline",dimensions:n,source:s}:{kind:"inline",source:s}}return e.kind==="ref"?typeof e.ref!="string"||e.ref.length===0?Ka("echarts.data.ref must be a non-empty string"):e.format!==void 0&&e.format!=="csv"&&e.format!=="json"?Ka("echarts.data.format must be csv or json"):{kind:"ref",ref:e.ref,...e.format?{format:e.format}:{},...n?{dimensions:n}:{}}:Ka(`Unsupported echarts.data.kind: ${e.kind}`)}function ere(e,t){if(nut.test(e))throw new sr("UNSAFE_SPEC",`${t} contains an ASCII control character`);const n=e.replace(/[\n\r\t]/g,""),s=e.trim();if(Jse.test(s)||Jse.test(n.trim())||sut.test(e)||rut.test(e)||out.test(e))throw new sr("UNSAFE_SPEC",`${t} contains a URL, CSS URL, or unsafe markup`)}function dut(e,t){for(const r of Object.keys(e))if(!Qct.has(r))throw new sr("UNSAFE_SPEC",`echarts.option.${r} is not allowed`);let n=0;const s=(r,o,i)=>{if(n+=1,n>t.maxNodes)throw new sr("LIMIT_EXCEEDED",`ECharts option exceeds the ${t.maxNodes} node limit`);if(i>t.maxDepth)throw new sr("LIMIT_EXCEEDED",`ECharts option exceeds the ${t.maxDepth} depth limit`);if(typeof r=="string"){ere(r,o);return}if(Array.isArray(r)){r.forEach((l,c)=>s(l,`${o}[${c}]`,i+1));return}if(ja(r))for(const[l,c]of Object.entries(r)){const u=l.toLowerCase();if(u==="formatter"){if(typeof c!="string")throw new sr("UNSAFE_SPEC",`${o}.${l} must be a string`);ere(c,`${o}.${l}`);continue}if(eut.has(u)||tut.test(l))throw new sr("UNSAFE_SPEC",`${o}.${l} is not allowed`);if(l==="type"&&c==="custom")throw new sr("UNSAFE_SPEC","Custom ECharts series are not allowed");s(c,`${o}.${l}`,i+1)}};if(s(e,"echarts.option",0),Array.isArray(e.series)&&e.series.length>t.maxSeries)throw new sr("LIMIT_EXCEEDED",`ECharts option exceeds the ${t.maxSeries} series limit`);e.dataset!==void 0&&(Array.isArray(e.dataset)?e.dataset:[e.dataset]).forEach((o,i)=>{ja(o)||Ka(`echarts.option.dataset[${i}] must be an object`),o.source!==void 0&&wL(o.source,t,`echarts.option.dataset[${i}].source`)})}function _U(e,t,n){if(!ja(e))return Ka("ECharts specification must be an object");if(Object.prototype.hasOwnProperty.call(e,"option")||Object.prototype.hasOwnProperty.call(e,"data"))return Ka("Canonical markdown-chart data must be a sibling of spec; spec must contain the ECharts option directly");const s=fb(e),r=t===void 0?void 0:uut(t,n);return r&&Object.prototype.hasOwnProperty.call(s,"dataset")?Ka("echarts.option.dataset cannot be combined with echarts.data"):(dut(s,n),{option:s,data:r})}function hut(e,t){if(!ja(e))return Ka("echarts-fulldata must contain an object");if(kU(e,new Set(["version","data","option"]),"echarts-fulldata"),e.version!==1)throw new sr("UNSUPPORTED_VERSION","Only echarts-fulldata version 1 is supported");if(!Object.prototype.hasOwnProperty.call(e,"data"))return Ka("echarts-fulldata.data is required");if(!ja(e.option))return Ka("echarts-fulldata.option must be an object");const n=aut(e.data,t);return _U(e.option,n,t)}function fut(e){const t="default"in e?e.default:e;if(!t||typeof t.init!="function")throw new sr("RUNTIME_LOAD_FAILED","The supplied ECharts runtime has no init function");return t}function tre(e,t){const n=wL(e.source,t,"resolvedDataset.source"),s=e.dimensions?Q1e(e.dimensions,"resolvedDataset.dimensions"):void 0;return s?{data:{kind:"inline",dimensions:s,source:n},option:{dimensions:s,source:n}}:{data:{kind:"inline",source:n},option:{source:n}}}var put={light:{background:"#ffffff",foreground:"#343434",legendText:"#555555",titleText:"#343434",subtext:"#aaaaaa",axisLine:"#5d666f",valueAxisLine:"#6E7079",axisLabel:"#838d95",splitLine:"#e0e6f1",splitAreaA:"rgba(250,250,250,0.2)",splitAreaB:"rgba(210,219,238,0.2)",seriesBorder:"#ffffff",pointer:"#7c8a96",tooltipBg:"#ffffff",primary:"#6250f9",palette:["#6250F9","#33AFA9","#AB7BFF","#5F99F9","#A9AFFF","#60CCC5","#C2A5FF","#8EB8FE","#E0E3FE","#98E3DD","#E8E1FA","#D7E6FF"]},dark:{background:"#0d0d0d",foreground:"#f4f7ff",legendText:"#c8cad0",titleText:"#e0e2e8",subtext:"#8a8d93",axisLine:"#555a63",valueAxisLine:"#555a63",axisLabel:"#9da1a8",splitLine:"#3a3e47",splitAreaA:"rgba(60,60,70,0.2)",splitAreaB:"rgba(80,80,90,0.2)",seriesBorder:"#2a2d35",pointer:"#6a707a",tooltipBg:"rgba(30, 32, 40, 0.95)",primary:"#8aa0ff",palette:["#8EA0FF","#61D6D1","#C8A7FF","#8EB8FE","#C7CCFF","#8DE7E2","#D8C5FF","#B8D2FF","#EEF0FF","#C2F0ED","#F0EAFE","#E8F1FF"]}};function B0(e,t){const n={...fb(e),...t};for(const[s,r]of Object.entries(e)){const o=t[s];ja(r)&&ja(o)&&(n[s]=B0(r,o))}return n}function k3(e,t){return Array.isArray(e)?e.map(n=>ja(n)?B0(t,n):n):ja(e)?B0(t,e):e??fb(t)}function exe(e){const t=n=>ja(n)?{...n,appendToBody:!1,confine:!0,enterable:!1,renderMode:"richText"}:n;return Array.isArray(e)?e.map(t):t(e)}function ZE(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function mut(e,t){const n=s=>{if(!ZE(s,"top")&&!ZE(s,"bottom"))return B0(t,s);const r=fb(t);return delete r.top,delete r.bottom,B0(r,s)};return Array.isArray(e)?e.map(s=>ja(s)?n(s):s):ja(e)?n(e):e??fb(t)}var gut=740,txe=10,nre=gut*txe/100,vut=24,wut=24,sre=16,yut=24;function nxe(e){if(typeof e=="number")return Number.isFinite(e)&&e>=0&&e<=nre?e:null;if(typeof e!="string")return null;const t=e.trim();if(t==="top")return 0;const n=/^([+-]?(?:\d+(?:\.\d*)?|\.\d+))%$/.exec(t);if(!n)return null;const s=Number(n[1]);return Number.isFinite(s)&&s>=0&&s<=txe?nre:null}function but(e){return["text","subtext"].some(t=>typeof e[t]=="string"&&e[t].trim().length>0)}function xut(e){return e.show===!1||!but(e)?null:ZE(e,"top")?nxe(e.top):ZE(e,"bottom")?null:0}function kut(e){return e.show===!1||!ZE(e,"top")?null:nxe(e.top)}function rre(e){return Array.isArray(e)?e.filter(ja):ja(e)?[e]:[]}function _ut(e,t){const n=rre(e).flatMap(r=>{const o=xut(r);return o===null?[]:[o+vut+sre]}),s=rre(t).flatMap(r=>{const o=kut(r);return o===null?[]:[o+wut+sre]});return Math.max(yut,...n,...s)}function ore(e,t){return Array.isArray(e)?e.map((n,s)=>ja(n)?B0(t(s),n):n):ja(e)?B0(t(0),e):e}function ire(e,t){const n=typeof e.type=="string"?e.type:void 0;let s={emphasis:{focus:"series",itemStyle:{borderColor:t.seriesBorder,borderWidth:2}},labelLayout:{hideOverlap:!0}};n==="line"?s=B0(s,{lineStyle:{width:2},itemStyle:{borderWidth:1},symbol:"circle",symbolSize:4}):n==="bar"?s=B0(s,{barCategoryGap:"48%",barMaxWidth:42,itemStyle:{borderRadius:[3,3,0,0]}}):n==="pie"&&(s=B0(s,{itemStyle:{borderColor:t.seriesBorder,borderWidth:2}}));const r=B0(s,e);return Object.prototype.hasOwnProperty.call(e,"tooltip")&&(r.tooltip=exe(k3(e.tooltip,{appendToBody:!1,confine:!0,enterable:!1,renderMode:"richText"}))),r}var sxe=new Set(["pie","funnel","gauge","radar","treemap"]),Sut=new Set([...sxe,"graph","chord","themeRiver"]);function rxe(e){return Array.isArray(e.series)?e.series.filter(ja):ja(e.series)?[e.series]:[]}function Cut(e){if(Object.prototype.hasOwnProperty.call(e,"legend"))return!0;const t=rxe(e);return t.some(n=>typeof n.type=="string"&&Sut.has(n.type))?!0:t.filter(n=>typeof n.name=="string"&&n.name.trim().length>0).length>1}function Tut(e){if(!Object.prototype.hasOwnProperty.call(e,"xAxis")&&!Object.prototype.hasOwnProperty.call(e,"yAxis"))return"item";const t=rxe(e);return t.length>0&&t.every(n=>typeof n.type=="string"&&sxe.has(n.type))?"item":"axis"}function Iut(e){return e==null||e==="light"?"light":e==="dark"?"dark":void 0}function Rut(e,t="light"){const n=put[t],s=fb(e);return s.backgroundColor??=n.background,s.color??=[...n.palette],s.textStyle=k3(s.textStyle,{color:n.foreground,fontFamily:"'pingfang SC', 'helvetica neue', arial, 'hiragino sans gb', 'microsoft yahei ui', 'microsoft yahei', sans-serif"}),s.title!==void 0&&(s.title=k3(s.title,{textStyle:{color:n.titleText},subtextStyle:{color:n.subtext}})),s.tooltip=exe(k3(s.tooltip,{trigger:Tut(e),appendToBody:!1,confine:!0,enterable:!1,renderMode:"richText",backgroundColor:n.tooltipBg,borderColor:n.splitLine,borderWidth:1,padding:[8,10],textStyle:{color:n.titleText,fontSize:12},axisPointer:{lineStyle:{color:n.pointer,width:1},crossStyle:{color:n.pointer,width:1}}})),Cut(e)&&(s.legend=mut(s.legend,{type:"scroll",bottom:8,padding:[4,16],textStyle:{color:n.legendText,fontSize:12},pageIconColor:n.primary,pageIconInactiveColor:n.splitLine,pageTextStyle:{color:n.legendText}})),s.grid=k3(s.grid,{top:_ut(s.title,s.legend),right:36,bottom:48,left:24,containLabel:!0}),s.xAxis!==void 0&&(s.xAxis=ore(s.xAxis,()=>({axisLine:{show:!0,lineStyle:{color:n.axisLine}},axisTick:{show:!0,lineStyle:{color:n.axisLine}},axisLabel:{color:n.axisLabel,fontSize:12,hideOverlap:!0},splitLine:{show:!1,lineStyle:{color:n.splitLine}},splitArea:{show:!1,areaStyle:{color:[n.splitAreaA,n.splitAreaB]}},nameTextStyle:{color:n.axisLabel}}))),s.yAxis!==void 0&&(s.yAxis=ore(s.yAxis,r=>({alignTicks:!0,axisLine:{show:!1,lineStyle:{color:n.valueAxisLine}},axisTick:{show:!1,lineStyle:{color:n.valueAxisLine}},axisLabel:{color:n.axisLabel,fontSize:12,hideOverlap:!0},splitLine:{show:r===0,lineStyle:{color:n.splitLine}},splitArea:{show:!1,areaStyle:{color:[n.splitAreaA,n.splitAreaB]}},nameGap:12,nameTextStyle:{color:n.axisLabel,align:r===0?"left":"right"}}))),Array.isArray(s.series)?s.series=s.series.map(r=>ja(r)?ire(r,n):r):ja(s.series)&&(s.series=ire(s.series,n)),s}var G$={dispose(){}};function Eut(e={}){const t={...Jct,...e.limits},n=e.legacySandbox?.resolveLegacyArtifactContent,s=e.legacySandbox?.resolveLegacySandboxFileContent,r=e.legacySandbox?Yct({maxRows:t.maxRows,maxCells:t.maxCells},void 0):void 0,o=e.loadECharts??(async()=>await Je(()=>import("./index-CL4z8Fsq.js"),[])),i=async(l,c)=>{if(e.validateDataRef&&!e.validateDataRef(l.ref))throw new sr("REF_REJECTED","The host rejected the chart data reference");if(!e.resolveDataRef)throw new sr("REF_RESOLVER_MISSING","A resolveDataRef callback is required");let u;try{u=await e.resolveDataRef(l.ref,{format:l.format,dimensions:l.dimensions,signal:c})}catch(f){if(c.aborted)return;throw new sr("REF_RESOLUTION_FAILED","The chart dataset could not be resolved",{cause:f})}if(c.aborted)return;const h=u.dimensions||!l.dimensions?u:{...u,dimensions:l.dimensions};return tre(h,t).data};return{id:"echarts",aliases:["echarts-fulldata"],matchLanguage:Pct,parse(l,c){return c.language==="echarts-fulldata"?hut(l,t):_U(l,c.data,t)},parseSource(l,c){return Y1e(c.language)?{option:{},data:void 0,legacyEChartSandboxFile:Dct(c.rawLanguage??c.language,l)}:{option:{},data:void 0,legacyEChartQuery:Lct(c.language,l)}},getTitle(l){return lut(l.option)},async materialize(l,c){if(!l.legacyEChartQuery&&!l.legacyEChartSandboxFile){if(l.data?.kind==="ref"){const m=await i(l.data,c.signal);return m?{parsed:{...l,data:m},data:m}:{parsed:l,data:c.data}}return{parsed:l,data:l.data}}if(l.legacyEChartQuery&&!n)throw new sr("REF_RESOLVER_MISSING","legacySandbox is required for this temporary ChatBI query fence");if(l.legacyEChartSandboxFile&&!s)throw new sr("REF_RESOLVER_MISSING","legacySandbox is required for this temporary ChatBI sandbox-file fence");let u;try{l.legacyEChartSandboxFile?u=await Zct({block:l.legacyEChartSandboxFile,signal:c.signal,resolveSandboxFileContent:s,limits:r,preserveLegacySandboxError:e.legacySandbox!==void 0}):u=await Xct({block:l.legacyEChartQuery,signal:c.signal,resolveArtifactContent:n,limits:r,preserveLegacySandboxError:!0})}catch(m){if(c.signal.aborted)return{parsed:l,data:c.data};throw m instanceof sr||m instanceof X1e?m:new sr("REF_RESOLUTION_FAILED","The temporary ChatBI chart could not be resolved",{cause:m})}if(c.signal.aborted)return{parsed:l,data:c.data};let h;try{h=hye(u,{maxDepth:t.maxDepth,maxNodes:t.maxNodes})}catch(m){throw m instanceof sr?m:new sr("SCHEMA_INVALID","Temporary ChatBI resolver returned a non-JSON result",{cause:m})}if(!ja(h))return Ka("Temporary ChatBI resolver must return an object");if(!Object.prototype.hasOwnProperty.call(h,"data")||!Object.prototype.hasOwnProperty.call(h,"spec"))return Ka("Temporary ChatBI resolver must return data and spec");const f=_U(h.spec,h.data,t);return f.data?.kind!=="inline"?Ka("Temporary ChatBI resolver must return inline data"):{parsed:f,data:f.data}},async mount(l,c,u){if(c.legacyEChartQuery||c.legacyEChartSandboxFile)return Ka("Temporary ChatBI charts must be materialized before mounting");const h=fb(c.option);if(u.externalizedTitle&&cut(h,u.externalizedTitle),c.data){let x;if(c.data.kind==="inline")x=c.data;else{const _=await i(c.data,u.signal);if(!_)return G$;x=_}const k=tre(x,t);h.dataset=k.option}if(u.signal.aborted)return G$;let f;try{f=fut(await o())}catch(x){throw x instanceof sr?x:new sr("RUNTIME_LOAD_FAILED","The ECharts runtime could not be loaded",{cause:x})}if(u.signal.aborted)return G$;let m,g;try{const x=typeof u.theme=="string"||ja(u.theme)?u.theme:void 0;m=f.init(l,x);const k=Iut(u.theme),_=e.defaultStyle===!1||!k?h:Rut(h,k);m.setOption(_,{notMerge:!0,lazyUpdate:!1}),e.resizeObserver!==!1&&typeof ResizeObserver<"u"&&(g=new ResizeObserver(()=>m?.resize()),g.observe(l))}catch(x){try{g?.disconnect()}catch{}try{m?.dispose()}catch{}throw new sr("RENDER_FAILED","ECharts failed to render the chart",{cause:x})}const w=m;let y=!1;return{resize:()=>w.resize(),dispose(){y||(y=!0,g?.disconnect(),w.dispose())}}}}}var eY=d.createContext(null);function Aut(e){if(d.isValidElement(e))return typeof e.props.children=="string"?e.props.children:void 0}function jut(e){const t=e.source??Aut(e.children),n=d.useMemo(()=>({registry:e.registry,theme:e.theme,streaming:e.streaming??!1,source:t,loadingLabel:e.loadingLabel,labels:e.labels,onError:e.onError}),[e.registry,e.theme,e.streaming,t,e.loadingLabel,e.labels,e.onError]);return d.createElement(eY.Provider,{value:n},e.children)}function Nut(e){const t=d.useContext(eY);if(!t)throw new Error("MarkdownChartBlock must be rendered inside MarkdownChartProvider");const n=d.useRef(null),s=e.streaming??t.streaming,r=e.loadingLabel??t.loadingLabel,o=e.labels??t.labels,i=d.useMemo(()=>pye(o),[o]);d.useEffect(()=>{const c=n.current;if(!c)return;const u=new zJe(t.registry);let h=!1;return u.render(c,{language:e.language,source:e.source,theme:t.theme,streaming:s,...r!==void 0?{loadingLabel:r}:{},...o!==void 0?{labels:o}:{}}).catch(f=>{h||(c.classList.add("markdown-chart-error"),c.setAttribute("role","alert"),c.textContent=i.chartUnavailable,t.onError?.(f,{language:e.language,source:e.source}))}),()=>{h=!0,u.dispose()}},[t.registry,t.theme,t.onError,r,o,i,e.language,e.source,s]);const l=["markdown-chart-placeholder",s?"markdown-chart-streaming":void 0,e.className].filter(Boolean).join(" ");return d.createElement("div",{ref:n,className:l,style:e.style,"aria-label":i.chart,"aria-busy":s||void 0,"data-markdown-chart-complete":String(!s)})}function Mut(e,t){const n=t?.position?.start?.offset,s=t?.position?.end?.offset;if(e===void 0||n===void 0||s===void 0)return!1;const r=e.lastIndexOf(`
1618
- `,Math.max(0,n-1))+1,o=e.slice(r,n),i=/^(?: {0,3}>[ \t]?)+$/.test(o)?r:n;return gye(e.slice(i,s))||e.slice(s).trim().length>0}function oxe(e,t){return e===NM||t?.has(e)===!0}function Put(e={}){return{code({node:n,...s}){return d.createElement("code",s)},pre:function({node:s,children:r,...o}){const i=d.useContext(eY);if(d.isValidElement(r)){const l=r,u=/(?:^|\s)language-([^\s]+)/.exec(l.props.className??"")?.[1],h=u?.toLowerCase();if(u&&h&&oxe(h,i?.registry)){const f=d.Children.toArray(l.props.children).map(m=>typeof m=="string"||typeof m=="number"?String(m):"").join("");return d.createElement(Nut,{language:u,source:f,streaming:i?.streaming===!0&&!Mut(i.source,s),...e.chartClassName?{className:e.chartClassName}:{},...e.chartStyle?{style:e.chartStyle}:{}})}}return d.createElement("pre",o,r)}}}const Lut=3e4,Dut=["artifact://","session-file://"],Out=/^[a-z]:/i;function $ut(e={}){const{resolveDataRef:t,validateDataRef:n=Uut,...s}=e,r=e.validateDataRef===void 0,o=t?async(i,l)=>{const c=r?ixe(i):i;if(!c)throw new Error("Chart data reference is not supported.");return Wut(Promise.resolve(t(c,l)),"Chart data reference resolution")}:void 0;return new CJe().register(Eut({...s,resolveDataRef:o,validateDataRef:n}))}const But={registry:$ut()};function Fut(e,t={}){const n=Put(t).pre;if(!n)throw new Error("markdown-chart React adapter did not provide a pre renderer");return function({children:r,...o}){if(d.isValidElement(r)){const i=r,c=/(?:^|\s)language-([^\s]+)/.exec(i.props.className??"")?.[1]?.toLowerCase();if(c&&oxe(c,e))return d.createElement(n,o,r)}return d.createElement(d.Fragment,null,r)}}function zut({customization:e,source:t,streaming:n,theme:s,children:r}){const o=Hut(e.labels),{t:i}=Ct();return a.jsx(jut,{registry:e.registry,source:t,streaming:n,theme:s,loadingLabel:e.loadingLabel??i("echartsChart.rendering"),labels:o,onError:e.onError,children:r})}function Hut(e){const{t}=Ct();return d.useMemo(()=>({chartUnavailable:t("echartsChart.renderFailed"),viewMode:t("echartsChart.viewMode"),chart:t("echartsChart.chart"),data:t("echartsChart.data"),showChart:t("echartsChart.showChart"),showData:t("echartsChart.showData"),noData:t("echartsChart.noData"),tableNotice:({visibleRows:n,totalRows:s,visibleColumns:r,totalColumns:o})=>t("echartsChart.tableNotice",{visibleRows:n,totalRows:s,visibleColumns:r,totalColumns:o,omittedRows:s-n,omittedColumns:o-r}),...e}),[e,t])}function are(e){return/\s/.test(e)||Array.from(e).some(t=>{const n=t.codePointAt(0);return n!==void 0&&(n<=31||n===127)})}function ixe(e){if(e.trim()!==e||!e||are(e))return;const t=e.toLowerCase(),n=Dut.find(i=>t.startsWith(i));if(!n)return;const s=e.slice(n.length);if(!s||/[?#\\]/.test(s))return;let r;try{r=decodeURIComponent(s)}catch{return}if(/[%?#\\]/.test(r)||are(r))return;const o=r.split("/");if(!o.some(i=>i.length===0||i==="."||i===".."||Out.test(i)))return`${n}${o.join("/")}`}function Uut(e){return ixe(e)!==void 0}function Wut(e,t){return new Promise((n,s)=>{const r=globalThis.setTimeout(()=>s(new Error(`${t} timed out.`)),Lut);e.then(n,s).finally(()=>globalThis.clearTimeout(r))})}const qut="_content_1ns4y_1",Vut="_streamingPlainText_1ns4y_11",Gut="_inlineCode_1ns4y_135",Kut="_link_1ns4y_147",Yut="_tableWrapper_1ns4y_157",Xut="_table_1ns4y_157",Zut="_image_1ns4y_187",Jut="_codeBlock_1ns4y_195",Qut="_codeBlockHeader_1ns4y_204",edt="_codeBlockLang_1ns4y_213",tdt="_codeBlockCopy_1ns4y_221",ndt="_codeBlockContent_1ns4y_244",sdt="_codeBlockPlain_1ns4y_264",rdt="_mermaidBlock_1ns4y_282",odt="_mermaidInline_1ns4y_294",idt="_mermaidStage_1ns4y_308",adt="_mermaidLoading_1ns4y_331",ldt="_mermaidActions_1ns4y_338",cdt="_mermaidZoomWrapper_1ns4y_343",udt="_mermaidPannable_1ns4y_358",ddt="_mermaidDragging_1ns4y_362",ri={content:qut,streamingPlainText:Vut,inlineCode:Gut,link:Kut,tableWrapper:Yut,table:Xut,image:Zut,codeBlock:Jut,codeBlockHeader:Qut,codeBlockLang:edt,codeBlockCopy:tdt,codeBlockContent:ndt,codeBlockPlain:sdt,mermaidBlock:rdt,mermaidInline:odt,mermaidStage:idt,mermaidLoading:adt,mermaidActions:ldt,mermaidZoomWrapper:cdt,mermaidPannable:udt,mermaidDragging:ddt},hdt=32e3,fdt=new Set(["javascript","typescript","python","rust","go","java","c","cpp","csharp","fsharp","ruby","php","swift","kotlin","scala","bash","fish","powershell","sql","html","css","scss","json","yaml","toml","xml","markdown","dockerfile","graphql","lua","r","matlab","perl","haskell","elixir","erlang","clojure","dart","vue","svelte","astro","tsx","jsx","diff"]),lre={"c++":"cpp","c#":"csharp","f#":"fsharp",ts:"typescript",js:"javascript",py:"python",rb:"ruby",rs:"rust",kt:"kotlin",cs:"csharp",sh:"bash",zsh:"bash",shell:"bash",yml:"yaml",md:"markdown",golang:"go",ps1:"powershell",docker:"dockerfile"};function tY(e){const t=(e||"").toLowerCase(),n=Object.hasOwn(lre,t)?lre[t]:t,s=fdt.has(n)?n:"text";return{label:(e||"").trim()||"text",lang:n,resolvedLang:s}}const axe=/^(https?:|mailto:)/i,pdt=/^data:image\/(png|jpeg|gif|webp|bmp);base64,/i,lxe=/^data:image\/(png|jpeg|gif|webp);base64,[A-Za-z0-9+/]*={0,2}$/i;function N4(e){if(!e)return!1;const t=e.trim();return t?t.startsWith("#")||t.startsWith("/")&&!t.startsWith("//")?!0:axe.test(t):!1}function Ow(e,t=!1){if(!e)return!1;const n=e.trim();return n?t?lxe.test(n):n.startsWith("#")||n.startsWith("/")&&!n.startsWith("//")||pdt.test(n)?!0:axe.test(n):!1}let cre,ure=Promise.resolve(),mdt=0;const gdt=5e4,vdt=500,wdt=1e4,dre=16;function ydt({code:e}){const{t}=Ct(),n=yb(),s=Vl()!=="interactive",[r,o]=d.useState(null),[i,l]=d.useState(null),[c,u]=d.useState("diagram"),[h,f]=bx(),[m,g]=d.useState(1),[w,y]=d.useState(!1),x=d.useRef(null),[k,_]=d.useState(!1),[S,I]=d.useState(!1),[E,A]=d.useState(null),j=d.useRef(null),L=d.useRef(null),R=n==="light"?"default":"dark",N=.5,M=3,O=.25,P=()=>{g(V=>Math.min(M,Math.round((V+O)*100)/100))},F=()=>{g(V=>Math.max(N,Math.round((V-O)*100)/100))},H=d.useCallback(()=>{L.current=null,y(!1),g(1);const V=x.current;V&&(V.scrollLeft=0,V.scrollTop=0),_(!1)},[]),$=d.useCallback(V=>{const J=x.current;J&&(V.preventDefault(),y(!0),L.current={startX:V.clientX,startY:V.clientY,startLeft:J.scrollLeft,startTop:J.scrollTop})},[]),Y=d.useCallback(V=>{const{scrollLeft:J,scrollTop:q}=V.currentTarget;_(J!==0||q!==0)},[]),Z=d.useCallback(()=>{const V=x.current;V&&(I(V.scrollWidth>V.clientWidth||V.scrollHeight>V.clientHeight),_(V.scrollLeft!==0||V.scrollTop!==0))},[]),K=d.useCallback(()=>{const V=x.current,J=j.current?.querySelector("svg");if(!V||!J)return;const[,,q,te]=(J.getAttribute("viewBox")??"").split(/[\s,]+/).map(Number),ie=(J.getAttribute("width")??"").trim(),ge=Number.parseFloat(J.getAttribute("height")??""),re=q>0&&te>0,G=re?q:Number.parseFloat(ie),Q=re?te:ge;if(!(G>0)||!(Q>0)){A(null);return}const he=V.clientWidth-dre*2,ve=ie.endsWith("%")&&he>0?Math.min(G,he):G,ye=Math.max(0,V.offsetHeight-V.clientHeight);A({stageWidth:ve,canvasHeight:ve*Q/G+dre*2+ye})},[]);d.useEffect(()=>{if(!w)return;const V=q=>{const te=x.current,ie=L.current;!te||!ie||(te.scrollLeft=ie.startLeft-(q.clientX-ie.startX),te.scrollTop=ie.startTop-(q.clientY-ie.startY),_(te.scrollLeft!==0||te.scrollTop!==0))},J=()=>{L.current=null,y(!1)};return window.addEventListener("mousemove",V),window.addEventListener("mouseup",J),window.addEventListener("blur",J),()=>{window.removeEventListener("mousemove",V),window.removeEventListener("mouseup",J),window.removeEventListener("blur",J)}},[w]),d.useEffect(()=>{H()},[e,H]),d.useLayoutEffect(()=>{K(),Z()},[r,m,c,K,Z]),d.useEffect(()=>{const V=x.current;if(!V)return;const J=new ResizeObserver(()=>{K(),Z()});return J.observe(V),()=>J.disconnect()},[r,c,K,Z]),d.useEffect(()=>{let V=!1;o(null),l(null);const J=setTimeout(()=>{Je(()=>import("./mermaid.core-CIdivnr2.js").then(q=>q.cb),[]).then(async q=>{if(V)return;const te=q.default,ie=`${R}:${s?"hardened":"runtime"}`,ge=ure.then(async()=>{if(V)throw new Error("Mermaid render skipped");cre!==ie&&(te.initialize({startOnLoad:!1,theme:R,securityLevel:"strict",suppressErrorRendering:!0,...s?{maxTextSize:gdt,maxEdges:vdt}:{},flowchart:{wrappingWidth:300,useMaxWidth:!1}}),cre=ie);const G=`mermaid-${++mdt}`;if(!s)return te.render(G,e.trim());let Q;try{return await Promise.race([te.render(G,e.trim()),new Promise((he,ve)=>{Q=setTimeout(()=>ve(new Error("Mermaid render timed out")),wdt)})])}finally{Q!==void 0&&clearTimeout(Q)}});ure=ge.then(()=>{},()=>{});const{svg:re}=await ge;V||o(re)}).catch(q=>{V||l(q instanceof Error?q.message:"Mermaid render failed")})},150);return()=>{V=!0,clearTimeout(J)}},[e,s,R]);const B=()=>{Yf(e).then(()=>{f()}).catch(W0)};return i?a.jsxs("div",{className:ri.codeBlock,children:[a.jsx("div",{className:ri.codeBlockHeader,children:a.jsx("span",{className:ri.codeBlockLang,children:t("mermaid.errorLabel")})}),a.jsx("pre",{className:`${ri.codeBlockContent} ${ri.codeBlockPlain}`,children:a.jsx("code",{children:e})})]}):a.jsxs("div",{className:ri.codeBlock,children:[a.jsxs("div",{className:ri.codeBlockHeader,children:[a.jsx("span",{className:ri.codeBlockLang,children:t("mermaid.label")}),a.jsxs("span",{className:ri.mermaidActions,children:[c==="diagram"&&a.jsxs(a.Fragment,{children:[a.jsx("button",{className:ri.codeBlockCopy,onClick:F,title:t("mermaid.zoomOut"),disabled:m<=N,children:t("mermaid.zoomOut")}),a.jsx("button",{className:ri.codeBlockCopy,onClick:H,title:t("mermaid.zoomReset"),disabled:m===1&&!k,children:t("mermaid.zoomReset")}),a.jsx("button",{className:ri.codeBlockCopy,onClick:P,title:t("mermaid.zoomIn"),disabled:m>=M,children:t("mermaid.zoomIn")})]}),a.jsx("button",{className:ri.codeBlockCopy,onClick:()=>u(c==="diagram"?"code":"diagram"),children:t(c==="diagram"?"mermaid.viewCode":"mermaid.viewDiagram")}),a.jsx("button",{className:ri.codeBlockCopy,onClick:B,children:t(h?"code.copied":"code.copy")})]})]}),c==="code"?a.jsx("pre",{className:`${ri.codeBlockContent} ${ri.codeBlockPlain}`,children:a.jsx("code",{children:e})}):r?a.jsx("div",{className:`${ri.mermaidZoomWrapper} ${S?ri.mermaidPannable:""} ${S&&w?ri.mermaidDragging:""}`,ref:x,style:E?{height:E.canvasHeight}:void 0,onMouseDown:$,onDoubleClick:H,onScroll:Y,children:a.jsx("div",{className:`${ri.mermaidBlock} ${ri.mermaidStage}`,ref:j,style:{...E?{width:E.stageWidth}:{},...m===1?{}:{zoom:m}},dangerouslySetInnerHTML:{__html:r}})}):a.jsx("div",{className:`${ri.mermaidBlock} ${ri.mermaidLoading} ${ri.mermaidInline}`,children:a.jsx("span",{children:t("mermaid.rendering")})})]})}function bdt({className:e,children:t,isStreaming:n}){const{t:s}=Ct(),r=yb(),o=Vl()==="document",[i,l]=d.useState(null),[c,u]=bx(),{label:h,lang:f,resolvedLang:m}=tY(cxe(e)),g=String(t).replace(/\n$/,""),w=r==="light"?"github-light-default":"github-dark-default";d.useEffect(()=>{if(o||n||f==="mermaid"||m==="text"||vU(g)){l(null);return}const x=pat(g,m,w);if(x!==null){l(x);return}const k=zse(g,m,w,!0);if(k!==null){l(k);return}l(null);let _=!1;return N1e(m).then(()=>{if(_)return;const S=zse(g,m,w,!0);S!==null&&l(S)}).catch(S=>{_||(console.warn("[web-shell] highlight failed for lang=%s",m,S),l(null))}),()=>{_=!0}},[g,o,f,m,w,n]);const y=()=>{Yf(g).then(()=>{u()}).catch(W0)};return f==="mermaid"&&!n&&!o?a.jsx(ydt,{code:g}):a.jsxs("div",{className:ri.codeBlock,children:[a.jsxs("div",{className:ri.codeBlockHeader,children:[a.jsx("span",{className:ri.codeBlockLang,children:h}),a.jsx("button",{className:ri.codeBlockCopy,onClick:y,children:s(c?"code.copied":"code.copy")})]}),!o&&!n&&i!==null?a.jsx("div",{className:ri.codeBlockContent,dangerouslySetInnerHTML:{__html:i}}):a.jsx("pre",{className:`${ri.codeBlockContent} ${ri.codeBlockPlain}`,children:a.jsx("code",{children:g})})]})}function cxe(e){const t=e?.match(/(?:^|\s)language-([^\s]+)/)?.[1]??"",n=t.match(/^([\w+.#-]+)/);if(!n)return"";const s=n[1]??"",r=t[s.length];return!r||r==="{"||r===":"?s:""}function xdt({children:e}){return a.jsx("code",{className:ri.inlineCode,children:e})}function hre({children:e}){return a.jsx("div",{className:ri.tableWrapper,children:a.jsx("table",{className:ri.table,children:e})})}const uxe=d.createContext(!1),dxe=d.createContext(void 0),hxe=d.createContext(void 0);function kdt(e,t,n){if(!n||e===void 0)return!1;const s=t?.position?.start.offset,r=t?.position?.end.offset;return s===void 0||r===void 0?!1:!gye(e.slice(s,r))&&e.slice(r).trim().length===0}function _dt({className:e,children:t,node:n}){const s=d.useContext(uxe),r=d.useContext(hxe);return e?.startsWith("language-")||typeof t=="string"&&t.includes(`
1618
+ `,Math.max(0,n-1))+1,o=e.slice(r,n),i=/^(?: {0,3}>[ \t]?)+$/.test(o)?r:n;return gye(e.slice(i,s))||e.slice(s).trim().length>0}function oxe(e,t){return e===NM||t?.has(e)===!0}function Put(e={}){return{code({node:n,...s}){return d.createElement("code",s)},pre:function({node:s,children:r,...o}){const i=d.useContext(eY);if(d.isValidElement(r)){const l=r,u=/(?:^|\s)language-([^\s]+)/.exec(l.props.className??"")?.[1],h=u?.toLowerCase();if(u&&h&&oxe(h,i?.registry)){const f=d.Children.toArray(l.props.children).map(m=>typeof m=="string"||typeof m=="number"?String(m):"").join("");return d.createElement(Nut,{language:u,source:f,streaming:i?.streaming===!0&&!Mut(i.source,s),...e.chartClassName?{className:e.chartClassName}:{},...e.chartStyle?{style:e.chartStyle}:{}})}}return d.createElement("pre",o,r)}}}const Lut=3e4,Dut=["artifact://","session-file://"],Out=/^[a-z]:/i;function $ut(e={}){const{resolveDataRef:t,validateDataRef:n=Uut,...s}=e,r=e.validateDataRef===void 0,o=t?async(i,l)=>{const c=r?ixe(i):i;if(!c)throw new Error("Chart data reference is not supported.");return Wut(Promise.resolve(t(c,l)),"Chart data reference resolution")}:void 0;return new CJe().register(Eut({...s,resolveDataRef:o,validateDataRef:n}))}const But={registry:$ut()};function Fut(e,t={}){const n=Put(t).pre;if(!n)throw new Error("markdown-chart React adapter did not provide a pre renderer");return function({children:r,...o}){if(d.isValidElement(r)){const i=r,c=/(?:^|\s)language-([^\s]+)/.exec(i.props.className??"")?.[1]?.toLowerCase();if(c&&oxe(c,e))return d.createElement(n,o,r)}return d.createElement(d.Fragment,null,r)}}function zut({customization:e,source:t,streaming:n,theme:s,children:r}){const o=Hut(e.labels),{t:i}=Ct();return a.jsx(jut,{registry:e.registry,source:t,streaming:n,theme:s,loadingLabel:e.loadingLabel??i("echartsChart.rendering"),labels:o,onError:e.onError,children:r})}function Hut(e){const{t}=Ct();return d.useMemo(()=>({chartUnavailable:t("echartsChart.renderFailed"),viewMode:t("echartsChart.viewMode"),chart:t("echartsChart.chart"),data:t("echartsChart.data"),showChart:t("echartsChart.showChart"),showData:t("echartsChart.showData"),noData:t("echartsChart.noData"),tableNotice:({visibleRows:n,totalRows:s,visibleColumns:r,totalColumns:o})=>t("echartsChart.tableNotice",{visibleRows:n,totalRows:s,visibleColumns:r,totalColumns:o,omittedRows:s-n,omittedColumns:o-r}),...e}),[e,t])}function are(e){return/\s/.test(e)||Array.from(e).some(t=>{const n=t.codePointAt(0);return n!==void 0&&(n<=31||n===127)})}function ixe(e){if(e.trim()!==e||!e||are(e))return;const t=e.toLowerCase(),n=Dut.find(i=>t.startsWith(i));if(!n)return;const s=e.slice(n.length);if(!s||/[?#\\]/.test(s))return;let r;try{r=decodeURIComponent(s)}catch{return}if(/[%?#\\]/.test(r)||are(r))return;const o=r.split("/");if(!o.some(i=>i.length===0||i==="."||i===".."||Out.test(i)))return`${n}${o.join("/")}`}function Uut(e){return ixe(e)!==void 0}function Wut(e,t){return new Promise((n,s)=>{const r=globalThis.setTimeout(()=>s(new Error(`${t} timed out.`)),Lut);e.then(n,s).finally(()=>globalThis.clearTimeout(r))})}const qut="_content_1ns4y_1",Vut="_streamingPlainText_1ns4y_11",Gut="_inlineCode_1ns4y_135",Kut="_link_1ns4y_147",Yut="_tableWrapper_1ns4y_157",Xut="_table_1ns4y_157",Zut="_image_1ns4y_187",Jut="_codeBlock_1ns4y_195",Qut="_codeBlockHeader_1ns4y_204",edt="_codeBlockLang_1ns4y_213",tdt="_codeBlockCopy_1ns4y_221",ndt="_codeBlockContent_1ns4y_244",sdt="_codeBlockPlain_1ns4y_264",rdt="_mermaidBlock_1ns4y_282",odt="_mermaidInline_1ns4y_294",idt="_mermaidStage_1ns4y_308",adt="_mermaidLoading_1ns4y_331",ldt="_mermaidActions_1ns4y_338",cdt="_mermaidZoomWrapper_1ns4y_343",udt="_mermaidPannable_1ns4y_358",ddt="_mermaidDragging_1ns4y_362",ri={content:qut,streamingPlainText:Vut,inlineCode:Gut,link:Kut,tableWrapper:Yut,table:Xut,image:Zut,codeBlock:Jut,codeBlockHeader:Qut,codeBlockLang:edt,codeBlockCopy:tdt,codeBlockContent:ndt,codeBlockPlain:sdt,mermaidBlock:rdt,mermaidInline:odt,mermaidStage:idt,mermaidLoading:adt,mermaidActions:ldt,mermaidZoomWrapper:cdt,mermaidPannable:udt,mermaidDragging:ddt},hdt=32e3,fdt=new Set(["javascript","typescript","python","rust","go","java","c","cpp","csharp","fsharp","ruby","php","swift","kotlin","scala","bash","fish","powershell","sql","html","css","scss","json","yaml","toml","xml","markdown","dockerfile","graphql","lua","r","matlab","perl","haskell","elixir","erlang","clojure","dart","vue","svelte","astro","tsx","jsx","diff"]),lre={"c++":"cpp","c#":"csharp","f#":"fsharp",ts:"typescript",js:"javascript",py:"python",rb:"ruby",rs:"rust",kt:"kotlin",cs:"csharp",sh:"bash",zsh:"bash",shell:"bash",yml:"yaml",md:"markdown",golang:"go",ps1:"powershell",docker:"dockerfile"};function tY(e){const t=(e||"").toLowerCase(),n=Object.hasOwn(lre,t)?lre[t]:t,s=fdt.has(n)?n:"text";return{label:(e||"").trim()||"text",lang:n,resolvedLang:s}}const axe=/^(https?:|mailto:)/i,pdt=/^data:image\/(png|jpeg|gif|webp|bmp);base64,/i,lxe=/^data:image\/(png|jpeg|gif|webp);base64,[A-Za-z0-9+/]*={0,2}$/i;function N4(e){if(!e)return!1;const t=e.trim();return t?t.startsWith("#")||t.startsWith("/")&&!t.startsWith("//")?!0:axe.test(t):!1}function Ow(e,t=!1){if(!e)return!1;const n=e.trim();return n?t?lxe.test(n):n.startsWith("#")||n.startsWith("/")&&!n.startsWith("//")||pdt.test(n)?!0:axe.test(n):!1}let cre,ure=Promise.resolve(),mdt=0;const gdt=5e4,vdt=500,wdt=1e4,dre=16;function ydt({code:e}){const{t}=Ct(),n=yb(),s=Vl()!=="interactive",[r,o]=d.useState(null),[i,l]=d.useState(null),[c,u]=d.useState("diagram"),[h,f]=bx(),[m,g]=d.useState(1),[w,y]=d.useState(!1),x=d.useRef(null),[k,_]=d.useState(!1),[S,I]=d.useState(!1),[E,A]=d.useState(null),j=d.useRef(null),L=d.useRef(null),R=n==="light"?"default":"dark",N=.5,M=3,O=.25,P=()=>{g(V=>Math.min(M,Math.round((V+O)*100)/100))},F=()=>{g(V=>Math.max(N,Math.round((V-O)*100)/100))},H=d.useCallback(()=>{L.current=null,y(!1),g(1);const V=x.current;V&&(V.scrollLeft=0,V.scrollTop=0),_(!1)},[]),$=d.useCallback(V=>{const J=x.current;J&&(V.preventDefault(),y(!0),L.current={startX:V.clientX,startY:V.clientY,startLeft:J.scrollLeft,startTop:J.scrollTop})},[]),Y=d.useCallback(V=>{const{scrollLeft:J,scrollTop:q}=V.currentTarget;_(J!==0||q!==0)},[]),Z=d.useCallback(()=>{const V=x.current;V&&(I(V.scrollWidth>V.clientWidth||V.scrollHeight>V.clientHeight),_(V.scrollLeft!==0||V.scrollTop!==0))},[]),K=d.useCallback(()=>{const V=x.current,J=j.current?.querySelector("svg");if(!V||!J)return;const[,,q,te]=(J.getAttribute("viewBox")??"").split(/[\s,]+/).map(Number),ie=(J.getAttribute("width")??"").trim(),ge=Number.parseFloat(J.getAttribute("height")??""),re=q>0&&te>0,G=re?q:Number.parseFloat(ie),Q=re?te:ge;if(!(G>0)||!(Q>0)){A(null);return}const he=V.clientWidth-dre*2,ve=ie.endsWith("%")&&he>0?Math.min(G,he):G,ye=Math.max(0,V.offsetHeight-V.clientHeight);A({stageWidth:ve,canvasHeight:ve*Q/G+dre*2+ye})},[]);d.useEffect(()=>{if(!w)return;const V=q=>{const te=x.current,ie=L.current;!te||!ie||(te.scrollLeft=ie.startLeft-(q.clientX-ie.startX),te.scrollTop=ie.startTop-(q.clientY-ie.startY),_(te.scrollLeft!==0||te.scrollTop!==0))},J=()=>{L.current=null,y(!1)};return window.addEventListener("mousemove",V),window.addEventListener("mouseup",J),window.addEventListener("blur",J),()=>{window.removeEventListener("mousemove",V),window.removeEventListener("mouseup",J),window.removeEventListener("blur",J)}},[w]),d.useEffect(()=>{H()},[e,H]),d.useLayoutEffect(()=>{K(),Z()},[r,m,c,K,Z]),d.useEffect(()=>{const V=x.current;if(!V)return;const J=new ResizeObserver(()=>{K(),Z()});return J.observe(V),()=>J.disconnect()},[r,c,K,Z]),d.useEffect(()=>{let V=!1;o(null),l(null);const J=setTimeout(()=>{Je(()=>import("./mermaid.core-BBo02LMd.js").then(q=>q.cb),[]).then(async q=>{if(V)return;const te=q.default,ie=`${R}:${s?"hardened":"runtime"}`,ge=ure.then(async()=>{if(V)throw new Error("Mermaid render skipped");cre!==ie&&(te.initialize({startOnLoad:!1,theme:R,securityLevel:"strict",suppressErrorRendering:!0,...s?{maxTextSize:gdt,maxEdges:vdt}:{},flowchart:{wrappingWidth:300,useMaxWidth:!1}}),cre=ie);const G=`mermaid-${++mdt}`;if(!s)return te.render(G,e.trim());let Q;try{return await Promise.race([te.render(G,e.trim()),new Promise((he,ve)=>{Q=setTimeout(()=>ve(new Error("Mermaid render timed out")),wdt)})])}finally{Q!==void 0&&clearTimeout(Q)}});ure=ge.then(()=>{},()=>{});const{svg:re}=await ge;V||o(re)}).catch(q=>{V||l(q instanceof Error?q.message:"Mermaid render failed")})},150);return()=>{V=!0,clearTimeout(J)}},[e,s,R]);const B=()=>{Yf(e).then(()=>{f()}).catch(W0)};return i?a.jsxs("div",{className:ri.codeBlock,children:[a.jsx("div",{className:ri.codeBlockHeader,children:a.jsx("span",{className:ri.codeBlockLang,children:t("mermaid.errorLabel")})}),a.jsx("pre",{className:`${ri.codeBlockContent} ${ri.codeBlockPlain}`,children:a.jsx("code",{children:e})})]}):a.jsxs("div",{className:ri.codeBlock,children:[a.jsxs("div",{className:ri.codeBlockHeader,children:[a.jsx("span",{className:ri.codeBlockLang,children:t("mermaid.label")}),a.jsxs("span",{className:ri.mermaidActions,children:[c==="diagram"&&a.jsxs(a.Fragment,{children:[a.jsx("button",{className:ri.codeBlockCopy,onClick:F,title:t("mermaid.zoomOut"),disabled:m<=N,children:t("mermaid.zoomOut")}),a.jsx("button",{className:ri.codeBlockCopy,onClick:H,title:t("mermaid.zoomReset"),disabled:m===1&&!k,children:t("mermaid.zoomReset")}),a.jsx("button",{className:ri.codeBlockCopy,onClick:P,title:t("mermaid.zoomIn"),disabled:m>=M,children:t("mermaid.zoomIn")})]}),a.jsx("button",{className:ri.codeBlockCopy,onClick:()=>u(c==="diagram"?"code":"diagram"),children:t(c==="diagram"?"mermaid.viewCode":"mermaid.viewDiagram")}),a.jsx("button",{className:ri.codeBlockCopy,onClick:B,children:t(h?"code.copied":"code.copy")})]})]}),c==="code"?a.jsx("pre",{className:`${ri.codeBlockContent} ${ri.codeBlockPlain}`,children:a.jsx("code",{children:e})}):r?a.jsx("div",{className:`${ri.mermaidZoomWrapper} ${S?ri.mermaidPannable:""} ${S&&w?ri.mermaidDragging:""}`,ref:x,style:E?{height:E.canvasHeight}:void 0,onMouseDown:$,onDoubleClick:H,onScroll:Y,children:a.jsx("div",{className:`${ri.mermaidBlock} ${ri.mermaidStage}`,ref:j,style:{...E?{width:E.stageWidth}:{},...m===1?{}:{zoom:m}},dangerouslySetInnerHTML:{__html:r}})}):a.jsx("div",{className:`${ri.mermaidBlock} ${ri.mermaidLoading} ${ri.mermaidInline}`,children:a.jsx("span",{children:t("mermaid.rendering")})})]})}function bdt({className:e,children:t,isStreaming:n}){const{t:s}=Ct(),r=yb(),o=Vl()==="document",[i,l]=d.useState(null),[c,u]=bx(),{label:h,lang:f,resolvedLang:m}=tY(cxe(e)),g=String(t).replace(/\n$/,""),w=r==="light"?"github-light-default":"github-dark-default";d.useEffect(()=>{if(o||n||f==="mermaid"||m==="text"||vU(g)){l(null);return}const x=pat(g,m,w);if(x!==null){l(x);return}const k=zse(g,m,w,!0);if(k!==null){l(k);return}l(null);let _=!1;return N1e(m).then(()=>{if(_)return;const S=zse(g,m,w,!0);S!==null&&l(S)}).catch(S=>{_||(console.warn("[web-shell] highlight failed for lang=%s",m,S),l(null))}),()=>{_=!0}},[g,o,f,m,w,n]);const y=()=>{Yf(g).then(()=>{u()}).catch(W0)};return f==="mermaid"&&!n&&!o?a.jsx(ydt,{code:g}):a.jsxs("div",{className:ri.codeBlock,children:[a.jsxs("div",{className:ri.codeBlockHeader,children:[a.jsx("span",{className:ri.codeBlockLang,children:h}),a.jsx("button",{className:ri.codeBlockCopy,onClick:y,children:s(c?"code.copied":"code.copy")})]}),!o&&!n&&i!==null?a.jsx("div",{className:ri.codeBlockContent,dangerouslySetInnerHTML:{__html:i}}):a.jsx("pre",{className:`${ri.codeBlockContent} ${ri.codeBlockPlain}`,children:a.jsx("code",{children:g})})]})}function cxe(e){const t=e?.match(/(?:^|\s)language-([^\s]+)/)?.[1]??"",n=t.match(/^([\w+.#-]+)/);if(!n)return"";const s=n[1]??"",r=t[s.length];return!r||r==="{"||r===":"?s:""}function xdt({children:e}){return a.jsx("code",{className:ri.inlineCode,children:e})}function hre({children:e}){return a.jsx("div",{className:ri.tableWrapper,children:a.jsx("table",{className:ri.table,children:e})})}const uxe=d.createContext(!1),dxe=d.createContext(void 0),hxe=d.createContext(void 0);function kdt(e,t,n){if(!n||e===void 0)return!1;const s=t?.position?.start.offset,r=t?.position?.end.offset;return s===void 0||r===void 0?!1:!gye(e.slice(s,r))&&e.slice(r).trim().length===0}function _dt({className:e,children:t,node:n}){const s=d.useContext(uxe),r=d.useContext(hxe);return e?.startsWith("language-")||typeof t=="string"&&t.includes(`
1619
1619
  `)?a.jsx(Sdt,{className:e,isStreaming:s,isIncomplete:kdt(r,n,s),children:t}):a.jsx(xdt,{children:t})}function Sdt({className:e,children:t,isStreaming:n,isIncomplete:s}){const r=d.useContext(dxe),o=yb(),{markdown:i}=Th(),l=String(t),c=l.replace(/\n$/,""),u=a.jsx(bdt,{className:e,isStreaming:n,children:l}),h=cxe(e),{resolvedLang:f}=tY(h);if(!!r&&!!e&&!!h)try{const g=i?.renderCodeBlock?.({language:h,resolvedLanguage:f,className:e,code:c,isStreaming:!!n,isIncomplete:!!s,source:r,theme:o});if(g!=null&&typeof g!="boolean")return a.jsx(K0,{fallback:u,label:`custom code block component render (lang=${h})`,resetKeys:[h,r,o,n?"streaming":"settled",s?"incomplete":"complete",c],children:g})}catch(g){console.error("[web-shell] custom code block renderer call failed (lang=%s):",h,g)}return u}function Cdt({children:e}){return a.jsx(a.Fragment,{children:e})}const SU=/^o1-code-session:\/\//i;function fre(e,t=!1){return t&&lxe.test(e.trim())||SU.test(e.trim())?e:uye(e)}function fxe({href:e,children:t,node:n,id:s,"aria-label":r,"aria-describedby":o}){const i=Vl(),l=Hp();if((n?.properties.dataFootnoteRef!==void 0||n?.properties.dataFootnoteBackref!==void 0)&&e?.startsWith("#"))return a.jsx("a",{id:s,href:e,className:ri.link,"aria-label":r,"aria-describedby":o,"data-footnote-ref":n?.properties.dataFootnoteRef!==void 0?"":void 0,"data-footnote-backref":n?.properties.dataFootnoteBackref!==void 0?"":void 0,onClick:h=>{const m=h.currentTarget.getRootNode().getElementById(e.slice(1));m&&(h.preventDefault(),m.scrollIntoView({block:"nearest"}),!m.hasAttribute("tabindex")&&m.tagName!=="BUTTON"&&(m.tabIndex=-1),m.focus({preventScroll:!0}))},children:t});if(e&&SU.test(e.trim())){if(i!=="interactive")return a.jsx("span",{className:ri.link,children:t});const h=e.trim().replace(SU,"");return a.jsx("a",{href:"#",role:"button",className:ri.link,onClick:f=>{f.preventDefault(),f.stopPropagation(),window.dispatchEvent(new CustomEvent("o1-code:open-session",{detail:h}))},children:t})}const u=N4(e)?e:void 0;return a.jsx("a",{href:u,target:"_blank",rel:"noopener noreferrer",className:ri.link,onClick:h=>l(h,u),children:t})}function Tdt({src:e,alt:t}){const n=Vl(),s=Ow(e,n==="document")?e:void 0;return a.jsx("img",{src:s,alt:t||"",className:ri.image})}function Idt(e,t,n=80){const[s,r]=d.useState(e),o=d.useRef(s);o.current=s;const i=d.useRef(0),l=d.useRef(null),c=d.useRef(e);return c.current=e,d.useEffect(()=>{if(!t){l.current&&(clearTimeout(l.current),l.current=null),o.current!==e&&r(e);return}const u=Date.now(),h=u-i.current;h>=n?(i.current=u,r(c.current)):l.current||(l.current=setTimeout(()=>{i.current=Date.now(),l.current=null,r(c.current)},n-h))},[e,t,n]),d.useEffect(()=>()=>{l.current&&(clearTimeout(l.current),l.current=null)},[]),!t||typeof e=="string"&&typeof s=="string"&&!e.startsWith(s)?e:s}function pxe(e="basic",t=""){return{code:_dt,pre:Cdt,a:fxe,img:Tdt,sup:q1e,section:V1e,table({children:n}){if(e==="advanced"){const s=a.jsx(hre,{children:n});return a.jsx(K0,{fallback:s,label:"enhanced markdown table",resetKeys:[t],children:a.jsx(bct,{fallback:s,children:n})})}return a.jsx(hre,{children:n})}}}const Rdt=pxe(),Edt=d.memo(function({content:t,components:n,remarkPlugins:s,rehypePlugins:r,urlTransform:o}){return a.jsx(mJe,{components:n,remarkPlugins:s,rehypePlugins:r,urlTransform:o,children:t})}),Im=d.memo(function({content:t,source:n,isStreaming:s,tableMode:r}){const{markdown:o,markdownTableMode:i}=Th(),l=yb(),c=Vl()==="document",u=`footnote-${d.useId()}-`,h=n?o:void 0,f=Idt(t??"",s),m=s===!0&&f.length>hdt,g=d.useMemo(()=>f&&n&&h?.transformMarkdown?h.transformMarkdown(f,{source:n,isStreaming:s===!0}):f,[n,h,f,s]),w=s?"basic":r??i??"basic",y=d.useMemo(()=>w==="advanced"?pxe("advanced",g):Rdt,[w,g]),x=h?.components,k=h?.getInlineFootnoteIcon,_=h?.mountFootnotePreview,S=d.useMemo(()=>{if(!x&&!k&&!_)return y;const O={...y,...x,...w==="advanced"?{table:y.table}:{}},P=x?.a;return x&&(O.a=F=>{if(F.node?.properties.dataFootnoteRef!==void 0||F.node?.properties.dataFootnoteBackref!==void 0||!P)return a.jsx(fxe,{...F});if(typeof P!="string")return d.createElement(P,F);const{node:$,...Y}=F;return d.createElement(P,Y)}),x?.sup||(O.sup=F=>a.jsx(q1e,{...F,linkComponent:P,iconResolver:k,mountPreview:_}),O.section=F=>a.jsx(V1e,{...F,sectionComponent:x?.section})),O},[y,w,x,k,_]),I=!c&&n==="assistant"&&!x?.code&&!x?.pre?h?.chart??(h?.renderCodeBlock?void 0:But):void 0,E=d.useMemo(()=>I?Fut(I.registry,{chartClassName:I.chartClassName,chartStyle:{minHeight:360,...I.chartStyle}}):void 0,[I]),A=d.useMemo(()=>E?{...S,pre:E}:S,[E,S]),j=d.useMemo(()=>h?.remarkPlugins?[_ne,cse,kse,...h.remarkPlugins]:[_ne,cse,kse],[h?.remarkPlugins]),L=d.useMemo(()=>[Ast,...h?.rehypePlugins??[],[Rct,{prefix:u,group:!c&&!x?.sup,safeHref:N4,safeImage:Ow,transformUrl:fre}]],[h?.rehypePlugins,u,c,x?.sup]),R=d.useMemo(()=>O=>fre(O,c),[c]);if(!t)return null;if(m)return a.jsx("div",{className:n!=="thinking"?ri.content:void 0,"data-markdown-source":n,"data-markdown-streaming-plain-text":"true",children:a.jsx("pre",{className:ri.streamingPlainText,children:g})});const N=a.jsx(Edt,{content:g,components:A,remarkPlugins:j,rehypePlugins:L,urlTransform:R}),M=I?a.jsx(zut,{customization:I,source:g,streaming:!!s,theme:l,children:N}):N;return a.jsx("div",{className:n!=="thinking"?ri.content:void 0,"data-markdown-source":n,children:a.jsx(uxe.Provider,{value:!!s,children:a.jsx(dxe.Provider,{value:n,children:a.jsx(hxe.Provider,{value:g,children:M})})})})}),K$=/https?:\/\/[A-Za-z0-9\-._~:/?#[\]{}@!$&'()*+,;=%]+/gi,Adt=new Set([...".,;:!?'*_~"]),jdt={")":"(","]":"[","}":"{"},Ndt=/^https?:\/\/./i;function pre(e,t){let n=0;for(const s of e)s===t&&(n+=1);return n}function Mdt(e){const t={};for(const[s,r]of Object.entries(jdt))t[s]=pre(e,s)-pre(e,r);let n=e.length;for(;n>0;){const s=e.charAt(n-1);if(Object.hasOwn(t,s)){if(t[s]<=0)break;t[s]--,n--;continue}if(!Adt.has(s))break;n--}return e.slice(0,n)}function Pdt(e){const t=[];let n=0;K$.lastIndex=0;for(let s=K$.exec(e);s!==null;s=K$.exec(e)){const r=Mdt(s[0]);if(!Ndt.test(r))continue;const o=s.index;o>n&&t.push({type:"text",value:e.slice(n,o)}),t.push({type:"url",value:r}),n=o+r.length}return n<e.length&&t.push({type:"text",value:e.slice(n)}),t}const M9=d.memo(function({text:t}){const n=Hp(),s=d.useMemo(()=>Pdt(t),[t]);return s.every(r=>r.type==="text")?t:s.map((r,o)=>{if(r.type==="text")return r.value;const i=r.value.replace(/%(?![0-9A-Za-z]{2})/g,"%25"),l=N4(i)?i:void 0;return a.jsx("a",{href:l,target:"_blank",rel:"noopener noreferrer",className:ri.link,onClick:c=>n(c,l),children:r.value},o)})}),Ldt="_flash_96ig5_1",pb={flash:Ldt},Ddt="_chatMessageRow_qnd03_41",Odt="_chatMessageColumn_qnd03_48",$dt="_chatBubble_qnd03_55",Bdt="_scheduledTaskBubble_qnd03_68",Fdt="_scheduledTaskRun_qnd03_76",zdt="_scheduledTaskHeader_qnd03_83",Hdt="_scheduledTaskIcon_qnd03_90",Udt="_scheduledTaskHeading_qnd03_108",Wdt="_scheduledTaskEyebrow_qnd03_115",qdt="_scheduledTaskName_qnd03_122",Vdt="_scheduledTaskMeta_qnd03_131",Gdt="_scheduledTaskMetaItem_qnd03_138",Kdt="_scheduledTaskBadge_qnd03_158",Ydt="_scheduledTaskId_qnd03_170",Xdt="_scheduledTaskPrompt_qnd03_181",Zdt="_sendFailure_qnd03_191",Jdt="_retryButton_qnd03_201",Qdt="_editArea_qnd03_229",eht="_editInput_qnd03_237",tht="_editActions_qnd03_258",nht="_editCancel_qnd03_264",sht="_editSubmit_qnd03_265",rht="_chatContent_qnd03_294",oht="_messageTag_qnd03_299",iht="_messageTagTooltip_qnd03_317",aht="_messageTagClickable_qnd03_351",lht="_messageTagIcon_qnd03_364",cht="_messageTagLabel_qnd03_376",uht="_messageTagValue_qnd03_377",dht="_chatContentCollapsed_qnd03_400",hht="_toggleButton_qnd03_405",fht="_toggleIcon_qnd03_426",pht="_toggleIconExpanded_qnd03_433",mht="_chatImages_qnd03_437",ght="_chatImageThumb_qnd03_445",vht="_chatImageThumbInteractive_qnd03_453",wht="_chatFiles_qnd03_462",yht="_chatFileChip_qnd03_470",bht="_chatFileChipPreviewable_qnd03_483",xht="_fileTagIcon_qnd03_492",Uo={chatMessageRow:Ddt,chatMessageColumn:Odt,chatBubble:$dt,scheduledTaskBubble:Bdt,scheduledTaskRun:Fdt,scheduledTaskHeader:zdt,scheduledTaskIcon:Hdt,scheduledTaskHeading:Udt,scheduledTaskEyebrow:Wdt,scheduledTaskName:qdt,scheduledTaskMeta:Vdt,scheduledTaskMetaItem:Gdt,scheduledTaskBadge:Kdt,scheduledTaskId:Ydt,scheduledTaskPrompt:Xdt,sendFailure:Zdt,retryButton:Jdt,editArea:Qdt,editInput:eht,editActions:tht,editCancel:nht,editSubmit:sht,chatContent:rht,messageTag:oht,messageTagTooltip:iht,messageTagClickable:aht,messageTagIcon:lht,messageTagLabel:cht,messageTagValue:uht,chatContentCollapsed:dht,toggleButton:hht,toggleIcon:fht,toggleIconExpanded:pht,chatImages:mht,chatImageThumb:ght,chatImageThumbInteractive:vht,chatFiles:wht,chatFileChip:yht,chatFileChipPreviewable:bht,fileTagIcon:xht},kht="This is a scheduled task run. Execute the instructions below now. Do not create or modify a schedule unless the instructions explicitly ask you to.";function _ht(e){const t=`
1620
1620
 
1621
1621
  ${kht}
@@ -2213,7 +2213,7 @@ ${i("terminal.notice.protocolMismatch")}`),ie.close(4002,"Terminal protocol mism
2213
2213
  * Copyright 2025 Qwen Team
2214
2214
  * SPDX-License-Identifier: Apache-2.0
2215
2215
  */const agn=250,VF={truncated:!1,status:"idle"};function lgn(e){if(e instanceof Error&&e.message)return e.message;const t=String(e??"");return t.length>0?t:"Unknown error"}function cgn(e){return e.replayError?{kind:"unreadable",message:e.replayError}:e.partial?{kind:"partial"}:void 0}function ugn(e,t={}){const n=t.pageSize??agn,[s,r]=d.useState(VF),o=d.useRef(0),i=d.useCallback(()=>{if(!e)return;const u=++o.current;r(h=>({...h,status:"loading",error:void 0})),e({limit:n}).then(h=>{if(o.current!==u)return;const f=cgn(h);if(f!==void 0){r(m=>({...m,status:"error",error:f}));return}r({events:h.events,truncated:h.hasMore,status:"ready"})},h=>{o.current===u&&r(f=>({...f,status:"error",error:{kind:"unreadable",message:lgn(h)}}))})},[e,n]);d.useEffect(()=>{if(!e){o.current+=1,r(VF);return}return r(VF),i(),()=>{o.current+=1}},[e,i]);const l=s.events;return{trajectory:d.useMemo(()=>l===void 0?void 0:sgn(ign(l)),[l]),status:s.status,...s.error!==void 0?{error:s.error}:{},truncated:s.truncated,refresh:i}}const dgn="_panel_1ploj_1",hgn="_header_1ploj_8",fgn="_summary_1ploj_17",pgn="_headerActions_1ploj_26",mgn="_headerButton_1ploj_33",ggn="_iconButton_1ploj_54",vgn="_error_1ploj_78",wgn="_notice_1ploj_91",ygn="_tableWrap_1ploj_100",bgn="_placeholder_1ploj_107",xgn="_scroll_1ploj_114",kgn="_olderBar_1ploj_126",_gn="_olderNotice_1ploj_132",Sgn="_virtualBody_1ploj_137",Cgn="_virtualRow_1ploj_142",Tgn="_turnHeader_1ploj_151",Ign="_turnTitle_1ploj_167",Rgn="_turnSummary_1ploj_171",Egn="_record_1ploj_179",Agn="_nestMarker_1ploj_198",jgn="_selected_1ploj_203",Ngn="_badge_1ploj_208",Mgn="_text_1ploj_221",Pgn="_faint_1ploj_230",Lgn="_metrics_1ploj_235",Dgn="_toneError_1ploj_244",Ogn="_toneMuted_1ploj_248",Ua={panel:dgn,header:hgn,summary:fgn,headerActions:pgn,headerButton:mgn,iconButton:ggn,error:vgn,notice:wgn,tableWrap:ygn,placeholder:bgn,scroll:xgn,olderBar:kgn,olderNotice:_gn,virtualBody:Sgn,virtualRow:Cgn,turnHeader:Tgn,turnTitle:Ign,turnSummary:Rgn,record:Egn,nestMarker:Agn,selected:jgn,badge:Ngn,text:Mgn,faint:Pgn,metrics:Lgn,toneError:Dgn,toneMuted:Ogn},vue=34;function wue(e){return e>=999950?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function $gn(e){return`${wue(e.inputTokens)} → ${wue(e.outputTokens)}`}const Bgn=/-call_[A-Za-z0-9]+$/;function Fgn(e){const{subagentId:t,parentToolCallId:n}=e;if(t!==void 0)return n!==void 0&&t.endsWith(`-${n}`)?t.slice(0,-(n.length+1)):t.replace(Bgn,"")}function yE(e){const t=e.trim(),n=t.indexOf(`
2216
- `);return n===-1?t:t.slice(0,n)}function zgn(e,t){if(e.kind==="request"){const n=[kh(e.timing.durationMs)];return e.timing.ttftMs!==void 0&&n.push(t("trajectory.ttft",{duration:kh(e.timing.ttftMs)})),e.usage&&n.push($gn(e.usage)),n}if(e.kind==="tool"){const n=[];if(e.timing&&n.push(kh(e.timing.durationMs)),e.subagentSummary){const{requests:s,tools:r,requestMs:o}=e.subagentSummary;n.push(t("trajectory.subagentRollup",{requests:s,tools:r,duration:kh(o)}))}return n}return[]}function yue(e){const t=e.toolStatus??e.block.status;if(t==="error"||t==="failed")return Ua.toneError;if(t==="cancelled")return Ua.toneMuted}function Hgn(e,t){switch(e.kind){case"user":return{badge:t("trajectory.badge.user"),text:yE(e.block.text)};case"request":{const n=Fgn(e),s=e.status==="error",r=n!==void 0?`${n}${e.model?` · ${e.model}`:""}`:e.model??t("trajectory.request");return{badge:n!==void 0?t("trajectory.badge.subagent"):`#${e.requestIndex??"?"}`,...s?{badgeTone:Ua.toneError}:{},text:s?`${r} · ${t("trajectory.requestFailed")}`:r}}case"message":return{badge:e.thought?t("trajectory.badge.thought"):t("trajectory.badge.message"),text:yE(e.block.text),faint:e.thought};case"tool":return{badge:e.block.toolName??t("trajectory.badge.tool"),...yue(e)?{badgeTone:yue(e)}:{},text:e.block.title||(e.block.toolName??"")};default:return Ugn(e.block,t)}}function Ugn(e,t){switch(e.kind){case"shell":return{badge:t("trajectory.badge.shell"),text:yE(e.text)};case"user_shell":return{badge:t("trajectory.badge.shell"),text:yE(e.command||e.text)};case"permission":return{badge:t("trajectory.badge.permission"),text:e.title||e.toolName||""};case"status":case"error":case"debug":return{badge:t("trajectory.badge.status"),...e.kind==="error"?{badgeTone:Ua.toneError}:{},text:yE(e.text),faint:e.kind!=="error"};case"prompt_cancelled":return{badge:t("trajectory.badge.cancelled"),badgeTone:Ua.toneMuted,text:e.reason??t("trajectory.cancelled"),faint:!0};default:return{badge:t("trajectory.badge.other"),text:""}}}function Wgn(e){return e.rows.some(t=>t.kind==="request"||t.kind==="tool"&&t.timing!==void 0)}function qgn({loadPage:e}){const{t}=Ct(),{trajectory:n,status:s,error:r,truncated:o,refresh:i}=ugn(e),[l,c]=d.useState(void 0),u=d.useRef(null),h=d.useRef(!1),f=d.useRef(0),m=d.useId(),g=d.useCallback(R=>`${m}-row-${R}`,[m]),w=d.useCallback((R,N)=>{R.scrollTop=N,f.current=R.scrollTop},[]),y=d.useMemo(()=>{if(!n)return[];const R=new Map(n.rows.map(M=>[M.key,M])),N=[];for(const M of n.turns){const O=M.userRowKey??`ordinal:${M.index}`;N.push({kind:"turn",key:`turn:${O}`,turn:M});for(const P of M.rowKeys){const F=R.get(P);F&&N.push({kind:"row",key:P,row:F})}}return N},[n]),x=wwe({count:y.length,getScrollElement:()=>u.current,getItemKey:R=>y[R]?.key??R,estimateSize:()=>vue,overscan:12}),k=y.length>0;d.useLayoutEffect(()=>{const R=u.current;if(!R||typeof ResizeObserver>"u")return;let N=0;const M=()=>{R.scrollTop===0&&f.current>0&&(R.scrollTop=f.current)},O=new ResizeObserver(()=>{M(),N=requestAnimationFrame(M)});return O.observe(R),()=>{O.disconnect(),N!==0&&cancelAnimationFrame(N)}},[k]),d.useEffect(()=>{if(s!=="ready"||h.current||y.length===0)return;h.current=!0;const R=u.current;R&&w(R,R.scrollHeight)},[w,s,y.length]);const _=d.useMemo(()=>l===void 0?-1:y.findIndex(R=>R.key===l),[l,y]),S=d.useCallback(R=>{if(y.length===0)return;const N=Math.min(Math.max(R,0),y.length-1);c(y[N].key),x.scrollToIndex(N,{align:"auto"})},[x,y]),I=d.useCallback(R=>{c(R),u.current?.focus({preventScroll:!0})},[]),E=d.useCallback(R=>{if(y.length===0)return;const N=_<0?-1:_;R.key==="ArrowDown"?(R.preventDefault(),S(N+1)):R.key==="ArrowUp"?(R.preventDefault(),S(N<=0?0:N-1)):R.key==="Home"?(R.preventDefault(),S(0)):R.key==="End"&&(R.preventDefault(),S(y.length-1))},[S,_,y]),A=d.useMemo(()=>{if(!n)return;let R=0,N=0,M=0;for(const O of n.turns)R+=O.requestCount,N+=O.toolCount,M+=O.requestMs;return{turns:n.turns.length,requests:R,tools:N,durationMs:M}},[n]),j=s==="ready"&&y.length===0,L=n!==void 0&&y.length>0&&!Wgn(n);return a.jsxs("div",{className:Ua.panel,"data-testid":"trajectory-panel",children:[a.jsxs("div",{className:Ua.header,children:[a.jsx("div",{className:Ua.summary,children:A?a.jsx("span",{"data-testid":"trajectory-totals",children:t("trajectory.totals",{turns:A.turns,requests:A.requests,tools:A.tools,duration:A.durationMs>0?kh(A.durationMs):"—"})}):a.jsx("span",{children:t("trajectory.title")})}),a.jsx("div",{className:Ua.headerActions,children:a.jsx("button",{type:"button",className:Ua.iconButton,onClick:i,disabled:!e||s==="loading",title:t("common.refresh"),"aria-label":t("common.refresh"),children:a.jsx(Hg,{size:14,strokeWidth:1.6})})})]}),r!==void 0&&a.jsxs("div",{className:Ua.error,role:"alert",children:[a.jsx("span",{children:r.kind==="partial"?t("trajectory.partial"):t("trajectory.loadFailed",{message:r.message})}),a.jsx("button",{type:"button",className:Ua.headerButton,onClick:i,disabled:s==="loading",children:t("common.retry")})]}),L&&a.jsx("div",{className:Ua.notice,role:"status",children:t("trajectory.noTiming")}),a.jsx("div",{className:Ua.tableWrap,children:y.length===0?s==="error"?null:a.jsx("div",{className:Ua.placeholder,role:"status",children:t(j?"trajectory.empty":"common.loading")}):a.jsxs(a.Fragment,{children:[o&&a.jsx("div",{className:Ua.olderBar,children:a.jsx("span",{className:Ua.olderNotice,"data-testid":"trajectory-truncated",children:t("trajectory.truncated")})}),a.jsx("div",{ref:u,className:Ua.scroll,role:"grid",tabIndex:0,"aria-label":t("trajectory.title"),"aria-rowcount":y.length,"aria-activedescendant":_>=0?g(_):void 0,onKeyDown:E,onScroll:R=>{f.current=R.currentTarget.scrollTop},"data-testid":"trajectory-rows",children:a.jsx("div",{className:Ua.virtualBody,style:{height:`${x.getTotalSize()}px`},children:x.getVirtualItems().map(R=>{const N=y[R.index];return a.jsx("div",{id:g(R.index),className:Ua.virtualRow,style:{height:`${vue}px`,transform:`translateY(${R.start}px)`},role:"row","aria-rowindex":R.index+1,children:N.kind==="turn"?a.jsx(Vgn,{turn:N.turn,selected:N.key===l,onSelect:()=>I(N.key)}):a.jsx(Ggn,{row:N.row,selected:N.key===l,onSelect:()=>I(N.key)})},R.key)})})})]})})]})}function Vgn({turn:e,selected:t,onSelect:n}){const{t:s}=Ct();return a.jsxs("div",{className:`${Ua.turnHeader} ${t?Ua.selected:""}`,onClick:n,"aria-selected":t,"data-selected":t?"true":void 0,role:"gridcell","data-testid":"trajectory-turn",children:[a.jsx("span",{className:Ua.turnTitle,children:e.partial?s("trajectory.turnPartial",{index:e.index}):s("trajectory.turn",{index:e.index})}),a.jsx("span",{className:Ua.turnSummary,children:s("trajectory.turnSummary",{requests:e.requestCount,tools:e.toolCount,duration:e.requestMs>0?kh(e.requestMs):"—"})})]})}function Ggn({row:e,selected:t,onSelect:n}){const{t:s}=Ct(),r=Hgn(e,s),o=zgn(e,s);return a.jsxs("div",{className:`${Ua.record} ${t?Ua.selected:""}`,role:"gridcell","aria-selected":t,"data-selected":t?"true":void 0,onClick:n,"data-testid":`trajectory-row-${e.kind}`,"data-depth":e.depth,children:[e.depth>0&&a.jsx(zHe,{size:12,strokeWidth:1.6,className:Ua.nestMarker,"aria-hidden":"true"}),a.jsx("span",{className:`${Ua.badge} ${r.badgeTone??""}`,children:r.badge}),a.jsx("span",{className:`${Ua.text} ${r.faint?Ua.faint:""}`,children:r.text}),a.jsx("span",{className:Ua.metrics,"data-testid":"trajectory-row-metrics",children:o.length>0?o.join(" · "):"—"})]})}const Kgn="_panel_pwtdr_1",Ygn="_toolbar_pwtdr_5",Xgn="_actions_pwtdr_15",Zgn="_feedback_pwtdr_21",Jgn="_state_pwtdr_31",ky={panel:Kgn,toolbar:Ygn,actions:Xgn,feedback:Zgn,state:Jgn};function Qgn({sessionActions:e,sessionId:t,controls:n}){const{t:s}=Ct(),[r,o]=d.useState(null),[i,l]=d.useState(!0),[c,u]=d.useState(!1),h=d.useRef(0),f=d.useRef(()=>{}),m=d.useRef(null),g=n?.sessionId===t?n:void 0,w=g?.getContextUsage??e?.getContextUsage,y=d.useRef(g);y.current=g;const x=g?.result,[k,_]=d.useState(x),S=!!(x&&x!==k&&(x.kind!=="completed"||!c));d.useEffect(()=>{x?.kind==="completed"&&(h.current++,o(x.usage),u(!1))},[x]),d.useEffect(()=>{let A=!0,j=!1;const L=y.current?.result;o(N=>N?.sessionId===t?N:L?.kind==="completed"?L.usage:null),u(!1),l(!!w);const R=async()=>{if(!A||j||!w)return;j=!0,l(!0),u(!1);const N=h.current,M=m.current,O=M&&M.getContextUsage===w&&M.sessionId===t?M:{getContextUsage:w,sessionId:t,promise:w({detail:!0,silent:!0,...y.current?.result?{syncCounters:!0}:{}})};m.current=O;try{const P=await O.promise;if(!A||N!==h.current)return;o(P.sessionId===t&&P.usage.contextWindowSize>0?P:null)}catch(P){if(!A||N!==h.current)return;u(DV(P)?"transient":"hard")}finally{j=!1,m.current===O&&(m.current=null),A&&l(!1)}};return f.current=()=>void R(),R(),()=>{A=!1}},[w,t]);const I=!w||i||g?.compressing,E=()=>{_(x),f.current()};return a.jsxs("div",{className:ky.panel,"aria-busy":i,children:[a.jsxs("div",{className:ky.toolbar,children:[a.jsx("span",{children:s("contextUsage.title")}),a.jsxs("div",{className:ky.actions,children:[a.jsx(Wt,{type:"button",variant:"ghost",size:"icon-sm","aria-label":s("contextUsage.refresh"),title:s("contextUsage.refresh"),disabled:I,onClick:E,children:a.jsx(Hg,{"aria-hidden":"true"})}),a.jsx("span",{title:g?.compressing?void 0:g?.canCompress?i?s("common.loading"):void 0:s("contextUsage.compressUnavailable"),children:a.jsx(Wt,{type:"button",variant:"outline",size:"sm",disabled:!g?.canCompress||i,onClick:()=>void g?.compress(),children:s(g?.compressing?"contextUsage.compressing":"contextUsage.compress")})})]})]}),(g?.compressing||S)&&a.jsx(i4e,{controls:g,className:ky.feedback}),c==="transient"&&r&&a.jsx("div",{className:ky.feedback,role:"status",children:s("contextUsage.previousReading")}),c==="hard"?a.jsxs("div",{className:ky.state,role:"alert",children:[a.jsx("span",{children:s("contextUsage.loadError")}),a.jsx(Wt,{type:"button",variant:"outline",size:"sm",disabled:I,onClick:E,children:s("contextUsage.retry")})]}):w?i&&!r?a.jsx("div",{className:ky.state,role:"status",children:s("common.loading")}):r?a.jsx(Sxe,{status:r,compact:!0}):a.jsx("div",{className:ky.state,children:s("contextUsage.unavailable")}):a.jsx("div",{className:ky.state,children:s("contextUsage.unavailable")})]})}const e0n=700,t0n=["daily","weekdays","weekly","hourly","minutes","custom"],n0n=[1,2,3,4,5,6,10,12,15,20,30],s0n=(e,t)=>{},r0n=(e,t,n)=>{},o0n=()=>Promise.reject(new Error("Side-task session creation is unavailable"));function bue(e){return e.kind==="review"||e.kind==="file"||e.kind==="artifact"||e.kind==="scheduled_task"}function _y(e){return e.kind==="pending"?e.targetKind:e.kind}function i0n(e){return`image.${(e.match(/^data:image\/([a-z0-9+.+-]+)/i)?.[1]??"png").split("+")[0].toLowerCase()}`}const a0n=["review","sideTask"];function xue({contextUsageControls:e,artifacts:t,tabs:n,activeTabId:s,reviewChanges:r,selectedReviewPath:o,panelWidth:i,workspaceCwd:l,loading:c,restoring:u=!1,error:h,onSelectTab:f,onCloseTab:m,onOpenFilePreview:g,latestReviewAvailable:w=!1,onOpenLatestReview:y,onOpenTerminal:x,onOpenTrajectory:k,trajectoryTabId:_,onOpenWebPreview:S,onWebPreviewChange:I,items:E=a0n,sideTaskAvailable:A=!1,sideTasks:j=[],sideTasksLoading:L=!1,onCreateSideTask:R,onOpenSideTask:N,onCreateSideTaskSession:M,onSideTaskCreated:O,onSideTaskTitleChange:P,onNestedRightPanelOpen:F,onNestedArtifactsChange:H,onOpenNestedSubagent:$,agentTasks:Y=[],agentTraceLoading:Z=!1,agentTraceError:K,onOpenWorkflowAgent:B,onError:V,sessionWorkflowEnabled:J,workflow:q,onImageIngestionNotice:te,deferSubagentMount:ie=!1,onClose:ge,variant:re="docked",fullscreen:G=!1,onToggleFullscreen:Q}){const{t:he}=Ct(),[ve,ye]=d.useState(!1),[_e,ae]=d.useState(),Se=d.useRef(null),Te=d.useCallback(()=>{Se.current&&(clearTimeout(Se.current),Se.current=null),ye(!0)},[]),Ne=d.useCallback(()=>{Se.current&&clearTimeout(Se.current),Se.current=setTimeout(()=>{ye(!1),Se.current=null},120)},[]);d.useEffect(()=>()=>{Se.current&&clearTimeout(Se.current)},[]);const Ae=n.find(ke=>ke.id===s)??n[0],Ve=Ae?.kind==="file"&&Ae.sourcePreview&&(/\.html?$/i.test(Ae.workspacePath)||ub(Ae.previewMimeType||Ae.previewData?.type)==="text/html"),Ze=Ae?.kind==="file"&&Ae.previewOnly===!0&&!Ve&&/\.(?:html?|md|markdown)$/i.test(Ae.workspacePath)&&(Ae.previewContent!==void 0||!Ae.previewData||!!i4(Ae.previewMimeType||Ae.previewData.type,Ae.workspacePath)),Tt=_e===Ae?.id,je=E.includes("review")&&!n.some(ke=>_y(ke)==="review"),ot=E.includes("sideTask")&&A&&!!R,Ie=!!x,ue=E.includes("webPreview")&&!!S,W=E.includes("trajectory")&&!!k&&!n.some(ke=>ke.id===_),ne=!!Ae&&(je||ot||Ie||ue||W),me=Ae&&bue(Ae)?{workspaceCwd:Ae.workspaceCwd,workspaceId:Ae.workspaceId}:void 0,Me=O4(me?.workspaceCwd),Ke=Me?.workspaceId===me?.workspaceId?Me?.actions:void 0,be=Ae?.kind==="artifact"?t.find(ke=>ke.id===Ae.artifactId):void 0;return a.jsxs("aside",{className:`${pt.panel} ${re==="drawer"?pt.panelDrawer:""} ${G?pt.panelFullscreen:""}`,style:re==="docked"&&i&&!G?{flexBasis:i,width:i}:void 0,"aria-label":"Right panel",children:[a.jsxs("div",{className:pt.header,children:[n.length>0&&a.jsx("div",{className:pt.tabs,role:"tablist","aria-label":"Right panel",children:n.map(ke=>a.jsxs("div",{className:[pt.tabItem,ke.id===Ae?.id?pt.tabActive:""].filter(Boolean).join(" "),children:[a.jsxs("button",{type:"button",role:"tab","aria-selected":ke.id===Ae?.id,className:pt.tab,onClick:()=>f(ke.id),onMouseEnter:Pe=>yT(Pe.currentTarget),onFocus:Pe=>yT(Pe.currentTarget),title:ke.title,children:[a.jsx("span",{className:`${pt.tabIcon} ${_y(ke)==="artifact"?pt.tabArtifactIcon:""}`,"aria-hidden":"true",children:_y(ke)==="review"?a.jsx(GF,{}):ke.kind==="workflow"?a.jsx(zve,{className:pt.tabIconSvg,strokeWidth:1.6}):ke.kind==="file"?a.jsx(U0,{name:ke.workspacePath,className:pt.tabIconSvg,strokeWidth:1.6}):_y(ke)==="artifact"?a.jsx(uwe,{artifact:t.find(Pe=>"artifactId"in ke&&Pe.id===ke.artifactId),className:pt.tabIconSvg}):_y(ke)==="subagent"?a.jsx(l0n,{}):_y(ke)==="monitor"?a.jsx(Yve,{className:pt.tabIconSvg,strokeWidth:1.6}):_y(ke)==="shell"?a.jsx(Y2,{className:pt.tabIconSvg,strokeWidth:1.6}):_y(ke)==="side_task"?a.jsx(Aj,{className:pt.tabIconSvg,strokeWidth:1.6}):ke.kind==="web_preview"?a.jsx(hT,{className:pt.tabIconSvg}):ke.kind==="terminal"?a.jsx(Y2,{className:pt.tabIconSvg,strokeWidth:1.6}):_y(ke)==="image"?a.jsx(UUe,{className:pt.tabIconSvg,strokeWidth:1.6}):ke.kind==="context_usage"?a.jsx(WP,{className:pt.tabIconSvg,strokeWidth:1.6}):ke.kind==="token_usage"?a.jsx(UG,{className:pt.tabIconSvg,strokeWidth:1.6}):ke.kind==="trajectory"?a.jsx(GO,{className:pt.tabIconSvg,strokeWidth:1.6}):a.jsx(u0n,{})}),a.jsx("span",{className:pt.tabTitle,"data-web-shell-session-title":!0,children:a.jsx("span",{className:pt.tabTitleInner,children:ke.title})})]}),a.jsx("button",{type:"button",className:pt.tabCloseButton,onClick:()=>m(ke.id),"aria-label":`Close ${ke.title}`,title:"Close",children:a.jsx(c0n,{})})]},ke.id))}),a.jsxs("div",{className:pt.headerActions,children:[ne&&a.jsxs(Z0,{modal:!1,children:[a.jsx(Vg,{asChild:!0,children:a.jsx("button",{type:"button",className:`${pt.iconButton} ${pt.addButton}`,"aria-label":he("rightPanel.add"),title:he("rightPanel.add"),children:a.jsx(Qf,{className:pt.toolbarIcon})})}),a.jsxs(Gg,{align:"end",className:"w-64",children:[je&&a.jsxs(yi,{disabled:!w||!y,onSelect:y,children:[a.jsx(GF,{}),a.jsx("span",{className:pt.sideTaskListTitle,children:he("turnOutputs.review")})]}),je&&ot&&a.jsx(ax,{}),ot&&a.jsxs(yi,{disabled:L,onSelect:R,children:[a.jsx(Aj,{className:pt.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:pt.sideTaskListTitle,children:he("sideTask.create")})]}),Ie&&(je||ot)&&a.jsx(ax,{}),Ie&&a.jsxs(yi,{onSelect:()=>x?.(),children:[a.jsx(Y2,{className:pt.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:pt.sideTaskListTitle,children:he("terminal.title")})]}),ue&&a.jsxs(yi,{onSelect:S,children:[a.jsx(hT,{className:pt.sideTaskNewIcon}),a.jsx("span",{className:pt.sideTaskListTitle,children:he("webPreview.title")})]}),W&&a.jsxs(yi,{onSelect:()=>k?.(),children:[a.jsx(GO,{className:pt.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:pt.sideTaskListTitle,children:he("trajectory.title")})]})]})]}),Q&&a.jsx("button",{type:"button",className:`${pt.iconButton} ${pt.fullscreenButton} ${G?pt.iconButtonActive:""}`,onClick:Q,"aria-label":he(G?"common.exitFullscreen":"common.fullscreen"),"aria-pressed":G,title:he(G?"common.exitFullscreen":"common.fullscreen"),children:G?a.jsx(qG,{className:pt.toolbarIcon,"aria-hidden":!0}):a.jsx(zG,{className:pt.toolbarIcon,"aria-hidden":!0})}),a.jsx("button",{type:"button",className:`${pt.iconButton} ${pt.panelToggleButton}`,onClick:ge,"aria-label":he("chatHeader.toggleRightPanel"),"aria-pressed":"true",title:he("chatHeader.toggleRightPanel"),children:a.jsx(Hve,{className:pt.panelToggleIcon})})]})]}),a.jsxs("div",{className:`${pt.body} ${Ae?.kind==="side_task"?pt.bodySideTask:""}`.trim(),children:[n.filter(ke=>ke.kind==="web_preview").map(ke=>a.jsx("div",{className:"h-full",hidden:ke.id!==Ae?.id,children:a.jsx(lmn,{state:ke,onChange:Pe=>I?.(ke.id,Pe)})},ke.id)),n.filter(ke=>ke.kind==="terminal").map(ke=>a.jsx("div",{className:`${pt.terminalPane} ${ke.id===Ae?.id?"":pt.terminalPaneHidden}`.trim(),"aria-hidden":ke.id===Ae?.id?void 0:!0,children:a.jsx(amn,{terminalId:ke.id,cwd:ke.workspaceCwd??l,active:ke.id===Ae?.id,enabled:ke.initialized!==!1})},ke.id)),Ze&&a.jsxs("button",{type:"button",className:pt.attachmentPreviewButton,onClick:()=>ae(Tt?void 0:Ae?.id),"aria-label":he(Tt?"attachment.showSource":"attachment.showPreview"),"aria-pressed":Tt,children:[Tt?a.jsx(PHe,{"aria-hidden":!0}):a.jsx(Pve,{"aria-hidden":!0}),he(Tt?"attachment.showSource":"attachment.showPreview")]}),u&&!Ae?a.jsxs("div",{className:"flex flex-col gap-4 p-5","data-testid":"right-panel-loading-skeleton",role:"status","aria-label":he("common.loading"),children:[a.jsx(ow,{className:"h-5 w-2/5"}),a.jsx(ow,{className:"h-32 w-full"}),a.jsx(ow,{className:"h-4 w-4/5"}),a.jsx(ow,{className:"h-4 w-3/5"})]}):Ae?.kind==="terminal"||Ae?.kind==="web_preview"?null:Ae?Ae.kind==="pending"?a.jsx("div",{className:pt.empty,role:Ae.loadError?"alert":"status",children:Ae.loadError??he("common.loading")}):Ae.kind==="workflow"?Ae.sessionId?a.jsx(tdn,{tasks:Y,loading:Z,error:K,onOpenAgent:B}):q?a.jsx(Udn,{...q}):a.jsx("div",{className:pt.empty,children:he("workflow.empty.title")}):bue(Ae)&&(Ae.kind!=="scheduled_task"||Ae.task.durable)&&(Ae.kind!=="file"||!Ae.previewOnly)&&(Ae.kind!=="artifact"||be?.metadata?.artifactType!=="web_preview_snapshot")&&!Ke?a.jsx("div",{className:pt.empty,role:"alert",children:he("workspace.notFoundDescription")}):Ae.kind==="review"?a.jsx(f0n,{changes:Ae.changes??r,selectedPath:Ae.selectedPath??o,workspaceCwd:Ae.workspaceCwd??l,onOpenFilePreview:ke=>g(ke,Ae.workspaceCwd??l,Ae.workspaceId),onDownloadFile:(ke,Pe)=>GP(Ke,ke.path,dVe(ke.path),Pe),onDownloadError:ke=>{const Pe=he("common.downloadFailed",{message:Iu(ke)});V?V(new Error(Pe,{cause:ke}),Pe):console.error(Pe,ke)}}):Ae.kind==="file"?Ae.attachmentId&&!Ae.previewData&&Ae.previewContent===void 0?a.jsx("div",{className:pt.empty,role:Ae.loadError?"alert":"status",children:Ae.loadError??he("common.loading")}):Ae.sourcePreview&&Ae.previewData&&ub(Ae.previewMimeType||Ae.previewData.type)!=="application/pdf"&&!i4(Ae.previewMimeType||Ae.previewData.type,Ae.workspacePath)?a.jsx(SRe,{data:Ae.previewData,title:Ae.title,image:!!FS(Ae.workspacePath)&&Ae.previewData.type.startsWith("image/")}):a.jsx(oD,{workspacePath:Ae.workspacePath,artifactVersion:String(Ae.previewVersion??0),workspaceActions:Ke,previewContent:Ae.previewContent,previewData:Ae.previewData,previewMimeType:Ae.previewMimeType,previewOnly:Ae.previewOnly,previewKind:Ve||Ae.previewOnly&&!Tt?"source":void 0},Ae.id):Ae.kind==="source"?a.jsx(A0n,{tab:Ae},Ae.id):Ae.kind==="artifact"?a.jsx(d0n,{artifacts:t,artifactId:Ae.artifactId,sourceSessionId:Ae.sourceSessionId,workspaceActions:Ke,previewContent:Ae.previewContent,loading:c,error:h},Ae.id):Ae.kind==="subagent"?ie?null:a.jsx(Oun,{sessionId:Ae.sessionId,rootToolCallId:Ae.rootToolCallId,initialRootTool:Ae.rootTool,workspaceCwd:Ae.workspaceCwd??l,onRightPanelOpen:F,onArtifactsChange:H,onOpenSubagent:$,onError:V}):Ae.kind==="monitor"?a.jsx(Owt,{task:Ae.task,actions:Ae.sessionActions},Ae.id):Ae.kind==="shell"?a.jsx($wt,{task:Ae.task,actions:Ae.sessionActions},Ae.id):Ae.kind==="side_task"?a.jsx(sdn,{tabId:Ae.id,sessionId:Ae.sessionId,parentSessionId:Ae.parentSessionId,workspaceCwd:Ae.workspaceCwd??l,title:Ae.title,shouldNameFromFirstPrompt:Ae.nameFromFirstPrompt,initialPrompt:Ae.initialPrompt,createSession:M??o0n,onCreated:O??s0n,onTitleChange:P??r0n,onRightPanelOpen:F,onArtifactsChange:H,onError:V,sessionWorkflowEnabled:J,onImageIngestionNotice:te},Ae.id):Ae.kind==="image"?Ae.src?a.jsxs("div",{className:pt.imagePreviewWrap,children:[a.jsx("img",{src:Ae.src,alt:Ae.alt??Ae.title,className:pt.imagePreview}),a.jsx("a",{className:pt.imageDownloadButton,href:Ae.src,download:i0n(Ae.src),"aria-label":he("common.download"),title:he("common.download"),children:a.jsx(Vy,{size:16,strokeWidth:1.8})})]}):a.jsx("div",{className:pt.empty,role:Ae.loadError?"alert":"status",children:Ae.loadError??he("common.loading")}):Ae.kind==="context_usage"?a.jsx(Qgn,{controls:e?.[Ae.sessionId],sessionActions:Ae.sessionActions,sessionId:Ae.sessionId},Ae.id):Ae.kind==="trajectory"?a.jsx(qgn,{loadPage:Ae.loadPage},Ae.id):Ae.kind==="token_usage"?a.jsx(Ymn,{sessionActions:Ae.sessionActions,sessionId:Ae.sessionId},Ae.id):a.jsx(h0n,{task:Ae.task,actions:Ke},Ae.id):a.jsxs("div",{className:pt.emptyActions,"data-testid":"right-panel-empty-actions",children:[E.includes("review")&&a.jsxs("button",{type:"button",className:pt.emptyAction,disabled:!w||!y,onClick:y,children:[a.jsx("span",{className:pt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(GF,{})}),a.jsx("span",{className:pt.emptyActionTitle,children:he("turnOutputs.review")}),a.jsx("span",{className:pt.emptyActionHint,children:he("turnOutputs.reviewLatest")}),a.jsx(Bl,{className:pt.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]}),E.includes("sideTask")&&A&&R&&(j.length===0?a.jsxs("button",{type:"button",className:pt.emptyAction,disabled:L,"aria-busy":L,onClick:R,children:[a.jsx("span",{className:pt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(Aj,{strokeWidth:1.6})}),a.jsx("span",{className:pt.emptyActionTitle,children:he("sideTask.title")}),a.jsx("span",{className:pt.emptyActionHint,children:he("sideTask.description")}),a.jsx(Bl,{className:pt.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]}):a.jsxs(Z0,{open:ve,onOpenChange:ye,modal:!1,children:[a.jsx(Vg,{asChild:!0,children:a.jsxs("button",{type:"button",className:pt.emptyAction,"aria-expanded":ve,onMouseEnter:Te,onMouseLeave:Ne,children:[a.jsx("span",{className:pt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(Aj,{strokeWidth:1.6})}),a.jsx("span",{className:pt.emptyActionTitle,children:he("sideTask.title")}),a.jsx("span",{className:pt.emptyActionHint,children:he("sideTask.description")}),a.jsx(Bl,{className:pt.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]})}),a.jsxs(Gg,{align:"end",className:"w-80",onMouseEnter:Te,onMouseLeave:Ne,children:[j.map(ke=>a.jsxs(yi,{onSelect:()=>N?.(ke),children:[a.jsx("span",{className:pt.sideTaskListTitle,children:ke.title}),ke.updatedAt&&a.jsx("span",{className:pt.sideTaskListTime,children:EA(ke.updatedAt,he)})]},ke.sessionId)),a.jsx(ax,{}),a.jsxs(yi,{onSelect:R,children:[a.jsx(kHe,{className:pt.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:pt.sideTaskListTitle,children:he("sideTask.new")})]})]})]})),ue&&a.jsxs("button",{type:"button",className:pt.emptyAction,onClick:S,children:[a.jsx("span",{className:pt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(hT,{strokeWidth:1.6})}),a.jsx("span",{className:pt.emptyActionTitle,children:he("webPreview.title")}),a.jsx("span",{className:pt.emptyActionHint,children:he("webPreview.openHint")}),a.jsx(Bl,{className:pt.emptyActionChevron,"aria-hidden":"true"})]}),W&&a.jsxs("button",{type:"button",className:pt.emptyAction,onClick:()=>k?.(),"data-testid":"right-panel-open-trajectory",children:[a.jsx("span",{className:pt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(GO,{strokeWidth:1.6})}),a.jsx("span",{className:pt.emptyActionTitle,children:he("trajectory.title")}),a.jsx("span",{className:pt.emptyActionHint,children:he("trajectory.description")}),a.jsx(Bl,{className:pt.emptyActionChevron,"aria-hidden":"true"})]}),x&&a.jsxs("button",{type:"button",className:pt.emptyAction,onClick:()=>x(),children:[a.jsx("span",{className:pt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(Y2,{strokeWidth:1.6})}),a.jsx("span",{className:pt.emptyActionTitle,children:he("terminal.title")}),a.jsx("span",{className:pt.emptyActionHint,children:he("terminal.open")}),a.jsx(Bl,{className:pt.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]})]})]})]})}function l0n(){return a.jsxs("svg",{className:pt.tabIconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false","aria-hidden":"true",children:[a.jsx("circle",{cx:"12",cy:"8",r:"3",stroke:"currentColor",strokeWidth:"1.6"}),a.jsx("path",{d:"M6.5 19c.7-3.1 2.5-4.7 5.5-4.7s4.8 1.6 5.5 4.7",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"})]})}function c0n(){return a.jsx("svg",{className:pt.tabCloseIcon,viewBox:"0 0 16 16",fill:"none",focusable:"false","aria-hidden":"true",children:a.jsx("path",{d:"m4.5 4.5 7 7M11.5 4.5l-7 7",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function GF(){return a.jsxs("svg",{className:pt.tabIconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false",children:[a.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:"currentColor",strokeWidth:"1.6"}),a.jsx("path",{d:"M9 9.5h6M12 6.5v6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),a.jsx("path",{d:"M9 16h6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}function u0n(){return a.jsxs("svg",{className:pt.tabIconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false",children:[a.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"3",stroke:"currentColor",strokeWidth:"1.8"}),a.jsx("path",{d:"M12 8v4l3 2",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})}function d0n({artifacts:e,artifactId:t,sourceSessionId:n,workspaceActions:s,previewContent:r,loading:o,error:i}){const l=e.find(c=>c.id===t);return l?a.jsx(S0n,{artifact:l,sourceSessionId:n,workspaceActions:s,previewContent:r}):o?a.jsx("div",{className:pt.empty,children:"Loading artifact..."}):i?a.jsx("div",{className:pt.empty,children:i}):a.jsx("div",{className:pt.empty,children:"Artifact not found."})}function h0n({task:e,actions:t}){const{t:n}=Ct(),[s,r]=d.useState(null),[o,i]=d.useState(!0),[l,c]=d.useState(null),[u,h]=d.useState(""),[f,m]=d.useState(e.prompt),[g,w]=d.useState(()=>M1(e.cron)),[y,x]=d.useState(!1),[k,_]=d.useState(!1),[S,I]=d.useState(!1),[E,A]=d.useState(!1),[j,L]=d.useState(null),R=d.useRef(0),N=d.useRef(0),M=d.useRef({actions:t,taskId:e.id,workspaceId:e.workspaceId});M.current={actions:t,taskId:e.id,workspaceId:e.workspaceId};const O=d.useCallback((he,ve,ye,_e)=>{const ae=M.current;return he===R.current&&ae.actions===ve&&ae.taskId===ye&&ae.workspaceId===_e},[]),P=d.useCallback((he,ve,ye,_e)=>{const ae=M.current;return he===N.current&&ae.actions===ve&&ae.taskId===ye&&ae.workspaceId===_e},[]);d.useEffect(()=>()=>{R.current+=1,N.current+=1},[]),d.useEffect(()=>{I(!1),A(!1),L(null)},[t,e.id,e.workspaceId]);const F=d.useCallback(async()=>{const he=++R.current,ve=++N.current,ye=e.id,_e=e.workspaceId;if(!e.durable||!t){r(null),h(""),m(e.prompt),w(M1(e.cron)),c(null),i(!1);return}i(!0),c(null);try{const ae=await t.listScheduledTasks(_e);if(!O(he,t,ye,_e))return;const Se=ae.find(Te=>Te.id===e.id)??null;r(Se),Se?(h(Se.name??""),m(Se.prompt),w(M1(Se.cron))):(h(""),m(e.prompt),w(M1(e.cron)))}catch(ae){P(ve,t,ye,_e)&&c(ae instanceof Error?ae.message:String(ae))}finally{P(ve,t,ye,_e)&&i(!1)}},[t,P,O,e.cron,e.durable,e.id,e.prompt,e.workspaceId]);d.useEffect(()=>{F()},[F]);const H=!e.durable,$=e.durable&&!o&&!l&&!s,Y=!!s,Z=s?.name||s?.prompt||e.title,K=s?.prompt??e.prompt,B=s?.cron??e.cron,V=s?.recurring??e.recurring,J=s?.enabled,q=d.useCallback(()=>{s&&(h(s.name??""),m(s.prompt),w(M1(s.cron)),L(null),x(!0))},[s]),te=d.useCallback(()=>{x(!1),L(null),s&&(h(s.name??""),m(s.prompt),w(M1(s.cron)))},[s]),ie=d.useCallback(async()=>{if(!s||!t)return;const he=i9(g);if(!he){L(n("scheduledTasks.error.invalidSchedule"));return}if(f.trim().length===0){L(n("scheduledTasks.error.emptyPrompt"));return}const ve=++R.current,ye=e.id,_e=e.workspaceId;A(!0),L(null);try{const ae=await t.updateScheduledTask(s.id,{cron:he,prompt:f.trim(),name:u.trim()||null},_e);if(!O(ve,t,ye,_e))return;r(ae),h(ae.name??""),m(ae.prompt),w(M1(ae.cron)),x(!1)}catch(ae){O(ve,t,ye,_e)&&L(ae instanceof Error?ae.message:String(ae))}finally{O(ve,t,ye,_e)&&A(!1)}},[t,g,O,s,u,f,n,e.id,e.workspaceId]),ge=d.useCallback(async()=>{if(!s||!t)return;const he=++R.current,ve=e.id,ye=e.workspaceId;I(!0),L(null);try{const _e=await t.updateScheduledTask(s.id,{enabled:!s.enabled},ye);if(!O(he,t,ve,ye))return;r(_e)}catch(_e){O(he,t,ve,ye)&&L(_e instanceof Error?_e.message:String(_e))}finally{O(he,t,ve,ye)&&I(!1)}},[t,O,s,e.id,e.workspaceId]),re=d.useCallback(async()=>{if(!s||!t)return;const he=++R.current,ve=e.id,ye=e.workspaceId;I(!0),L(null);try{if(await t.deleteScheduledTask(s.id,ye),!O(he,t,ve,ye))return;r(null),_(!1)}catch(_e){O(he,t,ve,ye)&&L(_e instanceof Error?_e.message:String(_e))}finally{O(he,t,ve,ye)&&I(!1)}},[t,O,s,e.id,e.workspaceId]),G=i9(g),Q=G?BT(G,n):null;return a.jsxs("div",{className:pt.detail,children:[o&&a.jsx("div",{className:pt.empty,children:n("scheduledTasks.loading")}),l&&a.jsx("div",{className:rn.loadError,children:l}),$&&a.jsx("div",{className:pt.empty,children:n("scheduledTasks.deletedSnapshot")}),H&&a.jsx("div",{className:pt.empty,children:n("scheduledTasks.sessionScopedSnapshot")}),!$&&a.jsx("div",{className:pt.section,children:a.jsxs("div",{className:pt.fieldGrid,children:[a.jsx("span",{className:pt.fieldLabel,children:n("scheduledTasks.name")}),a.jsx("span",{className:pt.fieldValue,children:Z}),a.jsx("span",{className:pt.fieldLabel,children:n("scheduledTasks.taskId")}),a.jsx("span",{className:pt.fieldValue,children:e.id}),a.jsx("span",{className:pt.fieldLabel,children:n("scheduledTasks.schedule")}),a.jsx("span",{className:pt.fieldValue,children:BT(B,n)}),a.jsx("span",{className:pt.fieldLabel,children:"Cron"}),a.jsx("span",{className:pt.fieldValue,children:B}),a.jsx("span",{className:pt.fieldLabel,children:n("scheduledTasks.type")}),a.jsx("span",{className:pt.fieldValue,children:n(V?"scheduledTasks.repeats":"scheduledTasks.runsOnce")}),J!==void 0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:pt.fieldLabel,children:n("scheduledTasks.status")}),a.jsx("span",{className:pt.fieldValue,children:n(J?"scheduledTasks.enable":"scheduledTasks.disable")})]})]})}),!$&&a.jsxs("div",{className:pt.section,children:[a.jsx("div",{className:pt.sectionTitle,children:"Prompt"}),a.jsx("div",{className:pt.description,children:K})]}),j&&a.jsx("div",{className:rn.formError,children:j}),a.jsxs("div",{className:pt.actionsRow,children:[a.jsx("button",{type:"button",className:rn.primaryButton,disabled:!Y||S,onClick:q,children:n("scheduledTasks.edit")}),a.jsx("button",{type:"button",className:rn.secondaryButton,disabled:!Y||S,onClick:()=>void ge(),children:s?.enabled?n("scheduledTasks.disable"):n("scheduledTasks.enable")}),a.jsx("button",{type:"button",className:rn.secondaryButton,disabled:!Y||S,onClick:()=>_(!0),children:n("scheduledTasks.delete")})]}),k&&s&&a.jsx(Wa,{title:n("scheduledTasks.deleteConfirmTitle"),size:"sm",onClose:()=>_(!1),children:a.jsxs("div",{className:rn.formFields,children:[a.jsx("div",{className:pt.description,children:n("scheduledTasks.deleteConfirm",{name:s.name||s.prompt})}),j&&a.jsx("div",{className:rn.formError,children:j}),a.jsxs("div",{className:rn.formActions,children:[a.jsx("button",{type:"button",className:rn.secondaryButton,onClick:()=>_(!1),disabled:S,children:n("scheduledTasks.cancel")}),a.jsx("button",{type:"button",className:rn.primaryButton,onClick:()=>void re(),disabled:S,children:n("scheduledTasks.delete")})]})]})}),y&&a.jsx(Wa,{title:n("scheduledTasks.editTitle"),size:"md",onClose:te,children:a.jsxs("div",{className:rn.formFields,children:[a.jsxs("label",{className:rn.field,children:[a.jsx("span",{className:rn.fieldLabel,children:n("scheduledTasks.name")}),a.jsx("input",{className:rn.input,type:"text",value:u,maxLength:200,placeholder:n("scheduledTasks.namePlaceholder"),onChange:he=>h(he.target.value)})]}),a.jsxs("label",{className:rn.field,children:[a.jsxs("span",{className:rn.fieldLabel,children:[n("scheduledTasks.prompt"),a.jsx("span",{className:rn.required,children:"*"})]}),a.jsx("textarea",{className:rn.textarea,value:f,rows:4,maxLength:1e5,placeholder:n("scheduledTasks.promptPlaceholder"),onChange:he=>m(he.target.value)})]}),a.jsxs("div",{className:rn.scheduleRow,children:[a.jsxs("label",{className:rn.field,children:[a.jsx("span",{className:rn.fieldLabel,children:n("scheduledTasks.frequency")}),a.jsx("select",{className:rn.select,value:g.frequency,onChange:he=>{const ve=he.target.value;w(ye=>({...ye,frequency:ve,...ve==="hourly"?{time:"00:00"}:{}}))},children:t0n.map(he=>a.jsx("option",{value:he,children:n(`scheduledTasks.freq.${he}`)},he))})]}),(g.frequency==="daily"||g.frequency==="weekdays"||g.frequency==="weekly")&&a.jsxs("label",{className:rn.field,children:[a.jsx("span",{className:rn.fieldLabel,children:n("scheduledTasks.time")}),a.jsx("input",{className:rn.input,type:"time",value:g.time,onChange:he=>w(ve=>({...ve,time:he.target.value}))})]}),g.frequency==="weekly"&&a.jsxs("label",{className:rn.field,children:[a.jsx("span",{className:rn.fieldLabel,children:n("scheduledTasks.weekday")}),a.jsx("select",{className:rn.select,value:g.weekday,onChange:he=>w(ve=>({...ve,weekday:Number(he.target.value)})),children:n("scheduledTasks.weekdayNames").split(",").map((he,ve)=>a.jsx("option",{value:ve,children:he},ve))})]}),g.frequency==="minutes"&&a.jsxs("label",{className:rn.field,children:[a.jsx("span",{className:rn.fieldLabel,children:n("scheduledTasks.interval")}),a.jsx("select",{className:rn.select,value:g.minuteInterval,onChange:he=>w(ve=>({...ve,minuteInterval:Number(he.target.value)})),children:n0n.map(he=>a.jsx("option",{value:he,children:he},he))})]}),g.frequency==="custom"&&a.jsxs("label",{className:`${rn.field} ${rn.fieldGrow}`,children:[a.jsx("span",{className:rn.fieldLabel,children:n("scheduledTasks.cron")}),a.jsx("input",{className:rn.input,type:"text",value:g.customCron,spellCheck:!1,placeholder:"0 9 * * 1-5",onChange:he=>w(ve=>({...ve,customCron:he.target.value}))})]})]}),a.jsx("div",{className:rn.preview,children:Q?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:rn.previewLabel,children:Q}),a.jsx("code",{className:rn.previewCron,children:G})]}):a.jsx("span",{className:rn.previewInvalid,children:n("scheduledTasks.error.invalidSchedule")})}),j&&a.jsx("div",{className:rn.formError,children:j}),a.jsxs("div",{className:rn.formActions,children:[a.jsx("button",{type:"button",className:rn.secondaryButton,onClick:te,disabled:E,children:n("scheduledTasks.cancel")}),a.jsx("button",{type:"button",className:rn.primaryButton,onClick:()=>void ie(),disabled:E,children:n(E?"scheduledTasks.saving":"scheduledTasks.save")})]})]})})]})}function f0n({changes:e,selectedPath:t,workspaceCwd:n,onOpenFilePreview:s,onDownloadFile:r,onDownloadError:o}){const{t:i}=Ct(),[l,c]=d.useState(!1),[u,h]=d.useState(!0),[f,m]=d.useState(!1),[g,w]=d.useState(520),y=d.useRef(g),x=d.useRef(null),k=d.useRef(null),[_,S]=d.useState(null),[I,E]=d.useState(()=>new Set),A=d.useRef(!0);d.useEffect(()=>(A.current=!0,()=>{A.current=!1}),[]);const j=l,L=d.useMemo(()=>_0n(e,n),[e,n]);d.useEffect(()=>{S(t)},[t]),d.useEffect(()=>{y.current=g},[g]),d.useEffect(()=>{const P=x.current;if(!P)return;const F=()=>{m(P.clientWidth<e0n)};F();const H=new ResizeObserver(F);return H.observe(P),()=>H.disconnect()},[u]),d.useEffect(()=>()=>k.current?.(),[]);const R=d.useCallback(P=>{const F=x.current;if(!F)return;P.preventDefault();const H=P.currentTarget;H.setPointerCapture(P.pointerId);const $=P.clientX,Y=y.current,Z=F.getBoundingClientRect().width,K=Math.max(180,Z-180),B=document.body.style.cursor,V=document.body.style.userSelect;let J=Y,q=null;document.body.style.cursor="col-resize",document.body.style.userSelect="none";const te=()=>{q=null,w(J)},ie=G=>{J=Math.min(K,Math.max(180,Y+(G.clientX-$))),q===null&&(q=window.requestAnimationFrame(te))};let ge=()=>{};const re=G=>{k.current=null,q!==null&&(window.cancelAnimationFrame(q),q=null),G&&w(J),H.hasPointerCapture(P.pointerId)&&H.releasePointerCapture(P.pointerId),document.body.style.cursor=B,document.body.style.userSelect=V,window.removeEventListener("pointermove",ie),window.removeEventListener("pointerup",ge),window.removeEventListener("pointercancel",ge)};ge=()=>re(!0),k.current=()=>re(!1),window.addEventListener("pointermove",ie),window.addEventListener("pointerup",ge),window.addEventListener("pointercancel",ge)},[]);if(e.length===0)return a.jsx("div",{className:pt.empty,children:"No file changes to review."});const N=T_e(e),M=P=>{S(F=>F===P?null:P)},O=async P=>{if(!I.has(P.path)){E(F=>new Set(F).add(P.path));try{await r(P,()=>!A.current)}catch(F){A.current&&o(F)}finally{E(F=>{const H=new Set(F);return H.delete(P.path),H})}}};return a.jsxs("div",{className:pt.review,children:[a.jsxs("div",{className:pt.reviewToolbar,children:[a.jsxs("div",{className:pt.reviewToolbarTitle,children:[a.jsx("span",{children:i("turnOutputs.previousTurn")}),a.jsx(Y9,{additions:N?.additions,deletions:N?.deletions,className:pt.lineStats,additionsClassName:pt.additions,deletionsClassName:pt.deletions})]}),a.jsxs("div",{className:pt.reviewToolbarActions,children:[a.jsxs("button",{type:"button",className:pt.reviewTotalsButton,onClick:()=>h(P=>!P),"aria-expanded":u,children:[a.jsx("span",{children:i("turnOutputs.fileCount",{count:e.length})}),a.jsx("span",{className:[pt.chevron,u?pt.chevronOpen:""].filter(Boolean).join(" "),"aria-hidden":"true",children:a.jsx(_ue,{})})]}),a.jsx("button",{type:"button",className:[pt.iconButton,l?pt.iconButtonActive:""].filter(Boolean).join(" "),onClick:()=>c(P=>!P),"aria-label":i(l?"turnOutputs.closeFileTree":"turnOutputs.openFileTree"),title:i(l?"turnOutputs.closeFileTree":"turnOutputs.openFileTree"),children:l?a.jsx(x0n,{}):a.jsx(b0n,{})})]})]}),u&&a.jsxs("div",{ref:x,className:[pt.reviewContent,j?"":pt.reviewContentListOnly,j&&f?pt.reviewContentStacked:""].filter(Boolean).join(" "),style:{"--review-list-width":`${g}px`},children:[a.jsx("div",{className:[pt.reviewList,_?pt.reviewListWithExpanded:""].filter(Boolean).join(" "),children:e.map(P=>{const F=_===P.path,H=E_e(P.path),$=YIt(P.path);return a.jsxs("div",{className:[pt.reviewItem,F?pt.reviewItemExpanded:""].filter(Boolean).join(" "),children:[a.jsxs("div",{className:pt.reviewRow,"data-selected":P.path===t||void 0,children:[a.jsx("button",{type:"button",className:pt.reviewRowToggle,onClick:()=>M(P.path),"aria-label":P.path,"aria-expanded":F}),a.jsx("span",{className:pt.fileIcon,children:_Re(P.path)}),a.jsxs("span",{className:pt.reviewFileName,children:[a.jsx(v0n,{path:AL(P.path,n),title:P.path}),H&&a.jsx("button",{type:"button",className:pt.reviewOpenButton,onClick:()=>s(P),title:`${i("turnOutputs.preview")} ${P.path}`,children:i("turnOutputs.preview")}),$&&a.jsx("button",{type:"button",className:pt.reviewOpenButton,onClick:()=>void O(P),title:`${i("common.download")} ${P.path}`,disabled:I.has(P.path),children:i(I.has(P.path)?"common.downloading":"common.download")})]}),a.jsx(Y9,{additions:P.additions,deletions:P.deletions,className:pt.lineStats,additionsClassName:pt.additions,deletionsClassName:pt.deletions}),a.jsx("span",{className:[pt.chevron,F?pt.chevronOpen:""].filter(Boolean).join(" "),"aria-hidden":"true",children:a.jsx(_ue,{})})]}),F&&a.jsx(p0n,{change:P})]},`${P.toolCallId}:${P.path}`)})}),j&&!f&&a.jsx("div",{className:pt.reviewSplitHandle,role:"separator","aria-orientation":"vertical",onPointerDown:R}),j&&a.jsx("div",{className:pt.tree,children:L.children.map(P=>a.jsx(bRe,{node:P,depth:0,selectedPath:t},P.path))})]})]})}function p0n({change:e}){if(e.diffs.length===0)return a.jsx("div",{className:pt.diffEmpty,children:"No diff available."});const t=m0n(e.diffs);return a.jsx("div",{className:pt.diffPreview,children:t.map((n,s)=>n.fileDiff&&!n.fullContent?a.jsx(gY,{diff:n.fileDiff},s):a.jsx(g0n,{oldText:n.oldText,newText:n.newText},s))})}function m0n(e){for(let t=e.length-1;t>=0;t--)if(e[t]?.fullContent)return e.slice(t);return e}function g0n({oldText:e,newText:t}){const n=d.useRef(null),[s,r]=d.useState(null),[o,i]=d.useState(null);return d.useEffect(()=>{const l=n.current;if(!l)return;const c=()=>r(l.clientWidth>=720);c();const u=new ResizeObserver(c);return u.observe(l),()=>u.disconnect()},[]),d.useEffect(()=>{const l=n.current;if(!l||s===null)return;l.replaceChildren(),i(null);let c=!1,u=null;const h=[vTe,js.editable.of(!1),ua.readOnly.of(!0),js.lineWrapping],f={scanLimit:1e3,timeout:500},m={margin:3,minSize:8};return Je(async()=>{const{MergeView:g,unifiedMergeView:w}=await import("./index-BH44b2De.js");return{MergeView:g,unifiedMergeView:w}},[]).then(({MergeView:g,unifiedMergeView:w})=>{if(!c)try{if(s){u=new g({a:{doc:e,extensions:h},b:{doc:t,extensions:h},parent:l,highlightChanges:!0,gutter:!0,revertControls:void 0,collapseUnchanged:m,diffConfig:f});return}u=new js({doc:t,extensions:[...h,w({original:e,highlightChanges:!0,gutter:!0,mergeControls:!1,allowInlineDiffs:!0,collapseUnchanged:m,diffConfig:f})],parent:l})}catch(y){c||i(y instanceof Error?y.message:String(y))}}).catch(g=>{c||i(g instanceof Error?g.message:String(g))}),()=>{c=!0,u?.destroy()}},[s,t,e]),a.jsxs("div",{className:pt.codeMirrorDiffWrap,children:[a.jsx("div",{ref:n,className:pt.codeMirrorDiff}),o&&a.jsxs("div",{className:pt.diffError,children:["Diff unavailable: ",o]})]})}function bRe({node:e,depth:t,selectedPath:n}){const s=!!e.file,[r,o]=d.useState(!0),i=[pt.treeRow,s?pt.treeFile:pt.treeFolder].filter(Boolean).join(" "),l={paddingLeft:10+t*18,"--tree-row-line-left":`${19+Math.max(0,t-1)*18}px`},c={"--tree-children-line-left":`${19+t*18}px`},u=a.jsxs(a.Fragment,{children:[a.jsx("span",{className:pt.treeTwisty,children:!s&&a.jsx("span",{className:[pt.treeChevron,r?"":pt.treeChevronClosed].filter(Boolean).join(" "),children:a.jsx(k0n,{})})}),a.jsxs("span",{className:pt.treeContent,children:[s&&a.jsx("span",{className:pt.fileIcon,children:_Re(e.path)}),a.jsx("span",{className:pt.treeName,children:e.name})]}),e.file?.isArtifact&&a.jsx("span",{className:pt.reviewBadge,children:"artifact"})]});return a.jsxs("div",{className:pt.treeNode,children:[s?a.jsx("div",{className:i,"data-selected":e.file?.path===n||void 0,"data-depth":t,style:l,title:e.path,children:u}):a.jsx("button",{type:"button",className:i,"data-depth":t,style:l,title:e.path,"aria-expanded":r,onClick:()=>o(h=>!h),children:u}),!s&&r&&e.children.length>0&&a.jsx("div",{className:pt.treeChildren,style:c,children:e.children.map(h=>a.jsx(bRe,{node:h,depth:t+1,selectedPath:n},h.path))})]})}function v0n({path:e,title:t}){const n=d.useRef(null),[s,r]=d.useState(()=>xRe(e));return d.useLayoutEffect(()=>{const o=n.current;if(!o)return;const i=()=>r(w0n(e,o));i();const l=new ResizeObserver(i);return l.observe(o),()=>l.disconnect()},[e]),a.jsxs("span",{ref:n,className:pt.reviewPath,title:t??e,children:[s.prefix&&a.jsx("span",{className:pt.pathPrefix,children:s.prefix}),a.jsx("span",{className:pt.pathFileName,children:s.leaf})]})}function xRe(e){const t=e.lastIndexOf("/");return t<0?{prefix:"",leaf:e}:{prefix:e.slice(0,t+1),leaf:e.slice(t+1)}}let kue=null;function w0n(e,t){const n=xRe(e),s=t.clientWidth;if(s<=0)return n;const r=y0n(t);if(r(e)<=s)return n;const o=e.split("/").filter(Boolean),i=o.at(-1)??e,l=r(i);if(o.length<=1||l+r(".../")>s)return{prefix:"",leaf:i};let c=".../";for(let u=1;u<o.length;u++){const f=`.../${o.slice(o.length-1-u,-1).join("/")}/`;if(r(f)+l>s)break;c=f}return{prefix:c,leaf:i}}function y0n(e){kue??=document.createElement("canvas");const t=kue.getContext("2d"),n=window.getComputedStyle(e);return t&&(t.font=[n.fontStyle,n.fontVariant,n.fontWeight,n.fontSize,n.fontFamily].join(" ")),s=>t?.measureText(s).width??s.length*8}function b0n(){return a.jsxs("svg",{className:pt.toolbarIcon,viewBox:"0 0 24 24",fill:"none",focusable:"false","aria-hidden":"true",children:[a.jsx("path",{d:"M3.5 7.5h6l1.6 2h9.4v8.2a2 2 0 0 1-2 2h-13a2 2 0 0 1-2-2V7.5Z",stroke:"currentColor",strokeWidth:"1.7",strokeLinejoin:"round"}),a.jsx("path",{d:"M3.5 7.5V5.8a1.5 1.5 0 0 1 1.5-1.5h4l1.8 2.1h7.2a1.5 1.5 0 0 1 1.5 1.5v1.6",stroke:"currentColor",strokeWidth:"1.7",strokeLinejoin:"round"})]})}function x0n(){return a.jsxs("svg",{className:pt.toolbarIcon,viewBox:"0 0 24 24",fill:"none",focusable:"false","aria-hidden":"true",children:[a.jsx("path",{d:"M3.5 8.2V5.8A1.5 1.5 0 0 1 5 4.3h4l1.8 2.1h7.2a1.5 1.5 0 0 1 1.5 1.5v1.4",stroke:"currentColor",strokeWidth:"1.7",strokeLinejoin:"round"}),a.jsx("path",{d:"M4.8 19.7h12.9a2 2 0 0 0 1.9-1.4l2-7H6.4l-2.8 7.1a.9.9 0 0 0 1.2 1.3Z",stroke:"currentColor",strokeWidth:"1.7",strokeLinejoin:"round"})]})}function _ue(){return a.jsx("svg",{className:pt.chevronIcon,viewBox:"0 0 16 16",fill:"none",focusable:"false","aria-hidden":"true",children:a.jsx("path",{d:"m6 4 4 4-4 4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}function k0n(){return a.jsx("svg",{className:pt.treeChevronIcon,viewBox:"0 0 16 16",fill:"none",focusable:"false","aria-hidden":"true",children:a.jsx("path",{d:"m4 6 4 4 4-4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}function _0n(e,t){const n={name:"",path:"",children:[]};for(const s of e){const r=AL(s.path,t).split("/").filter(Boolean);let o=n;for(let i=0;i<r.length;i++){const l=r[i],c=r.slice(0,i+1).join("/");let u=o.children.find(h=>h.name===l);u||(u={name:l,path:c,children:[]},o.children.push(u)),i===r.length-1&&(u.file=s),o=u}}return kRe(n),n}function kRe(e){e.children.sort((t,n)=>!!t.file!=!!n.file?t.file?1:-1:t.name.localeCompare(n.name));for(const t of e.children)kRe(t)}function y8(e){return db(e).split("/").filter(Boolean).at(-1)??e}function _Re(e){const t=y8(e),n=t.includes(".")?t.split(".").pop()?.toLowerCase():"";return n?{css:"CSS",html:"HTML",js:"JS",json:"JSON",jsx:"JSX",md:"MD",ts:"TS",tsx:"TSX"}[n]??n.slice(0,3).toUpperCase():"FILE"}function S0n({artifact:e,sourceSessionId:t,workspaceActions:n,previewContent:s}){const{t:r}=Ct(),o=Hp(),i=iwe(e),l=N4(e.url)?e.url:void 0,c=e.metadata?.artifactType==="automation_snapshot",u=e.metadata?.artifactType==="code_review",h=e.storage==="workspace"&&!!e.workspacePath,f=owe(e);return e.metadata?.artifactType==="web_preview_snapshot"?a.jsx(cmn,{artifact:e,sourceSessionId:t}):u?e.status!=="available"?a.jsx(C0n,{status:e.status}):!h||!e.workspacePath?a.jsx(T0n,{}):a.jsx(bun,{workspacePath:e.workspacePath,artifactVersion:xte(e),workspaceActions:n}):h&&e.workspacePath?swe(e)?a.jsx(E0n,{artifact:e,workspaceActions:n}):a.jsx(oD,{workspacePath:e.workspacePath,artifactVersion:xte(e),workspaceActions:n,previewContent:s,previewSizeBytes:e.sizeBytes,imageMimeType:f,previewKind:I0n(e)?"html":R0n(e)?"markdown":f?"image":"source"}):a.jsxs("div",{className:pt.detail,children:[a.jsxs("div",{className:pt.section,children:[a.jsx("div",{className:pt.sectionTitle,children:c?"Automation Snapshot":"Artifact"}),a.jsxs("div",{className:pt.fieldGrid,children:[a.jsx(kp,{label:"Type",value:GG(e.kind,e.workspacePath)}),a.jsx(kp,{label:"Storage",value:e.storage}),a.jsx(kp,{label:"Status",value:e.status}),a.jsx(kp,{label:"Source",value:e.source}),a.jsx(kp,{label:"Size",value:VP(e.sizeBytes)}),a.jsx(kp,{label:"Created",value:e.createdAt}),a.jsx(kp,{label:"Updated",value:e.updatedAt}),e.toolName&&a.jsx(kp,{label:"Tool",value:e.toolName}),e.toolCallId&&a.jsx(kp,{label:"Tool call",value:e.toolCallId})]})]}),e.description&&a.jsxs("div",{className:pt.section,children:[a.jsx("div",{className:pt.sectionTitle,children:"Description"}),a.jsx("div",{className:pt.description,children:e.description})]}),c&&e.metadata&&a.jsxs("div",{className:pt.section,children:[a.jsx("div",{className:pt.sectionTitle,children:"Details"}),a.jsxs("div",{className:pt.fieldGrid,children:[C2(e.metadata,"automationId","Automation ID"),C2(e.metadata,"schedule","Schedule"),C2(e.metadata,"timezone","Timezone"),C2(e.metadata,"status","Status"),C2(e.metadata,"nextRunAt","Next run"),C2(e.metadata,"prompt","Prompt")]})]}),(i||l)&&a.jsxs("div",{className:pt.section,children:[a.jsx("div",{className:pt.sectionTitle,children:"Location"}),l?a.jsxs("div",{className:pt.locationRow,children:[a.jsx("a",{className:pt.link,href:l,target:"_blank",rel:"noopener noreferrer",onClick:m=>o(m,l),children:l}),a.jsx("a",{className:pt.openButton,href:l,target:"_blank",rel:"noopener noreferrer",onClick:m=>o(m,l),children:r("artifact.openLink")})]}):a.jsx("div",{className:pt.meta,children:i})]})]})}function C0n({status:e}){const{t}=Ct();return a.jsx("div",{className:pt.previewError,role:"alert",children:t("codeReview.unavailable",{status:e})})}function T0n(){const{t:e}=Ct();return a.jsx("div",{className:pt.previewError,role:"alert",children:e("codeReview.workspaceRequired")})}function I0n(e){const t=e.workspacePath?.toLowerCase()??"",n=ub(e.mimeType);return e.kind==="html"||t.endsWith(".html")||t.endsWith(".htm")||n==="text/html"}function R0n(e){const t=e.workspacePath?.toLowerCase()??"",n=ub(e.mimeType);return t.endsWith(".md")||t.endsWith(".markdown")||n==="text/markdown"}function E0n({artifact:e,workspaceActions:t}){const{t:n}=Ct(),[s,r]=d.useState(null),[o,i]=d.useState(!1),l=d.useRef(!0),c=iwe(e);d.useEffect(()=>(l.current=!0,()=>{l.current=!1}),[]);const u=async()=>{if(e.workspacePath){i(!0),r(null);try{await GP(t,e.workspacePath,e.mimeType,()=>!l.current)}catch(h){if(!l.current)return;r(h instanceof Error?h.message:String(h))}finally{l.current&&i(!1)}}};return a.jsx("div",{className:pt.detail,children:a.jsxs("div",{className:pt.section,children:[a.jsx("div",{className:pt.sectionTitle,children:n("common.download")}),a.jsxs("div",{className:pt.fieldGrid,children:[a.jsx(kp,{label:"Type",value:GG(e.kind,e.workspacePath)}),a.jsx(kp,{label:"Size",value:VP(e.sizeBytes)}),c?a.jsx(kp,{label:"Location",value:c}):null,e.status!=="available"&&e.status!=="changed"?a.jsx(kp,{label:"Status",value:e.status??"missing"}):null]}),a.jsx("div",{className:pt.downloadRow,children:a.jsx("button",{type:"button",className:pt.downloadButton,onClick:()=>{u()},disabled:o||e.status!=="available"&&e.status!=="changed",children:n(o?"common.downloading":"common.download")})}),s&&a.jsx("div",{className:pt.previewError,children:s})]})})}function A0n({tab:e}){const{t}=Ct(),n=el(),s=O4(e.workspaceCwd),r=s?.actions,o=Hp(),[i,l]=d.useState(0),[c,u]=d.useState(),[h,f]=d.useState(),[m,g]=d.useState(),w=e.source,y=w.locator,x=e.owner.isCurrent()&&n.sessionId===e.sourceSessionId&&n.capabilities?.features.includes("session_sources")&&s?.workspaceId===e.workspaceId&&(!!s||e.workspaceCwd===void 0&&y.type!=="workspace_file")&&(y.type!=="workspace_file"||w.workspaceCwd===n.workspaceCwd),k=y.type==="workspace_file"?y.workspacePath:y.type==="attachment"?y.attachmentId:"",_=/\.pdf$/i.test(k);if(d.useEffect(()=>{let I=!1;return u(void 0),f(void 0),g(void 0),!x||y.type==="url"?void 0:((async()=>{if(y.type==="attachment"){const A=await e.sessionActions.readAttachment(y.attachmentId);if(I||!e.owner.isCurrent())return;const j=Uint8Array.from(atob(A.data),L=>L.charCodeAt(0));u(new Blob([j],{type:A.mimeType}))}else if(_&&r){const A=await _4(r.readFileBytes,k,"application/pdf",{statFile:r.stat,isCancelled:()=>I||!e.owner.isCurrent()});!I&&e.owner.isCurrent()&&u(A)}})().catch(A=>{!I&&e.owner.isCurrent()&&f(Iu(A))}),()=>{I=!0})},[i,x,y,k,_,e.owner,e.sessionActions,r]),x&&y.type==="url")return a.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[a.jsx("h3",{children:w.title}),w.description&&a.jsx("p",{children:w.description}),a.jsx("p",{className:"break-all text-sm text-muted-foreground",children:y.url}),N4(y.url)&&a.jsx("a",{className:"text-primary underline",href:y.url,target:"_blank",rel:"noopener noreferrer",onClick:I=>o(I,y.url),children:t("sources.openOriginal")})]});if(!x||!s&&y.type!=="attachment")return a.jsx("div",{className:pt.empty,role:"alert",children:t("sources.unavailable")});const S=y.type==="workspace_file"&&!_&&swe({workspacePath:k});return a.jsxs("div",{className:"flex h-full min-h-0 flex-1 flex-col",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-border px-3 py-2",children:[a.jsx("span",{className:"truncate text-xs text-muted-foreground",title:k,children:k}),a.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[m&&a.jsx(Wt,{variant:"ghost",size:"icon-sm",asChild:!0,children:a.jsx("a",{href:m,download:w.title,"aria-label":`Download ${w.title}`,title:t("common.download"),children:a.jsx(Vy,{})})}),h&&a.jsx(Wt,{variant:"ghost",size:"sm",onClick:()=>l(I=>I+1),children:t("common.retry")})]})]}),h?a.jsx("div",{className:pt.previewError,role:"alert",children:h}):S?a.jsxs("div",{className:"p-4",children:[a.jsx("p",{children:t("attachment.previewUnsupported")}),a.jsx(Wt,{onClick:()=>void GP(r,k,"application/octet-stream",()=>!e.owner.isCurrent()).catch(I=>{e.owner.isCurrent()&&f(Iu(I))}),children:t("common.download")})]}):(y.type==="attachment"||_)&&!c?a.jsx("div",{className:pt.empty,role:"status",children:t("common.loading")}):c&&c.type!=="application/pdf"&&!i4(c.type,k)?a.jsx(SRe,{data:c,title:w.title,onDownloadUrl:g,showDownload:!1,image:!!FS(k)&&c.type.startsWith("image/")}):a.jsx("div",{className:"relative min-h-0 flex-1 overflow-auto",children:a.jsx(oD,{workspacePath:k,workspaceActions:r,onLoadError:f,previewData:c,previewOnly:y.type==="attachment",previewMimeType:c?.type,previewKind:/\.html?$/i.test(k)||ub(c?.type)==="text/html"?"source":void 0},i)})]})}function SRe({data:e,title:t,image:n,onDownloadUrl:s,showDownload:r=!0}){const[o,i]=d.useState();return d.useEffect(()=>{const l=URL.createObjectURL(e);return i(l),s?.(l),()=>URL.revokeObjectURL(l)},[e,s]),o?a.jsxs("div",{className:pt.imagePreviewWrap,children:[n?a.jsx("img",{className:pt.imagePreview,src:o,alt:t}):a.jsx(CRe,{name:t,mimeType:e.type,size:e.size}),r&&a.jsx("a",{href:o,download:t,"aria-label":`Download ${t}`,children:a.jsx(Vy,{})})]}):null}function oD({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewData:o,previewMimeType:i,imageMimeType:l,previewKind:c,previewOnly:u,onLoadError:h}){if(o)return a.jsx(j0n,{workspacePath:e,workspaceActions:n,data:o,mimeType:i,previewKind:c,onLoadError:h});const f=e.toLowerCase(),m=l??FS(e),g=c??(f.endsWith(".html")||f.endsWith(".htm")?"html":f.endsWith(".md")||f.endsWith(".markdown")?"markdown":m?"image":"source");return g==="html"?a.jsx(L0n,{workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:u,onLoadError:h}):g==="markdown"?a.jsx(O0n,{workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:u,onLoadError:h}):g==="image"&&m?a.jsx(P0n,{workspacePath:e,artifactVersion:t,workspaceActions:n,mimeType:m,onLoadError:h}):a.jsx(TRe,{workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:u,onLoadError:h})}function j0n({workspacePath:e,workspaceActions:t,data:n,mimeType:s,previewKind:r,onLoadError:o}){const i=(s||n.type||"application/octet-stream").split(";",1)[0].trim().toLowerCase();return i==="application/pdf"?a.jsx(M0n,{data:n,mimeType:i,title:e}):i4(i,e)?a.jsx(N0n,{workspacePath:e,workspaceActions:t,data:n,previewKind:r,onLoadError:o}):a.jsx(CRe,{name:e,mimeType:i,size:n.size})}function N0n({workspacePath:e,workspaceActions:t,data:n,previewKind:s,onLoadError:r}){const{t:o}=Ct(),[i,l]=d.useState(),[c,u]=d.useState();return d.useEffect(()=>{const h=new FileReader;return l(void 0),u(void 0),h.onload=()=>l(String(h.result??"")),h.onerror=()=>{const f=o("attachment.readFailed");u(f),r?.(f)},h.readAsText(n),()=>{h.readyState===FileReader.LOADING&&h.abort()}},[n,r,o]),c?a.jsx("div",{className:pt.previewError,children:c}):i===void 0?a.jsx("div",{className:pt.empty,children:o("attachment.loadingFile")}):a.jsx(oD,{workspacePath:e,workspaceActions:t,previewContent:i,previewSizeBytes:n.size,previewOnly:!0,previewKind:s})}function M0n({data:e,mimeType:t,title:n}){const{t:s}=Ct(),[r,o]=d.useState();return d.useEffect(()=>{const i=URL.createObjectURL(e.type===t?e:new Blob([e],{type:t}));return o(i),()=>URL.revokeObjectURL(i)},[e,t]),r?a.jsx("iframe",{className:pt.pdfAttachmentPreview,src:r,title:`Preview ${n}`}):a.jsx("div",{className:pt.empty,children:s("attachment.loadingPreview")})}function CRe({name:e,mimeType:t,size:n}){const{t:s}=Ct();return a.jsxs("div",{className:pt.unsupportedAttachmentPreview,children:[a.jsx(U0,{name:e,mimeType:t,"aria-hidden":"true"}),a.jsx("div",{children:s("attachment.previewUnsupported")}),a.jsxs("div",{className:pt.unsupportedAttachmentMeta,children:[t," · ",VP(n)]})]})}function P0n({workspacePath:e,artifactVersion:t,workspaceActions:n,mimeType:s,onLoadError:r}){const[o,i]=d.useState(null),[l,c]=d.useState(null);return d.useEffect(()=>{let u=!1,h;return i(null),c(null),_4((f,m)=>n.readFileBytes(f,m),e,s,{statFile:f=>n.stat(f),isCancelled:()=>u}).then(f=>{u||(h=URL.createObjectURL(f),i(h))}).catch(f=>{if(u)return;const m=f instanceof Error?f.message:String(f);c(m),r?.(m)}),()=>{u=!0,h&&URL.revokeObjectURL(h)}},[t,s,r,n,e]),a.jsxs("div",{className:pt.imagePreviewWrap,children:[o?a.jsxs(a.Fragment,{children:[a.jsx("img",{className:pt.imagePreview,src:o,alt:y8(e)}),a.jsx("a",{className:pt.imageDownloadButton,href:o,download:y8(e),"aria-label":`Download ${y8(e)}`,title:"Download",children:a.jsx(Vy,{size:16,strokeWidth:1.8})})]}):l?null:a.jsx("div",{className:pt.empty,children:"Loading image..."}),l&&a.jsx("div",{className:pt.previewError,children:l})]})}function SZ({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:r,onLoadError:o}){const[i,l]=d.useState(s??null),[c,u]=d.useState(),[h,f]=d.useState(null);return d.useEffect(()=>{let m=!1;if(l(s??null),f(null),u(void 0),!r)return n.stat(e).then(g=>{if(!m){if(g.type==="directory")throw new Error("Directories cannot be opened as artifacts.");return n.readWorkspaceFile(e,{maxBytes:256*1024})}}).then(async g=>{if(m||!g||!g.truncated)return g;const w=await _4((y,x)=>n.readFileBytes(y,x),e,"application/octet-stream",{statFile:y=>n.stat(y),isCancelled:()=>m});return{sizeBytes:w.size,content:new TextDecoder(g.encoding||"utf-8").decode(await w.arrayBuffer())}}).then(g=>{m||!g||(u(g.sizeBytes),l(g.content))}).catch(g=>{if(m)return;const w=g instanceof Error?g.message:String(g);f(w),o?.(w)}),()=>{m=!0}},[t,s,r,o,n,e]),{content:i,error:h,sizeBytes:c}}function L0n({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:o,onLoadError:i}){const{content:l,error:c,sizeBytes:u}=SZ({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:o,onLoadError:i});return a.jsxs("div",{className:pt.htmlPreviewWrap,children:[l===null?!c&&a.jsx("div",{className:pt.empty,children:"Loading preview..."}):a.jsx(IRe,{content:l,sizeBytes:u??r,workspacePath:e,workspaceActions:n,children:()=>a.jsx(D0n,{content:l,workspacePath:e})}),c&&a.jsx("div",{className:pt.previewError,children:c})]})}function D0n({content:e,workspacePath:t}){const n=`Preview ${t}`,{t:s}=Ct(),[r,o]=d.useState(null),[i,l]=d.useState(null);return d.useEffect(()=>{const c=new AbortController;return o(null),l(null),hVe(e,n,c.signal).then(u=>{c.signal.aborted||o(u)},u=>{c.signal.aborted||l(Iu(u))}),()=>c.abort()},[e,n]),i?a.jsx("div",{className:pt.previewError,children:s("artifact.previewFailed",{message:i})}):r===null?a.jsx("div",{className:pt.empty,children:s("attachment.loadingPreview")}):a.jsx("iframe",{className:pt.htmlPreview,referrerPolicy:"no-referrer",sandbox:"allow-scripts",srcDoc:r,title:n})}function TRe({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:r,onLoadError:o}){const i=d.useRef(null),[l,c]=d.useState(null),{content:u,error:h}=SZ({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:r,onLoadError:o});return d.useEffect(()=>{const f=i.current;if(!f||u===null)return;f.replaceChildren(),c(null);let m;try{m=new js({doc:u,extensions:[vTe,js.editable.of(!1),ua.readOnly.of(!0),js.lineWrapping],parent:f})}catch(g){c(g instanceof Error?g.message:String(g));return}return()=>m.destroy()},[u]),a.jsxs("div",{className:pt.filePreviewWrap,children:[u===null?!h&&a.jsx("div",{className:pt.empty,children:"Loading file..."}):a.jsx("div",{ref:i,className:pt.codeMirrorFile}),(h||l)&&a.jsx("div",{className:pt.previewError,children:h||l})]})}function IRe({content:e,sizeBytes:t,workspacePath:n,workspaceActions:s,children:r}){const{t:o}=Ct(),[i,l]=d.useState(null);if(!d.useMemo(()=>(t??new TextEncoder().encode(e).byteLength)>1024*1024,[e,t]))return r();const u=i===e;return a.jsxs("div",{className:"absolute inset-3 flex min-h-0 flex-col gap-2",children:[a.jsxs("div",{className:"flex shrink-0 items-center gap-2 text-sm text-muted-foreground",children:[a.jsx("span",{children:o("artifact.longDocument")}),a.jsx(Wt,{className:"ml-auto shrink-0",variant:"outline",size:"sm",onClick:()=>l(u?null:e),children:o(u?"artifact.showSource":"artifact.renderFullPreview")})]}),a.jsx("div",{className:"relative min-h-0 flex-1 overflow-auto",children:u?r():a.jsx(TRe,{workspacePath:n,workspaceActions:s,previewContent:e,previewOnly:!0})})]})}function O0n({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:o,onLoadError:i}){const{content:l,error:c,sizeBytes:u}=SZ({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:o,onLoadError:i});return a.jsxs("div",{className:pt.htmlPreviewWrap,children:[l===null?!c&&a.jsx("div",{className:pt.empty,children:"Loading preview..."}):a.jsx(IRe,{content:l,sizeBytes:u??r,workspacePath:e,workspaceActions:n,children:()=>a.jsx("div",{className:pt.markdownPreviewWrap,children:a.jsx(Im,{content:l})})}),c&&a.jsx("div",{className:pt.previewError,children:c})]})}function kp({label:e,value:t}){return t?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:pt.fieldLabel,children:e}),a.jsx("span",{className:pt.fieldValue,children:t})]}):null}function C2(e,t,n){const s=e[t];return s==null||s===""?null:a.jsx(kp,{label:n,value:String(s)},t)}/**
2216
+ `);return n===-1?t:t.slice(0,n)}function zgn(e,t){if(e.kind==="request"){const n=[kh(e.timing.durationMs)];return e.timing.ttftMs!==void 0&&n.push(t("trajectory.ttft",{duration:kh(e.timing.ttftMs)})),e.usage&&n.push($gn(e.usage)),n}if(e.kind==="tool"){const n=[];if(e.timing&&n.push(kh(e.timing.durationMs)),e.subagentSummary){const{requests:s,tools:r,requestMs:o}=e.subagentSummary;n.push(t("trajectory.subagentRollup",{requests:s,tools:r,duration:kh(o)}))}return n}return[]}function yue(e){const t=e.toolStatus??e.block.status;if(t==="error"||t==="failed")return Ua.toneError;if(t==="cancelled")return Ua.toneMuted}function Hgn(e,t){switch(e.kind){case"user":return{badge:t("trajectory.badge.user"),text:yE(e.block.text)};case"request":{const n=Fgn(e),s=e.status==="error",r=n!==void 0?`${n}${e.model?` · ${e.model}`:""}`:e.model??t("trajectory.request");return{badge:n!==void 0?t("trajectory.badge.subagent"):`#${e.requestIndex??"?"}`,...s?{badgeTone:Ua.toneError}:{},text:s?`${r} · ${t("trajectory.requestFailed")}`:r}}case"message":return{badge:e.thought?t("trajectory.badge.thought"):t("trajectory.badge.message"),text:yE(e.block.text),faint:e.thought};case"tool":return{badge:e.block.toolName??t("trajectory.badge.tool"),...yue(e)?{badgeTone:yue(e)}:{},text:e.block.title||(e.block.toolName??"")};default:return Ugn(e.block,t)}}function Ugn(e,t){switch(e.kind){case"shell":return{badge:t("trajectory.badge.shell"),text:yE(e.text)};case"user_shell":return{badge:t("trajectory.badge.shell"),text:yE(e.command||e.text)};case"permission":return{badge:t("trajectory.badge.permission"),text:e.title||e.toolName||""};case"status":case"error":case"debug":return{badge:t("trajectory.badge.status"),...e.kind==="error"?{badgeTone:Ua.toneError}:{},text:yE(e.text),faint:e.kind!=="error"};case"prompt_cancelled":return{badge:t("trajectory.badge.cancelled"),badgeTone:Ua.toneMuted,text:e.reason??t("trajectory.cancelled"),faint:!0};default:return{badge:t("trajectory.badge.other"),text:""}}}function Wgn(e){return e.rows.some(t=>t.kind==="request"||t.kind==="tool"&&t.timing!==void 0)}function qgn({loadPage:e}){const{t}=Ct(),{trajectory:n,status:s,error:r,truncated:o,refresh:i}=ugn(e),[l,c]=d.useState(void 0),u=d.useRef(null),h=d.useRef(!1),f=d.useRef(0),m=d.useId(),g=d.useCallback(R=>`${m}-row-${R}`,[m]),w=d.useCallback((R,N)=>{R.scrollTop=N,f.current=R.scrollTop},[]),y=d.useMemo(()=>{if(!n)return[];const R=new Map(n.rows.map(M=>[M.key,M])),N=[];for(const M of n.turns){const O=M.userRowKey??`ordinal:${M.index}`;N.push({kind:"turn",key:`turn:${O}`,turn:M});for(const P of M.rowKeys){const F=R.get(P);F&&N.push({kind:"row",key:P,row:F})}}return N},[n]),x=wwe({count:y.length,getScrollElement:()=>u.current,getItemKey:R=>y[R]?.key??R,estimateSize:()=>vue,overscan:12}),k=y.length>0;d.useLayoutEffect(()=>{const R=u.current;if(!R||typeof ResizeObserver>"u")return;let N=0;const M=()=>{R.scrollTop===0&&f.current>0&&(R.scrollTop=f.current)},O=new ResizeObserver(()=>{M(),N=requestAnimationFrame(M)});return O.observe(R),()=>{O.disconnect(),N!==0&&cancelAnimationFrame(N)}},[k]),d.useEffect(()=>{if(s!=="ready"||h.current||y.length===0)return;h.current=!0;const R=u.current;R&&w(R,R.scrollHeight)},[w,s,y.length]);const _=d.useMemo(()=>l===void 0?-1:y.findIndex(R=>R.key===l),[l,y]),S=d.useCallback(R=>{if(y.length===0)return;const N=Math.min(Math.max(R,0),y.length-1);c(y[N].key),x.scrollToIndex(N,{align:"auto"})},[x,y]),I=d.useCallback(R=>{c(R),u.current?.focus({preventScroll:!0})},[]),E=d.useCallback(R=>{if(y.length===0)return;const N=_<0?-1:_;R.key==="ArrowDown"?(R.preventDefault(),S(N+1)):R.key==="ArrowUp"?(R.preventDefault(),S(N<=0?0:N-1)):R.key==="Home"?(R.preventDefault(),S(0)):R.key==="End"&&(R.preventDefault(),S(y.length-1))},[S,_,y]),A=d.useMemo(()=>{if(!n)return;let R=0,N=0,M=0;for(const O of n.turns)R+=O.requestCount,N+=O.toolCount,M+=O.requestMs;return{turns:n.turns.length,requests:R,tools:N,durationMs:M}},[n]),j=s==="ready"&&y.length===0,L=n!==void 0&&y.length>0&&!Wgn(n);return a.jsxs("div",{className:Ua.panel,"data-testid":"trajectory-panel",children:[a.jsxs("div",{className:Ua.header,children:[a.jsx("div",{className:Ua.summary,children:A?a.jsx("span",{"data-testid":"trajectory-totals",children:t("trajectory.totals",{turns:A.turns,requests:A.requests,tools:A.tools,duration:A.durationMs>0?kh(A.durationMs):"—"})}):a.jsx("span",{children:t("trajectory.title")})}),a.jsx("div",{className:Ua.headerActions,children:a.jsx("button",{type:"button",className:Ua.iconButton,onClick:i,disabled:!e||s==="loading",title:t("common.refresh"),"aria-label":t("common.refresh"),children:a.jsx(Hg,{size:14,strokeWidth:1.6})})})]}),r!==void 0&&a.jsxs("div",{className:Ua.error,role:"alert",children:[a.jsx("span",{children:r.kind==="partial"?t("trajectory.partial"):t("trajectory.loadFailed",{message:r.message})}),a.jsx("button",{type:"button",className:Ua.headerButton,onClick:i,disabled:s==="loading",children:t("common.retry")})]}),L&&a.jsx("div",{className:Ua.notice,role:"status",children:t("trajectory.noTiming")}),a.jsx("div",{className:Ua.tableWrap,children:y.length===0?s==="error"?null:a.jsx("div",{className:Ua.placeholder,role:"status",children:t(j?"trajectory.empty":"common.loading")}):a.jsxs(a.Fragment,{children:[o&&a.jsx("div",{className:Ua.olderBar,children:a.jsx("span",{className:Ua.olderNotice,"data-testid":"trajectory-truncated",children:t("trajectory.truncated")})}),a.jsx("div",{ref:u,className:Ua.scroll,role:"grid",tabIndex:0,"aria-label":t("trajectory.title"),"aria-rowcount":y.length,"aria-activedescendant":_>=0?g(_):void 0,onKeyDown:E,onScroll:R=>{f.current=R.currentTarget.scrollTop},"data-testid":"trajectory-rows",children:a.jsx("div",{className:Ua.virtualBody,style:{height:`${x.getTotalSize()}px`},children:x.getVirtualItems().map(R=>{const N=y[R.index];return a.jsx("div",{id:g(R.index),className:Ua.virtualRow,style:{height:`${vue}px`,transform:`translateY(${R.start}px)`},role:"row","aria-rowindex":R.index+1,children:N.kind==="turn"?a.jsx(Vgn,{turn:N.turn,selected:N.key===l,onSelect:()=>I(N.key)}):a.jsx(Ggn,{row:N.row,selected:N.key===l,onSelect:()=>I(N.key)})},R.key)})})})]})})]})}function Vgn({turn:e,selected:t,onSelect:n}){const{t:s}=Ct();return a.jsxs("div",{className:`${Ua.turnHeader} ${t?Ua.selected:""}`,onClick:n,"aria-selected":t,"data-selected":t?"true":void 0,role:"gridcell","data-testid":"trajectory-turn",children:[a.jsx("span",{className:Ua.turnTitle,children:e.partial?s("trajectory.turnPartial",{index:e.index}):s("trajectory.turn",{index:e.index})}),a.jsx("span",{className:Ua.turnSummary,children:s("trajectory.turnSummary",{requests:e.requestCount,tools:e.toolCount,duration:e.requestMs>0?kh(e.requestMs):"—"})})]})}function Ggn({row:e,selected:t,onSelect:n}){const{t:s}=Ct(),r=Hgn(e,s),o=zgn(e,s);return a.jsxs("div",{className:`${Ua.record} ${t?Ua.selected:""}`,role:"gridcell","aria-selected":t,"data-selected":t?"true":void 0,onClick:n,"data-testid":`trajectory-row-${e.kind}`,"data-depth":e.depth,children:[e.depth>0&&a.jsx(zHe,{size:12,strokeWidth:1.6,className:Ua.nestMarker,"aria-hidden":"true"}),a.jsx("span",{className:`${Ua.badge} ${r.badgeTone??""}`,children:r.badge}),a.jsx("span",{className:`${Ua.text} ${r.faint?Ua.faint:""}`,children:r.text}),a.jsx("span",{className:Ua.metrics,"data-testid":"trajectory-row-metrics",children:o.length>0?o.join(" · "):"—"})]})}const Kgn="_panel_pwtdr_1",Ygn="_toolbar_pwtdr_5",Xgn="_actions_pwtdr_15",Zgn="_feedback_pwtdr_21",Jgn="_state_pwtdr_31",ky={panel:Kgn,toolbar:Ygn,actions:Xgn,feedback:Zgn,state:Jgn};function Qgn({sessionActions:e,sessionId:t,controls:n}){const{t:s}=Ct(),[r,o]=d.useState(null),[i,l]=d.useState(!0),[c,u]=d.useState(!1),h=d.useRef(0),f=d.useRef(()=>{}),m=d.useRef(null),g=n?.sessionId===t?n:void 0,w=g?.getContextUsage??e?.getContextUsage,y=d.useRef(g);y.current=g;const x=g?.result,[k,_]=d.useState(x),S=!!(x&&x!==k&&(x.kind!=="completed"||!c));d.useEffect(()=>{x?.kind==="completed"&&(h.current++,o(x.usage),u(!1))},[x]),d.useEffect(()=>{let A=!0,j=!1;const L=y.current?.result;o(N=>N?.sessionId===t?N:L?.kind==="completed"?L.usage:null),u(!1),l(!!w);const R=async()=>{if(!A||j||!w)return;j=!0,l(!0),u(!1);const N=h.current,M=m.current,O=M&&M.getContextUsage===w&&M.sessionId===t?M:{getContextUsage:w,sessionId:t,promise:w({detail:!0,silent:!0,...y.current?.result?{syncCounters:!0}:{}})};m.current=O;try{const P=await O.promise;if(!A||N!==h.current)return;o(P.sessionId===t&&P.usage.contextWindowSize>0?P:null)}catch(P){if(!A||N!==h.current)return;u(DV(P)?"transient":"hard")}finally{j=!1,m.current===O&&(m.current=null),A&&l(!1)}};return f.current=()=>void R(),R(),()=>{A=!1}},[w,t]);const I=!w||i||g?.compressing,E=()=>{_(x),f.current()};return a.jsxs("div",{className:ky.panel,"aria-busy":i,children:[a.jsxs("div",{className:ky.toolbar,children:[a.jsx("span",{children:s("contextUsage.title")}),a.jsxs("div",{className:ky.actions,children:[a.jsx(Wt,{type:"button",variant:"ghost",size:"icon-sm","aria-label":s("contextUsage.refresh"),title:s("contextUsage.refresh"),disabled:I,onClick:E,children:a.jsx(Hg,{"aria-hidden":"true"})}),a.jsx("span",{title:g?.compressing?void 0:g?.canCompress?i?s("common.loading"):void 0:s("contextUsage.compressUnavailable"),children:a.jsx(Wt,{type:"button",variant:"outline",size:"sm",disabled:!g?.canCompress||i,onClick:()=>void g?.compress(),children:s(g?.compressing?"contextUsage.compressing":"contextUsage.compress")})})]})]}),(g?.compressing||S)&&a.jsx(i4e,{controls:g,className:ky.feedback}),c==="transient"&&r&&a.jsx("div",{className:ky.feedback,role:"status",children:s("contextUsage.previousReading")}),c==="hard"?a.jsxs("div",{className:ky.state,role:"alert",children:[a.jsx("span",{children:s("contextUsage.loadError")}),a.jsx(Wt,{type:"button",variant:"outline",size:"sm",disabled:I,onClick:E,children:s("contextUsage.retry")})]}):w?i&&!r?a.jsx("div",{className:ky.state,role:"status",children:s("common.loading")}):r?a.jsx(Sxe,{status:r,compact:!0}):a.jsx("div",{className:ky.state,children:s("contextUsage.unavailable")}):a.jsx("div",{className:ky.state,children:s("contextUsage.unavailable")})]})}const e0n=700,t0n=["daily","weekdays","weekly","hourly","minutes","custom"],n0n=[1,2,3,4,5,6,10,12,15,20,30],s0n=(e,t)=>{},r0n=(e,t,n)=>{},o0n=()=>Promise.reject(new Error("Side-task session creation is unavailable"));function bue(e){return e.kind==="review"||e.kind==="file"||e.kind==="artifact"||e.kind==="scheduled_task"}function _y(e){return e.kind==="pending"?e.targetKind:e.kind}function i0n(e){return`image.${(e.match(/^data:image\/([a-z0-9+.+-]+)/i)?.[1]??"png").split("+")[0].toLowerCase()}`}const a0n=["review","sideTask"];function xue({contextUsageControls:e,artifacts:t,tabs:n,activeTabId:s,reviewChanges:r,selectedReviewPath:o,panelWidth:i,workspaceCwd:l,loading:c,restoring:u=!1,error:h,onSelectTab:f,onCloseTab:m,onOpenFilePreview:g,latestReviewAvailable:w=!1,onOpenLatestReview:y,onOpenTerminal:x,onOpenTrajectory:k,trajectoryTabId:_,onOpenWebPreview:S,onWebPreviewChange:I,items:E=a0n,sideTaskAvailable:A=!1,sideTasks:j=[],sideTasksLoading:L=!1,onCreateSideTask:R,onOpenSideTask:N,onCreateSideTaskSession:M,onSideTaskCreated:O,onSideTaskTitleChange:P,onNestedRightPanelOpen:F,onNestedArtifactsChange:H,onOpenNestedSubagent:$,agentTasks:Y=[],agentTraceLoading:Z=!1,agentTraceError:K,onOpenWorkflowAgent:B,onError:V,sessionWorkflowEnabled:J,workflow:q,onImageIngestionNotice:te,deferSubagentMount:ie=!1,onClose:ge,variant:re="docked",fullscreen:G=!1,onToggleFullscreen:Q}){const{t:he}=Ct(),[ve,ye]=d.useState(!1),[_e,ae]=d.useState(),Se=d.useRef(null),Te=d.useCallback(()=>{Se.current&&(clearTimeout(Se.current),Se.current=null),ye(!0)},[]),Ne=d.useCallback(()=>{Se.current&&clearTimeout(Se.current),Se.current=setTimeout(()=>{ye(!1),Se.current=null},120)},[]);d.useEffect(()=>()=>{Se.current&&clearTimeout(Se.current)},[]);const Ae=n.find(ke=>ke.id===s)??n[0],Ve=Ae?.kind==="file"&&Ae.sourcePreview&&(/\.html?$/i.test(Ae.workspacePath)||ub(Ae.previewMimeType||Ae.previewData?.type)==="text/html"),Ze=Ae?.kind==="file"&&Ae.previewOnly===!0&&!Ve&&/\.(?:html?|md|markdown)$/i.test(Ae.workspacePath)&&(Ae.previewContent!==void 0||!Ae.previewData||!!i4(Ae.previewMimeType||Ae.previewData.type,Ae.workspacePath)),Tt=_e===Ae?.id,je=E.includes("review")&&!n.some(ke=>_y(ke)==="review"),ot=E.includes("sideTask")&&A&&!!R,Ie=!!x,ue=E.includes("webPreview")&&!!S,W=E.includes("trajectory")&&!!k&&!n.some(ke=>ke.id===_),ne=!!Ae&&(je||ot||Ie||ue||W),me=Ae&&bue(Ae)?{workspaceCwd:Ae.workspaceCwd,workspaceId:Ae.workspaceId}:void 0,Me=O4(me?.workspaceCwd),Ke=Me?.workspaceId===me?.workspaceId?Me?.actions:void 0,be=Ae?.kind==="artifact"?t.find(ke=>ke.id===Ae.artifactId):void 0;return a.jsxs("aside",{className:`${pt.panel} ${re==="drawer"?pt.panelDrawer:""} ${G?pt.panelFullscreen:""}`,style:re==="docked"&&i&&!G?{flexBasis:i,width:i}:void 0,"aria-label":"Right panel",children:[a.jsxs("div",{className:pt.header,children:[n.length>0&&a.jsx("div",{className:pt.tabs,role:"tablist","aria-label":"Right panel",children:n.map(ke=>a.jsxs("div",{className:[pt.tabItem,ke.id===Ae?.id?pt.tabActive:""].filter(Boolean).join(" "),children:[a.jsxs("button",{type:"button",role:"tab","aria-selected":ke.id===Ae?.id,className:pt.tab,onClick:()=>f(ke.id),onMouseEnter:Pe=>yT(Pe.currentTarget),onFocus:Pe=>yT(Pe.currentTarget),title:ke.title,children:[a.jsx("span",{className:`${pt.tabIcon} ${_y(ke)==="artifact"?pt.tabArtifactIcon:""}`,"aria-hidden":"true",children:_y(ke)==="review"?a.jsx(GF,{}):ke.kind==="workflow"?a.jsx(zve,{className:pt.tabIconSvg,strokeWidth:1.6}):ke.kind==="file"?a.jsx(U0,{name:ke.workspacePath,className:pt.tabIconSvg,strokeWidth:1.6}):_y(ke)==="artifact"?a.jsx(uwe,{artifact:t.find(Pe=>"artifactId"in ke&&Pe.id===ke.artifactId),className:pt.tabIconSvg}):_y(ke)==="subagent"?a.jsx(l0n,{}):_y(ke)==="monitor"?a.jsx(Yve,{className:pt.tabIconSvg,strokeWidth:1.6}):_y(ke)==="shell"?a.jsx(Y2,{className:pt.tabIconSvg,strokeWidth:1.6}):_y(ke)==="side_task"?a.jsx(Aj,{className:pt.tabIconSvg,strokeWidth:1.6}):ke.kind==="web_preview"?a.jsx(hT,{className:pt.tabIconSvg}):ke.kind==="terminal"?a.jsx(Y2,{className:pt.tabIconSvg,strokeWidth:1.6}):_y(ke)==="image"?a.jsx(UUe,{className:pt.tabIconSvg,strokeWidth:1.6}):ke.kind==="context_usage"?a.jsx(WP,{className:pt.tabIconSvg,strokeWidth:1.6}):ke.kind==="token_usage"?a.jsx(UG,{className:pt.tabIconSvg,strokeWidth:1.6}):ke.kind==="trajectory"?a.jsx(GO,{className:pt.tabIconSvg,strokeWidth:1.6}):a.jsx(u0n,{})}),a.jsx("span",{className:pt.tabTitle,"data-web-shell-session-title":!0,children:a.jsx("span",{className:pt.tabTitleInner,children:ke.title})})]}),a.jsx("button",{type:"button",className:pt.tabCloseButton,onClick:()=>m(ke.id),"aria-label":`Close ${ke.title}`,title:"Close",children:a.jsx(c0n,{})})]},ke.id))}),a.jsxs("div",{className:pt.headerActions,children:[ne&&a.jsxs(Z0,{modal:!1,children:[a.jsx(Vg,{asChild:!0,children:a.jsx("button",{type:"button",className:`${pt.iconButton} ${pt.addButton}`,"aria-label":he("rightPanel.add"),title:he("rightPanel.add"),children:a.jsx(Qf,{className:pt.toolbarIcon})})}),a.jsxs(Gg,{align:"end",className:"w-64",children:[je&&a.jsxs(yi,{disabled:!w||!y,onSelect:y,children:[a.jsx(GF,{}),a.jsx("span",{className:pt.sideTaskListTitle,children:he("turnOutputs.review")})]}),je&&ot&&a.jsx(ax,{}),ot&&a.jsxs(yi,{disabled:L,onSelect:R,children:[a.jsx(Aj,{className:pt.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:pt.sideTaskListTitle,children:he("sideTask.create")})]}),Ie&&(je||ot)&&a.jsx(ax,{}),Ie&&a.jsxs(yi,{onSelect:()=>x?.(),children:[a.jsx(Y2,{className:pt.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:pt.sideTaskListTitle,children:he("terminal.title")})]}),ue&&a.jsxs(yi,{onSelect:S,children:[a.jsx(hT,{className:pt.sideTaskNewIcon}),a.jsx("span",{className:pt.sideTaskListTitle,children:he("webPreview.title")})]}),W&&a.jsxs(yi,{onSelect:()=>k?.(),children:[a.jsx(GO,{className:pt.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:pt.sideTaskListTitle,children:he("trajectory.title")})]})]})]}),Q&&a.jsx("button",{type:"button",className:`${pt.iconButton} ${pt.fullscreenButton} ${G?pt.iconButtonActive:""}`,onClick:Q,"aria-label":he(G?"common.exitFullscreen":"common.fullscreen"),"aria-pressed":G,title:he(G?"common.exitFullscreen":"common.fullscreen"),children:G?a.jsx(qG,{className:pt.toolbarIcon,"aria-hidden":!0}):a.jsx(zG,{className:pt.toolbarIcon,"aria-hidden":!0})}),a.jsx("button",{type:"button",className:`${pt.iconButton} ${pt.panelToggleButton}`,onClick:ge,"aria-label":he("chatHeader.toggleRightPanel"),"aria-pressed":"true",title:he("chatHeader.toggleRightPanel"),children:a.jsx(Hve,{className:pt.panelToggleIcon})})]})]}),a.jsxs("div",{className:`${pt.body} ${Ae?.kind==="side_task"?pt.bodySideTask:""}`.trim(),children:[n.filter(ke=>ke.kind==="web_preview").map(ke=>a.jsx("div",{className:"h-full",hidden:ke.id!==Ae?.id,children:a.jsx(lmn,{state:ke,onChange:Pe=>I?.(ke.id,Pe)})},ke.id)),n.filter(ke=>ke.kind==="terminal").map(ke=>a.jsx("div",{className:`${pt.terminalPane} ${ke.id===Ae?.id?"":pt.terminalPaneHidden}`.trim(),"aria-hidden":ke.id===Ae?.id?void 0:!0,children:a.jsx(amn,{terminalId:ke.id,cwd:ke.workspaceCwd??l,active:ke.id===Ae?.id,enabled:ke.initialized!==!1})},ke.id)),Ze&&a.jsxs("button",{type:"button",className:pt.attachmentPreviewButton,onClick:()=>ae(Tt?void 0:Ae?.id),"aria-label":he(Tt?"attachment.showSource":"attachment.showPreview"),"aria-pressed":Tt,children:[Tt?a.jsx(PHe,{"aria-hidden":!0}):a.jsx(Pve,{"aria-hidden":!0}),he(Tt?"attachment.showSource":"attachment.showPreview")]}),u&&!Ae?a.jsxs("div",{className:"flex flex-col gap-4 p-5","data-testid":"right-panel-loading-skeleton",role:"status","aria-label":he("common.loading"),children:[a.jsx(ow,{className:"h-5 w-2/5"}),a.jsx(ow,{className:"h-32 w-full"}),a.jsx(ow,{className:"h-4 w-4/5"}),a.jsx(ow,{className:"h-4 w-3/5"})]}):Ae?.kind==="terminal"||Ae?.kind==="web_preview"?null:Ae?Ae.kind==="pending"?a.jsx("div",{className:pt.empty,role:Ae.loadError?"alert":"status",children:Ae.loadError??he("common.loading")}):Ae.kind==="workflow"?Ae.sessionId?a.jsx(tdn,{tasks:Y,loading:Z,error:K,onOpenAgent:B}):q?a.jsx(Udn,{...q}):a.jsx("div",{className:pt.empty,children:he("workflow.empty.title")}):bue(Ae)&&(Ae.kind!=="scheduled_task"||Ae.task.durable)&&(Ae.kind!=="file"||!Ae.previewOnly)&&(Ae.kind!=="artifact"||be?.metadata?.artifactType!=="web_preview_snapshot")&&!Ke?a.jsx("div",{className:pt.empty,role:"alert",children:he("workspace.notFoundDescription")}):Ae.kind==="review"?a.jsx(f0n,{changes:Ae.changes??r,selectedPath:Ae.selectedPath??o,workspaceCwd:Ae.workspaceCwd??l,onOpenFilePreview:ke=>g(ke,Ae.workspaceCwd??l,Ae.workspaceId),onDownloadFile:(ke,Pe)=>GP(Ke,ke.path,dVe(ke.path),Pe),onDownloadError:ke=>{const Pe=he("common.downloadFailed",{message:Iu(ke)});V?V(new Error(Pe,{cause:ke}),Pe):console.error(Pe,ke)}}):Ae.kind==="file"?Ae.attachmentId&&!Ae.previewData&&Ae.previewContent===void 0?a.jsx("div",{className:pt.empty,role:Ae.loadError?"alert":"status",children:Ae.loadError??he("common.loading")}):Ae.sourcePreview&&Ae.previewData&&ub(Ae.previewMimeType||Ae.previewData.type)!=="application/pdf"&&!i4(Ae.previewMimeType||Ae.previewData.type,Ae.workspacePath)?a.jsx(SRe,{data:Ae.previewData,title:Ae.title,image:!!FS(Ae.workspacePath)&&Ae.previewData.type.startsWith("image/")}):a.jsx(oD,{workspacePath:Ae.workspacePath,artifactVersion:String(Ae.previewVersion??0),workspaceActions:Ke,previewContent:Ae.previewContent,previewData:Ae.previewData,previewMimeType:Ae.previewMimeType,previewOnly:Ae.previewOnly,previewKind:Ve||Ae.previewOnly&&!Tt?"source":void 0},Ae.id):Ae.kind==="source"?a.jsx(A0n,{tab:Ae},Ae.id):Ae.kind==="artifact"?a.jsx(d0n,{artifacts:t,artifactId:Ae.artifactId,sourceSessionId:Ae.sourceSessionId,workspaceActions:Ke,previewContent:Ae.previewContent,loading:c,error:h},Ae.id):Ae.kind==="subagent"?ie?null:a.jsx(Oun,{sessionId:Ae.sessionId,rootToolCallId:Ae.rootToolCallId,initialRootTool:Ae.rootTool,workspaceCwd:Ae.workspaceCwd??l,onRightPanelOpen:F,onArtifactsChange:H,onOpenSubagent:$,onError:V}):Ae.kind==="monitor"?a.jsx(Owt,{task:Ae.task,actions:Ae.sessionActions},Ae.id):Ae.kind==="shell"?a.jsx($wt,{task:Ae.task,actions:Ae.sessionActions},Ae.id):Ae.kind==="side_task"?a.jsx(sdn,{tabId:Ae.id,sessionId:Ae.sessionId,parentSessionId:Ae.parentSessionId,workspaceCwd:Ae.workspaceCwd??l,title:Ae.title,shouldNameFromFirstPrompt:Ae.nameFromFirstPrompt,initialPrompt:Ae.initialPrompt,createSession:M??o0n,onCreated:O??s0n,onTitleChange:P??r0n,onRightPanelOpen:F,onArtifactsChange:H,onError:V,sessionWorkflowEnabled:J,onImageIngestionNotice:te},Ae.id):Ae.kind==="image"?Ae.src?a.jsxs("div",{className:pt.imagePreviewWrap,children:[a.jsx("img",{src:Ae.src,alt:Ae.alt??Ae.title,className:pt.imagePreview}),a.jsx("a",{className:pt.imageDownloadButton,href:Ae.src,download:i0n(Ae.src),"aria-label":he("common.download"),title:he("common.download"),children:a.jsx(Vy,{size:16,strokeWidth:1.8})})]}):a.jsx("div",{className:pt.empty,role:Ae.loadError?"alert":"status",children:Ae.loadError??he("common.loading")}):Ae.kind==="context_usage"?a.jsx(Qgn,{controls:e?.[Ae.sessionId],sessionActions:Ae.sessionActions,sessionId:Ae.sessionId},Ae.id):Ae.kind==="trajectory"?a.jsx(qgn,{loadPage:Ae.loadPage},Ae.id):Ae.kind==="token_usage"?a.jsx(Ymn,{sessionActions:Ae.sessionActions,sessionId:Ae.sessionId},Ae.id):a.jsx(h0n,{task:Ae.task,actions:Ke},Ae.id):a.jsxs("div",{className:pt.emptyActions,"data-testid":"right-panel-empty-actions",children:[E.includes("review")&&a.jsxs("button",{type:"button",className:pt.emptyAction,disabled:!w||!y,onClick:y,children:[a.jsx("span",{className:pt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(GF,{})}),a.jsx("span",{className:pt.emptyActionTitle,children:he("turnOutputs.review")}),a.jsx("span",{className:pt.emptyActionHint,children:he("turnOutputs.reviewLatest")}),a.jsx(Bl,{className:pt.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]}),E.includes("sideTask")&&A&&R&&(j.length===0?a.jsxs("button",{type:"button",className:pt.emptyAction,disabled:L,"aria-busy":L,onClick:R,children:[a.jsx("span",{className:pt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(Aj,{strokeWidth:1.6})}),a.jsx("span",{className:pt.emptyActionTitle,children:he("sideTask.title")}),a.jsx("span",{className:pt.emptyActionHint,children:he("sideTask.description")}),a.jsx(Bl,{className:pt.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]}):a.jsxs(Z0,{open:ve,onOpenChange:ye,modal:!1,children:[a.jsx(Vg,{asChild:!0,children:a.jsxs("button",{type:"button",className:pt.emptyAction,"aria-expanded":ve,onMouseEnter:Te,onMouseLeave:Ne,children:[a.jsx("span",{className:pt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(Aj,{strokeWidth:1.6})}),a.jsx("span",{className:pt.emptyActionTitle,children:he("sideTask.title")}),a.jsx("span",{className:pt.emptyActionHint,children:he("sideTask.description")}),a.jsx(Bl,{className:pt.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]})}),a.jsxs(Gg,{align:"end",className:"w-80",onMouseEnter:Te,onMouseLeave:Ne,children:[j.map(ke=>a.jsxs(yi,{onSelect:()=>N?.(ke),children:[a.jsx("span",{className:pt.sideTaskListTitle,children:ke.title}),ke.updatedAt&&a.jsx("span",{className:pt.sideTaskListTime,children:EA(ke.updatedAt,he)})]},ke.sessionId)),a.jsx(ax,{}),a.jsxs(yi,{onSelect:R,children:[a.jsx(kHe,{className:pt.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:pt.sideTaskListTitle,children:he("sideTask.new")})]})]})]})),ue&&a.jsxs("button",{type:"button",className:pt.emptyAction,onClick:S,children:[a.jsx("span",{className:pt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(hT,{strokeWidth:1.6})}),a.jsx("span",{className:pt.emptyActionTitle,children:he("webPreview.title")}),a.jsx("span",{className:pt.emptyActionHint,children:he("webPreview.openHint")}),a.jsx(Bl,{className:pt.emptyActionChevron,"aria-hidden":"true"})]}),W&&a.jsxs("button",{type:"button",className:pt.emptyAction,onClick:()=>k?.(),"data-testid":"right-panel-open-trajectory",children:[a.jsx("span",{className:pt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(GO,{strokeWidth:1.6})}),a.jsx("span",{className:pt.emptyActionTitle,children:he("trajectory.title")}),a.jsx("span",{className:pt.emptyActionHint,children:he("trajectory.description")}),a.jsx(Bl,{className:pt.emptyActionChevron,"aria-hidden":"true"})]}),x&&a.jsxs("button",{type:"button",className:pt.emptyAction,onClick:()=>x(),children:[a.jsx("span",{className:pt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(Y2,{strokeWidth:1.6})}),a.jsx("span",{className:pt.emptyActionTitle,children:he("terminal.title")}),a.jsx("span",{className:pt.emptyActionHint,children:he("terminal.open")}),a.jsx(Bl,{className:pt.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]})]})]})]})}function l0n(){return a.jsxs("svg",{className:pt.tabIconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false","aria-hidden":"true",children:[a.jsx("circle",{cx:"12",cy:"8",r:"3",stroke:"currentColor",strokeWidth:"1.6"}),a.jsx("path",{d:"M6.5 19c.7-3.1 2.5-4.7 5.5-4.7s4.8 1.6 5.5 4.7",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"})]})}function c0n(){return a.jsx("svg",{className:pt.tabCloseIcon,viewBox:"0 0 16 16",fill:"none",focusable:"false","aria-hidden":"true",children:a.jsx("path",{d:"m4.5 4.5 7 7M11.5 4.5l-7 7",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function GF(){return a.jsxs("svg",{className:pt.tabIconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false",children:[a.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:"currentColor",strokeWidth:"1.6"}),a.jsx("path",{d:"M9 9.5h6M12 6.5v6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),a.jsx("path",{d:"M9 16h6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}function u0n(){return a.jsxs("svg",{className:pt.tabIconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false",children:[a.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"3",stroke:"currentColor",strokeWidth:"1.8"}),a.jsx("path",{d:"M12 8v4l3 2",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})}function d0n({artifacts:e,artifactId:t,sourceSessionId:n,workspaceActions:s,previewContent:r,loading:o,error:i}){const l=e.find(c=>c.id===t);return l?a.jsx(S0n,{artifact:l,sourceSessionId:n,workspaceActions:s,previewContent:r}):o?a.jsx("div",{className:pt.empty,children:"Loading artifact..."}):i?a.jsx("div",{className:pt.empty,children:i}):a.jsx("div",{className:pt.empty,children:"Artifact not found."})}function h0n({task:e,actions:t}){const{t:n}=Ct(),[s,r]=d.useState(null),[o,i]=d.useState(!0),[l,c]=d.useState(null),[u,h]=d.useState(""),[f,m]=d.useState(e.prompt),[g,w]=d.useState(()=>M1(e.cron)),[y,x]=d.useState(!1),[k,_]=d.useState(!1),[S,I]=d.useState(!1),[E,A]=d.useState(!1),[j,L]=d.useState(null),R=d.useRef(0),N=d.useRef(0),M=d.useRef({actions:t,taskId:e.id,workspaceId:e.workspaceId});M.current={actions:t,taskId:e.id,workspaceId:e.workspaceId};const O=d.useCallback((he,ve,ye,_e)=>{const ae=M.current;return he===R.current&&ae.actions===ve&&ae.taskId===ye&&ae.workspaceId===_e},[]),P=d.useCallback((he,ve,ye,_e)=>{const ae=M.current;return he===N.current&&ae.actions===ve&&ae.taskId===ye&&ae.workspaceId===_e},[]);d.useEffect(()=>()=>{R.current+=1,N.current+=1},[]),d.useEffect(()=>{I(!1),A(!1),L(null)},[t,e.id,e.workspaceId]);const F=d.useCallback(async()=>{const he=++R.current,ve=++N.current,ye=e.id,_e=e.workspaceId;if(!e.durable||!t){r(null),h(""),m(e.prompt),w(M1(e.cron)),c(null),i(!1);return}i(!0),c(null);try{const ae=await t.listScheduledTasks(_e);if(!O(he,t,ye,_e))return;const Se=ae.find(Te=>Te.id===e.id)??null;r(Se),Se?(h(Se.name??""),m(Se.prompt),w(M1(Se.cron))):(h(""),m(e.prompt),w(M1(e.cron)))}catch(ae){P(ve,t,ye,_e)&&c(ae instanceof Error?ae.message:String(ae))}finally{P(ve,t,ye,_e)&&i(!1)}},[t,P,O,e.cron,e.durable,e.id,e.prompt,e.workspaceId]);d.useEffect(()=>{F()},[F]);const H=!e.durable,$=e.durable&&!o&&!l&&!s,Y=!!s,Z=s?.name||s?.prompt||e.title,K=s?.prompt??e.prompt,B=s?.cron??e.cron,V=s?.recurring??e.recurring,J=s?.enabled,q=d.useCallback(()=>{s&&(h(s.name??""),m(s.prompt),w(M1(s.cron)),L(null),x(!0))},[s]),te=d.useCallback(()=>{x(!1),L(null),s&&(h(s.name??""),m(s.prompt),w(M1(s.cron)))},[s]),ie=d.useCallback(async()=>{if(!s||!t)return;const he=i9(g);if(!he){L(n("scheduledTasks.error.invalidSchedule"));return}if(f.trim().length===0){L(n("scheduledTasks.error.emptyPrompt"));return}const ve=++R.current,ye=e.id,_e=e.workspaceId;A(!0),L(null);try{const ae=await t.updateScheduledTask(s.id,{cron:he,prompt:f.trim(),name:u.trim()||null},_e);if(!O(ve,t,ye,_e))return;r(ae),h(ae.name??""),m(ae.prompt),w(M1(ae.cron)),x(!1)}catch(ae){O(ve,t,ye,_e)&&L(ae instanceof Error?ae.message:String(ae))}finally{O(ve,t,ye,_e)&&A(!1)}},[t,g,O,s,u,f,n,e.id,e.workspaceId]),ge=d.useCallback(async()=>{if(!s||!t)return;const he=++R.current,ve=e.id,ye=e.workspaceId;I(!0),L(null);try{const _e=await t.updateScheduledTask(s.id,{enabled:!s.enabled},ye);if(!O(he,t,ve,ye))return;r(_e)}catch(_e){O(he,t,ve,ye)&&L(_e instanceof Error?_e.message:String(_e))}finally{O(he,t,ve,ye)&&I(!1)}},[t,O,s,e.id,e.workspaceId]),re=d.useCallback(async()=>{if(!s||!t)return;const he=++R.current,ve=e.id,ye=e.workspaceId;I(!0),L(null);try{if(await t.deleteScheduledTask(s.id,ye),!O(he,t,ve,ye))return;r(null),_(!1)}catch(_e){O(he,t,ve,ye)&&L(_e instanceof Error?_e.message:String(_e))}finally{O(he,t,ve,ye)&&I(!1)}},[t,O,s,e.id,e.workspaceId]),G=i9(g),Q=G?BT(G,n):null;return a.jsxs("div",{className:pt.detail,children:[o&&a.jsx("div",{className:pt.empty,children:n("scheduledTasks.loading")}),l&&a.jsx("div",{className:rn.loadError,children:l}),$&&a.jsx("div",{className:pt.empty,children:n("scheduledTasks.deletedSnapshot")}),H&&a.jsx("div",{className:pt.empty,children:n("scheduledTasks.sessionScopedSnapshot")}),!$&&a.jsx("div",{className:pt.section,children:a.jsxs("div",{className:pt.fieldGrid,children:[a.jsx("span",{className:pt.fieldLabel,children:n("scheduledTasks.name")}),a.jsx("span",{className:pt.fieldValue,children:Z}),a.jsx("span",{className:pt.fieldLabel,children:n("scheduledTasks.taskId")}),a.jsx("span",{className:pt.fieldValue,children:e.id}),a.jsx("span",{className:pt.fieldLabel,children:n("scheduledTasks.schedule")}),a.jsx("span",{className:pt.fieldValue,children:BT(B,n)}),a.jsx("span",{className:pt.fieldLabel,children:"Cron"}),a.jsx("span",{className:pt.fieldValue,children:B}),a.jsx("span",{className:pt.fieldLabel,children:n("scheduledTasks.type")}),a.jsx("span",{className:pt.fieldValue,children:n(V?"scheduledTasks.repeats":"scheduledTasks.runsOnce")}),J!==void 0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:pt.fieldLabel,children:n("scheduledTasks.status")}),a.jsx("span",{className:pt.fieldValue,children:n(J?"scheduledTasks.enable":"scheduledTasks.disable")})]})]})}),!$&&a.jsxs("div",{className:pt.section,children:[a.jsx("div",{className:pt.sectionTitle,children:"Prompt"}),a.jsx("div",{className:pt.description,children:K})]}),j&&a.jsx("div",{className:rn.formError,children:j}),a.jsxs("div",{className:pt.actionsRow,children:[a.jsx("button",{type:"button",className:rn.primaryButton,disabled:!Y||S,onClick:q,children:n("scheduledTasks.edit")}),a.jsx("button",{type:"button",className:rn.secondaryButton,disabled:!Y||S,onClick:()=>void ge(),children:s?.enabled?n("scheduledTasks.disable"):n("scheduledTasks.enable")}),a.jsx("button",{type:"button",className:rn.secondaryButton,disabled:!Y||S,onClick:()=>_(!0),children:n("scheduledTasks.delete")})]}),k&&s&&a.jsx(Wa,{title:n("scheduledTasks.deleteConfirmTitle"),size:"sm",onClose:()=>_(!1),children:a.jsxs("div",{className:rn.formFields,children:[a.jsx("div",{className:pt.description,children:n("scheduledTasks.deleteConfirm",{name:s.name||s.prompt})}),j&&a.jsx("div",{className:rn.formError,children:j}),a.jsxs("div",{className:rn.formActions,children:[a.jsx("button",{type:"button",className:rn.secondaryButton,onClick:()=>_(!1),disabled:S,children:n("scheduledTasks.cancel")}),a.jsx("button",{type:"button",className:rn.primaryButton,onClick:()=>void re(),disabled:S,children:n("scheduledTasks.delete")})]})]})}),y&&a.jsx(Wa,{title:n("scheduledTasks.editTitle"),size:"md",onClose:te,children:a.jsxs("div",{className:rn.formFields,children:[a.jsxs("label",{className:rn.field,children:[a.jsx("span",{className:rn.fieldLabel,children:n("scheduledTasks.name")}),a.jsx("input",{className:rn.input,type:"text",value:u,maxLength:200,placeholder:n("scheduledTasks.namePlaceholder"),onChange:he=>h(he.target.value)})]}),a.jsxs("label",{className:rn.field,children:[a.jsxs("span",{className:rn.fieldLabel,children:[n("scheduledTasks.prompt"),a.jsx("span",{className:rn.required,children:"*"})]}),a.jsx("textarea",{className:rn.textarea,value:f,rows:4,maxLength:1e5,placeholder:n("scheduledTasks.promptPlaceholder"),onChange:he=>m(he.target.value)})]}),a.jsxs("div",{className:rn.scheduleRow,children:[a.jsxs("label",{className:rn.field,children:[a.jsx("span",{className:rn.fieldLabel,children:n("scheduledTasks.frequency")}),a.jsx("select",{className:rn.select,value:g.frequency,onChange:he=>{const ve=he.target.value;w(ye=>({...ye,frequency:ve,...ve==="hourly"?{time:"00:00"}:{}}))},children:t0n.map(he=>a.jsx("option",{value:he,children:n(`scheduledTasks.freq.${he}`)},he))})]}),(g.frequency==="daily"||g.frequency==="weekdays"||g.frequency==="weekly")&&a.jsxs("label",{className:rn.field,children:[a.jsx("span",{className:rn.fieldLabel,children:n("scheduledTasks.time")}),a.jsx("input",{className:rn.input,type:"time",value:g.time,onChange:he=>w(ve=>({...ve,time:he.target.value}))})]}),g.frequency==="weekly"&&a.jsxs("label",{className:rn.field,children:[a.jsx("span",{className:rn.fieldLabel,children:n("scheduledTasks.weekday")}),a.jsx("select",{className:rn.select,value:g.weekday,onChange:he=>w(ve=>({...ve,weekday:Number(he.target.value)})),children:n("scheduledTasks.weekdayNames").split(",").map((he,ve)=>a.jsx("option",{value:ve,children:he},ve))})]}),g.frequency==="minutes"&&a.jsxs("label",{className:rn.field,children:[a.jsx("span",{className:rn.fieldLabel,children:n("scheduledTasks.interval")}),a.jsx("select",{className:rn.select,value:g.minuteInterval,onChange:he=>w(ve=>({...ve,minuteInterval:Number(he.target.value)})),children:n0n.map(he=>a.jsx("option",{value:he,children:he},he))})]}),g.frequency==="custom"&&a.jsxs("label",{className:`${rn.field} ${rn.fieldGrow}`,children:[a.jsx("span",{className:rn.fieldLabel,children:n("scheduledTasks.cron")}),a.jsx("input",{className:rn.input,type:"text",value:g.customCron,spellCheck:!1,placeholder:"0 9 * * 1-5",onChange:he=>w(ve=>({...ve,customCron:he.target.value}))})]})]}),a.jsx("div",{className:rn.preview,children:Q?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:rn.previewLabel,children:Q}),a.jsx("code",{className:rn.previewCron,children:G})]}):a.jsx("span",{className:rn.previewInvalid,children:n("scheduledTasks.error.invalidSchedule")})}),j&&a.jsx("div",{className:rn.formError,children:j}),a.jsxs("div",{className:rn.formActions,children:[a.jsx("button",{type:"button",className:rn.secondaryButton,onClick:te,disabled:E,children:n("scheduledTasks.cancel")}),a.jsx("button",{type:"button",className:rn.primaryButton,onClick:()=>void ie(),disabled:E,children:n(E?"scheduledTasks.saving":"scheduledTasks.save")})]})]})})]})}function f0n({changes:e,selectedPath:t,workspaceCwd:n,onOpenFilePreview:s,onDownloadFile:r,onDownloadError:o}){const{t:i}=Ct(),[l,c]=d.useState(!1),[u,h]=d.useState(!0),[f,m]=d.useState(!1),[g,w]=d.useState(520),y=d.useRef(g),x=d.useRef(null),k=d.useRef(null),[_,S]=d.useState(null),[I,E]=d.useState(()=>new Set),A=d.useRef(!0);d.useEffect(()=>(A.current=!0,()=>{A.current=!1}),[]);const j=l,L=d.useMemo(()=>_0n(e,n),[e,n]);d.useEffect(()=>{S(t)},[t]),d.useEffect(()=>{y.current=g},[g]),d.useEffect(()=>{const P=x.current;if(!P)return;const F=()=>{m(P.clientWidth<e0n)};F();const H=new ResizeObserver(F);return H.observe(P),()=>H.disconnect()},[u]),d.useEffect(()=>()=>k.current?.(),[]);const R=d.useCallback(P=>{const F=x.current;if(!F)return;P.preventDefault();const H=P.currentTarget;H.setPointerCapture(P.pointerId);const $=P.clientX,Y=y.current,Z=F.getBoundingClientRect().width,K=Math.max(180,Z-180),B=document.body.style.cursor,V=document.body.style.userSelect;let J=Y,q=null;document.body.style.cursor="col-resize",document.body.style.userSelect="none";const te=()=>{q=null,w(J)},ie=G=>{J=Math.min(K,Math.max(180,Y+(G.clientX-$))),q===null&&(q=window.requestAnimationFrame(te))};let ge=()=>{};const re=G=>{k.current=null,q!==null&&(window.cancelAnimationFrame(q),q=null),G&&w(J),H.hasPointerCapture(P.pointerId)&&H.releasePointerCapture(P.pointerId),document.body.style.cursor=B,document.body.style.userSelect=V,window.removeEventListener("pointermove",ie),window.removeEventListener("pointerup",ge),window.removeEventListener("pointercancel",ge)};ge=()=>re(!0),k.current=()=>re(!1),window.addEventListener("pointermove",ie),window.addEventListener("pointerup",ge),window.addEventListener("pointercancel",ge)},[]);if(e.length===0)return a.jsx("div",{className:pt.empty,children:"No file changes to review."});const N=T_e(e),M=P=>{S(F=>F===P?null:P)},O=async P=>{if(!I.has(P.path)){E(F=>new Set(F).add(P.path));try{await r(P,()=>!A.current)}catch(F){A.current&&o(F)}finally{E(F=>{const H=new Set(F);return H.delete(P.path),H})}}};return a.jsxs("div",{className:pt.review,children:[a.jsxs("div",{className:pt.reviewToolbar,children:[a.jsxs("div",{className:pt.reviewToolbarTitle,children:[a.jsx("span",{children:i("turnOutputs.previousTurn")}),a.jsx(Y9,{additions:N?.additions,deletions:N?.deletions,className:pt.lineStats,additionsClassName:pt.additions,deletionsClassName:pt.deletions})]}),a.jsxs("div",{className:pt.reviewToolbarActions,children:[a.jsxs("button",{type:"button",className:pt.reviewTotalsButton,onClick:()=>h(P=>!P),"aria-expanded":u,children:[a.jsx("span",{children:i("turnOutputs.fileCount",{count:e.length})}),a.jsx("span",{className:[pt.chevron,u?pt.chevronOpen:""].filter(Boolean).join(" "),"aria-hidden":"true",children:a.jsx(_ue,{})})]}),a.jsx("button",{type:"button",className:[pt.iconButton,l?pt.iconButtonActive:""].filter(Boolean).join(" "),onClick:()=>c(P=>!P),"aria-label":i(l?"turnOutputs.closeFileTree":"turnOutputs.openFileTree"),title:i(l?"turnOutputs.closeFileTree":"turnOutputs.openFileTree"),children:l?a.jsx(x0n,{}):a.jsx(b0n,{})})]})]}),u&&a.jsxs("div",{ref:x,className:[pt.reviewContent,j?"":pt.reviewContentListOnly,j&&f?pt.reviewContentStacked:""].filter(Boolean).join(" "),style:{"--review-list-width":`${g}px`},children:[a.jsx("div",{className:[pt.reviewList,_?pt.reviewListWithExpanded:""].filter(Boolean).join(" "),children:e.map(P=>{const F=_===P.path,H=E_e(P.path),$=YIt(P.path);return a.jsxs("div",{className:[pt.reviewItem,F?pt.reviewItemExpanded:""].filter(Boolean).join(" "),children:[a.jsxs("div",{className:pt.reviewRow,"data-selected":P.path===t||void 0,children:[a.jsx("button",{type:"button",className:pt.reviewRowToggle,onClick:()=>M(P.path),"aria-label":P.path,"aria-expanded":F}),a.jsx("span",{className:pt.fileIcon,children:_Re(P.path)}),a.jsxs("span",{className:pt.reviewFileName,children:[a.jsx(v0n,{path:AL(P.path,n),title:P.path}),H&&a.jsx("button",{type:"button",className:pt.reviewOpenButton,onClick:()=>s(P),title:`${i("turnOutputs.preview")} ${P.path}`,children:i("turnOutputs.preview")}),$&&a.jsx("button",{type:"button",className:pt.reviewOpenButton,onClick:()=>void O(P),title:`${i("common.download")} ${P.path}`,disabled:I.has(P.path),children:i(I.has(P.path)?"common.downloading":"common.download")})]}),a.jsx(Y9,{additions:P.additions,deletions:P.deletions,className:pt.lineStats,additionsClassName:pt.additions,deletionsClassName:pt.deletions}),a.jsx("span",{className:[pt.chevron,F?pt.chevronOpen:""].filter(Boolean).join(" "),"aria-hidden":"true",children:a.jsx(_ue,{})})]}),F&&a.jsx(p0n,{change:P})]},`${P.toolCallId}:${P.path}`)})}),j&&!f&&a.jsx("div",{className:pt.reviewSplitHandle,role:"separator","aria-orientation":"vertical",onPointerDown:R}),j&&a.jsx("div",{className:pt.tree,children:L.children.map(P=>a.jsx(bRe,{node:P,depth:0,selectedPath:t},P.path))})]})]})}function p0n({change:e}){if(e.diffs.length===0)return a.jsx("div",{className:pt.diffEmpty,children:"No diff available."});const t=m0n(e.diffs);return a.jsx("div",{className:pt.diffPreview,children:t.map((n,s)=>n.fileDiff&&!n.fullContent?a.jsx(gY,{diff:n.fileDiff},s):a.jsx(g0n,{oldText:n.oldText,newText:n.newText},s))})}function m0n(e){for(let t=e.length-1;t>=0;t--)if(e[t]?.fullContent)return e.slice(t);return e}function g0n({oldText:e,newText:t}){const n=d.useRef(null),[s,r]=d.useState(null),[o,i]=d.useState(null);return d.useEffect(()=>{const l=n.current;if(!l)return;const c=()=>r(l.clientWidth>=720);c();const u=new ResizeObserver(c);return u.observe(l),()=>u.disconnect()},[]),d.useEffect(()=>{const l=n.current;if(!l||s===null)return;l.replaceChildren(),i(null);let c=!1,u=null;const h=[vTe,js.editable.of(!1),ua.readOnly.of(!0),js.lineWrapping],f={scanLimit:1e3,timeout:500},m={margin:3,minSize:8};return Je(async()=>{const{MergeView:g,unifiedMergeView:w}=await import("./index-H7LsVN_M.js");return{MergeView:g,unifiedMergeView:w}},[]).then(({MergeView:g,unifiedMergeView:w})=>{if(!c)try{if(s){u=new g({a:{doc:e,extensions:h},b:{doc:t,extensions:h},parent:l,highlightChanges:!0,gutter:!0,revertControls:void 0,collapseUnchanged:m,diffConfig:f});return}u=new js({doc:t,extensions:[...h,w({original:e,highlightChanges:!0,gutter:!0,mergeControls:!1,allowInlineDiffs:!0,collapseUnchanged:m,diffConfig:f})],parent:l})}catch(y){c||i(y instanceof Error?y.message:String(y))}}).catch(g=>{c||i(g instanceof Error?g.message:String(g))}),()=>{c=!0,u?.destroy()}},[s,t,e]),a.jsxs("div",{className:pt.codeMirrorDiffWrap,children:[a.jsx("div",{ref:n,className:pt.codeMirrorDiff}),o&&a.jsxs("div",{className:pt.diffError,children:["Diff unavailable: ",o]})]})}function bRe({node:e,depth:t,selectedPath:n}){const s=!!e.file,[r,o]=d.useState(!0),i=[pt.treeRow,s?pt.treeFile:pt.treeFolder].filter(Boolean).join(" "),l={paddingLeft:10+t*18,"--tree-row-line-left":`${19+Math.max(0,t-1)*18}px`},c={"--tree-children-line-left":`${19+t*18}px`},u=a.jsxs(a.Fragment,{children:[a.jsx("span",{className:pt.treeTwisty,children:!s&&a.jsx("span",{className:[pt.treeChevron,r?"":pt.treeChevronClosed].filter(Boolean).join(" "),children:a.jsx(k0n,{})})}),a.jsxs("span",{className:pt.treeContent,children:[s&&a.jsx("span",{className:pt.fileIcon,children:_Re(e.path)}),a.jsx("span",{className:pt.treeName,children:e.name})]}),e.file?.isArtifact&&a.jsx("span",{className:pt.reviewBadge,children:"artifact"})]});return a.jsxs("div",{className:pt.treeNode,children:[s?a.jsx("div",{className:i,"data-selected":e.file?.path===n||void 0,"data-depth":t,style:l,title:e.path,children:u}):a.jsx("button",{type:"button",className:i,"data-depth":t,style:l,title:e.path,"aria-expanded":r,onClick:()=>o(h=>!h),children:u}),!s&&r&&e.children.length>0&&a.jsx("div",{className:pt.treeChildren,style:c,children:e.children.map(h=>a.jsx(bRe,{node:h,depth:t+1,selectedPath:n},h.path))})]})}function v0n({path:e,title:t}){const n=d.useRef(null),[s,r]=d.useState(()=>xRe(e));return d.useLayoutEffect(()=>{const o=n.current;if(!o)return;const i=()=>r(w0n(e,o));i();const l=new ResizeObserver(i);return l.observe(o),()=>l.disconnect()},[e]),a.jsxs("span",{ref:n,className:pt.reviewPath,title:t??e,children:[s.prefix&&a.jsx("span",{className:pt.pathPrefix,children:s.prefix}),a.jsx("span",{className:pt.pathFileName,children:s.leaf})]})}function xRe(e){const t=e.lastIndexOf("/");return t<0?{prefix:"",leaf:e}:{prefix:e.slice(0,t+1),leaf:e.slice(t+1)}}let kue=null;function w0n(e,t){const n=xRe(e),s=t.clientWidth;if(s<=0)return n;const r=y0n(t);if(r(e)<=s)return n;const o=e.split("/").filter(Boolean),i=o.at(-1)??e,l=r(i);if(o.length<=1||l+r(".../")>s)return{prefix:"",leaf:i};let c=".../";for(let u=1;u<o.length;u++){const f=`.../${o.slice(o.length-1-u,-1).join("/")}/`;if(r(f)+l>s)break;c=f}return{prefix:c,leaf:i}}function y0n(e){kue??=document.createElement("canvas");const t=kue.getContext("2d"),n=window.getComputedStyle(e);return t&&(t.font=[n.fontStyle,n.fontVariant,n.fontWeight,n.fontSize,n.fontFamily].join(" ")),s=>t?.measureText(s).width??s.length*8}function b0n(){return a.jsxs("svg",{className:pt.toolbarIcon,viewBox:"0 0 24 24",fill:"none",focusable:"false","aria-hidden":"true",children:[a.jsx("path",{d:"M3.5 7.5h6l1.6 2h9.4v8.2a2 2 0 0 1-2 2h-13a2 2 0 0 1-2-2V7.5Z",stroke:"currentColor",strokeWidth:"1.7",strokeLinejoin:"round"}),a.jsx("path",{d:"M3.5 7.5V5.8a1.5 1.5 0 0 1 1.5-1.5h4l1.8 2.1h7.2a1.5 1.5 0 0 1 1.5 1.5v1.6",stroke:"currentColor",strokeWidth:"1.7",strokeLinejoin:"round"})]})}function x0n(){return a.jsxs("svg",{className:pt.toolbarIcon,viewBox:"0 0 24 24",fill:"none",focusable:"false","aria-hidden":"true",children:[a.jsx("path",{d:"M3.5 8.2V5.8A1.5 1.5 0 0 1 5 4.3h4l1.8 2.1h7.2a1.5 1.5 0 0 1 1.5 1.5v1.4",stroke:"currentColor",strokeWidth:"1.7",strokeLinejoin:"round"}),a.jsx("path",{d:"M4.8 19.7h12.9a2 2 0 0 0 1.9-1.4l2-7H6.4l-2.8 7.1a.9.9 0 0 0 1.2 1.3Z",stroke:"currentColor",strokeWidth:"1.7",strokeLinejoin:"round"})]})}function _ue(){return a.jsx("svg",{className:pt.chevronIcon,viewBox:"0 0 16 16",fill:"none",focusable:"false","aria-hidden":"true",children:a.jsx("path",{d:"m6 4 4 4-4 4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}function k0n(){return a.jsx("svg",{className:pt.treeChevronIcon,viewBox:"0 0 16 16",fill:"none",focusable:"false","aria-hidden":"true",children:a.jsx("path",{d:"m4 6 4 4 4-4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}function _0n(e,t){const n={name:"",path:"",children:[]};for(const s of e){const r=AL(s.path,t).split("/").filter(Boolean);let o=n;for(let i=0;i<r.length;i++){const l=r[i],c=r.slice(0,i+1).join("/");let u=o.children.find(h=>h.name===l);u||(u={name:l,path:c,children:[]},o.children.push(u)),i===r.length-1&&(u.file=s),o=u}}return kRe(n),n}function kRe(e){e.children.sort((t,n)=>!!t.file!=!!n.file?t.file?1:-1:t.name.localeCompare(n.name));for(const t of e.children)kRe(t)}function y8(e){return db(e).split("/").filter(Boolean).at(-1)??e}function _Re(e){const t=y8(e),n=t.includes(".")?t.split(".").pop()?.toLowerCase():"";return n?{css:"CSS",html:"HTML",js:"JS",json:"JSON",jsx:"JSX",md:"MD",ts:"TS",tsx:"TSX"}[n]??n.slice(0,3).toUpperCase():"FILE"}function S0n({artifact:e,sourceSessionId:t,workspaceActions:n,previewContent:s}){const{t:r}=Ct(),o=Hp(),i=iwe(e),l=N4(e.url)?e.url:void 0,c=e.metadata?.artifactType==="automation_snapshot",u=e.metadata?.artifactType==="code_review",h=e.storage==="workspace"&&!!e.workspacePath,f=owe(e);return e.metadata?.artifactType==="web_preview_snapshot"?a.jsx(cmn,{artifact:e,sourceSessionId:t}):u?e.status!=="available"?a.jsx(C0n,{status:e.status}):!h||!e.workspacePath?a.jsx(T0n,{}):a.jsx(bun,{workspacePath:e.workspacePath,artifactVersion:xte(e),workspaceActions:n}):h&&e.workspacePath?swe(e)?a.jsx(E0n,{artifact:e,workspaceActions:n}):a.jsx(oD,{workspacePath:e.workspacePath,artifactVersion:xte(e),workspaceActions:n,previewContent:s,previewSizeBytes:e.sizeBytes,imageMimeType:f,previewKind:I0n(e)?"html":R0n(e)?"markdown":f?"image":"source"}):a.jsxs("div",{className:pt.detail,children:[a.jsxs("div",{className:pt.section,children:[a.jsx("div",{className:pt.sectionTitle,children:c?"Automation Snapshot":"Artifact"}),a.jsxs("div",{className:pt.fieldGrid,children:[a.jsx(kp,{label:"Type",value:GG(e.kind,e.workspacePath)}),a.jsx(kp,{label:"Storage",value:e.storage}),a.jsx(kp,{label:"Status",value:e.status}),a.jsx(kp,{label:"Source",value:e.source}),a.jsx(kp,{label:"Size",value:VP(e.sizeBytes)}),a.jsx(kp,{label:"Created",value:e.createdAt}),a.jsx(kp,{label:"Updated",value:e.updatedAt}),e.toolName&&a.jsx(kp,{label:"Tool",value:e.toolName}),e.toolCallId&&a.jsx(kp,{label:"Tool call",value:e.toolCallId})]})]}),e.description&&a.jsxs("div",{className:pt.section,children:[a.jsx("div",{className:pt.sectionTitle,children:"Description"}),a.jsx("div",{className:pt.description,children:e.description})]}),c&&e.metadata&&a.jsxs("div",{className:pt.section,children:[a.jsx("div",{className:pt.sectionTitle,children:"Details"}),a.jsxs("div",{className:pt.fieldGrid,children:[C2(e.metadata,"automationId","Automation ID"),C2(e.metadata,"schedule","Schedule"),C2(e.metadata,"timezone","Timezone"),C2(e.metadata,"status","Status"),C2(e.metadata,"nextRunAt","Next run"),C2(e.metadata,"prompt","Prompt")]})]}),(i||l)&&a.jsxs("div",{className:pt.section,children:[a.jsx("div",{className:pt.sectionTitle,children:"Location"}),l?a.jsxs("div",{className:pt.locationRow,children:[a.jsx("a",{className:pt.link,href:l,target:"_blank",rel:"noopener noreferrer",onClick:m=>o(m,l),children:l}),a.jsx("a",{className:pt.openButton,href:l,target:"_blank",rel:"noopener noreferrer",onClick:m=>o(m,l),children:r("artifact.openLink")})]}):a.jsx("div",{className:pt.meta,children:i})]})]})}function C0n({status:e}){const{t}=Ct();return a.jsx("div",{className:pt.previewError,role:"alert",children:t("codeReview.unavailable",{status:e})})}function T0n(){const{t:e}=Ct();return a.jsx("div",{className:pt.previewError,role:"alert",children:e("codeReview.workspaceRequired")})}function I0n(e){const t=e.workspacePath?.toLowerCase()??"",n=ub(e.mimeType);return e.kind==="html"||t.endsWith(".html")||t.endsWith(".htm")||n==="text/html"}function R0n(e){const t=e.workspacePath?.toLowerCase()??"",n=ub(e.mimeType);return t.endsWith(".md")||t.endsWith(".markdown")||n==="text/markdown"}function E0n({artifact:e,workspaceActions:t}){const{t:n}=Ct(),[s,r]=d.useState(null),[o,i]=d.useState(!1),l=d.useRef(!0),c=iwe(e);d.useEffect(()=>(l.current=!0,()=>{l.current=!1}),[]);const u=async()=>{if(e.workspacePath){i(!0),r(null);try{await GP(t,e.workspacePath,e.mimeType,()=>!l.current)}catch(h){if(!l.current)return;r(h instanceof Error?h.message:String(h))}finally{l.current&&i(!1)}}};return a.jsx("div",{className:pt.detail,children:a.jsxs("div",{className:pt.section,children:[a.jsx("div",{className:pt.sectionTitle,children:n("common.download")}),a.jsxs("div",{className:pt.fieldGrid,children:[a.jsx(kp,{label:"Type",value:GG(e.kind,e.workspacePath)}),a.jsx(kp,{label:"Size",value:VP(e.sizeBytes)}),c?a.jsx(kp,{label:"Location",value:c}):null,e.status!=="available"&&e.status!=="changed"?a.jsx(kp,{label:"Status",value:e.status??"missing"}):null]}),a.jsx("div",{className:pt.downloadRow,children:a.jsx("button",{type:"button",className:pt.downloadButton,onClick:()=>{u()},disabled:o||e.status!=="available"&&e.status!=="changed",children:n(o?"common.downloading":"common.download")})}),s&&a.jsx("div",{className:pt.previewError,children:s})]})})}function A0n({tab:e}){const{t}=Ct(),n=el(),s=O4(e.workspaceCwd),r=s?.actions,o=Hp(),[i,l]=d.useState(0),[c,u]=d.useState(),[h,f]=d.useState(),[m,g]=d.useState(),w=e.source,y=w.locator,x=e.owner.isCurrent()&&n.sessionId===e.sourceSessionId&&n.capabilities?.features.includes("session_sources")&&s?.workspaceId===e.workspaceId&&(!!s||e.workspaceCwd===void 0&&y.type!=="workspace_file")&&(y.type!=="workspace_file"||w.workspaceCwd===n.workspaceCwd),k=y.type==="workspace_file"?y.workspacePath:y.type==="attachment"?y.attachmentId:"",_=/\.pdf$/i.test(k);if(d.useEffect(()=>{let I=!1;return u(void 0),f(void 0),g(void 0),!x||y.type==="url"?void 0:((async()=>{if(y.type==="attachment"){const A=await e.sessionActions.readAttachment(y.attachmentId);if(I||!e.owner.isCurrent())return;const j=Uint8Array.from(atob(A.data),L=>L.charCodeAt(0));u(new Blob([j],{type:A.mimeType}))}else if(_&&r){const A=await _4(r.readFileBytes,k,"application/pdf",{statFile:r.stat,isCancelled:()=>I||!e.owner.isCurrent()});!I&&e.owner.isCurrent()&&u(A)}})().catch(A=>{!I&&e.owner.isCurrent()&&f(Iu(A))}),()=>{I=!0})},[i,x,y,k,_,e.owner,e.sessionActions,r]),x&&y.type==="url")return a.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[a.jsx("h3",{children:w.title}),w.description&&a.jsx("p",{children:w.description}),a.jsx("p",{className:"break-all text-sm text-muted-foreground",children:y.url}),N4(y.url)&&a.jsx("a",{className:"text-primary underline",href:y.url,target:"_blank",rel:"noopener noreferrer",onClick:I=>o(I,y.url),children:t("sources.openOriginal")})]});if(!x||!s&&y.type!=="attachment")return a.jsx("div",{className:pt.empty,role:"alert",children:t("sources.unavailable")});const S=y.type==="workspace_file"&&!_&&swe({workspacePath:k});return a.jsxs("div",{className:"flex h-full min-h-0 flex-1 flex-col",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-border px-3 py-2",children:[a.jsx("span",{className:"truncate text-xs text-muted-foreground",title:k,children:k}),a.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[m&&a.jsx(Wt,{variant:"ghost",size:"icon-sm",asChild:!0,children:a.jsx("a",{href:m,download:w.title,"aria-label":`Download ${w.title}`,title:t("common.download"),children:a.jsx(Vy,{})})}),h&&a.jsx(Wt,{variant:"ghost",size:"sm",onClick:()=>l(I=>I+1),children:t("common.retry")})]})]}),h?a.jsx("div",{className:pt.previewError,role:"alert",children:h}):S?a.jsxs("div",{className:"p-4",children:[a.jsx("p",{children:t("attachment.previewUnsupported")}),a.jsx(Wt,{onClick:()=>void GP(r,k,"application/octet-stream",()=>!e.owner.isCurrent()).catch(I=>{e.owner.isCurrent()&&f(Iu(I))}),children:t("common.download")})]}):(y.type==="attachment"||_)&&!c?a.jsx("div",{className:pt.empty,role:"status",children:t("common.loading")}):c&&c.type!=="application/pdf"&&!i4(c.type,k)?a.jsx(SRe,{data:c,title:w.title,onDownloadUrl:g,showDownload:!1,image:!!FS(k)&&c.type.startsWith("image/")}):a.jsx("div",{className:"relative min-h-0 flex-1 overflow-auto",children:a.jsx(oD,{workspacePath:k,workspaceActions:r,onLoadError:f,previewData:c,previewOnly:y.type==="attachment",previewMimeType:c?.type,previewKind:/\.html?$/i.test(k)||ub(c?.type)==="text/html"?"source":void 0},i)})]})}function SRe({data:e,title:t,image:n,onDownloadUrl:s,showDownload:r=!0}){const[o,i]=d.useState();return d.useEffect(()=>{const l=URL.createObjectURL(e);return i(l),s?.(l),()=>URL.revokeObjectURL(l)},[e,s]),o?a.jsxs("div",{className:pt.imagePreviewWrap,children:[n?a.jsx("img",{className:pt.imagePreview,src:o,alt:t}):a.jsx(CRe,{name:t,mimeType:e.type,size:e.size}),r&&a.jsx("a",{href:o,download:t,"aria-label":`Download ${t}`,children:a.jsx(Vy,{})})]}):null}function oD({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewData:o,previewMimeType:i,imageMimeType:l,previewKind:c,previewOnly:u,onLoadError:h}){if(o)return a.jsx(j0n,{workspacePath:e,workspaceActions:n,data:o,mimeType:i,previewKind:c,onLoadError:h});const f=e.toLowerCase(),m=l??FS(e),g=c??(f.endsWith(".html")||f.endsWith(".htm")?"html":f.endsWith(".md")||f.endsWith(".markdown")?"markdown":m?"image":"source");return g==="html"?a.jsx(L0n,{workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:u,onLoadError:h}):g==="markdown"?a.jsx(O0n,{workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:u,onLoadError:h}):g==="image"&&m?a.jsx(P0n,{workspacePath:e,artifactVersion:t,workspaceActions:n,mimeType:m,onLoadError:h}):a.jsx(TRe,{workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:u,onLoadError:h})}function j0n({workspacePath:e,workspaceActions:t,data:n,mimeType:s,previewKind:r,onLoadError:o}){const i=(s||n.type||"application/octet-stream").split(";",1)[0].trim().toLowerCase();return i==="application/pdf"?a.jsx(M0n,{data:n,mimeType:i,title:e}):i4(i,e)?a.jsx(N0n,{workspacePath:e,workspaceActions:t,data:n,previewKind:r,onLoadError:o}):a.jsx(CRe,{name:e,mimeType:i,size:n.size})}function N0n({workspacePath:e,workspaceActions:t,data:n,previewKind:s,onLoadError:r}){const{t:o}=Ct(),[i,l]=d.useState(),[c,u]=d.useState();return d.useEffect(()=>{const h=new FileReader;return l(void 0),u(void 0),h.onload=()=>l(String(h.result??"")),h.onerror=()=>{const f=o("attachment.readFailed");u(f),r?.(f)},h.readAsText(n),()=>{h.readyState===FileReader.LOADING&&h.abort()}},[n,r,o]),c?a.jsx("div",{className:pt.previewError,children:c}):i===void 0?a.jsx("div",{className:pt.empty,children:o("attachment.loadingFile")}):a.jsx(oD,{workspacePath:e,workspaceActions:t,previewContent:i,previewSizeBytes:n.size,previewOnly:!0,previewKind:s})}function M0n({data:e,mimeType:t,title:n}){const{t:s}=Ct(),[r,o]=d.useState();return d.useEffect(()=>{const i=URL.createObjectURL(e.type===t?e:new Blob([e],{type:t}));return o(i),()=>URL.revokeObjectURL(i)},[e,t]),r?a.jsx("iframe",{className:pt.pdfAttachmentPreview,src:r,title:`Preview ${n}`}):a.jsx("div",{className:pt.empty,children:s("attachment.loadingPreview")})}function CRe({name:e,mimeType:t,size:n}){const{t:s}=Ct();return a.jsxs("div",{className:pt.unsupportedAttachmentPreview,children:[a.jsx(U0,{name:e,mimeType:t,"aria-hidden":"true"}),a.jsx("div",{children:s("attachment.previewUnsupported")}),a.jsxs("div",{className:pt.unsupportedAttachmentMeta,children:[t," · ",VP(n)]})]})}function P0n({workspacePath:e,artifactVersion:t,workspaceActions:n,mimeType:s,onLoadError:r}){const[o,i]=d.useState(null),[l,c]=d.useState(null);return d.useEffect(()=>{let u=!1,h;return i(null),c(null),_4((f,m)=>n.readFileBytes(f,m),e,s,{statFile:f=>n.stat(f),isCancelled:()=>u}).then(f=>{u||(h=URL.createObjectURL(f),i(h))}).catch(f=>{if(u)return;const m=f instanceof Error?f.message:String(f);c(m),r?.(m)}),()=>{u=!0,h&&URL.revokeObjectURL(h)}},[t,s,r,n,e]),a.jsxs("div",{className:pt.imagePreviewWrap,children:[o?a.jsxs(a.Fragment,{children:[a.jsx("img",{className:pt.imagePreview,src:o,alt:y8(e)}),a.jsx("a",{className:pt.imageDownloadButton,href:o,download:y8(e),"aria-label":`Download ${y8(e)}`,title:"Download",children:a.jsx(Vy,{size:16,strokeWidth:1.8})})]}):l?null:a.jsx("div",{className:pt.empty,children:"Loading image..."}),l&&a.jsx("div",{className:pt.previewError,children:l})]})}function SZ({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:r,onLoadError:o}){const[i,l]=d.useState(s??null),[c,u]=d.useState(),[h,f]=d.useState(null);return d.useEffect(()=>{let m=!1;if(l(s??null),f(null),u(void 0),!r)return n.stat(e).then(g=>{if(!m){if(g.type==="directory")throw new Error("Directories cannot be opened as artifacts.");return n.readWorkspaceFile(e,{maxBytes:256*1024})}}).then(async g=>{if(m||!g||!g.truncated)return g;const w=await _4((y,x)=>n.readFileBytes(y,x),e,"application/octet-stream",{statFile:y=>n.stat(y),isCancelled:()=>m});return{sizeBytes:w.size,content:new TextDecoder(g.encoding||"utf-8").decode(await w.arrayBuffer())}}).then(g=>{m||!g||(u(g.sizeBytes),l(g.content))}).catch(g=>{if(m)return;const w=g instanceof Error?g.message:String(g);f(w),o?.(w)}),()=>{m=!0}},[t,s,r,o,n,e]),{content:i,error:h,sizeBytes:c}}function L0n({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:o,onLoadError:i}){const{content:l,error:c,sizeBytes:u}=SZ({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:o,onLoadError:i});return a.jsxs("div",{className:pt.htmlPreviewWrap,children:[l===null?!c&&a.jsx("div",{className:pt.empty,children:"Loading preview..."}):a.jsx(IRe,{content:l,sizeBytes:u??r,workspacePath:e,workspaceActions:n,children:()=>a.jsx(D0n,{content:l,workspacePath:e})}),c&&a.jsx("div",{className:pt.previewError,children:c})]})}function D0n({content:e,workspacePath:t}){const n=`Preview ${t}`,{t:s}=Ct(),[r,o]=d.useState(null),[i,l]=d.useState(null);return d.useEffect(()=>{const c=new AbortController;return o(null),l(null),hVe(e,n,c.signal).then(u=>{c.signal.aborted||o(u)},u=>{c.signal.aborted||l(Iu(u))}),()=>c.abort()},[e,n]),i?a.jsx("div",{className:pt.previewError,children:s("artifact.previewFailed",{message:i})}):r===null?a.jsx("div",{className:pt.empty,children:s("attachment.loadingPreview")}):a.jsx("iframe",{className:pt.htmlPreview,referrerPolicy:"no-referrer",sandbox:"allow-scripts",srcDoc:r,title:n})}function TRe({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:r,onLoadError:o}){const i=d.useRef(null),[l,c]=d.useState(null),{content:u,error:h}=SZ({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:r,onLoadError:o});return d.useEffect(()=>{const f=i.current;if(!f||u===null)return;f.replaceChildren(),c(null);let m;try{m=new js({doc:u,extensions:[vTe,js.editable.of(!1),ua.readOnly.of(!0),js.lineWrapping],parent:f})}catch(g){c(g instanceof Error?g.message:String(g));return}return()=>m.destroy()},[u]),a.jsxs("div",{className:pt.filePreviewWrap,children:[u===null?!h&&a.jsx("div",{className:pt.empty,children:"Loading file..."}):a.jsx("div",{ref:i,className:pt.codeMirrorFile}),(h||l)&&a.jsx("div",{className:pt.previewError,children:h||l})]})}function IRe({content:e,sizeBytes:t,workspacePath:n,workspaceActions:s,children:r}){const{t:o}=Ct(),[i,l]=d.useState(null);if(!d.useMemo(()=>(t??new TextEncoder().encode(e).byteLength)>1024*1024,[e,t]))return r();const u=i===e;return a.jsxs("div",{className:"absolute inset-3 flex min-h-0 flex-col gap-2",children:[a.jsxs("div",{className:"flex shrink-0 items-center gap-2 text-sm text-muted-foreground",children:[a.jsx("span",{children:o("artifact.longDocument")}),a.jsx(Wt,{className:"ml-auto shrink-0",variant:"outline",size:"sm",onClick:()=>l(u?null:e),children:o(u?"artifact.showSource":"artifact.renderFullPreview")})]}),a.jsx("div",{className:"relative min-h-0 flex-1 overflow-auto",children:u?r():a.jsx(TRe,{workspacePath:n,workspaceActions:s,previewContent:e,previewOnly:!0})})]})}function O0n({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:o,onLoadError:i}){const{content:l,error:c,sizeBytes:u}=SZ({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:o,onLoadError:i});return a.jsxs("div",{className:pt.htmlPreviewWrap,children:[l===null?!c&&a.jsx("div",{className:pt.empty,children:"Loading preview..."}):a.jsx(IRe,{content:l,sizeBytes:u??r,workspacePath:e,workspaceActions:n,children:()=>a.jsx("div",{className:pt.markdownPreviewWrap,children:a.jsx(Im,{content:l})})}),c&&a.jsx("div",{className:pt.previewError,children:c})]})}function kp({label:e,value:t}){return t?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:pt.fieldLabel,children:e}),a.jsx("span",{className:pt.fieldValue,children:t})]}):null}function C2(e,t,n){const s=e[t];return s==null||s===""?null:a.jsx(kp,{label:n,value:String(s)},t)}/**
2217
2217
  * @license
2218
2218
  * Copyright 2025 Qwen Team
2219
2219
  * SPDX-License-Identifier: Apache-2.0