@organizaone/o1-code 0.2.2 → 0.3.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/commit/SKILL.md +1 -1
- package/bundled/debugging/SKILL.md +58 -0
- package/bundled/debugging/references/root-cause-tracing.md +37 -0
- package/bundled/design/SKILL.md +65 -0
- package/bundled/execute-plan/SKILL.md +51 -0
- package/bundled/extension-creator/SKILL.md +1 -1
- package/bundled/finish/SKILL.md +1 -1
- package/bundled/goal-draft/SKILL.md +1 -1
- package/bundled/new-app/SKILL.md +2 -0
- package/bundled/review/SKILL.md +1 -1
- package/bundled/tdd/SKILL.md +56 -0
- package/bundled/tdd/references/good-tests.md +37 -0
- package/bundled/write-plan/SKILL.md +66 -0
- package/chunks/{MaxSizedBox-5SCM5KM2.js → MaxSizedBox-GF25YEIN.js} +21 -21
- package/chunks/{StandaloneSessionPicker-AJJBYDA3.js → StandaloneSessionPicker-YBS47NTB.js} +34 -34
- package/chunks/{acp-subagent-executor-K3G5OOSP.js → acp-subagent-executor-OCP4NXXX.js} +24 -24
- package/chunks/{acpAgent-DKLAK5PM.js → acpAgent-WMX43ZDF.js} +61 -61
- package/chunks/{agent-6OWW6WY2.js → agent-NMLVWIU3.js} +11 -11
- package/chunks/{agent-headless-YPSZDZPG.js → agent-headless-5AKJIKG2.js} +11 -11
- package/chunks/{anthropicContentGenerator-3IK5TV3K.js → anthropicContentGenerator-5OH4LNCZ.js} +4 -4
- package/chunks/{askUserQuestion-3IDRGYW3.js → askUserQuestion-LD66OM5J.js} +1 -1
- package/chunks/{bridge-ZX33T7DG.js → bridge-DTVVZPYE.js} +24 -24
- package/chunks/{chunk-YEOU65NW.js → chunk-2S34HMND.js} +1 -1
- package/chunks/{chunk-HWG2ZXRT.js → chunk-2X5ECQ5K.js} +5 -5
- package/chunks/{chunk-VGR4BKLQ.js → chunk-3CO4GKLV.js} +1 -1
- package/chunks/{chunk-Q5D3WECC.js → chunk-3YCUO772.js} +1 -1
- package/chunks/{chunk-46QWU5NF.js → chunk-4JQ6AGCG.js} +1 -1
- package/chunks/{chunk-RQOEQ73K.js → chunk-4NV74I76.js} +1 -1
- package/chunks/{chunk-D3VJGSXW.js → chunk-5BGVEQ5T.js} +6 -6
- package/chunks/{chunk-XMBUOPZG.js → chunk-5ITAMZY3.js} +7 -7
- package/chunks/{chunk-OMKGBEIH.js → chunk-5ST67IZT.js} +3 -3
- package/chunks/{chunk-ATR7W3VI.js → chunk-623SEN5Q.js} +1 -1
- package/chunks/{chunk-L65YOA4P.js → chunk-7J3ZEJUN.js} +2 -2
- package/chunks/{chunk-J4WTP4LX.js → chunk-7OHUVM2P.js} +3 -3
- package/chunks/{chunk-TQO7BXBQ.js → chunk-AE25P7KP.js} +5 -5
- package/chunks/{chunk-K7L7Z5JJ.js → chunk-AG2ELNEP.js} +9 -9
- package/chunks/{chunk-QHQFX3P5.js → chunk-B6W2OL2D.js} +30 -30
- package/chunks/{chunk-HWTDN2JB.js → chunk-BDKFE7EF.js} +1 -1
- package/chunks/{chunk-5VYJVTAM.js → chunk-BDKGHKN5.js} +1 -1
- package/chunks/{chunk-4OKN67QV.js → chunk-C6LFEUFU.js} +1 -1
- package/chunks/{chunk-VIYT2NE4.js → chunk-C6U74Q6C.js} +3 -3
- package/chunks/{chunk-WRQYAWUW.js → chunk-CCNABFR3.js} +3 -3
- package/chunks/{chunk-T6BNDNKW.js → chunk-COABCWBY.js} +5 -3
- package/chunks/{chunk-7RYHVZAS.js → chunk-CTIEFYP7.js} +2 -2
- package/chunks/{chunk-2KFLZ6RD.js → chunk-D4RCT4J4.js} +2 -2
- package/chunks/{chunk-54A4EPMP.js → chunk-DB5UA5RL.js} +5 -5
- package/chunks/{chunk-TLHPWOSA.js → chunk-DBD424KY.js} +2 -2
- package/chunks/{chunk-Z4H2RDAF.js → chunk-EGZKXA6V.js} +1 -1
- package/chunks/{chunk-2HHPWUTH.js → chunk-ELIXZXZC.js} +4 -4
- package/chunks/{chunk-53EO7S4Y.js → chunk-ERJWPEY7.js} +3 -3
- package/chunks/{chunk-IBPA7P2S.js → chunk-ERV4L76G.js} +12 -12
- package/chunks/{chunk-YS57I3OQ.js → chunk-FJKGFWXG.js} +3 -3
- package/chunks/{chunk-7JU2ULBO.js → chunk-FWXUI7DZ.js} +6 -6
- package/chunks/{chunk-X2HM423P.js → chunk-G4NGNKM6.js} +3 -3
- package/chunks/{chunk-V5YZXZMM.js → chunk-GFZWLC66.js} +10 -3
- package/chunks/{chunk-XKPECZJM.js → chunk-GZNQS5UB.js} +1 -1
- package/chunks/{chunk-WYUR66BU.js → chunk-HEXJ5CP4.js} +7 -7
- package/chunks/{chunk-PS7DDP2Q.js → chunk-HKGC5GVY.js} +1 -1
- package/chunks/{chunk-QIZ34JTV.js → chunk-I3G7XU6U.js} +4 -4
- package/chunks/{chunk-NVKVO57S.js → chunk-IFBW6FYH.js} +1 -1
- package/chunks/{chunk-XAA77MEC.js → chunk-IVAO4HY7.js} +3 -3
- package/chunks/{chunk-7GTL3WHO.js → chunk-J7G3OJOX.js} +9 -9
- package/chunks/{chunk-GY77YVM3.js → chunk-JBMSEZDI.js} +4 -4
- package/chunks/{chunk-4QRR663K.js → chunk-JDUBQ632.js} +1 -1
- package/chunks/{chunk-35HKXSBC.js → chunk-JE64TPWB.js} +4 -4
- package/chunks/{chunk-H76MQGWH.js → chunk-JEX5DADO.js} +1 -1
- package/chunks/{chunk-S64M5W2S.js → chunk-JHODAWQZ.js} +10 -10
- package/chunks/{chunk-677NF5JH.js → chunk-JR2IXLNE.js} +4 -4
- package/chunks/{chunk-62HSC5KO.js → chunk-JYM2UKSC.js} +2 -2
- package/chunks/{chunk-S7CMT75P.js → chunk-KIQ7D4YK.js} +25 -14
- package/chunks/{chunk-6VAMW6I2.js → chunk-KTH2NXBH.js} +1 -1
- package/chunks/{chunk-UIBQ77SC.js → chunk-L425LZSD.js} +3 -3
- package/chunks/{chunk-6IF6KATN.js → chunk-LQY5SDPR.js} +2 -2
- package/chunks/{chunk-J6YVMK2F.js → chunk-LVFKSBH3.js} +5 -5
- package/chunks/{chunk-4WPPTUCX.js → chunk-MPSJQSNY.js} +2 -2
- package/chunks/{chunk-5D3SQUVZ.js → chunk-MTJQKPTJ.js} +1 -1
- package/chunks/{chunk-3BYFQ2H6.js → chunk-MVE72SO7.js} +1 -1
- package/chunks/{chunk-T3SMR7ET.js → chunk-NHKFCD4F.js} +1 -1
- package/chunks/{chunk-POMHQTHO.js → chunk-NNVR5V2I.js} +5 -5
- package/chunks/{chunk-JHFU5Z3V.js → chunk-NYKKDVZN.js} +1 -1
- package/chunks/{chunk-7F23OSW4.js → chunk-OPNBX4BU.js} +1 -1
- package/chunks/{chunk-NIYI5272.js → chunk-QPGBAI7B.js} +1 -1
- package/chunks/{chunk-IBKJ7UBC.js → chunk-QQQRGEHT.js} +3 -3
- package/chunks/{chunk-KU4ER5BM.js → chunk-QS7N2YMJ.js} +1 -1
- package/chunks/{chunk-EUHJ4MJD.js → chunk-QSF42LP4.js} +3 -3
- package/chunks/{chunk-FJAC7QWS.js → chunk-QUMGEZV4.js} +1 -1
- package/chunks/{chunk-O3KQN6OE.js → chunk-RHYRXRHW.js} +1 -1
- package/chunks/{chunk-3WHURT5H.js → chunk-RYKMFNWC.js} +1 -1
- package/chunks/{chunk-O7LSTDIS.js → chunk-SGW7DY4F.js} +1 -1
- package/chunks/{chunk-M4M3XQJU.js → chunk-SJ7DMBBS.js} +3 -3
- package/chunks/{chunk-PC4V3VPG.js → chunk-SS2JMVDW.js} +1 -1
- package/chunks/{chunk-KUSGHH6D.js → chunk-SXPTY2NJ.js} +1 -1
- package/chunks/{chunk-TTV7MBGI.js → chunk-TLWUCRTO.js} +3 -3
- package/chunks/{chunk-X62LTOGE.js → chunk-TNQJ66S4.js} +52 -52
- package/chunks/{chunk-XJXDZPSD.js → chunk-UKS76REW.js} +3 -3
- package/chunks/{chunk-V2R5TAQQ.js → chunk-UUNTJ2TR.js} +1 -1
- package/chunks/{chunk-JASYFKBU.js → chunk-UXN7KJEI.js} +3 -3
- package/chunks/{chunk-QMW7RSXD.js → chunk-V6XI7HKD.js} +1 -1
- package/chunks/{chunk-5PY64ILO.js → chunk-VKFY6KJC.js} +3 -3
- package/chunks/{chunk-UVUHDO2Y.js → chunk-VNMKY2V3.js} +1 -1
- package/chunks/{chunk-FW5URUJS.js → chunk-W3HT3Y67.js} +3 -3
- package/chunks/{chunk-EPCKGEAE.js → chunk-WGXPBRMN.js} +1 -1
- package/chunks/{chunk-N2WMG5XF.js → chunk-WZKJPAWS.js} +2 -2
- package/chunks/{chunk-PJLUCMQZ.js → chunk-XF7WMIX5.js} +4 -4
- package/chunks/{chunk-DGBGYBO4.js → chunk-XPYWEOXT.js} +19 -5
- package/chunks/{chunk-WSWWZ7IT.js → chunk-Y6NXDVBG.js} +2 -2
- package/chunks/{chunk-RZCK3LM2.js → chunk-YV5ECLPM.js} +30 -30
- package/chunks/{chunk-5WYIBYDU.js → chunk-Z7APSZZK.js} +4 -4
- package/chunks/{chunk-L7A4D4IY.js → chunk-ZNNZZ4BW.js} +1 -1
- package/chunks/{codex-subagent-executor-URK6CSXE.js → codex-subagent-executor-QGB72XUZ.js} +24 -24
- package/chunks/{contextCommand-NFZZE3E4.js → contextCommand-OIZKYRYR.js} +22 -22
- package/chunks/{core-runtime-QX52LNEY.js → core-runtime-ZFOKJ32O.js} +21 -21
- package/chunks/{create-sub-session-2JFP4FMQ.js → create-sub-session-Y6QAGHZ6.js} +22 -22
- package/chunks/{daemon-git-worktree-guard-7JVFR6J3.js → daemon-git-worktree-guard-M73ZL5UO.js} +21 -21
- package/chunks/{daemon-status-provider-GGAO5SSF.js → daemon-status-provider-6YNQ74OV.js} +29 -29
- package/chunks/{daemon-trust-policy-D6AWUEZK.js → daemon-trust-policy-URDFVFCF.js} +26 -26
- package/chunks/{daemon-trust-policy-monitor-77JEJNAK.js → daemon-trust-policy-monitor-FKHP5BIE.js} +26 -26
- package/chunks/{deferred-core-runtime-XBSMNSGZ.js → deferred-core-runtime-3Q5WFRWL.js} +21 -21
- package/chunks/{edit-4AFGA6RJ.js → edit-BA7F4PT6.js} +13 -13
- package/chunks/{enterPlanMode-GWCLJSPB.js → enterPlanMode-EFBL4BF7.js} +16 -15
- package/chunks/{environment-GB72GJFP.js → environment-WPNDLJO7.js} +23 -23
- package/chunks/{errors-UB6Y6QB7.js → errors-7ETRPMNN.js} +23 -23
- package/chunks/{execution-tool-SM65QD3E.js → execution-tool-CAWRJH4J.js} +13 -13
- package/chunks/{execution-worker-277RP2BS.js → execution-worker-HLC7A4TJ.js} +16 -16
- package/chunks/{exitPlanMode-YL44MDSN.js → exitPlanMode-S23F45GN.js} +11 -11
- package/chunks/{fast-path-BHS3UUDU.js → fast-path-3I3VLXLK.js} +2 -2
- package/chunks/{glob-RMPRZBBM.js → glob-QTRRGB3D.js} +11 -11
- package/chunks/{goal-tools-IARELLX6.js → goal-tools-NUONFKIG.js} +11 -11
- package/chunks/{handleAutoUpdate-B6H2CUWG.js → handleAutoUpdate-QVESGET2.js} +23 -23
- package/chunks/{i18n-PEUDBKCF.js → i18n-ZSSY3WKU.js} +21 -21
- package/chunks/{initializer-5CTPR23V.js → initializer-T5M3ALQB.js} +26 -26
- package/chunks/{installationInfo-RKF4FYYG.js → installationInfo-P5YK242M.js} +21 -21
- package/chunks/{list-JFHTQZXB.js → list-MJY6Y5CU.js} +28 -28
- package/chunks/{llm-ZBVAGEV2.js → llm-W5ENEUT6.js} +52 -52
- package/chunks/{llm-content-generator-5ELI577U.js → llm-content-generator-TXCK3B4L.js} +3 -3
- package/chunks/{loadedSettingsAdapter-A63DFE7G.js → loadedSettingsAdapter-JLZC4ZBX.js} +26 -26
- package/chunks/{local-execution-environment-JYU5ETM4.js → local-execution-environment-YZMNKOAL.js} +16 -16
- package/chunks/{loggingContentGenerator-SCVT5IMD.js → loggingContentGenerator-N47XAAOQ.js} +12 -12
- package/chunks/{managed-npm-update-CW3A5IYM.js → managed-npm-update-4ROJTOPU.js} +21 -21
- package/chunks/{mcp-XCJSXNQS.js → mcp-RKXPYCS7.js} +26 -26
- package/chunks/{model-call-collection-QHVB4RVP.js → model-call-collection-OJVM2GWV.js} +1 -1
- package/chunks/{model-configuration-FMD3UX64.js → model-configuration-GYGU23MY.js} +27 -27
- package/chunks/{modelConfigUtils-BLJJCU4P.js → modelConfigUtils-6MZXMJI7.js} +23 -23
- package/chunks/{monitor-ZCZL365W.js → monitor-PY4ONOQZ.js} +11 -11
- package/chunks/{nonInteractiveCli-ND5K3Z6K.js → nonInteractiveCli-BEOCLPL7.js} +51 -51
- package/chunks/{nonInteractiveToolExecutor-JDDFIDEA.js → nonInteractiveToolExecutor-TWHMKTHV.js} +12 -12
- package/chunks/{notebook-edit-AW454CFZ.js → notebook-edit-735U37BJ.js} +12 -12
- package/chunks/{omni-5ALTY2B4.js → omni-TSSGKDWK.js} +8 -8
- package/chunks/{openaiContentGenerator-SKPNHTOM.js → openaiContentGenerator-66O4ID6K.js} +6 -6
- package/chunks/{openaiResponsesContentGenerator-G2PVJMGK.js → openaiResponsesContentGenerator-AI4VCUZW.js} +3 -3
- package/chunks/{processUtils-HED6IV7T.js → processUtils-KX55UCVT.js} +2 -2
- package/chunks/{prompt-terminal-ledger-IAHXPZ2K.js → prompt-terminal-ledger-TMEWRMRM.js} +22 -22
- package/chunks/{reactive-degrade-UDGAMHBZ.js → reactive-degrade-W6RK63HX.js} +7 -7
- package/chunks/{read-file-VM6TL6KB.js → read-file-EY55LILP.js} +2 -2
- package/chunks/{resumeHistoryUtils-PRCLL7VH.js → resumeHistoryUtils-64X6P4RL.js} +22 -22
- package/chunks/{ripGrep-RIKFZ5VR.js → ripGrep-EJBNAHG7.js} +3 -3
- package/chunks/{run-o1-code-serve-D4MM64ZN.js → run-o1-code-serve-XZD4J7UT.js} +32 -32
- package/chunks/{sandboxConfig-RMU6PWYZ.js → sandboxConfig-Q5T2KDWX.js} +21 -21
- package/chunks/{scheduled-tasks-4GGMZT2G.js → scheduled-tasks-VFTJISRZ.js} +27 -27
- package/chunks/{scheduler-VROKOD3O.js → scheduler-LFPINJ3O.js} +23 -23
- package/chunks/{serve-GK3X7AVS.js → serve-KFLQFW4S.js} +26 -26
- package/chunks/{server-YQ4IHB2Z.js → server-5VX5EJJN.js} +54 -54
- package/chunks/{session-2IHZ5JXU.js → session-FN3DK22S.js} +52 -52
- package/chunks/{session-attachments-root-AR5PGJNN.js → session-attachments-root-2KL64FGA.js} +21 -21
- package/chunks/{session-pr-refresh-PIZTNB2B.js → session-pr-refresh-RHCGWRST.js} +26 -26
- package/chunks/{settings-ODFKFJAO.js → settings-JNRHGVXK.js} +25 -25
- package/chunks/{shell-C3DRI7IE.js → shell-QXU6U3ZQ.js} +11 -11
- package/chunks/{skill-2EZBO4KR.js → skill-RRZHSAYL.js} +3 -3
- package/chunks/{skill-settings-VUTNOTIK.js → skill-settings-WUQLVFBS.js} +26 -26
- package/chunks/{spawnChannel-IQQIBRY4.js → spawnChannel-IIN6QVRF.js} +23 -23
- package/chunks/{standalone-update-DK57ZQVB.js → standalone-update-ET5NFOX4.js} +22 -22
- package/chunks/{startInteractiveUI-JXO3ANAJ.js → startInteractiveUI-LNRR43PI.js} +59 -59
- package/chunks/{team-create-SPQB4ZIQ.js → team-create-QJCKLQOF.js} +11 -11
- package/chunks/{team-plan-approval-DSGKM6D4.js → team-plan-approval-KQ2O743Z.js} +11 -11
- package/chunks/{terminal-image-renderer-F46UJJR7.js → terminal-image-renderer-AWXQOO4X.js} +21 -21
- package/chunks/{theme-manager-XHLUGDMV.js → theme-manager-VA6NQNIL.js} +21 -21
- package/chunks/{tool-result-media-UVGNZWQ7.js → tool-result-media-6ZV6V5VB.js} +8 -8
- package/chunks/{tool-search-TTHUGA3R.js → tool-search-HPPYWJBF.js} +2 -2
- package/chunks/{total-session-admission-IAZTBDST.js → total-session-admission-JVRBXXYV.js} +24 -24
- package/chunks/{trustedFolders-FIKJDDCU.js → trustedFolders-56YDYOI5.js} +22 -22
- package/chunks/{update-relaunch-QM4HHYSH.js → update-relaunch-GFLNZDAX.js} +5 -5
- package/chunks/{updateCheck-SHHRTDIC.js → updateCheck-GD2DXYWP.js} +21 -21
- package/chunks/{upload-config-EB7CHHBR.js → upload-config-E5MQ5NML.js} +5 -5
- package/chunks/{useAutoAcceptIndicator-IXO3W3HW.js → useAutoAcceptIndicator-KQ3H2K62.js} +28 -28
- package/chunks/{validateNonInterActiveAuth-76YN2FKV.js → validateNonInterActiveAuth-Y4MBCH4W.js} +49 -49
- package/chunks/{version-SGBHVOAU.js → version-IJ3TUIPZ.js} +1 -1
- package/chunks/{web-fetch-RKLVSDYG.js → web-fetch-F2CLSSW6.js} +2 -2
- package/chunks/{web-search-7OFCLM4E.js → web-search-2HX22GBH.js} +6 -6
- package/chunks/{workflow-FLGREXLS.js → workflow-O5UFRP3U.js} +12 -12
- package/chunks/{workspace-providers-status-Z5XTDXZO.js → workspace-providers-status-74YJNLJJ.js} +32 -32
- package/chunks/{workspace-registration-store-I257THQX.js → workspace-registration-store-TZFSDL3K.js} +1 -1
- package/chunks/{workspace-registry-DTSUSPQJ.js → workspace-registry-NAMQHWBJ.js} +24 -24
- package/chunks/{workspace-runtime-coordinator-7OPXPAWA.js → workspace-runtime-coordinator-WI35ERMI.js} +25 -25
- package/chunks/{workspace-service-DNZFALOP.js → workspace-service-GDF53GJS.js} +29 -29
- package/chunks/{workspace-skills-status-VH3GD2S3.js → workspace-skills-status-PNR3ICAP.js} +29 -29
- package/chunks/{workspace-trust-reconciler-LCBJTVGU.js → workspace-trust-reconciler-UO4CD5XT.js} +29 -29
- package/chunks/{write-file-NZJANURY.js → write-file-4NLDAO3E.js} +13 -13
- package/chunks/{zoom-image-3UVOSRAZ.js → zoom-image-WVJNVR4G.js} +2 -2
- package/cli.js +12 -12
- package/execution-worker.js +1 -1
- package/export-transcript-document.js +1 -1
- package/package.json +2 -2
- package/release-notes.json +7 -0
- package/web-shell/assets/{abnfDiagram-VCTEODGH-DkmBSa44.js → abnfDiagram-VCTEODGH-GkC7qpZa.js} +1 -1
- package/web-shell/assets/{arc-B6QJJ8tD.js → arc-rCRTR9rP.js} +1 -1
- package/web-shell/assets/{architectureDiagram-5GKGNRK7-Dfqoi9lk.js → architectureDiagram-5GKGNRK7-BXamqUa2.js} +1 -1
- package/web-shell/assets/{blockDiagram-NRAW4CY4-DclmlLhY.js → blockDiagram-NRAW4CY4-gcjjt4RN.js} +1 -1
- package/web-shell/assets/{c4Diagram-UCG6FXSJ-0gbQb3pK.js → c4Diagram-UCG6FXSJ-y4txHZ64.js} +1 -1
- package/web-shell/assets/channel-CRgqjxIs.js +1 -0
- package/web-shell/assets/{chunk-2Q5K7J3B-BAfaryX9.js → chunk-2Q5K7J3B-CP7Wj7xO.js} +1 -1
- package/web-shell/assets/{chunk-5VM5RSS4-xSewF8tm.js → chunk-5VM5RSS4-Cp32oZuQ.js} +1 -1
- package/web-shell/assets/{chunk-F27PBJKO-ChEgStih.js → chunk-F27PBJKO-91dCDCyf.js} +1 -1
- package/web-shell/assets/{chunk-G27WJ6UU-BAVY2RkO.js → chunk-G27WJ6UU-CE0yCTWa.js} +1 -1
- package/web-shell/assets/{chunk-JWPE2WC7-BXOwTSzw.js → chunk-JWPE2WC7-BrpX8c3O.js} +1 -1
- package/web-shell/assets/{chunk-LCL6LL3I-nw5Rmnmd.js → chunk-LCL6LL3I-BYJTu4zN.js} +1 -1
- package/web-shell/assets/{chunk-POPQ4Y6H-DIDQ5Zzu.js → chunk-POPQ4Y6H-Codub2tr.js} +1 -1
- package/web-shell/assets/{chunk-SVP7TREG-CjdgAA3l.js → chunk-SVP7TREG-DM-ke8Mr.js} +1 -1
- package/web-shell/assets/{chunk-XXDRQBXY-CKoYFCQo.js → chunk-XXDRQBXY-BLcKbNbx.js} +1 -1
- package/web-shell/assets/classDiagram-DTDB5LWJ-oQ799Ozj.js +1 -0
- package/web-shell/assets/classDiagram-v2-JRS7N3AN-oQ799Ozj.js +1 -0
- package/web-shell/assets/{cose-bilkent-JH36ORCC-OKMrJSR7.js → cose-bilkent-JH36ORCC-yMq4SSTl.js} +1 -1
- package/web-shell/assets/{cynefin-OW5HDTMX-BDE2ih0w.js → cynefin-OW5HDTMX-B-n83dZA.js} +1 -1
- package/web-shell/assets/{cynefinDiagram-5FMLGOSQ-DHgwp6ZM.js → cynefinDiagram-5FMLGOSQ-DwgvqFDD.js} +1 -1
- package/web-shell/assets/{dagre-3AP2YEHR-mHCyf6A6.js → dagre-3AP2YEHR-BjByq1Of.js} +1 -1
- package/web-shell/assets/{diagram-S7CK7UJ4-CHeZ9YMQ.js → diagram-S7CK7UJ4-b-k59yRn.js} +1 -1
- package/web-shell/assets/{diagram-UQ7AKVKN-D3jwKiUo.js → diagram-UQ7AKVKN-d4Mot6Yz.js} +1 -1
- package/web-shell/assets/{diagram-VSXAHHWV-z9gvH87B.js → diagram-VSXAHHWV-CkxocesP.js} +1 -1
- package/web-shell/assets/{diagram-VX7I27RA-DBdwXye9.js → diagram-VX7I27RA-ClsrsYuH.js} +1 -1
- package/web-shell/assets/{diagram-Z3DM3KII-BZrQD3_5.js → diagram-Z3DM3KII-C86pbkMU.js} +1 -1
- package/web-shell/assets/{ebnfDiagram-PWID7BFC-CsdYNOhn.js → ebnfDiagram-PWID7BFC-Dd_W23Ti.js} +1 -1
- package/web-shell/assets/{erDiagram-SSCWMZ5O-kLiDhj_x.js → erDiagram-SSCWMZ5O-Bm0aSkLh.js} +1 -1
- package/web-shell/assets/{flowDiagram-A5DVABFB-7E_nqNi9.js → flowDiagram-A5DVABFB-CzOHrYqI.js} +1 -1
- package/web-shell/assets/{ganttDiagram-EL5Y4UJY-frx7zvbA.js → ganttDiagram-EL5Y4UJY-aD7VOZlz.js} +1 -1
- package/web-shell/assets/{gitGraphDiagram-WWUBYQGX-DkyMPkwJ.js → gitGraphDiagram-WWUBYQGX-qC6lU8hO.js} +1 -1
- package/web-shell/assets/{index-oMwDI29g.js → index-Dt92aFEi.js} +1 -1
- package/web-shell/assets/{index-EoFfssG4.js → index-IQxVrdU8.js} +3 -3
- package/web-shell/assets/{infoDiagram-RXCK75RN-XljVTrU8.js → infoDiagram-RXCK75RN-D7n5hN5T.js} +1 -1
- package/web-shell/assets/{ishikawaDiagram-5VMMS53U-C9WCq-5V.js → ishikawaDiagram-5VMMS53U-Crzzj9Hk.js} +1 -1
- package/web-shell/assets/{journeyDiagram-EYS64GPL-DXu9g9Sy.js → journeyDiagram-EYS64GPL-FwmS41nw.js} +1 -1
- package/web-shell/assets/{kanban-definition-3QL26DDD-Doy--c8N.js → kanban-definition-3QL26DDD-CKIs80uY.js} +1 -1
- package/web-shell/assets/{layout-CS7r1tO4.js → layout-BQz4dKSf.js} +1 -1
- package/web-shell/assets/{linear-CzSHv-4-.js → linear-BFhHgDEc.js} +1 -1
- package/web-shell/assets/{mermaid.core-7BsQ3zED.js → mermaid.core-Bk7ZiySi.js} +6 -6
- package/web-shell/assets/{mindmap-definition-FBJOCRG2-yHWxnbXN.js → mindmap-definition-FBJOCRG2-BBWZxLbK.js} +1 -1
- package/web-shell/assets/{pegDiagram-XKGWAZYB-DHUzJJRt.js → pegDiagram-XKGWAZYB-D3XoIA9B.js} +1 -1
- package/web-shell/assets/{pieDiagram-E7YTZNPT-CRjSY45J.js → pieDiagram-E7YTZNPT-B_tPTCKL.js} +1 -1
- package/web-shell/assets/{quadrantDiagram-AXDQQJYC-CUKQicAO.js → quadrantDiagram-AXDQQJYC-BtsvzEtS.js} +1 -1
- package/web-shell/assets/{railroadDiagram-O6MQD6OU-CeIaRI86.js → railroadDiagram-O6MQD6OU-6ag1DheV.js} +1 -1
- package/web-shell/assets/{requirementDiagram-EFPCY7ZU-CkdesAuv.js → requirementDiagram-EFPCY7ZU-8YxylfMT.js} +1 -1
- package/web-shell/assets/{sankeyDiagram-P5KCCOFB-DRv4I5Uy.js → sankeyDiagram-P5KCCOFB-1_AorqC_.js} +1 -1
- package/web-shell/assets/{sequenceDiagram-WJ2MYXX4-BUIm21Ol.js → sequenceDiagram-WJ2MYXX4-paioxV9Q.js} +1 -1
- package/web-shell/assets/{sizeCapture-X5ZJPWSS-W69Ocb71.js → sizeCapture-X5ZJPWSS-oOBrUhQf.js} +1 -1
- package/web-shell/assets/{stateDiagram-HBIQ2CUA-DD0RyKZg.js → stateDiagram-HBIQ2CUA-DGkViHHK.js} +1 -1
- package/web-shell/assets/stateDiagram-v2-4QOOHH4V-CWC6iKqT.js +1 -0
- package/web-shell/assets/{swimlanes-XN3QIQJK-vsonhOlr.js → swimlanes-XN3QIQJK-TqBChE5a.js} +1 -1
- package/web-shell/assets/swimlanesDiagram-VK2B7HYN-Dz_lYxMp.js +8 -0
- package/web-shell/assets/{timeline-definition-24CTP7MA-DjdRx1i_.js → timeline-definition-24CTP7MA-BQGAL6YG.js} +1 -1
- package/web-shell/assets/{vennDiagram-4TSXK5OY-CPVhp0Hy.js → vennDiagram-4TSXK5OY-CGPjpaes.js} +1 -1
- package/web-shell/assets/{wardleyDiagram-VM6X3IG4-M6mqQteg.js → wardleyDiagram-VM6X3IG4-DPK0MANE.js} +1 -1
- package/web-shell/assets/{xychartDiagram-S5SC5T6Z-Cli-2870.js → xychartDiagram-S5SC5T6Z-D4TN6euT.js} +1 -1
- package/web-shell/index.html +1 -1
- package/web-shell/sw.js +1 -1
- package/web-shell/assets/channel-COSuEQ94.js +0 -1
- package/web-shell/assets/classDiagram-DTDB5LWJ-DUKWtFFX.js +0 -1
- package/web-shell/assets/classDiagram-v2-JRS7N3AN-DUKWtFFX.js +0 -1
- package/web-shell/assets/stateDiagram-v2-4QOOHH4V-C5kAp2c6.js +0 -1
- package/web-shell/assets/swimlanesDiagram-VK2B7HYN-DP2NE03a.js +0 -8
|
@@ -1091,7 +1091,7 @@ ${n}`:n}function pae(e){const t=e.data.indexOf(","),n=e.data.startsWith("data:")
|
|
|
1091
1091
|
</head><body><iframe title="${lR(t)}" src="${lR(e.href)}" sandbox="allow-scripts allow-same-origin allow-forms" referrerpolicy="no-referrer"></iframe></body></html>`}function OJ(e,t){const n=sD(t);if($J.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 Lat=new Set([".doc",".docx",".docm",".dotx",".xls",".xlsx",".xlsm",".xlsb",".ppt",".pptx",".pptm",".odt",".ods",".odp"]),$J=new Set([".m4a",".mp3",".ogg",".wav"]),Dat=new Set([...Lat,...$J,".pdf",".mp4",".mov",".webm"]);function n4e(e){const t=sD(e.workspacePath),n=Cw(e.mimeType);return t===".svg"||n==="image/svg+xml"||Dat.has(t)?!0:r4e(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 sD(e){const n=(e??"").split(/[?#]/,1)[0].split(/[/\\]/).pop()??"",s=n.lastIndexOf(".");return s>=0?n.slice(s).toLowerCase():""}function Oat(e,t){return $J.has(sD(e))||Cw(t).startsWith("audio/")}const $at="o1code.workspace.sha256";function pce(e){const t=e.metadata?.[$at],n=typeof t=="string"?t:"";return`${e.status}:${e.updatedAt}:${n}`}function Bat(e){const t=e.metadata?.artifactType;return typeof t=="string"&&t?t:OJ(e.kind,e.workspacePath??e.url??e.title)}function rD(e){return e===void 0?"":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}const s4e={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"},Fat=100*1024*1024,zat=256*1024;function Cw(e){return e?.split(";",1)[0]?.trim().toLowerCase()??""}function r4e(e){const t=Cw(e.mimeType);return t.startsWith("image/")?t==="image/jpg"?"image/jpeg":Object.values(s4e).includes(t)?t:void 0:v_(e.workspacePath??"")}function v_(e){const t=e.toLowerCase(),n=t.includes(".")?t.split(".").pop():void 0;return n?s4e[n]:void 0}function Hat(e){return/\.html?$/i.test(e)?"text/html":"text/markdown"}async function TT(e,t,n,s){const r=[],o=s.maxBytes??Fat,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:zat});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 oD(e,t,n="application/octet-stream",s){const r=await TT((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=Tw(t).split("/").at(-1)??t,document.body.appendChild(i),i.click(),i.remove()}finally{URL.revokeObjectURL(o)}}function o4e(e){return e.workspacePath??e.url??e.managedId??""}function Tw(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 pE(e,t){const n=Tw(e),s=Tw(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 BJ(e,t,n){const s=pE(e??"",n),r=pE(t??"",n);return!!s&&s===r}const uV="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 i4e(e,t){return dV(hV(e),t)}function dV(e,t){return`<!doctype html><html><head>
|
|
1092
1092
|
<meta http-equiv="Content-Security-Policy" content="${uV} 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="${lR(t)}" sandbox="allow-scripts" referrerpolicy="no-referrer" srcdoc="${lR(e)}"></iframe></body></html>`}let Dj;async function Uat(e,t,n){if(Dj?.content===e&&Dj.title===t)return Dj.document;const s=await Wat(e,t,n);return Dj={content:e,title:t,document:s},s}async function Wat(e,t,n){if(typeof DOMParser>"u")return i4e(e,t);const s=new DOMParser().parseFromString(e,"text/html");if(!s.querySelector('script#transcript-document[type="application/json"]'))return dV(hV(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)??"",p=h?.getAttribute("integrity")??"";if(!h)return;const m=`https://unpkg.com/@organizaone/o1-code@0.2.2/export-transcript-document.${c}`;if(f!==m||!/^sha384-[A-Za-z0-9+/]{64}$/.test(p))throw new Error("Unsupported export preview resource; use an export matching the current Web Shell version.");const g=await fetch(f,{integrity:p,signal:r.signal,credentials:"omit",referrerPolicy:"no-referrer",redirect:"error"});if(!g.ok)throw new Error(`Could not load export renderer (${g.status}).`);const v=new Blob([await g.arrayBuffer()],{type:u}),y=await new Promise((w,b)=>{const x=new FileReader;x.onload=()=>w(x.result),x.onerror=()=>b(x.error),x.readAsDataURL(v)});h.setAttribute(l,y),h.removeAttribute("integrity"),h.removeAttribute("crossorigin")}))}finally{n.removeEventListener("abort",o),r.abort()}return dV(hV(s),t)}function hV(e){if(typeof e=="string"&&typeof DOMParser>"u")return`<!doctype html><html><head><meta http-equiv="Content-Security-Policy" content="${uV}"></head><body>${qat(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=uV,t.head.prepend(n),`<!doctype html>${t.documentElement.outerHTML}`}function qat(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 a4e={csv:Sat,file:Cat,html:Tat,image:Iat,link:Rat,md:Eat,pdf:Aat,spreadsheet:jat,video:Nat,word:Mat},Vat={csv:"csv",html:"html",image:"image",link:"link",markdown:"md",md:"md",pdf:"pdf",spreadsheet:"spreadsheet",video:"video",word:"word"},Gat={audio:NJ,document:CT,notebook:eit},mce={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 l4e(e){if(!e)return"file";const t=e.workspacePath??e.url??e.title,n=sD(t).slice(1);if(n&&mce[n])return mce[n];const s=Cw(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":Vat[e.kind]??"file"}function c4e({artifact:e,className:t}){const{artifact:n}=xd(),s=e?n?.renderImage?.(e):void 0;if(s!=null&&s!==!1)return s;const r=l4e(e),o=e?e.workspacePath??e.url??e.title:void 0,i=r==="file"&&e?Oat(o,e.mimeType)?"audio":e.kind:void 0,l=i?Gat[i]:void 0;return l?a.jsx(l,{className:t,"data-artifact-icon":i,"aria-hidden":"true"}):a.jsx("img",{className:t,src:a4e[r],"data-artifact-icon":r,alt:""})}const Kat=[[new Set(["json","jsonl","geojson"]),Nst],[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"]),V9],[new Set(["zip","tar","gz","tgz","bz2","xz","7z","rar"]),jrt],[new Set(["csv","tsv","xls","xlsx","ods"]),$rt],[new Set(["ppt","pptx","odp"]),wit],[new Set(["png","jpg","jpeg","gif","webp","bmp","ico","tif","tiff"]),LTe],[new Set(["mp3","wav","ogg","m4a","aac","flac"]),NJ],[new Set(["mp4","mov","webm","avi","mkv"]),DTe],[new Set(["txt","md","mdx","log","pdf","doc","docx","rtf"]),CT]];function Yat(e,t){const n=e.split(".").pop()?.toLowerCase()??"";for(const[s,r]of Kat)if(s.has(n))return r;return t?.startsWith("image/")?LTe:t?.startsWith("audio/")?NJ:t?.startsWith("video/")?DTe:t?.startsWith("text/")?CT:OTe}function ag({name:e,mimeType:t,size:n=24,absoluteStrokeWidth:s,...r}){const o=Yat(e,t),i=l4e({kind:"file",title:e.replace(/[?#]/g,"_"),mimeType:t});return i!=="file"||o===OTe?a.jsx("svg",{width:n,height:n,...r,"data-file-type-icon":i,children:a.jsx("image",{href:a4e[i],width:"100%",height:"100%"})}):a.jsx(o,{size:n,absoluteStrokeWidth:s,...r})}const Xat="_panel_19vsn_1",Zat="_floating_19vsn_16",Jat="_section_19vsn_26",Qat="_sectionHeader_19vsn_40",elt="_sectionHeaderRow_19vsn_59",tlt="_sectionAction_19vsn_70",nlt="_sectionContent_19vsn_111",slt="_row_19vsn_115",rlt="_workspaceIcon_19vsn_158",olt="_rowActionIcon_19vsn_162",ilt="_label_19vsn_168",alt="_branchName_19vsn_173",llt="_value_19vsn_181",clt="_tasks_19vsn_191",ult="_task_19vsn_191",dlt="_taskIcon_19vsn_229",hlt="_taskLabel_19vsn_240",flt="_agentName_19vsn_248",plt="_taskName_19vsn_249",mlt="_agentColor_19vsn_260",glt="_agentTag_19vsn_269",vlt="_taskStatus_19vsn_280",wlt="_statusRunning_19vsn_301",ylt="_attachmentFiles_19vsn_311",blt="_attachmentFile_19vsn_311",xlt="_attachmentFileIcon_19vsn_344",klt="_attachmentFileName_19vsn_348",_lt="_emptyDescription_19vsn_356",Slt="_sourceTitle_19vsn_363",vr={panel:Xat,floating:Zat,section:Jat,sectionHeader:Qat,sectionHeaderRow:elt,sectionAction:tlt,sectionContent:nlt,row:slt,workspaceIcon:rlt,rowActionIcon:olt,label:ilt,branchName:alt,value:llt,tasks:clt,task:ult,taskIcon:dlt,taskLabel:hlt,agentName:flt,taskName:plt,agentColor:mlt,agentTag:glt,taskStatus:vlt,statusRunning:wlt,attachmentFiles:ylt,attachmentFile:blt,attachmentFileIcon:xlt,attachmentFileName:klt,emptyDescription:_lt,sourceTitle:Slt};function u4e({entries:e,onOpen:t}){const{t:n}=pt();return a.jsx("ul",{className:vr.attachmentFiles,children:e.map(s=>a.jsx("li",{children:a.jsxs("button",{type:"button",className:vr.attachmentFile,title:dce(s),"aria-label":s.type==="source"?`${n("sources.open")} ${uce(s)}`:void 0,disabled:!t,onClick:()=>t?.(s),children:[s.type==="source"&&s.source.kind==="link"?a.jsx(BTe,{size:16,strokeWidth:1.7,className:vr.attachmentFileIcon}):a.jsx(ag,{name:dce(s),mimeType:s.type==="attachment"?s.attachment.mimeType:void 0,size:16,strokeWidth:1.7,className:vr.attachmentFileIcon,"aria-hidden":"true"}),a.jsx("span",{className:vr.attachmentFileName,children:uce(s)})]})},KM(s)))})}function p0({className:e,...t}){return a.jsx("div",{"data-slot":"skeleton",className:Un("animate-pulse rounded-md bg-muted",e),...t})}function Clt(){return typeof window>"u"?!1:new URLSearchParams(window.location.search).get("addSource")==="1"}function Tlt({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:p}){const{t:m}=pt(),[g,v]=d.useState(!1),[y,w]=d.useState(!1);d.useEffect(()=>{e&&w(!1)},[e]),d.useEffect(()=>{w(!1),v(!1)},[t?.owner,t?.supported]),d.useEffect(()=>(c?.(y&&t?.supported===!0),()=>c?.(!1)),[y,c,t?.supported]);const b=t?.supported?t.sources:[],x=JTe(b,n);if(!t?.supported&&!x.length&&!s&&!r)return null;const _=s||t?.supported&&t.loading;return a.jsxs("section",{className:vr.section,"aria-label":m("sources.title"),"data-testid":"sources-section",children:[a.jsxs("div",{className:vr.sectionHeaderRow,children:[a.jsxs("h3",{className:`${vr.sectionHeader} ${vr.sourceTitle}`,children:[m("sources.title")," ",a.jsx("span",{className:"text-muted-foreground",children:x.length})]}),t?.supported&&Clt()&&a.jsx("button",{type:"button",className:vr.sectionAction,"aria-label":m("sources.add"),onClick:()=>w(!0),children:a.jsx(jh,{})})]}),l&&a.jsxs("div",{className:vr.emptyDescription,role:"alert",children:[m("sources.registrationFailed")," ",a.jsx(Mt,{size:"sm",variant:"link",onClick:()=>void l(),children:m("common.retry")})]}),t?.supported&&t.error&&a.jsxs("div",{className:"mt-2 text-xs text-destructive",role:"alert",children:[t.error," ",a.jsx(Mt,{size:"sm",variant:"link",onClick:()=>void t.refresh(),children:m("common.retry")})]}),r&&a.jsxs("div",{className:"mt-2 text-xs text-destructive",role:"alert",children:[m("sources.attachmentsLoadFailed",{error:r})," ",a.jsx(Mt,{size:"sm",variant:"link",onClick:o,children:m("common.retry")})]}),a.jsx(u4e,{entries:g?x:x.slice(0,3),onOpen:C=>d4e(C,{onOpen:i,onReadImage:u,onImagePreview:h,onAttachmentPreview:f,onAttachmentPreviewError:p})}),_&&!x.length&&a.jsx("ul",{className:vr.attachmentFiles,"data-testid":"environment-file-list-skeleton",role:"status","aria-label":m("common.loading"),children:[72,88,64].map(C=>a.jsxs("li",{className:vr.attachmentFile,children:[a.jsx(p0,{className:"size-4 shrink-0 rounded-sm"}),a.jsx(p0,{className:"h-4",style:{width:`${C}%`}})]},C))}),!_&&!x.length&&t?.hydrated&&!t.error&&!r&&a.jsx("p",{className:vr.emptyDescription,children:m("sources.empty")}),x.length>3&&a.jsx("button",{type:"button",className:vr.attachmentFile,"aria-expanded":g,onClick:()=>v(C=>!C),children:m(g?"common.collapse":"sources.viewAll")}),y&&t?.supported&&a.jsx(Ilt,{state:t,onClose:()=>w(!1)})]})}function Ilt({state:e,onClose:t}){const{t:n}=pt(),[s,r]=d.useState("workspace_file"),[o,i]=d.useState(""),[l,c]=d.useState(""),[u,h]=d.useState(""),[f,p]=d.useState(),[m,g]=d.useState(!1),v=async()=>{g(!0),p(void 0);try{const y=s==="url"?new URL(o).hostname:o.split(/[\\/]/).at(-1)||o,w=s==="workspace_file"?{type:s,workspacePath:o}:{type:s,url:o};await e.upsert({title:l.trim()||y.trim().slice(0,200),locator:w,...u?{description:u}:{}}),e.owner.isCurrent()&&t()}catch(y){e.owner.isCurrent()&&p(y instanceof Error?y.message:String(y))}finally{e.owner.isCurrent()&&g(!1)}};return a.jsx(Ji,{title:n("sources.add"),subtitle:n("sources.explanation"),onClose:t,size:"sm",children:a.jsxs("form",{className:"flex flex-col gap-3",onSubmit:y=>{y.preventDefault(),v()},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:y=>{r(y.target.value),i(""),p(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(Mo,{value:o,onChange:y=>i(y.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(Mo,{value:l,maxLength:200,onChange:y=>c(y.target.value)})]}),a.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[n("sources.description"),a.jsx(Mo,{value:u,maxLength:1e3,onChange:y=>h(y.target.value)})]}),f&&a.jsx("div",{role:"alert",className:"text-xs text-destructive",children:f}),a.jsx(Mt,{type:"submit",disabled:m||!o,children:n("sources.add")})]})})}function d4e(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="${lR(t)}" sandbox="allow-scripts" referrerpolicy="no-referrer" srcdoc="${lR(e)}"></iframe></body></html>`}let Dj;async function Uat(e,t,n){if(Dj?.content===e&&Dj.title===t)return Dj.document;const s=await Wat(e,t,n);return Dj={content:e,title:t,document:s},s}async function Wat(e,t,n){if(typeof DOMParser>"u")return i4e(e,t);const s=new DOMParser().parseFromString(e,"text/html");if(!s.querySelector('script#transcript-document[type="application/json"]'))return dV(hV(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)??"",p=h?.getAttribute("integrity")??"";if(!h)return;const m=`https://unpkg.com/@organizaone/o1-code@0.3.0/export-transcript-document.${c}`;if(f!==m||!/^sha384-[A-Za-z0-9+/]{64}$/.test(p))throw new Error("Unsupported export preview resource; use an export matching the current Web Shell version.");const g=await fetch(f,{integrity:p,signal:r.signal,credentials:"omit",referrerPolicy:"no-referrer",redirect:"error"});if(!g.ok)throw new Error(`Could not load export renderer (${g.status}).`);const v=new Blob([await g.arrayBuffer()],{type:u}),y=await new Promise((w,b)=>{const x=new FileReader;x.onload=()=>w(x.result),x.onerror=()=>b(x.error),x.readAsDataURL(v)});h.setAttribute(l,y),h.removeAttribute("integrity"),h.removeAttribute("crossorigin")}))}finally{n.removeEventListener("abort",o),r.abort()}return dV(hV(s),t)}function hV(e){if(typeof e=="string"&&typeof DOMParser>"u")return`<!doctype html><html><head><meta http-equiv="Content-Security-Policy" content="${uV}"></head><body>${qat(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=uV,t.head.prepend(n),`<!doctype html>${t.documentElement.outerHTML}`}function qat(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 a4e={csv:Sat,file:Cat,html:Tat,image:Iat,link:Rat,md:Eat,pdf:Aat,spreadsheet:jat,video:Nat,word:Mat},Vat={csv:"csv",html:"html",image:"image",link:"link",markdown:"md",md:"md",pdf:"pdf",spreadsheet:"spreadsheet",video:"video",word:"word"},Gat={audio:NJ,document:CT,notebook:eit},mce={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 l4e(e){if(!e)return"file";const t=e.workspacePath??e.url??e.title,n=sD(t).slice(1);if(n&&mce[n])return mce[n];const s=Cw(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":Vat[e.kind]??"file"}function c4e({artifact:e,className:t}){const{artifact:n}=xd(),s=e?n?.renderImage?.(e):void 0;if(s!=null&&s!==!1)return s;const r=l4e(e),o=e?e.workspacePath??e.url??e.title:void 0,i=r==="file"&&e?Oat(o,e.mimeType)?"audio":e.kind:void 0,l=i?Gat[i]:void 0;return l?a.jsx(l,{className:t,"data-artifact-icon":i,"aria-hidden":"true"}):a.jsx("img",{className:t,src:a4e[r],"data-artifact-icon":r,alt:""})}const Kat=[[new Set(["json","jsonl","geojson"]),Nst],[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"]),V9],[new Set(["zip","tar","gz","tgz","bz2","xz","7z","rar"]),jrt],[new Set(["csv","tsv","xls","xlsx","ods"]),$rt],[new Set(["ppt","pptx","odp"]),wit],[new Set(["png","jpg","jpeg","gif","webp","bmp","ico","tif","tiff"]),LTe],[new Set(["mp3","wav","ogg","m4a","aac","flac"]),NJ],[new Set(["mp4","mov","webm","avi","mkv"]),DTe],[new Set(["txt","md","mdx","log","pdf","doc","docx","rtf"]),CT]];function Yat(e,t){const n=e.split(".").pop()?.toLowerCase()??"";for(const[s,r]of Kat)if(s.has(n))return r;return t?.startsWith("image/")?LTe:t?.startsWith("audio/")?NJ:t?.startsWith("video/")?DTe:t?.startsWith("text/")?CT:OTe}function ag({name:e,mimeType:t,size:n=24,absoluteStrokeWidth:s,...r}){const o=Yat(e,t),i=l4e({kind:"file",title:e.replace(/[?#]/g,"_"),mimeType:t});return i!=="file"||o===OTe?a.jsx("svg",{width:n,height:n,...r,"data-file-type-icon":i,children:a.jsx("image",{href:a4e[i],width:"100%",height:"100%"})}):a.jsx(o,{size:n,absoluteStrokeWidth:s,...r})}const Xat="_panel_19vsn_1",Zat="_floating_19vsn_16",Jat="_section_19vsn_26",Qat="_sectionHeader_19vsn_40",elt="_sectionHeaderRow_19vsn_59",tlt="_sectionAction_19vsn_70",nlt="_sectionContent_19vsn_111",slt="_row_19vsn_115",rlt="_workspaceIcon_19vsn_158",olt="_rowActionIcon_19vsn_162",ilt="_label_19vsn_168",alt="_branchName_19vsn_173",llt="_value_19vsn_181",clt="_tasks_19vsn_191",ult="_task_19vsn_191",dlt="_taskIcon_19vsn_229",hlt="_taskLabel_19vsn_240",flt="_agentName_19vsn_248",plt="_taskName_19vsn_249",mlt="_agentColor_19vsn_260",glt="_agentTag_19vsn_269",vlt="_taskStatus_19vsn_280",wlt="_statusRunning_19vsn_301",ylt="_attachmentFiles_19vsn_311",blt="_attachmentFile_19vsn_311",xlt="_attachmentFileIcon_19vsn_344",klt="_attachmentFileName_19vsn_348",_lt="_emptyDescription_19vsn_356",Slt="_sourceTitle_19vsn_363",vr={panel:Xat,floating:Zat,section:Jat,sectionHeader:Qat,sectionHeaderRow:elt,sectionAction:tlt,sectionContent:nlt,row:slt,workspaceIcon:rlt,rowActionIcon:olt,label:ilt,branchName:alt,value:llt,tasks:clt,task:ult,taskIcon:dlt,taskLabel:hlt,agentName:flt,taskName:plt,agentColor:mlt,agentTag:glt,taskStatus:vlt,statusRunning:wlt,attachmentFiles:ylt,attachmentFile:blt,attachmentFileIcon:xlt,attachmentFileName:klt,emptyDescription:_lt,sourceTitle:Slt};function u4e({entries:e,onOpen:t}){const{t:n}=pt();return a.jsx("ul",{className:vr.attachmentFiles,children:e.map(s=>a.jsx("li",{children:a.jsxs("button",{type:"button",className:vr.attachmentFile,title:dce(s),"aria-label":s.type==="source"?`${n("sources.open")} ${uce(s)}`:void 0,disabled:!t,onClick:()=>t?.(s),children:[s.type==="source"&&s.source.kind==="link"?a.jsx(BTe,{size:16,strokeWidth:1.7,className:vr.attachmentFileIcon}):a.jsx(ag,{name:dce(s),mimeType:s.type==="attachment"?s.attachment.mimeType:void 0,size:16,strokeWidth:1.7,className:vr.attachmentFileIcon,"aria-hidden":"true"}),a.jsx("span",{className:vr.attachmentFileName,children:uce(s)})]})},KM(s)))})}function p0({className:e,...t}){return a.jsx("div",{"data-slot":"skeleton",className:Un("animate-pulse rounded-md bg-muted",e),...t})}function Clt(){return typeof window>"u"?!1:new URLSearchParams(window.location.search).get("addSource")==="1"}function Tlt({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:p}){const{t:m}=pt(),[g,v]=d.useState(!1),[y,w]=d.useState(!1);d.useEffect(()=>{e&&w(!1)},[e]),d.useEffect(()=>{w(!1),v(!1)},[t?.owner,t?.supported]),d.useEffect(()=>(c?.(y&&t?.supported===!0),()=>c?.(!1)),[y,c,t?.supported]);const b=t?.supported?t.sources:[],x=JTe(b,n);if(!t?.supported&&!x.length&&!s&&!r)return null;const _=s||t?.supported&&t.loading;return a.jsxs("section",{className:vr.section,"aria-label":m("sources.title"),"data-testid":"sources-section",children:[a.jsxs("div",{className:vr.sectionHeaderRow,children:[a.jsxs("h3",{className:`${vr.sectionHeader} ${vr.sourceTitle}`,children:[m("sources.title")," ",a.jsx("span",{className:"text-muted-foreground",children:x.length})]}),t?.supported&&Clt()&&a.jsx("button",{type:"button",className:vr.sectionAction,"aria-label":m("sources.add"),onClick:()=>w(!0),children:a.jsx(jh,{})})]}),l&&a.jsxs("div",{className:vr.emptyDescription,role:"alert",children:[m("sources.registrationFailed")," ",a.jsx(Mt,{size:"sm",variant:"link",onClick:()=>void l(),children:m("common.retry")})]}),t?.supported&&t.error&&a.jsxs("div",{className:"mt-2 text-xs text-destructive",role:"alert",children:[t.error," ",a.jsx(Mt,{size:"sm",variant:"link",onClick:()=>void t.refresh(),children:m("common.retry")})]}),r&&a.jsxs("div",{className:"mt-2 text-xs text-destructive",role:"alert",children:[m("sources.attachmentsLoadFailed",{error:r})," ",a.jsx(Mt,{size:"sm",variant:"link",onClick:o,children:m("common.retry")})]}),a.jsx(u4e,{entries:g?x:x.slice(0,3),onOpen:C=>d4e(C,{onOpen:i,onReadImage:u,onImagePreview:h,onAttachmentPreview:f,onAttachmentPreviewError:p})}),_&&!x.length&&a.jsx("ul",{className:vr.attachmentFiles,"data-testid":"environment-file-list-skeleton",role:"status","aria-label":m("common.loading"),children:[72,88,64].map(C=>a.jsxs("li",{className:vr.attachmentFile,children:[a.jsx(p0,{className:"size-4 shrink-0 rounded-sm"}),a.jsx(p0,{className:"h-4",style:{width:`${C}%`}})]},C))}),!_&&!x.length&&t?.hydrated&&!t.error&&!r&&a.jsx("p",{className:vr.emptyDescription,children:m("sources.empty")}),x.length>3&&a.jsx("button",{type:"button",className:vr.attachmentFile,"aria-expanded":g,onClick:()=>v(C=>!C),children:m(g?"common.collapse":"sources.viewAll")}),y&&t?.supported&&a.jsx(Ilt,{state:t,onClose:()=>w(!1)})]})}function Ilt({state:e,onClose:t}){const{t:n}=pt(),[s,r]=d.useState("workspace_file"),[o,i]=d.useState(""),[l,c]=d.useState(""),[u,h]=d.useState(""),[f,p]=d.useState(),[m,g]=d.useState(!1),v=async()=>{g(!0),p(void 0);try{const y=s==="url"?new URL(o).hostname:o.split(/[\\/]/).at(-1)||o,w=s==="workspace_file"?{type:s,workspacePath:o}:{type:s,url:o};await e.upsert({title:l.trim()||y.trim().slice(0,200),locator:w,...u?{description:u}:{}}),e.owner.isCurrent()&&t()}catch(y){e.owner.isCurrent()&&p(y instanceof Error?y.message:String(y))}finally{e.owner.isCurrent()&&g(!1)}};return a.jsx(Ji,{title:n("sources.add"),subtitle:n("sources.explanation"),onClose:t,size:"sm",children:a.jsxs("form",{className:"flex flex-col gap-3",onSubmit:y=>{y.preventDefault(),v()},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:y=>{r(y.target.value),i(""),p(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(Mo,{value:o,onChange:y=>i(y.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(Mo,{value:l,maxLength:200,onChange:y=>c(y.target.value)})]}),a.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[n("sources.description"),a.jsx(Mo,{value:u,maxLength:1e3,onChange:y=>h(y.target.value)})]}),f&&a.jsx("div",{role:"alert",className:"text-xs text-destructive",children:f}),a.jsx(Mt,{type:"submit",disabled:m||!o,children:n("sources.add")})]})})}function d4e(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
|
})();`,B_t=`<!doctype html>
|
|
1616
1616
|
<html><head><meta charset="utf-8"><meta http-equiv="Content-Security-Policy" content="${D_t}"></head>
|
|
1617
1617
|
<body><script>${$_t}<\/script></body></html>`;function F_t(){const e=globalThis.crypto;if(!e?.getRandomValues)throw new js("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 Yde(){return new DOMException("The temporary legacy chart operation was aborted","AbortError")}function z_t(e){if(e.signal.aborted)return Promise.reject(Yde());if(!Number.isSafeInteger(e.timeoutMs)||e.timeoutMs<=0)return Promise.reject(new js("SCHEMA_INVALID","Legacy sandbox timeout must be a positive safe integer"));if(typeof document>"u"||!document.body)return Promise.reject(new js("LEGACY_SANDBOX_UNAVAILABLE","The temporary legacy sandbox requires a browser document body"));const t=F_t(),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=B_t,new Promise((s,r)=>{let o=!1,i=!1,l;const c=()=>{window.removeEventListener("message",p),e.signal.removeEventListener("abort",f),n.onload=null,n.onerror=null,l!==void 0&&clearTimeout(l),n.remove()},u=(m,g)=>{o||(o=!0,c(),m(g))},h=m=>{o||(o=!0,c(),r(m))},f=()=>h(Yde()),p=m=>{if(!(m.source!==n.contentWindow||!Fi(m.data))&&!(m.data.channel!==dG||m.data.requestId!==t)){if(m.data.type==="error"){h(new js("LEGACY_SANDBOX_EXECUTION_FAILED","Temporary legacy chart source failed in the isolated worker"));return}if(m.data.type==="result")try{const g=hIe(m.data.option);if(!Fi(g))throw new js("SCHEMA_INVALID","Temporary legacy chart source must produce a JSON object option");u(s,g)}catch(g){h(g)}}};window.addEventListener("message",p),e.signal.addEventListener("abort",f,{once:!0}),n.onerror=()=>h(new js("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:dG,type:"execute",requestId:t,source:e.source,inputData:e.inputData},"*")}},l=setTimeout(()=>h(new js("LEGACY_SANDBOX_TIMEOUT",`Temporary legacy chart sandbox exceeded ${e.timeoutMs}ms`)),e.timeoutMs),document.body.append(n)})}var ZRe=class extends Error{constructor(t,n,s){super(n,s&&"cause"in s?{cause:s.cause}:void 0);Ke(this,"code");Ke(this,"cause");this.name="LegacySandboxError",this.code=t,this.cause=s?.cause}},H_t=Object.freeze({maxArtifactContentBytes:5*1024*1024,maxRows:2e3,maxColumns:200,maxCells:4e4,executionTimeoutMs:5e3});function U_t(e,t){const n={...H_t,...e,...t};for(const[s,r]of Object.entries(n))if(!Number.isSafeInteger(r)||r<=0)throw new js("SCHEMA_INVALID",`legacyArtifactLimits.${s} must be a positive safe integer`);return n}async function JRe(e){let t;try{t=await e.resolveContent()}catch(o){throw e.signal.aborted||e.preserveLegacySandboxError&&o instanceof ZRe?o:new js("REF_RESOLUTION_FAILED",e.resolutionError,{cause:o})}if(typeof t!="string")throw new js("SCHEMA_INVALID",e.returnTypeError);if(e.signal.aborted)throw new DOMException("The temporary legacy chart operation was aborted","AbortError");const n=N_t(t,e.limits),s=L_t(e.source);if(!s)throw new js("SCHEMA_INVALID","Temporary legacy chart source is empty after sanitization");const r=await z_t({source:s,inputData:n.source,signal:e.signal,timeoutMs:e.limits.executionTimeoutMs});return{data:n,spec:r}}async function W_t(e){return JRe({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 q_t(e){return JRe({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 V_t=Object.freeze({maxRows:2e3,maxCells:4e4,maxSeries:100,maxDepth:40,maxNodes:1e5}),G_t=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"]),K_t=new Set(["__proto__","prototype","constructor","extracsstext","renderitem","graphic","image","toolbox","dataview","transform","link","sublink","href","src","url"]),Y_t=/(?:url|uri|href|src|link)$/i,X_t=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/,Xde=/(?:^|[\s("'=])(?:https?:|file:|ftp:|blob:|data:|javascript:|vbscript:|\/\/|image:\/\/)/i,Z_t=/\burl\s*\(/i,J_t=/<\s*\/?\s*[a-z][^>]*>/i,Q_t=/&(?:#\d+|#x[\da-f]+|[a-z][\da-z]+);/i,eSt=/^[A-Za-z_][A-Za-z0-9_]*$/;function na(e){throw new js("SCHEMA_INVALID",e)}function hG(e,t,n){for(const s of Object.keys(e))t.has(s)||na(`${n}.${s} is not allowed`)}function Zde(e,t){if(!Array.isArray(e)||e.length===0)return na(`${t} must be a non-empty array`);const n=e.map((s,r)=>typeof s!="string"||!eSt.test(s)?na(`${t}[${r}] must be a stable ASCII identifier`):s);return new Set(n).size!==n.length?na(`${t} must not contain duplicate dimensions`):n}function tSt(e,t){if(!Fi(e)||typeof e.kind!="string")return na("echarts-fulldata.data must be an inline or ref dataset object");if(e.kind==="inline"){hG(e,new Set(["kind","dimensions","source"]),"echarts-fulldata.data");const n=Zde(e.dimensions,"echarts-fulldata.data.dimensions");if(!Array.isArray(e.source))return na("echarts-fulldata.data.source must be an array");e.source.forEach((r,o)=>{Array.isArray(r)||na(`echarts-fulldata.data.source[${o}] must be an array`),r.length!==n.length&&na(`echarts-fulldata.data.source[${o}] must contain ${n.length} cells`)});const s=jD(e.source,t,"echarts-fulldata.data.source");return{kind:"inline",dimensions:n,source:s}}if(e.kind==="ref"){if(hG(e,new Set(["kind","ref","format","dimensions"]),"echarts-fulldata.data"),typeof e.ref!="string"||e.ref.trim().length===0)return na("echarts-fulldata.data.ref must be a non-empty string");if(e.format!=="csv"&&e.format!=="json")return na("echarts-fulldata.data.format must be csv or json");const n=Zde(e.dimensions,"echarts-fulldata.data.dimensions");return{kind:"ref",ref:e.ref,format:e.format,dimensions:n}}return na(`Unsupported echarts-fulldata.data.kind: ${e.kind}`)}function QRe(e){const t=Array.isArray(e.title),n=t?e.title:[e.title];for(const[s,r]of n.entries()){if(!Fi(r)||typeof r.text!="string")continue;const o=r.text.trim();if(o)return{index:s,isArray:t,title:r,text:o}}}function nSt(e){return QRe(e)?.text}function sSt(e,t){const n=QRe(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 Rw(e){return Array.isArray(e)?e.map(t=>Rw(t)):Fi(e)?Object.fromEntries(Object.entries(e).map(([t,n])=>[t,Rw(n)])):e}function eEe(e,t){if(e!==void 0)return(!Array.isArray(e)||e.some(n=>typeof n!="string"||n.length===0))&&na(`${t} must be an array of non-empty strings`),[...e]}function jD(e,t,n){if(Array.isArray(e)||na(`${n} must be an array`),e.length>t.maxRows)throw new js("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)&&na(`${n}[${i}][${u}] must be a JSON scalar`),c));return s+=l.length,l}if(Fi(o)){const l={};for(const[c,u]of Object.entries(o))u!==null&&!["string","number","boolean"].includes(typeof u)&&na(`${n}[${i}].${c} must be a JSON scalar`),l[c]=u,s+=1;return l}return na(`${n}[${i}] must be an array or object`)});if(s>t.maxCells)throw new js("LIMIT_EXCEEDED",`${n} exceeds the ${t.maxCells} cell limit`);return r}function rSt(e,t){if(!Fi(e)||typeof e.kind!="string")return na("echarts.data must be an inline or ref dataset object");const n=eEe(e.dimensions,"echarts.data.dimensions");if(e.kind==="inline"){const s=jD(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?na("echarts.data.ref must be a non-empty string"):e.format!==void 0&&e.format!=="csv"&&e.format!=="json"?na("echarts.data.format must be csv or json"):{kind:"ref",ref:e.ref,...e.format?{format:e.format}:{},...n?{dimensions:n}:{}}:na(`Unsupported echarts.data.kind: ${e.kind}`)}function Jde(e,t){if(X_t.test(e))throw new js("UNSAFE_SPEC",`${t} contains an ASCII control character`);const n=e.replace(/[\n\r\t]/g,""),s=e.trim();if(Xde.test(s)||Xde.test(n.trim())||Z_t.test(e)||J_t.test(e)||Q_t.test(e))throw new js("UNSAFE_SPEC",`${t} contains a URL, CSS URL, or unsafe markup`)}function oSt(e,t){for(const r of Object.keys(e))if(!G_t.has(r))throw new js("UNSAFE_SPEC",`echarts.option.${r} is not allowed`);let n=0;const s=(r,o,i)=>{if(n+=1,n>t.maxNodes)throw new js("LIMIT_EXCEEDED",`ECharts option exceeds the ${t.maxNodes} node limit`);if(i>t.maxDepth)throw new js("LIMIT_EXCEEDED",`ECharts option exceeds the ${t.maxDepth} depth limit`);if(typeof r=="string"){Jde(r,o);return}if(Array.isArray(r)){r.forEach((l,c)=>s(l,`${o}[${c}]`,i+1));return}if(Fi(r))for(const[l,c]of Object.entries(r)){const u=l.toLowerCase();if(u==="formatter"){if(typeof c!="string")throw new js("UNSAFE_SPEC",`${o}.${l} must be a string`);Jde(c,`${o}.${l}`);continue}if(K_t.has(u)||Y_t.test(l))throw new js("UNSAFE_SPEC",`${o}.${l} is not allowed`);if(l==="type"&&c==="custom")throw new js("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 js("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)=>{Fi(o)||na(`echarts.option.dataset[${i}] must be an object`),o.source!==void 0&&jD(o.source,t,`echarts.option.dataset[${i}].source`)})}function fG(e,t,n){if(!Fi(e))return na("ECharts specification must be an object");if(Object.prototype.hasOwnProperty.call(e,"option")||Object.prototype.hasOwnProperty.call(e,"data"))return na("Canonical markdown-chart data must be a sibling of spec; spec must contain the ECharts option directly");const s=Rw(e),r=t===void 0?void 0:rSt(t,n);return r&&Object.prototype.hasOwnProperty.call(s,"dataset")?na("echarts.option.dataset cannot be combined with echarts.data"):(oSt(s,n),{option:s,data:r})}function iSt(e,t){if(!Fi(e))return na("echarts-fulldata must contain an object");if(hG(e,new Set(["version","data","option"]),"echarts-fulldata"),e.version!==1)throw new js("UNSUPPORTED_VERSION","Only echarts-fulldata version 1 is supported");if(!Object.prototype.hasOwnProperty.call(e,"data"))return na("echarts-fulldata.data is required");if(!Fi(e.option))return na("echarts-fulldata.option must be an object");const n=tSt(e.data,t);return fG(e.option,n,t)}function aSt(e){const t="default"in e?e.default:e;if(!t||typeof t.init!="function")throw new js("RUNTIME_LOAD_FAILED","The supplied ECharts runtime has no init function");return t}function Qde(e,t){const n=jD(e.source,t,"resolvedDataset.source"),s=e.dimensions?eEe(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 lSt={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 sg(e,t){const n={...Rw(e),...t};for(const[s,r]of Object.entries(e)){const o=t[s];Fi(r)&&Fi(o)&&(n[s]=sg(r,o))}return n}function _3(e,t){return Array.isArray(e)?e.map(n=>Fi(n)?sg(t,n):n):Fi(e)?sg(t,e):e??Rw(t)}function tEe(e){const t=n=>Fi(n)?{...n,appendToBody:!1,confine:!0,enterable:!1,renderMode:"richText"}:n;return Array.isArray(e)?e.map(t):t(e)}function IE(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function cSt(e,t){const n=s=>{if(!IE(s,"top")&&!IE(s,"bottom"))return sg(t,s);const r=Rw(t);return delete r.top,delete r.bottom,sg(r,s)};return Array.isArray(e)?e.map(s=>Fi(s)?n(s):s):Fi(e)?n(e):e??Rw(t)}var uSt=740,nEe=10,ehe=uSt*nEe/100,dSt=24,hSt=24,the=16,fSt=24;function sEe(e){if(typeof e=="number")return Number.isFinite(e)&&e>=0&&e<=ehe?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<=nEe?ehe:null}function pSt(e){return["text","subtext"].some(t=>typeof e[t]=="string"&&e[t].trim().length>0)}function mSt(e){return e.show===!1||!pSt(e)?null:IE(e,"top")?sEe(e.top):IE(e,"bottom")?null:0}function gSt(e){return e.show===!1||!IE(e,"top")?null:sEe(e.top)}function nhe(e){return Array.isArray(e)?e.filter(Fi):Fi(e)?[e]:[]}function vSt(e,t){const n=nhe(e).flatMap(r=>{const o=mSt(r);return o===null?[]:[o+dSt+the]}),s=nhe(t).flatMap(r=>{const o=gSt(r);return o===null?[]:[o+hSt+the]});return Math.max(fSt,...n,...s)}function she(e,t){return Array.isArray(e)?e.map((n,s)=>Fi(n)?sg(t(s),n):n):Fi(e)?sg(t(0),e):e}function rhe(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=sg(s,{lineStyle:{width:2},itemStyle:{borderWidth:1},symbol:"circle",symbolSize:4}):n==="bar"?s=sg(s,{barCategoryGap:"48%",barMaxWidth:42,itemStyle:{borderRadius:[3,3,0,0]}}):n==="pie"&&(s=sg(s,{itemStyle:{borderColor:t.seriesBorder,borderWidth:2}}));const r=sg(s,e);return Object.prototype.hasOwnProperty.call(e,"tooltip")&&(r.tooltip=tEe(_3(e.tooltip,{appendToBody:!1,confine:!0,enterable:!1,renderMode:"richText"}))),r}var rEe=new Set(["pie","funnel","gauge","radar","treemap"]),wSt=new Set([...rEe,"graph","chord","themeRiver"]);function oEe(e){return Array.isArray(e.series)?e.series.filter(Fi):Fi(e.series)?[e.series]:[]}function ySt(e){if(Object.prototype.hasOwnProperty.call(e,"legend"))return!0;const t=oEe(e);return t.some(n=>typeof n.type=="string"&&wSt.has(n.type))?!0:t.filter(n=>typeof n.name=="string"&&n.name.trim().length>0).length>1}function bSt(e){if(!Object.prototype.hasOwnProperty.call(e,"xAxis")&&!Object.prototype.hasOwnProperty.call(e,"yAxis"))return"item";const t=oEe(e);return t.length>0&&t.every(n=>typeof n.type=="string"&&rEe.has(n.type))?"item":"axis"}function xSt(e){return e==null||e==="light"?"light":e==="dark"?"dark":void 0}function kSt(e,t="light"){const n=lSt[t],s=Rw(e);return s.backgroundColor??=n.background,s.color??=[...n.palette],s.textStyle=_3(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=_3(s.title,{textStyle:{color:n.titleText},subtextStyle:{color:n.subtext}})),s.tooltip=tEe(_3(s.tooltip,{trigger:bSt(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}}})),ySt(e)&&(s.legend=cSt(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=_3(s.grid,{top:vSt(s.title,s.legend),right:36,bottom:48,left:24,containLabel:!0}),s.xAxis!==void 0&&(s.xAxis=she(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=she(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=>Fi(r)?rhe(r,n):r):Fi(s.series)&&(s.series=rhe(s.series,n)),s}var Fz={dispose(){}};function _St(e={}){const t={...V_t,...e.limits},n=e.legacySandbox?.resolveLegacyArtifactContent,s=e.legacySandbox?.resolveLegacySandboxFileContent,r=e.legacySandbox?U_t({maxRows:t.maxRows,maxCells:t.maxCells},void 0):void 0,o=e.loadECharts??(async()=>await Ue(()=>import("./index-DohPy72Z.js"),[])),i=async(l,c)=>{if(e.validateDataRef&&!e.validateDataRef(l.ref))throw new js("REF_REJECTED","The host rejected the chart data reference");if(!e.resolveDataRef)throw new js("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 js("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 Qde(h,t).data};return{id:"echarts",aliases:["echarts-fulldata"],matchLanguage:R_t,parse(l,c){return c.language==="echarts-fulldata"?iSt(l,t):fG(l,c.data,t)},parseSource(l,c){return XRe(c.language)?{option:{},data:void 0,legacyEChartSandboxFile:A_t(c.rawLanguage??c.language,l)}:{option:{},data:void 0,legacyEChartQuery:E_t(c.language,l)}},getTitle(l){return nSt(l.option)},async materialize(l,c){if(!l.legacyEChartQuery&&!l.legacyEChartSandboxFile){if(l.data?.kind==="ref"){const p=await i(l.data,c.signal);return p?{parsed:{...l,data:p},data:p}:{parsed:l,data:c.data}}return{parsed:l,data:l.data}}if(l.legacyEChartQuery&&!n)throw new js("REF_RESOLVER_MISSING","legacySandbox is required for this temporary ChatBI query fence");if(l.legacyEChartSandboxFile&&!s)throw new js("REF_RESOLVER_MISSING","legacySandbox is required for this temporary ChatBI sandbox-file fence");let u;try{l.legacyEChartSandboxFile?u=await q_t({block:l.legacyEChartSandboxFile,signal:c.signal,resolveSandboxFileContent:s,limits:r,preserveLegacySandboxError:e.legacySandbox!==void 0}):u=await W_t({block:l.legacyEChartQuery,signal:c.signal,resolveArtifactContent:n,limits:r,preserveLegacySandboxError:!0})}catch(p){if(c.signal.aborted)return{parsed:l,data:c.data};throw p instanceof js||p instanceof ZRe?p:new js("REF_RESOLUTION_FAILED","The temporary ChatBI chart could not be resolved",{cause:p})}if(c.signal.aborted)return{parsed:l,data:c.data};let h;try{h=hIe(u,{maxDepth:t.maxDepth,maxNodes:t.maxNodes})}catch(p){throw p instanceof js?p:new js("SCHEMA_INVALID","Temporary ChatBI resolver returned a non-JSON result",{cause:p})}if(!Fi(h))return na("Temporary ChatBI resolver must return an object");if(!Object.prototype.hasOwnProperty.call(h,"data")||!Object.prototype.hasOwnProperty.call(h,"spec"))return na("Temporary ChatBI resolver must return data and spec");const f=fG(h.spec,h.data,t);return f.data?.kind!=="inline"?na("Temporary ChatBI resolver must return inline data"):{parsed:f,data:f.data}},async mount(l,c,u){if(c.legacyEChartQuery||c.legacyEChartSandboxFile)return na("Temporary ChatBI charts must be materialized before mounting");const h=Rw(c.option);if(u.externalizedTitle&&sSt(h,u.externalizedTitle),c.data){let y;if(c.data.kind==="inline")y=c.data;else{const b=await i(c.data,u.signal);if(!b)return Fz;y=b}const w=Qde(y,t);h.dataset=w.option}if(u.signal.aborted)return Fz;let f;try{f=aSt(await o())}catch(y){throw y instanceof js?y:new js("RUNTIME_LOAD_FAILED","The ECharts runtime could not be loaded",{cause:y})}if(u.signal.aborted)return Fz;let p,m;try{const y=typeof u.theme=="string"||Fi(u.theme)?u.theme:void 0;p=f.init(l,y);const w=xSt(u.theme),b=e.defaultStyle===!1||!w?h:kSt(h,w);p.setOption(b,{notMerge:!0,lazyUpdate:!1}),e.resizeObserver!==!1&&typeof ResizeObserver<"u"&&(m=new ResizeObserver(()=>p?.resize()),m.observe(l))}catch(y){try{m?.disconnect()}catch{}try{p?.dispose()}catch{}throw new js("RENDER_FAILED","ECharts failed to render the chart",{cause:y})}const g=p;let v=!1;return{resize:()=>g.resize(),dispose(){v||(v=!0,m?.disconnect(),g.dispose())}}}}}var qQ=d.createContext(null);function SSt(e){if(d.isValidElement(e))return typeof e.props.children=="string"?e.props.children:void 0}function CSt(e){const t=e.source??SSt(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(qQ.Provider,{value:n},e.children)}function TSt(e){const t=d.useContext(qQ);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(()=>pIe(o),[o]);d.useEffect(()=>{const c=n.current;if(!c)return;const u=new Bpt(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 ISt(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 gIe(e.slice(i,s))||e.slice(s).trim().length>0}function iEe(e,t){return e===ZM||t?.has(e)===!0}function RSt(e={}){return{code({node:n,...s}){return d.createElement("code",s)},pre:function({node:s,children:r,...o}){const i=d.useContext(qQ);if(d.isValidElement(r)){const l=r,u=/(?:^|\s)language-([^\s]+)/.exec(l.props.className??"")?.[1],h=u?.toLowerCase();if(u&&h&&iEe(h,i?.registry)){const f=d.Children.toArray(l.props.children).map(p=>typeof p=="string"||typeof p=="number"?String(p):"").join("");return d.createElement(TSt,{language:u,source:f,streaming:i?.streaming===!0&&!ISt(i.source,s),...e.chartClassName?{className:e.chartClassName}:{},...e.chartStyle?{style:e.chartStyle}:{}})}}return d.createElement("pre",o,r)}}}const ESt=3e4,ASt=["artifact://","session-file://"],jSt=/^[a-z]:/i;function NSt(e={}){const{resolveDataRef:t,validateDataRef:n=OSt,...s}=e,r=e.validateDataRef===void 0,o=t?async(i,l)=>{const c=r?aEe(i):i;if(!c)throw new Error("Chart data reference is not supported.");return $St(Promise.resolve(t(c,l)),"Chart data reference resolution")}:void 0;return new _pt().register(_St({...s,resolveDataRef:o,validateDataRef:n}))}const MSt={registry:NSt()};function PSt(e,t={}){const n=RSt(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&&iEe(c,e))return d.createElement(n,o,r)}return d.createElement(d.Fragment,null,r)}}function LSt({customization:e,source:t,streaming:n,theme:s,children:r}){const o=DSt(e.labels),{t:i}=pt();return a.jsx(CSt,{registry:e.registry,source:t,streaming:n,theme:s,loadingLabel:e.loadingLabel??i("echartsChart.rendering"),labels:o,onError:e.onError,children:r})}function DSt(e){const{t}=pt();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 ohe(e){return/\s/.test(e)||Array.from(e).some(t=>{const n=t.codePointAt(0);return n!==void 0&&(n<=31||n===127)})}function aEe(e){if(e.trim()!==e||!e||ohe(e))return;const t=e.toLowerCase(),n=ASt.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)||ohe(r))return;const o=r.split("/");if(!o.some(i=>i.length===0||i==="."||i===".."||jSt.test(i)))return`${n}${o.join("/")}`}function OSt(e){return aEe(e)!==void 0}function $St(e,t){return new Promise((n,s)=>{const r=globalThis.setTimeout(()=>s(new Error(`${t} timed out.`)),ESt);e.then(n,s).finally(()=>globalThis.clearTimeout(r))})}const BSt="_content_1ns4y_1",FSt="_streamingPlainText_1ns4y_11",zSt="_inlineCode_1ns4y_135",HSt="_link_1ns4y_147",USt="_tableWrapper_1ns4y_157",WSt="_table_1ns4y_157",qSt="_image_1ns4y_187",VSt="_codeBlock_1ns4y_195",GSt="_codeBlockHeader_1ns4y_204",KSt="_codeBlockLang_1ns4y_213",YSt="_codeBlockCopy_1ns4y_221",XSt="_codeBlockContent_1ns4y_244",ZSt="_codeBlockPlain_1ns4y_264",JSt="_mermaidBlock_1ns4y_282",QSt="_mermaidInline_1ns4y_294",eCt="_mermaidStage_1ns4y_308",tCt="_mermaidLoading_1ns4y_331",nCt="_mermaidActions_1ns4y_338",sCt="_mermaidZoomWrapper_1ns4y_343",rCt="_mermaidPannable_1ns4y_358",oCt="_mermaidDragging_1ns4y_362",So={content:BSt,streamingPlainText:FSt,inlineCode:zSt,link:HSt,tableWrapper:USt,table:WSt,image:qSt,codeBlock:VSt,codeBlockHeader:GSt,codeBlockLang:KSt,codeBlockCopy:YSt,codeBlockContent:XSt,codeBlockPlain:ZSt,mermaidBlock:JSt,mermaidInline:QSt,mermaidStage:eCt,mermaidLoading:tCt,mermaidActions:nCt,mermaidZoomWrapper:sCt,mermaidPannable:rCt,mermaidDragging:oCt},iCt=32e3,aCt=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"]),ihe={"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 VQ(e){const t=(e||"").toLowerCase(),n=Object.hasOwn(ihe,t)?ihe[t]:t,s=aCt.has(n)?n:"text";return{label:(e||"").trim()||"text",lang:n,resolvedLang:s}}const lEe=/^(https?:|mailto:)/i,lCt=/^data:image\/(png|jpeg|gif|webp|bmp);base64,/i,cEe=/^data:image\/(png|jpeg|gif|webp);base64,[A-Za-z0-9+/]*={0,2}$/i;function LT(e){if(!e)return!1;const t=e.trim();return t?t.startsWith("#")||t.startsWith("/")&&!t.startsWith("//")?!0:lEe.test(t):!1}function Y0(e,t=!1){if(!e)return!1;const n=e.trim();return n?t?cEe.test(n):n.startsWith("#")||n.startsWith("/")&&!n.startsWith("//")||lCt.test(n)?!0:lEe.test(n):!1}let ahe,lhe=Promise.resolve(),cCt=0;const uCt=5e4,dCt=500,hCt=1e4,che=16;function fCt({code:e}){const{t}=pt(),n=Lw(),s=Va()!=="interactive",[r,o]=d.useState(null),[i,l]=d.useState(null),[c,u]=d.useState("diagram"),[h,f]=Kb(),[p,m]=d.useState(1),[g,v]=d.useState(!1),y=d.useRef(null),[w,b]=d.useState(!1),[x,_]=d.useState(!1),[C,T]=d.useState(null),I=d.useRef(null),j=d.useRef(null),S=n==="light"?"default":"dark",R=.5,E=3,N=.25,A=()=>{m(Y=>Math.min(E,Math.round((Y+N)*100)/100))},L=()=>{m(Y=>Math.max(R,Math.round((Y-N)*100)/100))},$=d.useCallback(()=>{j.current=null,v(!1),m(1);const Y=y.current;Y&&(Y.scrollLeft=0,Y.scrollTop=0),b(!1)},[]),M=d.useCallback(Y=>{const Q=y.current;Q&&(Y.preventDefault(),v(!0),j.current={startX:Y.clientX,startY:Y.clientY,startLeft:Q.scrollLeft,startTop:Q.scrollTop})},[]),U=d.useCallback(Y=>{const{scrollLeft:Q,scrollTop:B}=Y.currentTarget;b(Q!==0||B!==0)},[]),W=d.useCallback(()=>{const Y=y.current;Y&&(_(Y.scrollWidth>Y.clientWidth||Y.scrollHeight>Y.clientHeight),b(Y.scrollLeft!==0||Y.scrollTop!==0))},[]),z=d.useCallback(()=>{const Y=y.current,Q=I.current?.querySelector("svg");if(!Y||!Q)return;const[,,B,X]=(Q.getAttribute("viewBox")??"").split(/[\s,]+/).map(Number),ce=(Q.getAttribute("width")??"").trim(),fe=Number.parseFloat(Q.getAttribute("height")??""),ee=B>0&&X>0,F=ee?B:Number.parseFloat(ce),V=ee?X:fe;if(!(F>0)||!(V>0)){T(null);return}const oe=Y.clientWidth-che*2,ue=ce.endsWith("%")&&oe>0?Math.min(F,oe):F,de=Math.max(0,Y.offsetHeight-Y.clientHeight);T({stageWidth:ue,canvasHeight:ue*V/F+che*2+de})},[]);d.useEffect(()=>{if(!g)return;const Y=B=>{const X=y.current,ce=j.current;!X||!ce||(X.scrollLeft=ce.startLeft-(B.clientX-ce.startX),X.scrollTop=ce.startTop-(B.clientY-ce.startY),b(X.scrollLeft!==0||X.scrollTop!==0))},Q=()=>{j.current=null,v(!1)};return window.addEventListener("mousemove",Y),window.addEventListener("mouseup",Q),window.addEventListener("blur",Q),()=>{window.removeEventListener("mousemove",Y),window.removeEventListener("mouseup",Q),window.removeEventListener("blur",Q)}},[g]),d.useEffect(()=>{$()},[e,$]),d.useLayoutEffect(()=>{z(),W()},[r,p,c,z,W]),d.useEffect(()=>{const Y=y.current;if(!Y)return;const Q=new ResizeObserver(()=>{z(),W()});return Q.observe(Y),()=>Q.disconnect()},[r,c,z,W]),d.useEffect(()=>{let Y=!1;o(null),l(null);const Q=setTimeout(()=>{Ue(()=>import("./mermaid.core-7BsQ3zED.js").then(B=>B.cb),[]).then(async B=>{if(Y)return;const X=B.default,ce=`${S}:${s?"hardened":"runtime"}`,fe=lhe.then(async()=>{if(Y)throw new Error("Mermaid render skipped");ahe!==ce&&(X.initialize({startOnLoad:!1,theme:S,securityLevel:"strict",suppressErrorRendering:!0,...s?{maxTextSize:uCt,maxEdges:dCt}:{},flowchart:{wrappingWidth:300,useMaxWidth:!1}}),ahe=ce);const F=`mermaid-${++cCt}`;if(!s)return X.render(F,e.trim());let V;try{return await Promise.race([X.render(F,e.trim()),new Promise((oe,ue)=>{V=setTimeout(()=>ue(new Error("Mermaid render timed out")),hCt)})])}finally{V!==void 0&&clearTimeout(V)}});lhe=fe.then(()=>{},()=>{});const{svg:ee}=await fe;Y||o(ee)}).catch(B=>{Y||l(B instanceof Error?B.message:"Mermaid render failed")})},150);return()=>{Y=!0,clearTimeout(Q)}},[e,s,S]);const P=()=>{Ih(e).then(()=>{f()}).catch(lg)};return i?a.jsxs("div",{className:So.codeBlock,children:[a.jsx("div",{className:So.codeBlockHeader,children:a.jsx("span",{className:So.codeBlockLang,children:t("mermaid.errorLabel")})}),a.jsx("pre",{className:`${So.codeBlockContent} ${So.codeBlockPlain}`,children:a.jsx("code",{children:e})})]}):a.jsxs("div",{className:So.codeBlock,children:[a.jsxs("div",{className:So.codeBlockHeader,children:[a.jsx("span",{className:So.codeBlockLang,children:t("mermaid.label")}),a.jsxs("span",{className:So.mermaidActions,children:[c==="diagram"&&a.jsxs(a.Fragment,{children:[a.jsx("button",{className:So.codeBlockCopy,onClick:L,title:t("mermaid.zoomOut"),disabled:p<=R,children:t("mermaid.zoomOut")}),a.jsx("button",{className:So.codeBlockCopy,onClick:$,title:t("mermaid.zoomReset"),disabled:p===1&&!w,children:t("mermaid.zoomReset")}),a.jsx("button",{className:So.codeBlockCopy,onClick:A,title:t("mermaid.zoomIn"),disabled:p>=E,children:t("mermaid.zoomIn")})]}),a.jsx("button",{className:So.codeBlockCopy,onClick:()=>u(c==="diagram"?"code":"diagram"),children:t(c==="diagram"?"mermaid.viewCode":"mermaid.viewDiagram")}),a.jsx("button",{className:So.codeBlockCopy,onClick:P,children:t(h?"code.copied":"code.copy")})]})]}),c==="code"?a.jsx("pre",{className:`${So.codeBlockContent} ${So.codeBlockPlain}`,children:a.jsx("code",{children:e})}):r?a.jsx("div",{className:`${So.mermaidZoomWrapper} ${x?So.mermaidPannable:""} ${x&&g?So.mermaidDragging:""}`,ref:y,style:C?{height:C.canvasHeight}:void 0,onMouseDown:M,onDoubleClick:$,onScroll:U,children:a.jsx("div",{className:`${So.mermaidBlock} ${So.mermaidStage}`,ref:I,style:{...C?{width:C.stageWidth}:{},...p===1?{}:{zoom:p}},dangerouslySetInnerHTML:{__html:r}})}):a.jsx("div",{className:`${So.mermaidBlock} ${So.mermaidLoading} ${So.mermaidInline}`,children:a.jsx("span",{children:t("mermaid.rendering")})})]})}function pCt({className:e,children:t,isStreaming:n}){const{t:s}=pt(),r=Lw(),o=Va()==="document",[i,l]=d.useState(null),[c,u]=Kb(),{label:h,lang:f,resolvedLang:p}=VQ(uEe(e)),m=String(t).replace(/\n$/,""),g=r==="light"?"github-light-default":"github-dark-default";d.useEffect(()=>{if(o||n||f==="mermaid"||p==="text"||aG(m)){l(null);return}const y=uxt(m,p,g);if(y!==null){l(y);return}const w=Fde(m,p,g,!0);if(w!==null){l(w);return}l(null);let b=!1;return NRe(p).then(()=>{if(b)return;const x=Fde(m,p,g,!0);x!==null&&l(x)}).catch(x=>{b||(console.warn("[web-shell] highlight failed for lang=%s",p,x),l(null))}),()=>{b=!0}},[m,o,f,p,g,n]);const v=()=>{Ih(m).then(()=>{u()}).catch(lg)};return f==="mermaid"&&!n&&!o?a.jsx(fCt,{code:m}):a.jsxs("div",{className:So.codeBlock,children:[a.jsxs("div",{className:So.codeBlockHeader,children:[a.jsx("span",{className:So.codeBlockLang,children:h}),a.jsx("button",{className:So.codeBlockCopy,onClick:v,children:s(c?"code.copied":"code.copy")})]}),!o&&!n&&i!==null?a.jsx("div",{className:So.codeBlockContent,dangerouslySetInnerHTML:{__html:i}}):a.jsx("pre",{className:`${So.codeBlockContent} ${So.codeBlockPlain}`,children:a.jsx("code",{children:m})})]})}function uEe(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 mCt({children:e}){return a.jsx("code",{className:So.inlineCode,children:e})}function uhe({children:e}){return a.jsx("div",{className:So.tableWrapper,children:a.jsx("table",{className:So.table,children:e})})}const dEe=d.createContext(!1),hEe=d.createContext(void 0),fEe=d.createContext(void 0);function gCt(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:!gIe(e.slice(s,r))&&e.slice(r).trim().length===0}function vCt({className:e,children:t,node:n}){const s=d.useContext(dEe),r=d.useContext(fEe);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 gIe(e.slice(i,s))||e.slice(s).trim().length>0}function iEe(e,t){return e===ZM||t?.has(e)===!0}function RSt(e={}){return{code({node:n,...s}){return d.createElement("code",s)},pre:function({node:s,children:r,...o}){const i=d.useContext(qQ);if(d.isValidElement(r)){const l=r,u=/(?:^|\s)language-([^\s]+)/.exec(l.props.className??"")?.[1],h=u?.toLowerCase();if(u&&h&&iEe(h,i?.registry)){const f=d.Children.toArray(l.props.children).map(p=>typeof p=="string"||typeof p=="number"?String(p):"").join("");return d.createElement(TSt,{language:u,source:f,streaming:i?.streaming===!0&&!ISt(i.source,s),...e.chartClassName?{className:e.chartClassName}:{},...e.chartStyle?{style:e.chartStyle}:{}})}}return d.createElement("pre",o,r)}}}const ESt=3e4,ASt=["artifact://","session-file://"],jSt=/^[a-z]:/i;function NSt(e={}){const{resolveDataRef:t,validateDataRef:n=OSt,...s}=e,r=e.validateDataRef===void 0,o=t?async(i,l)=>{const c=r?aEe(i):i;if(!c)throw new Error("Chart data reference is not supported.");return $St(Promise.resolve(t(c,l)),"Chart data reference resolution")}:void 0;return new _pt().register(_St({...s,resolveDataRef:o,validateDataRef:n}))}const MSt={registry:NSt()};function PSt(e,t={}){const n=RSt(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&&iEe(c,e))return d.createElement(n,o,r)}return d.createElement(d.Fragment,null,r)}}function LSt({customization:e,source:t,streaming:n,theme:s,children:r}){const o=DSt(e.labels),{t:i}=pt();return a.jsx(CSt,{registry:e.registry,source:t,streaming:n,theme:s,loadingLabel:e.loadingLabel??i("echartsChart.rendering"),labels:o,onError:e.onError,children:r})}function DSt(e){const{t}=pt();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 ohe(e){return/\s/.test(e)||Array.from(e).some(t=>{const n=t.codePointAt(0);return n!==void 0&&(n<=31||n===127)})}function aEe(e){if(e.trim()!==e||!e||ohe(e))return;const t=e.toLowerCase(),n=ASt.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)||ohe(r))return;const o=r.split("/");if(!o.some(i=>i.length===0||i==="."||i===".."||jSt.test(i)))return`${n}${o.join("/")}`}function OSt(e){return aEe(e)!==void 0}function $St(e,t){return new Promise((n,s)=>{const r=globalThis.setTimeout(()=>s(new Error(`${t} timed out.`)),ESt);e.then(n,s).finally(()=>globalThis.clearTimeout(r))})}const BSt="_content_1ns4y_1",FSt="_streamingPlainText_1ns4y_11",zSt="_inlineCode_1ns4y_135",HSt="_link_1ns4y_147",USt="_tableWrapper_1ns4y_157",WSt="_table_1ns4y_157",qSt="_image_1ns4y_187",VSt="_codeBlock_1ns4y_195",GSt="_codeBlockHeader_1ns4y_204",KSt="_codeBlockLang_1ns4y_213",YSt="_codeBlockCopy_1ns4y_221",XSt="_codeBlockContent_1ns4y_244",ZSt="_codeBlockPlain_1ns4y_264",JSt="_mermaidBlock_1ns4y_282",QSt="_mermaidInline_1ns4y_294",eCt="_mermaidStage_1ns4y_308",tCt="_mermaidLoading_1ns4y_331",nCt="_mermaidActions_1ns4y_338",sCt="_mermaidZoomWrapper_1ns4y_343",rCt="_mermaidPannable_1ns4y_358",oCt="_mermaidDragging_1ns4y_362",So={content:BSt,streamingPlainText:FSt,inlineCode:zSt,link:HSt,tableWrapper:USt,table:WSt,image:qSt,codeBlock:VSt,codeBlockHeader:GSt,codeBlockLang:KSt,codeBlockCopy:YSt,codeBlockContent:XSt,codeBlockPlain:ZSt,mermaidBlock:JSt,mermaidInline:QSt,mermaidStage:eCt,mermaidLoading:tCt,mermaidActions:nCt,mermaidZoomWrapper:sCt,mermaidPannable:rCt,mermaidDragging:oCt},iCt=32e3,aCt=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"]),ihe={"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 VQ(e){const t=(e||"").toLowerCase(),n=Object.hasOwn(ihe,t)?ihe[t]:t,s=aCt.has(n)?n:"text";return{label:(e||"").trim()||"text",lang:n,resolvedLang:s}}const lEe=/^(https?:|mailto:)/i,lCt=/^data:image\/(png|jpeg|gif|webp|bmp);base64,/i,cEe=/^data:image\/(png|jpeg|gif|webp);base64,[A-Za-z0-9+/]*={0,2}$/i;function LT(e){if(!e)return!1;const t=e.trim();return t?t.startsWith("#")||t.startsWith("/")&&!t.startsWith("//")?!0:lEe.test(t):!1}function Y0(e,t=!1){if(!e)return!1;const n=e.trim();return n?t?cEe.test(n):n.startsWith("#")||n.startsWith("/")&&!n.startsWith("//")||lCt.test(n)?!0:lEe.test(n):!1}let ahe,lhe=Promise.resolve(),cCt=0;const uCt=5e4,dCt=500,hCt=1e4,che=16;function fCt({code:e}){const{t}=pt(),n=Lw(),s=Va()!=="interactive",[r,o]=d.useState(null),[i,l]=d.useState(null),[c,u]=d.useState("diagram"),[h,f]=Kb(),[p,m]=d.useState(1),[g,v]=d.useState(!1),y=d.useRef(null),[w,b]=d.useState(!1),[x,_]=d.useState(!1),[C,T]=d.useState(null),I=d.useRef(null),j=d.useRef(null),S=n==="light"?"default":"dark",R=.5,E=3,N=.25,A=()=>{m(Y=>Math.min(E,Math.round((Y+N)*100)/100))},L=()=>{m(Y=>Math.max(R,Math.round((Y-N)*100)/100))},$=d.useCallback(()=>{j.current=null,v(!1),m(1);const Y=y.current;Y&&(Y.scrollLeft=0,Y.scrollTop=0),b(!1)},[]),M=d.useCallback(Y=>{const Q=y.current;Q&&(Y.preventDefault(),v(!0),j.current={startX:Y.clientX,startY:Y.clientY,startLeft:Q.scrollLeft,startTop:Q.scrollTop})},[]),U=d.useCallback(Y=>{const{scrollLeft:Q,scrollTop:B}=Y.currentTarget;b(Q!==0||B!==0)},[]),W=d.useCallback(()=>{const Y=y.current;Y&&(_(Y.scrollWidth>Y.clientWidth||Y.scrollHeight>Y.clientHeight),b(Y.scrollLeft!==0||Y.scrollTop!==0))},[]),z=d.useCallback(()=>{const Y=y.current,Q=I.current?.querySelector("svg");if(!Y||!Q)return;const[,,B,X]=(Q.getAttribute("viewBox")??"").split(/[\s,]+/).map(Number),ce=(Q.getAttribute("width")??"").trim(),fe=Number.parseFloat(Q.getAttribute("height")??""),ee=B>0&&X>0,F=ee?B:Number.parseFloat(ce),V=ee?X:fe;if(!(F>0)||!(V>0)){T(null);return}const oe=Y.clientWidth-che*2,ue=ce.endsWith("%")&&oe>0?Math.min(F,oe):F,de=Math.max(0,Y.offsetHeight-Y.clientHeight);T({stageWidth:ue,canvasHeight:ue*V/F+che*2+de})},[]);d.useEffect(()=>{if(!g)return;const Y=B=>{const X=y.current,ce=j.current;!X||!ce||(X.scrollLeft=ce.startLeft-(B.clientX-ce.startX),X.scrollTop=ce.startTop-(B.clientY-ce.startY),b(X.scrollLeft!==0||X.scrollTop!==0))},Q=()=>{j.current=null,v(!1)};return window.addEventListener("mousemove",Y),window.addEventListener("mouseup",Q),window.addEventListener("blur",Q),()=>{window.removeEventListener("mousemove",Y),window.removeEventListener("mouseup",Q),window.removeEventListener("blur",Q)}},[g]),d.useEffect(()=>{$()},[e,$]),d.useLayoutEffect(()=>{z(),W()},[r,p,c,z,W]),d.useEffect(()=>{const Y=y.current;if(!Y)return;const Q=new ResizeObserver(()=>{z(),W()});return Q.observe(Y),()=>Q.disconnect()},[r,c,z,W]),d.useEffect(()=>{let Y=!1;o(null),l(null);const Q=setTimeout(()=>{Ue(()=>import("./mermaid.core-Bk7ZiySi.js").then(B=>B.cb),[]).then(async B=>{if(Y)return;const X=B.default,ce=`${S}:${s?"hardened":"runtime"}`,fe=lhe.then(async()=>{if(Y)throw new Error("Mermaid render skipped");ahe!==ce&&(X.initialize({startOnLoad:!1,theme:S,securityLevel:"strict",suppressErrorRendering:!0,...s?{maxTextSize:uCt,maxEdges:dCt}:{},flowchart:{wrappingWidth:300,useMaxWidth:!1}}),ahe=ce);const F=`mermaid-${++cCt}`;if(!s)return X.render(F,e.trim());let V;try{return await Promise.race([X.render(F,e.trim()),new Promise((oe,ue)=>{V=setTimeout(()=>ue(new Error("Mermaid render timed out")),hCt)})])}finally{V!==void 0&&clearTimeout(V)}});lhe=fe.then(()=>{},()=>{});const{svg:ee}=await fe;Y||o(ee)}).catch(B=>{Y||l(B instanceof Error?B.message:"Mermaid render failed")})},150);return()=>{Y=!0,clearTimeout(Q)}},[e,s,S]);const P=()=>{Ih(e).then(()=>{f()}).catch(lg)};return i?a.jsxs("div",{className:So.codeBlock,children:[a.jsx("div",{className:So.codeBlockHeader,children:a.jsx("span",{className:So.codeBlockLang,children:t("mermaid.errorLabel")})}),a.jsx("pre",{className:`${So.codeBlockContent} ${So.codeBlockPlain}`,children:a.jsx("code",{children:e})})]}):a.jsxs("div",{className:So.codeBlock,children:[a.jsxs("div",{className:So.codeBlockHeader,children:[a.jsx("span",{className:So.codeBlockLang,children:t("mermaid.label")}),a.jsxs("span",{className:So.mermaidActions,children:[c==="diagram"&&a.jsxs(a.Fragment,{children:[a.jsx("button",{className:So.codeBlockCopy,onClick:L,title:t("mermaid.zoomOut"),disabled:p<=R,children:t("mermaid.zoomOut")}),a.jsx("button",{className:So.codeBlockCopy,onClick:$,title:t("mermaid.zoomReset"),disabled:p===1&&!w,children:t("mermaid.zoomReset")}),a.jsx("button",{className:So.codeBlockCopy,onClick:A,title:t("mermaid.zoomIn"),disabled:p>=E,children:t("mermaid.zoomIn")})]}),a.jsx("button",{className:So.codeBlockCopy,onClick:()=>u(c==="diagram"?"code":"diagram"),children:t(c==="diagram"?"mermaid.viewCode":"mermaid.viewDiagram")}),a.jsx("button",{className:So.codeBlockCopy,onClick:P,children:t(h?"code.copied":"code.copy")})]})]}),c==="code"?a.jsx("pre",{className:`${So.codeBlockContent} ${So.codeBlockPlain}`,children:a.jsx("code",{children:e})}):r?a.jsx("div",{className:`${So.mermaidZoomWrapper} ${x?So.mermaidPannable:""} ${x&&g?So.mermaidDragging:""}`,ref:y,style:C?{height:C.canvasHeight}:void 0,onMouseDown:M,onDoubleClick:$,onScroll:U,children:a.jsx("div",{className:`${So.mermaidBlock} ${So.mermaidStage}`,ref:I,style:{...C?{width:C.stageWidth}:{},...p===1?{}:{zoom:p}},dangerouslySetInnerHTML:{__html:r}})}):a.jsx("div",{className:`${So.mermaidBlock} ${So.mermaidLoading} ${So.mermaidInline}`,children:a.jsx("span",{children:t("mermaid.rendering")})})]})}function pCt({className:e,children:t,isStreaming:n}){const{t:s}=pt(),r=Lw(),o=Va()==="document",[i,l]=d.useState(null),[c,u]=Kb(),{label:h,lang:f,resolvedLang:p}=VQ(uEe(e)),m=String(t).replace(/\n$/,""),g=r==="light"?"github-light-default":"github-dark-default";d.useEffect(()=>{if(o||n||f==="mermaid"||p==="text"||aG(m)){l(null);return}const y=uxt(m,p,g);if(y!==null){l(y);return}const w=Fde(m,p,g,!0);if(w!==null){l(w);return}l(null);let b=!1;return NRe(p).then(()=>{if(b)return;const x=Fde(m,p,g,!0);x!==null&&l(x)}).catch(x=>{b||(console.warn("[web-shell] highlight failed for lang=%s",p,x),l(null))}),()=>{b=!0}},[m,o,f,p,g,n]);const v=()=>{Ih(m).then(()=>{u()}).catch(lg)};return f==="mermaid"&&!n&&!o?a.jsx(fCt,{code:m}):a.jsxs("div",{className:So.codeBlock,children:[a.jsxs("div",{className:So.codeBlockHeader,children:[a.jsx("span",{className:So.codeBlockLang,children:h}),a.jsx("button",{className:So.codeBlockCopy,onClick:v,children:s(c?"code.copied":"code.copy")})]}),!o&&!n&&i!==null?a.jsx("div",{className:So.codeBlockContent,dangerouslySetInnerHTML:{__html:i}}):a.jsx("pre",{className:`${So.codeBlockContent} ${So.codeBlockPlain}`,children:a.jsx("code",{children:m})})]})}function uEe(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 mCt({children:e}){return a.jsx("code",{className:So.inlineCode,children:e})}function uhe({children:e}){return a.jsx("div",{className:So.tableWrapper,children:a.jsx("table",{className:So.table,children:e})})}const dEe=d.createContext(!1),hEe=d.createContext(void 0),fEe=d.createContext(void 0);function gCt(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:!gIe(e.slice(s,r))&&e.slice(r).trim().length===0}function vCt({className:e,children:t,node:n}){const s=d.useContext(dEe),r=d.useContext(fEe);return e?.startsWith("language-")||typeof t=="string"&&t.includes(`
|
|
1619
1619
|
`)?a.jsx(wCt,{className:e,isStreaming:s,isIncomplete:gCt(r,n,s),children:t}):a.jsx(mCt,{children:t})}function wCt({className:e,children:t,isStreaming:n,isIncomplete:s}){const r=d.useContext(hEe),o=Lw(),{markdown:i}=xd(),l=String(t),c=l.replace(/\n$/,""),u=a.jsx(pCt,{className:e,isStreaming:n,children:l}),h=uEe(e),{resolvedLang:f}=VQ(h);if(!!r&&!!e&&!!h)try{const m=i?.renderCodeBlock?.({language:h,resolvedLanguage:f,className:e,code:c,isStreaming:!!n,isIncomplete:!!s,source:r,theme:o});if(m!=null&&typeof m!="boolean")return a.jsx(hg,{fallback:u,label:`custom code block component render (lang=${h})`,resetKeys:[h,r,o,n?"streaming":"settled",s?"incomplete":"complete",c],children:m})}catch(m){console.error("[web-shell] custom code block renderer call failed (lang=%s):",h,m)}return u}function yCt({children:e}){return a.jsx(a.Fragment,{children:e})}const pG=/^o1-code-session:\/\//i;function dhe(e,t=!1){return t&&cEe.test(e.trim())||pG.test(e.trim())?e:uIe(e)}function pEe({href:e,children:t,node:n,id:s,"aria-label":r,"aria-describedby":o}){const i=Va(),l=_f();if((n?.properties.dataFootnoteRef!==void 0||n?.properties.dataFootnoteBackref!==void 0)&&e?.startsWith("#"))return a.jsx("a",{id:s,href:e,className:So.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 p=h.currentTarget.getRootNode().getElementById(e.slice(1));p&&(h.preventDefault(),p.scrollIntoView({block:"nearest"}),!p.hasAttribute("tabindex")&&p.tagName!=="BUTTON"&&(p.tabIndex=-1),p.focus({preventScroll:!0}))},children:t});if(e&&pG.test(e.trim())){if(i!=="interactive")return a.jsx("span",{className:So.link,children:t});const h=e.trim().replace(pG,"");return a.jsx("a",{href:"#",role:"button",className:So.link,onClick:f=>{f.preventDefault(),f.stopPropagation(),window.dispatchEvent(new CustomEvent("o1-code:open-session",{detail:h}))},children:t})}const u=LT(e)?e:void 0;return a.jsx("a",{href:u,target:"_blank",rel:"noopener noreferrer",className:So.link,onClick:h=>l(h,u),children:t})}function bCt({src:e,alt:t}){const n=Va(),s=Y0(e,n==="document")?e:void 0;return a.jsx("img",{src:s,alt:t||"",className:So.image})}function xCt(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 mEe(e="basic",t=""){return{code:vCt,pre:yCt,a:pEe,img:bCt,sup:qRe,section:VRe,table({children:n}){if(e==="advanced"){const s=a.jsx(uhe,{children:n});return a.jsx(hg,{fallback:s,label:"enhanced markdown table",resetKeys:[t],children:a.jsx(g_t,{fallback:s,children:n})})}return a.jsx(uhe,{children:n})}}}const kCt=mEe(),_Ct=d.memo(function({content:t,components:n,remarkPlugins:s,rehypePlugins:r,urlTransform:o}){return a.jsx(fpt,{components:n,remarkPlugins:s,rehypePlugins:r,urlTransform:o,children:t})}),cp=d.memo(function({content:t,source:n,isStreaming:s,tableMode:r}){const{markdown:o,markdownTableMode:i}=xd(),l=Lw(),c=Va()==="document",u=`footnote-${d.useId()}-`,h=n?o:void 0,f=xCt(t??"",s),p=s===!0&&f.length>iCt,m=d.useMemo(()=>f&&n&&h?.transformMarkdown?h.transformMarkdown(f,{source:n,isStreaming:s===!0}):f,[n,h,f,s]),g=s?"basic":r??i??"basic",v=d.useMemo(()=>g==="advanced"?mEe("advanced",m):kCt,[g,m]),y=h?.components,w=h?.getInlineFootnoteIcon,b=h?.mountFootnotePreview,x=d.useMemo(()=>{if(!y&&!w&&!b)return v;const N={...v,...y,...g==="advanced"?{table:v.table}:{}},A=y?.a;return y&&(N.a=L=>{if(L.node?.properties.dataFootnoteRef!==void 0||L.node?.properties.dataFootnoteBackref!==void 0||!A)return a.jsx(pEe,{...L});if(typeof A!="string")return d.createElement(A,L);const{node:M,...U}=L;return d.createElement(A,U)}),y?.sup||(N.sup=L=>a.jsx(qRe,{...L,linkComponent:A,iconResolver:w,mountPreview:b}),N.section=L=>a.jsx(VRe,{...L,sectionComponent:y?.section})),N},[v,g,y,w,b]),_=!c&&n==="assistant"&&!y?.code&&!y?.pre?h?.chart??(h?.renderCodeBlock?void 0:MSt):void 0,C=d.useMemo(()=>_?PSt(_.registry,{chartClassName:_.chartClassName,chartStyle:{minHeight:360,..._.chartStyle}}):void 0,[_]),T=d.useMemo(()=>C?{...x,pre:C}:x,[C,x]),I=d.useMemo(()=>h?.remarkPlugins?[kue,lde,xde,...h.remarkPlugins]:[kue,lde,xde],[h?.remarkPlugins]),j=d.useMemo(()=>[Twt,...h?.rehypePlugins??[],[S_t,{prefix:u,group:!c&&!y?.sup,safeHref:LT,safeImage:Y0,transformUrl:dhe}]],[h?.rehypePlugins,u,c,y?.sup]),S=d.useMemo(()=>N=>dhe(N,c),[c]);if(!t)return null;if(p)return a.jsx("div",{className:n!=="thinking"?So.content:void 0,"data-markdown-source":n,"data-markdown-streaming-plain-text":"true",children:a.jsx("pre",{className:So.streamingPlainText,children:m})});const R=a.jsx(_Ct,{content:m,components:T,remarkPlugins:I,rehypePlugins:j,urlTransform:S}),E=_?a.jsx(LSt,{customization:_,source:m,streaming:!!s,theme:l,children:R}):R;return a.jsx("div",{className:n!=="thinking"?So.content:void 0,"data-markdown-source":n,children:a.jsx(dEe.Provider,{value:!!s,children:a.jsx(hEe.Provider,{value:n,children:a.jsx(fEe.Provider,{value:m,children:E})})})})}),zz=/https?:\/\/[A-Za-z0-9\-._~:/?#[\]{}@!$&'()*+,;=%]+/gi,SCt=new Set([...".,;:!?'*_~"]),CCt={")":"(","]":"[","}":"{"},TCt=/^https?:\/\/./i;function hhe(e,t){let n=0;for(const s of e)s===t&&(n+=1);return n}function ICt(e){const t={};for(const[s,r]of Object.entries(CCt))t[s]=hhe(e,s)-hhe(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(!SCt.has(s))break;n--}return e.slice(0,n)}function RCt(e){const t=[];let n=0;zz.lastIndex=0;for(let s=zz.exec(e);s!==null;s=zz.exec(e)){const r=ICt(s[0]);if(!TCt.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 T7=d.memo(function({text:t}){const n=_f(),s=d.useMemo(()=>RCt(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=LT(i)?i:void 0;return a.jsx("a",{href:l,target:"_blank",rel:"noopener noreferrer",className:So.link,onClick:c=>n(c,l),children:r.value},o)})}),ECt="_flash_96ig5_1",Ew={flash:ECt},ACt="_chatMessageRow_qnd03_41",jCt="_chatMessageColumn_qnd03_48",NCt="_chatBubble_qnd03_55",MCt="_scheduledTaskBubble_qnd03_68",PCt="_scheduledTaskRun_qnd03_76",LCt="_scheduledTaskHeader_qnd03_83",DCt="_scheduledTaskIcon_qnd03_90",OCt="_scheduledTaskHeading_qnd03_108",$Ct="_scheduledTaskEyebrow_qnd03_115",BCt="_scheduledTaskName_qnd03_122",FCt="_scheduledTaskMeta_qnd03_131",zCt="_scheduledTaskMetaItem_qnd03_138",HCt="_scheduledTaskBadge_qnd03_158",UCt="_scheduledTaskId_qnd03_170",WCt="_scheduledTaskPrompt_qnd03_181",qCt="_sendFailure_qnd03_191",VCt="_retryButton_qnd03_201",GCt="_editArea_qnd03_229",KCt="_editInput_qnd03_237",YCt="_editActions_qnd03_258",XCt="_editCancel_qnd03_264",ZCt="_editSubmit_qnd03_265",JCt="_chatContent_qnd03_294",QCt="_messageTag_qnd03_299",e2t="_messageTagTooltip_qnd03_317",t2t="_messageTagClickable_qnd03_351",n2t="_messageTagIcon_qnd03_364",s2t="_messageTagLabel_qnd03_376",r2t="_messageTagValue_qnd03_377",o2t="_chatContentCollapsed_qnd03_400",i2t="_toggleButton_qnd03_405",a2t="_toggleIcon_qnd03_426",l2t="_toggleIconExpanded_qnd03_433",c2t="_chatImages_qnd03_437",u2t="_chatImageThumb_qnd03_445",d2t="_chatImageThumbInteractive_qnd03_453",h2t="_chatFiles_qnd03_462",f2t="_chatFileChip_qnd03_470",p2t="_chatFileChipPreviewable_qnd03_483",m2t="_fileTagIcon_qnd03_492",po={chatMessageRow:ACt,chatMessageColumn:jCt,chatBubble:NCt,scheduledTaskBubble:MCt,scheduledTaskRun:PCt,scheduledTaskHeader:LCt,scheduledTaskIcon:DCt,scheduledTaskHeading:OCt,scheduledTaskEyebrow:$Ct,scheduledTaskName:BCt,scheduledTaskMeta:FCt,scheduledTaskMetaItem:zCt,scheduledTaskBadge:HCt,scheduledTaskId:UCt,scheduledTaskPrompt:WCt,sendFailure:qCt,retryButton:VCt,editArea:GCt,editInput:KCt,editActions:YCt,editCancel:XCt,editSubmit:ZCt,chatContent:JCt,messageTag:QCt,messageTagTooltip:e2t,messageTagClickable:t2t,messageTagIcon:n2t,messageTagLabel:s2t,messageTagValue:r2t,chatContentCollapsed:o2t,toggleButton:i2t,toggleIcon:a2t,toggleIconExpanded:l2t,chatImages:c2t,chatImageThumb:u2t,chatImageThumbInteractive:d2t,chatFiles:h2t,chatFileChip:f2t,chatFileChipPreviewable:p2t,fileTagIcon:m2t},g2t="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 v2t(e){const t=`
|
|
1620
1620
|
|
|
1621
1621
|
${g2t}
|
|
@@ -2213,7 +2213,7 @@ ${i("terminal.notice.protocolMismatch")}`),ce.close(4002,"Terminal protocol mism
|
|
|
2213
2213
|
* Copyright 2025 Qwen Team
|
|
2214
2214
|
* SPDX-License-Identifier: Apache-2.0
|
|
2215
2215
|
*/const t3n=250,BU={truncated:!1,status:"idle"};function n3n(e){if(e instanceof Error&&e.message)return e.message;const t=String(e??"");return t.length>0?t:"Unknown error"}function s3n(e){return e.replayError?{kind:"unreadable",message:e.replayError}:e.partial?{kind:"partial"}:void 0}function r3n(e,t={}){const n=t.pageSize??t3n,[s,r]=d.useState(BU),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=s3n(h);if(f!==void 0){r(p=>({...p,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:n3n(h)}}))})},[e,n]);d.useEffect(()=>{if(!e){o.current+=1,r(BU);return}return r(BU),i(),()=>{o.current+=1}},[e,i]);const l=s.events;return{trajectory:d.useMemo(()=>l===void 0?void 0:ZIn(e3n(l)),[l]),status:s.status,...s.error!==void 0?{error:s.error}:{},truncated:s.truncated,refresh:i}}const o3n="_panel_1ploj_1",i3n="_header_1ploj_8",a3n="_summary_1ploj_17",l3n="_headerActions_1ploj_26",c3n="_headerButton_1ploj_33",u3n="_iconButton_1ploj_54",d3n="_error_1ploj_78",h3n="_notice_1ploj_91",f3n="_tableWrap_1ploj_100",p3n="_placeholder_1ploj_107",m3n="_scroll_1ploj_114",g3n="_olderBar_1ploj_126",v3n="_olderNotice_1ploj_132",w3n="_virtualBody_1ploj_137",y3n="_virtualRow_1ploj_142",b3n="_turnHeader_1ploj_151",x3n="_turnTitle_1ploj_167",k3n="_turnSummary_1ploj_171",_3n="_record_1ploj_179",S3n="_nestMarker_1ploj_198",C3n="_selected_1ploj_203",T3n="_badge_1ploj_208",I3n="_text_1ploj_221",R3n="_faint_1ploj_230",E3n="_metrics_1ploj_235",A3n="_toneError_1ploj_244",j3n="_toneMuted_1ploj_248",Zi={panel:o3n,header:i3n,summary:a3n,headerActions:l3n,headerButton:c3n,iconButton:u3n,error:d3n,notice:h3n,tableWrap:f3n,placeholder:p3n,scroll:m3n,olderBar:g3n,olderNotice:v3n,virtualBody:w3n,virtualRow:y3n,turnHeader:b3n,turnTitle:x3n,turnSummary:k3n,record:_3n,nestMarker:S3n,selected:C3n,badge:T3n,text:I3n,faint:R3n,metrics:E3n,toneError:A3n,toneMuted:j3n},mve=34;function gve(e){return e>=999950?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function N3n(e){return`${gve(e.inputTokens)} → ${gve(e.outputTokens)}`}const M3n=/-call_[A-Za-z0-9]+$/;function P3n(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(M3n,"")}function PR(e){const t=e.trim(),n=t.indexOf(`
|
|
2216
|
-
`);return n===-1?t:t.slice(0,n)}function L3n(e,t){if(e.kind==="request"){const n=[gd(e.timing.durationMs)];return e.timing.ttftMs!==void 0&&n.push(t("trajectory.ttft",{duration:gd(e.timing.ttftMs)})),e.usage&&n.push(N3n(e.usage)),n}if(e.kind==="tool"){const n=[];if(e.timing&&n.push(gd(e.timing.durationMs)),e.subagentSummary){const{requests:s,tools:r,requestMs:o}=e.subagentSummary;n.push(t("trajectory.subagentRollup",{requests:s,tools:r,duration:gd(o)}))}return n}return[]}function vve(e){const t=e.toolStatus??e.block.status;if(t==="error"||t==="failed")return Zi.toneError;if(t==="cancelled")return Zi.toneMuted}function D3n(e,t){switch(e.kind){case"user":return{badge:t("trajectory.badge.user"),text:PR(e.block.text)};case"request":{const n=P3n(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:Zi.toneError}:{},text:s?`${r} · ${t("trajectory.requestFailed")}`:r}}case"message":return{badge:e.thought?t("trajectory.badge.thought"):t("trajectory.badge.message"),text:PR(e.block.text),faint:e.thought};case"tool":return{badge:e.block.toolName??t("trajectory.badge.tool"),...vve(e)?{badgeTone:vve(e)}:{},text:e.block.title||(e.block.toolName??"")};default:return O3n(e.block,t)}}function O3n(e,t){switch(e.kind){case"shell":return{badge:t("trajectory.badge.shell"),text:PR(e.text)};case"user_shell":return{badge:t("trajectory.badge.shell"),text:PR(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:Zi.toneError}:{},text:PR(e.text),faint:e.kind!=="error"};case"prompt_cancelled":return{badge:t("trajectory.badge.cancelled"),badgeTone:Zi.toneMuted,text:e.reason??t("trajectory.cancelled"),faint:!0};default:return{badge:t("trajectory.badge.other"),text:""}}}function $3n(e){return e.rows.some(t=>t.kind==="request"||t.kind==="tool"&&t.timing!==void 0)}function B3n({loadPage:e}){const{t}=pt(),{trajectory:n,status:s,error:r,truncated:o,refresh:i}=r3n(e),[l,c]=d.useState(void 0),u=d.useRef(null),h=d.useRef(!1),f=d.useRef(0),p=d.useId(),m=d.useCallback(S=>`${p}-row-${S}`,[p]),g=d.useCallback((S,R)=>{S.scrollTop=R,f.current=S.scrollTop},[]),v=d.useMemo(()=>{if(!n)return[];const S=new Map(n.rows.map(E=>[E.key,E])),R=[];for(const E of n.turns){const N=E.userRowKey??`ordinal:${E.index}`;R.push({kind:"turn",key:`turn:${N}`,turn:E});for(const A of E.rowKeys){const L=S.get(A);L&&R.push({kind:"row",key:A,row:L})}}return R},[n]),y=v4e({count:v.length,getScrollElement:()=>u.current,getItemKey:S=>v[S]?.key??S,estimateSize:()=>mve,overscan:12}),w=v.length>0;d.useLayoutEffect(()=>{const S=u.current;if(!S||typeof ResizeObserver>"u")return;let R=0;const E=()=>{S.scrollTop===0&&f.current>0&&(S.scrollTop=f.current)},N=new ResizeObserver(()=>{E(),R=requestAnimationFrame(E)});return N.observe(S),()=>{N.disconnect(),R!==0&&cancelAnimationFrame(R)}},[w]),d.useEffect(()=>{if(s!=="ready"||h.current||v.length===0)return;h.current=!0;const S=u.current;S&&g(S,S.scrollHeight)},[g,s,v.length]);const b=d.useMemo(()=>l===void 0?-1:v.findIndex(S=>S.key===l),[l,v]),x=d.useCallback(S=>{if(v.length===0)return;const R=Math.min(Math.max(S,0),v.length-1);c(v[R].key),y.scrollToIndex(R,{align:"auto"})},[y,v]),_=d.useCallback(S=>{c(S),u.current?.focus({preventScroll:!0})},[]),C=d.useCallback(S=>{if(v.length===0)return;const R=b<0?-1:b;S.key==="ArrowDown"?(S.preventDefault(),x(R+1)):S.key==="ArrowUp"?(S.preventDefault(),x(R<=0?0:R-1)):S.key==="Home"?(S.preventDefault(),x(0)):S.key==="End"&&(S.preventDefault(),x(v.length-1))},[x,b,v]),T=d.useMemo(()=>{if(!n)return;let S=0,R=0,E=0;for(const N of n.turns)S+=N.requestCount,R+=N.toolCount,E+=N.requestMs;return{turns:n.turns.length,requests:S,tools:R,durationMs:E}},[n]),I=s==="ready"&&v.length===0,j=n!==void 0&&v.length>0&&!$3n(n);return a.jsxs("div",{className:Zi.panel,"data-testid":"trajectory-panel",children:[a.jsxs("div",{className:Zi.header,children:[a.jsx("div",{className:Zi.summary,children:T?a.jsx("span",{"data-testid":"trajectory-totals",children:t("trajectory.totals",{turns:T.turns,requests:T.requests,tools:T.tools,duration:T.durationMs>0?gd(T.durationMs):"—"})}):a.jsx("span",{children:t("trajectory.title")})}),a.jsx("div",{className:Zi.headerActions,children:a.jsx("button",{type:"button",className:Zi.iconButton,onClick:i,disabled:!e||s==="loading",title:t("common.refresh"),"aria-label":t("common.refresh"),children:a.jsx(ym,{size:14,strokeWidth:1.6})})})]}),r!==void 0&&a.jsxs("div",{className:Zi.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:Zi.headerButton,onClick:i,disabled:s==="loading",children:t("common.retry")})]}),j&&a.jsx("div",{className:Zi.notice,role:"status",children:t("trajectory.noTiming")}),a.jsx("div",{className:Zi.tableWrap,children:v.length===0?s==="error"?null:a.jsx("div",{className:Zi.placeholder,role:"status",children:t(I?"trajectory.empty":"common.loading")}):a.jsxs(a.Fragment,{children:[o&&a.jsx("div",{className:Zi.olderBar,children:a.jsx("span",{className:Zi.olderNotice,"data-testid":"trajectory-truncated",children:t("trajectory.truncated")})}),a.jsx("div",{ref:u,className:Zi.scroll,role:"grid",tabIndex:0,"aria-label":t("trajectory.title"),"aria-rowcount":v.length,"aria-activedescendant":b>=0?m(b):void 0,onKeyDown:C,onScroll:S=>{f.current=S.currentTarget.scrollTop},"data-testid":"trajectory-rows",children:a.jsx("div",{className:Zi.virtualBody,style:{height:`${y.getTotalSize()}px`},children:y.getVirtualItems().map(S=>{const R=v[S.index];return a.jsx("div",{id:m(S.index),className:Zi.virtualRow,style:{height:`${mve}px`,transform:`translateY(${S.start}px)`},role:"row","aria-rowindex":S.index+1,children:R.kind==="turn"?a.jsx(F3n,{turn:R.turn,selected:R.key===l,onSelect:()=>_(R.key)}):a.jsx(z3n,{row:R.row,selected:R.key===l,onSelect:()=>_(R.key)})},S.key)})})})]})})]})}function F3n({turn:e,selected:t,onSelect:n}){const{t:s}=pt();return a.jsxs("div",{className:`${Zi.turnHeader} ${t?Zi.selected:""}`,onClick:n,"aria-selected":t,"data-selected":t?"true":void 0,role:"gridcell","data-testid":"trajectory-turn",children:[a.jsx("span",{className:Zi.turnTitle,children:e.partial?s("trajectory.turnPartial",{index:e.index}):s("trajectory.turn",{index:e.index})}),a.jsx("span",{className:Zi.turnSummary,children:s("trajectory.turnSummary",{requests:e.requestCount,tools:e.toolCount,duration:e.requestMs>0?gd(e.requestMs):"—"})})]})}function z3n({row:e,selected:t,onSelect:n}){const{t:s}=pt(),r=D3n(e,s),o=L3n(e,s);return a.jsxs("div",{className:`${Zi.record} ${t?Zi.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(wrt,{size:12,strokeWidth:1.6,className:Zi.nestMarker,"aria-hidden":"true"}),a.jsx("span",{className:`${Zi.badge} ${r.badgeTone??""}`,children:r.badge}),a.jsx("span",{className:`${Zi.text} ${r.faint?Zi.faint:""}`,children:r.text}),a.jsx("span",{className:Zi.metrics,"data-testid":"trajectory-row-metrics",children:o.length>0?o.join(" · "):"—"})]})}const H3n="_panel_pwtdr_1",U3n="_toolbar_pwtdr_5",W3n="_actions_pwtdr_15",q3n="_feedback_pwtdr_21",V3n="_state_pwtdr_31",_v={panel:H3n,toolbar:U3n,actions:W3n,feedback:q3n,state:V3n};function G3n({sessionActions:e,sessionId:t,controls:n}){const{t:s}=pt(),[r,o]=d.useState(null),[i,l]=d.useState(!0),[c,u]=d.useState(!1),h=d.useRef(0),f=d.useRef(()=>{}),p=d.useRef(null),m=n?.sessionId===t?n:void 0,g=m?.getContextUsage??e?.getContextUsage,v=d.useRef(m);v.current=m;const y=m?.result,[w,b]=d.useState(y),x=!!(y&&y!==w&&(y.kind!=="completed"||!c));d.useEffect(()=>{y?.kind==="completed"&&(h.current++,o(y.usage),u(!1))},[y]),d.useEffect(()=>{let T=!0,I=!1;const j=v.current?.result;o(R=>R?.sessionId===t?R:j?.kind==="completed"?j.usage:null),u(!1),l(!!g);const S=async()=>{if(!T||I||!g)return;I=!0,l(!0),u(!1);const R=h.current,E=p.current,N=E&&E.getContextUsage===g&&E.sessionId===t?E:{getContextUsage:g,sessionId:t,promise:g({detail:!0,silent:!0,...v.current?.result?{syncCounters:!0}:{}})};p.current=N;try{const A=await N.promise;if(!T||R!==h.current)return;o(A.sessionId===t&&A.usage.contextWindowSize>0?A:null)}catch(A){if(!T||R!==h.current)return;u(TZ(A)?"transient":"hard")}finally{I=!1,p.current===N&&(p.current=null),T&&l(!1)}};return f.current=()=>void S(),S(),()=>{T=!1}},[g,t]);const _=!g||i||m?.compressing,C=()=>{b(y),f.current()};return a.jsxs("div",{className:_v.panel,"aria-busy":i,children:[a.jsxs("div",{className:_v.toolbar,children:[a.jsx("span",{children:s("contextUsage.title")}),a.jsxs("div",{className:_v.actions,children:[a.jsx(Mt,{type:"button",variant:"ghost",size:"icon-sm","aria-label":s("contextUsage.refresh"),title:s("contextUsage.refresh"),disabled:_,onClick:C,children:a.jsx(ym,{"aria-hidden":"true"})}),a.jsx("span",{title:m?.compressing?void 0:m?.canCompress?i?s("common.loading"):void 0:s("contextUsage.compressUnavailable"),children:a.jsx(Mt,{type:"button",variant:"outline",size:"sm",disabled:!m?.canCompress||i,onClick:()=>void m?.compress(),children:s(m?.compressing?"contextUsage.compressing":"contextUsage.compress")})})]})]}),(m?.compressing||x)&&a.jsx(a8e,{controls:m,className:_v.feedback}),c==="transient"&&r&&a.jsx("div",{className:_v.feedback,role:"status",children:s("contextUsage.previousReading")}),c==="hard"?a.jsxs("div",{className:_v.state,role:"alert",children:[a.jsx("span",{children:s("contextUsage.loadError")}),a.jsx(Mt,{type:"button",variant:"outline",size:"sm",disabled:_,onClick:C,children:s("contextUsage.retry")})]}):g?i&&!r?a.jsx("div",{className:_v.state,role:"status",children:s("common.loading")}):r?a.jsx(CEe,{status:r,compact:!0}):a.jsx("div",{className:_v.state,children:s("contextUsage.unavailable")}):a.jsx("div",{className:_v.state,children:s("contextUsage.unavailable")})]})}const K3n=700,Y3n=["daily","weekdays","weekly","hourly","minutes","custom"],X3n=[1,2,3,4,5,6,10,12,15,20,30],Z3n=(e,t)=>{},J3n=(e,t,n)=>{},Q3n=()=>Promise.reject(new Error("Side-task session creation is unavailable"));function wve(e){return e.kind==="review"||e.kind==="file"||e.kind==="artifact"||e.kind==="scheduled_task"}function Sv(e){return e.kind==="pending"?e.targetKind:e.kind}function eRn(e){return`image.${(e.match(/^data:image\/([a-z0-9+.+-]+)/i)?.[1]??"png").split("+")[0].toLowerCase()}`}const tRn=["review","sideTask"];function yve({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:p,onOpenFilePreview:m,latestReviewAvailable:g=!1,onOpenLatestReview:v,onOpenTerminal:y,onOpenTrajectory:w,trajectoryTabId:b,onOpenWebPreview:x,onWebPreviewChange:_,items:C=tRn,sideTaskAvailable:T=!1,sideTasks:I=[],sideTasksLoading:j=!1,onCreateSideTask:S,onOpenSideTask:R,onCreateSideTaskSession:E,onSideTaskCreated:N,onSideTaskTitleChange:A,onNestedRightPanelOpen:L,onNestedArtifactsChange:$,onOpenNestedSubagent:M,agentTasks:U=[],agentTraceLoading:W=!1,agentTraceError:z,onOpenWorkflowAgent:P,onError:Y,sessionWorkflowEnabled:Q,workflow:B,onImageIngestionNotice:X,deferSubagentMount:ce=!1,onClose:fe,variant:ee="docked",fullscreen:F=!1,onToggleFullscreen:V}){const{t:oe}=pt(),[ue,de]=d.useState(!1),[ge,ne]=d.useState(),ve=d.useRef(null),ye=d.useCallback(()=>{ve.current&&(clearTimeout(ve.current),ve.current=null),de(!0)},[]),Ce=d.useCallback(()=>{ve.current&&clearTimeout(ve.current),ve.current=setTimeout(()=>{de(!1),ve.current=null},120)},[]);d.useEffect(()=>()=>{ve.current&&clearTimeout(ve.current)},[]);const ke=n.find(me=>me.id===s)??n[0],Oe=ke?.kind==="file"&&ke.sourcePreview&&(/\.html?$/i.test(ke.workspacePath)||Cw(ke.previewMimeType||ke.previewData?.type)==="text/html"),We=ke?.kind==="file"&&ke.previewOnly===!0&&!Oe&&/\.(?:html?|md|markdown)$/i.test(ke.workspacePath)&&(ke.previewContent!==void 0||!ke.previewData||!!tT(ke.previewMimeType||ke.previewData.type,ke.workspacePath)),vt=ge===ke?.id,Se=C.includes("review")&&!n.some(me=>Sv(me)==="review"),Ye=C.includes("sideTask")&&T&&!!S,_e=!!y,se=C.includes("webPreview")&&!!x,O=C.includes("trajectory")&&!!w&&!n.some(me=>me.id===b),G=!!ke&&(Se||Ye||_e||se||O),le=ke&&wve(ke)?{workspaceCwd:ke.workspaceCwd,workspaceId:ke.workspaceId}:void 0,Te=FT(le?.workspaceCwd),Fe=Te?.workspaceId===le?.workspaceId?Te?.actions:void 0,he=ke?.kind==="artifact"?t.find(me=>me.id===ke.artifactId):void 0;return a.jsxs("aside",{className:`${rt.panel} ${ee==="drawer"?rt.panelDrawer:""} ${F?rt.panelFullscreen:""}`,style:ee==="docked"&&i&&!F?{flexBasis:i,width:i}:void 0,"aria-label":"Right panel",children:[a.jsxs("div",{className:rt.header,children:[n.length>0&&a.jsx("div",{className:rt.tabs,role:"tablist","aria-label":"Right panel",children:n.map(me=>a.jsxs("div",{className:[rt.tabItem,me.id===ke?.id?rt.tabActive:""].filter(Boolean).join(" "),children:[a.jsxs("button",{type:"button",role:"tab","aria-selected":me.id===ke?.id,className:rt.tab,onClick:()=>f(me.id),onMouseEnter:Ie=>s2(Ie.currentTarget),onFocus:Ie=>s2(Ie.currentTarget),title:me.title,children:[a.jsx("span",{className:`${rt.tabIcon} ${Sv(me)==="artifact"?rt.tabArtifactIcon:""}`,"aria-hidden":"true",children:Sv(me)==="review"?a.jsx(FU,{}):me.kind==="workflow"?a.jsx(FTe,{className:rt.tabIconSvg,strokeWidth:1.6}):me.kind==="file"?a.jsx(ag,{name:me.workspacePath,className:rt.tabIconSvg,strokeWidth:1.6}):Sv(me)==="artifact"?a.jsx(c4e,{artifact:t.find(Ie=>"artifactId"in me&&Ie.id===me.artifactId),className:rt.tabIconSvg}):Sv(me)==="subagent"?a.jsx(nRn,{}):Sv(me)==="monitor"?a.jsx(KTe,{className:rt.tabIconSvg,strokeWidth:1.6}):Sv(me)==="shell"?a.jsx(TC,{className:rt.tabIconSvg,strokeWidth:1.6}):Sv(me)==="side_task"?a.jsx(Mj,{className:rt.tabIconSvg,strokeWidth:1.6}):me.kind==="web_preview"?a.jsx(XC,{className:rt.tabIconSvg}):me.kind==="terminal"?a.jsx(TC,{className:rt.tabIconSvg,strokeWidth:1.6}):Sv(me)==="image"?a.jsx(bot,{className:rt.tabIconSvg,strokeWidth:1.6}):me.kind==="context_usage"?a.jsx(nD,{className:rt.tabIconSvg,strokeWidth:1.6}):me.kind==="token_usage"?a.jsx(MJ,{className:rt.tabIconSvg,strokeWidth:1.6}):me.kind==="trajectory"?a.jsx(HF,{className:rt.tabIconSvg,strokeWidth:1.6}):a.jsx(rRn,{})}),a.jsx("span",{className:rt.tabTitle,"data-web-shell-session-title":!0,children:a.jsx("span",{className:rt.tabTitleInner,children:me.title})})]}),a.jsx("button",{type:"button",className:rt.tabCloseButton,onClick:()=>p(me.id),"aria-label":`Close ${me.title}`,title:"Close",children:a.jsx(sRn,{})})]},me.id))}),a.jsxs("div",{className:rt.headerActions,children:[G&&a.jsxs(mg,{modal:!1,children:[a.jsx(_m,{asChild:!0,children:a.jsx("button",{type:"button",className:`${rt.iconButton} ${rt.addButton}`,"aria-label":oe("rightPanel.add"),title:oe("rightPanel.add"),children:a.jsx(jh,{className:rt.toolbarIcon})})}),a.jsxs(Sm,{align:"end",className:"w-64",children:[Se&&a.jsxs(Oo,{disabled:!g||!v,onSelect:v,children:[a.jsx(FU,{}),a.jsx("span",{className:rt.sideTaskListTitle,children:oe("turnOutputs.review")})]}),Se&&Ye&&a.jsx(jb,{}),Ye&&a.jsxs(Oo,{disabled:j,onSelect:S,children:[a.jsx(Mj,{className:rt.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:rt.sideTaskListTitle,children:oe("sideTask.create")})]}),_e&&(Se||Ye)&&a.jsx(jb,{}),_e&&a.jsxs(Oo,{onSelect:()=>y?.(),children:[a.jsx(TC,{className:rt.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:rt.sideTaskListTitle,children:oe("terminal.title")})]}),se&&a.jsxs(Oo,{onSelect:x,children:[a.jsx(XC,{className:rt.sideTaskNewIcon}),a.jsx("span",{className:rt.sideTaskListTitle,children:oe("webPreview.title")})]}),O&&a.jsxs(Oo,{onSelect:()=>w?.(),children:[a.jsx(HF,{className:rt.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:rt.sideTaskListTitle,children:oe("trajectory.title")})]})]})]}),V&&a.jsx("button",{type:"button",className:`${rt.iconButton} ${rt.fullscreenButton} ${F?rt.iconButtonActive:""}`,onClick:V,"aria-label":oe(F?"common.exitFullscreen":"common.fullscreen"),"aria-pressed":F,title:oe(F?"common.exitFullscreen":"common.fullscreen"),children:F?a.jsx(LJ,{className:rt.toolbarIcon,"aria-hidden":!0}):a.jsx(jJ,{className:rt.toolbarIcon,"aria-hidden":!0})}),a.jsx("button",{type:"button",className:`${rt.iconButton} ${rt.panelToggleButton}`,onClick:fe,"aria-label":oe("chatHeader.toggleRightPanel"),"aria-pressed":"true",title:oe("chatHeader.toggleRightPanel"),children:a.jsx(zTe,{className:rt.panelToggleIcon})})]})]}),a.jsxs("div",{className:`${rt.body} ${ke?.kind==="side_task"?rt.bodySideTask:""}`.trim(),children:[n.filter(me=>me.kind==="web_preview").map(me=>a.jsx("div",{className:"h-full",hidden:me.id!==ke?.id,children:a.jsx(nIn,{state:me,onChange:Ie=>_?.(me.id,Ie)})},me.id)),n.filter(me=>me.kind==="terminal").map(me=>a.jsx("div",{className:`${rt.terminalPane} ${me.id===ke?.id?"":rt.terminalPaneHidden}`.trim(),"aria-hidden":me.id===ke?.id?void 0:!0,children:a.jsx(tIn,{terminalId:me.id,cwd:me.workspaceCwd??l,active:me.id===ke?.id,enabled:me.initialized!==!1})},me.id)),We&&a.jsxs("button",{type:"button",className:rt.attachmentPreviewButton,onClick:()=>ne(vt?void 0:ke?.id),"aria-label":oe(vt?"attachment.showSource":"attachment.showPreview"),"aria-pressed":vt,children:[vt?a.jsx(drt,{"aria-hidden":!0}):a.jsx(MTe,{"aria-hidden":!0}),oe(vt?"attachment.showSource":"attachment.showPreview")]}),u&&!ke?a.jsxs("div",{className:"flex flex-col gap-4 p-5","data-testid":"right-panel-loading-skeleton",role:"status","aria-label":oe("common.loading"),children:[a.jsx(p0,{className:"h-5 w-2/5"}),a.jsx(p0,{className:"h-32 w-full"}),a.jsx(p0,{className:"h-4 w-4/5"}),a.jsx(p0,{className:"h-4 w-3/5"})]}):ke?.kind==="terminal"||ke?.kind==="web_preview"?null:ke?ke.kind==="pending"?a.jsx("div",{className:rt.empty,role:ke.loadError?"alert":"status",children:ke.loadError??oe("common.loading")}):ke.kind==="workflow"?ke.sessionId?a.jsx(YSn,{tasks:U,loading:W,error:z,onOpenAgent:P}):B?a.jsx(OCn,{...B}):a.jsx("div",{className:rt.empty,children:oe("workflow.empty.title")}):wve(ke)&&(ke.kind!=="scheduled_task"||ke.task.durable)&&(ke.kind!=="file"||!ke.previewOnly)&&(ke.kind!=="artifact"||he?.metadata?.artifactType!=="web_preview_snapshot")&&!Fe?a.jsx("div",{className:rt.empty,role:"alert",children:oe("workspace.notFoundDescription")}):ke.kind==="review"?a.jsx(aRn,{changes:ke.changes??r,selectedPath:ke.selectedPath??o,workspaceCwd:ke.workspaceCwd??l,onOpenFilePreview:me=>m(me,ke.workspaceCwd??l,ke.workspaceId),onDownloadFile:(me,Ie)=>oD(Fe,me.path,Hat(me.path),Ie),onDownloadError:me=>{const Ie=oe("common.downloadFailed",{message:kc(me)});Y?Y(new Error(Ie,{cause:me}),Ie):console.error(Ie,me)}}):ke.kind==="file"?ke.attachmentId&&!ke.previewData&&ke.previewContent===void 0?a.jsx("div",{className:rt.empty,role:ke.loadError?"alert":"status",children:ke.loadError??oe("common.loading")}):ke.sourcePreview&&ke.previewData&&Cw(ke.previewMimeType||ke.previewData.type)!=="application/pdf"&&!tT(ke.previewMimeType||ke.previewData.type,ke.workspacePath)?a.jsx(C7e,{data:ke.previewData,title:ke.title,image:!!v_(ke.workspacePath)&&ke.previewData.type.startsWith("image/")}):a.jsx(wO,{workspacePath:ke.workspacePath,artifactVersion:String(ke.previewVersion??0),workspaceActions:Fe,previewContent:ke.previewContent,previewData:ke.previewData,previewMimeType:ke.previewMimeType,previewOnly:ke.previewOnly,previewKind:Oe||ke.previewOnly&&!vt?"source":void 0},ke.id):ke.kind==="source"?a.jsx(SRn,{tab:ke},ke.id):ke.kind==="artifact"?a.jsx(oRn,{artifacts:t,artifactId:ke.artifactId,sourceSessionId:ke.sourceSessionId,workspaceActions:Fe,previewContent:ke.previewContent,loading:c,error:h},ke.id):ke.kind==="subagent"?ce?null:a.jsx(jSn,{sessionId:ke.sessionId,rootToolCallId:ke.rootToolCallId,initialRootTool:ke.rootTool,workspaceCwd:ke.workspaceCwd??l,onRightPanelOpen:L,onArtifactsChange:$,onOpenSubagent:M,onError:Y}):ke.kind==="monitor"?a.jsx(jAt,{task:ke.task,actions:ke.sessionActions},ke.id):ke.kind==="shell"?a.jsx(NAt,{task:ke.task,actions:ke.sessionActions},ke.id):ke.kind==="side_task"?a.jsx(ZSn,{tabId:ke.id,sessionId:ke.sessionId,parentSessionId:ke.parentSessionId,workspaceCwd:ke.workspaceCwd??l,title:ke.title,shouldNameFromFirstPrompt:ke.nameFromFirstPrompt,initialPrompt:ke.initialPrompt,createSession:E??Q3n,onCreated:N??Z3n,onTitleChange:A??J3n,onRightPanelOpen:L,onArtifactsChange:$,onError:Y,sessionWorkflowEnabled:Q,onImageIngestionNotice:X},ke.id):ke.kind==="image"?ke.src?a.jsxs("div",{className:rt.imagePreviewWrap,children:[a.jsx("img",{src:ke.src,alt:ke.alt??ke.title,className:rt.imagePreview}),a.jsx("a",{className:rt.imageDownloadButton,href:ke.src,download:eRn(ke.src),"aria-label":oe("common.download"),title:oe("common.download"),children:a.jsx(nw,{size:16,strokeWidth:1.8})})]}):a.jsx("div",{className:rt.empty,role:ke.loadError?"alert":"status",children:ke.loadError??oe("common.loading")}):ke.kind==="context_usage"?a.jsx(G3n,{controls:e?.[ke.sessionId],sessionActions:ke.sessionActions,sessionId:ke.sessionId},ke.id):ke.kind==="trajectory"?a.jsx(B3n,{loadPage:ke.loadPage},ke.id):ke.kind==="token_usage"?a.jsx(UIn,{sessionActions:ke.sessionActions,sessionId:ke.sessionId},ke.id):a.jsx(iRn,{task:ke.task,actions:Fe},ke.id):a.jsxs("div",{className:rt.emptyActions,"data-testid":"right-panel-empty-actions",children:[C.includes("review")&&a.jsxs("button",{type:"button",className:rt.emptyAction,disabled:!g||!v,onClick:v,children:[a.jsx("span",{className:rt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(FU,{})}),a.jsx("span",{className:rt.emptyActionTitle,children:oe("turnOutputs.review")}),a.jsx("span",{className:rt.emptyActionHint,children:oe("turnOutputs.reviewLatest")}),a.jsx($a,{className:rt.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]}),C.includes("sideTask")&&T&&S&&(I.length===0?a.jsxs("button",{type:"button",className:rt.emptyAction,disabled:j,"aria-busy":j,onClick:S,children:[a.jsx("span",{className:rt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(Mj,{strokeWidth:1.6})}),a.jsx("span",{className:rt.emptyActionTitle,children:oe("sideTask.title")}),a.jsx("span",{className:rt.emptyActionHint,children:oe("sideTask.description")}),a.jsx($a,{className:rt.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]}):a.jsxs(mg,{open:ue,onOpenChange:de,modal:!1,children:[a.jsx(_m,{asChild:!0,children:a.jsxs("button",{type:"button",className:rt.emptyAction,"aria-expanded":ue,onMouseEnter:ye,onMouseLeave:Ce,children:[a.jsx("span",{className:rt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(Mj,{strokeWidth:1.6})}),a.jsx("span",{className:rt.emptyActionTitle,children:oe("sideTask.title")}),a.jsx("span",{className:rt.emptyActionHint,children:oe("sideTask.description")}),a.jsx($a,{className:rt.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]})}),a.jsxs(Sm,{align:"end",className:"w-80",onMouseEnter:ye,onMouseLeave:Ce,children:[I.map(me=>a.jsxs(Oo,{onSelect:()=>R?.(me),children:[a.jsx("span",{className:rt.sideTaskListTitle,children:me.title}),me.updatedAt&&a.jsx("span",{className:rt.sideTaskListTime,children:oA(me.updatedAt,oe)})]},me.sessionId)),a.jsx(jb,{}),a.jsxs(Oo,{onSelect:S,children:[a.jsx(Qst,{className:rt.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:rt.sideTaskListTitle,children:oe("sideTask.new")})]})]})]})),se&&a.jsxs("button",{type:"button",className:rt.emptyAction,onClick:x,children:[a.jsx("span",{className:rt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(XC,{strokeWidth:1.6})}),a.jsx("span",{className:rt.emptyActionTitle,children:oe("webPreview.title")}),a.jsx("span",{className:rt.emptyActionHint,children:oe("webPreview.openHint")}),a.jsx($a,{className:rt.emptyActionChevron,"aria-hidden":"true"})]}),O&&a.jsxs("button",{type:"button",className:rt.emptyAction,onClick:()=>w?.(),"data-testid":"right-panel-open-trajectory",children:[a.jsx("span",{className:rt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(HF,{strokeWidth:1.6})}),a.jsx("span",{className:rt.emptyActionTitle,children:oe("trajectory.title")}),a.jsx("span",{className:rt.emptyActionHint,children:oe("trajectory.description")}),a.jsx($a,{className:rt.emptyActionChevron,"aria-hidden":"true"})]}),y&&a.jsxs("button",{type:"button",className:rt.emptyAction,onClick:()=>y(),children:[a.jsx("span",{className:rt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(TC,{strokeWidth:1.6})}),a.jsx("span",{className:rt.emptyActionTitle,children:oe("terminal.title")}),a.jsx("span",{className:rt.emptyActionHint,children:oe("terminal.open")}),a.jsx($a,{className:rt.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]})]})]})]})}function nRn(){return a.jsxs("svg",{className:rt.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 sRn(){return a.jsx("svg",{className:rt.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 FU(){return a.jsxs("svg",{className:rt.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 rRn(){return a.jsxs("svg",{className:rt.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 oRn({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(wRn,{artifact:l,sourceSessionId:n,workspaceActions:s,previewContent:r}):o?a.jsx("div",{className:rt.empty,children:"Loading artifact..."}):i?a.jsx("div",{className:rt.empty,children:i}):a.jsx("div",{className:rt.empty,children:"Artifact not found."})}function iRn({task:e,actions:t}){const{t:n}=pt(),[s,r]=d.useState(null),[o,i]=d.useState(!0),[l,c]=d.useState(null),[u,h]=d.useState(""),[f,p]=d.useState(e.prompt),[m,g]=d.useState(()=>Oy(e.cron)),[v,y]=d.useState(!1),[w,b]=d.useState(!1),[x,_]=d.useState(!1),[C,T]=d.useState(!1),[I,j]=d.useState(null),S=d.useRef(0),R=d.useRef(0),E=d.useRef({actions:t,taskId:e.id,workspaceId:e.workspaceId});E.current={actions:t,taskId:e.id,workspaceId:e.workspaceId};const N=d.useCallback((oe,ue,de,ge)=>{const ne=E.current;return oe===S.current&&ne.actions===ue&&ne.taskId===de&&ne.workspaceId===ge},[]),A=d.useCallback((oe,ue,de,ge)=>{const ne=E.current;return oe===R.current&&ne.actions===ue&&ne.taskId===de&&ne.workspaceId===ge},[]);d.useEffect(()=>()=>{S.current+=1,R.current+=1},[]),d.useEffect(()=>{_(!1),T(!1),j(null)},[t,e.id,e.workspaceId]);const L=d.useCallback(async()=>{const oe=++S.current,ue=++R.current,de=e.id,ge=e.workspaceId;if(!e.durable||!t){r(null),h(""),p(e.prompt),g(Oy(e.cron)),c(null),i(!1);return}i(!0),c(null);try{const ne=await t.listScheduledTasks(ge);if(!N(oe,t,de,ge))return;const ve=ne.find(ye=>ye.id===e.id)??null;r(ve),ve?(h(ve.name??""),p(ve.prompt),g(Oy(ve.cron))):(h(""),p(e.prompt),g(Oy(e.cron)))}catch(ne){A(ue,t,de,ge)&&c(ne instanceof Error?ne.message:String(ne))}finally{A(ue,t,de,ge)&&i(!1)}},[t,A,N,e.cron,e.durable,e.id,e.prompt,e.workspaceId]);d.useEffect(()=>{L()},[L]);const $=!e.durable,M=e.durable&&!o&&!l&&!s,U=!!s,W=s?.name||s?.prompt||e.title,z=s?.prompt??e.prompt,P=s?.cron??e.cron,Y=s?.recurring??e.recurring,Q=s?.enabled,B=d.useCallback(()=>{s&&(h(s.name??""),p(s.prompt),g(Oy(s.cron)),j(null),y(!0))},[s]),X=d.useCallback(()=>{y(!1),j(null),s&&(h(s.name??""),p(s.prompt),g(Oy(s.cron)))},[s]),ce=d.useCallback(async()=>{if(!s||!t)return;const oe=Q9(m);if(!oe){j(n("scheduledTasks.error.invalidSchedule"));return}if(f.trim().length===0){j(n("scheduledTasks.error.emptyPrompt"));return}const ue=++S.current,de=e.id,ge=e.workspaceId;T(!0),j(null);try{const ne=await t.updateScheduledTask(s.id,{cron:oe,prompt:f.trim(),name:u.trim()||null},ge);if(!N(ue,t,de,ge))return;r(ne),h(ne.name??""),p(ne.prompt),g(Oy(ne.cron)),y(!1)}catch(ne){N(ue,t,de,ge)&&j(ne instanceof Error?ne.message:String(ne))}finally{N(ue,t,de,ge)&&T(!1)}},[t,m,N,s,u,f,n,e.id,e.workspaceId]),fe=d.useCallback(async()=>{if(!s||!t)return;const oe=++S.current,ue=e.id,de=e.workspaceId;_(!0),j(null);try{const ge=await t.updateScheduledTask(s.id,{enabled:!s.enabled},de);if(!N(oe,t,ue,de))return;r(ge)}catch(ge){N(oe,t,ue,de)&&j(ge instanceof Error?ge.message:String(ge))}finally{N(oe,t,ue,de)&&_(!1)}},[t,N,s,e.id,e.workspaceId]),ee=d.useCallback(async()=>{if(!s||!t)return;const oe=++S.current,ue=e.id,de=e.workspaceId;_(!0),j(null);try{if(await t.deleteScheduledTask(s.id,de),!N(oe,t,ue,de))return;r(null),b(!1)}catch(ge){N(oe,t,ue,de)&&j(ge instanceof Error?ge.message:String(ge))}finally{N(oe,t,ue,de)&&_(!1)}},[t,N,s,e.id,e.workspaceId]),F=Q9(m),V=F?P2(F,n):null;return a.jsxs("div",{className:rt.detail,children:[o&&a.jsx("div",{className:rt.empty,children:n("scheduledTasks.loading")}),l&&a.jsx("div",{className:Ut.loadError,children:l}),M&&a.jsx("div",{className:rt.empty,children:n("scheduledTasks.deletedSnapshot")}),$&&a.jsx("div",{className:rt.empty,children:n("scheduledTasks.sessionScopedSnapshot")}),!M&&a.jsx("div",{className:rt.section,children:a.jsxs("div",{className:rt.fieldGrid,children:[a.jsx("span",{className:rt.fieldLabel,children:n("scheduledTasks.name")}),a.jsx("span",{className:rt.fieldValue,children:W}),a.jsx("span",{className:rt.fieldLabel,children:n("scheduledTasks.taskId")}),a.jsx("span",{className:rt.fieldValue,children:e.id}),a.jsx("span",{className:rt.fieldLabel,children:n("scheduledTasks.schedule")}),a.jsx("span",{className:rt.fieldValue,children:P2(P,n)}),a.jsx("span",{className:rt.fieldLabel,children:"Cron"}),a.jsx("span",{className:rt.fieldValue,children:P}),a.jsx("span",{className:rt.fieldLabel,children:n("scheduledTasks.type")}),a.jsx("span",{className:rt.fieldValue,children:n(Y?"scheduledTasks.repeats":"scheduledTasks.runsOnce")}),Q!==void 0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:rt.fieldLabel,children:n("scheduledTasks.status")}),a.jsx("span",{className:rt.fieldValue,children:n(Q?"scheduledTasks.enable":"scheduledTasks.disable")})]})]})}),!M&&a.jsxs("div",{className:rt.section,children:[a.jsx("div",{className:rt.sectionTitle,children:"Prompt"}),a.jsx("div",{className:rt.description,children:z})]}),I&&a.jsx("div",{className:Ut.formError,children:I}),a.jsxs("div",{className:rt.actionsRow,children:[a.jsx("button",{type:"button",className:Ut.primaryButton,disabled:!U||x,onClick:B,children:n("scheduledTasks.edit")}),a.jsx("button",{type:"button",className:Ut.secondaryButton,disabled:!U||x,onClick:()=>void fe(),children:s?.enabled?n("scheduledTasks.disable"):n("scheduledTasks.enable")}),a.jsx("button",{type:"button",className:Ut.secondaryButton,disabled:!U||x,onClick:()=>b(!0),children:n("scheduledTasks.delete")})]}),w&&s&&a.jsx(Ji,{title:n("scheduledTasks.deleteConfirmTitle"),size:"sm",onClose:()=>b(!1),children:a.jsxs("div",{className:Ut.formFields,children:[a.jsx("div",{className:rt.description,children:n("scheduledTasks.deleteConfirm",{name:s.name||s.prompt})}),I&&a.jsx("div",{className:Ut.formError,children:I}),a.jsxs("div",{className:Ut.formActions,children:[a.jsx("button",{type:"button",className:Ut.secondaryButton,onClick:()=>b(!1),disabled:x,children:n("scheduledTasks.cancel")}),a.jsx("button",{type:"button",className:Ut.primaryButton,onClick:()=>void ee(),disabled:x,children:n("scheduledTasks.delete")})]})]})}),v&&a.jsx(Ji,{title:n("scheduledTasks.editTitle"),size:"md",onClose:X,children:a.jsxs("div",{className:Ut.formFields,children:[a.jsxs("label",{className:Ut.field,children:[a.jsx("span",{className:Ut.fieldLabel,children:n("scheduledTasks.name")}),a.jsx("input",{className:Ut.input,type:"text",value:u,maxLength:200,placeholder:n("scheduledTasks.namePlaceholder"),onChange:oe=>h(oe.target.value)})]}),a.jsxs("label",{className:Ut.field,children:[a.jsxs("span",{className:Ut.fieldLabel,children:[n("scheduledTasks.prompt"),a.jsx("span",{className:Ut.required,children:"*"})]}),a.jsx("textarea",{className:Ut.textarea,value:f,rows:4,maxLength:1e5,placeholder:n("scheduledTasks.promptPlaceholder"),onChange:oe=>p(oe.target.value)})]}),a.jsxs("div",{className:Ut.scheduleRow,children:[a.jsxs("label",{className:Ut.field,children:[a.jsx("span",{className:Ut.fieldLabel,children:n("scheduledTasks.frequency")}),a.jsx("select",{className:Ut.select,value:m.frequency,onChange:oe=>{const ue=oe.target.value;g(de=>({...de,frequency:ue,...ue==="hourly"?{time:"00:00"}:{}}))},children:Y3n.map(oe=>a.jsx("option",{value:oe,children:n(`scheduledTasks.freq.${oe}`)},oe))})]}),(m.frequency==="daily"||m.frequency==="weekdays"||m.frequency==="weekly")&&a.jsxs("label",{className:Ut.field,children:[a.jsx("span",{className:Ut.fieldLabel,children:n("scheduledTasks.time")}),a.jsx("input",{className:Ut.input,type:"time",value:m.time,onChange:oe=>g(ue=>({...ue,time:oe.target.value}))})]}),m.frequency==="weekly"&&a.jsxs("label",{className:Ut.field,children:[a.jsx("span",{className:Ut.fieldLabel,children:n("scheduledTasks.weekday")}),a.jsx("select",{className:Ut.select,value:m.weekday,onChange:oe=>g(ue=>({...ue,weekday:Number(oe.target.value)})),children:n("scheduledTasks.weekdayNames").split(",").map((oe,ue)=>a.jsx("option",{value:ue,children:oe},ue))})]}),m.frequency==="minutes"&&a.jsxs("label",{className:Ut.field,children:[a.jsx("span",{className:Ut.fieldLabel,children:n("scheduledTasks.interval")}),a.jsx("select",{className:Ut.select,value:m.minuteInterval,onChange:oe=>g(ue=>({...ue,minuteInterval:Number(oe.target.value)})),children:X3n.map(oe=>a.jsx("option",{value:oe,children:oe},oe))})]}),m.frequency==="custom"&&a.jsxs("label",{className:`${Ut.field} ${Ut.fieldGrow}`,children:[a.jsx("span",{className:Ut.fieldLabel,children:n("scheduledTasks.cron")}),a.jsx("input",{className:Ut.input,type:"text",value:m.customCron,spellCheck:!1,placeholder:"0 9 * * 1-5",onChange:oe=>g(ue=>({...ue,customCron:oe.target.value}))})]})]}),a.jsx("div",{className:Ut.preview,children:V?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:Ut.previewLabel,children:V}),a.jsx("code",{className:Ut.previewCron,children:F})]}):a.jsx("span",{className:Ut.previewInvalid,children:n("scheduledTasks.error.invalidSchedule")})}),I&&a.jsx("div",{className:Ut.formError,children:I}),a.jsxs("div",{className:Ut.formActions,children:[a.jsx("button",{type:"button",className:Ut.secondaryButton,onClick:X,disabled:C,children:n("scheduledTasks.cancel")}),a.jsx("button",{type:"button",className:Ut.primaryButton,onClick:()=>void ce(),disabled:C,children:n(C?"scheduledTasks.saving":"scheduledTasks.save")})]})]})})]})}function aRn({changes:e,selectedPath:t,workspaceCwd:n,onOpenFilePreview:s,onDownloadFile:r,onDownloadError:o}){const{t:i}=pt(),[l,c]=d.useState(!1),[u,h]=d.useState(!0),[f,p]=d.useState(!1),[m,g]=d.useState(520),v=d.useRef(m),y=d.useRef(null),w=d.useRef(null),[b,x]=d.useState(null),[_,C]=d.useState(()=>new Set),T=d.useRef(!0);d.useEffect(()=>(T.current=!0,()=>{T.current=!1}),[]);const I=l,j=d.useMemo(()=>vRn(e,n),[e,n]);d.useEffect(()=>{x(t)},[t]),d.useEffect(()=>{v.current=m},[m]),d.useEffect(()=>{const A=y.current;if(!A)return;const L=()=>{p(A.clientWidth<K3n)};L();const $=new ResizeObserver(L);return $.observe(A),()=>$.disconnect()},[u]),d.useEffect(()=>()=>w.current?.(),[]);const S=d.useCallback(A=>{const L=y.current;if(!L)return;A.preventDefault();const $=A.currentTarget;$.setPointerCapture(A.pointerId);const M=A.clientX,U=v.current,W=L.getBoundingClientRect().width,z=Math.max(180,W-180),P=document.body.style.cursor,Y=document.body.style.userSelect;let Q=U,B=null;document.body.style.cursor="col-resize",document.body.style.userSelect="none";const X=()=>{B=null,g(Q)},ce=F=>{Q=Math.min(z,Math.max(180,U+(F.clientX-M))),B===null&&(B=window.requestAnimationFrame(X))};let fe=()=>{};const ee=F=>{w.current=null,B!==null&&(window.cancelAnimationFrame(B),B=null),F&&g(Q),$.hasPointerCapture(A.pointerId)&&$.releasePointerCapture(A.pointerId),document.body.style.cursor=P,document.body.style.userSelect=Y,window.removeEventListener("pointermove",ce),window.removeEventListener("pointerup",fe),window.removeEventListener("pointercancel",fe)};fe=()=>ee(!0),w.current=()=>ee(!1),window.addEventListener("pointermove",ce),window.addEventListener("pointerup",fe),window.addEventListener("pointercancel",fe)},[]);if(e.length===0)return a.jsx("div",{className:rt.empty,children:"No file changes to review."});const R=I5e(e),E=A=>{x(L=>L===A?null:A)},N=async A=>{if(!_.has(A.path)){C(L=>new Set(L).add(A.path));try{await r(A,()=>!T.current)}catch(L){T.current&&o(L)}finally{C(L=>{const $=new Set(L);return $.delete(A.path),$})}}};return a.jsxs("div",{className:rt.review,children:[a.jsxs("div",{className:rt.reviewToolbar,children:[a.jsxs("div",{className:rt.reviewToolbarTitle,children:[a.jsx("span",{children:i("turnOutputs.previousTurn")}),a.jsx(H7,{additions:R?.additions,deletions:R?.deletions,className:rt.lineStats,additionsClassName:rt.additions,deletionsClassName:rt.deletions})]}),a.jsxs("div",{className:rt.reviewToolbarActions,children:[a.jsxs("button",{type:"button",className:rt.reviewTotalsButton,onClick:()=>h(A=>!A),"aria-expanded":u,children:[a.jsx("span",{children:i("turnOutputs.fileCount",{count:e.length})}),a.jsx("span",{className:[rt.chevron,u?rt.chevronOpen:""].filter(Boolean).join(" "),"aria-hidden":"true",children:a.jsx(xve,{})})]}),a.jsx("button",{type:"button",className:[rt.iconButton,l?rt.iconButtonActive:""].filter(Boolean).join(" "),onClick:()=>c(A=>!A),"aria-label":i(l?"turnOutputs.closeFileTree":"turnOutputs.openFileTree"),title:i(l?"turnOutputs.closeFileTree":"turnOutputs.openFileTree"),children:l?a.jsx(mRn,{}):a.jsx(pRn,{})})]})]}),u&&a.jsxs("div",{ref:y,className:[rt.reviewContent,I?"":rt.reviewContentListOnly,I&&f?rt.reviewContentStacked:""].filter(Boolean).join(" "),style:{"--review-list-width":`${m}px`},children:[a.jsx("div",{className:[rt.reviewList,b?rt.reviewListWithExpanded:""].filter(Boolean).join(" "),children:e.map(A=>{const L=b===A.path,$=A5e(A.path),M=UOt(A.path);return a.jsxs("div",{className:[rt.reviewItem,L?rt.reviewItemExpanded:""].filter(Boolean).join(" "),children:[a.jsxs("div",{className:rt.reviewRow,"data-selected":A.path===t||void 0,children:[a.jsx("button",{type:"button",className:rt.reviewRowToggle,onClick:()=>E(A.path),"aria-label":A.path,"aria-expanded":L}),a.jsx("span",{className:rt.fileIcon,children:S7e(A.path)}),a.jsxs("span",{className:rt.reviewFileName,children:[a.jsx(dRn,{path:UD(A.path,n),title:A.path}),$&&a.jsx("button",{type:"button",className:rt.reviewOpenButton,onClick:()=>s(A),title:`${i("turnOutputs.preview")} ${A.path}`,children:i("turnOutputs.preview")}),M&&a.jsx("button",{type:"button",className:rt.reviewOpenButton,onClick:()=>void N(A),title:`${i("common.download")} ${A.path}`,disabled:_.has(A.path),children:i(_.has(A.path)?"common.downloading":"common.download")})]}),a.jsx(H7,{additions:A.additions,deletions:A.deletions,className:rt.lineStats,additionsClassName:rt.additions,deletionsClassName:rt.deletions}),a.jsx("span",{className:[rt.chevron,L?rt.chevronOpen:""].filter(Boolean).join(" "),"aria-hidden":"true",children:a.jsx(xve,{})})]}),L&&a.jsx(lRn,{change:A})]},`${A.toolCallId}:${A.path}`)})}),I&&!f&&a.jsx("div",{className:rt.reviewSplitHandle,role:"separator","aria-orientation":"vertical",onPointerDown:S}),I&&a.jsx("div",{className:rt.tree,children:j.children.map(A=>a.jsx(x7e,{node:A,depth:0,selectedPath:t},A.path))})]})]})}function lRn({change:e}){if(e.diffs.length===0)return a.jsx("div",{className:rt.diffEmpty,children:"No diff available."});const t=cRn(e.diffs);return a.jsx("div",{className:rt.diffPreview,children:t.map((n,s)=>n.fileDiff&&!n.fullContent?a.jsx(aee,{diff:n.fileDiff},s):a.jsx(uRn,{oldText:n.oldText,newText:n.newText},s))})}function cRn(e){for(let t=e.length-1;t>=0;t--)if(e[t]?.fullContent)return e.slice(t);return e}function uRn({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=[wMe,as.editable.of(!1),Si.readOnly.of(!0),as.lineWrapping],f={scanLimit:1e3,timeout:500},p={margin:3,minSize:8};return Ue(async()=>{const{MergeView:m,unifiedMergeView:g}=await import("./index-oMwDI29g.js");return{MergeView:m,unifiedMergeView:g}},[]).then(({MergeView:m,unifiedMergeView:g})=>{if(!c)try{if(s){u=new m({a:{doc:e,extensions:h},b:{doc:t,extensions:h},parent:l,highlightChanges:!0,gutter:!0,revertControls:void 0,collapseUnchanged:p,diffConfig:f});return}u=new as({doc:t,extensions:[...h,g({original:e,highlightChanges:!0,gutter:!0,mergeControls:!1,allowInlineDiffs:!0,collapseUnchanged:p,diffConfig:f})],parent:l})}catch(v){c||i(v instanceof Error?v.message:String(v))}}).catch(m=>{c||i(m instanceof Error?m.message:String(m))}),()=>{c=!0,u?.destroy()}},[s,t,e]),a.jsxs("div",{className:rt.codeMirrorDiffWrap,children:[a.jsx("div",{ref:n,className:rt.codeMirrorDiff}),o&&a.jsxs("div",{className:rt.diffError,children:["Diff unavailable: ",o]})]})}function x7e({node:e,depth:t,selectedPath:n}){const s=!!e.file,[r,o]=d.useState(!0),i=[rt.treeRow,s?rt.treeFile:rt.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:rt.treeTwisty,children:!s&&a.jsx("span",{className:[rt.treeChevron,r?"":rt.treeChevronClosed].filter(Boolean).join(" "),children:a.jsx(gRn,{})})}),a.jsxs("span",{className:rt.treeContent,children:[s&&a.jsx("span",{className:rt.fileIcon,children:S7e(e.path)}),a.jsx("span",{className:rt.treeName,children:e.name})]}),e.file?.isArtifact&&a.jsx("span",{className:rt.reviewBadge,children:"artifact"})]});return a.jsxs("div",{className:rt.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:rt.treeChildren,style:c,children:e.children.map(h=>a.jsx(x7e,{node:h,depth:t+1,selectedPath:n},h.path))})]})}function dRn({path:e,title:t}){const n=d.useRef(null),[s,r]=d.useState(()=>k7e(e));return d.useLayoutEffect(()=>{const o=n.current;if(!o)return;const i=()=>r(hRn(e,o));i();const l=new ResizeObserver(i);return l.observe(o),()=>l.disconnect()},[e]),a.jsxs("span",{ref:n,className:rt.reviewPath,title:t??e,children:[s.prefix&&a.jsx("span",{className:rt.pathPrefix,children:s.prefix}),a.jsx("span",{className:rt.pathFileName,children:s.leaf})]})}function k7e(e){const t=e.lastIndexOf("/");return t<0?{prefix:"",leaf:e}:{prefix:e.slice(0,t+1),leaf:e.slice(t+1)}}let bve=null;function hRn(e,t){const n=k7e(e),s=t.clientWidth;if(s<=0)return n;const r=fRn(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 fRn(e){bve??=document.createElement("canvas");const t=bve.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 pRn(){return a.jsxs("svg",{className:rt.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 mRn(){return a.jsxs("svg",{className:rt.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 xve(){return a.jsx("svg",{className:rt.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 gRn(){return a.jsx("svg",{className:rt.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 vRn(e,t){const n={name:"",path:"",children:[]};for(const s of e){const r=UD(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 _7e(n),n}function _7e(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)_7e(t)}function O8(e){return Tw(e).split("/").filter(Boolean).at(-1)??e}function S7e(e){const t=O8(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 wRn({artifact:e,sourceSessionId:t,workspaceActions:n,previewContent:s}){const{t:r}=pt(),o=_f(),i=o4e(e),l=LT(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=r4e(e);return e.metadata?.artifactType==="web_preview_snapshot"?a.jsx(sIn,{artifact:e,sourceSessionId:t}):u?e.status!=="available"?a.jsx(yRn,{status:e.status}):!h||!e.workspacePath?a.jsx(bRn,{}):a.jsx(pSn,{workspacePath:e.workspacePath,artifactVersion:pce(e),workspaceActions:n}):h&&e.workspacePath?n4e(e)?a.jsx(_Rn,{artifact:e,workspaceActions:n}):a.jsx(wO,{workspacePath:e.workspacePath,artifactVersion:pce(e),workspaceActions:n,previewContent:s,previewSizeBytes:e.sizeBytes,imageMimeType:f,previewKind:xRn(e)?"html":kRn(e)?"markdown":f?"image":"source"}):a.jsxs("div",{className:rt.detail,children:[a.jsxs("div",{className:rt.section,children:[a.jsx("div",{className:rt.sectionTitle,children:c?"Automation Snapshot":"Artifact"}),a.jsxs("div",{className:rt.fieldGrid,children:[a.jsx(Jh,{label:"Type",value:OJ(e.kind,e.workspacePath)}),a.jsx(Jh,{label:"Storage",value:e.storage}),a.jsx(Jh,{label:"Status",value:e.status}),a.jsx(Jh,{label:"Source",value:e.source}),a.jsx(Jh,{label:"Size",value:rD(e.sizeBytes)}),a.jsx(Jh,{label:"Created",value:e.createdAt}),a.jsx(Jh,{label:"Updated",value:e.updatedAt}),e.toolName&&a.jsx(Jh,{label:"Tool",value:e.toolName}),e.toolCallId&&a.jsx(Jh,{label:"Tool call",value:e.toolCallId})]})]}),e.description&&a.jsxs("div",{className:rt.section,children:[a.jsx("div",{className:rt.sectionTitle,children:"Description"}),a.jsx("div",{className:rt.description,children:e.description})]}),c&&e.metadata&&a.jsxs("div",{className:rt.section,children:[a.jsx("div",{className:rt.sectionTitle,children:"Details"}),a.jsxs("div",{className:rt.fieldGrid,children:[zS(e.metadata,"automationId","Automation ID"),zS(e.metadata,"schedule","Schedule"),zS(e.metadata,"timezone","Timezone"),zS(e.metadata,"status","Status"),zS(e.metadata,"nextRunAt","Next run"),zS(e.metadata,"prompt","Prompt")]})]}),(i||l)&&a.jsxs("div",{className:rt.section,children:[a.jsx("div",{className:rt.sectionTitle,children:"Location"}),l?a.jsxs("div",{className:rt.locationRow,children:[a.jsx("a",{className:rt.link,href:l,target:"_blank",rel:"noopener noreferrer",onClick:p=>o(p,l),children:l}),a.jsx("a",{className:rt.openButton,href:l,target:"_blank",rel:"noopener noreferrer",onClick:p=>o(p,l),children:r("artifact.openLink")})]}):a.jsx("div",{className:rt.meta,children:i})]})]})}function yRn({status:e}){const{t}=pt();return a.jsx("div",{className:rt.previewError,role:"alert",children:t("codeReview.unavailable",{status:e})})}function bRn(){const{t:e}=pt();return a.jsx("div",{className:rt.previewError,role:"alert",children:e("codeReview.workspaceRequired")})}function xRn(e){const t=e.workspacePath?.toLowerCase()??"",n=Cw(e.mimeType);return e.kind==="html"||t.endsWith(".html")||t.endsWith(".htm")||n==="text/html"}function kRn(e){const t=e.workspacePath?.toLowerCase()??"",n=Cw(e.mimeType);return t.endsWith(".md")||t.endsWith(".markdown")||n==="text/markdown"}function _Rn({artifact:e,workspaceActions:t}){const{t:n}=pt(),[s,r]=d.useState(null),[o,i]=d.useState(!1),l=d.useRef(!0),c=o4e(e);d.useEffect(()=>(l.current=!0,()=>{l.current=!1}),[]);const u=async()=>{if(e.workspacePath){i(!0),r(null);try{await oD(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:rt.detail,children:a.jsxs("div",{className:rt.section,children:[a.jsx("div",{className:rt.sectionTitle,children:n("common.download")}),a.jsxs("div",{className:rt.fieldGrid,children:[a.jsx(Jh,{label:"Type",value:OJ(e.kind,e.workspacePath)}),a.jsx(Jh,{label:"Size",value:rD(e.sizeBytes)}),c?a.jsx(Jh,{label:"Location",value:c}):null,e.status!=="available"&&e.status!=="changed"?a.jsx(Jh,{label:"Status",value:e.status??"missing"}):null]}),a.jsx("div",{className:rt.downloadRow,children:a.jsx("button",{type:"button",className:rt.downloadButton,onClick:()=>{u()},disabled:o||e.status!=="available"&&e.status!=="changed",children:n(o?"common.downloading":"common.download")})}),s&&a.jsx("div",{className:rt.previewError,children:s})]})})}function SRn({tab:e}){const{t}=pt(),n=ua(),s=FT(e.workspaceCwd),r=s?.actions,o=_f(),[i,l]=d.useState(0),[c,u]=d.useState(),[h,f]=d.useState(),[p,m]=d.useState(),g=e.source,v=g.locator,y=e.owner.isCurrent()&&n.sessionId===e.sourceSessionId&&n.capabilities?.features.includes("session_sources")&&s?.workspaceId===e.workspaceId&&(!!s||e.workspaceCwd===void 0&&v.type!=="workspace_file")&&(v.type!=="workspace_file"||g.workspaceCwd===n.workspaceCwd),w=v.type==="workspace_file"?v.workspacePath:v.type==="attachment"?v.attachmentId:"",b=/\.pdf$/i.test(w);if(d.useEffect(()=>{let _=!1;return u(void 0),f(void 0),m(void 0),!y||v.type==="url"?void 0:((async()=>{if(v.type==="attachment"){const T=await e.sessionActions.readAttachment(v.attachmentId);if(_||!e.owner.isCurrent())return;const I=Uint8Array.from(atob(T.data),j=>j.charCodeAt(0));u(new Blob([I],{type:T.mimeType}))}else if(b&&r){const T=await TT(r.readFileBytes,w,"application/pdf",{statFile:r.stat,isCancelled:()=>_||!e.owner.isCurrent()});!_&&e.owner.isCurrent()&&u(T)}})().catch(T=>{!_&&e.owner.isCurrent()&&f(kc(T))}),()=>{_=!0})},[i,y,v,w,b,e.owner,e.sessionActions,r]),y&&v.type==="url")return a.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[a.jsx("h3",{children:g.title}),g.description&&a.jsx("p",{children:g.description}),a.jsx("p",{className:"break-all text-sm text-muted-foreground",children:v.url}),LT(v.url)&&a.jsx("a",{className:"text-primary underline",href:v.url,target:"_blank",rel:"noopener noreferrer",onClick:_=>o(_,v.url),children:t("sources.openOriginal")})]});if(!y||!s&&v.type!=="attachment")return a.jsx("div",{className:rt.empty,role:"alert",children:t("sources.unavailable")});const x=v.type==="workspace_file"&&!b&&n4e({workspacePath:w});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:w,children:w}),a.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[p&&a.jsx(Mt,{variant:"ghost",size:"icon-sm",asChild:!0,children:a.jsx("a",{href:p,download:g.title,"aria-label":`Download ${g.title}`,title:t("common.download"),children:a.jsx(nw,{})})}),h&&a.jsx(Mt,{variant:"ghost",size:"sm",onClick:()=>l(_=>_+1),children:t("common.retry")})]})]}),h?a.jsx("div",{className:rt.previewError,role:"alert",children:h}):x?a.jsxs("div",{className:"p-4",children:[a.jsx("p",{children:t("attachment.previewUnsupported")}),a.jsx(Mt,{onClick:()=>void oD(r,w,"application/octet-stream",()=>!e.owner.isCurrent()).catch(_=>{e.owner.isCurrent()&&f(kc(_))}),children:t("common.download")})]}):(v.type==="attachment"||b)&&!c?a.jsx("div",{className:rt.empty,role:"status",children:t("common.loading")}):c&&c.type!=="application/pdf"&&!tT(c.type,w)?a.jsx(C7e,{data:c,title:g.title,onDownloadUrl:m,showDownload:!1,image:!!v_(w)&&c.type.startsWith("image/")}):a.jsx("div",{className:"relative min-h-0 flex-1 overflow-auto",children:a.jsx(wO,{workspacePath:w,workspaceActions:r,onLoadError:f,previewData:c,previewOnly:v.type==="attachment",previewMimeType:c?.type,previewKind:/\.html?$/i.test(w)||Cw(c?.type)==="text/html"?"source":void 0},i)})]})}function C7e({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:rt.imagePreviewWrap,children:[n?a.jsx("img",{className:rt.imagePreview,src:o,alt:t}):a.jsx(T7e,{name:t,mimeType:e.type,size:e.size}),r&&a.jsx("a",{href:o,download:t,"aria-label":`Download ${t}`,children:a.jsx(nw,{})})]}):null}function wO({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(CRn,{workspacePath:e,workspaceActions:n,data:o,mimeType:i,previewKind:c,onLoadError:h});const f=e.toLowerCase(),p=l??v_(e),m=c??(f.endsWith(".html")||f.endsWith(".htm")?"html":f.endsWith(".md")||f.endsWith(".markdown")?"markdown":p?"image":"source");return m==="html"?a.jsx(ERn,{workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:u,onLoadError:h}):m==="markdown"?a.jsx(jRn,{workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:u,onLoadError:h}):m==="image"&&p?a.jsx(RRn,{workspacePath:e,artifactVersion:t,workspaceActions:n,mimeType:p,onLoadError:h}):a.jsx(I7e,{workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:u,onLoadError:h})}function CRn({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(IRn,{data:n,mimeType:i,title:e}):tT(i,e)?a.jsx(TRn,{workspacePath:e,workspaceActions:t,data:n,previewKind:r,onLoadError:o}):a.jsx(T7e,{name:e,mimeType:i,size:n.size})}function TRn({workspacePath:e,workspaceActions:t,data:n,previewKind:s,onLoadError:r}){const{t:o}=pt(),[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:rt.previewError,children:c}):i===void 0?a.jsx("div",{className:rt.empty,children:o("attachment.loadingFile")}):a.jsx(wO,{workspacePath:e,workspaceActions:t,previewContent:i,previewSizeBytes:n.size,previewOnly:!0,previewKind:s})}function IRn({data:e,mimeType:t,title:n}){const{t:s}=pt(),[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:rt.pdfAttachmentPreview,src:r,title:`Preview ${n}`}):a.jsx("div",{className:rt.empty,children:s("attachment.loadingPreview")})}function T7e({name:e,mimeType:t,size:n}){const{t:s}=pt();return a.jsxs("div",{className:rt.unsupportedAttachmentPreview,children:[a.jsx(ag,{name:e,mimeType:t,"aria-hidden":"true"}),a.jsx("div",{children:s("attachment.previewUnsupported")}),a.jsxs("div",{className:rt.unsupportedAttachmentMeta,children:[t," · ",rD(n)]})]})}function RRn({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),TT((f,p)=>n.readFileBytes(f,p),e,s,{statFile:f=>n.stat(f),isCancelled:()=>u}).then(f=>{u||(h=URL.createObjectURL(f),i(h))}).catch(f=>{if(u)return;const p=f instanceof Error?f.message:String(f);c(p),r?.(p)}),()=>{u=!0,h&&URL.revokeObjectURL(h)}},[t,s,r,n,e]),a.jsxs("div",{className:rt.imagePreviewWrap,children:[o?a.jsxs(a.Fragment,{children:[a.jsx("img",{className:rt.imagePreview,src:o,alt:O8(e)}),a.jsx("a",{className:rt.imageDownloadButton,href:o,download:O8(e),"aria-label":`Download ${O8(e)}`,title:"Download",children:a.jsx(nw,{size:16,strokeWidth:1.8})})]}):l?null:a.jsx("div",{className:rt.empty,children:"Loading image..."}),l&&a.jsx("div",{className:rt.previewError,children:l})]})}function mne({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 p=!1;if(l(s??null),f(null),u(void 0),!r)return n.stat(e).then(m=>{if(!p){if(m.type==="directory")throw new Error("Directories cannot be opened as artifacts.");return n.readWorkspaceFile(e,{maxBytes:256*1024})}}).then(async m=>{if(p||!m||!m.truncated)return m;const g=await TT((v,y)=>n.readFileBytes(v,y),e,"application/octet-stream",{statFile:v=>n.stat(v),isCancelled:()=>p});return{sizeBytes:g.size,content:new TextDecoder(m.encoding||"utf-8").decode(await g.arrayBuffer())}}).then(m=>{p||!m||(u(m.sizeBytes),l(m.content))}).catch(m=>{if(p)return;const g=m instanceof Error?m.message:String(m);f(g),o?.(g)}),()=>{p=!0}},[t,s,r,o,n,e]),{content:i,error:h,sizeBytes:c}}function ERn({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:o,onLoadError:i}){const{content:l,error:c,sizeBytes:u}=mne({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:o,onLoadError:i});return a.jsxs("div",{className:rt.htmlPreviewWrap,children:[l===null?!c&&a.jsx("div",{className:rt.empty,children:"Loading preview..."}):a.jsx(R7e,{content:l,sizeBytes:u??r,workspacePath:e,workspaceActions:n,children:()=>a.jsx(ARn,{content:l,workspacePath:e})}),c&&a.jsx("div",{className:rt.previewError,children:c})]})}function ARn({content:e,workspacePath:t}){const n=`Preview ${t}`,{t:s}=pt(),[r,o]=d.useState(null),[i,l]=d.useState(null);return d.useEffect(()=>{const c=new AbortController;return o(null),l(null),Uat(e,n,c.signal).then(u=>{c.signal.aborted||o(u)},u=>{c.signal.aborted||l(kc(u))}),()=>c.abort()},[e,n]),i?a.jsx("div",{className:rt.previewError,children:s("artifact.previewFailed",{message:i})}):r===null?a.jsx("div",{className:rt.empty,children:s("attachment.loadingPreview")}):a.jsx("iframe",{className:rt.htmlPreview,referrerPolicy:"no-referrer",sandbox:"allow-scripts",srcDoc:r,title:n})}function I7e({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}=mne({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 p;try{p=new as({doc:u,extensions:[wMe,as.editable.of(!1),Si.readOnly.of(!0),as.lineWrapping],parent:f})}catch(m){c(m instanceof Error?m.message:String(m));return}return()=>p.destroy()},[u]),a.jsxs("div",{className:rt.filePreviewWrap,children:[u===null?!h&&a.jsx("div",{className:rt.empty,children:"Loading file..."}):a.jsx("div",{ref:i,className:rt.codeMirrorFile}),(h||l)&&a.jsx("div",{className:rt.previewError,children:h||l})]})}function R7e({content:e,sizeBytes:t,workspacePath:n,workspaceActions:s,children:r}){const{t:o}=pt(),[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(Mt,{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(I7e,{workspacePath:n,workspaceActions:s,previewContent:e,previewOnly:!0})})]})}function jRn({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:o,onLoadError:i}){const{content:l,error:c,sizeBytes:u}=mne({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:o,onLoadError:i});return a.jsxs("div",{className:rt.htmlPreviewWrap,children:[l===null?!c&&a.jsx("div",{className:rt.empty,children:"Loading preview..."}):a.jsx(R7e,{content:l,sizeBytes:u??r,workspacePath:e,workspaceActions:n,children:()=>a.jsx("div",{className:rt.markdownPreviewWrap,children:a.jsx(cp,{content:l})})}),c&&a.jsx("div",{className:rt.previewError,children:c})]})}function Jh({label:e,value:t}){return t?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:rt.fieldLabel,children:e}),a.jsx("span",{className:rt.fieldValue,children:t})]}):null}function zS(e,t,n){const s=e[t];return s==null||s===""?null:a.jsx(Jh,{label:n,value:String(s)},t)}/**
|
|
2216
|
+
`);return n===-1?t:t.slice(0,n)}function L3n(e,t){if(e.kind==="request"){const n=[gd(e.timing.durationMs)];return e.timing.ttftMs!==void 0&&n.push(t("trajectory.ttft",{duration:gd(e.timing.ttftMs)})),e.usage&&n.push(N3n(e.usage)),n}if(e.kind==="tool"){const n=[];if(e.timing&&n.push(gd(e.timing.durationMs)),e.subagentSummary){const{requests:s,tools:r,requestMs:o}=e.subagentSummary;n.push(t("trajectory.subagentRollup",{requests:s,tools:r,duration:gd(o)}))}return n}return[]}function vve(e){const t=e.toolStatus??e.block.status;if(t==="error"||t==="failed")return Zi.toneError;if(t==="cancelled")return Zi.toneMuted}function D3n(e,t){switch(e.kind){case"user":return{badge:t("trajectory.badge.user"),text:PR(e.block.text)};case"request":{const n=P3n(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:Zi.toneError}:{},text:s?`${r} · ${t("trajectory.requestFailed")}`:r}}case"message":return{badge:e.thought?t("trajectory.badge.thought"):t("trajectory.badge.message"),text:PR(e.block.text),faint:e.thought};case"tool":return{badge:e.block.toolName??t("trajectory.badge.tool"),...vve(e)?{badgeTone:vve(e)}:{},text:e.block.title||(e.block.toolName??"")};default:return O3n(e.block,t)}}function O3n(e,t){switch(e.kind){case"shell":return{badge:t("trajectory.badge.shell"),text:PR(e.text)};case"user_shell":return{badge:t("trajectory.badge.shell"),text:PR(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:Zi.toneError}:{},text:PR(e.text),faint:e.kind!=="error"};case"prompt_cancelled":return{badge:t("trajectory.badge.cancelled"),badgeTone:Zi.toneMuted,text:e.reason??t("trajectory.cancelled"),faint:!0};default:return{badge:t("trajectory.badge.other"),text:""}}}function $3n(e){return e.rows.some(t=>t.kind==="request"||t.kind==="tool"&&t.timing!==void 0)}function B3n({loadPage:e}){const{t}=pt(),{trajectory:n,status:s,error:r,truncated:o,refresh:i}=r3n(e),[l,c]=d.useState(void 0),u=d.useRef(null),h=d.useRef(!1),f=d.useRef(0),p=d.useId(),m=d.useCallback(S=>`${p}-row-${S}`,[p]),g=d.useCallback((S,R)=>{S.scrollTop=R,f.current=S.scrollTop},[]),v=d.useMemo(()=>{if(!n)return[];const S=new Map(n.rows.map(E=>[E.key,E])),R=[];for(const E of n.turns){const N=E.userRowKey??`ordinal:${E.index}`;R.push({kind:"turn",key:`turn:${N}`,turn:E});for(const A of E.rowKeys){const L=S.get(A);L&&R.push({kind:"row",key:A,row:L})}}return R},[n]),y=v4e({count:v.length,getScrollElement:()=>u.current,getItemKey:S=>v[S]?.key??S,estimateSize:()=>mve,overscan:12}),w=v.length>0;d.useLayoutEffect(()=>{const S=u.current;if(!S||typeof ResizeObserver>"u")return;let R=0;const E=()=>{S.scrollTop===0&&f.current>0&&(S.scrollTop=f.current)},N=new ResizeObserver(()=>{E(),R=requestAnimationFrame(E)});return N.observe(S),()=>{N.disconnect(),R!==0&&cancelAnimationFrame(R)}},[w]),d.useEffect(()=>{if(s!=="ready"||h.current||v.length===0)return;h.current=!0;const S=u.current;S&&g(S,S.scrollHeight)},[g,s,v.length]);const b=d.useMemo(()=>l===void 0?-1:v.findIndex(S=>S.key===l),[l,v]),x=d.useCallback(S=>{if(v.length===0)return;const R=Math.min(Math.max(S,0),v.length-1);c(v[R].key),y.scrollToIndex(R,{align:"auto"})},[y,v]),_=d.useCallback(S=>{c(S),u.current?.focus({preventScroll:!0})},[]),C=d.useCallback(S=>{if(v.length===0)return;const R=b<0?-1:b;S.key==="ArrowDown"?(S.preventDefault(),x(R+1)):S.key==="ArrowUp"?(S.preventDefault(),x(R<=0?0:R-1)):S.key==="Home"?(S.preventDefault(),x(0)):S.key==="End"&&(S.preventDefault(),x(v.length-1))},[x,b,v]),T=d.useMemo(()=>{if(!n)return;let S=0,R=0,E=0;for(const N of n.turns)S+=N.requestCount,R+=N.toolCount,E+=N.requestMs;return{turns:n.turns.length,requests:S,tools:R,durationMs:E}},[n]),I=s==="ready"&&v.length===0,j=n!==void 0&&v.length>0&&!$3n(n);return a.jsxs("div",{className:Zi.panel,"data-testid":"trajectory-panel",children:[a.jsxs("div",{className:Zi.header,children:[a.jsx("div",{className:Zi.summary,children:T?a.jsx("span",{"data-testid":"trajectory-totals",children:t("trajectory.totals",{turns:T.turns,requests:T.requests,tools:T.tools,duration:T.durationMs>0?gd(T.durationMs):"—"})}):a.jsx("span",{children:t("trajectory.title")})}),a.jsx("div",{className:Zi.headerActions,children:a.jsx("button",{type:"button",className:Zi.iconButton,onClick:i,disabled:!e||s==="loading",title:t("common.refresh"),"aria-label":t("common.refresh"),children:a.jsx(ym,{size:14,strokeWidth:1.6})})})]}),r!==void 0&&a.jsxs("div",{className:Zi.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:Zi.headerButton,onClick:i,disabled:s==="loading",children:t("common.retry")})]}),j&&a.jsx("div",{className:Zi.notice,role:"status",children:t("trajectory.noTiming")}),a.jsx("div",{className:Zi.tableWrap,children:v.length===0?s==="error"?null:a.jsx("div",{className:Zi.placeholder,role:"status",children:t(I?"trajectory.empty":"common.loading")}):a.jsxs(a.Fragment,{children:[o&&a.jsx("div",{className:Zi.olderBar,children:a.jsx("span",{className:Zi.olderNotice,"data-testid":"trajectory-truncated",children:t("trajectory.truncated")})}),a.jsx("div",{ref:u,className:Zi.scroll,role:"grid",tabIndex:0,"aria-label":t("trajectory.title"),"aria-rowcount":v.length,"aria-activedescendant":b>=0?m(b):void 0,onKeyDown:C,onScroll:S=>{f.current=S.currentTarget.scrollTop},"data-testid":"trajectory-rows",children:a.jsx("div",{className:Zi.virtualBody,style:{height:`${y.getTotalSize()}px`},children:y.getVirtualItems().map(S=>{const R=v[S.index];return a.jsx("div",{id:m(S.index),className:Zi.virtualRow,style:{height:`${mve}px`,transform:`translateY(${S.start}px)`},role:"row","aria-rowindex":S.index+1,children:R.kind==="turn"?a.jsx(F3n,{turn:R.turn,selected:R.key===l,onSelect:()=>_(R.key)}):a.jsx(z3n,{row:R.row,selected:R.key===l,onSelect:()=>_(R.key)})},S.key)})})})]})})]})}function F3n({turn:e,selected:t,onSelect:n}){const{t:s}=pt();return a.jsxs("div",{className:`${Zi.turnHeader} ${t?Zi.selected:""}`,onClick:n,"aria-selected":t,"data-selected":t?"true":void 0,role:"gridcell","data-testid":"trajectory-turn",children:[a.jsx("span",{className:Zi.turnTitle,children:e.partial?s("trajectory.turnPartial",{index:e.index}):s("trajectory.turn",{index:e.index})}),a.jsx("span",{className:Zi.turnSummary,children:s("trajectory.turnSummary",{requests:e.requestCount,tools:e.toolCount,duration:e.requestMs>0?gd(e.requestMs):"—"})})]})}function z3n({row:e,selected:t,onSelect:n}){const{t:s}=pt(),r=D3n(e,s),o=L3n(e,s);return a.jsxs("div",{className:`${Zi.record} ${t?Zi.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(wrt,{size:12,strokeWidth:1.6,className:Zi.nestMarker,"aria-hidden":"true"}),a.jsx("span",{className:`${Zi.badge} ${r.badgeTone??""}`,children:r.badge}),a.jsx("span",{className:`${Zi.text} ${r.faint?Zi.faint:""}`,children:r.text}),a.jsx("span",{className:Zi.metrics,"data-testid":"trajectory-row-metrics",children:o.length>0?o.join(" · "):"—"})]})}const H3n="_panel_pwtdr_1",U3n="_toolbar_pwtdr_5",W3n="_actions_pwtdr_15",q3n="_feedback_pwtdr_21",V3n="_state_pwtdr_31",_v={panel:H3n,toolbar:U3n,actions:W3n,feedback:q3n,state:V3n};function G3n({sessionActions:e,sessionId:t,controls:n}){const{t:s}=pt(),[r,o]=d.useState(null),[i,l]=d.useState(!0),[c,u]=d.useState(!1),h=d.useRef(0),f=d.useRef(()=>{}),p=d.useRef(null),m=n?.sessionId===t?n:void 0,g=m?.getContextUsage??e?.getContextUsage,v=d.useRef(m);v.current=m;const y=m?.result,[w,b]=d.useState(y),x=!!(y&&y!==w&&(y.kind!=="completed"||!c));d.useEffect(()=>{y?.kind==="completed"&&(h.current++,o(y.usage),u(!1))},[y]),d.useEffect(()=>{let T=!0,I=!1;const j=v.current?.result;o(R=>R?.sessionId===t?R:j?.kind==="completed"?j.usage:null),u(!1),l(!!g);const S=async()=>{if(!T||I||!g)return;I=!0,l(!0),u(!1);const R=h.current,E=p.current,N=E&&E.getContextUsage===g&&E.sessionId===t?E:{getContextUsage:g,sessionId:t,promise:g({detail:!0,silent:!0,...v.current?.result?{syncCounters:!0}:{}})};p.current=N;try{const A=await N.promise;if(!T||R!==h.current)return;o(A.sessionId===t&&A.usage.contextWindowSize>0?A:null)}catch(A){if(!T||R!==h.current)return;u(TZ(A)?"transient":"hard")}finally{I=!1,p.current===N&&(p.current=null),T&&l(!1)}};return f.current=()=>void S(),S(),()=>{T=!1}},[g,t]);const _=!g||i||m?.compressing,C=()=>{b(y),f.current()};return a.jsxs("div",{className:_v.panel,"aria-busy":i,children:[a.jsxs("div",{className:_v.toolbar,children:[a.jsx("span",{children:s("contextUsage.title")}),a.jsxs("div",{className:_v.actions,children:[a.jsx(Mt,{type:"button",variant:"ghost",size:"icon-sm","aria-label":s("contextUsage.refresh"),title:s("contextUsage.refresh"),disabled:_,onClick:C,children:a.jsx(ym,{"aria-hidden":"true"})}),a.jsx("span",{title:m?.compressing?void 0:m?.canCompress?i?s("common.loading"):void 0:s("contextUsage.compressUnavailable"),children:a.jsx(Mt,{type:"button",variant:"outline",size:"sm",disabled:!m?.canCompress||i,onClick:()=>void m?.compress(),children:s(m?.compressing?"contextUsage.compressing":"contextUsage.compress")})})]})]}),(m?.compressing||x)&&a.jsx(a8e,{controls:m,className:_v.feedback}),c==="transient"&&r&&a.jsx("div",{className:_v.feedback,role:"status",children:s("contextUsage.previousReading")}),c==="hard"?a.jsxs("div",{className:_v.state,role:"alert",children:[a.jsx("span",{children:s("contextUsage.loadError")}),a.jsx(Mt,{type:"button",variant:"outline",size:"sm",disabled:_,onClick:C,children:s("contextUsage.retry")})]}):g?i&&!r?a.jsx("div",{className:_v.state,role:"status",children:s("common.loading")}):r?a.jsx(CEe,{status:r,compact:!0}):a.jsx("div",{className:_v.state,children:s("contextUsage.unavailable")}):a.jsx("div",{className:_v.state,children:s("contextUsage.unavailable")})]})}const K3n=700,Y3n=["daily","weekdays","weekly","hourly","minutes","custom"],X3n=[1,2,3,4,5,6,10,12,15,20,30],Z3n=(e,t)=>{},J3n=(e,t,n)=>{},Q3n=()=>Promise.reject(new Error("Side-task session creation is unavailable"));function wve(e){return e.kind==="review"||e.kind==="file"||e.kind==="artifact"||e.kind==="scheduled_task"}function Sv(e){return e.kind==="pending"?e.targetKind:e.kind}function eRn(e){return`image.${(e.match(/^data:image\/([a-z0-9+.+-]+)/i)?.[1]??"png").split("+")[0].toLowerCase()}`}const tRn=["review","sideTask"];function yve({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:p,onOpenFilePreview:m,latestReviewAvailable:g=!1,onOpenLatestReview:v,onOpenTerminal:y,onOpenTrajectory:w,trajectoryTabId:b,onOpenWebPreview:x,onWebPreviewChange:_,items:C=tRn,sideTaskAvailable:T=!1,sideTasks:I=[],sideTasksLoading:j=!1,onCreateSideTask:S,onOpenSideTask:R,onCreateSideTaskSession:E,onSideTaskCreated:N,onSideTaskTitleChange:A,onNestedRightPanelOpen:L,onNestedArtifactsChange:$,onOpenNestedSubagent:M,agentTasks:U=[],agentTraceLoading:W=!1,agentTraceError:z,onOpenWorkflowAgent:P,onError:Y,sessionWorkflowEnabled:Q,workflow:B,onImageIngestionNotice:X,deferSubagentMount:ce=!1,onClose:fe,variant:ee="docked",fullscreen:F=!1,onToggleFullscreen:V}){const{t:oe}=pt(),[ue,de]=d.useState(!1),[ge,ne]=d.useState(),ve=d.useRef(null),ye=d.useCallback(()=>{ve.current&&(clearTimeout(ve.current),ve.current=null),de(!0)},[]),Ce=d.useCallback(()=>{ve.current&&clearTimeout(ve.current),ve.current=setTimeout(()=>{de(!1),ve.current=null},120)},[]);d.useEffect(()=>()=>{ve.current&&clearTimeout(ve.current)},[]);const ke=n.find(me=>me.id===s)??n[0],Oe=ke?.kind==="file"&&ke.sourcePreview&&(/\.html?$/i.test(ke.workspacePath)||Cw(ke.previewMimeType||ke.previewData?.type)==="text/html"),We=ke?.kind==="file"&&ke.previewOnly===!0&&!Oe&&/\.(?:html?|md|markdown)$/i.test(ke.workspacePath)&&(ke.previewContent!==void 0||!ke.previewData||!!tT(ke.previewMimeType||ke.previewData.type,ke.workspacePath)),vt=ge===ke?.id,Se=C.includes("review")&&!n.some(me=>Sv(me)==="review"),Ye=C.includes("sideTask")&&T&&!!S,_e=!!y,se=C.includes("webPreview")&&!!x,O=C.includes("trajectory")&&!!w&&!n.some(me=>me.id===b),G=!!ke&&(Se||Ye||_e||se||O),le=ke&&wve(ke)?{workspaceCwd:ke.workspaceCwd,workspaceId:ke.workspaceId}:void 0,Te=FT(le?.workspaceCwd),Fe=Te?.workspaceId===le?.workspaceId?Te?.actions:void 0,he=ke?.kind==="artifact"?t.find(me=>me.id===ke.artifactId):void 0;return a.jsxs("aside",{className:`${rt.panel} ${ee==="drawer"?rt.panelDrawer:""} ${F?rt.panelFullscreen:""}`,style:ee==="docked"&&i&&!F?{flexBasis:i,width:i}:void 0,"aria-label":"Right panel",children:[a.jsxs("div",{className:rt.header,children:[n.length>0&&a.jsx("div",{className:rt.tabs,role:"tablist","aria-label":"Right panel",children:n.map(me=>a.jsxs("div",{className:[rt.tabItem,me.id===ke?.id?rt.tabActive:""].filter(Boolean).join(" "),children:[a.jsxs("button",{type:"button",role:"tab","aria-selected":me.id===ke?.id,className:rt.tab,onClick:()=>f(me.id),onMouseEnter:Ie=>s2(Ie.currentTarget),onFocus:Ie=>s2(Ie.currentTarget),title:me.title,children:[a.jsx("span",{className:`${rt.tabIcon} ${Sv(me)==="artifact"?rt.tabArtifactIcon:""}`,"aria-hidden":"true",children:Sv(me)==="review"?a.jsx(FU,{}):me.kind==="workflow"?a.jsx(FTe,{className:rt.tabIconSvg,strokeWidth:1.6}):me.kind==="file"?a.jsx(ag,{name:me.workspacePath,className:rt.tabIconSvg,strokeWidth:1.6}):Sv(me)==="artifact"?a.jsx(c4e,{artifact:t.find(Ie=>"artifactId"in me&&Ie.id===me.artifactId),className:rt.tabIconSvg}):Sv(me)==="subagent"?a.jsx(nRn,{}):Sv(me)==="monitor"?a.jsx(KTe,{className:rt.tabIconSvg,strokeWidth:1.6}):Sv(me)==="shell"?a.jsx(TC,{className:rt.tabIconSvg,strokeWidth:1.6}):Sv(me)==="side_task"?a.jsx(Mj,{className:rt.tabIconSvg,strokeWidth:1.6}):me.kind==="web_preview"?a.jsx(XC,{className:rt.tabIconSvg}):me.kind==="terminal"?a.jsx(TC,{className:rt.tabIconSvg,strokeWidth:1.6}):Sv(me)==="image"?a.jsx(bot,{className:rt.tabIconSvg,strokeWidth:1.6}):me.kind==="context_usage"?a.jsx(nD,{className:rt.tabIconSvg,strokeWidth:1.6}):me.kind==="token_usage"?a.jsx(MJ,{className:rt.tabIconSvg,strokeWidth:1.6}):me.kind==="trajectory"?a.jsx(HF,{className:rt.tabIconSvg,strokeWidth:1.6}):a.jsx(rRn,{})}),a.jsx("span",{className:rt.tabTitle,"data-web-shell-session-title":!0,children:a.jsx("span",{className:rt.tabTitleInner,children:me.title})})]}),a.jsx("button",{type:"button",className:rt.tabCloseButton,onClick:()=>p(me.id),"aria-label":`Close ${me.title}`,title:"Close",children:a.jsx(sRn,{})})]},me.id))}),a.jsxs("div",{className:rt.headerActions,children:[G&&a.jsxs(mg,{modal:!1,children:[a.jsx(_m,{asChild:!0,children:a.jsx("button",{type:"button",className:`${rt.iconButton} ${rt.addButton}`,"aria-label":oe("rightPanel.add"),title:oe("rightPanel.add"),children:a.jsx(jh,{className:rt.toolbarIcon})})}),a.jsxs(Sm,{align:"end",className:"w-64",children:[Se&&a.jsxs(Oo,{disabled:!g||!v,onSelect:v,children:[a.jsx(FU,{}),a.jsx("span",{className:rt.sideTaskListTitle,children:oe("turnOutputs.review")})]}),Se&&Ye&&a.jsx(jb,{}),Ye&&a.jsxs(Oo,{disabled:j,onSelect:S,children:[a.jsx(Mj,{className:rt.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:rt.sideTaskListTitle,children:oe("sideTask.create")})]}),_e&&(Se||Ye)&&a.jsx(jb,{}),_e&&a.jsxs(Oo,{onSelect:()=>y?.(),children:[a.jsx(TC,{className:rt.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:rt.sideTaskListTitle,children:oe("terminal.title")})]}),se&&a.jsxs(Oo,{onSelect:x,children:[a.jsx(XC,{className:rt.sideTaskNewIcon}),a.jsx("span",{className:rt.sideTaskListTitle,children:oe("webPreview.title")})]}),O&&a.jsxs(Oo,{onSelect:()=>w?.(),children:[a.jsx(HF,{className:rt.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:rt.sideTaskListTitle,children:oe("trajectory.title")})]})]})]}),V&&a.jsx("button",{type:"button",className:`${rt.iconButton} ${rt.fullscreenButton} ${F?rt.iconButtonActive:""}`,onClick:V,"aria-label":oe(F?"common.exitFullscreen":"common.fullscreen"),"aria-pressed":F,title:oe(F?"common.exitFullscreen":"common.fullscreen"),children:F?a.jsx(LJ,{className:rt.toolbarIcon,"aria-hidden":!0}):a.jsx(jJ,{className:rt.toolbarIcon,"aria-hidden":!0})}),a.jsx("button",{type:"button",className:`${rt.iconButton} ${rt.panelToggleButton}`,onClick:fe,"aria-label":oe("chatHeader.toggleRightPanel"),"aria-pressed":"true",title:oe("chatHeader.toggleRightPanel"),children:a.jsx(zTe,{className:rt.panelToggleIcon})})]})]}),a.jsxs("div",{className:`${rt.body} ${ke?.kind==="side_task"?rt.bodySideTask:""}`.trim(),children:[n.filter(me=>me.kind==="web_preview").map(me=>a.jsx("div",{className:"h-full",hidden:me.id!==ke?.id,children:a.jsx(nIn,{state:me,onChange:Ie=>_?.(me.id,Ie)})},me.id)),n.filter(me=>me.kind==="terminal").map(me=>a.jsx("div",{className:`${rt.terminalPane} ${me.id===ke?.id?"":rt.terminalPaneHidden}`.trim(),"aria-hidden":me.id===ke?.id?void 0:!0,children:a.jsx(tIn,{terminalId:me.id,cwd:me.workspaceCwd??l,active:me.id===ke?.id,enabled:me.initialized!==!1})},me.id)),We&&a.jsxs("button",{type:"button",className:rt.attachmentPreviewButton,onClick:()=>ne(vt?void 0:ke?.id),"aria-label":oe(vt?"attachment.showSource":"attachment.showPreview"),"aria-pressed":vt,children:[vt?a.jsx(drt,{"aria-hidden":!0}):a.jsx(MTe,{"aria-hidden":!0}),oe(vt?"attachment.showSource":"attachment.showPreview")]}),u&&!ke?a.jsxs("div",{className:"flex flex-col gap-4 p-5","data-testid":"right-panel-loading-skeleton",role:"status","aria-label":oe("common.loading"),children:[a.jsx(p0,{className:"h-5 w-2/5"}),a.jsx(p0,{className:"h-32 w-full"}),a.jsx(p0,{className:"h-4 w-4/5"}),a.jsx(p0,{className:"h-4 w-3/5"})]}):ke?.kind==="terminal"||ke?.kind==="web_preview"?null:ke?ke.kind==="pending"?a.jsx("div",{className:rt.empty,role:ke.loadError?"alert":"status",children:ke.loadError??oe("common.loading")}):ke.kind==="workflow"?ke.sessionId?a.jsx(YSn,{tasks:U,loading:W,error:z,onOpenAgent:P}):B?a.jsx(OCn,{...B}):a.jsx("div",{className:rt.empty,children:oe("workflow.empty.title")}):wve(ke)&&(ke.kind!=="scheduled_task"||ke.task.durable)&&(ke.kind!=="file"||!ke.previewOnly)&&(ke.kind!=="artifact"||he?.metadata?.artifactType!=="web_preview_snapshot")&&!Fe?a.jsx("div",{className:rt.empty,role:"alert",children:oe("workspace.notFoundDescription")}):ke.kind==="review"?a.jsx(aRn,{changes:ke.changes??r,selectedPath:ke.selectedPath??o,workspaceCwd:ke.workspaceCwd??l,onOpenFilePreview:me=>m(me,ke.workspaceCwd??l,ke.workspaceId),onDownloadFile:(me,Ie)=>oD(Fe,me.path,Hat(me.path),Ie),onDownloadError:me=>{const Ie=oe("common.downloadFailed",{message:kc(me)});Y?Y(new Error(Ie,{cause:me}),Ie):console.error(Ie,me)}}):ke.kind==="file"?ke.attachmentId&&!ke.previewData&&ke.previewContent===void 0?a.jsx("div",{className:rt.empty,role:ke.loadError?"alert":"status",children:ke.loadError??oe("common.loading")}):ke.sourcePreview&&ke.previewData&&Cw(ke.previewMimeType||ke.previewData.type)!=="application/pdf"&&!tT(ke.previewMimeType||ke.previewData.type,ke.workspacePath)?a.jsx(C7e,{data:ke.previewData,title:ke.title,image:!!v_(ke.workspacePath)&&ke.previewData.type.startsWith("image/")}):a.jsx(wO,{workspacePath:ke.workspacePath,artifactVersion:String(ke.previewVersion??0),workspaceActions:Fe,previewContent:ke.previewContent,previewData:ke.previewData,previewMimeType:ke.previewMimeType,previewOnly:ke.previewOnly,previewKind:Oe||ke.previewOnly&&!vt?"source":void 0},ke.id):ke.kind==="source"?a.jsx(SRn,{tab:ke},ke.id):ke.kind==="artifact"?a.jsx(oRn,{artifacts:t,artifactId:ke.artifactId,sourceSessionId:ke.sourceSessionId,workspaceActions:Fe,previewContent:ke.previewContent,loading:c,error:h},ke.id):ke.kind==="subagent"?ce?null:a.jsx(jSn,{sessionId:ke.sessionId,rootToolCallId:ke.rootToolCallId,initialRootTool:ke.rootTool,workspaceCwd:ke.workspaceCwd??l,onRightPanelOpen:L,onArtifactsChange:$,onOpenSubagent:M,onError:Y}):ke.kind==="monitor"?a.jsx(jAt,{task:ke.task,actions:ke.sessionActions},ke.id):ke.kind==="shell"?a.jsx(NAt,{task:ke.task,actions:ke.sessionActions},ke.id):ke.kind==="side_task"?a.jsx(ZSn,{tabId:ke.id,sessionId:ke.sessionId,parentSessionId:ke.parentSessionId,workspaceCwd:ke.workspaceCwd??l,title:ke.title,shouldNameFromFirstPrompt:ke.nameFromFirstPrompt,initialPrompt:ke.initialPrompt,createSession:E??Q3n,onCreated:N??Z3n,onTitleChange:A??J3n,onRightPanelOpen:L,onArtifactsChange:$,onError:Y,sessionWorkflowEnabled:Q,onImageIngestionNotice:X},ke.id):ke.kind==="image"?ke.src?a.jsxs("div",{className:rt.imagePreviewWrap,children:[a.jsx("img",{src:ke.src,alt:ke.alt??ke.title,className:rt.imagePreview}),a.jsx("a",{className:rt.imageDownloadButton,href:ke.src,download:eRn(ke.src),"aria-label":oe("common.download"),title:oe("common.download"),children:a.jsx(nw,{size:16,strokeWidth:1.8})})]}):a.jsx("div",{className:rt.empty,role:ke.loadError?"alert":"status",children:ke.loadError??oe("common.loading")}):ke.kind==="context_usage"?a.jsx(G3n,{controls:e?.[ke.sessionId],sessionActions:ke.sessionActions,sessionId:ke.sessionId},ke.id):ke.kind==="trajectory"?a.jsx(B3n,{loadPage:ke.loadPage},ke.id):ke.kind==="token_usage"?a.jsx(UIn,{sessionActions:ke.sessionActions,sessionId:ke.sessionId},ke.id):a.jsx(iRn,{task:ke.task,actions:Fe},ke.id):a.jsxs("div",{className:rt.emptyActions,"data-testid":"right-panel-empty-actions",children:[C.includes("review")&&a.jsxs("button",{type:"button",className:rt.emptyAction,disabled:!g||!v,onClick:v,children:[a.jsx("span",{className:rt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(FU,{})}),a.jsx("span",{className:rt.emptyActionTitle,children:oe("turnOutputs.review")}),a.jsx("span",{className:rt.emptyActionHint,children:oe("turnOutputs.reviewLatest")}),a.jsx($a,{className:rt.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]}),C.includes("sideTask")&&T&&S&&(I.length===0?a.jsxs("button",{type:"button",className:rt.emptyAction,disabled:j,"aria-busy":j,onClick:S,children:[a.jsx("span",{className:rt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(Mj,{strokeWidth:1.6})}),a.jsx("span",{className:rt.emptyActionTitle,children:oe("sideTask.title")}),a.jsx("span",{className:rt.emptyActionHint,children:oe("sideTask.description")}),a.jsx($a,{className:rt.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]}):a.jsxs(mg,{open:ue,onOpenChange:de,modal:!1,children:[a.jsx(_m,{asChild:!0,children:a.jsxs("button",{type:"button",className:rt.emptyAction,"aria-expanded":ue,onMouseEnter:ye,onMouseLeave:Ce,children:[a.jsx("span",{className:rt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(Mj,{strokeWidth:1.6})}),a.jsx("span",{className:rt.emptyActionTitle,children:oe("sideTask.title")}),a.jsx("span",{className:rt.emptyActionHint,children:oe("sideTask.description")}),a.jsx($a,{className:rt.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]})}),a.jsxs(Sm,{align:"end",className:"w-80",onMouseEnter:ye,onMouseLeave:Ce,children:[I.map(me=>a.jsxs(Oo,{onSelect:()=>R?.(me),children:[a.jsx("span",{className:rt.sideTaskListTitle,children:me.title}),me.updatedAt&&a.jsx("span",{className:rt.sideTaskListTime,children:oA(me.updatedAt,oe)})]},me.sessionId)),a.jsx(jb,{}),a.jsxs(Oo,{onSelect:S,children:[a.jsx(Qst,{className:rt.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:rt.sideTaskListTitle,children:oe("sideTask.new")})]})]})]})),se&&a.jsxs("button",{type:"button",className:rt.emptyAction,onClick:x,children:[a.jsx("span",{className:rt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(XC,{strokeWidth:1.6})}),a.jsx("span",{className:rt.emptyActionTitle,children:oe("webPreview.title")}),a.jsx("span",{className:rt.emptyActionHint,children:oe("webPreview.openHint")}),a.jsx($a,{className:rt.emptyActionChevron,"aria-hidden":"true"})]}),O&&a.jsxs("button",{type:"button",className:rt.emptyAction,onClick:()=>w?.(),"data-testid":"right-panel-open-trajectory",children:[a.jsx("span",{className:rt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(HF,{strokeWidth:1.6})}),a.jsx("span",{className:rt.emptyActionTitle,children:oe("trajectory.title")}),a.jsx("span",{className:rt.emptyActionHint,children:oe("trajectory.description")}),a.jsx($a,{className:rt.emptyActionChevron,"aria-hidden":"true"})]}),y&&a.jsxs("button",{type:"button",className:rt.emptyAction,onClick:()=>y(),children:[a.jsx("span",{className:rt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(TC,{strokeWidth:1.6})}),a.jsx("span",{className:rt.emptyActionTitle,children:oe("terminal.title")}),a.jsx("span",{className:rt.emptyActionHint,children:oe("terminal.open")}),a.jsx($a,{className:rt.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]})]})]})]})}function nRn(){return a.jsxs("svg",{className:rt.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 sRn(){return a.jsx("svg",{className:rt.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 FU(){return a.jsxs("svg",{className:rt.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 rRn(){return a.jsxs("svg",{className:rt.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 oRn({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(wRn,{artifact:l,sourceSessionId:n,workspaceActions:s,previewContent:r}):o?a.jsx("div",{className:rt.empty,children:"Loading artifact..."}):i?a.jsx("div",{className:rt.empty,children:i}):a.jsx("div",{className:rt.empty,children:"Artifact not found."})}function iRn({task:e,actions:t}){const{t:n}=pt(),[s,r]=d.useState(null),[o,i]=d.useState(!0),[l,c]=d.useState(null),[u,h]=d.useState(""),[f,p]=d.useState(e.prompt),[m,g]=d.useState(()=>Oy(e.cron)),[v,y]=d.useState(!1),[w,b]=d.useState(!1),[x,_]=d.useState(!1),[C,T]=d.useState(!1),[I,j]=d.useState(null),S=d.useRef(0),R=d.useRef(0),E=d.useRef({actions:t,taskId:e.id,workspaceId:e.workspaceId});E.current={actions:t,taskId:e.id,workspaceId:e.workspaceId};const N=d.useCallback((oe,ue,de,ge)=>{const ne=E.current;return oe===S.current&&ne.actions===ue&&ne.taskId===de&&ne.workspaceId===ge},[]),A=d.useCallback((oe,ue,de,ge)=>{const ne=E.current;return oe===R.current&&ne.actions===ue&&ne.taskId===de&&ne.workspaceId===ge},[]);d.useEffect(()=>()=>{S.current+=1,R.current+=1},[]),d.useEffect(()=>{_(!1),T(!1),j(null)},[t,e.id,e.workspaceId]);const L=d.useCallback(async()=>{const oe=++S.current,ue=++R.current,de=e.id,ge=e.workspaceId;if(!e.durable||!t){r(null),h(""),p(e.prompt),g(Oy(e.cron)),c(null),i(!1);return}i(!0),c(null);try{const ne=await t.listScheduledTasks(ge);if(!N(oe,t,de,ge))return;const ve=ne.find(ye=>ye.id===e.id)??null;r(ve),ve?(h(ve.name??""),p(ve.prompt),g(Oy(ve.cron))):(h(""),p(e.prompt),g(Oy(e.cron)))}catch(ne){A(ue,t,de,ge)&&c(ne instanceof Error?ne.message:String(ne))}finally{A(ue,t,de,ge)&&i(!1)}},[t,A,N,e.cron,e.durable,e.id,e.prompt,e.workspaceId]);d.useEffect(()=>{L()},[L]);const $=!e.durable,M=e.durable&&!o&&!l&&!s,U=!!s,W=s?.name||s?.prompt||e.title,z=s?.prompt??e.prompt,P=s?.cron??e.cron,Y=s?.recurring??e.recurring,Q=s?.enabled,B=d.useCallback(()=>{s&&(h(s.name??""),p(s.prompt),g(Oy(s.cron)),j(null),y(!0))},[s]),X=d.useCallback(()=>{y(!1),j(null),s&&(h(s.name??""),p(s.prompt),g(Oy(s.cron)))},[s]),ce=d.useCallback(async()=>{if(!s||!t)return;const oe=Q9(m);if(!oe){j(n("scheduledTasks.error.invalidSchedule"));return}if(f.trim().length===0){j(n("scheduledTasks.error.emptyPrompt"));return}const ue=++S.current,de=e.id,ge=e.workspaceId;T(!0),j(null);try{const ne=await t.updateScheduledTask(s.id,{cron:oe,prompt:f.trim(),name:u.trim()||null},ge);if(!N(ue,t,de,ge))return;r(ne),h(ne.name??""),p(ne.prompt),g(Oy(ne.cron)),y(!1)}catch(ne){N(ue,t,de,ge)&&j(ne instanceof Error?ne.message:String(ne))}finally{N(ue,t,de,ge)&&T(!1)}},[t,m,N,s,u,f,n,e.id,e.workspaceId]),fe=d.useCallback(async()=>{if(!s||!t)return;const oe=++S.current,ue=e.id,de=e.workspaceId;_(!0),j(null);try{const ge=await t.updateScheduledTask(s.id,{enabled:!s.enabled},de);if(!N(oe,t,ue,de))return;r(ge)}catch(ge){N(oe,t,ue,de)&&j(ge instanceof Error?ge.message:String(ge))}finally{N(oe,t,ue,de)&&_(!1)}},[t,N,s,e.id,e.workspaceId]),ee=d.useCallback(async()=>{if(!s||!t)return;const oe=++S.current,ue=e.id,de=e.workspaceId;_(!0),j(null);try{if(await t.deleteScheduledTask(s.id,de),!N(oe,t,ue,de))return;r(null),b(!1)}catch(ge){N(oe,t,ue,de)&&j(ge instanceof Error?ge.message:String(ge))}finally{N(oe,t,ue,de)&&_(!1)}},[t,N,s,e.id,e.workspaceId]),F=Q9(m),V=F?P2(F,n):null;return a.jsxs("div",{className:rt.detail,children:[o&&a.jsx("div",{className:rt.empty,children:n("scheduledTasks.loading")}),l&&a.jsx("div",{className:Ut.loadError,children:l}),M&&a.jsx("div",{className:rt.empty,children:n("scheduledTasks.deletedSnapshot")}),$&&a.jsx("div",{className:rt.empty,children:n("scheduledTasks.sessionScopedSnapshot")}),!M&&a.jsx("div",{className:rt.section,children:a.jsxs("div",{className:rt.fieldGrid,children:[a.jsx("span",{className:rt.fieldLabel,children:n("scheduledTasks.name")}),a.jsx("span",{className:rt.fieldValue,children:W}),a.jsx("span",{className:rt.fieldLabel,children:n("scheduledTasks.taskId")}),a.jsx("span",{className:rt.fieldValue,children:e.id}),a.jsx("span",{className:rt.fieldLabel,children:n("scheduledTasks.schedule")}),a.jsx("span",{className:rt.fieldValue,children:P2(P,n)}),a.jsx("span",{className:rt.fieldLabel,children:"Cron"}),a.jsx("span",{className:rt.fieldValue,children:P}),a.jsx("span",{className:rt.fieldLabel,children:n("scheduledTasks.type")}),a.jsx("span",{className:rt.fieldValue,children:n(Y?"scheduledTasks.repeats":"scheduledTasks.runsOnce")}),Q!==void 0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:rt.fieldLabel,children:n("scheduledTasks.status")}),a.jsx("span",{className:rt.fieldValue,children:n(Q?"scheduledTasks.enable":"scheduledTasks.disable")})]})]})}),!M&&a.jsxs("div",{className:rt.section,children:[a.jsx("div",{className:rt.sectionTitle,children:"Prompt"}),a.jsx("div",{className:rt.description,children:z})]}),I&&a.jsx("div",{className:Ut.formError,children:I}),a.jsxs("div",{className:rt.actionsRow,children:[a.jsx("button",{type:"button",className:Ut.primaryButton,disabled:!U||x,onClick:B,children:n("scheduledTasks.edit")}),a.jsx("button",{type:"button",className:Ut.secondaryButton,disabled:!U||x,onClick:()=>void fe(),children:s?.enabled?n("scheduledTasks.disable"):n("scheduledTasks.enable")}),a.jsx("button",{type:"button",className:Ut.secondaryButton,disabled:!U||x,onClick:()=>b(!0),children:n("scheduledTasks.delete")})]}),w&&s&&a.jsx(Ji,{title:n("scheduledTasks.deleteConfirmTitle"),size:"sm",onClose:()=>b(!1),children:a.jsxs("div",{className:Ut.formFields,children:[a.jsx("div",{className:rt.description,children:n("scheduledTasks.deleteConfirm",{name:s.name||s.prompt})}),I&&a.jsx("div",{className:Ut.formError,children:I}),a.jsxs("div",{className:Ut.formActions,children:[a.jsx("button",{type:"button",className:Ut.secondaryButton,onClick:()=>b(!1),disabled:x,children:n("scheduledTasks.cancel")}),a.jsx("button",{type:"button",className:Ut.primaryButton,onClick:()=>void ee(),disabled:x,children:n("scheduledTasks.delete")})]})]})}),v&&a.jsx(Ji,{title:n("scheduledTasks.editTitle"),size:"md",onClose:X,children:a.jsxs("div",{className:Ut.formFields,children:[a.jsxs("label",{className:Ut.field,children:[a.jsx("span",{className:Ut.fieldLabel,children:n("scheduledTasks.name")}),a.jsx("input",{className:Ut.input,type:"text",value:u,maxLength:200,placeholder:n("scheduledTasks.namePlaceholder"),onChange:oe=>h(oe.target.value)})]}),a.jsxs("label",{className:Ut.field,children:[a.jsxs("span",{className:Ut.fieldLabel,children:[n("scheduledTasks.prompt"),a.jsx("span",{className:Ut.required,children:"*"})]}),a.jsx("textarea",{className:Ut.textarea,value:f,rows:4,maxLength:1e5,placeholder:n("scheduledTasks.promptPlaceholder"),onChange:oe=>p(oe.target.value)})]}),a.jsxs("div",{className:Ut.scheduleRow,children:[a.jsxs("label",{className:Ut.field,children:[a.jsx("span",{className:Ut.fieldLabel,children:n("scheduledTasks.frequency")}),a.jsx("select",{className:Ut.select,value:m.frequency,onChange:oe=>{const ue=oe.target.value;g(de=>({...de,frequency:ue,...ue==="hourly"?{time:"00:00"}:{}}))},children:Y3n.map(oe=>a.jsx("option",{value:oe,children:n(`scheduledTasks.freq.${oe}`)},oe))})]}),(m.frequency==="daily"||m.frequency==="weekdays"||m.frequency==="weekly")&&a.jsxs("label",{className:Ut.field,children:[a.jsx("span",{className:Ut.fieldLabel,children:n("scheduledTasks.time")}),a.jsx("input",{className:Ut.input,type:"time",value:m.time,onChange:oe=>g(ue=>({...ue,time:oe.target.value}))})]}),m.frequency==="weekly"&&a.jsxs("label",{className:Ut.field,children:[a.jsx("span",{className:Ut.fieldLabel,children:n("scheduledTasks.weekday")}),a.jsx("select",{className:Ut.select,value:m.weekday,onChange:oe=>g(ue=>({...ue,weekday:Number(oe.target.value)})),children:n("scheduledTasks.weekdayNames").split(",").map((oe,ue)=>a.jsx("option",{value:ue,children:oe},ue))})]}),m.frequency==="minutes"&&a.jsxs("label",{className:Ut.field,children:[a.jsx("span",{className:Ut.fieldLabel,children:n("scheduledTasks.interval")}),a.jsx("select",{className:Ut.select,value:m.minuteInterval,onChange:oe=>g(ue=>({...ue,minuteInterval:Number(oe.target.value)})),children:X3n.map(oe=>a.jsx("option",{value:oe,children:oe},oe))})]}),m.frequency==="custom"&&a.jsxs("label",{className:`${Ut.field} ${Ut.fieldGrow}`,children:[a.jsx("span",{className:Ut.fieldLabel,children:n("scheduledTasks.cron")}),a.jsx("input",{className:Ut.input,type:"text",value:m.customCron,spellCheck:!1,placeholder:"0 9 * * 1-5",onChange:oe=>g(ue=>({...ue,customCron:oe.target.value}))})]})]}),a.jsx("div",{className:Ut.preview,children:V?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:Ut.previewLabel,children:V}),a.jsx("code",{className:Ut.previewCron,children:F})]}):a.jsx("span",{className:Ut.previewInvalid,children:n("scheduledTasks.error.invalidSchedule")})}),I&&a.jsx("div",{className:Ut.formError,children:I}),a.jsxs("div",{className:Ut.formActions,children:[a.jsx("button",{type:"button",className:Ut.secondaryButton,onClick:X,disabled:C,children:n("scheduledTasks.cancel")}),a.jsx("button",{type:"button",className:Ut.primaryButton,onClick:()=>void ce(),disabled:C,children:n(C?"scheduledTasks.saving":"scheduledTasks.save")})]})]})})]})}function aRn({changes:e,selectedPath:t,workspaceCwd:n,onOpenFilePreview:s,onDownloadFile:r,onDownloadError:o}){const{t:i}=pt(),[l,c]=d.useState(!1),[u,h]=d.useState(!0),[f,p]=d.useState(!1),[m,g]=d.useState(520),v=d.useRef(m),y=d.useRef(null),w=d.useRef(null),[b,x]=d.useState(null),[_,C]=d.useState(()=>new Set),T=d.useRef(!0);d.useEffect(()=>(T.current=!0,()=>{T.current=!1}),[]);const I=l,j=d.useMemo(()=>vRn(e,n),[e,n]);d.useEffect(()=>{x(t)},[t]),d.useEffect(()=>{v.current=m},[m]),d.useEffect(()=>{const A=y.current;if(!A)return;const L=()=>{p(A.clientWidth<K3n)};L();const $=new ResizeObserver(L);return $.observe(A),()=>$.disconnect()},[u]),d.useEffect(()=>()=>w.current?.(),[]);const S=d.useCallback(A=>{const L=y.current;if(!L)return;A.preventDefault();const $=A.currentTarget;$.setPointerCapture(A.pointerId);const M=A.clientX,U=v.current,W=L.getBoundingClientRect().width,z=Math.max(180,W-180),P=document.body.style.cursor,Y=document.body.style.userSelect;let Q=U,B=null;document.body.style.cursor="col-resize",document.body.style.userSelect="none";const X=()=>{B=null,g(Q)},ce=F=>{Q=Math.min(z,Math.max(180,U+(F.clientX-M))),B===null&&(B=window.requestAnimationFrame(X))};let fe=()=>{};const ee=F=>{w.current=null,B!==null&&(window.cancelAnimationFrame(B),B=null),F&&g(Q),$.hasPointerCapture(A.pointerId)&&$.releasePointerCapture(A.pointerId),document.body.style.cursor=P,document.body.style.userSelect=Y,window.removeEventListener("pointermove",ce),window.removeEventListener("pointerup",fe),window.removeEventListener("pointercancel",fe)};fe=()=>ee(!0),w.current=()=>ee(!1),window.addEventListener("pointermove",ce),window.addEventListener("pointerup",fe),window.addEventListener("pointercancel",fe)},[]);if(e.length===0)return a.jsx("div",{className:rt.empty,children:"No file changes to review."});const R=I5e(e),E=A=>{x(L=>L===A?null:A)},N=async A=>{if(!_.has(A.path)){C(L=>new Set(L).add(A.path));try{await r(A,()=>!T.current)}catch(L){T.current&&o(L)}finally{C(L=>{const $=new Set(L);return $.delete(A.path),$})}}};return a.jsxs("div",{className:rt.review,children:[a.jsxs("div",{className:rt.reviewToolbar,children:[a.jsxs("div",{className:rt.reviewToolbarTitle,children:[a.jsx("span",{children:i("turnOutputs.previousTurn")}),a.jsx(H7,{additions:R?.additions,deletions:R?.deletions,className:rt.lineStats,additionsClassName:rt.additions,deletionsClassName:rt.deletions})]}),a.jsxs("div",{className:rt.reviewToolbarActions,children:[a.jsxs("button",{type:"button",className:rt.reviewTotalsButton,onClick:()=>h(A=>!A),"aria-expanded":u,children:[a.jsx("span",{children:i("turnOutputs.fileCount",{count:e.length})}),a.jsx("span",{className:[rt.chevron,u?rt.chevronOpen:""].filter(Boolean).join(" "),"aria-hidden":"true",children:a.jsx(xve,{})})]}),a.jsx("button",{type:"button",className:[rt.iconButton,l?rt.iconButtonActive:""].filter(Boolean).join(" "),onClick:()=>c(A=>!A),"aria-label":i(l?"turnOutputs.closeFileTree":"turnOutputs.openFileTree"),title:i(l?"turnOutputs.closeFileTree":"turnOutputs.openFileTree"),children:l?a.jsx(mRn,{}):a.jsx(pRn,{})})]})]}),u&&a.jsxs("div",{ref:y,className:[rt.reviewContent,I?"":rt.reviewContentListOnly,I&&f?rt.reviewContentStacked:""].filter(Boolean).join(" "),style:{"--review-list-width":`${m}px`},children:[a.jsx("div",{className:[rt.reviewList,b?rt.reviewListWithExpanded:""].filter(Boolean).join(" "),children:e.map(A=>{const L=b===A.path,$=A5e(A.path),M=UOt(A.path);return a.jsxs("div",{className:[rt.reviewItem,L?rt.reviewItemExpanded:""].filter(Boolean).join(" "),children:[a.jsxs("div",{className:rt.reviewRow,"data-selected":A.path===t||void 0,children:[a.jsx("button",{type:"button",className:rt.reviewRowToggle,onClick:()=>E(A.path),"aria-label":A.path,"aria-expanded":L}),a.jsx("span",{className:rt.fileIcon,children:S7e(A.path)}),a.jsxs("span",{className:rt.reviewFileName,children:[a.jsx(dRn,{path:UD(A.path,n),title:A.path}),$&&a.jsx("button",{type:"button",className:rt.reviewOpenButton,onClick:()=>s(A),title:`${i("turnOutputs.preview")} ${A.path}`,children:i("turnOutputs.preview")}),M&&a.jsx("button",{type:"button",className:rt.reviewOpenButton,onClick:()=>void N(A),title:`${i("common.download")} ${A.path}`,disabled:_.has(A.path),children:i(_.has(A.path)?"common.downloading":"common.download")})]}),a.jsx(H7,{additions:A.additions,deletions:A.deletions,className:rt.lineStats,additionsClassName:rt.additions,deletionsClassName:rt.deletions}),a.jsx("span",{className:[rt.chevron,L?rt.chevronOpen:""].filter(Boolean).join(" "),"aria-hidden":"true",children:a.jsx(xve,{})})]}),L&&a.jsx(lRn,{change:A})]},`${A.toolCallId}:${A.path}`)})}),I&&!f&&a.jsx("div",{className:rt.reviewSplitHandle,role:"separator","aria-orientation":"vertical",onPointerDown:S}),I&&a.jsx("div",{className:rt.tree,children:j.children.map(A=>a.jsx(x7e,{node:A,depth:0,selectedPath:t},A.path))})]})]})}function lRn({change:e}){if(e.diffs.length===0)return a.jsx("div",{className:rt.diffEmpty,children:"No diff available."});const t=cRn(e.diffs);return a.jsx("div",{className:rt.diffPreview,children:t.map((n,s)=>n.fileDiff&&!n.fullContent?a.jsx(aee,{diff:n.fileDiff},s):a.jsx(uRn,{oldText:n.oldText,newText:n.newText},s))})}function cRn(e){for(let t=e.length-1;t>=0;t--)if(e[t]?.fullContent)return e.slice(t);return e}function uRn({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=[wMe,as.editable.of(!1),Si.readOnly.of(!0),as.lineWrapping],f={scanLimit:1e3,timeout:500},p={margin:3,minSize:8};return Ue(async()=>{const{MergeView:m,unifiedMergeView:g}=await import("./index-Dt92aFEi.js");return{MergeView:m,unifiedMergeView:g}},[]).then(({MergeView:m,unifiedMergeView:g})=>{if(!c)try{if(s){u=new m({a:{doc:e,extensions:h},b:{doc:t,extensions:h},parent:l,highlightChanges:!0,gutter:!0,revertControls:void 0,collapseUnchanged:p,diffConfig:f});return}u=new as({doc:t,extensions:[...h,g({original:e,highlightChanges:!0,gutter:!0,mergeControls:!1,allowInlineDiffs:!0,collapseUnchanged:p,diffConfig:f})],parent:l})}catch(v){c||i(v instanceof Error?v.message:String(v))}}).catch(m=>{c||i(m instanceof Error?m.message:String(m))}),()=>{c=!0,u?.destroy()}},[s,t,e]),a.jsxs("div",{className:rt.codeMirrorDiffWrap,children:[a.jsx("div",{ref:n,className:rt.codeMirrorDiff}),o&&a.jsxs("div",{className:rt.diffError,children:["Diff unavailable: ",o]})]})}function x7e({node:e,depth:t,selectedPath:n}){const s=!!e.file,[r,o]=d.useState(!0),i=[rt.treeRow,s?rt.treeFile:rt.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:rt.treeTwisty,children:!s&&a.jsx("span",{className:[rt.treeChevron,r?"":rt.treeChevronClosed].filter(Boolean).join(" "),children:a.jsx(gRn,{})})}),a.jsxs("span",{className:rt.treeContent,children:[s&&a.jsx("span",{className:rt.fileIcon,children:S7e(e.path)}),a.jsx("span",{className:rt.treeName,children:e.name})]}),e.file?.isArtifact&&a.jsx("span",{className:rt.reviewBadge,children:"artifact"})]});return a.jsxs("div",{className:rt.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:rt.treeChildren,style:c,children:e.children.map(h=>a.jsx(x7e,{node:h,depth:t+1,selectedPath:n},h.path))})]})}function dRn({path:e,title:t}){const n=d.useRef(null),[s,r]=d.useState(()=>k7e(e));return d.useLayoutEffect(()=>{const o=n.current;if(!o)return;const i=()=>r(hRn(e,o));i();const l=new ResizeObserver(i);return l.observe(o),()=>l.disconnect()},[e]),a.jsxs("span",{ref:n,className:rt.reviewPath,title:t??e,children:[s.prefix&&a.jsx("span",{className:rt.pathPrefix,children:s.prefix}),a.jsx("span",{className:rt.pathFileName,children:s.leaf})]})}function k7e(e){const t=e.lastIndexOf("/");return t<0?{prefix:"",leaf:e}:{prefix:e.slice(0,t+1),leaf:e.slice(t+1)}}let bve=null;function hRn(e,t){const n=k7e(e),s=t.clientWidth;if(s<=0)return n;const r=fRn(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 fRn(e){bve??=document.createElement("canvas");const t=bve.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 pRn(){return a.jsxs("svg",{className:rt.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 mRn(){return a.jsxs("svg",{className:rt.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 xve(){return a.jsx("svg",{className:rt.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 gRn(){return a.jsx("svg",{className:rt.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 vRn(e,t){const n={name:"",path:"",children:[]};for(const s of e){const r=UD(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 _7e(n),n}function _7e(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)_7e(t)}function O8(e){return Tw(e).split("/").filter(Boolean).at(-1)??e}function S7e(e){const t=O8(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 wRn({artifact:e,sourceSessionId:t,workspaceActions:n,previewContent:s}){const{t:r}=pt(),o=_f(),i=o4e(e),l=LT(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=r4e(e);return e.metadata?.artifactType==="web_preview_snapshot"?a.jsx(sIn,{artifact:e,sourceSessionId:t}):u?e.status!=="available"?a.jsx(yRn,{status:e.status}):!h||!e.workspacePath?a.jsx(bRn,{}):a.jsx(pSn,{workspacePath:e.workspacePath,artifactVersion:pce(e),workspaceActions:n}):h&&e.workspacePath?n4e(e)?a.jsx(_Rn,{artifact:e,workspaceActions:n}):a.jsx(wO,{workspacePath:e.workspacePath,artifactVersion:pce(e),workspaceActions:n,previewContent:s,previewSizeBytes:e.sizeBytes,imageMimeType:f,previewKind:xRn(e)?"html":kRn(e)?"markdown":f?"image":"source"}):a.jsxs("div",{className:rt.detail,children:[a.jsxs("div",{className:rt.section,children:[a.jsx("div",{className:rt.sectionTitle,children:c?"Automation Snapshot":"Artifact"}),a.jsxs("div",{className:rt.fieldGrid,children:[a.jsx(Jh,{label:"Type",value:OJ(e.kind,e.workspacePath)}),a.jsx(Jh,{label:"Storage",value:e.storage}),a.jsx(Jh,{label:"Status",value:e.status}),a.jsx(Jh,{label:"Source",value:e.source}),a.jsx(Jh,{label:"Size",value:rD(e.sizeBytes)}),a.jsx(Jh,{label:"Created",value:e.createdAt}),a.jsx(Jh,{label:"Updated",value:e.updatedAt}),e.toolName&&a.jsx(Jh,{label:"Tool",value:e.toolName}),e.toolCallId&&a.jsx(Jh,{label:"Tool call",value:e.toolCallId})]})]}),e.description&&a.jsxs("div",{className:rt.section,children:[a.jsx("div",{className:rt.sectionTitle,children:"Description"}),a.jsx("div",{className:rt.description,children:e.description})]}),c&&e.metadata&&a.jsxs("div",{className:rt.section,children:[a.jsx("div",{className:rt.sectionTitle,children:"Details"}),a.jsxs("div",{className:rt.fieldGrid,children:[zS(e.metadata,"automationId","Automation ID"),zS(e.metadata,"schedule","Schedule"),zS(e.metadata,"timezone","Timezone"),zS(e.metadata,"status","Status"),zS(e.metadata,"nextRunAt","Next run"),zS(e.metadata,"prompt","Prompt")]})]}),(i||l)&&a.jsxs("div",{className:rt.section,children:[a.jsx("div",{className:rt.sectionTitle,children:"Location"}),l?a.jsxs("div",{className:rt.locationRow,children:[a.jsx("a",{className:rt.link,href:l,target:"_blank",rel:"noopener noreferrer",onClick:p=>o(p,l),children:l}),a.jsx("a",{className:rt.openButton,href:l,target:"_blank",rel:"noopener noreferrer",onClick:p=>o(p,l),children:r("artifact.openLink")})]}):a.jsx("div",{className:rt.meta,children:i})]})]})}function yRn({status:e}){const{t}=pt();return a.jsx("div",{className:rt.previewError,role:"alert",children:t("codeReview.unavailable",{status:e})})}function bRn(){const{t:e}=pt();return a.jsx("div",{className:rt.previewError,role:"alert",children:e("codeReview.workspaceRequired")})}function xRn(e){const t=e.workspacePath?.toLowerCase()??"",n=Cw(e.mimeType);return e.kind==="html"||t.endsWith(".html")||t.endsWith(".htm")||n==="text/html"}function kRn(e){const t=e.workspacePath?.toLowerCase()??"",n=Cw(e.mimeType);return t.endsWith(".md")||t.endsWith(".markdown")||n==="text/markdown"}function _Rn({artifact:e,workspaceActions:t}){const{t:n}=pt(),[s,r]=d.useState(null),[o,i]=d.useState(!1),l=d.useRef(!0),c=o4e(e);d.useEffect(()=>(l.current=!0,()=>{l.current=!1}),[]);const u=async()=>{if(e.workspacePath){i(!0),r(null);try{await oD(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:rt.detail,children:a.jsxs("div",{className:rt.section,children:[a.jsx("div",{className:rt.sectionTitle,children:n("common.download")}),a.jsxs("div",{className:rt.fieldGrid,children:[a.jsx(Jh,{label:"Type",value:OJ(e.kind,e.workspacePath)}),a.jsx(Jh,{label:"Size",value:rD(e.sizeBytes)}),c?a.jsx(Jh,{label:"Location",value:c}):null,e.status!=="available"&&e.status!=="changed"?a.jsx(Jh,{label:"Status",value:e.status??"missing"}):null]}),a.jsx("div",{className:rt.downloadRow,children:a.jsx("button",{type:"button",className:rt.downloadButton,onClick:()=>{u()},disabled:o||e.status!=="available"&&e.status!=="changed",children:n(o?"common.downloading":"common.download")})}),s&&a.jsx("div",{className:rt.previewError,children:s})]})})}function SRn({tab:e}){const{t}=pt(),n=ua(),s=FT(e.workspaceCwd),r=s?.actions,o=_f(),[i,l]=d.useState(0),[c,u]=d.useState(),[h,f]=d.useState(),[p,m]=d.useState(),g=e.source,v=g.locator,y=e.owner.isCurrent()&&n.sessionId===e.sourceSessionId&&n.capabilities?.features.includes("session_sources")&&s?.workspaceId===e.workspaceId&&(!!s||e.workspaceCwd===void 0&&v.type!=="workspace_file")&&(v.type!=="workspace_file"||g.workspaceCwd===n.workspaceCwd),w=v.type==="workspace_file"?v.workspacePath:v.type==="attachment"?v.attachmentId:"",b=/\.pdf$/i.test(w);if(d.useEffect(()=>{let _=!1;return u(void 0),f(void 0),m(void 0),!y||v.type==="url"?void 0:((async()=>{if(v.type==="attachment"){const T=await e.sessionActions.readAttachment(v.attachmentId);if(_||!e.owner.isCurrent())return;const I=Uint8Array.from(atob(T.data),j=>j.charCodeAt(0));u(new Blob([I],{type:T.mimeType}))}else if(b&&r){const T=await TT(r.readFileBytes,w,"application/pdf",{statFile:r.stat,isCancelled:()=>_||!e.owner.isCurrent()});!_&&e.owner.isCurrent()&&u(T)}})().catch(T=>{!_&&e.owner.isCurrent()&&f(kc(T))}),()=>{_=!0})},[i,y,v,w,b,e.owner,e.sessionActions,r]),y&&v.type==="url")return a.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[a.jsx("h3",{children:g.title}),g.description&&a.jsx("p",{children:g.description}),a.jsx("p",{className:"break-all text-sm text-muted-foreground",children:v.url}),LT(v.url)&&a.jsx("a",{className:"text-primary underline",href:v.url,target:"_blank",rel:"noopener noreferrer",onClick:_=>o(_,v.url),children:t("sources.openOriginal")})]});if(!y||!s&&v.type!=="attachment")return a.jsx("div",{className:rt.empty,role:"alert",children:t("sources.unavailable")});const x=v.type==="workspace_file"&&!b&&n4e({workspacePath:w});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:w,children:w}),a.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[p&&a.jsx(Mt,{variant:"ghost",size:"icon-sm",asChild:!0,children:a.jsx("a",{href:p,download:g.title,"aria-label":`Download ${g.title}`,title:t("common.download"),children:a.jsx(nw,{})})}),h&&a.jsx(Mt,{variant:"ghost",size:"sm",onClick:()=>l(_=>_+1),children:t("common.retry")})]})]}),h?a.jsx("div",{className:rt.previewError,role:"alert",children:h}):x?a.jsxs("div",{className:"p-4",children:[a.jsx("p",{children:t("attachment.previewUnsupported")}),a.jsx(Mt,{onClick:()=>void oD(r,w,"application/octet-stream",()=>!e.owner.isCurrent()).catch(_=>{e.owner.isCurrent()&&f(kc(_))}),children:t("common.download")})]}):(v.type==="attachment"||b)&&!c?a.jsx("div",{className:rt.empty,role:"status",children:t("common.loading")}):c&&c.type!=="application/pdf"&&!tT(c.type,w)?a.jsx(C7e,{data:c,title:g.title,onDownloadUrl:m,showDownload:!1,image:!!v_(w)&&c.type.startsWith("image/")}):a.jsx("div",{className:"relative min-h-0 flex-1 overflow-auto",children:a.jsx(wO,{workspacePath:w,workspaceActions:r,onLoadError:f,previewData:c,previewOnly:v.type==="attachment",previewMimeType:c?.type,previewKind:/\.html?$/i.test(w)||Cw(c?.type)==="text/html"?"source":void 0},i)})]})}function C7e({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:rt.imagePreviewWrap,children:[n?a.jsx("img",{className:rt.imagePreview,src:o,alt:t}):a.jsx(T7e,{name:t,mimeType:e.type,size:e.size}),r&&a.jsx("a",{href:o,download:t,"aria-label":`Download ${t}`,children:a.jsx(nw,{})})]}):null}function wO({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(CRn,{workspacePath:e,workspaceActions:n,data:o,mimeType:i,previewKind:c,onLoadError:h});const f=e.toLowerCase(),p=l??v_(e),m=c??(f.endsWith(".html")||f.endsWith(".htm")?"html":f.endsWith(".md")||f.endsWith(".markdown")?"markdown":p?"image":"source");return m==="html"?a.jsx(ERn,{workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:u,onLoadError:h}):m==="markdown"?a.jsx(jRn,{workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:u,onLoadError:h}):m==="image"&&p?a.jsx(RRn,{workspacePath:e,artifactVersion:t,workspaceActions:n,mimeType:p,onLoadError:h}):a.jsx(I7e,{workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:u,onLoadError:h})}function CRn({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(IRn,{data:n,mimeType:i,title:e}):tT(i,e)?a.jsx(TRn,{workspacePath:e,workspaceActions:t,data:n,previewKind:r,onLoadError:o}):a.jsx(T7e,{name:e,mimeType:i,size:n.size})}function TRn({workspacePath:e,workspaceActions:t,data:n,previewKind:s,onLoadError:r}){const{t:o}=pt(),[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:rt.previewError,children:c}):i===void 0?a.jsx("div",{className:rt.empty,children:o("attachment.loadingFile")}):a.jsx(wO,{workspacePath:e,workspaceActions:t,previewContent:i,previewSizeBytes:n.size,previewOnly:!0,previewKind:s})}function IRn({data:e,mimeType:t,title:n}){const{t:s}=pt(),[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:rt.pdfAttachmentPreview,src:r,title:`Preview ${n}`}):a.jsx("div",{className:rt.empty,children:s("attachment.loadingPreview")})}function T7e({name:e,mimeType:t,size:n}){const{t:s}=pt();return a.jsxs("div",{className:rt.unsupportedAttachmentPreview,children:[a.jsx(ag,{name:e,mimeType:t,"aria-hidden":"true"}),a.jsx("div",{children:s("attachment.previewUnsupported")}),a.jsxs("div",{className:rt.unsupportedAttachmentMeta,children:[t," · ",rD(n)]})]})}function RRn({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),TT((f,p)=>n.readFileBytes(f,p),e,s,{statFile:f=>n.stat(f),isCancelled:()=>u}).then(f=>{u||(h=URL.createObjectURL(f),i(h))}).catch(f=>{if(u)return;const p=f instanceof Error?f.message:String(f);c(p),r?.(p)}),()=>{u=!0,h&&URL.revokeObjectURL(h)}},[t,s,r,n,e]),a.jsxs("div",{className:rt.imagePreviewWrap,children:[o?a.jsxs(a.Fragment,{children:[a.jsx("img",{className:rt.imagePreview,src:o,alt:O8(e)}),a.jsx("a",{className:rt.imageDownloadButton,href:o,download:O8(e),"aria-label":`Download ${O8(e)}`,title:"Download",children:a.jsx(nw,{size:16,strokeWidth:1.8})})]}):l?null:a.jsx("div",{className:rt.empty,children:"Loading image..."}),l&&a.jsx("div",{className:rt.previewError,children:l})]})}function mne({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 p=!1;if(l(s??null),f(null),u(void 0),!r)return n.stat(e).then(m=>{if(!p){if(m.type==="directory")throw new Error("Directories cannot be opened as artifacts.");return n.readWorkspaceFile(e,{maxBytes:256*1024})}}).then(async m=>{if(p||!m||!m.truncated)return m;const g=await TT((v,y)=>n.readFileBytes(v,y),e,"application/octet-stream",{statFile:v=>n.stat(v),isCancelled:()=>p});return{sizeBytes:g.size,content:new TextDecoder(m.encoding||"utf-8").decode(await g.arrayBuffer())}}).then(m=>{p||!m||(u(m.sizeBytes),l(m.content))}).catch(m=>{if(p)return;const g=m instanceof Error?m.message:String(m);f(g),o?.(g)}),()=>{p=!0}},[t,s,r,o,n,e]),{content:i,error:h,sizeBytes:c}}function ERn({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:o,onLoadError:i}){const{content:l,error:c,sizeBytes:u}=mne({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:o,onLoadError:i});return a.jsxs("div",{className:rt.htmlPreviewWrap,children:[l===null?!c&&a.jsx("div",{className:rt.empty,children:"Loading preview..."}):a.jsx(R7e,{content:l,sizeBytes:u??r,workspacePath:e,workspaceActions:n,children:()=>a.jsx(ARn,{content:l,workspacePath:e})}),c&&a.jsx("div",{className:rt.previewError,children:c})]})}function ARn({content:e,workspacePath:t}){const n=`Preview ${t}`,{t:s}=pt(),[r,o]=d.useState(null),[i,l]=d.useState(null);return d.useEffect(()=>{const c=new AbortController;return o(null),l(null),Uat(e,n,c.signal).then(u=>{c.signal.aborted||o(u)},u=>{c.signal.aborted||l(kc(u))}),()=>c.abort()},[e,n]),i?a.jsx("div",{className:rt.previewError,children:s("artifact.previewFailed",{message:i})}):r===null?a.jsx("div",{className:rt.empty,children:s("attachment.loadingPreview")}):a.jsx("iframe",{className:rt.htmlPreview,referrerPolicy:"no-referrer",sandbox:"allow-scripts",srcDoc:r,title:n})}function I7e({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}=mne({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 p;try{p=new as({doc:u,extensions:[wMe,as.editable.of(!1),Si.readOnly.of(!0),as.lineWrapping],parent:f})}catch(m){c(m instanceof Error?m.message:String(m));return}return()=>p.destroy()},[u]),a.jsxs("div",{className:rt.filePreviewWrap,children:[u===null?!h&&a.jsx("div",{className:rt.empty,children:"Loading file..."}):a.jsx("div",{ref:i,className:rt.codeMirrorFile}),(h||l)&&a.jsx("div",{className:rt.previewError,children:h||l})]})}function R7e({content:e,sizeBytes:t,workspacePath:n,workspaceActions:s,children:r}){const{t:o}=pt(),[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(Mt,{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(I7e,{workspacePath:n,workspaceActions:s,previewContent:e,previewOnly:!0})})]})}function jRn({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:o,onLoadError:i}){const{content:l,error:c,sizeBytes:u}=mne({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:o,onLoadError:i});return a.jsxs("div",{className:rt.htmlPreviewWrap,children:[l===null?!c&&a.jsx("div",{className:rt.empty,children:"Loading preview..."}):a.jsx(R7e,{content:l,sizeBytes:u??r,workspacePath:e,workspaceActions:n,children:()=>a.jsx("div",{className:rt.markdownPreviewWrap,children:a.jsx(cp,{content:l})})}),c&&a.jsx("div",{className:rt.previewError,children:c})]})}function Jh({label:e,value:t}){return t?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:rt.fieldLabel,children:e}),a.jsx("span",{className:rt.fieldValue,children:t})]}):null}function zS(e,t,n){const s=e[t];return s==null||s===""?null:a.jsx(Jh,{label:n,value:String(s)},t)}/**
|
|
2217
2217
|
* @license
|
|
2218
2218
|
* Copyright 2025 Qwen Team
|
|
2219
2219
|
* SPDX-License-Identifier: Apache-2.0
|