@organizaone/o1-code 0.11.3 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundled/qc-helper/docs/features/commands.md +1 -0
- package/chunks/{MaxSizedBox-4YD6N3PU.js → MaxSizedBox-JTZPQAQ5.js} +66 -66
- package/chunks/{StandaloneSessionPicker-I5FMAIU2.js → StandaloneSessionPicker-VFQEG54H.js} +88 -88
- package/chunks/{acp-subagent-executor-PRFEPDLD.js → acp-subagent-executor-QEOKYURZ.js} +70 -70
- package/chunks/{acpAgent-2SVJNE5B.js → acpAgent-5MQXC2XU.js} +229 -227
- package/chunks/{agent-QONNC6CU.js → agent-FKFYDUVP.js} +42 -42
- package/chunks/{agent-headless-5HHGBH6Z.js → agent-headless-TVPFCEOP.js} +42 -42
- package/chunks/all-providers-CAKB5HCH.js +73 -0
- package/chunks/{anthropicContentGenerator-2VK5J36U.js → anthropicContentGenerator-K2ELMX7W.js} +121 -73
- package/chunks/{bridge-376JROPC.js → bridge-33WHGPXZ.js} +71 -71
- package/chunks/{bwrap-execution-UZAMPG6F.js → bwrap-execution-FIGUBZCN.js} +6 -6
- package/chunks/{caption-audio-HGDJVVJZ.js → caption-audio-EK6K45W3.js} +8 -8
- package/chunks/{caption-image-ATZSXV7W.js → caption-image-WDXLQK6T.js} +6 -6
- package/chunks/{chunk-KRZBFGAT.js → chunk-32XL2YY2.js} +2345 -4252
- package/chunks/{chunk-MLHBCLEP.js → chunk-3EPSY3X7.js} +9 -9
- package/chunks/{chunk-GCAERMSL.js → chunk-3T72AXG7.js} +6 -6
- package/chunks/{chunk-ZG7HDQQN.js → chunk-3YUQQOUL.js} +13 -13
- package/chunks/{chunk-3DUYZD3L.js → chunk-46JJPOUF.js} +3 -3
- package/chunks/{chunk-7LLX5ROK.js → chunk-4G6OUQPH.js} +3 -3
- package/chunks/{chunk-QCONHGJR.js → chunk-4OUIZHHJ.js} +4 -4
- package/chunks/{chunk-QYUMJTBP.js → chunk-4SJO2I35.js} +1 -1
- package/chunks/{chunk-EB5V6K5E.js → chunk-4X3MIKOZ.js} +5 -5
- package/chunks/{chunk-HCE5HUQG.js → chunk-55BVGW3L.js} +4 -4
- package/chunks/{chunk-OJP3SONV.js → chunk-5AIPNJAB.js} +5 -5
- package/chunks/{chunk-ADBRWAV5.js → chunk-5NNMFA5J.js} +1 -1
- package/chunks/{chunk-UWV7KBPN.js → chunk-5OGI74MG.js} +2 -2
- package/chunks/{chunk-RZGFYBL5.js → chunk-5ZO4TG64.js} +4 -4
- package/chunks/{chunk-R3QYIDIU.js → chunk-62SWENB6.js} +2 -2
- package/chunks/{chunk-3KUQCZUE.js → chunk-65JWVPGE.js} +1 -1
- package/chunks/{chunk-REDO4D2W.js → chunk-65NGV7DR.js} +11 -11
- package/chunks/{chunk-HK7AV2JH.js → chunk-6O3ZQGW7.js} +1 -1
- package/chunks/{chunk-PLGVOOCJ.js → chunk-6WTLQ4BD.js} +1 -1
- package/chunks/{chunk-H2U6QRJX.js → chunk-72EBG4FJ.js} +3 -471
- package/chunks/{chunk-4OI2JVHJ.js → chunk-776VI66O.js} +2 -2
- package/chunks/{chunk-NWG5SKCQ.js → chunk-7JEEDCZF.js} +3 -3
- package/chunks/{chunk-VJFA7HHP.js → chunk-7LQNUREG.js} +1 -1
- package/chunks/chunk-7TK6OY2J.js +53 -0
- package/chunks/{chunk-5MX4BYWK.js → chunk-ADPTJZ7L.js} +3 -3
- package/chunks/{chunk-A4JNI44O.js → chunk-AKIPIOIW.js} +62 -36
- package/chunks/{chunk-IYLIZY56.js → chunk-BF6VCZFG.js} +4 -4
- package/chunks/{chunk-ZBV6TO3P.js → chunk-C7LS4YW3.js} +1 -1
- package/chunks/{chunk-W4SBUUTI.js → chunk-D56JIPBA.js} +3 -3
- package/chunks/{chunk-OKDNVNDE.js → chunk-DBPKYUKM.js} +5 -5
- package/chunks/{chunk-LBM7FFM5.js → chunk-DNJPSAMC.js} +1 -1
- package/chunks/{chunk-W6TGDESU.js → chunk-DOG2T422.js} +2 -2
- package/chunks/{chunk-J4QU4MC5.js → chunk-DOWMMDKU.js} +9 -9
- package/chunks/{chunk-VKBMJSAR.js → chunk-EMXZMR7F.js} +321 -109
- package/chunks/{chunk-653CF7X7.js → chunk-EO3GEEN5.js} +3 -3
- package/chunks/{chunk-RS2LNQEC.js → chunk-EVC2HZ5T.js} +3 -39
- package/chunks/{chunk-MIWMCUU5.js → chunk-EVIJNKSX.js} +17 -8
- package/chunks/{chunk-YR3UI5PL.js → chunk-EWBEXGRC.js} +10 -10
- package/chunks/{chunk-ALRR6EQ5.js → chunk-EXTCLF42.js} +2 -2
- package/chunks/{chunk-QE2GKG2B.js → chunk-F36DMAAF.js} +5 -5
- package/chunks/{chunk-C4WTDBKV.js → chunk-FEQM3UVX.js} +8 -8
- package/chunks/{chunk-V75J4GJ2.js → chunk-FJAZPBX2.js} +1 -1
- package/chunks/{chunk-QKTYOXBW.js → chunk-FJB4BIQY.js} +1 -1
- package/chunks/{chunk-QHENJTME.js → chunk-FL43SLBB.js} +36 -36
- package/chunks/{chunk-VPGICF4V.js → chunk-FOGGBV5D.js} +3 -3
- package/chunks/{chunk-JQPMOOCH.js → chunk-FXR7OHQM.js} +1 -1
- package/chunks/{chunk-DVRWYOU6.js → chunk-GQ2KSD3A.js} +1 -1
- package/chunks/{chunk-BLFBP3N2.js → chunk-GSMPZG6N.js} +1 -1
- package/chunks/{chunk-LK74HWZ4.js → chunk-H4FGPXI3.js} +63 -63
- package/chunks/{chunk-WDCHA7NA.js → chunk-H4K55KOQ.js} +5 -5
- package/chunks/{chunk-JHZM32LS.js → chunk-IKYYF5PP.js} +388 -620
- package/chunks/{chunk-SIZ4LTNU.js → chunk-J2WSYRAJ.js} +28 -28
- package/chunks/{chunk-LEBY6RZT.js → chunk-J33WTLCX.js} +5 -5
- package/chunks/{chunk-7M4NSLWM.js → chunk-JOBZWTVK.js} +1 -1
- package/chunks/{chunk-W4COM34L.js → chunk-K3RGDBVU.js} +3 -3
- package/chunks/{chunk-PQZRAMZG.js → chunk-KCBAWQGT.js} +19 -19
- package/chunks/{chunk-SAGRWAPN.js → chunk-KD2QZWRE.js} +12 -10
- package/chunks/{chunk-ZUQTYSNU.js → chunk-KEBHJIGX.js} +4 -4
- package/chunks/{chunk-AAXKDAOY.js → chunk-KYFNPY5G.js} +1 -1
- package/chunks/{chunk-HVOUAFTO.js → chunk-M2HUTNAI.js} +7 -7
- package/chunks/{chunk-QIRU74SA.js → chunk-MKBG6C2K.js} +1 -1
- package/chunks/{chunk-YPWPIBDR.js → chunk-MMVLDNOK.js} +5 -5
- package/chunks/{chunk-AQFTTYP6.js → chunk-MRR2UVN6.js} +4 -4
- package/chunks/{chunk-4O37MUA4.js → chunk-NIOE4OJE.js} +1 -1
- package/chunks/{chunk-AJSSTPJK.js → chunk-NLDWAN5E.js} +1 -1
- package/chunks/{chunk-OJSW65PQ.js → chunk-NOL6NAWN.js} +1 -1
- package/chunks/{chunk-EXG47R4V.js → chunk-NPGATJZA.js} +2 -2
- package/chunks/{chunk-XHYWPHWN.js → chunk-NQTVSCZM.js} +1 -1
- package/chunks/chunk-NTDRNHKB.js +484 -0
- package/chunks/{chunk-L7JLMUG3.js → chunk-NTHY5RR5.js} +2 -2
- package/chunks/{chunk-EIJNDD2V.js → chunk-O43YWGHK.js} +1 -1
- package/chunks/{chunk-6IAGZKHT.js → chunk-OF7SHQ7M.js} +3 -3
- package/chunks/{chunk-GXHNABHV.js → chunk-OP553VGL.js} +8 -8
- package/chunks/{chunk-L6MGGTHA.js → chunk-OS6CVNKI.js} +1 -1
- package/chunks/{chunk-7LFCBMVX.js → chunk-P4F73WS7.js} +1 -1
- package/chunks/{chunk-DG6LRVVN.js → chunk-PD4HVHCC.js} +1 -1
- package/chunks/{chunk-JZ4ZEW3K.js → chunk-Q5CQXESD.js} +1 -1
- package/chunks/{chunk-TK7HNIQM.js → chunk-QFMADEHM.js} +1 -1
- package/chunks/{chunk-U7C4TQUX.js → chunk-QFUVHWOM.js} +1 -1
- package/chunks/{chunk-WS7DJM5N.js → chunk-QJQOFPJ5.js} +18 -18
- package/chunks/{chunk-EFN3RELD.js → chunk-QNHUPN6K.js} +3 -3
- package/chunks/{chunk-O5F6BGMF.js → chunk-RE37G7GK.js} +7 -7
- package/chunks/{chunk-OKR7R26W.js → chunk-RRYTDYCK.js} +4 -4
- package/chunks/{chunk-BIP774WW.js → chunk-RS2CMJTM.js} +1 -1
- package/chunks/{chunk-3YG4OBGV.js → chunk-S5H5TQN4.js} +1 -1
- package/chunks/{chunk-W7NTX5RO.js → chunk-S5QFGJXY.js} +7 -7
- package/chunks/{chunk-ER3EHNTV.js → chunk-SPTU3FVH.js} +4 -4
- package/chunks/chunk-TC2TJAOF.js +1365 -0
- package/chunks/{chunk-HUMRTP2R.js → chunk-TFFOK3SJ.js} +1 -1
- package/chunks/{chunk-OD2XVV6S.js → chunk-TJRZBOWB.js} +6 -6
- package/chunks/chunk-TL23ZRID.js +327 -0
- package/chunks/{chunk-QMCDBQRJ.js → chunk-TP3M5WJ2.js} +1 -1
- package/chunks/chunk-TPHHBX2V.js +372 -0
- package/chunks/{chunk-FVO4TXS5.js → chunk-TXTBBSFN.js} +6 -6
- package/chunks/{chunk-WQ6CX6N3.js → chunk-U5W3UVUJ.js} +15 -15
- package/chunks/{chunk-FYQO4Y3N.js → chunk-UEBG3R2E.js} +19 -19
- package/chunks/{chunk-N7NBYHMJ.js → chunk-UNY7AZRV.js} +1 -1
- package/chunks/{chunk-UDWKKKF3.js → chunk-VBCZ36HL.js} +16 -12
- package/chunks/{chunk-DMVMQMWZ.js → chunk-VCQ6UT2V.js} +86 -86
- package/chunks/{chunk-5V3EOW36.js → chunk-VGJTZHV4.js} +28 -28
- package/chunks/{chunk-XOVXSDNN.js → chunk-VPFTCMMK.js} +1 -1
- package/chunks/{chunk-7H7YR3TX.js → chunk-VSGHHI2A.js} +1 -1
- package/chunks/{chunk-FQO3QDB5.js → chunk-VT3TJFQR.js} +1 -1
- package/chunks/{chunk-6LLJK4YT.js → chunk-VWSBLBKL.js} +2 -2
- package/chunks/{chunk-4FUKWWA7.js → chunk-W52IXLWZ.js} +2 -2
- package/chunks/{chunk-7I52LFBI.js → chunk-W7TFIXSV.js} +8 -6
- package/chunks/chunk-WBPIFM2X.js +2008 -0
- package/chunks/{chunk-AIQC2WHG.js → chunk-WDHSE635.js} +4 -4
- package/chunks/{chunk-M2EBVYXC.js → chunk-WK44MSGW.js} +1 -1
- package/chunks/{chunk-IKXBBMRT.js → chunk-WSEWAUUB.js} +1 -1
- package/chunks/{chunk-FJHDFJVI.js → chunk-WSHOWMUB.js} +1 -1
- package/chunks/{chunk-VBJH6XAM.js → chunk-WVGCMQD5.js} +1 -1
- package/chunks/{chunk-OAGT2TNR.js → chunk-XD6GHBUY.js} +9 -9
- package/chunks/{chunk-6D6Z2RPR.js → chunk-XDTO4IJ3.js} +2 -2
- package/chunks/{chunk-4AJNXOC5.js → chunk-XRY5FMOE.js} +2 -2
- package/chunks/{chunk-Z5UCVPGO.js → chunk-YII34AZ7.js} +13 -13
- package/chunks/{chunk-BSLKB37V.js → chunk-ZGPPP7FC.js} +30 -30
- package/chunks/{chunk-ZQBNP2ZQ.js → chunk-ZRO2FPEP.js} +4 -4
- package/chunks/{chunk-4RA6DVZM.js → chunk-ZUP2FFM5.js} +4 -4
- package/chunks/{codex-subagent-executor-BDV2OYSK.js → codex-subagent-executor-6GZ7UBTB.js} +70 -70
- package/chunks/{contextCommand-4XBRYOBZ.js → contextCommand-RK4SGQXM.js} +69 -69
- package/chunks/{core-runtime-IYMVEYKI.js → core-runtime-Z3MAZ6W4.js} +78 -78
- package/chunks/{create-sub-session-EAHSPBXY.js → create-sub-session-KWT7I6XG.js} +72 -72
- package/chunks/{daemon-git-worktree-guard-JPOH2ZV5.js → daemon-git-worktree-guard-RVYAPX2W.js} +68 -68
- package/chunks/{daemon-status-provider-GOJGNJ2Y.js → daemon-status-provider-7Q4AQLU7.js} +76 -76
- package/chunks/{daemon-trust-policy-X5QLCVP2.js → daemon-trust-policy-K6KAYOII.js} +74 -74
- package/chunks/{daemon-trust-policy-monitor-GOMIMXAS.js → daemon-trust-policy-monitor-L2HR4KDO.js} +74 -74
- package/chunks/{deferred-core-runtime-MFMRVOPT.js → deferred-core-runtime-B3GYIW7X.js} +66 -66
- package/chunks/{display-image-U6HZKF3G.js → display-image-ETU7QIAC.js} +2 -2
- package/chunks/{edit-N5WDGSAZ.js → edit-DHFV3SJW.js} +44 -44
- package/chunks/{en-C4TIYTOH.js → en-PCBCZAUA.js} +29 -2
- package/chunks/{enter-worktree-A2WD27HQ.js → enter-worktree-OZOIH6KH.js} +4 -4
- package/chunks/{enterPlanMode-52GAH43E.js → enterPlanMode-FHBSHN7T.js} +42 -42
- package/chunks/{environment-RXHNLDLZ.js → environment-SJ2O6HRJ.js} +69 -69
- package/chunks/{errors-D65OPVWO.js → errors-SLII5WDL.js} +69 -69
- package/chunks/{execution-sandbox-config-YE2XOT56.js → execution-sandbox-config-EYZYM2IC.js} +7 -7
- package/chunks/{execution-tool-RK3OB5IY.js → execution-tool-VRA7QCXP.js} +45 -45
- package/chunks/{execution-worker-R7E5B7CA.js → execution-worker-LT2EFVHR.js} +50 -50
- package/chunks/{exit-worktree-S7KUQ4HO.js → exit-worktree-W5TC4B4C.js} +4 -4
- package/chunks/{exitPlanMode-SRLMLRK5.js → exitPlanMode-XQ75FETK.js} +42 -42
- package/chunks/{fast-path-KOMJMO2I.js → fast-path-NQQ53WED.js} +2 -2
- package/chunks/{glob-MD6DOICU.js → glob-7SQOB5CX.js} +42 -42
- package/chunks/{goal-tools-FLJYRSX6.js → goal-tools-4GR2BFFX.js} +42 -42
- package/chunks/{handleAutoUpdate-LX4OGPKI.js → handleAutoUpdate-OLVCIBDN.js} +70 -70
- package/chunks/{i18n-CSJNAMVB.js → i18n-NXRBYDXM.js} +68 -68
- package/chunks/{image-gen-GRJ73O3N.js → image-gen-Q4E7L7EV.js} +3 -6
- package/chunks/{initializer-UN73MGL2.js → initializer-NGPV43CI.js} +74 -74
- package/chunks/{installationInfo-DOO2EVLV.js → installationInfo-U5NUDGQV.js} +66 -66
- package/chunks/{keychain-token-storage-NDVFNJI5.js → keychain-token-storage-SJOKJDWV.js} +2 -1
- package/chunks/{list-UMP3UXDE.js → list-WUD2DUO4.js} +77 -77
- package/chunks/{llm-4AHGUE2C.js → llm-3GFPNXO6.js} +142 -142
- package/chunks/{llm-content-generator-I62R6Q4I.js → llm-content-generator-5CTS3JEL.js} +8 -6
- package/chunks/{loadedSettingsAdapter-KHAGVCPO.js → loadedSettingsAdapter-45PMLPYE.js} +74 -74
- package/chunks/{local-execution-environment-DOKSKTNZ.js → local-execution-environment-XJ5Y5J5E.js} +50 -50
- package/chunks/{loggingContentGenerator-53CAIYCN.js → loggingContentGenerator-BJHOK6Q7.js} +69 -69
- package/chunks/{managed-npm-update-KTATRLFZ.js → managed-npm-update-TCLLJP27.js} +66 -66
- package/chunks/{mcp-7GPEHQCC.js → mcp-LJGCW5XK.js} +74 -74
- package/chunks/{memory-side-query-EHR7FGIB.js → memory-side-query-BSVTSKCB.js} +7 -7
- package/chunks/{model-call-collection-J33XHZPS.js → model-call-collection-GCSBAMPN.js} +7 -7
- package/chunks/{model-configuration-BK2FWMLQ.js → model-configuration-N6EASNX6.js} +75 -75
- package/chunks/{modelConfigUtils-RHOU5ENH.js → modelConfigUtils-4O46TEAJ.js} +68 -68
- package/chunks/{monitor-WXQOHZKP.js → monitor-OOKJVU73.js} +42 -42
- package/chunks/{nonInteractiveCli-332KOMYW.js → nonInteractiveCli-6H3CIYOC.js} +113 -113
- package/chunks/{nonInteractiveToolExecutor-ULCR2RA7.js → nonInteractiveToolExecutor-MWOHBQ3G.js} +43 -43
- package/chunks/{notebook-edit-HOKY5D6F.js → notebook-edit-CG5ZTY7N.js} +43 -43
- package/chunks/{ocr-image-ZJCSAMSQ.js → ocr-image-O6ECQNUE.js} +6 -6
- package/chunks/{omni-O37J5JI3.js → omni-MWVCLGTK.js} +40 -42
- package/chunks/{openaiContentGenerator-62C5JSNE.js → openaiContentGenerator-XDEGXNI6.js} +62 -59
- package/chunks/{openaiResponsesContentGenerator-JSS3U575.js → openaiResponsesContentGenerator-KVV57AK6.js} +40 -24
- package/chunks/{processUtils-Y66KDZSB.js → processUtils-7C3HIK43.js} +2 -2
- package/chunks/{prompt-terminal-ledger-MXYMD7UN.js → prompt-terminal-ledger-R4EB443Y.js} +67 -67
- package/chunks/{pt-TCLIZMUA.js → pt-3QNK7RYA.js} +29 -2
- package/chunks/{reactive-degrade-X2JSVX5V.js → reactive-degrade-6JECKK6A.js} +25 -23
- package/chunks/{read-file-UDFSKNBI.js → read-file-2V6MBYCS.js} +12 -11
- package/chunks/{recall-media-memory-tool-GAR6JWON.js → recall-media-memory-tool-WIFEB2OG.js} +5 -5
- package/chunks/{record-artifact-PL2T5AJY.js → record-artifact-IVE6QT4D.js} +3 -3
- package/chunks/{record-source-ANENC5K7.js → record-source-U53PRXYX.js} +5 -5
- package/chunks/{report-findings-RFO53756.js → report-findings-W75NCFXY.js} +4 -4
- package/chunks/{request-shutdown-LRWCJOEG.js → request-shutdown-E5QAHOAD.js} +4 -4
- package/chunks/{resumeHistoryUtils-ABWHIQME.js → resumeHistoryUtils-OA7LAAZ7.js} +72 -72
- package/chunks/{ripGrep-RMGB52RM.js → ripGrep-KR5EE3HU.js} +14 -13
- package/chunks/{run-o1-code-serve-KVOUMETW.js → run-o1-code-serve-RJHXITCF.js} +59 -59
- package/chunks/{runtime-shell-policy-Y3TGAQLT.js → runtime-shell-policy-Z53GWNM7.js} +1 -1
- package/chunks/{sandboxConfig-6UNSTBMJ.js → sandboxConfig-Q5GADSBO.js} +66 -66
- package/chunks/{scheduled-tasks-SHFPXK6P.js → scheduled-tasks-6FXAE77O.js} +75 -75
- package/chunks/{scheduler-N5K2SUQE.js → scheduler-W5XJHCSY.js} +68 -68
- package/chunks/{sdk-exporters-grpc-J2ILXEUS.js → sdk-exporters-grpc-FZO3Y43M.js} +2 -2
- package/chunks/{sdk-exporters-http-HGBOA62S.js → sdk-exporters-http-WYXH2KE4.js} +14 -14
- package/chunks/{sdk-impl-G2NWB5MF.js → sdk-impl-5PWLMFPQ.js} +20 -20
- package/chunks/{send-message-QOWWQKZJ.js → send-message-OSS7K7GE.js} +4 -4
- package/chunks/{serve-RQIMY7MC.js → serve-PRXYYEOA.js} +74 -74
- package/chunks/{server-AA4LTEQ2.js → server-UBJ5BVPH.js} +260 -260
- package/chunks/{session-4627GZ4S.js → session-62TX2TX2.js} +122 -122
- package/chunks/session-WTJAKLQE.js +34 -0
- package/chunks/{session-attachments-root-Y4BXBBHX.js → session-attachments-root-FW2TX3FF.js} +66 -66
- package/chunks/{session-pr-refresh-XXIT42IO.js → session-pr-refresh-R2Y6QHL7.js} +75 -75
- package/chunks/{settings-CHJS242C.js → settings-HJODN63R.js} +74 -74
- package/chunks/{shell-PDZIKVVS.js → shell-P3L2UMOI.js} +42 -42
- package/chunks/{skill-QOPISSJO.js → skill-3PV7IPAH.js} +14 -13
- package/chunks/{skill-settings-SSXT3JNN.js → skill-settings-TSXFLSXL.js} +74 -74
- package/chunks/{spawnChannel-MPL2AUYX.js → spawnChannel-VV2PWHJ2.js} +69 -69
- package/chunks/{standalone-update-ACWQFW36.js → standalone-update-4BRRDDO4.js} +69 -69
- package/chunks/{startInteractiveUI-PKMNIOMH.js → startInteractiveUI-KUDCHKGV.js} +446 -354
- package/chunks/{task-create-2BHPJUF3.js → task-create-WLFSUWNH.js} +5 -5
- package/chunks/{task-update-NGKKBFU5.js → task-update-STSLD6C5.js} +5 -5
- package/chunks/{team-create-PDT7MW4F.js → team-create-DXTHTZKI.js} +42 -42
- package/chunks/{team-plan-approval-4CFTZI2I.js → team-plan-approval-22HFWRXC.js} +42 -42
- package/chunks/{terminal-image-renderer-C65IVJHI.js → terminal-image-renderer-YBRDENRT.js} +66 -66
- package/chunks/{theme-manager-5FF3ROXZ.js → theme-manager-3GMAH5RD.js} +66 -66
- package/chunks/{tool-call-GVZHLCX6.js → tool-call-2R6GT3ZZ.js} +5 -5
- package/chunks/{tool-result-media-YFEIOZDR.js → tool-result-media-TPGTYKAD.js} +21 -23
- package/chunks/{tool-search-WNOVTFBP.js → tool-search-JYV3OQ6L.js} +19 -18
- package/chunks/{total-session-admission-Q6NUZVLI.js → total-session-admission-A27OSZFH.js} +71 -71
- package/chunks/{transcribe-audio-J3OVKT5D.js → transcribe-audio-R6YC24KU.js} +3 -3
- package/chunks/{trustedFolders-SFZUU4GO.js → trustedFolders-OVHIYR7G.js} +68 -68
- package/chunks/{understand-video-segments-OMAJP6Q7.js → understand-video-segments-2WK4T6PO.js} +8 -8
- package/chunks/{update-relaunch-ICPN37DV.js → update-relaunch-NJNXJ7YF.js} +5 -5
- package/chunks/{updateCheck-PRCH4Y2X.js → updateCheck-XCRLLMAH.js} +69 -69
- package/chunks/{upload-config-JG34DU4J.js → upload-config-QSD3T2AU.js} +10 -8
- package/chunks/{useAutoAcceptIndicator-FZVG3NNO.js → useAutoAcceptIndicator-PJMRWE6O.js} +77 -77
- package/chunks/{validateNonInterActiveAuth-XRY2O6CQ.js → validateNonInterActiveAuth-SD677WKS.js} +110 -110
- package/chunks/{version-IU45BCJE.js → version-FD6BAJ7Z.js} +1 -1
- package/chunks/{web-fetch-WO3GHRIO.js → web-fetch-4RUI7Y7U.js} +14 -16
- package/chunks/{web-search-4GJLGZQM.js → web-search-ROO2Y3AU.js} +12 -13
- package/chunks/web-shell-static-OOIIII74.js +1 -1
- package/chunks/{workflow-UG4V5VWR.js → workflow-OTLXZKSM.js} +45 -45
- package/chunks/{workspace-providers-status-IM5IUQXM.js → workspace-providers-status-E7XZW55K.js} +80 -80
- package/chunks/{workspace-registration-store-O36O7FTL.js → workspace-registration-store-NTRX2N6W.js} +1 -1
- package/chunks/{workspace-registry-TOE2NYGH.js → workspace-registry-OKP2RI5C.js} +71 -71
- package/chunks/{workspace-runtime-coordinator-LS7MYSDY.js → workspace-runtime-coordinator-774UWQBB.js} +72 -72
- package/chunks/{workspace-service-FL63YNEM.js → workspace-service-C3BQFCAC.js} +80 -80
- package/chunks/{workspace-skills-status-IXHCVUXS.js → workspace-skills-status-GJFMBOCP.js} +77 -77
- package/chunks/{workspace-trust-reconciler-WTJ52TKZ.js → workspace-trust-reconciler-3V6TVY5S.js} +80 -80
- package/chunks/{write-file-VTHULBGP.js → write-file-CE74OWAB.js} +45 -45
- package/chunks/{zh-KRQU675V.js → zh-GBDJHFG4.js} +1 -0
- package/chunks/{zh-TW-K657U7LC.js → zh-TW-WWN26WO4.js} +1 -0
- package/chunks/{zoom-image-TJNJJATC.js → zoom-image-EK6GNK4H.js} +12 -11
- package/cli.js +14 -14
- package/execution-worker.js +1 -1
- package/export-transcript-document.js +1 -1
- package/locales/en.js +46 -2
- package/locales/pt.js +46 -2
- package/locales/zh-TW.js +2 -0
- package/locales/zh.js +2 -0
- package/package.json +2 -2
- package/release-notes.json +13 -0
- package/web-shell/assets/{abnfDiagram-VCTEODGH-anMh0rnI.js → abnfDiagram-VCTEODGH-B1-jzC8p.js} +1 -1
- package/web-shell/assets/{arc-sPYpPSws.js → arc-CSOZi0KQ.js} +1 -1
- package/web-shell/assets/{architectureDiagram-5GKGNRK7-BKh0KCFR.js → architectureDiagram-5GKGNRK7-CPkIznhq.js} +1 -1
- package/web-shell/assets/{blockDiagram-NRAW4CY4-CUfywffW.js → blockDiagram-NRAW4CY4-B4CmWPlm.js} +1 -1
- package/web-shell/assets/{c4Diagram-UCG6FXSJ-CM2pLl5w.js → c4Diagram-UCG6FXSJ-CfbSKaAp.js} +1 -1
- package/web-shell/assets/channel-DtvUnSzo.js +1 -0
- package/web-shell/assets/{chunk-2Q5K7J3B-n9OTAsCE.js → chunk-2Q5K7J3B-DeXG-4SQ.js} +1 -1
- package/web-shell/assets/{chunk-5VM5RSS4-CC3dLmo9.js → chunk-5VM5RSS4-C8diV_rJ.js} +1 -1
- package/web-shell/assets/{chunk-F27PBJKO-pIte4woe.js → chunk-F27PBJKO-Dfz0hM4f.js} +1 -1
- package/web-shell/assets/{chunk-G27WJ6UU-Bd4q9Va0.js → chunk-G27WJ6UU-BE_M2PYM.js} +1 -1
- package/web-shell/assets/{chunk-JWPE2WC7-C1ornOGN.js → chunk-JWPE2WC7-CLsWUvS5.js} +1 -1
- package/web-shell/assets/{chunk-LCL6LL3I-w09p9W09.js → chunk-LCL6LL3I-DeyqYZUf.js} +1 -1
- package/web-shell/assets/{chunk-POPQ4Y6H-CHY7aAx4.js → chunk-POPQ4Y6H-C-6z-5n3.js} +1 -1
- package/web-shell/assets/{chunk-SVP7TREG-DKqS6ObW.js → chunk-SVP7TREG-DdwfG0ad.js} +1 -1
- package/web-shell/assets/{chunk-XXDRQBXY-DWqNHE5T.js → chunk-XXDRQBXY-X9aD75Ws.js} +1 -1
- package/web-shell/assets/classDiagram-DTDB5LWJ-B4Ulnn_s.js +1 -0
- package/web-shell/assets/classDiagram-v2-JRS7N3AN-B4Ulnn_s.js +1 -0
- package/web-shell/assets/{cose-bilkent-JH36ORCC-CTuORHW-.js → cose-bilkent-JH36ORCC-DNp5iXJM.js} +1 -1
- package/web-shell/assets/{cynefin-OW5HDTMX-D38bIRGV.js → cynefin-OW5HDTMX-DhhzkPLD.js} +1 -1
- package/web-shell/assets/{cynefinDiagram-5FMLGOSQ-zojG5SHE.js → cynefinDiagram-5FMLGOSQ-5eATS_mD.js} +1 -1
- package/web-shell/assets/{dagre-3AP2YEHR-B_mgdgxG.js → dagre-3AP2YEHR-DXUm0J5e.js} +1 -1
- package/web-shell/assets/{diagram-S7CK7UJ4-Boe4tqaP.js → diagram-S7CK7UJ4-DNrRshkn.js} +1 -1
- package/web-shell/assets/{diagram-UQ7AKVKN-DEFdgAk5.js → diagram-UQ7AKVKN-DS2yugJl.js} +1 -1
- package/web-shell/assets/{diagram-VSXAHHWV-lg-aIy2H.js → diagram-VSXAHHWV-Ds2io9aQ.js} +1 -1
- package/web-shell/assets/{diagram-VX7I27RA-B8GfIB8O.js → diagram-VX7I27RA-CGa-K6oj.js} +1 -1
- package/web-shell/assets/{diagram-Z3DM3KII-B9d7kR6t.js → diagram-Z3DM3KII-BW68o26L.js} +1 -1
- package/web-shell/assets/{ebnfDiagram-PWID7BFC-BbKPC4Lq.js → ebnfDiagram-PWID7BFC-BC4P1K1r.js} +1 -1
- package/web-shell/assets/{erDiagram-SSCWMZ5O-CRAgoOe5.js → erDiagram-SSCWMZ5O-CLs5DpAu.js} +1 -1
- package/web-shell/assets/{flowDiagram-A5DVABFB-Ur3ln_JM.js → flowDiagram-A5DVABFB-D76URsL1.js} +1 -1
- package/web-shell/assets/{ganttDiagram-EL5Y4UJY-C9BN2b5E.js → ganttDiagram-EL5Y4UJY-xVE4LPqO.js} +1 -1
- package/web-shell/assets/{gitGraphDiagram-WWUBYQGX-CRfkh-0v.js → gitGraphDiagram-WWUBYQGX-CIRl0tk3.js} +1 -1
- package/web-shell/assets/{index-DiA0wMqK.js → index-Bv4OUm3o.js} +1 -1
- package/web-shell/assets/{index-CeQlCdwD.js → index-KZq_3onf.js} +3 -3
- package/web-shell/assets/{infoDiagram-RXCK75RN-DK1-ESA4.js → infoDiagram-RXCK75RN-CBnubrlE.js} +1 -1
- package/web-shell/assets/{ishikawaDiagram-5VMMS53U-kxpIDlCX.js → ishikawaDiagram-5VMMS53U-qK-V6061.js} +1 -1
- package/web-shell/assets/{journeyDiagram-EYS64GPL-DQ9EbXpv.js → journeyDiagram-EYS64GPL-UUJYez4X.js} +1 -1
- package/web-shell/assets/{kanban-definition-3QL26DDD-UYveUTce.js → kanban-definition-3QL26DDD-BCcGvRtp.js} +1 -1
- package/web-shell/assets/{layout-BPonaHzT.js → layout-CSFWOY9q.js} +1 -1
- package/web-shell/assets/{linear-C-eJXPTS.js → linear-WUzB_hII.js} +1 -1
- package/web-shell/assets/{mermaid.core-BX1Kz_A0.js → mermaid.core-eLc_GDkM.js} +6 -6
- package/web-shell/assets/{mindmap-definition-FBJOCRG2-B6QyHOu0.js → mindmap-definition-FBJOCRG2-BfzdSe6H.js} +1 -1
- package/web-shell/assets/{pegDiagram-XKGWAZYB-Caflqhs8.js → pegDiagram-XKGWAZYB-B1kr5DxT.js} +1 -1
- package/web-shell/assets/{pieDiagram-E7YTZNPT-6zzkWzNt.js → pieDiagram-E7YTZNPT-CPFq2ZOW.js} +1 -1
- package/web-shell/assets/{quadrantDiagram-AXDQQJYC-BVL3cBz2.js → quadrantDiagram-AXDQQJYC-DuZmXZaP.js} +1 -1
- package/web-shell/assets/{railroadDiagram-O6MQD6OU-DqBEO3-Z.js → railroadDiagram-O6MQD6OU-DCjBx5S1.js} +1 -1
- package/web-shell/assets/{requirementDiagram-EFPCY7ZU-CBFGB-6Q.js → requirementDiagram-EFPCY7ZU-DISKvzR7.js} +1 -1
- package/web-shell/assets/{sankeyDiagram-P5KCCOFB-DOpW98KL.js → sankeyDiagram-P5KCCOFB-BugqzyC1.js} +1 -1
- package/web-shell/assets/{sequenceDiagram-WJ2MYXX4-CVtDqArI.js → sequenceDiagram-WJ2MYXX4-DLQyc2mn.js} +1 -1
- package/web-shell/assets/{sizeCapture-X5ZJPWSS-DQjMKuHP.js → sizeCapture-X5ZJPWSS-CDbelLiH.js} +1 -1
- package/web-shell/assets/{stateDiagram-HBIQ2CUA-D4n_VP2j.js → stateDiagram-HBIQ2CUA-Bw4uH6Y6.js} +1 -1
- package/web-shell/assets/stateDiagram-v2-4QOOHH4V-UrUNUyaU.js +1 -0
- package/web-shell/assets/{swimlanes-XN3QIQJK-Dvr4Gk5J.js → swimlanes-XN3QIQJK-BT-heLFQ.js} +1 -1
- package/web-shell/assets/swimlanesDiagram-VK2B7HYN-E8v9mXaE.js +8 -0
- package/web-shell/assets/{timeline-definition-24CTP7MA-DXsPhzEF.js → timeline-definition-24CTP7MA-ORqZ_woY.js} +1 -1
- package/web-shell/assets/{vennDiagram-4TSXK5OY-aA8X42UU.js → vennDiagram-4TSXK5OY-AgffOwo5.js} +1 -1
- package/web-shell/assets/{wardleyDiagram-VM6X3IG4-CuOx8tlj.js → wardleyDiagram-VM6X3IG4-CcqvB4mV.js} +1 -1
- package/web-shell/assets/{xychartDiagram-S5SC5T6Z-DIc2TzVm.js → xychartDiagram-S5SC5T6Z-BQBX00-a.js} +1 -1
- package/web-shell/index.html +1 -1
- package/web-shell/sw.js +1 -1
- package/chunks/chunk-7USF7X6U.js +0 -584
- package/chunks/chunk-ALIO4STD.js +0 -340
- package/chunks/chunk-KTOCX7IM.js +0 -27
- package/chunks/chunk-MWFHMYVA.js +0 -93
- package/chunks/chunk-PFRCGQAE.js +0 -48
- package/chunks/chunk-VIAJ74X3.js +0 -410
- package/web-shell/assets/channel-DRltBDks.js +0 -1
- package/web-shell/assets/classDiagram-DTDB5LWJ-Bs6uTgrQ.js +0 -1
- package/web-shell/assets/classDiagram-v2-JRS7N3AN-Bs6uTgrQ.js +0 -1
- package/web-shell/assets/stateDiagram-v2-4QOOHH4V-Cy-H3uc5.js +0 -1
- package/web-shell/assets/swimlanesDiagram-VK2B7HYN-BmzgGPpR.js +0 -8
- package/chunks/{chunk-BWRP5ZMP.js → chunk-DQZYZDIL.js} +3 -3
- package/chunks/{chunk-KV5QCRFB.js → chunk-IC57EPC7.js} +3 -3
- package/chunks/{chunk-YJLJUKJ7.js → chunk-IZSIFV6S.js} +3 -3
- package/chunks/{chunk-H5L5E5NI.js → chunk-ROO6F2BT.js} +3 -3
- package/chunks/{chunk-MDU4BZLN.js → chunk-YSZCVSC3.js} +0 -0
- package/chunks/{clip-audio-G2SG55MB.js → clip-audio-BJ42NS5B.js} +4 -4
- package/chunks/{clip-image-I3IFRW4Z.js → clip-image-FDBAIKGB.js} +3 -3
- package/chunks/{clip-video-XISLKGWO.js → clip-video-6KVC2IFL.js} +4 -4
- package/chunks/{convert-image-TXAOAPLS.js → convert-image-AYXBZ3TH.js} +3 -3
- package/chunks/{downsample-audio-SBMOSASE.js → downsample-audio-HSPMS25U.js} +4 -4
- package/chunks/{downsample-image-S5ZKCZEM.js → downsample-image-BFBX343I.js} +3 -3
- package/chunks/{downscale-video-LFLD2MYN.js → downscale-video-GQ5ZMJRX.js} +4 -4
- package/chunks/{extract-audio-TY277NLN.js → extract-audio-3LB2Q736.js} +4 -4
- package/chunks/{extract-keyframes-CXPABWEU.js → extract-keyframes-6ZP65BJF.js} +4 -4
|
@@ -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.11.3/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.12.0/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-BX1Kz_A0.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-eLc_GDkM.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-DiA0wMqK.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-Bv4OUm3o.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
|