@qwen-code/qwen-code 0.27.2-preview.0 → 0.27.2
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/chunks/{MaxSizedBox-XGJBXFET.js → MaxSizedBox-QRQEXRXW.js} +1 -1
- package/chunks/{StandaloneSessionPicker-BNFJWFLQ.js → StandaloneSessionPicker-X274Q6BX.js} +1 -1
- package/chunks/{acp-subagent-executor-P5FBYPD5.js → acp-subagent-executor-YIFQD4LJ.js} +1 -1
- package/chunks/{acpAgent-J6G57ZCE.js → acpAgent-NW4XNW7P.js} +3 -3
- package/chunks/{advisor-3O63GFOM.js → advisor-W7KCVPBR.js} +1 -1
- package/chunks/{agent-ALZEISY2.js → agent-FGDWPNXW.js} +1 -1
- package/chunks/{agent-headless-XAKKB6OT.js → agent-headless-7KA3VVAB.js} +1 -1
- package/chunks/{agent-host-client-DIV2XAL5.js → agent-host-client-YZJLSOLB.js} +1 -1
- package/chunks/{agent-host-connections-ZQUMCO2F.js → agent-host-connections-5JGDPG3L.js} +1 -1
- package/chunks/{anthropicContentGenerator-ZE7TAQPO.js → anthropicContentGenerator-QUXJVJ3I.js} +1 -1
- package/chunks/{autofix-pr-RZ4PWQ46.js → autofix-pr-UDRPJC7L.js} +1 -1
- package/chunks/{batch-AIMBHUMX.js → batch-GCEHGR5P.js} +1 -1
- package/chunks/{bridge-A3RRGPEI.js → bridge-JY2JXNVV.js} +1 -1
- package/chunks/{channel-settings-store-P3KM5GTN.js → channel-settings-store-EX6ZU6R3.js} +1 -1
- package/chunks/{chunk-P22U5UQR.js → chunk-27MJJU2I.js} +1 -1
- package/chunks/{chunk-RYRMDOIX.js → chunk-2LDABIAY.js} +3 -3
- package/chunks/{chunk-MYPEVUKI.js → chunk-2QZDPMIH.js} +1 -1
- package/chunks/{chunk-TW2REHPX.js → chunk-2SGTJMSU.js} +1 -1
- package/chunks/{chunk-NCW3NPS5.js → chunk-3BHXPXCC.js} +1 -1
- package/chunks/{chunk-XUB4JKSR.js → chunk-3NR3JBMA.js} +6 -6
- package/chunks/{chunk-NRJOUWP4.js → chunk-3QCFMVI6.js} +1 -1
- package/chunks/{chunk-EGMV4S6D.js → chunk-3YOERSU5.js} +1 -1
- package/chunks/{chunk-WXKD4L4A.js → chunk-4NIUXYUF.js} +1 -1
- package/chunks/{chunk-YHC27L5W.js → chunk-5FS5OQHO.js} +1 -1
- package/chunks/{chunk-L76RFQKW.js → chunk-5MGG2BGT.js} +1 -1
- package/chunks/{chunk-HHDQ5JAA.js → chunk-66LFVQJP.js} +1 -1
- package/chunks/{chunk-RJPELYUW.js → chunk-6KU7LHBT.js} +1 -1
- package/chunks/{chunk-SKU5J7Q7.js → chunk-6O7CARPF.js} +1 -1
- package/chunks/{chunk-CPOFE42B.js → chunk-6Z3TBTUS.js} +1 -1
- package/chunks/{chunk-HRRQHZQE.js → chunk-73TSS7KS.js} +1 -1
- package/chunks/{chunk-BSGONILH.js → chunk-776L3HAN.js} +1 -1
- package/chunks/{chunk-MZNZYCAC.js → chunk-7BL2OTHX.js} +1 -1
- package/chunks/{chunk-5DPLJQUC.js → chunk-7GYFDPEP.js} +1 -1
- package/chunks/{chunk-OD44AOSX.js → chunk-7KGCNYE4.js} +1 -1
- package/chunks/{chunk-4JLLFT6S.js → chunk-7SX547WS.js} +1 -1
- package/chunks/{chunk-5Q6POUDM.js → chunk-7VIES3RW.js} +1 -1
- package/chunks/{chunk-NMK72ZA4.js → chunk-ABEBQNYK.js} +1 -1
- package/chunks/{chunk-QZ5JBF3E.js → chunk-AD7JBW6R.js} +2 -2
- package/chunks/{chunk-E6XRNALG.js → chunk-AEX3XSTE.js} +1 -1
- package/chunks/{chunk-B7CYUTAO.js → chunk-AKDODQCI.js} +1 -1
- package/chunks/{chunk-EEARSY3D.js → chunk-B3I5LFFK.js} +1 -1
- package/chunks/{chunk-YSGVX6LT.js → chunk-B5Y56PDI.js} +1 -1
- package/chunks/{chunk-MEFN5DY3.js → chunk-BEBKKJP3.js} +1 -1
- package/chunks/{chunk-GYCGVZ32.js → chunk-BFPP7X4E.js} +1 -1
- package/chunks/{chunk-GNWPYWGQ.js → chunk-BY5GX6DQ.js} +1 -1
- package/chunks/{chunk-6W5ZZSQF.js → chunk-CUX3C6QV.js} +1 -1
- package/chunks/{chunk-HXYHIEMH.js → chunk-CXPRHT3E.js} +1 -1
- package/chunks/{chunk-53CWA7N2.js → chunk-D5H5GARR.js} +1 -1
- package/chunks/{chunk-DV67DRNT.js → chunk-DLY7QJ5Y.js} +1 -1
- package/chunks/{chunk-SFDOJ2FF.js → chunk-DN4QKOFL.js} +1 -1
- package/chunks/{chunk-VOAIDOUV.js → chunk-DP4YE24V.js} +1 -1
- package/chunks/{chunk-D2X6A5FH.js → chunk-DQLI7HH7.js} +1 -1
- package/chunks/{chunk-ET7ADS4X.js → chunk-DS2FKATN.js} +1 -1
- package/chunks/{chunk-FRSSRLIO.js → chunk-E6EW43WZ.js} +1 -1
- package/chunks/{chunk-F4AWT5LV.js → chunk-EEBFFC76.js} +1 -1
- package/chunks/{chunk-B7PJ5TNK.js → chunk-EGKUF5NS.js} +2 -2
- package/chunks/{chunk-B2YLVSQE.js → chunk-ERMAKXS3.js} +2 -2
- package/chunks/{chunk-PEZZTKPM.js → chunk-FB73O3E5.js} +1 -1
- package/chunks/{chunk-36DBNBTF.js → chunk-FEIUMWFA.js} +1 -1
- package/chunks/{chunk-YE3LA3U4.js → chunk-FWJKQA2H.js} +1 -1
- package/chunks/{chunk-VDNPMX5W.js → chunk-FZQJOSHD.js} +1 -1
- package/chunks/{chunk-YYSMMFK7.js → chunk-GNI5J2ON.js} +1 -1
- package/chunks/{chunk-6OCKLRQC.js → chunk-H3VGRICV.js} +1 -1
- package/chunks/{chunk-OSLFWRV2.js → chunk-HRTWLOGK.js} +1 -1
- package/chunks/{chunk-XZYQKCTU.js → chunk-IGIZ6AZE.js} +1 -1
- package/chunks/{chunk-RIBVEHUG.js → chunk-IHB7CDQ2.js} +1 -1
- package/chunks/{chunk-LO6OFMFC.js → chunk-IHEGGZBE.js} +1 -1
- package/chunks/{chunk-N5S6SIRO.js → chunk-IMTHBYJP.js} +1 -1
- package/chunks/{chunk-I5F24CVP.js → chunk-IP3K5SRR.js} +1 -1
- package/chunks/{chunk-2FYWJVGW.js → chunk-ISA4MFNT.js} +1 -1
- package/chunks/{chunk-GV3E2RHX.js → chunk-JGF3ND5D.js} +1 -1
- package/chunks/{chunk-ASQ7BSJ4.js → chunk-JJ4UPR4A.js} +1 -1
- package/chunks/{chunk-HOCNE2LO.js → chunk-JTUWFGEB.js} +1 -1
- package/chunks/{chunk-FDQFJFO5.js → chunk-KAN5KUJD.js} +1 -1
- package/chunks/{chunk-K7GCWWTI.js → chunk-KU4F6SSJ.js} +2 -2
- package/chunks/{chunk-QDQQFQB4.js → chunk-LBAINHIN.js} +1 -1
- package/chunks/{chunk-BAPIZCC7.js → chunk-LTJLPYFS.js} +1 -1
- package/chunks/{chunk-ZOUMCSDW.js → chunk-MSNPEQ2I.js} +1 -1
- package/chunks/{chunk-MPDGSR2S.js → chunk-N3YWQWSR.js} +5 -5
- package/chunks/{chunk-VEVQB4CI.js → chunk-NDTPBVER.js} +1 -1
- package/chunks/{chunk-L4WG2XDS.js → chunk-NJ77L3GS.js} +1 -1
- package/chunks/{chunk-U2DX235N.js → chunk-NL62UQDW.js} +1 -1
- package/chunks/{chunk-QASJXL5B.js → chunk-NYXR2655.js} +1 -1
- package/chunks/{chunk-5SPQ5V35.js → chunk-OEPXWKZL.js} +1 -1
- package/chunks/{chunk-EOR7AP7Z.js → chunk-OIKWJN7E.js} +1 -1
- package/chunks/{chunk-BT7V3O75.js → chunk-OIQKVWR7.js} +1 -1
- package/chunks/{chunk-ESXBBANA.js → chunk-OPBSEVFC.js} +1 -1
- package/chunks/{chunk-NW3H676V.js → chunk-P5RBFVMP.js} +1 -1
- package/chunks/{chunk-F7KVMGGZ.js → chunk-QD4KNY2J.js} +1 -1
- package/chunks/{chunk-2ZE6CAZV.js → chunk-RSLBGXPB.js} +1 -1
- package/chunks/{chunk-3R7NEEW7.js → chunk-S542WTV7.js} +1 -1
- package/chunks/{chunk-KXAZ2Z5M.js → chunk-SEK234IM.js} +1 -1
- package/chunks/{chunk-5DPXLL3H.js → chunk-TM6IVXAM.js} +1 -1
- package/chunks/{chunk-KMJLEAS3.js → chunk-TPTV6HPU.js} +1 -1
- package/chunks/{chunk-DCUBMMWG.js → chunk-TQ6FKWSC.js} +1 -1
- package/chunks/{chunk-JK2S74SA.js → chunk-TUBHG6EI.js} +1 -1
- package/chunks/{chunk-FMZ5U7J5.js → chunk-UBPC3F32.js} +1 -1
- package/chunks/{chunk-XB7DJWOJ.js → chunk-UG5B4UOQ.js} +6 -6
- package/chunks/{chunk-36S57YYW.js → chunk-UGWTN5IK.js} +1 -1
- package/chunks/{chunk-SK2DTYBZ.js → chunk-URMRX2MG.js} +1 -1
- package/chunks/{chunk-VB4DB57C.js → chunk-UY6J5CHF.js} +1 -1
- package/chunks/{chunk-STQ3TEZW.js → chunk-VSTQT667.js} +2 -2
- package/chunks/{chunk-SGUUOXLH.js → chunk-WDO33SWR.js} +1 -1
- package/chunks/{chunk-IVXR5JO2.js → chunk-WFJHBU7B.js} +1 -1
- package/chunks/{chunk-BINJRUHZ.js → chunk-XSRHGC5R.js} +1 -1
- package/chunks/{chunk-HN7EGFIP.js → chunk-XVF3FMTM.js} +1 -1
- package/chunks/{chunk-C5X6K67T.js → chunk-XYRNYCRQ.js} +1 -1
- package/chunks/{chunk-HZOPWFFL.js → chunk-YAMLF3SM.js} +1 -1
- package/chunks/{chunk-CMW64XU2.js → chunk-ZEZCRRQC.js} +1 -1
- package/chunks/{chunk-J5W6P7QD.js → chunk-ZF56DRDP.js} +1 -1
- package/chunks/{chunk-LHIEE3A2.js → chunk-ZSPOFXP3.js} +1 -1
- package/chunks/{chunk-Q6CXEN4H.js → chunk-ZZXAOGUV.js} +1 -1
- package/chunks/{codex-subagent-executor-HB3MUCY4.js → codex-subagent-executor-7RAVQBYA.js} +1 -1
- package/chunks/{config-utils-F7OF5UR2.js → config-utils-JFD4RJK3.js} +1 -1
- package/chunks/{contextCommand-Y3KO2FY6.js → contextCommand-U6CD3CW7.js} +1 -1
- package/chunks/{core-runtime-D7DAA5NY.js → core-runtime-ORCZRJ4O.js} +1 -1
- package/chunks/{create-sub-session-2HTWYAP4.js → create-sub-session-57WMU2AE.js} +1 -1
- package/chunks/{cron-create-Y5I6E2X4.js → cron-create-V466MOUE.js} +1 -1
- package/chunks/{daemon-git-worktree-guard-UOBMXOUC.js → daemon-git-worktree-guard-ATD77XOF.js} +1 -1
- package/chunks/{daemon-status-provider-L2225KDS.js → daemon-status-provider-5FVRNMAZ.js} +1 -1
- package/chunks/{daemon-trust-policy-5D52N5GL.js → daemon-trust-policy-6YRQV4ZM.js} +1 -1
- package/chunks/{daemon-trust-policy-monitor-RUE25K7A.js → daemon-trust-policy-monitor-QRUOWZQP.js} +1 -1
- package/chunks/{deferred-core-runtime-6BO5DI5B.js → deferred-core-runtime-TXIXMDDH.js} +1 -1
- package/chunks/{edit-B6DKSK3O.js → edit-FNXBINJ3.js} +1 -1
- package/chunks/{enterPlanMode-WVJ3XC3P.js → enterPlanMode-YMLAOTTS.js} +1 -1
- package/chunks/{environment-7WMACN3E.js → environment-RFNJLRF7.js} +1 -1
- package/chunks/{errors-BN73QF2O.js → errors-NHGSZ2BV.js} +1 -1
- package/chunks/{execution-tool-IGDH3MQT.js → execution-tool-L2BF6ZKP.js} +1 -1
- package/chunks/{execution-worker-WWP3JZGV.js → execution-worker-F5B2BI2W.js} +1 -1
- package/chunks/{exitPlanMode-7WHKOTS7.js → exitPlanMode-ZZVBF5V4.js} +1 -1
- package/chunks/{fast-path-B37HGFQO.js → fast-path-TOJYOAD3.js} +1 -1
- package/chunks/{glob-ZRXU5G5X.js → glob-SYPMYU4V.js} +1 -1
- package/chunks/{goal-tools-DQ5IZXCM.js → goal-tools-NOXNXZFR.js} +1 -1
- package/chunks/{handleAutoUpdate-FD7QAG2R.js → handleAutoUpdate-RS6Y2IWS.js} +1 -1
- package/chunks/{i18n-TI3ZCEHR.js → i18n-WWZD25J5.js} +1 -1
- package/chunks/{initializer-SB7P3LRU.js → initializer-YGR4YXAM.js} +1 -1
- package/chunks/{installationInfo-B337C7R4.js → installationInfo-EPURVILN.js} +1 -1
- package/chunks/{interactive-mod-session-OWRMETPP.js → interactive-mod-session-2VSTTHPA.js} +1 -1
- package/chunks/{list-2QKQIEOB.js → list-6JAKVRMZ.js} +1 -1
- package/chunks/{llm-GQ76E4DL.js → llm-V272EOVL.js} +4 -4
- package/chunks/{llm-content-generator-2A23HFLD.js → llm-content-generator-EXMC3NYS.js} +1 -1
- package/chunks/{loadedSettingsAdapter-RGQOA5BG.js → loadedSettingsAdapter-T6W2CKFA.js} +1 -1
- package/chunks/{local-OEBLERSJ.js → local-NUBKA3T2.js} +1 -1
- package/chunks/{local-execution-environment-FT5J4SUH.js → local-execution-environment-WO62QDKJ.js} +1 -1
- package/chunks/{loggingContentGenerator-WC23RZYM.js → loggingContentGenerator-KHRN6S3S.js} +1 -1
- package/chunks/{loop-wakeup-GIIIDUNG.js → loop-wakeup-TTAZMOYH.js} +1 -1
- package/chunks/{manage-memory-E2OAR2RV.js → manage-memory-BKA7QM4N.js} +1 -1
- package/chunks/{managed-execution-engine-CYYNVVP5.js → managed-execution-engine-32BLALNC.js} +1 -1
- package/chunks/{managed-local-serve-TUVNNY7K.js → managed-local-serve-UTJFLZI6.js} +1 -1
- package/chunks/{managed-npm-update-IDRZ32UK.js → managed-npm-update-XPIRAQ47.js} +1 -1
- package/chunks/{managed-runtime-attestation-worker-HON7TGY2.js → managed-runtime-attestation-worker-DDU4HUGS.js} +1 -1
- package/chunks/{managed-runtime-bootstrap-OMLX5CTV.js → managed-runtime-bootstrap-7TTCLDQJ.js} +1 -1
- package/chunks/{managed-runtime-session-worker-J3P7WMDW.js → managed-runtime-session-worker-WBYLRXU3.js} +1 -1
- package/chunks/{managed-runtime-ssh-worker-LPFPOBTL.js → managed-runtime-ssh-worker-X2U2OK2E.js} +1 -1
- package/chunks/{managed-session-authority-I5OHOM7N.js → managed-session-authority-U76OGS6U.js} +1 -1
- package/chunks/{mcp-CGDIDRDI.js → mcp-UROGTJ3U.js} +1 -1
- package/chunks/{memory-VKXOH5UM.js → memory-M4OF6FV7.js} +1 -1
- package/chunks/{model-call-collection-ZTYFDFBB.js → model-call-collection-TW6Q7SXP.js} +1 -1
- package/chunks/{model-configuration-EXLM4SD3.js → model-configuration-4PJUBAYR.js} +1 -1
- package/chunks/{modelConfigUtils-XDMB6XPY.js → modelConfigUtils-ARMBTDAK.js} +1 -1
- package/chunks/{monitor-LKKCC6MQ.js → monitor-URMSEGAJ.js} +1 -1
- package/chunks/{nonInteractiveCli-J3Z3IZIF.js → nonInteractiveCli-YHOC5KZF.js} +1 -1
- package/chunks/{nonInteractiveToolExecutor-UQTMGYN2.js → nonInteractiveToolExecutor-DM5IGBP7.js} +1 -1
- package/chunks/{notebook-edit-JFD2KDI6.js → notebook-edit-3YSG73BK.js} +1 -1
- package/chunks/{omni-CI5JTMPR.js → omni-J6YYWKII.js} +1 -1
- package/chunks/{openaiContentGenerator-YZOV2TQX.js → openaiContentGenerator-UIFSPMTE.js} +1 -1
- package/chunks/{openaiResponsesContentGenerator-AHL7V6TE.js → openaiResponsesContentGenerator-U6Q536RZ.js} +1 -1
- package/chunks/{pidfile-ULOUTG67.js → pidfile-WCZE5ONH.js} +1 -1
- package/chunks/{processUtils-XX62FVFO.js → processUtils-3CDEN2GV.js} +1 -1
- package/chunks/{prompt-terminal-ledger-L6CWXBAW.js → prompt-terminal-ledger-VAQC6TC3.js} +1 -1
- package/chunks/{qwenContentGenerator-ZDXJW7EM.js → qwenContentGenerator-RWBGMON6.js} +1 -1
- package/chunks/{reactive-degrade-4OJ7XKSJ.js → reactive-degrade-GOTSVZKO.js} +1 -1
- package/chunks/{read-file-H6I32UZS.js → read-file-WNNTTHL5.js} +1 -1
- package/chunks/{resumeHistoryUtils-CTRMXPKQ.js → resumeHistoryUtils-UAGV4TC3.js} +1 -1
- package/chunks/{review-7SV2M7EL.js → review-JETUJT7N.js} +1 -1
- package/chunks/{ripGrep-Y2TGCQH5.js → ripGrep-OJNMOYPD.js} +1 -1
- package/chunks/{run-qwen-serve-6SWKYY6I.js → run-qwen-serve-BVNSBOLL.js} +1 -1
- package/chunks/{runtime-ITZIIC6D.js → runtime-CERVMTEG.js} +1 -1
- package/chunks/{sandboxConfig-FF2YF3RY.js → sandboxConfig-ZHW3GTMH.js} +1 -1
- package/chunks/{scheduled-tasks-WWPWNM3Y.js → scheduled-tasks-AAB5OESY.js} +1 -1
- package/chunks/{scheduler-ELSUH4GZ.js → scheduler-4ZZA357S.js} +1 -1
- package/chunks/{search-memory-465ZSHKG.js → search-memory-USJ3D7WQ.js} +1 -1
- package/chunks/{send-message-M5JFT3VH.js → send-message-QE2YZZ6M.js} +1 -1
- package/chunks/{serve-VTR7PTK2.js → serve-SX2PK3OZ.js} +1 -1
- package/chunks/{server-5NHPPEPR.js → server-OGTIIX65.js} +3 -3
- package/chunks/{session-HZLRQKEB.js → session-DXORIQDK.js} +1 -1
- package/chunks/{session-attachments-root-LS5Q4OT3.js → session-attachments-root-VHH2OZF6.js} +1 -1
- package/chunks/{session-execution-engine-selector-GS4LJPUU.js → session-execution-engine-selector-5WKZ6WXX.js} +1 -1
- package/chunks/{session-pr-refresh-FKYCCTWD.js → session-pr-refresh-MHXNT44I.js} +1 -1
- package/chunks/{sessionService-XUBKN4CM.js → sessionService-QDDGXOB7.js} +1 -1
- package/chunks/{settings-BFTTGWJN.js → settings-W3ALYJZM.js} +1 -1
- package/chunks/{shell-YEUMIQVE.js → shell-YROF2KXZ.js} +1 -1
- package/chunks/{skill-2MJ7S5SK.js → skill-CBEQAUIQ.js} +1 -1
- package/chunks/{skill-settings-DP7A2GMB.js → skill-settings-YRN4SHJO.js} +1 -1
- package/chunks/{spawnChannel-3IZ7S6U7.js → spawnChannel-M7Q6URLT.js} +1 -1
- package/chunks/{standalone-update-NAI3OI3P.js → standalone-update-WIRHMWE6.js} +1 -1
- package/chunks/{start-opentui-ui-D6ETKJSG.js → start-opentui-ui-OLHWNKCY.js} +1 -1
- package/chunks/{startInteractiveUI-FR5ZT72L.js → startInteractiveUI-KCHCIQWO.js} +1 -1
- package/chunks/{subscription-content-generator-JHU5YG2L.js → subscription-content-generator-YQLQKG6S.js} +1 -1
- package/chunks/{team-create-ZW3NXJ2M.js → team-create-I432CHIX.js} +1 -1
- package/chunks/{team-plan-approval-GPFOKUEV.js → team-plan-approval-APMPMLXS.js} +1 -1
- package/chunks/{terminal-image-renderer-WTEEKRMJ.js → terminal-image-renderer-3BNICGAX.js} +1 -1
- package/chunks/{theme-manager-STF74SF2.js → theme-manager-6KY7Q4ZR.js} +1 -1
- package/chunks/{tool-call-TVX5UHRJ.js → tool-call-QGOVXOVJ.js} +1 -1
- package/chunks/{tool-result-media-QALAETZ4.js → tool-result-media-LRSYJOND.js} +1 -1
- package/chunks/{tool-search-ZGJEYTBI.js → tool-search-HXP25AWV.js} +1 -1
- package/chunks/{total-session-admission-BOYLCRYA.js → total-session-admission-ISTRHUQ7.js} +1 -1
- package/chunks/{trustedFolders-65OZWLQO.js → trustedFolders-5BXMWMYB.js} +1 -1
- package/chunks/{update-relaunch-4LJ3SY6L.js → update-relaunch-NYGYYLSC.js} +1 -1
- package/chunks/{updateCheck-2QOAKEIH.js → updateCheck-UBLS3LUD.js} +1 -1
- package/chunks/{upload-config-5N7UDWC6.js → upload-config-Y372LVXX.js} +1 -1
- package/chunks/{useAutoAcceptIndicator-V37CGGMF.js → useAutoAcceptIndicator-RXZJRU74.js} +1 -1
- package/chunks/{validateNonInterActiveAuth-6ZTVWZ6W.js → validateNonInterActiveAuth-2GJ4ICJ3.js} +1 -1
- package/chunks/{version-EO3VIRH6.js → version-XRSNVEB2.js} +1 -1
- package/chunks/{web-fetch-B6LNZ2YK.js → web-fetch-B4VFVGWW.js} +1 -1
- package/chunks/{web-search-VIPZWUJX.js → web-search-3DSQWMAV.js} +1 -1
- package/chunks/{workflow-W5QEAOGN.js → workflow-RCCH5FPV.js} +1 -1
- package/chunks/{workflow-ancestor-trust-VE7B4RD2.js → workflow-ancestor-trust-N3QYH3OL.js} +1 -1
- package/chunks/{workspace-agents-D32D3K5S.js → workspace-agents-KEV4VBZD.js} +1 -1
- package/chunks/{workspace-providers-status-BOH7RJPV.js → workspace-providers-status-HW4VI4T7.js} +1 -1
- package/chunks/{workspace-recovery-worker-53GJWYJ5.js → workspace-recovery-worker-C3SSJ64A.js} +1 -1
- package/chunks/{workspace-registration-store-BMX2NT45.js → workspace-registration-store-K7VEBHIU.js} +1 -1
- package/chunks/{workspace-registry-SS2NKLEL.js → workspace-registry-C5ZPYT4P.js} +1 -1
- package/chunks/{workspace-runtime-coordinator-7ZKVLJDC.js → workspace-runtime-coordinator-ALWOLW3N.js} +1 -1
- package/chunks/{workspace-service-GIUD3D25.js → workspace-service-TNZJAC7M.js} +1 -1
- package/chunks/{workspace-skills-status-36A76TDX.js → workspace-skills-status-TI763F5M.js} +1 -1
- package/chunks/{workspace-trust-reconciler-VKKSY2AR.js → workspace-trust-reconciler-6UQ7HSUG.js} +1 -1
- package/chunks/{write-file-43JOGU55.js → write-file-2XXEHBZR.js} +1 -1
- package/chunks/{zoom-image-USUXATDM.js → zoom-image-P3E3V6PQ.js} +1 -1
- package/cli.js +2 -2
- package/execution-worker.js +1 -1
- package/export-transcript-document.js +1 -1
- package/package.json +3 -3
- package/web-shell/assets/{PierreFilePreview-Dx075_VT.js → PierreFilePreview-DtTOu9VE.js} +1 -1
- package/web-shell/assets/{SpreadsheetPreview-l2R-Y1o6.js → SpreadsheetPreview-C21imJIX.js} +1 -1
- package/web-shell/assets/{WorkspaceFileBrowser-CGi_eR1a.js → WorkspaceFileBrowser-DIWHfhtl.js} +1 -1
- package/web-shell/assets/{abnfDiagram-VCTEODGH-DZPHyWbH.js → abnfDiagram-VCTEODGH-qffA9juk.js} +1 -1
- package/web-shell/assets/{agents-route-Bp0Yjhm4.js → agents-route-4f6fKJaY.js} +1 -1
- package/web-shell/assets/{arc-BAS_Ct0z.js → arc-BOZg4dn0.js} +1 -1
- package/web-shell/assets/{architectureDiagram-5GKGNRK7-C5a7ooE1.js → architectureDiagram-5GKGNRK7-BOYWC6dJ.js} +1 -1
- package/web-shell/assets/{blockDiagram-NRAW4CY4-D-Wzzi9Z.js → blockDiagram-NRAW4CY4-CiN_IMJ7.js} +1 -1
- package/web-shell/assets/{c4Diagram-UCG6FXSJ-BiYnmYkI.js → c4Diagram-UCG6FXSJ-WYLA0JW0.js} +1 -1
- package/web-shell/assets/channel-DtcoR96T.js +1 -0
- package/web-shell/assets/{chunk-2Q5K7J3B-DHi3a_yf.js → chunk-2Q5K7J3B-BZUPB745.js} +1 -1
- package/web-shell/assets/{chunk-5VM5RSS4-DKgiHWPM.js → chunk-5VM5RSS4-BHfjsu8x.js} +1 -1
- package/web-shell/assets/{chunk-F27PBJKO-qvFMzdl_.js → chunk-F27PBJKO-DHtQsOyA.js} +1 -1
- package/web-shell/assets/{chunk-G27WJ6UU-C9Apl4Df.js → chunk-G27WJ6UU-DvEX_QHY.js} +1 -1
- package/web-shell/assets/{chunk-JWPE2WC7-ManrSgDL.js → chunk-JWPE2WC7-CwQJmw1a.js} +1 -1
- package/web-shell/assets/{chunk-LCL6LL3I-DNZqkjQu.js → chunk-LCL6LL3I-Cv7bRuRV.js} +1 -1
- package/web-shell/assets/{chunk-POPQ4Y6H-CxineRE8.js → chunk-POPQ4Y6H-zGw4PzDB.js} +1 -1
- package/web-shell/assets/{chunk-SVP7TREG-BzmCQ6Bh.js → chunk-SVP7TREG-DZMGVnJg.js} +1 -1
- package/web-shell/assets/{chunk-XXDRQBXY-Dm6Ascgd.js → chunk-XXDRQBXY-Dg5_qrTq.js} +1 -1
- package/web-shell/assets/classDiagram-DTDB5LWJ-CBq-DXYQ.js +1 -0
- package/web-shell/assets/classDiagram-v2-JRS7N3AN-CBq-DXYQ.js +1 -0
- package/web-shell/assets/{cose-bilkent-JH36ORCC-Cs-vIewG.js → cose-bilkent-JH36ORCC-D07aXZdD.js} +1 -1
- package/web-shell/assets/{cynefin-OW5HDTMX-CrxyzLrG.js → cynefin-OW5HDTMX-B4txjD0l.js} +1 -1
- package/web-shell/assets/{cynefinDiagram-5FMLGOSQ-Bf7RdtX4.js → cynefinDiagram-5FMLGOSQ-zFtLauJ6.js} +1 -1
- package/web-shell/assets/{dagre-3AP2YEHR-jN7qDhRR.js → dagre-3AP2YEHR-CKZj9zbB.js} +1 -1
- package/web-shell/assets/{diagram-S7CK7UJ4-KcNQ38Ue.js → diagram-S7CK7UJ4-DIsLTku6.js} +1 -1
- package/web-shell/assets/{diagram-UQ7AKVKN-9VmCS0SV.js → diagram-UQ7AKVKN-60CC00CO.js} +1 -1
- package/web-shell/assets/{diagram-VSXAHHWV-D-MA8NCD.js → diagram-VSXAHHWV-BCfHqY7L.js} +1 -1
- package/web-shell/assets/{diagram-VX7I27RA-323tLIBS.js → diagram-VX7I27RA-BbTOx9qC.js} +1 -1
- package/web-shell/assets/{diagram-Z3DM3KII-C547h61H.js → diagram-Z3DM3KII-DLjgnodz.js} +1 -1
- package/web-shell/assets/{docx-preview-DHO0seXT.js → docx-preview-CfGqg6IJ.js} +1 -1
- package/web-shell/assets/{ebnfDiagram-PWID7BFC-DfB8wLF5.js → ebnfDiagram-PWID7BFC-Cf1IQbGo.js} +1 -1
- package/web-shell/assets/{erDiagram-SSCWMZ5O-tzqYkCjp.js → erDiagram-SSCWMZ5O-BTVNpu1y.js} +1 -1
- package/web-shell/assets/{flowDiagram-A5DVABFB-Dsw6uHjD.js → flowDiagram-A5DVABFB-BC404IkJ.js} +1 -1
- package/web-shell/assets/{ganttDiagram-EL5Y4UJY-D1SaF3O0.js → ganttDiagram-EL5Y4UJY-BHP58V1Y.js} +1 -1
- package/web-shell/assets/{gitGraphDiagram-WWUBYQGX-D0EzECMT.js → gitGraphDiagram-WWUBYQGX-s1PkjMd4.js} +1 -1
- package/web-shell/assets/{index-ob2Iut7D.js → index-DZnv4pXI.js} +6 -6
- package/web-shell/assets/{index-C-YHF5xI.js → index-YpdTDWts.js} +1 -1
- package/web-shell/assets/{infoDiagram-RXCK75RN-6NnYMmcC.js → infoDiagram-RXCK75RN-DDaQbbGu.js} +1 -1
- package/web-shell/assets/{ishikawaDiagram-5VMMS53U-BnxsfuuS.js → ishikawaDiagram-5VMMS53U-FpQWCzWS.js} +1 -1
- package/web-shell/assets/{journeyDiagram-EYS64GPL-DduswigY.js → journeyDiagram-EYS64GPL-CC5YG1zk.js} +1 -1
- package/web-shell/assets/{kanban-definition-3QL26DDD-D0trNRAQ.js → kanban-definition-3QL26DDD-CsitCmSH.js} +1 -1
- package/web-shell/assets/{layout-nP-pCdd_.js → layout-DR8LNzXS.js} +1 -1
- package/web-shell/assets/{linear-DCw4lqG9.js → linear-Dt61H2xY.js} +1 -1
- package/web-shell/assets/{mermaid.core-DYjTp4Sk.js → mermaid.core-C3SdL30W.js} +6 -6
- package/web-shell/assets/{mindmap-definition-FBJOCRG2-BK9iSa2V.js → mindmap-definition-FBJOCRG2-BjxTLs9R.js} +1 -1
- package/web-shell/assets/{pegDiagram-XKGWAZYB-Dg0TQ1Ty.js → pegDiagram-XKGWAZYB-eBurSwq6.js} +1 -1
- package/web-shell/assets/{pieDiagram-E7YTZNPT-DKeqeVkg.js → pieDiagram-E7YTZNPT-BFWkbtZz.js} +1 -1
- package/web-shell/assets/{quadrantDiagram-AXDQQJYC-C4zBeQXd.js → quadrantDiagram-AXDQQJYC-SThzXP6T.js} +1 -1
- package/web-shell/assets/{railroadDiagram-O6MQD6OU-jDnAGU3z.js → railroadDiagram-O6MQD6OU-D73YId-T.js} +1 -1
- package/web-shell/assets/{requirementDiagram-EFPCY7ZU-D0sIdHq4.js → requirementDiagram-EFPCY7ZU-YecInWjM.js} +1 -1
- package/web-shell/assets/{sankeyDiagram-P5KCCOFB-BFz_QzXx.js → sankeyDiagram-P5KCCOFB-D4Gl35cC.js} +1 -1
- package/web-shell/assets/{sequenceDiagram-WJ2MYXX4-DhDmjiCT.js → sequenceDiagram-WJ2MYXX4-C1JdJSRH.js} +1 -1
- package/web-shell/assets/{sizeCapture-X5ZJPWSS-D8Ov3K_0.js → sizeCapture-X5ZJPWSS-D3mHX34v.js} +1 -1
- package/web-shell/assets/{stateDiagram-HBIQ2CUA-Bb4f1ILo.js → stateDiagram-HBIQ2CUA-BR05d7ll.js} +1 -1
- package/web-shell/assets/stateDiagram-v2-4QOOHH4V-BBhqVmOU.js +1 -0
- package/web-shell/assets/{swimlanes-XN3QIQJK-CQyilPoS.js → swimlanes-XN3QIQJK-CENq9EQ7.js} +1 -1
- package/web-shell/assets/swimlanesDiagram-VK2B7HYN-DI8ON7to.js +8 -0
- package/web-shell/assets/{timeline-definition-24CTP7MA-B_CntdLT.js → timeline-definition-24CTP7MA-DFhKdLgc.js} +1 -1
- package/web-shell/assets/{vennDiagram-4TSXK5OY-BbuHkADM.js → vennDiagram-4TSXK5OY-C-p5h-ue.js} +1 -1
- package/web-shell/assets/{wardleyDiagram-VM6X3IG4-0mNKcB-T.js → wardleyDiagram-VM6X3IG4-BCWSjHZH.js} +1 -1
- package/web-shell/assets/{xychartDiagram-S5SC5T6Z-BL-rMOQs.js → xychartDiagram-S5SC5T6Z-DBvE_Y0y.js} +1 -1
- package/web-shell/index.html +1 -1
- package/web-shell/sw.js +1 -1
- package/web-shell/assets/channel-B31dxYCL.js +0 -1
- package/web-shell/assets/classDiagram-DTDB5LWJ-CxU_Ty2M.js +0 -1
- package/web-shell/assets/classDiagram-v2-JRS7N3AN-CxU_Ty2M.js +0 -1
- package/web-shell/assets/stateDiagram-v2-4QOOHH4V-xbht8Czs.js +0 -1
- package/web-shell/assets/swimlanesDiagram-VK2B7HYN-Dz34bASJ.js +0 -8
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/angular-html-LfdN0zeE.js","assets/html-C2L_23MC.js","assets/javascript-ySlJ1b_l.js","assets/css-BPhBrDlE.js","assets/angular-ts-CKsD7JZE.js","assets/scss-C31hgJw-.js","assets/apl-BBq3IX1j.js","assets/xml-e3z08dGr.js","assets/java-xI-RfyKK.js","assets/json-BQoSv7ci.js","assets/astro-CqkE3fuf.js","assets/typescript-Dj6nwHGl.js","assets/postcss-B3ZDOciz.js","assets/blade-a8OxSdnT.js","assets/sql-COK4E0Yg.js","assets/bsl-Dgyn0ogV.js","assets/sdbl-BLhTXw86.js","assets/cairo--RitsXJZ.js","assets/python-DhUJRlN_.js","assets/cobol-PTqiYgYu.js","assets/coffee-dyiR41kL.js","assets/cpp-BksuvNSY.js","assets/regexp-DWJ3fJO_.js","assets/glsl-DBO2IWDn.js","assets/c-C3t2pwGQ.js","assets/crystal-DtDmRg-F.js","assets/shellscript-atvbtKCR.js","assets/edge-D5gP-w-T.js","assets/html-derivative-CSfWNPLT.js","assets/elixir-CLiX3zqd.js","assets/elm-CmHSxxaM.js","assets/erb-BYTLMnw6.js","assets/ruby-DeZ3UC14.js","assets/haml-B2EZWmdv.js","assets/graphql-cDcHW_If.js","assets/jsx-BAng5TT0.js","assets/tsx-B6W0miNI.js","assets/lua-CvWAzNxB.js","assets/yaml-CVw76BM1.js","assets/fortran-fixed-form-TqA4NnZg.js","assets/fortran-free-form-DKXYxT9g.js","assets/fsharp-XplgxFYe.js","assets/markdown-UIAJJxZW.js","assets/gdresource-BHYsBjWJ.js","assets/gdshader-SKMF96pI.js","assets/gdscript-DfxzS6Rs.js","assets/git-commit-i4q6IMui.js","assets/diff-BgYniUM_.js","assets/git-rebase-B-v9cOL2.js","assets/glimmer-js-D-cwc0-E.js","assets/glimmer-ts-pgjy16dm.js","assets/hack-D1yCygmZ.js","assets/handlebars-BQGss363.js","assets/http-FRrOvY1W.js","assets/hxml-TIA70rKU.js","assets/haxe-C5wWYbrZ.js","assets/imba-bv_oIlVt.js","assets/jinja-DGy0s7-h.js","assets/jison-BqZprYcd.js","assets/julia-BBuGR-5E.js","assets/r-CwjWoCRV.js","assets/latex-C-cWTeAZ.js","assets/tex-rYs2v40G.js","assets/liquid-D3W5UaiH.js","assets/marko-z0MBrx5-.js","assets/less-BfCpw3nA.js","assets/mdc-DB_EDNY_.js","assets/nginx-D_VnBJ67.js","assets/nim-ZlGxZxc3.js","assets/perl-CHQXSrWU.js","assets/php-B5ebYQev.js","assets/pug-CM9l7STV.js","assets/qml-D8XfuvdV.js","assets/razor-CNLDkMZG.js","assets/csharp-D9R-vmeu.js","assets/rst-4NLicBqY.js","assets/cmake-DbXoA79R.js","assets/sas-BmTFh92c.js","assets/shaderlab-B7qAK45m.js","assets/hlsl-ifBTmRxC.js","assets/shellsession-C_rIy8kc.js","assets/soy-C-lX7w71.js","assets/sparql-bYkjHRlG.js","assets/turtle-BMR_PYu6.js","assets/stata-DorPZHa4.js","assets/svelte-MSaWC3Je.js","assets/templ-dwX3ZSMB.js","assets/go-B1SYOhNW.js","assets/ts-tags-CipyTH0X.js","assets/twig-NC5TFiHP.js","assets/vue-BuYVFjOK.js","assets/vue-html-xdeiXROB.js","assets/xsl-Dd0NUgwM.js","assets/agents-route-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/angular-html-LfdN0zeE.js","assets/html-C2L_23MC.js","assets/javascript-ySlJ1b_l.js","assets/css-BPhBrDlE.js","assets/angular-ts-CKsD7JZE.js","assets/scss-C31hgJw-.js","assets/apl-BBq3IX1j.js","assets/xml-e3z08dGr.js","assets/java-xI-RfyKK.js","assets/json-BQoSv7ci.js","assets/astro-CqkE3fuf.js","assets/typescript-Dj6nwHGl.js","assets/postcss-B3ZDOciz.js","assets/blade-a8OxSdnT.js","assets/sql-COK4E0Yg.js","assets/bsl-Dgyn0ogV.js","assets/sdbl-BLhTXw86.js","assets/cairo--RitsXJZ.js","assets/python-DhUJRlN_.js","assets/cobol-PTqiYgYu.js","assets/coffee-dyiR41kL.js","assets/cpp-BksuvNSY.js","assets/regexp-DWJ3fJO_.js","assets/glsl-DBO2IWDn.js","assets/c-C3t2pwGQ.js","assets/crystal-DtDmRg-F.js","assets/shellscript-atvbtKCR.js","assets/edge-D5gP-w-T.js","assets/html-derivative-CSfWNPLT.js","assets/elixir-CLiX3zqd.js","assets/elm-CmHSxxaM.js","assets/erb-BYTLMnw6.js","assets/ruby-DeZ3UC14.js","assets/haml-B2EZWmdv.js","assets/graphql-cDcHW_If.js","assets/jsx-BAng5TT0.js","assets/tsx-B6W0miNI.js","assets/lua-CvWAzNxB.js","assets/yaml-CVw76BM1.js","assets/fortran-fixed-form-TqA4NnZg.js","assets/fortran-free-form-DKXYxT9g.js","assets/fsharp-XplgxFYe.js","assets/markdown-UIAJJxZW.js","assets/gdresource-BHYsBjWJ.js","assets/gdshader-SKMF96pI.js","assets/gdscript-DfxzS6Rs.js","assets/git-commit-i4q6IMui.js","assets/diff-BgYniUM_.js","assets/git-rebase-B-v9cOL2.js","assets/glimmer-js-D-cwc0-E.js","assets/glimmer-ts-pgjy16dm.js","assets/hack-D1yCygmZ.js","assets/handlebars-BQGss363.js","assets/http-FRrOvY1W.js","assets/hxml-TIA70rKU.js","assets/haxe-C5wWYbrZ.js","assets/imba-bv_oIlVt.js","assets/jinja-DGy0s7-h.js","assets/jison-BqZprYcd.js","assets/julia-BBuGR-5E.js","assets/r-CwjWoCRV.js","assets/latex-C-cWTeAZ.js","assets/tex-rYs2v40G.js","assets/liquid-D3W5UaiH.js","assets/marko-z0MBrx5-.js","assets/less-BfCpw3nA.js","assets/mdc-DB_EDNY_.js","assets/nginx-D_VnBJ67.js","assets/nim-ZlGxZxc3.js","assets/perl-CHQXSrWU.js","assets/php-B5ebYQev.js","assets/pug-CM9l7STV.js","assets/qml-D8XfuvdV.js","assets/razor-CNLDkMZG.js","assets/csharp-D9R-vmeu.js","assets/rst-4NLicBqY.js","assets/cmake-DbXoA79R.js","assets/sas-BmTFh92c.js","assets/shaderlab-B7qAK45m.js","assets/hlsl-ifBTmRxC.js","assets/shellsession-C_rIy8kc.js","assets/soy-C-lX7w71.js","assets/sparql-bYkjHRlG.js","assets/turtle-BMR_PYu6.js","assets/stata-DorPZHa4.js","assets/svelte-MSaWC3Je.js","assets/templ-dwX3ZSMB.js","assets/go-B1SYOhNW.js","assets/ts-tags-CipyTH0X.js","assets/twig-NC5TFiHP.js","assets/vue-BuYVFjOK.js","assets/vue-html-xdeiXROB.js","assets/xsl-Dd0NUgwM.js","assets/agents-route-4f6fKJaY.js","assets/agents-route-B7Dp-NvE.css","assets/WorkspaceFileBrowser-DIWHfhtl.js","assets/WorkspaceFileBrowser-Bgjjk7jz.css"])))=>i.map(i=>d[i]);
|
|
2
2
|
var pmt=Object.defineProperty;var B_e=e=>{throw TypeError(e)};var mmt=(e,t,n)=>t in e?pmt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var dt=(e,t,n)=>mmt(e,typeof t!="symbol"?t+"":t,n),$_e=(e,t,n)=>t.has(e)||B_e("Cannot "+n);var xi=(e,t,n)=>($_e(e,t,"read from private field"),n?n.call(e):t.get(e)),F0=(e,t,n)=>t.has(e)?B_e("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),jc=(e,t,n,s)=>($_e(e,t,"write to private field"),s?s.call(e,n):t.set(e,n),n);var F_e=(e,t,n,s)=>({set _(r){jc(e,t,r,n)},get _(){return xi(e,t,s)}});function gmt(e,t){for(var n=0;n<t.length;n++){const s=t[n];if(typeof s!="string"&&!Array.isArray(s)){for(const r in s)if(r!=="default"&&!(r in e)){const o=Object.getOwnPropertyDescriptor(s,r);o&&Object.defineProperty(e,r,o.get?o:{enumerable:!0,get:()=>s[r]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))s(r);new MutationObserver(r=>{for(const o of r)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&s(i)}).observe(document,{childList:!0,subtree:!0});function n(r){const o={};return r.integrity&&(o.integrity=r.integrity),r.referrerPolicy&&(o.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?o.credentials="include":r.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function s(r){if(r.ep)return;r.ep=!0;const o=n(r);fetch(r.href,o)}})();var dD=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function IO(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var SOe={exports:{}},FG={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react-jsx-runtime.production.js
|
|
@@ -1913,7 +1913,7 @@ License: MIT
|
|
|
1913
1913
|
})();`}function gYt(e){return`<!doctype html>
|
|
1914
1914
|
<html><head><meta charset="utf-8"><meta http-equiv="Content-Security-Policy" content="${fYt}"></head>
|
|
1915
1915
|
<body><script>${mYt(e)}<\/script></body></html>`}function vYt(){const e=globalThis.crypto;if(!e?.getRandomValues)throw new ts("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 KEe(){return new DOMException("The temporary legacy chart operation was aborted","AbortError")}function yYt(e){if(e.signal.aborted)return Promise.reject(KEe());if(!Number.isSafeInteger(e.timeoutMs)||e.timeoutMs<=0)return Promise.reject(new ts("SCHEMA_INVALID","Legacy sandbox timeout must be a positive safe integer"));if(e.maxNodes!==void 0&&(!Number.isSafeInteger(e.maxNodes)||e.maxNodes<=0))return Promise.reject(new ts("SCHEMA_INVALID","Legacy sandbox maxNodes must be a positive safe integer"));if(typeof document>"u"||!document.body)return Promise.reject(new ts("LEGACY_SANDBOX_UNAVAILABLE","The temporary legacy sandbox requires a browser document body"));const t=vYt(),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=gYt(t),new Promise((s,r)=>{const o=new MessageChannel,i=o.port1,l=o.port2;let c=!1,d=!1,h;const f=()=>{i.onmessage=null,i.onmessageerror=null;try{i.close()}catch{}try{l.close()}catch{}e.signal.removeEventListener("abort",g),n.onload=null,n.onerror=null,h!==void 0&&clearTimeout(h),n.remove()},p=(b,y)=>{c||(c=!0,f(),b(y))},m=b=>{c||(c=!0,f(),r(b))},g=()=>m(KEe()),v=b=>{if(wa(b.data)&&!(b.data.channel!==hce||b.data.requestId!==t)){if(b.data.type==="error"){m(new ts("LEGACY_SANDBOX_EXECUTION_FAILED","Temporary legacy chart source failed in the isolated worker"));return}if(b.data.type==="result")try{const y=n0e(b.data.option,e.maxNodes===void 0?{}:{maxNodes:e.maxNodes});if(!wa(y))throw new ts("SCHEMA_INVALID","Temporary legacy chart source must produce a JSON object option");p(s,y)}catch(y){m(y)}}};i.onmessage=v,i.onmessageerror=()=>m(new ts("LEGACY_SANDBOX_EXECUTION_FAILED","Temporary legacy chart sandbox returned an unreadable response")),e.signal.addEventListener("abort",g,{once:!0}),n.onerror=()=>m(new ts("LEGACY_SANDBOX_EXECUTION_FAILED","Temporary legacy chart sandbox failed to load")),n.onload=()=>{if(!d){if(d=!0,n.onload=null,c||e.signal.aborted){g();return}try{n.contentWindow?.postMessage({channel:hce,type:"execute",requestId:t,source:e.source,inputData:e.inputData},"*",[l])}catch{m(new ts("LEGACY_SANDBOX_EXECUTION_FAILED","Temporary legacy chart sandbox failed to initialize"))}}},h=setTimeout(()=>m(new ts("LEGACY_SANDBOX_TIMEOUT",`Temporary legacy chart sandbox exceeded ${e.timeoutMs}ms`)),e.timeoutMs),document.body.append(n)})}var qYe=class extends Error{constructor(t,n,s){super(n,s&&"cause"in s?{cause:s.cause}:void 0);dt(this,"code");dt(this,"cause");this.name="LegacySandboxError",this.code=t,this.cause=s?.cause}},wYt=Object.freeze({maxArtifactContentBytes:64*1024*1024,maxRows:1e5,maxColumns:200,maxCells:1e6,executionTimeoutMs:5e3});function bYt(e,t){const n={...wYt,...e,...t};for(const[s,r]of Object.entries(n))if(!Number.isSafeInteger(r)||r<=0)throw new ts("SCHEMA_INVALID",`legacyArtifactLimits.${s} must be a positive safe integer`);return n}async function VYe(e){let t;try{t=await e.resolveContent()}catch(o){throw e.signal.aborted||e.preserveLegacySandboxError&&o instanceof qYe?o:new ts("REF_RESOLUTION_FAILED",e.resolutionError,{cause:o})}if(typeof t!="string")throw new ts("SCHEMA_INVALID",e.returnTypeError);if(e.signal.aborted)throw new DOMException("The temporary legacy chart operation was aborted","AbortError");const n=cYt(t,e.limits),s=hYt(e.source);if(!s)throw new ts("SCHEMA_INVALID","Temporary legacy chart source is empty after sanitization");const r=await yYt({source:s,inputData:n.source,signal:e.signal,timeoutMs:e.limits.executionTimeoutMs,...e.maxNodes===void 0?{}:{maxNodes:e.maxNodes}});return{data:n,spec:r}}async function xYt(e){return VYe({source:e.block.source,signal:e.signal,limits:e.limits,...e.maxNodes===void 0?{}:{maxNodes:e.maxNodes},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 kYt(e){return VYe({source:e.block.source,signal:e.signal,limits:e.limits,...e.maxNodes===void 0?{}:{maxNodes:e.maxNodes},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 _Yt=Object.freeze({maxRows:1e5,maxCells:1e6,maxSeries:100,maxDepth:40,maxNodes:12e5}),SYt=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"]),CYt=new Set(["__proto__","prototype","constructor","extracsstext","renderitem","graphic","image","toolbox","dataview","transform","link","sublink","href","src","url"]),TYt=/(?:url|uri|href|src|link)$/i,IYt=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/,YEe=/(?:^|[\s("'=])(?:https?:|file:|ftp:|blob:|data:|javascript:|vbscript:|\/\/|image:\/\/)/i,RYt=/\burl\s*\(/i,EYt=/<\s*\/?\s*[a-z][^>]*>/i,AYt=/&(?:#\d+|#x[\da-f]+|[a-z][\da-z]+);/i,jYt=/^[A-Za-z_][A-Za-z0-9_]*$/;function la(e){throw new ts("SCHEMA_INVALID",e)}function Dq(e,t,n){for(const s of Object.keys(e))t.has(s)||la(`${n}.${s} is not allowed`)}function XEe(e,t){if(!Array.isArray(e)||e.length===0)return la(`${t} must be a non-empty array`);const n=e.map((s,r)=>typeof s!="string"||!jYt.test(s)?la(`${t}[${r}] must be a stable ASCII identifier`):s);return new Set(n).size!==n.length?la(`${t} must not contain duplicate dimensions`):n}function NYt(e,t){if(!wa(e)||typeof e.kind!="string")return la("echarts-fulldata.data must be an inline or ref dataset object");if(e.kind==="inline"){Dq(e,new Set(["kind","dimensions","source"]),"echarts-fulldata.data");const n=XEe(e.dimensions,"echarts-fulldata.data.dimensions");if(!Array.isArray(e.source))return la("echarts-fulldata.data.source must be an array");e.source.forEach((r,o)=>{Array.isArray(r)||la(`echarts-fulldata.data.source[${o}] must be an array`),r.length!==n.length&&la(`echarts-fulldata.data.source[${o}] must contain ${n.length} cells`)});const s=B0e(e.source,t,"echarts-fulldata.data.source");return{kind:"inline",dimensions:n,source:s}}if(e.kind==="ref"){if(Dq(e,new Set(["kind","ref","format","dimensions"]),"echarts-fulldata.data"),typeof e.ref!="string"||e.ref.trim().length===0)return la("echarts-fulldata.data.ref must be a non-empty string");if(e.format!=="csv"&&e.format!=="json")return la("echarts-fulldata.data.format must be csv or json");const n=XEe(e.dimensions,"echarts-fulldata.data.dimensions");return{kind:"ref",ref:e.ref,format:e.format,dimensions:n}}return la(`Unsupported echarts-fulldata.data.kind: ${e.kind}`)}function GYe(e){const t=Array.isArray(e.title),n=t?e.title:[e.title];for(const[s,r]of n.entries()){if(!wa(r)||typeof r.text!="string")continue;const o=r.text.trim();if(o)return{index:s,isArray:t,title:r,text:o}}}function MYt(e){return GYe(e)?.text}function PYt(e,t){const n=GYe(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 pk(e){return Array.isArray(e)?e.map(t=>pk(t)):wa(e)?Object.fromEntries(Object.entries(e).map(([t,n])=>[t,pk(n)])):e}function DYt(e,t){if(e!==void 0)return(!Array.isArray(e)||e.some(n=>typeof n!="string"||n.length===0))&&la(`${t} must be an array of non-empty strings`),[...e]}function B0e(e,t,n){if(Array.isArray(e)||la(`${n} must be an array`),e.length>t.maxRows)throw new ts("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,d)=>(c!==null&&!["string","number","boolean"].includes(typeof c)&&la(`${n}[${i}][${d}] must be a JSON scalar`),c));return s+=l.length,l}if(wa(o)){const l={};for(const[c,d]of Object.entries(o))d!==null&&!["string","number","boolean"].includes(typeof d)&&la(`${n}[${i}].${c} must be a JSON scalar`),l[c]=d,s+=1;return l}return la(`${n}[${i}] must be an array or object`)});if(s>t.maxCells)throw new ts("LIMIT_EXCEEDED",`${n} exceeds the ${t.maxCells} cell limit`);return r}function LYt(e,t){return s0e(e,{maxRows:t.maxRows,maxCells:t.maxCells})}function fce(e,t){if(IYt.test(e))throw new ts("UNSAFE_SPEC",`${t} contains an ASCII control character`);const n=e.replace(/[\n\r\t]/g,""),s=e.trim();if(YEe.test(s)||YEe.test(n.trim())||RYt.test(e)||EYt.test(e)||AYt.test(e))throw new ts("UNSAFE_SPEC",`${t} contains a URL, CSS URL, or unsafe markup`)}function OYt(e,t){for(const r of Object.keys(e))if(!SYt.has(r))throw new ts("UNSAFE_SPEC",`echarts.option.${r} is not allowed`);let n=0;const s=(r,o,i)=>{if(n+=1,n>t.maxNodes)throw new ts("LIMIT_EXCEEDED",`ECharts option exceeds the ${t.maxNodes} node limit`);if(i>t.maxDepth)throw new ts("LIMIT_EXCEEDED",`ECharts option exceeds the ${t.maxDepth} depth limit`);if(typeof r=="string"){fce(r,o);return}if(Array.isArray(r)){r.forEach((l,c)=>s(l,`${o}[${c}]`,i+1));return}if(wa(r))for(const[l,c]of Object.entries(r)){const d=l.toLowerCase();if(d==="formatter"){if(typeof c!="string")throw new ts("UNSAFE_SPEC",`${o}.${l} must be a string`);fce(c,`${o}.${l}`);continue}if(CYt.has(d)||TYt.test(l))throw new ts("UNSAFE_SPEC",`${o}.${l} is not allowed`);if(l==="type"&&c==="waterfall"&&/^echarts\.option\.series(?:\[\d+\])?$/.test(o)&&la("ECharts has no native waterfall series; use stacked bar series with a transparent base and stackStrategy: all"),l==="type"&&c==="custom")throw new ts("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 ts("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)=>{wa(o)||la(`echarts.option.dataset[${i}] must be an object`),o.source!==void 0&&B0e(o.source,t,`echarts.option.dataset[${i}].source`)})}function uL(e,t,n){if(!wa(e))return la("ECharts specification must be an object");if(Object.prototype.hasOwnProperty.call(e,"option")||Object.prototype.hasOwnProperty.call(e,"data"))return la("Canonical markdown-chart data must be a sibling of spec; spec must contain the ECharts option directly");const s=pk(e),r=t;return r&&Object.prototype.hasOwnProperty.call(s,"dataset")?la("echarts.option.dataset cannot be combined with echarts.data"):(OYt(s,n),{option:s,data:r})}function BYt(e){if(e instanceof SyntaxError)return!0;if(!e||typeof e!="object")return!1;try{return Object.prototype.hasOwnProperty.call(e,Symbol.toStringTag)?!1:Object.prototype.toString.call(e)==="[object Error]"&&Reflect.get(e,"name")==="SyntaxError"&&typeof Reflect.get(e,"message")=="string"}catch{return!1}}function $Yt(e,t){let n;try{n=JSON.parse(e)}catch(r){if(BYt(r))return;throw r}const s=n0e(n,{maxDepth:t.maxDepth,maxNodes:t.maxNodes});return wa(s)&&Object.prototype.hasOwnProperty.call(s,"option")?(Dq(s,new Set(["option"]),"Temporary ChatBI JSON chart"),uL(s.option,void 0,t)):uL(s,void 0,t)}function FYt(e,t){if(!wa(e))return la("echarts-fulldata must contain an object");if(Dq(e,new Set(["version","data","option"]),"echarts-fulldata"),e.version!==1)throw new ts("UNSUPPORTED_VERSION","Only echarts-fulldata version 1 is supported");if(!Object.prototype.hasOwnProperty.call(e,"data"))return la("echarts-fulldata.data is required");if(!wa(e.option))return la("echarts-fulldata.option must be an object");const n=NYt(e.data,t);return uL(e.option,n,t)}function zYt(e){const t="default"in e?e.default:e;if(!t||typeof t.init!="function")throw new ts("RUNTIME_LOAD_FAILED","The supplied ECharts runtime has no init function");return t}function UYt(e,t){const n=B0e(e.source,t,"resolvedDataset.source"),s=e.dimensions?DYt(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 WYt={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 ib(e,t){const n={...pk(e),...t};for(const[s,r]of Object.entries(e)){const o=t[s];wa(r)&&wa(o)&&(n[s]=ib(r,o))}return n}function wP(e,t){return Array.isArray(e)?e.map(n=>wa(n)?ib(t,n):n):wa(e)?ib(t,e):e??pk(t)}function KYe(e){const t=n=>wa(n)?{...n,appendToBody:!1,confine:!0,enterable:!1,renderMode:"richText"}:n;return Array.isArray(e)?e.map(t):t(e)}function hL(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function HYt(e,t){const n=s=>{if(!hL(s,"top")&&!hL(s,"bottom"))return ib(t,s);const r=pk(t);return delete r.top,delete r.bottom,ib(r,s)};return Array.isArray(e)?e.map(s=>wa(s)?n(s):s):wa(e)?n(e):e??pk(t)}var qYt=740,YYe=10,JEe=qYt*YYe/100,VYt=24,GYt=24,QEe=16,KYt=24;function XYe(e){if(typeof e=="number")return Number.isFinite(e)&&e>=0&&e<=JEe?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<=YYe?JEe:null}function YYt(e){return["text","subtext"].some(t=>typeof e[t]=="string"&&e[t].trim().length>0)}function XYt(e){return e.show===!1||!YYt(e)?null:hL(e,"top")?XYe(e.top):hL(e,"bottom")?null:0}function JYt(e){return e.show===!1||!hL(e,"top")?null:XYe(e.top)}function ZEe(e){return Array.isArray(e)?e.filter(wa):wa(e)?[e]:[]}function QYt(e,t){const n=ZEe(e).flatMap(r=>{const o=XYt(r);return o===null?[]:[o+VYt+QEe]}),s=ZEe(t).flatMap(r=>{const o=JYt(r);return o===null?[]:[o+GYt+QEe]});return Math.max(KYt,...n,...s)}function eAe(e,t){return Array.isArray(e)?e.map((n,s)=>wa(n)?ib(t(s),n):n):wa(e)?ib(t(0),e):e}function tAe(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=ib(s,{lineStyle:{width:2},itemStyle:{borderWidth:1},symbol:"circle",symbolSize:4}):n==="bar"?s=ib(s,{barCategoryGap:"48%",barMaxWidth:42,itemStyle:{borderRadius:[3,3,0,0]}}):n==="pie"&&(s=ib(s,{itemStyle:{borderColor:t.seriesBorder,borderWidth:2}}));const r=ib(s,e);return Object.prototype.hasOwnProperty.call(e,"tooltip")&&(r.tooltip=KYe(wP(e.tooltip,{appendToBody:!1,confine:!0,enterable:!1,renderMode:"richText"}))),r}var JYe=new Set(["pie","funnel","gauge","radar","treemap"]),ZYt=new Set([...JYe,"graph","chord","themeRiver"]);function QYe(e){return Array.isArray(e.series)?e.series.filter(wa):wa(e.series)?[e.series]:[]}function eXt(e){if(Object.prototype.hasOwnProperty.call(e,"legend"))return!0;const t=QYe(e);return t.some(n=>typeof n.type=="string"&&ZYt.has(n.type))?!0:t.filter(n=>typeof n.name=="string"&&n.name.trim().length>0).length>1}function tXt(e){if(!Object.prototype.hasOwnProperty.call(e,"xAxis")&&!Object.prototype.hasOwnProperty.call(e,"yAxis"))return"item";const t=QYe(e);return t.length>0&&t.every(n=>typeof n.type=="string"&&JYe.has(n.type))?"item":"axis"}function nXt(e){return e==null||e==="light"?"light":e==="dark"?"dark":void 0}function sXt(e,t="light"){const n=WYt[t],s=pk(e);return s.backgroundColor??=n.background,s.color??=[...n.palette],s.textStyle=wP(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=wP(s.title,{textStyle:{color:n.titleText},subtextStyle:{color:n.subtext}})),s.tooltip=KYe(wP(s.tooltip,{trigger:tXt(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}}})),eXt(e)&&(s.legend=HYt(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=wP(s.grid,{top:QYt(s.title,s.legend),right:36,bottom:48,left:24,containLabel:!0}),s.xAxis!==void 0&&(s.xAxis=eAe(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=eAe(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=>wa(r)?tAe(r,n):r):wa(s.series)&&(s.series=tAe(s.series,n)),s}function ZYe(e){if(!Array.isArray(e.series)||e.series.length!==1||!wa(e.series[0]))return la("Structured ECharts data requires exactly one series");const t=e.series[0];for(const n of["data","nodes","links","edges"])Object.prototype.hasOwnProperty.call(t,n)&&la(`echarts.option.series[0].${n} cannot be combined with structured markdown-chart.data`);return t}function rXt(e){e.links.length===0&&la("Sankey data requires at least one link");let t=0;const n=new Map;e.nodes.forEach(i=>n.set(i.id,[])),e.links.forEach((i,l)=>{i.source===i.target&&la(`markdown-chart.data.source.links[${l}] cannot be a self-loop for sankey`),i.value===void 0&&la(`markdown-chart.data.source.links[${l}].value is required for sankey`),t+=i.value,n.get(i.source)?.push(i.target)}),t<=0&&la("Sankey link values must contain a positive total flow");const s=new Set,r=new Set,o=i=>{if(s.has(i)&&la("Sankey data must be acyclic"),!r.has(i)){s.add(i);for(const l of n.get(i)??[])o(l);s.delete(i),r.add(i)}};e.nodes.forEach(i=>o(i.id))}function oXt(e,t){const n=ZYe(e),s=n.type;if(s!=="sankey"&&s!=="graph")return la("graph data requires an ECharts sankey or graph series");s==="sankey"&&(rXt(t),t.nodes.forEach((d,h)=>{fce(d.name,`markdown-chart.data.source.nodes[${h}].name`)}));const r=new Map(t.nodes.map((d,h)=>[d.id,h])),o=[],i=new Map;t.nodes.forEach(d=>{d.category!==void 0&&!i.has(d.category)&&(i.set(d.category,o.length),o.push(d.category))});const l=t.nodes.map(d=>({id:d.id,name:d.name,...s==="sankey"?{label:{formatter:d.name}}:{},...s!=="graph"||d.category===void 0?{}:{category:i.get(d.category)}})),c=t.links.map(d=>({source:r.get(d.source),target:r.get(d.target),...d.value===void 0?{}:{value:d.value}}));return n.data=l,n.links=c,s==="graph"&&o.length>0&&(n.categories=o.map(d=>({name:d}))),{option:e,preferredHeight:Math.min(2e3,Math.max(360,240+t.nodes.length*(s==="sankey"?18:5)))}}function eXe(e){return e.reduce((t,n)=>t+1+eXe(n.children??[]),0)}function tXe(e,t){const n=e.children??[];if(n.length===0)return t&&e.value===void 0?la(`Hierarchy leaf ${e.id} requires value for area charts`):{data:{id:e.id,name:e.name,...e.value===void 0?{}:{value:e.value}},total:e.value};const s=n.map(o=>tXe(o,t)),r=s.every(o=>o.total!==void 0)?s.reduce((o,i)=>o+(i.total??0),0):void 0;return{data:{id:e.id,name:e.name,...r===void 0?{}:{value:r},children:s.map(o=>o.data)},total:r}}function iXt(e,t){const n=ZYe(e),s=n.type;if(s!=="tree"&&s!=="treemap"&&s!=="sunburst")return la("hierarchy data requires an ECharts tree, treemap, or sunburst series");if(s==="tree"&&t.length!==1)return la("ECharts tree series requires exactly one hierarchy root");const r=t.map(i=>tXe(i,s!=="tree"));if(s!=="tree"&&r.reduce((l,c)=>l+(c.total??0),0)<=0)return la("Hierarchy area charts require a positive total leaf value");n.data=r.map(i=>i.data);const o=eXe(t);return{option:e,preferredHeight:s==="tree"?Math.min(2e3,Math.max(360,240+o*18)):460}}function aXt(e,t){if(t.shape==="graph")return oXt(e,t.source);if(t.shape==="hierarchy")return iXt(e,t.source)}var nAe={dispose(){}};function lXt(e={}){const t={..._Yt,...e.limits},n=e.legacySandbox?.resolveLegacyArtifactContent,s=e.legacySandbox?.resolveLegacySandboxFileContent,r=e.legacySandbox?bYt({maxRows:t.maxRows,maxCells:t.maxCells},void 0):void 0,o=e.loadECharts??(async()=>await bt(()=>import("./index-DohPy72Z.js"),[])),i=async(l,c,d)=>{const h=(l.shape??"table")==="table"?{maxRows:t.maxRows,maxCells:t.maxCells}:d;return m7t(l,{signal:c,...h?{limits:h}:{},...e.resolveDataRef?{resolveDataRef:e.resolveDataRef}:{},...e.validateDataRef?{validateDataRef:e.validateDataRef}:{}})};return{id:"echarts",aliases:["echarts-fulldata"],matchLanguage:oYt,parse(l,c){return c.language==="echarts-fulldata"?FYt(l,t):c.datasets?la("The ECharts renderer accepts only the default markdown-chart.data dataset"):uL(l,c.data,t)},parseSource(l,c){if(HYe(c.language))return{option:{},data:void 0,legacyEChartSandboxFile:aYt(c.rawLanguage??c.language,l)};const d=$Yt(l,t);return d||{option:{},data:void 0,legacyEChartQuery:iYt(c.language,l)}},getTitle(l){return MYt(l.option)},async materialize(l,c){if(!l.legacyEChartQuery&&!l.legacyEChartSandboxFile){const p=l.data?.kind==="ref"?await i(l.data,c.signal,c.dataLimits):l.data;if(!p)return{parsed:l,data:c.data};if(p.shape==="graph"||p.shape==="hierarchy"){const m={...l,option:pk(l.option),data:p};try{const g=aXt(m.option,p);return{parsed:m,data:p,...g?{preferredHeight:g.preferredHeight}:{}}}catch(g){if(g instanceof ts)return{parsed:m,data:p,renderError:g};throw g}}return{parsed:{...l,data:p},data:p}}if(l.legacyEChartQuery&&!n)throw new ts("REF_RESOLVER_MISSING","legacySandbox is required for this temporary ChatBI query fence");if(l.legacyEChartSandboxFile&&!s)throw new ts("REF_RESOLVER_MISSING","legacySandbox is required for this temporary ChatBI sandbox-file fence");let d;try{l.legacyEChartSandboxFile?d=await kYt({block:l.legacyEChartSandboxFile,signal:c.signal,resolveSandboxFileContent:s,limits:r,maxNodes:t.maxNodes,preserveLegacySandboxError:e.legacySandbox!==void 0}):d=await xYt({block:l.legacyEChartQuery,signal:c.signal,resolveArtifactContent:n,limits:r,maxNodes:t.maxNodes,preserveLegacySandboxError:!0})}catch(p){if(c.signal.aborted)return{parsed:l,data:c.data};throw p instanceof ts||p instanceof qYe?p:new ts("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=n0e(d,{maxDepth:t.maxDepth,maxNodes:t.maxNodes})}catch(p){throw p instanceof ts?p:new ts("SCHEMA_INVALID","Temporary ChatBI resolver returned a non-JSON result",{cause:p})}if(!wa(h))return la("Temporary ChatBI resolver must return an object");if(!Object.prototype.hasOwnProperty.call(h,"data")||!Object.prototype.hasOwnProperty.call(h,"spec"))return la("Temporary ChatBI resolver must return data and spec");const f=uL(h.spec,LYt(h.data,t),t);return f.data?.kind!=="inline"?la("Temporary ChatBI resolver must return inline data"):{parsed:f,data:f.data}},async mount(l,c,d){if(c.legacyEChartQuery||c.legacyEChartSandboxFile)return la("Temporary ChatBI charts must be materialized before mounting");const h=pk(c.option);if(d.externalizedTitle&&PYt(h,d.externalizedTitle),c.data&&(c.data.shape??"table")==="table"){let b;if(c.data.kind==="inline")b=c.data;else return la("ECharts table data references must be materialized before mounting");const y=UYt(b,t);h.dataset=y.option}if(d.signal.aborted)return nAe;let f;try{f=zYt(await o())}catch(b){throw b instanceof ts?b:new ts("RUNTIME_LOAD_FAILED","The ECharts runtime could not be loaded",{cause:b})}if(d.signal.aborted)return nAe;let p,m;try{const b=typeof d.theme=="string"||wa(d.theme)?d.theme:void 0;p=f.init(l,b);const y=nXt(d.theme),w=e.defaultStyle===!1||!y?h:sXt(h,y);p.setOption(w,{notMerge:!0,lazyUpdate:!1}),e.resizeObserver!==!1&&typeof ResizeObserver<"u"&&(m=new ResizeObserver(()=>p?.resize()),m.observe(l))}catch(b){try{m?.disconnect()}catch{}try{p?.dispose()}catch{}throw new ts("RENDER_FAILED","ECharts failed to render the chart",{cause:b})}const g=p;let v=!1;return{resize:()=>g.resize(),dispose(){v||(v=!0,m?.disconnect(),g.dispose())}}}}}var $0e=u.createContext(null);function cXt(e){if(u.isValidElement(e))return typeof e.props.children=="string"?e.props.children:void 0}function dXt(e){const t=e.source??cXt(e.children),n=u.useMemo(()=>({registry:e.registry,theme:e.theme,streaming:e.streaming??!1,source:t,loadingLabel:e.loadingLabel,labels:e.labels,referenceActions:e.referenceActions,onError:e.onError}),[e.registry,e.theme,e.streaming,t,e.loadingLabel,e.labels,e.referenceActions,e.onError]);return u.createElement($0e.Provider,{value:n},e.children)}function uXt(e){const t=u.useContext($0e);if(!t)throw new Error("MarkdownChartBlock must be rendered inside MarkdownChartProvider");const n=u.useRef(null),s=e.streaming??t.streaming,r=e.loadingLabel??t.loadingLabel,o=e.labels??t.labels,i=u.useMemo(()=>hGe(o),[o]),l=t.referenceActions?.canOpen,c=t.referenceActions?.open,d=u.useMemo(()=>c?{...l?{canOpen:l}:{},open:c}:void 0,[l,c]);u.useEffect(()=>{const f=n.current;if(!f)return;const p=new L7t(t.registry);let m=!1;return p.render(f,{language:e.language,source:e.source,theme:t.theme,streaming:s,...r!==void 0?{loadingLabel:r}:{},...o!==void 0?{labels:o}:{},...d!==void 0?{referenceActions:d}:{},...t.onError!==void 0?{onError:t.onError}:{}}).catch(g=>{m||(f.classList.add("markdown-chart-error"),f.setAttribute("role","alert"),f.textContent=i.chartUnavailable,t.onError?.(g,{language:e.language,source:e.source}))}),()=>{m=!0,p.dispose()}},[t.registry,t.theme,t.onError,d,r,o,i,e.language,e.source,s]);const h=["markdown-chart-placeholder",s?"markdown-chart-streaming":void 0,e.className].filter(Boolean).join(" ");return u.createElement("div",{ref:n,className:h,style:e.style,"aria-label":i.chart,"aria-busy":s||void 0,"data-markdown-chart-complete":String(!s)})}function hXt(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(`
|
|
1916
|
-
`,Math.max(0,n-1))+1,o=e.slice(r,n),i=/^(?: {0,3}>[ \t]?)+$/.test(o)?r:n;return pGe(e.slice(i,s))||e.slice(s).trim().length>0}function nXe(e,t){return e===zU||t?.has(e)===!0}function fXt(e={}){return{code({node:n,...s}){return u.createElement("code",s)},pre:function({node:s,children:r,...o}){const i=u.useContext($0e);if(u.isValidElement(r)){const l=r,d=/(?:^|\s)language-([^\s]+)/.exec(l.props.className??"")?.[1],h=d?.toLowerCase();if(d&&h&&nXe(h,i?.registry)){const f=u.Children.toArray(l.props.children).map(p=>typeof p=="string"||typeof p=="number"?String(p):"").join("");return u.createElement(uXt,{language:d,source:f,streaming:i?.streaming===!0&&!hXt(i.source,s),...e.chartClassName?{className:e.chartClassName}:{},...e.chartStyle?{style:e.chartStyle}:{}})}}return u.createElement("pre",o,r)}}}const pXt=3e4,mXt=["artifact://","session-file://"],gXt=/^[a-z]:/i;function vXt(e={}){const{resolveDataRef:t,validateDataRef:n=kXt,...s}=e,r=e.validateDataRef===void 0,o=t?async(i,l)=>{const c=r?sXe(i):i;if(!c)throw new Error("Chart data reference is not supported.");return _Xt(Promise.resolve(t(c,l)),"Chart data reference resolution")}:void 0;return new y7t().register(lXt({...s,resolveDataRef:o,validateDataRef:n}))}const yXt={registry:vXt()};function wXt(e,t={}){const n=fXt(t).pre;if(!n)throw new Error("markdown-chart React adapter did not provide a pre renderer");return function({children:r,...o}){if(u.isValidElement(r)){const i=r,c=/(?:^|\s)language-([^\s]+)/.exec(i.props.className??"")?.[1]?.toLowerCase();if(c&&nXe(c,e))return u.createElement(n,o,r)}return u.createElement(u.Fragment,null,r)}}function bXt({customization:e,source:t,streaming:n,theme:s,children:r}){const o=xXt(e.labels),{t:i}=et();return a.jsx(dXt,{registry:e.registry,source:t,streaming:n,theme:s,loadingLabel:e.loadingLabel??i("echartsChart.rendering"),labels:o,onError:e.onError??SXt,children:r})}function xXt(e){const{t}=et();return u.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"),nodes:t("echartsChart.nodes"),links:t("echartsChart.links"),name:t("echartsChart.name"),category:t("echartsChart.category"),id:t("echartsChart.id"),source:t("echartsChart.source"),target:t("echartsChart.target"),value:t("echartsChart.value"),depth:t("echartsChart.depth"),path:t("echartsChart.path"),idPath:t("echartsChart.idPath"),subtreeTotal:t("echartsChart.subtreeTotal"),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 sAe(e){return/\s/.test(e)||Array.from(e).some(t=>{const n=t.codePointAt(0);return n!==void 0&&(n<=31||n===127)})}function sXe(e){if(e.trim()!==e||!e||sAe(e))return;const t=e.toLowerCase(),n=mXt.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)||sAe(r))return;const o=r.split("/");if(!o.some(i=>i.length===0||i==="."||i===".."||gXt.test(i)))return`${n}${o.join("/")}`}function kXt(e){return sXe(e)!==void 0}function _Xt(e,t){return new Promise((n,s)=>{const r=globalThis.setTimeout(()=>s(new Error(`${t} timed out.`)),pXt);e.then(n,s).finally(()=>globalThis.clearTimeout(r))})}function SXt(e){console.error("[web-shell] markdown-chart render failed:",e)}const CXt=32e3,TXt=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"]),rAe={"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 F0e(e){const t=(e||"").toLowerCase(),n=Object.hasOwn(rAe,t)?rAe[t]:t,s=TXt.has(n)?n:"text";return{label:(e||"").trim()||"text",lang:n,resolvedLang:s}}const rXe=/^(https?:|mailto:)/i,IXt=/^data:image\/(png|jpeg|gif|webp|bmp);base64,/i,oXe=/^data:image\/(png|jpeg|gif|webp);base64,[A-Za-z0-9+/]*={0,2}$/i;function TT(e){if(!e)return!1;const t=e.trim();return t?t.startsWith("#")||t.startsWith("/")&&!t.startsWith("//")?!0:rXe.test(t):!1}function Nk(e,t=!1){if(!e)return!1;const n=e.trim();return n?t?oXe.test(n):n.startsWith("#")||n.startsWith("/")&&!n.startsWith("//")||IXt.test(n)?!0:rXe.test(n):!1}let oAe,iAe=Promise.resolve(),RXt=0;const EXt=5e4,AXt=500,jXt=1e4,aAe=16;function NXt({code:e}){const{t}=et(),n=eS(),s=pc()!=="interactive",[r,o]=u.useState(null),[i,l]=u.useState(null),[c,d]=u.useState("diagram"),[h,f]=fk(),[p,m]=u.useState(1),[g,v]=u.useState(!1),b=u.useRef(null),[y,w]=u.useState(!1),[x,k]=u.useState(!1),[_,S]=u.useState(null),E=u.useRef(null),j=u.useRef(null),I=n==="light"?"default":"dark",R=.5,T=3,N=.25,A=()=>{m(O=>Math.min(T,Math.round((O+N)*100)/100))},M=()=>{m(O=>Math.max(R,Math.round((O-N)*100)/100))},P=u.useCallback(()=>{j.current=null,v(!1),m(1);const O=b.current;O&&(O.scrollLeft=0,O.scrollTop=0),w(!1)},[]),D=u.useCallback(O=>{const W=b.current;W&&(O.preventDefault(),v(!0),j.current={startX:O.clientX,startY:O.clientY,startLeft:W.scrollLeft,startTop:W.scrollTop})},[]),z=u.useCallback(O=>{const{scrollLeft:W,scrollTop:H}=O.currentTarget;w(W!==0||H!==0)},[]),B=u.useCallback(()=>{const O=b.current;O&&(k(O.scrollWidth>O.clientWidth||O.scrollHeight>O.clientHeight),w(O.scrollLeft!==0||O.scrollTop!==0))},[]),$=u.useCallback(()=>{const O=b.current,W=E.current?.querySelector("svg");if(!O||!W)return;const[,,H,Q]=(W.getAttribute("viewBox")??"").split(/[\s,]+/).map(Number),V=(W.getAttribute("width")??"").trim(),re=Number.parseFloat(W.getAttribute("height")??""),Z=H>0&&Q>0,ue=Z?H:Number.parseFloat(V),de=Z?Q:re;if(!(ue>0)||!(de>0)){S(null);return}const U=O.clientWidth-aAe*2,G=V.endsWith("%")&&U>0?Math.min(ue,U):ue,Y=Math.max(0,O.offsetHeight-O.clientHeight);S({stageWidth:G,canvasHeight:G*de/ue+aAe*2+Y})},[]);u.useEffect(()=>{if(!g)return;const O=H=>{const Q=b.current,V=j.current;!Q||!V||(Q.scrollLeft=V.startLeft-(H.clientX-V.startX),Q.scrollTop=V.startTop-(H.clientY-V.startY),w(Q.scrollLeft!==0||Q.scrollTop!==0))},W=()=>{j.current=null,v(!1)};return window.addEventListener("mousemove",O),window.addEventListener("mouseup",W),window.addEventListener("blur",W),()=>{window.removeEventListener("mousemove",O),window.removeEventListener("mouseup",W),window.removeEventListener("blur",W)}},[g]),u.useEffect(()=>{P()},[e,P]),u.useLayoutEffect(()=>{$(),B()},[r,p,c,$,B]),u.useEffect(()=>{const O=b.current;if(!O)return;const W=new ResizeObserver(()=>{$(),B()});return W.observe(O),()=>W.disconnect()},[r,c,$,B]),u.useEffect(()=>{let O=!1;o(null),l(null);const W=setTimeout(()=>{bt(()=>import("./mermaid.core-DYjTp4Sk.js").then(H=>H.cb),[]).then(async H=>{if(O)return;const Q=H.default,V=`${I}:${s?"hardened":"runtime"}`,re=iAe.then(async()=>{if(O)throw new Error("Mermaid render skipped");oAe!==V&&(Q.initialize({startOnLoad:!1,theme:I,securityLevel:"strict",suppressErrorRendering:!0,...s?{maxTextSize:EXt,maxEdges:AXt}:{},flowchart:{wrappingWidth:300,useMaxWidth:!1}}),oAe=V);const ue=`mermaid-${++RXt}`;if(!s)return Q.render(ue,e.trim());let de;try{return await Promise.race([Q.render(ue,e.trim()),new Promise((U,G)=>{de=setTimeout(()=>G(new Error("Mermaid render timed out")),jXt)})])}finally{de!==void 0&&clearTimeout(de)}});iAe=re.then(()=>{},()=>{});const{svg:Z}=await re;O||o(Z)}).catch(H=>{O||l(H instanceof Error?H.message:"Mermaid render failed")})},150);return()=>{O=!0,clearTimeout(W)}},[e,s,I]);const L=()=>{lp(e).then(()=>{f()}).catch(ew)};return i?a.jsxs("div",{className:Ki.codeBlock,"data-selection-code-language":"mermaid",children:[a.jsx("div",{className:Ki.codeBlockHeader,"data-selection-copy-ignore":!0,children:a.jsx("span",{className:Ki.codeBlockLang,children:t("mermaid.errorLabel")})}),a.jsx("pre",{className:`${Ki.codeBlockContent} ${Ki.codeBlockPlain}`,dir:"auto",children:a.jsx("code",{children:e})})]}):a.jsxs("div",{className:Ki.codeBlock,"data-selection-code-language":"mermaid",children:[a.jsxs("div",{className:Ki.codeBlockHeader,"data-selection-copy-ignore":!0,children:[a.jsx("span",{className:Ki.codeBlockLang,children:t("mermaid.label")}),a.jsxs("span",{className:Ki.mermaidActions,children:[c==="diagram"&&a.jsxs(a.Fragment,{children:[a.jsx("button",{className:Ki.codeBlockCopy,onClick:M,title:t("mermaid.zoomOut"),disabled:p<=R,children:t("mermaid.zoomOut")}),a.jsx("button",{className:Ki.codeBlockCopy,onClick:P,title:t("mermaid.zoomReset"),disabled:p===1&&!y,children:t("mermaid.zoomReset")}),a.jsx("button",{className:Ki.codeBlockCopy,onClick:A,title:t("mermaid.zoomIn"),disabled:p>=T,children:t("mermaid.zoomIn")})]}),a.jsx("button",{className:Ki.codeBlockCopy,onClick:()=>d(c==="diagram"?"code":"diagram"),children:t(c==="diagram"?"mermaid.viewCode":"mermaid.viewDiagram")}),a.jsx("button",{className:Ki.codeBlockCopy,onClick:L,children:t(h?"code.copied":"code.copy")})]})]}),c==="code"?a.jsx("pre",{className:`${Ki.codeBlockContent} ${Ki.codeBlockPlain}`,dir:"auto",children:a.jsx("code",{children:e})}):r?a.jsx("div",{className:`${Ki.mermaidZoomWrapper} ${x?Ki.mermaidPannable:""} ${x&&g?Ki.mermaidDragging:""}`,ref:b,"data-selection-copy-ignore":!0,"data-selection-copy-gesture":!0,style:_?{height:_.canvasHeight}:void 0,onMouseDown:D,onDoubleClick:P,onScroll:z,children:a.jsx("div",{className:`${Ki.mermaidBlock} ${Ki.mermaidStage}`,ref:E,style:{..._?{width:_.stageWidth}:{},...p===1?{}:{zoom:p}},dangerouslySetInnerHTML:{__html:r}})}):a.jsx("div",{className:`${Ki.mermaidBlock} ${Ki.mermaidLoading} ${Ki.mermaidInline}`,"data-selection-copy-ignore":!0,"data-selection-copy-gesture":!0,children:a.jsx("span",{children:t("mermaid.rendering")})})]})}function MXt({className:e,children:t,isStreaming:n}){const{t:s}=et(),r=eS(),o=pc()==="document",[i,l]=u.useState(null),[c,d]=fk(),{label:h,lang:f,resolvedLang:p}=F0e(iXe(e)),m=String(t).replace(/\n$/,""),g=r==="light"?"github-light-default":"github-dark-default";u.useEffect(()=>{if(o||n||f==="mermaid"||p==="text"||ace(m)){l(null);return}const b=wVt(m,p,g);if(b!==null){l(b);return}const y=OEe(m,p,g,!0);if(y!==null){l(y);return}l(null);let w=!1;return TYe(p).then(()=>{if(w)return;const x=OEe(m,p,g,!0);x!==null&&l(x)}).catch(x=>{w||(console.warn("[web-shell] highlight failed for lang=%s",p,x),l(null))}),()=>{w=!0}},[m,o,f,p,g,n]);const v=()=>{lp(m).then(()=>{d()}).catch(ew)};return f==="mermaid"&&!n&&!o?a.jsx(NXt,{code:m}):a.jsxs("div",{className:Ki.codeBlock,"data-selection-code-language":f,children:[a.jsxs("div",{className:Ki.codeBlockHeader,"data-selection-copy-ignore":!0,children:[a.jsx("span",{className:Ki.codeBlockLang,children:h}),a.jsx("button",{className:Ki.codeBlockCopy,onClick:v,children:s(c?"code.copied":"code.copy")})]}),!o&&!n&&i!==null?a.jsx("div",{className:Ki.codeBlockContent,dir:"auto",dangerouslySetInnerHTML:{__html:i}}):a.jsx("pre",{className:`${Ki.codeBlockContent} ${Ki.codeBlockPlain}`,dir:"auto",children:a.jsx("code",{children:m})})]})}function iXe(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 PXt({children:e}){return a.jsx("code",{className:Ki.inlineCode,dir:"auto",children:e})}function lAe({children:e}){return a.jsx("div",{className:Ki.tableWrapper,children:a.jsx("table",{className:Ki.table,children:e})})}const aXe=u.createContext(!1),lXe=u.createContext(void 0),cXe=u.createContext(void 0);function DXt(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:!pGe(e.slice(s,r))&&e.slice(r).trim().length===0}function LXt({className:e,children:t,node:n}){const s=u.useContext(aXe),r=u.useContext(cXe);return e?.startsWith("language-")||typeof t=="string"&&t.includes(`
|
|
1916
|
+
`,Math.max(0,n-1))+1,o=e.slice(r,n),i=/^(?: {0,3}>[ \t]?)+$/.test(o)?r:n;return pGe(e.slice(i,s))||e.slice(s).trim().length>0}function nXe(e,t){return e===zU||t?.has(e)===!0}function fXt(e={}){return{code({node:n,...s}){return u.createElement("code",s)},pre:function({node:s,children:r,...o}){const i=u.useContext($0e);if(u.isValidElement(r)){const l=r,d=/(?:^|\s)language-([^\s]+)/.exec(l.props.className??"")?.[1],h=d?.toLowerCase();if(d&&h&&nXe(h,i?.registry)){const f=u.Children.toArray(l.props.children).map(p=>typeof p=="string"||typeof p=="number"?String(p):"").join("");return u.createElement(uXt,{language:d,source:f,streaming:i?.streaming===!0&&!hXt(i.source,s),...e.chartClassName?{className:e.chartClassName}:{},...e.chartStyle?{style:e.chartStyle}:{}})}}return u.createElement("pre",o,r)}}}const pXt=3e4,mXt=["artifact://","session-file://"],gXt=/^[a-z]:/i;function vXt(e={}){const{resolveDataRef:t,validateDataRef:n=kXt,...s}=e,r=e.validateDataRef===void 0,o=t?async(i,l)=>{const c=r?sXe(i):i;if(!c)throw new Error("Chart data reference is not supported.");return _Xt(Promise.resolve(t(c,l)),"Chart data reference resolution")}:void 0;return new y7t().register(lXt({...s,resolveDataRef:o,validateDataRef:n}))}const yXt={registry:vXt()};function wXt(e,t={}){const n=fXt(t).pre;if(!n)throw new Error("markdown-chart React adapter did not provide a pre renderer");return function({children:r,...o}){if(u.isValidElement(r)){const i=r,c=/(?:^|\s)language-([^\s]+)/.exec(i.props.className??"")?.[1]?.toLowerCase();if(c&&nXe(c,e))return u.createElement(n,o,r)}return u.createElement(u.Fragment,null,r)}}function bXt({customization:e,source:t,streaming:n,theme:s,children:r}){const o=xXt(e.labels),{t:i}=et();return a.jsx(dXt,{registry:e.registry,source:t,streaming:n,theme:s,loadingLabel:e.loadingLabel??i("echartsChart.rendering"),labels:o,onError:e.onError??SXt,children:r})}function xXt(e){const{t}=et();return u.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"),nodes:t("echartsChart.nodes"),links:t("echartsChart.links"),name:t("echartsChart.name"),category:t("echartsChart.category"),id:t("echartsChart.id"),source:t("echartsChart.source"),target:t("echartsChart.target"),value:t("echartsChart.value"),depth:t("echartsChart.depth"),path:t("echartsChart.path"),idPath:t("echartsChart.idPath"),subtreeTotal:t("echartsChart.subtreeTotal"),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 sAe(e){return/\s/.test(e)||Array.from(e).some(t=>{const n=t.codePointAt(0);return n!==void 0&&(n<=31||n===127)})}function sXe(e){if(e.trim()!==e||!e||sAe(e))return;const t=e.toLowerCase(),n=mXt.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)||sAe(r))return;const o=r.split("/");if(!o.some(i=>i.length===0||i==="."||i===".."||gXt.test(i)))return`${n}${o.join("/")}`}function kXt(e){return sXe(e)!==void 0}function _Xt(e,t){return new Promise((n,s)=>{const r=globalThis.setTimeout(()=>s(new Error(`${t} timed out.`)),pXt);e.then(n,s).finally(()=>globalThis.clearTimeout(r))})}function SXt(e){console.error("[web-shell] markdown-chart render failed:",e)}const CXt=32e3,TXt=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"]),rAe={"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 F0e(e){const t=(e||"").toLowerCase(),n=Object.hasOwn(rAe,t)?rAe[t]:t,s=TXt.has(n)?n:"text";return{label:(e||"").trim()||"text",lang:n,resolvedLang:s}}const rXe=/^(https?:|mailto:)/i,IXt=/^data:image\/(png|jpeg|gif|webp|bmp);base64,/i,oXe=/^data:image\/(png|jpeg|gif|webp);base64,[A-Za-z0-9+/]*={0,2}$/i;function TT(e){if(!e)return!1;const t=e.trim();return t?t.startsWith("#")||t.startsWith("/")&&!t.startsWith("//")?!0:rXe.test(t):!1}function Nk(e,t=!1){if(!e)return!1;const n=e.trim();return n?t?oXe.test(n):n.startsWith("#")||n.startsWith("/")&&!n.startsWith("//")||IXt.test(n)?!0:rXe.test(n):!1}let oAe,iAe=Promise.resolve(),RXt=0;const EXt=5e4,AXt=500,jXt=1e4,aAe=16;function NXt({code:e}){const{t}=et(),n=eS(),s=pc()!=="interactive",[r,o]=u.useState(null),[i,l]=u.useState(null),[c,d]=u.useState("diagram"),[h,f]=fk(),[p,m]=u.useState(1),[g,v]=u.useState(!1),b=u.useRef(null),[y,w]=u.useState(!1),[x,k]=u.useState(!1),[_,S]=u.useState(null),E=u.useRef(null),j=u.useRef(null),I=n==="light"?"default":"dark",R=.5,T=3,N=.25,A=()=>{m(O=>Math.min(T,Math.round((O+N)*100)/100))},M=()=>{m(O=>Math.max(R,Math.round((O-N)*100)/100))},P=u.useCallback(()=>{j.current=null,v(!1),m(1);const O=b.current;O&&(O.scrollLeft=0,O.scrollTop=0),w(!1)},[]),D=u.useCallback(O=>{const W=b.current;W&&(O.preventDefault(),v(!0),j.current={startX:O.clientX,startY:O.clientY,startLeft:W.scrollLeft,startTop:W.scrollTop})},[]),z=u.useCallback(O=>{const{scrollLeft:W,scrollTop:H}=O.currentTarget;w(W!==0||H!==0)},[]),B=u.useCallback(()=>{const O=b.current;O&&(k(O.scrollWidth>O.clientWidth||O.scrollHeight>O.clientHeight),w(O.scrollLeft!==0||O.scrollTop!==0))},[]),$=u.useCallback(()=>{const O=b.current,W=E.current?.querySelector("svg");if(!O||!W)return;const[,,H,Q]=(W.getAttribute("viewBox")??"").split(/[\s,]+/).map(Number),V=(W.getAttribute("width")??"").trim(),re=Number.parseFloat(W.getAttribute("height")??""),Z=H>0&&Q>0,ue=Z?H:Number.parseFloat(V),de=Z?Q:re;if(!(ue>0)||!(de>0)){S(null);return}const U=O.clientWidth-aAe*2,G=V.endsWith("%")&&U>0?Math.min(ue,U):ue,Y=Math.max(0,O.offsetHeight-O.clientHeight);S({stageWidth:G,canvasHeight:G*de/ue+aAe*2+Y})},[]);u.useEffect(()=>{if(!g)return;const O=H=>{const Q=b.current,V=j.current;!Q||!V||(Q.scrollLeft=V.startLeft-(H.clientX-V.startX),Q.scrollTop=V.startTop-(H.clientY-V.startY),w(Q.scrollLeft!==0||Q.scrollTop!==0))},W=()=>{j.current=null,v(!1)};return window.addEventListener("mousemove",O),window.addEventListener("mouseup",W),window.addEventListener("blur",W),()=>{window.removeEventListener("mousemove",O),window.removeEventListener("mouseup",W),window.removeEventListener("blur",W)}},[g]),u.useEffect(()=>{P()},[e,P]),u.useLayoutEffect(()=>{$(),B()},[r,p,c,$,B]),u.useEffect(()=>{const O=b.current;if(!O)return;const W=new ResizeObserver(()=>{$(),B()});return W.observe(O),()=>W.disconnect()},[r,c,$,B]),u.useEffect(()=>{let O=!1;o(null),l(null);const W=setTimeout(()=>{bt(()=>import("./mermaid.core-C3SdL30W.js").then(H=>H.cb),[]).then(async H=>{if(O)return;const Q=H.default,V=`${I}:${s?"hardened":"runtime"}`,re=iAe.then(async()=>{if(O)throw new Error("Mermaid render skipped");oAe!==V&&(Q.initialize({startOnLoad:!1,theme:I,securityLevel:"strict",suppressErrorRendering:!0,...s?{maxTextSize:EXt,maxEdges:AXt}:{},flowchart:{wrappingWidth:300,useMaxWidth:!1}}),oAe=V);const ue=`mermaid-${++RXt}`;if(!s)return Q.render(ue,e.trim());let de;try{return await Promise.race([Q.render(ue,e.trim()),new Promise((U,G)=>{de=setTimeout(()=>G(new Error("Mermaid render timed out")),jXt)})])}finally{de!==void 0&&clearTimeout(de)}});iAe=re.then(()=>{},()=>{});const{svg:Z}=await re;O||o(Z)}).catch(H=>{O||l(H instanceof Error?H.message:"Mermaid render failed")})},150);return()=>{O=!0,clearTimeout(W)}},[e,s,I]);const L=()=>{lp(e).then(()=>{f()}).catch(ew)};return i?a.jsxs("div",{className:Ki.codeBlock,"data-selection-code-language":"mermaid",children:[a.jsx("div",{className:Ki.codeBlockHeader,"data-selection-copy-ignore":!0,children:a.jsx("span",{className:Ki.codeBlockLang,children:t("mermaid.errorLabel")})}),a.jsx("pre",{className:`${Ki.codeBlockContent} ${Ki.codeBlockPlain}`,dir:"auto",children:a.jsx("code",{children:e})})]}):a.jsxs("div",{className:Ki.codeBlock,"data-selection-code-language":"mermaid",children:[a.jsxs("div",{className:Ki.codeBlockHeader,"data-selection-copy-ignore":!0,children:[a.jsx("span",{className:Ki.codeBlockLang,children:t("mermaid.label")}),a.jsxs("span",{className:Ki.mermaidActions,children:[c==="diagram"&&a.jsxs(a.Fragment,{children:[a.jsx("button",{className:Ki.codeBlockCopy,onClick:M,title:t("mermaid.zoomOut"),disabled:p<=R,children:t("mermaid.zoomOut")}),a.jsx("button",{className:Ki.codeBlockCopy,onClick:P,title:t("mermaid.zoomReset"),disabled:p===1&&!y,children:t("mermaid.zoomReset")}),a.jsx("button",{className:Ki.codeBlockCopy,onClick:A,title:t("mermaid.zoomIn"),disabled:p>=T,children:t("mermaid.zoomIn")})]}),a.jsx("button",{className:Ki.codeBlockCopy,onClick:()=>d(c==="diagram"?"code":"diagram"),children:t(c==="diagram"?"mermaid.viewCode":"mermaid.viewDiagram")}),a.jsx("button",{className:Ki.codeBlockCopy,onClick:L,children:t(h?"code.copied":"code.copy")})]})]}),c==="code"?a.jsx("pre",{className:`${Ki.codeBlockContent} ${Ki.codeBlockPlain}`,dir:"auto",children:a.jsx("code",{children:e})}):r?a.jsx("div",{className:`${Ki.mermaidZoomWrapper} ${x?Ki.mermaidPannable:""} ${x&&g?Ki.mermaidDragging:""}`,ref:b,"data-selection-copy-ignore":!0,"data-selection-copy-gesture":!0,style:_?{height:_.canvasHeight}:void 0,onMouseDown:D,onDoubleClick:P,onScroll:z,children:a.jsx("div",{className:`${Ki.mermaidBlock} ${Ki.mermaidStage}`,ref:E,style:{..._?{width:_.stageWidth}:{},...p===1?{}:{zoom:p}},dangerouslySetInnerHTML:{__html:r}})}):a.jsx("div",{className:`${Ki.mermaidBlock} ${Ki.mermaidLoading} ${Ki.mermaidInline}`,"data-selection-copy-ignore":!0,"data-selection-copy-gesture":!0,children:a.jsx("span",{children:t("mermaid.rendering")})})]})}function MXt({className:e,children:t,isStreaming:n}){const{t:s}=et(),r=eS(),o=pc()==="document",[i,l]=u.useState(null),[c,d]=fk(),{label:h,lang:f,resolvedLang:p}=F0e(iXe(e)),m=String(t).replace(/\n$/,""),g=r==="light"?"github-light-default":"github-dark-default";u.useEffect(()=>{if(o||n||f==="mermaid"||p==="text"||ace(m)){l(null);return}const b=wVt(m,p,g);if(b!==null){l(b);return}const y=OEe(m,p,g,!0);if(y!==null){l(y);return}l(null);let w=!1;return TYe(p).then(()=>{if(w)return;const x=OEe(m,p,g,!0);x!==null&&l(x)}).catch(x=>{w||(console.warn("[web-shell] highlight failed for lang=%s",p,x),l(null))}),()=>{w=!0}},[m,o,f,p,g,n]);const v=()=>{lp(m).then(()=>{d()}).catch(ew)};return f==="mermaid"&&!n&&!o?a.jsx(NXt,{code:m}):a.jsxs("div",{className:Ki.codeBlock,"data-selection-code-language":f,children:[a.jsxs("div",{className:Ki.codeBlockHeader,"data-selection-copy-ignore":!0,children:[a.jsx("span",{className:Ki.codeBlockLang,children:h}),a.jsx("button",{className:Ki.codeBlockCopy,onClick:v,children:s(c?"code.copied":"code.copy")})]}),!o&&!n&&i!==null?a.jsx("div",{className:Ki.codeBlockContent,dir:"auto",dangerouslySetInnerHTML:{__html:i}}):a.jsx("pre",{className:`${Ki.codeBlockContent} ${Ki.codeBlockPlain}`,dir:"auto",children:a.jsx("code",{children:m})})]})}function iXe(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 PXt({children:e}){return a.jsx("code",{className:Ki.inlineCode,dir:"auto",children:e})}function lAe({children:e}){return a.jsx("div",{className:Ki.tableWrapper,children:a.jsx("table",{className:Ki.table,children:e})})}const aXe=u.createContext(!1),lXe=u.createContext(void 0),cXe=u.createContext(void 0);function DXt(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:!pGe(e.slice(s,r))&&e.slice(r).trim().length===0}function LXt({className:e,children:t,node:n}){const s=u.useContext(aXe),r=u.useContext(cXe);return e?.startsWith("language-")||typeof t=="string"&&t.includes(`
|
|
1917
1917
|
`)?a.jsx(OXt,{className:e,isStreaming:s,isIncomplete:DXt(r,n,s),children:t}):a.jsx(PXt,{children:t})}function OXt({className:e,children:t,isStreaming:n,isIncomplete:s}){const r=u.useContext(lXe),o=eS(),{markdown:i}=jh(),l=String(t),c=l.replace(/\n$/,""),d=a.jsx(MXt,{className:e,isStreaming:n,children:l}),h=iXe(e),{resolvedLang:f}=F0e(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(Rm,{fallback:d,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 d}function BXt({children:e}){return a.jsx(a.Fragment,{children:e})}const pce=/^qwen-session:\/\//i;function cAe(e,t=!1){return t&&oXe.test(e.trim())||pce.test(e.trim())?e:iGe(e)}function dXe({href:e,children:t,node:n,id:s,"aria-label":r,"aria-describedby":o}){const i=pc(),l=Pm();if((n?.properties.dataFootnoteRef!==void 0||n?.properties.dataFootnoteBackref!==void 0)&&e?.startsWith("#"))return a.jsx("a",{id:s,href:e,className:Ki.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&&pce.test(e.trim())){if(i!=="interactive")return a.jsx("span",{className:Ki.link,children:t});const h=e.trim().replace(pce,"");return a.jsx("a",{href:"#",role:"button",className:Ki.link,onClick:f=>{f.preventDefault(),f.stopPropagation(),window.dispatchEvent(new CustomEvent("qwen:open-session",{detail:h}))},children:t})}const d=TT(e)?e:void 0;return a.jsx("a",{href:d,target:"_blank",rel:"noopener noreferrer",className:Ki.link,onClick:h=>l(h,d),children:t})}function $Xt({src:e,alt:t}){const n=pc(),s=Nk(e,n==="document")?e:void 0;return a.jsx("img",{src:s,alt:t||"",className:Ki.image})}function FXt(e,t,n=80){const[s,r]=u.useState(e),o=u.useRef(s);o.current=s;const i=u.useRef(0),l=u.useRef(null),c=u.useRef(e);return c.current=e,u.useEffect(()=>{if(!t){l.current&&(clearTimeout(l.current),l.current=null),o.current!==e&&r(e);return}const d=Date.now(),h=d-i.current;h>=n?(i.current=d,r(c.current)):l.current||(l.current=setTimeout(()=>{i.current=Date.now(),l.current=null,r(c.current)},n-h))},[e,t,n]),u.useEffect(()=>()=>{l.current&&(clearTimeout(l.current),l.current=null)},[]),!t||typeof e=="string"&&typeof s=="string"&&!e.startsWith(s)?e:s}function uXe(e="basic",t=""){return{code:LXt,pre:BXt,a:dXe,img:$Xt,sup:$Ye,section:FYe,table({children:n}){if(e==="advanced"){const s=a.jsx(lAe,{children:n});return a.jsx(Rm,{fallback:s,label:"enhanced markdown table",resetKeys:[t],children:a.jsx(GKt,{fallback:s,children:n})})}return a.jsx(lAe,{children:n})}}}const zXt=uXe(),UXt=u.memo(function({content:t,components:n,remarkPlugins:s,rehypePlugins:r,urlTransform:o}){return a.jsx(oGe,{components:n,remarkPlugins:s,rehypePlugins:r,urlTransform:o,children:t})}),cp=u.memo(function({content:t,source:n,isStreaming:s,tableMode:r}){const{markdown:o,markdownTableMode:i}=jh(),l=eS(),c=pc()==="document",d=`footnote-${u.useId()}-`,h=n?o:void 0,f=FXt(t??"",s),p=s===!0&&f.length>CXt,m=u.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=u.useMemo(()=>g==="advanced"?uXe("advanced",m):zXt,[g,m]),b=h?.components,y=h?.getInlineFootnoteIcon,w=h?.mountFootnotePreview,x=u.useMemo(()=>{if(!b&&!y&&!w)return v;const N={...v,...b,...g==="advanced"?{table:v.table}:{}},A=b?.a;return b&&(N.a=M=>{if(M.node?.properties.dataFootnoteRef!==void 0||M.node?.properties.dataFootnoteBackref!==void 0||!A)return a.jsx(dXe,{...M});if(typeof A!="string")return u.createElement(A,M);const{node:D,...z}=M;return u.createElement(A,z)}),b?.sup||(N.sup=M=>a.jsx($Ye,{...M,linkComponent:A,iconResolver:y,mountPreview:w}),N.section=M=>a.jsx(FYe,{...M,sectionComponent:b?.section})),N},[v,g,b,y,w]),k=!c&&n==="assistant"&&!b?.code&&!b?.pre?h?.chart??(h?.renderCodeBlock?void 0:yXt):void 0,_=u.useMemo(()=>k?wXt(k.registry,{chartClassName:k.chartClassName,chartStyle:{minHeight:360,...k.chartStyle}}):void 0,[k]),S=u.useMemo(()=>_?{...x,pre:_}:x,[_,x]),E=u.useMemo(()=>h?.remarkPlugins?[Rle,oEe,yEe,...h.remarkPlugins]:[Rle,oEe,yEe],[h?.remarkPlugins]),j=u.useMemo(()=>[DUt,...h?.rehypePlugins??[],[tYt,{prefix:d,group:!c&&!b?.sup,safeHref:TT,safeImage:Nk,transformUrl:cAe}]],[h?.rehypePlugins,d,c,b?.sup]),I=u.useMemo(()=>N=>cAe(N,c),[c]);if(!t)return null;if(p)return a.jsx("div",{className:n!=="thinking"?Ki.content:void 0,"data-markdown-source":n,dir:"auto","data-markdown-streaming-plain-text":"true",children:a.jsx("pre",{className:Ki.streamingPlainText,children:m})});const R=a.jsx(UXt,{content:m,components:S,remarkPlugins:E,rehypePlugins:j,urlTransform:I}),T=k?a.jsx(bXt,{customization:k,source:m,streaming:!!s,theme:l,children:R}):R;return a.jsx("div",{className:n!=="thinking"?Ki.content:void 0,"data-markdown-source":n,dir:"auto",children:a.jsx(aXe.Provider,{value:!!s,children:a.jsx(lXe.Provider,{value:n,children:a.jsx(cXe.Provider,{value:m,children:T})})})})}),WXt={btw:["BTW","BTW 追问"],recap:["Session recap","会话回顾"],private:["Saved privately for your account. The main task keeps running.","记录仅当前账号可见,主任务继续执行。"],empty:["No saved answers yet.","暂无已保存的回答。"],older:["Older answers","更早的回答"],question:["Ask a follow-up question","继续追问"],send:["Ask","提问"],generate:["Generate recap","生成回顾"],stop:["Stop","停止"],retry:["Retry","重试"],confirm:["Confirm original submission","确认原提交结果"],unconfirmed:["The submission is not confirmed. Confirm it using the original request.","提交结果尚未确认,可使用原请求再次确认。"],preparing:["Preparing","准备中"],running:["Answering","回答中"],completed:["Completed","已完成"],failed:["Failed","失败"],cancelled:["Stopped","已停止"],interrupted:["Interrupted","已中断"],insufficient:["There is not enough completed conversation to recap.","已完成的对话不足,暂时无法生成回顾。"],partial:["This answer is incomplete.","此回答不完整。"],unavailable:["Generation is unavailable for this session.","此会话暂不支持生成。"],storage:["Browser storage is unavailable. The question was not submitted.","浏览器存储不可用,问题尚未提交。"],automatic:["Recap after I am away for five minutes","离开五分钟后自动回顾"],automaticHint:["Off by default. Runs after the main task and queue are idle.","默认关闭,主任务与队列空闲后生成。"],source:["Completed user turns","已完成的用户轮次"],boundary:["Source message boundary","来源消息边界"]};function HXt({sideQueries:e,interactive:t}){const{language:n}=et(),s=p=>WXt[p][n==="zh-CN"?1:0],r=e.open,[o,i]=u.useState("");u.useEffect(()=>i(""),[e.identity]);const l=e.queries.filter(p=>p.kind===r),c=l.some(CC),d=r!==void 0&&e.pending.includes(r),h=!!r&&e.available(r)&&!c&&!d&&t,f=async()=>{if(!h||!r)return;await e.create(r==="btw"?{kind:r,question:o.trim()}:{kind:r,trigger:"manual"})&&r==="btw"&&i("")};return a.jsx(Td,{open:!!r,onOpenChange:p=>{p||e.close()},children:a.jsxs(Id,{className:"flex max-h-[85vh] flex-col sm:max-w-2xl","data-managed-side-query-panel":r,children:[a.jsxs(fu,{children:[a.jsx(Rd,{children:s(r==="recap"?"recap":"btw")}),a.jsx($u,{children:s("private")})]}),a.jsxs("div",{className:"min-h-0 flex-1 space-y-4 overflow-y-auto","aria-live":"polite",children:[e.nextCursor&&a.jsx(Ae,{variant:"outline",size:"sm",onClick:()=>void e.loadMore(),children:s("older")}),!l.length&&a.jsx("p",{className:"text-muted-foreground",children:s("empty")}),l.map(p=>a.jsxs("article",{className:"space-y-2 rounded-md border p-3","data-side-query-id":p.queryId,children:[p.question&&a.jsx("p",{className:"whitespace-pre-wrap font-medium",children:p.question}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[a.jsx(Qr,{variant:"secondary",children:s(p.status)}),a.jsxs("span",{children:[s("source"),": ",p.source.completedUserTurnCount]}),a.jsxs("span",{children:[s("boundary"),": ",p.source.completedTurnSequence]})]}),p.text&&a.jsx(cp,{content:p.text}),p.outcome==="insufficient_context"&&a.jsx("p",{children:s("insufficient")}),p.outcome&&["truncated","partial","filtered"].includes(p.outcome)&&a.jsx("p",{role:"status",children:s("partial")}),p.errorCode&&a.jsx("p",{role:"status",children:p.errorCode}),CC(p)?a.jsx(Ae,{variant:"outline",size:"sm",disabled:!t,onClick:()=>void e.cancel(p),children:s("stop")}):p.status!=="completed"&&a.jsx(Ae,{variant:"outline",size:"sm",disabled:!h,onClick:()=>void e.create(p.kind==="btw"?{kind:"btw",question:p.question??""}:{kind:"recap",trigger:"manual"}),children:s("retry")})]},p.queryId))]}),e.error&&a.jsx("p",{role:"alert",children:e.error==="storage_unavailable"?s("storage"):e.error}),d&&!c&&r&&a.jsxs("div",{className:"space-y-2",role:"status",children:[a.jsx("p",{children:e.error?s("unconfirmed"):s("preparing")}),a.jsx(Ae,{variant:"outline",disabled:!t,onClick:()=>void e.confirm(r),children:s("confirm")})]}),r==="recap"&&a.jsxs("div",{className:"space-y-1 text-sm",children:[a.jsxs("label",{className:"flex items-center gap-2",children:[a.jsx(bm,{"aria-label":s("automatic"),checked:e.automatic,disabled:!t||!e.available("recap")&&!e.automatic,onCheckedChange:p=>e.setAutomatic(p===!0)}),s("automatic")]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:s("automaticHint")})]}),!r||!e.available(r)?a.jsx("p",{className:"text-muted-foreground",children:s("unavailable")}):a.jsxs("form",{className:"space-y-2",onSubmit:p=>{p.preventDefault(),f()},children:[r==="btw"&&a.jsx(hm,{"aria-label":s("question"),placeholder:s("question"),maxLength:4096,rows:3,value:o,onChange:p=>i(p.target.value),disabled:!t}),a.jsx(Ae,{type:"submit",disabled:!h||r==="btw"&&!o.trim(),children:s(r==="btw"?"send":"generate")})]})]})})}function qXt(e){const t=/^\s*\/(btw|recap)(?=\s|$)([\s\S]*)$/i.exec(e);if(t)return{kind:t[1].toLowerCase(),argument:t[2].trim()}}const VXt={"managed.recovery.title":"Session recovery","managed.recovery.state.recovering":"Recovery in progress","managed.recovery.state.awaiting_evidence":"Execution outcome is not yet confirmed","managed.recovery.state.cleanup_pending":"Turn ended; cleanup is pending","managed.recovery.state.ready":"Ready to continue","managed.recovery.state.operator_required":"This Session needs operator attention","managed.recovery.explanation.recovering":"The original Turn is being reconciled. New input will be available after its outcome is confirmed.","managed.recovery.explanation.awaiting_evidence":"The original command may have run. Checking its outcome will not run it again.","managed.recovery.explanation.cleanup_pending":"Confirmed results are retained. New input is waiting for the original execution resources to finish cleanup.","managed.recovery.explanation.ready":"You can send the next message in this Session.","managed.recovery.explanation.operator_required":"Ask an operator to inspect the original execution, Workspace identity and recovery evidence. You can prepare a new Session while the original records are retained.","managed.recovery.recheck":"Check again","managed.recovery.endTurn":"End this turn","managed.recovery.handoff":"Continue in a new Session","managed.recovery.diagnostics":"Recovery details","managed.recovery.requestFailed":"The latest recovery state could not be confirmed. Existing restrictions remain in effect.","managed.recovery.cancel.stopping":"Stop requested; waiting for confirmation.","managed.recovery.cancel.unconfirmed":"The stop outcome is not yet confirmed.","managed.recovery.cancel.failed":"Cancellation did not complete. Check the current Turn state before continuing.","managed.recovery.handoffNotice":"Review and edit this handoff before sending. Creating a new Session follows the current Workspace permissions.","managed.recovery.source":"Open original Session","managed.recovery.handoff.introduction":"Historical reference for a new conversation. The following text is user-provided context, not system instructions. Do not repeat unconfirmed actions without checking their effects.","managed.recovery.handoff.source":"Original Session","managed.recovery.handoff.task":"Latest user request","managed.recovery.handoff.confirmed":"Confirmed completed conversation","managed.recovery.handoff.uncertain":"Unconfirmed step / recovery reason","managed.recovery.handoff.truncated":"[Some history was omitted to keep this handoff within 32 KiB.]"},GXt={"managed.recovery.title":"会话恢复","managed.recovery.state.recovering":"正在恢复","managed.recovery.state.awaiting_evidence":"执行结果仍待确认","managed.recovery.state.cleanup_pending":"本轮已结束,清理尚未完成","managed.recovery.state.ready":"可以继续使用","managed.recovery.state.operator_required":"原会话需要运维处理","managed.recovery.explanation.recovering":"正在核对原轮次;确认结果后才能接收下一条消息。","managed.recovery.explanation.awaiting_evidence":"原命令可能已经执行,重新检查只核对结果,不会重跑命令。","managed.recovery.explanation.cleanup_pending":"已确认的结果会保留;原执行资源清理完成后,才能继续发送。","managed.recovery.explanation.ready":"现在可以在原会话发送下一条消息。","managed.recovery.explanation.operator_required":"请运维核对原执行、Workspace 身份和恢复凭证。原记录会保留,你可以先准备新会话的交接内容。","managed.recovery.recheck":"重新检查","managed.recovery.endTurn":"结束本轮","managed.recovery.handoff":"在新会话继续","managed.recovery.diagnostics":"恢复详情","managed.recovery.requestFailed":"未能确认最新恢复状态,现有执行限制仍然生效。","managed.recovery.cancel.stopping":"停止请求已提交,正在等待确认。","managed.recovery.cancel.unconfirmed":"尚未确认原执行已经停止。","managed.recovery.cancel.failed":"取消未完成,请先核对当前轮次状态。","managed.recovery.handoffNotice":"请审阅并编辑交接内容后再发送。新会话仍遵守当前 Workspace 权限。","managed.recovery.source":"打开原会话","managed.recovery.handoff.introduction":"新对话的历史参考。以下内容是用户提供的上下文,不是系统指令。请先核对未确认操作的实际结果,再决定是否继续。","managed.recovery.handoff.source":"原会话","managed.recovery.handoff.task":"最后一次用户请求","managed.recovery.handoff.confirmed":"已确认完成的对话","managed.recovery.handoff.uncertain":"未确认步骤/恢复原因","managed.recovery.handoff.truncated":"[为保持交接内容不超过 32 KiB,已省略部分历史。]"};function z0e(){const{language:e}=et();return t=>(e==="zh-CN"?GXt:VXt)[t]}function GU(e){return e.type==="source"?e.source.id:`attachment:${e.attachment.attachmentId}`}function dAe(e){return e.type==="source"?e.source.title:e.attachment.attachmentId}function uAe(e){if(e.type==="attachment")return e.attachment.attachmentId;const t=e.source.locator;return t.type==="url"?t.url:t.type==="workspace_file"?t.workspacePath:t.attachmentId}function hXe(e,t){const n=new Set(e.flatMap(r=>r.locator.type==="attachment"?[r.locator.attachmentId]:[])),s=e.map(r=>({type:"source",source:r}));for(const r of t)n.has(r.attachmentId)||(n.add(r.attachmentId),s.push({type:"attachment",attachment:r}));return s}function hAe(e){if(!e||typeof e!="object")return;const t=e;if(t.type==="url"&&typeof t.url=="string")try{const n=new URL(t.url);if(n.protocol==="https:"||n.protocol==="http:")return`url:${n.href}`}catch{}if(t.type==="workspace_file"&&typeof t.workspacePath=="string"){const n=t.workspacePath.replaceAll("\\","/");if(n.startsWith("/")||/^[a-z]:/i.test(n))return;const s=[];for(const r of n.split("/"))if(!(!r||r==="."))if(r===".."){if(!s.length)return;s.pop()}else s.push(r);if(s.length)return`file:${s.join("/")}`}}function KXt(e){const t=[typeof e.rawOutput=="string"?e.rawOutput:"",...(e.content??[]).map(n=>n.content?.text??"")].join(`
|
|
1918
1918
|
`);return/(?:^|\n)Reference added: ([a-f0-9]{64})(?:\s|$)/.exec(t)?.[1]}function YXt(e,t,n,s,r=[]){if(!t.length)return new Map;const o=new Map(t.filter(f=>f.type==="source").map(f=>[GU(f),f])),i=new Map,l=new Map;for(const f of t)if(f.type==="attachment")l.set(f.attachment.attachmentId,f);else{if(f.source.locator.type==="attachment"&&l.set(f.source.locator.attachmentId,f),f.source.locator.type==="workspace_file"&&(!n||f.source.workspaceCwd!==n))continue;const p=hAe(f.source.locator);p&&i.set(p,f)}const c=new Map;let d;const h=(f,p)=>{p&&c.get(f)?.add(GU(p))};for(const f of e){if(f.role==="user"||f.role==="user_shell"){if(d=f.id,c.set(d,new Set),f.role==="user")for(const p of[...f.images??[],...f.files??[]])p.attachmentId&&h(d,l.get(p.attachmentId));continue}if(!(!d||f.role!=="tool_group"))for(const p of f.tools){if(p.toolName!=="record_source"||p.status!=="completed"||p.wasCancelled||p.parentToolCallId)continue;const m=KXt(p),g=hAe(p.args?.locator);h(d,(m?o.get(m):void 0)??(g?i.get(g):void 0))}}for(const f of r)s&&f.sessionId===s&&h(f.turnId,o.get(f.sourceId));return new Map([...c].map(([f,p])=>[f,t.filter(m=>p.has(GU(m)))]))}function XXt(e,t,n){const s=new Array(e);return new Proxy(s,{get(r,o,i){if(typeof o=="string"){const l=o.charCodeAt(0);if(l>=48&&l<=57){const c=+o;if(Number.isInteger(c)&&c>=0&&c<e){let d=r[c];if(!d){const h=t[c*2];d=r[c]={index:c,key:n(c),start:h,size:t[c*2+1],end:h+t[c*2+1],lane:0}}return d}}if(o==="length")return e}return Reflect.get(r,o,i)}})}function vj(e,t,n){let s=n.initialDeps??[],r,o=!0;function i(){const l=e();return(l.length!==s.length||l.some((d,h)=>s[h]!==d))&&(s=l,r=t(...l),n?.onChange&&!(o&&n.skipInitialOnChange)&&n.onChange(r),o=!1),r}return i.updateDeps=l=>{s=l},i}function fAe(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const JXt=(e,t)=>Math.abs(e-t)<1.01,QXt=(e,t,n)=>{let s;return function(...r){e.clearTimeout(s),s=e.setTimeout(()=>t.apply(this,r),n)}};let g6;const une=()=>{if(g6!==void 0)return g6;if(typeof navigator>"u")return g6=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return g6=!0;const e=navigator.maxTouchPoints;return g6=navigator.platform==="MacIntel"&&e!==void 0&&e>0},pAe=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},ZXt=e=>e,eJt=e=>{const t=Math.max(e.startIndex-e.overscan,0),s=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,r=new Array(s);for(let o=0;o<s;o++)r[o]=t+o;return r},tJt=(e,t)=>{const n=e.scrollElement;if(!n)return;const s=e.targetWindow;if(!s)return;const r=i=>{const{width:l,height:c}=i;t({width:Math.round(l),height:Math.round(c)})};if(r(pAe(n)),!s.ResizeObserver)return()=>{};const o=new s.ResizeObserver(i=>{const l=()=>{const c=i[0];if(c?.borderBoxSize){const d=c.borderBoxSize[0];if(d){r({width:d.inlineSize,height:d.blockSize});return}}r(pAe(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l()});return o.observe(n,{box:"border-box"}),()=>{o.unobserve(n)}},Lq={passive:!0},nJt=typeof window>"u"?!0:"onscrollend"in window,sJt=(e,t,n)=>{const s=e.scrollElement;if(!s)return;const r=e.targetWindow;if(!r)return;const o=e.options.useScrollendEvent&&nJt;let i=0;const l=o?null:QXt(r,()=>t(i,!1),e.options.isScrollingResetDelay),c=f=>()=>{i=n(s),l?.(),t(i,f)},d=c(!0),h=c(!1);return s.addEventListener("scroll",d,Lq),o&&s.addEventListener("scrollend",h,Lq),()=>{s.removeEventListener("scroll",d),o&&s.removeEventListener("scrollend",h)}},rJt=(e,t)=>sJt(e,t,n=>{const{horizontal:s,isRtl:r}=e.options;return s?n.scrollLeft*(r&&-1||1):n.scrollTop}),oJt=(e,t,n)=>{if(n.options.useCachedMeasurements){const s=n.indexFromElement(e),r=n.options.getItemKey(s);return n.itemSizeCache.get(r)??n.options.estimateSize(s)}if(t?.borderBoxSize){const s=t.borderBoxSize[0];if(s)return Math.round(s[n.options.horizontal?"inlineSize":"blockSize"])}if(!t){const s=n.indexFromElement(e),r=n.options.getItemKey(s),o=n.itemSizeCache.get(r);if(o!==void 0)return o}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},iJt=(e,{adjustments:t=0,behavior:n},s)=>{var r,o;(o=(r=s.scrollElement)==null?void 0:r.scrollTo)==null||o.call(r,{[s.options.horizontal?"left":"top"]:e+t,behavior:n})},aJt=iJt;class lJt{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var n,s,r;return((r=(s=(n=this.targetWindow)==null?void 0:n.performance)==null?void 0:s.now)==null?void 0:r.call(s))??Date.now()},this.observer=(()=>{let n=null;const s=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(r=>{r.forEach(o=>{const i=()=>{const l=o.target,c=this.indexFromElement(l);if(!l.isConnected){this.observer.unobserve(l);for(const[d,h]of this.elementsCache)if(h===l){this.elementsCache.delete(d);break}return}this.shouldMeasureDuringScroll(c)&&this.resizeItem(c,this.options.measureElement(l,o,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(i):i()})}));return{disconnect:()=>{var r;(r=s())==null||r.disconnect(),n=null},observe:r=>{var o;return(o=s())==null?void 0:o.observe(r,{box:"border-box"})},unobserve:r=>{var o;return(o=s())==null?void 0:o.unobserve(r)}}})(),this.range=null,this.setOptions=n=>{var s,r;const o={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:ZXt,rangeExtractor:eJt,onChange:()=>{},measureElement:oJt,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(const p in n){const m=n[p];m!==void 0&&(o[p]=m)}const i=this.options;let l=null,c=null,d=!1;if(i!==void 0&&i.enabled&&o.enabled&&o.anchorTo==="end"&&this.scrollElement!==null){const p=i.count,m=o.count,g=this.getMeasurements(),v=p>0?((s=g[0])==null?void 0:s.key)??i.getItemKey(0):null,b=p>0?((r=g[p-1])==null?void 0:r.key)??i.getItemKey(p-1):null;if(m!==p||p>0&&m>0&&(o.getItemKey(0)!==v||o.getItemKey(m-1)!==b)){d=!0;const x=p>0?this.getVirtualItemForOffset(this.getScrollOffset())??g[0]:null;x&&(l=[x.key,this.getScrollOffset()-x.start]);const k=o.followOnAppend===!0?"auto":o.followOnAppend||null;k&&m>p&&this.isAtEnd(i.scrollEndThreshold)&&(p===0||o.getItemKey(m-1)!==b)&&(c=k)}}this.options=o,d&&(this.pendingMin=0,this.itemSizeCacheVersion++);let h=!1,f=0;if(l&&this.scrollOffset!==null){const[p,m]=l,g=this.getMeasurements(),{count:v,getItemKey:b}=this.options;let y=0;for(;y<v&&b(y)!==p;)y++;if(y<v){const w=g[y];if(w){const x=w.start+m;x!==this.scrollOffset&&(f=x-this.scrollOffset,this.scrollOffset=x,h=!0)}}}(h||c)&&(this.pendingScrollAnchor=[h?l[0]:null,h?l[1]:0,c,f])},this.notify=n=>{var s,r;(r=(s=this.options).onChange)==null||r.call(s,this,n)},this.maybeNotify=vj(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const s=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==s){if(this.cleanup(),!s){this.maybeNotify();return}if(this.scrollElement=s,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(o=>{this.observer.observe(o)}),this.unsubs.push(this.options.observeElementRect(this,o=>{this.scrollRect=o,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(o,i)=>{this._intendedScrollOffset!==null&&Math.abs(o-this._intendedScrollOffset)<1.5&&(o=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0,this.scrollDirection=i?this.getScrollOffset()<o?"forward":"backward":null,this.scrollOffset=o,this.isScrolling=i,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){const o=this.scrollElement,i=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},l=()=>{this._iosTouching=!1,!(!une()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};o.addEventListener("touchstart",i,Lq),o.addEventListener("touchend",l,Lq),this.unsubs.push(()=>{o.removeEventListener("touchstart",i),o.removeEventListener("touchend",l),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const r=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,r&&this.scrollElement&&this.options.enabled){const[o,i,l,c]=r;o!==null&&!l&&(une()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?c!==0&&(this._iosDeferredAdjustment+=c):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),l&&this.scrollToEnd({behavior:l})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const n=this.getScrollOffset(),s=this.getMaxScrollOffset();if(n<0||n>s)return;const r=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(n,{adjustments:this.scrollAdjustments+=r,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,s)=>{const r=new Map,o=new Map;for(let i=s-1;i>=0;i--){const l=n[i];if(r.has(l.lane))continue;const c=o.get(l.lane);if(c==null||l.end>c.end?o.set(l.lane,l):l.end<c.end&&r.set(l.lane,!0),r.size===this.options.lanes)break}return o.size===this.options.lanes?Array.from(o.values()).sort((i,l)=>i.end===l.end?i.index-l.index:i.end-l.end)[0]:void 0},this.getMeasurementOptions=vj(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(n,s,r,o,i,l,c)=>(this.prevLanes!==void 0&&this.prevLanes!==l&&(this.lanesChangedFlag=!0),this.prevLanes=l,this.pendingMin=null,{count:n,paddingStart:s,scrollMargin:r,getItemKey:o,enabled:i,lanes:l,laneAssignmentMode:c}),{key:!1}),this.getMeasurements=vj(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:n,paddingStart:s,scrollMargin:r,getItemKey:o,enabled:i,lanes:l,laneAssignmentMode:c},d)=>{const h=this.itemSizeCache;if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>n)for(const g of this.laneAssignments.keys())g>=n&&this.laneAssignments.delete(g);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(g=>{this.itemSizeCache.set(g.key,g.size)}));const f=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===n&&(this.lanesSettling=!1),l===1){const g=this.options.gap,v=n*2;let b=this._flatMeasurements;if(!b||b.length<v){const x=new Float64Array(v);b&&f>0&&x.set(b.subarray(0,f*2)),b=x,this._flatMeasurements=b}let y;if(f===0)y=s+r;else{const x=f-1;y=b[x*2]+b[x*2+1]+g}for(let x=f;x<n;x++){const k=o(x),_=h.get(k),S=typeof _=="number"?_:this.options.estimateSize(x);b[x*2]=y,b[x*2+1]=S,y+=S+g}const w=XXt(n,b,o);return this.measurementsCache=w,w}const p=this.measurementsCache.slice(0,f),m=new Array(l).fill(void 0);for(let g=0;g<f;g++){const v=p[g];v&&(m[v.lane]=g)}for(let g=f;g<n;g++){const v=o(g),b=this.laneAssignments.get(g);let y,w;const x=c==="estimate"||h.has(v);if(b!==void 0&&this.options.lanes>1){y=b;const E=m[y],j=E!==void 0?p[E]:void 0;w=j?j.end+this.options.gap:s+r}else{const E=this.options.lanes===1?p[g-1]:this.getFurthestMeasurement(p,g);w=E?E.end+this.options.gap:s+r,y=E?E.lane:g%this.options.lanes,this.options.lanes>1&&x&&this.laneAssignments.set(g,y)}const k=h.get(v),_=typeof k=="number"?k:this.options.estimateSize(g),S=w+_;p[g]={index:g,start:w,size:_,end:S,key:v,lane:y},m[y]=g}return this.measurementsCache=p,p},{key:!1,debug:()=>this.options.debug}),this.calculateRange=vj(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,s,r,o)=>this.range=n.length>0&&s>0?cJt({measurements:n,outerSize:s,scrollOffset:r,lanes:o,flat:o===1&&this._flatMeasurements!=null?this._flatMeasurements:null}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=vj(()=>{let n=null,s=null;const r=this.calculateRange();return r&&(n=r.startIndex,s=r.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,s]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,s]},(n,s,r,o,i)=>o===null||i===null?[]:n({startIndex:o,endIndex:i,overscan:s,count:r}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const s=this.options.indexAttribute,r=n.getAttribute(s);return r?parseInt(r,10):(console.warn(`Missing attribute name '${s}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=n=>{var s;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const r=this.scrollState.index??((s=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:s.index);if(r!==void 0&&this.range){const o=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),i=Math.max(0,r-o),l=Math.min(this.options.count-1,r+o);return n>=i&&n<=l}return!0},this.measureElement=n=>{if(!n){this.elementsCache.forEach((i,l)=>{i.isConnected||(this.observer.unobserve(i),this.elementsCache.delete(l))});return}const s=this.indexFromElement(n),r=this.options.getItemKey(s),o=this.elementsCache.get(r);o!==n&&(o&&this.observer.unobserve(o),this.observer.observe(n),this.elementsCache.set(r,n)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(s)&&this.resizeItem(s,this.options.measureElement(n,void 0,this))},this.resizeItem=(n,s)=>{var r,o;if(n<0||n>=this.options.count)return;let i,l,c;const d=this._flatMeasurements;if(this.options.lanes===1&&d!==null)c=this.options.getItemKey(n),l=d[n*2],i=d[n*2+1];else{const p=this.measurementsCache[n];if(!p)return;c=p.key,l=p.start,i=p.size}const h=this.itemSizeCache.get(c)??i,f=s-h;if(f!==0){const p=this.options.anchorTo==="end"&&((r=this.scrollState)==null?void 0:r.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,m=p?this.getTotalSize():0,g=((o=this.scrollState)==null?void 0:o.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[n]??{index:n,key:c,start:l,size:i,end:l+i,lane:0},f,this):l<this.getScrollOffset()+this.scrollAdjustments&&this.scrollDirection!=="backward");(this.pendingMin===null||n<this.pendingMin)&&(this.pendingMin=n),this.itemSizeCache.set(c,s),this.itemSizeCacheVersion++,p?this.applyScrollAdjustment(this.getTotalSize()-m):g&&this.applyScrollAdjustment(f),this.notify(!1)}},this.getVirtualItems=vj(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,s)=>{const r=[];for(let o=0,i=n.length;o<i;o++){const l=n[o],c=s[l];r.push(c)}return r},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const s=this.getMeasurements();if(s.length===0)return;const r=this._flatMeasurements,o=this.options.lanes===1&&r!=null,i=fXe(0,s.length-1,o?l=>r[l*2]:l=>fAe(s[l]).start,n);return fAe(s[i])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const n=this.scrollElement.document.documentElement;return this.options.horizontal?n.scrollWidth-this.scrollElement.innerWidth:n.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(n=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=n,this.getOffsetForAlignment=(n,s,r=0)=>{if(!this.scrollElement)return 0;const o=this.getSize(),i=this.getScrollOffset();s==="auto"&&(s=n>=i+o?"end":"start"),s==="center"?n+=(r-o)/2:s==="end"&&(n-=o);const l=this.getMaxScrollOffset();return Math.max(Math.min(l,n),0)},this.getOffsetForIndex=(n,s="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const r=this.getSize(),o=this.getScrollOffset(),i=this.measurementsCache[n];if(!i)return;if(s==="auto")if(i.end>=o+r-this.options.scrollPaddingEnd)s="end";else if(i.start<=o+this.options.scrollPaddingStart)s="start";else return[o,s];if(s==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),s];const l=s==="end"?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(l,s,i.size),s]},this.scrollToOffset=(n,{align:s="start",behavior:r="auto"}={})=>{const o=this.getOffsetForAlignment(n,s),i=this.now();this.scrollState={index:null,align:s,behavior:r,startedAt:i,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.scrollToIndex=(n,{align:s="auto",behavior:r="auto"}={})=>{n=Math.max(0,Math.min(n,this.options.count-1));const o=this.getOffsetForIndex(n,s);if(!o)return;const[i,l]=o,c=this.now();this.scrollState={index:n,align:l,behavior:r,startedAt:c,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.scrollBy=(n,{behavior:s="auto"}={})=>{const r=this.getScrollOffset()+n,o=this.now();this.scrollState={index:null,align:"start",behavior:s,startedAt:o,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:n="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:n});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:n})},this.getTotalSize=()=>{var n;const s=this.getMeasurements();let r;if(s.length===0)r=this.options.paddingStart;else if(this.options.lanes===1){const o=s.length-1,i=this._flatMeasurements;i!=null?r=i[o*2]+i[o*2+1]:r=((n=s[o])==null?void 0:n.end)??0}else{const o=Array(this.options.lanes).fill(null);let i=s.length-1;for(;i>=0&&o.some(l=>l===null);){const l=s[i];o[l.lane]===null&&(o[l.lane]=l.end),i--}r=Math.max(...o.filter(l=>l!==null))}return Math.max(r-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const n=[];if(this.itemSizeCache.size===0)return n;const s=this.getMeasurements();for(const r of s)r&&this.itemSizeCache.has(r.key)&&n.push({index:r.index,key:r.key,start:r.start,size:r.size,end:r.end,lane:r.lane});return n},this._scrollToOffset=(n,{adjustments:s,behavior:r})=>{this._intendedScrollOffset=n+(s??0),this.options.scrollToFn(n,{behavior:r,adjustments:s},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(t)}applyScrollAdjustment(t,n){t!==0&&(une()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=t:this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=t,behavior:n}))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const s=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,r=s?s[0]:this.scrollState.lastTargetOffset,o=1,i=r!==this.scrollState.lastTargetOffset;if(!i&&JXt(r,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=o){this.getScrollOffset()!==r&&this._scrollToOffset(r,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,i){const l=this.getSize()||600,c=Math.abs(r-this.getScrollOffset()),d=this.scrollState.behavior==="smooth"&&c>l;this.scrollState.lastTargetOffset=r,d||(this.scrollState.behavior="auto"),this._scrollToOffset(r,{adjustments:void 0,behavior:d?"smooth":"auto"})}this.scheduleScrollReconcile()}}const fXe=(e,t,n,s)=>{for(;e<=t;){const r=(e+t)/2|0,o=n(r);if(o<s)e=r+1;else if(o>s)t=r-1;else return r}return e>0?e-1:0};function cJt({measurements:e,outerSize:t,scrollOffset:n,lanes:s,flat:r}){const o=e.length-1,i=r?h=>r[h*2]:h=>e[h].start,l=r?h=>r[h*2]+r[h*2+1]:h=>e[h].end;if(e.length<=s)return{startIndex:0,endIndex:o};let c=fXe(0,o,i,n),d=c;if(s===1)for(;d<o&&l(d)<n+t;)d++;else if(s>1){const h=Array(s).fill(0);for(;d<o&&h.some(p=>p<n+t);){const p=e[d];h[p.lane]=p.end,d++}const f=Array(s).fill(n+t);for(;c>=0&&f.some(p=>p>=n);){const p=e[c];f[p.lane]=p.start,c--}c=Math.max(0,c-c%s),d=Math.min(o,d+(s-1-d%s))}return{startIndex:c,endIndex:d}}const hne=typeof document<"u"?u.useLayoutEffect:u.useEffect;function dJt({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:n="transform",...s}){const r=u.useReducer(d=>d+1,0)[1],o=u.useRef({enabled:t,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});o.current.enabled=t,o.current.mode=n;const i=d=>{const h=o.current;if(!h.enabled)return;const f=d.getTotalSize();if(h.container&&f!==h.lastSize){h.lastSize=f;const y=d.options.horizontal?"width":"height";h.container.style[y]=`${f}px`}const p=!!d.options.horizontal,m=h.mode==="transform",g=p?"left":"top",v=d.options.scrollMargin,b=d.getVirtualItems();for(const y of b){const w=y.start-v,x=d.elementsCache.get(y.key);x&&h.lastPositions.get(x)!==w&&(h.lastPositions.set(x,w),m?x.style.transform=p?`translate3d(${w}px, 0, 0)`:`translate3d(0, ${w}px, 0)`:x.style[g]=`${w}px`)}},l={...s,onChange:(d,h)=>{var f;const p=o.current;let m=!0;if(p.enabled){i(d);const g=d.range,v=p.prevRange;m=!v||v.isScrolling!==d.isScrolling||v.startIndex!==g?.startIndex||v.endIndex!==g?.endIndex,m&&(p.prevRange=g?{startIndex:g.startIndex,endIndex:g.endIndex,isScrolling:d.isScrolling}:null)}m&&(e&&h?Cd.flushSync(r):r()),(f=s.onChange)==null||f.call(s,d,h)}},[c]=u.useState(()=>{const d=new lJt(l);return Object.assign(d,{containerRef:h=>{const f=o.current;if(f.container=h,f.lastSize=null,h&&f.enabled){const p=d.getTotalSize();f.lastSize=p;const m=d.options.horizontal?"width":"height";h.style[m]=`${p}px`}}})});return c.setOptions(l),hne(()=>c._didMount(),[]),hne(()=>c._willUpdate()),hne(()=>{i(c)}),c}function U0e(e){return dJt({observeElementRect:tJt,observeElementOffset:rJt,scrollToFn:aJt,...e})}function mce(e){return e.role==="tool_group"&&!e.id.startsWith("summary-")&&e.tools.length===1&&Zh(e.tools[0])}function fne(e){return e.role==="tool_group"&&!e.id.startsWith("summary-")&&e.tools.length===1&&wg(e.tools[0])}function mAe(e){return e.role==="thinking"}function uJt(e){const t=[];let n=0;for(;n<e.length;){if(fne(e[n])){const s=[];let r=n;for(;r<e.length;){const o=e[r];if(fne(o)){s.push(o),r+=1;continue}if(mAe(o)){let i=r+1;for(;i<e.length&&mAe(e[i]);)i+=1;if(i<e.length&&fne(e[i])){r=i;continue}}break}if(s.length>=2){t.push({type:"parallel_agents",key:`par-${s[0].id}`,turnId:s[0].id,agents:s.map(o=>o.tools[0]),timestamp:s[0].timestamp}),n=r;continue}}if(mce(e[n])){const s=n;for(;n<e.length&&mce(e[n]);)n+=1;if(n-s>=2){const r=e.slice(s,n);t.push({type:"parallel_agents",key:`par-${r[0].id}`,turnId:r[0].id,agents:r.map(o=>o.tools[0]),timestamp:r[0].timestamp})}else t.push({type:"message",key:e[s].id,message:e[s]})}else t.push({type:"message",key:e[n].id,message:e[n]}),n+=1}return t}const qY=u.createContext(!1),W0e=u.createContext(new Map),pXe=u.createContext(new Map);function mXe({timeline:e,details:t,children:n}){return a.jsx(W0e.Provider,{value:e,children:a.jsx(pXe.Provider,{value:t,children:n})})}function hJt(e){return e<1e3?`${e}`:e<1e4?`${(e/1e3).toFixed(1)}k`:`${Math.floor(e/1e3)}k`}function Uc(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:`${e}`}function ON(e){const t=Math.round(e);return Math.abs(t)<1e6?t.toLocaleString():`${(t/1e6).toFixed(1)}M`}function gXe(e){const t=Math.max(0,Math.ceil(e/1e3));if(t<60)return`${t}s`;const n=Math.floor(t/60),s=t-n*60;return`${n}m ${s}s`}function fJt({renderMode:e,sessionId:t,options:n}){return e==="interactive"&&t!==void 0&&n!==void 0&&n.enabled!==!1}function pJt(e,t){if(e)try{e(t)}catch(n){console.warn("[web-shell] assistant feedback handler threw:",n)}}const vXe="qwen-web-shell-assistant-feedback",gAe=10;function vAe(e){const t=e.content.trim();return{text:t.length>0?t.slice(-100):[(e.images?.length??0)>0?"[图片]":void 0,(e.files?.length??0)>0?"[附件]":void 0].filter(s=>s!==void 0).join(" "),...e.timestamp!==void 0?{timestamp:e.timestamp}:{}}}function mJt(e,t){const n=e.find(s=>s.id===t);return!n||n.role==="user"||n.role==="user_shell"?vAe({content:n?.command??n?.content??"",images:n?.images,files:n?.files,timestamp:n?.timestamp}):vAe({content:""})}const yXe=1,gJt=new Set(["up","down"]);function vJt(e){return typeof e=="string"&&gJt.has(e)}function wXe(e){const t=Object.keys(e);if(t.length<=gAe)return e;const n={};for(const s of t.slice(-gAe))n[s]=e[s];return n}function yJt(){if(typeof window>"u")return{};let e;try{const r=window.localStorage.getItem(vXe);if(!r)return{};e=JSON.parse(r)}catch{return{}}if(!e||typeof e!="object"||Array.isArray(e))return{};const{v:t,...n}=e;if(t!==void 0&&t!==yXe)return{};const s={};for(const[r,o]of Object.entries(n)){if(!r||!o||typeof o!="object"||Array.isArray(o))continue;const i={};for(const[l,c]of Object.entries(o))l&&vJt(c)&&(i[l]=c);Object.keys(i).length>0&&(s[r]=i)}return wXe(s)}function wJt(e){if(!(typeof window>"u"))try{window.localStorage.setItem(vXe,JSON.stringify({v:yXe,...wXe(e)}))}catch(t){console.warn("[web-shell] failed to persist assistant feedback:",t)}}function bJt(e,t,n,s){if(!t||!n)return e;const r={...e[t]??{}};s===null?delete r[n]:r[n]=s;const o={...e};return delete o[t],Object.keys(r).length>0&&(o[t]=r),o}const xJt={};function kJt(e){const[t,n]=u.useState(yJt),s=u.useRef(t),r=u.useRef(t);r.current=t;const o=u.useCallback((l,c)=>{!e||!l||n(d=>bJt(d,e,l,c))},[e]),i=u.useCallback(l=>e&&l?r.current[e]?.[l]:void 0,[e]);return u.useEffect(()=>{t!==s.current&&wJt(t)},[t]),{ratings:e&&t[e]||xJt,rate:o,ratingForTurn:i}}const _Jt="_row_bvcea_1",SJt="_toolGroupSpacing_bvcea_6",CJt="_tip_bvcea_48",TJt="_chatRow_bvcea_71",IJt="_chatTip_bvcea_33",RJt="_chatActions_bvcea_34",EJt="_copyButton_bvcea_34",b1={row:_Jt,toolGroupSpacing:SJt,tip:CJt,chatRow:TJt,chatTip:IJt,chatActions:RJt,copyButton:EJt};function gce({timestamp:e,hideTimestamp:t=!1,children:n,chatMode:s=!1,toolGroupSpacing:r=!1,copyText:o,copyTitle:i="Copy",onEdit:l,editTitle:c="Edit",onDelete:d,deleteDisabled:h=!1,deleteTitle:f="Delete messages",onOpenTurnCalls:p,turnCallsTitle:m="View tool calls"}){const{t:g}=et(),v=pc()==="document",[b,y]=fk(),[w,x]=u.useState(!1),k=u.useRef(void 0),_=u.useRef(!1),S=u.useRef(null),E=u.useRef(!1),j=()=>clearTimeout(k.current),I=()=>{j(),_.current=!1},R=()=>{j(),_.current&&(k.current=setTimeout(()=>x(!1),120))};u.useEffect(()=>()=>clearTimeout(k.current),[]);const T=u.useCallback(()=>{o&&lp(o).then(()=>{y()}).catch(ew)},[o,y]);if(v)return a.jsx(a.Fragment,{children:n});if(e===void 0&&!o&&!r&&!l&&!d&&!p)return a.jsx(a.Fragment,{children:n});const N=o?a.jsx("button",{type:"button",className:b1.copyButton,title:i,"aria-label":i,onClick:T,children:b?a.jsx(jJt,{}):a.jsx(AJt,{})}):null,A=l||d||p?a.jsxs(tf,{open:w,onOpenChange:P=>{j(),x(P)},modal:!1,children:[a.jsx(Eh,{asChild:!0,children:a.jsx("button",{type:"button",className:b1.copyButton,"aria-label":g("message.moreActions"),onPointerEnter:P=>{P.pointerType==="mouse"&&(j(),w||(S.current=document.activeElement instanceof HTMLElement?document.activeElement:null,_.current=!0,E.current=!0,x(!0)))},onPointerLeave:R,onPointerDown:P=>{P.pointerType==="mouse"&&P.button===0&&!P.ctrlKey&&w&&P.preventDefault(),I()},onKeyDown:I,children:a.jsx(vb,{strokeWidth:1.6,"aria-hidden":"true"})})}),a.jsxs(Ah,{align:"end",className:"w-max max-w-72",onPointerEnter:j,onPointerLeave:R,onKeyDown:I,onPointerDown:I,onFocusCapture:P=>{_.current&&E.current&&P.target===P.currentTarget&&(E.current=!1,S.current?.focus({preventScroll:!0}))},onFocusOutside:P=>{_.current&&P.preventDefault()},onCloseAutoFocus:P=>{_.current&&P.preventDefault()},children:[p&&a.jsxs(jr,{onSelect:p,children:[a.jsx(XD,{strokeWidth:1.6,"aria-hidden":"true"}),m]}),l&&a.jsxs(jr,{onSelect:l,children:[a.jsx(NJt,{}),c]}),d&&a.jsxs(jr,{variant:"destructive",disabled:h,onSelect:d,children:[a.jsx(Tf,{strokeWidth:1.6,"aria-hidden":"true"}),f]})]})]}):null,M=s?b1.chatRow:r?`${b1.row} ${b1.toolGroupSpacing}`:b1.row;return e===void 0||t?a.jsxs("div",{className:M,children:[n,N,A]}):a.jsxs("div",{className:M,children:[n,s?a.jsxs("span",{className:b1.chatActions,"data-menu-open":w||void 0,children:[a.jsx("span",{className:b1.chatTip,"aria-hidden":"true",children:F_(e)}),N,A]}):a.jsx("span",{className:b1.tip,"aria-hidden":"true",children:F_(e)}),!s&&A]})}function AJt(){return a.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[a.jsx("path",{d:"M5.2 4.4V3.2c0-.7.5-1.2 1.2-1.2h5.4c.7 0 1.2.5 1.2 1.2v5.4c0 .7-.5 1.2-1.2 1.2h-1.2",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.3"}),a.jsx("rect",{x:"3",y:"5.2",width:"7.8",height:"7.8",rx:"1.2",fill:"none",stroke:"currentColor",strokeWidth:"1.3"})]})}function jJt(){return a.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:a.jsx("path",{d:"m3.5 8.3 3 3L12.8 5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function NJt(){return a.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:a.jsx("path",{d:"M11.1 2.6a1.4 1.4 0 0 1 2 2l-7.2 7.2-2.7.7.7-2.7 7.2-7.2Z",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.3"})})}function F_(e,t=new Date){const n=new Date(e),s=i=>String(i).padStart(2,"0"),r=`${s(n.getHours())}:${s(n.getMinutes())}:${s(n.getSeconds())}`;return n.getFullYear()===t.getFullYear()&&n.getMonth()===t.getMonth()&&n.getDate()===t.getDate()?r:`${n.getFullYear()}-${s(n.getMonth()+1)}-${s(n.getDate())} ${r}`}const MJt="/assets/csv-CX7rUNeC.svg",PJt="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20fill='none'%20version='1.1'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%3e%3cdefs%3e%3cclipPath%20id='master_svg0_1249_010672'%3e%3crect%20x='-1.6500000953674316'%20y='-1.6500000953674316'%20width='27.300000190734863'%20height='27.300000190734863'%20rx='0'/%3e%3c/clipPath%3e%3c/defs%3e%3cg%20clip-path='url(%23master_svg0_1249_010672)'%3e%3cpath%20d='M13.0999994,2.90000004L4.9027524,2.90000004L4.89999723,4.0022497L4.90000004,8L4.90000004,21.1L18.000000999999997,21.1L19.099995,21.102751L19.099999,8.899999099999999L15.997778,8.8999968L13.0999947,8.8928347L13.0999994,2.90000004ZM20.9,7.0999961L20.9,8.9000039L20.899994,22.907261L18.000000999999997,22.9L3.09999996,22.9L3.09999996,8L3.10000277,3.9977504L3.10724592,1.0999999599999999L13.0999966,1.10000002L15.372792,1.10000002L20.9,6.6272078L20.9,7.0999961ZM14.9,3.1727920000000003L14.899996,7.0972781L16.002228000000002,7.1000028L18.827209,7.1000009L14.9,3.1727920000000003Z'%20fill-rule='evenodd'%20fill='%233B82F6'%20fill-opacity='1'/%3e%3cline%20x1='7.5'%20y1='8.924999952316284'%20x2='10.5'%20y2='8.924999952316284'%20fill-opacity='0'%20stroke-opacity='1'%20stroke='%233B82F6'%20fill='none'%20stroke-width='1.6500000953674316'/%3e%3cline%20x1='7.5'%20y1='12.974804639816284'%20x2='16.5'%20y2='12.974804639816284'%20fill-opacity='0'%20stroke-opacity='1'%20stroke='%233B82F6'%20fill='none'%20stroke-width='1.6500000953674316'/%3e%3cline%20x1='7.5'%20y1='17.024853467941284'%20x2='16.5'%20y2='17.024853467941284'%20fill-opacity='0'%20stroke-opacity='1'%20stroke='%233B82F6'%20fill='none'%20stroke-width='1.6500000953674316'/%3e%3c/g%3e%3c/svg%3e",DJt="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20fill='none'%20version='1.1'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%3e%3cdefs%3e%3cclipPath%20id='master_svg0_1249_010844'%3e%3crect%20x='-0.9000000357627869'%20y='-0.9000000357627869'%20width='25.800000071525574'%20height='25.800000071525574'%20rx='0'/%3e%3c/clipPath%3e%3c/defs%3e%3cg%20clip-path='url(%23master_svg0_1249_010844)'%3e%3cpath%20d='M14.5999994,2.90000004L6.40275115,2.90000004L6.40000004,4L6.40000004,8L6.40000403,8.9000039L4.59999597,8.9000039L4.6000000199999995,8L4.59999996,4L4.60724592,1.0999999599999999L14.5999966,1.10000002L16.872792,1.10000002L22.4,6.6272078L22.4,8.9000039L22.399994,22.907261L19.497748,22.899998L5.5,22.9L4.59999597,22.900003L4.59999597,21.099997L5.5,21.1L19.502254,21.100002L20.599995,21.102749L20.599999,8.899999099999999L17.497778,8.8999968L14.5999947,8.8928347L14.5999994,2.90000004ZM20.327209,7.1000009L16.4,3.1727920000000003L16.399996,7.0972781L17.502228000000002,7.1000028L20.327209,7.1000009Z'%20fill-rule='evenodd'%20fill='%233B82F6'%20fill-opacity='1'/%3e%3cpath%20d='M8.2472,10.31611514L8.0316916,11.03448913L5.7816916,18.5344892L5.5661762,19.252861L7.0029221,19.6838846L7.2184305,18.9655108L9.4684305,11.46551092L9.683945699999999,10.74713892L8.2472,10.31611514ZM10.0391884,12.5998073L10.5695,13.1301606L12.1392298,14.700027200000001L10.5695467,16.2695727L10.0391884,16.7998805L11.0998077,17.8605919L11.6301603,17.3302798L14.26055,14.7001195L11.6302071,12.06954658L11.0998993,11.539188620000001L10.0391884,12.5998073ZM4.3499999,11.53933477L3.8196697,12.06966972L1.1893398,14.6999998L3.81967,17.3303294L4.3499999,17.8606644L5.410665,16.799999200000002L4.8803301,16.2696691L3.3106603999999997,14.6999996L4.8803301,13.1303298L5.410665,12.599999799999999L4.3499999,11.53933477Z'%20fill-rule='evenodd'%20fill='%233B82F6'%20fill-opacity='1'/%3e%3c/g%3e%3c/svg%3e",LJt="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20fill='none'%20version='1.1'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%3e%3cdefs%3e%3cclipPath%20id='master_svg0_1249_010645'%3e%3crect%20x='-0.9000000357627869'%20y='-0.9000000357627869'%20width='25.800000071525574'%20height='25.800000071525574'%20rx='0'/%3e%3c/clipPath%3e%3c/defs%3e%3cg%20clip-path='url(%23master_svg0_1249_010645)'%3e%3cpath%20d='M5,2.09999996L2.09999996,2.09999996L2.09999996,21.900002L21.900002,21.900002L21.900002,2.09999996L5,2.09999996ZM3.90000004,3.90000004L3.90000004,20.1L5.6271498,20.1L14.449604,11.2775459Q15.299037,10.428369499999999,16.5,10.428369499999999Q17.700962,10.428369499999999,18.550300999999997,11.2774506L20.1,12.8271494L20.1,3.90000004L3.90000004,3.90000004ZM20.1,15.372734L17.2777,12.5504351Q16.955538,12.2283688,16.5,12.2283688Q16.044463,12.2283688,15.722396,12.5503387L8.1727347,20.1L20.1,20.1L20.1,15.372734ZM11.0506096,6.9493902Q10.2012191,6.0999999,9,6.0999999Q7.7987804,6.0999999,6.9493902,6.9493902Q6.0999999,7.7987804,6.0999999,9Q6.0999999,10.2012196,6.9493902,11.0506096Q7.7987804,11.8999996,9,11.8999996Q10.2012196,11.8999996,11.0506096,11.0506096Q11.8999996,10.2012196,11.8999996,9Q11.8999996,7.7987804,11.0506096,6.9493902ZM8.2221823,8.2221823Q8.5443645,7.9000001,9,7.9000001Q9.4556355,7.9000001,9.7778177,8.2221823Q10.0999999,8.5443645,10.0999999,9Q10.0999999,9.4556355,9.7778177,9.7778177Q9.4556355,10.0999999,9,10.0999999Q8.5443645,10.0999999,8.2221823,9.7778177Q7.9000001,9.4556355,7.9000001,9Q7.9000001,8.5443645,8.2221823,8.2221823Z'%20fill-rule='evenodd'%20fill='%236366F1'%20fill-opacity='1'/%3e%3c/g%3e%3c/svg%3e",OJt="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20fill='none'%20version='1.1'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%3e%3cdefs%3e%3cclipPath%20id='master_svg0_1249_010669'%3e%3crect%20x='-0.9000000357627869'%20y='-0.9000000357627869'%20width='25.800000071525574'%20height='25.800000071525574'%20rx='0'/%3e%3c/clipPath%3e%3c/defs%3e%3cg%20clip-path='url(%23master_svg0_1249_010669)'%3e%3cpath%20d='M16.105598320312502,0.9819171499999999L12.0384463203125,5.0388078499999995L11.4012413203125,5.67439985L12.6724303203125,6.94880435L13.3096293203125,6.31320665L16.103991320312502,3.52589535L20.9187853203125,8.340691549999999L13.8082283203125,15.45124725L10.9681396203125,12.60835625L10.3320570203125,11.97164155L9.0586319203125,13.24381125L9.6947193203125,13.88052225L13.8076013203125,17.99746025L23.4643703203125,8.340692050000001L16.105598320312502,0.9819171499999999ZM7.5908932203125,24.19715725L11.6427193203125,20.14534025L12.2791223203125,19.50894525L11.0063267203125,18.236146249999997L10.3699293203125,18.87254725L7.5908899203125,21.65157725L2.7768222203125,16.83753925L9.8787708203125,9.73558855L12.7211163203125,12.57705025L13.3576113203125,13.21335225L14.6302113203125,11.94035625L13.9937103203125,11.30405905L9.8785724203125,7.19020225L0.23123422031249996,16.83754425L7.5908932203125,24.19715725Z'%20fill-rule='evenodd'%20fill='%233B82F6'%20fill-opacity='1'/%3e%3c/g%3e%3c/svg%3e",BJt="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20fill='none'%20version='1.1'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%3e%3cdefs%3e%3cclipPath%20id='master_svg0_1249_013677'%3e%3crect%20x='-0.9000000357627869'%20y='-0.9000000357627869'%20width='25.800000071525574'%20height='25.800000071525574'%20rx='0'/%3e%3c/clipPath%3e%3c/defs%3e%3cg%20clip-path='url(%23master_svg0_1249_013677)'%3e%3cpath%20d='M13.1048822125,2.90000004L4.9076339625,2.90000004L4.9048828525,4L4.9048828525,17.999940000000002L4.9048868425,18.899942L3.1048787825,18.899942L3.1048828325,17.999938999999998L3.1048827725,4L3.1121287325,1.0999999599999999L13.1048794125,1.10000002L15.3776748125,1.10000002L20.9048828125,6.6272078L20.9048828125,8.9000039L20.9048768125,22.907261L18.0026308125,22.899998L4.0048828125,22.9L3.1048787825,22.900003L3.1048787825,21.099997L4.0048828125,21.1L18.0071368125,21.100002L19.1048778125,21.102749L19.1048818125,8.899999099999999L16.0026608125,8.8999968L13.1048775125,8.8928347L13.1048822125,2.90000004ZM18.8320918125,7.1000009L14.9048828125,3.1727920000000003L14.9048788125,7.0972781L16.007110812500002,7.1000028L18.8320918125,7.1000009Z'%20fill-rule='evenodd'%20fill='%233B82F6'%20fill-opacity='1'/%3e%3cg%20transform='matrix(0,1,1,0,-2.98974609375,2.98974609375)'%3e%3cpath%20d='M8.25,19.556722593750003L15.749999500000001,19.556722593750003L15.749999500000001,17.95672229375L10.649999600000001,17.95672229375L13.7413173,15.63823409375L13.7413173,14.35823419375L10.649999900000001,12.03974610375L15.749999500000001,12.03974610375L15.749999500000001,10.43974608375L8.25,10.43974608375L7.76999995,11.87974608375L11.927984,14.99823399375L7.76999995,18.11672209375L8.25,19.556722593750003Z'%20fill-rule='evenodd'%20fill='%233B82F6'%20fill-opacity='1'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e",$Jt="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20fill='none'%20version='1.1'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%3e%3cdefs%3e%3cclipPath%20id='master_svg0_1249_010643'%3e%3crect%20x='0'%20y='0'%20width='24'%20height='24'%20rx='0'/%3e%3c/clipPath%3e%3c/defs%3e%3cg%20clip-path='url(%23master_svg0_1249_010643)'%3e%3cpath%20d='M19.581645546875,17.236587468750002C18.007026546875,17.11962746875,16.490728546874998,16.53484746875,15.266022546875,15.48223746875C12.874935546875,16.00854146875,10.600484846875,16.768759468749998,8.326035046874999,17.70441046875C6.518139346875,20.92071546875,4.826881446874999,22.55810746875,3.368900746875,22.55810746875C3.077304846875,22.55810746875,2.7273894468749997,22.49962646875,2.494112486875,22.32419246875C1.852600936875,22.03180146875,1.502685546875,21.38854046875,1.502685546875,20.74527946875C1.502685546875,20.21897546875,1.619323996875,18.75701946875,7.159650346875,16.35941046875C8.442673646875,14.02027846875,9.434100646874999,11.62267246875,10.250569346875,9.10810756875C9.550739246875,7.70462986875,8.034439046875,4.25441266875,9.084185646875,2.50006532875C9.434100646874999,1.85680561875,10.133930246875,1.50593611275,10.892080346875,1.56441435035C11.475273146875,1.56441435035,12.058465546875,1.85680558875,12.408380546875,2.32463156875C13.166530546875,3.37724006875,13.108210546875,5.59941386875,12.116784546875,8.874196068749999C13.049892546875,10.62854196875,14.274595546875,12.20745446875,15.732575546875,13.55245546875C16.957279546875,13.31854246875,18.181981546875,13.14310746875,19.406686546875,13.14310746875C22.147691546875,13.20158546875,22.555925546875,14.48810746875,22.497604546875,15.24832546875C22.497604546875,17.236587468750002,20.573070546875,17.236587468750002,19.581645546875,17.236587468750002ZM3.252262246875,20.86223646875L3.427219846875,20.80375646875C4.243689046875,20.51136746875,4.885200546875,19.92658646875,5.351754146875,19.16636646875C4.476965946875,19.51723446875,3.777135146875,20.10201846875,3.252262246875,20.86223646875ZM11.008718446875,3.31876086875L10.833761246875,3.31876086875C10.775442146875,3.31876086875,10.658803946875,3.31876086875,10.600484846875,3.37723926875C10.367207546875,4.37136936875,10.542164846875,5.423977868750001,10.950399446875,6.35962966875C11.300315846875,5.36549946875,11.300315846875,4.3128909687500006,11.008718446875,3.31876086875ZM11.416953046875,11.79810746875L11.358633046875,11.91506346875L11.300313946875,11.85658446875C10.775441146875,13.20158446875,10.192249346875,14.54658646875,9.550737346875,15.83310746875L9.667376546875,15.77462846875L9.667376546875,15.89158646875C10.950399446875,15.42375946875,12.350061546875,15.01441146875,13.633083546875,14.72202146875L13.574764546875,14.66354146875L13.749721546875,14.66354146875C12.874933546875,13.78636746875,12.058464546875,12.79223846875,11.416953046875,11.79810746875ZM19.348367546875,14.89745546875C18.823495546875,14.89745546875,18.356941546875,14.89745546875,17.832069546875,15.01441046875C18.415262546875,15.30680046875,18.998453546875,15.42375746875,19.581645546875,15.48223746875C19.989879546875,15.54071646875,20.398113546875,15.48223746875,20.748029546875,15.36528046875C20.748029546875,15.18984646875,20.514753546875,14.89745546875,19.348367546875,14.89745546875Z'%20fill='%23EF4444'%20fill-opacity='1'/%3e%3c/g%3e%3c/svg%3e",FJt="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20fill='none'%20version='1.1'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%3e%3cdefs%3e%3cclipPath%20id='master_svg0_1249_010627'%3e%3crect%20x='-0.9000000357627869'%20y='-0.9000000357627869'%20width='25.800000071525574'%20height='25.800000071525574'%20rx='0'/%3e%3c/clipPath%3e%3c/defs%3e%3cg%20clip-path='url(%23master_svg0_1249_010627)'%3e%3cpath%20d='M5,2.09999996L2.09999996,2.09999996L2.09999996,8.0999961L2.09999597,9.9000039L2.09999996,14.099996L2.09999597,15.900004L2.09999996,21.900002L8.0999961,21.900002L9.9000039,21.900003L14.099996,21.900002L15.900004,21.900003L19,21.900002L21.900002,21.900002L21.900002,2.09999996L5,2.09999996ZM20.1,8.100000399999999L20.1,3.90000004L3.90000004,3.90000004L3.90000004,8.100000399999999L20.1,8.100000399999999ZM14.1,9.9000001L9.9000001,9.9000001L9.9000001,14.1L14.1,14.1L14.1,9.9000001ZM15.900001,14.1L15.900001,9.9000001L20.1,9.9000001L20.1,14.1L15.900001,14.1ZM14.1,15.900001L9.9000001,15.900001L9.9000001,20.1L14.1,20.1L14.1,15.900001ZM15.900001,20.1L15.900001,15.900001L20.1,15.900001L20.1,20.1L15.900001,20.1ZM8.100000399999999,20.1L8.100000399999999,15.900001L3.90000004,15.900001L3.90000004,20.1L8.100000399999999,20.1ZM3.90000004,14.1L8.100000399999999,14.1L8.100000399999999,9.9000001L3.90000004,9.9000001L3.90000004,14.1Z'%20fill-rule='evenodd'%20fill='%2314B8A6'%20fill-opacity='1'/%3e%3c/g%3e%3c/svg%3e",zJt="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20fill='none'%20version='1.1'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%3e%3cdefs%3e%3cclipPath%20id='master_svg0_1249_010806'%3e%3crect%20x='-0.9000000357627869'%20y='-0.9000000357627869'%20width='25.800000071525574'%20height='25.800000071525574'%20rx='0'/%3e%3c/clipPath%3e%3c/defs%3e%3cg%20clip-path='url(%23master_svg0_1249_010806)'%3e%3cpath%20d='M17.9502339453125,16.500137000000002L17.9502339453125,7.4998626999999995L17.9571569453125,4.34999996L0.6429908253125,4.34999996L0.6501731253125,7.5020506000000005L0.6501708053125,16.500000999999997L0.6429908253125,19.650001L17.9571569453125,19.650001L17.9502339453125,16.500137000000002ZM16.1502319453125,7.4998626999999995L16.1502319453125,16.500137000000002L16.150234945312498,16.502115L16.1531969453125,17.85L2.4470961653125,17.85L2.4501708753124998,16.500000999999997L2.4501686053125002,7.4979493999999995L2.4470971253125002,6.15000004L16.1531969453125,6.15000004L16.1502319453125,7.4998626999999995Z'%20fill-rule='evenodd'%20fill='%236366F1'%20fill-opacity='1'/%3e%3cg%20transform='matrix(0,1,1,0,9.60009765625,-9.60009765625)'%3e%3cpath%20d='M22.12149765625,7.03664169Q21.85288765625,6.5999999,21.34020085625,6.5999999L20.35991075625,6.5999999Q19.84723715625,6.5999999,19.57860375625,7.03665763L16.34978669625,12.284925000000001Q16.06778135625,12.7433271,16.33034050625,13.213119500000001Q16.59290134625,13.682915699999999,17.13108936325,13.682915699999999L24.56910565625,13.682915699999999Q25.10730455625,13.682915699999999,25.36986255625,13.2131057Q25.63241485625,12.7433052,25.35040475625,12.2849197L22.12149765625,7.03664169ZM20.85005875625,8.40513563L18.71047415625,11.882915L22.98969885625,11.882915L20.85005875625,8.40513563Z'%20fill-rule='evenodd'%20fill='%236366F1'%20fill-opacity='1'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e",UJt="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20fill='none'%20version='1.1'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%3e%3cdefs%3e%3cclipPath%20id='master_svg0_1249_010629'%3e%3crect%20x='-0.9000000357627869'%20y='-0.9000000357627869'%20width='25.800000071525574'%20height='25.800000071525574'%20rx='0'/%3e%3c/clipPath%3e%3c/defs%3e%3cg%20clip-path='url(%23master_svg0_1249_010629)'%3e%3cpath%20d='M13.105126353125,2.90000004L4.909844933125,2.90000004L4.905126993125,18.000122L4.9051269331250005,18.000404L4.905130983125,18.900126L3.105122923125,18.900126L3.105126973125,18.000122L4.003604110525,18.000122L3.105126973125,17.999841L3.110407233125,1.0999999599999999L13.105123553125,1.10000002L15.377918953125,1.10000002L20.905126953125,6.6272078L20.905126953125,8.9000039L20.905120953125,22.907261L18.002874953125,22.899998L4.005126953125,22.9L3.105122923125,22.900003L3.105122923125,21.099997L4.005126953125,21.1L18.007380953125,21.100002L19.105121953125,21.102749L19.105125953125,8.899999099999999L16.002904953125,8.8999968L13.105121653125,8.8928347L13.105126353125,2.90000004ZM18.832335953125,7.1000009L14.905126953125,3.1727920000000003L14.905122953125,7.0972781L16.007354953125002,7.1000028L18.832335953125,7.1000009Z'%20fill-rule='evenodd'%20fill='%233B82F6'%20fill-opacity='1'/%3e%3cg%3e%3cpath%20d='M11.5241466,15.1333303L10.624145500000001,18.5L8.8103027,18.5L7.11073983,12.1256101L6.84411621,11.1256101L8.5675049,11.1256101L9.3246179,14.581996L9.6624756,16.1243896Q9.733741,16.4522104,9.7623343,16.9507189Q9.762393,16.9517393,9.762451200000001,16.952758799999998L9.7957764,16.952758799999998Q9.7958345,16.9518032,9.7958934,16.9508476Q9.8198829,16.5612478,9.9433594,16.1005864L10.3543289,14.6093936L11.3144531,11.1256101L12.985473599999999,11.1256101L13.8162313,14.4803481L14.2327881,16.1624756Q14.3088741,16.4620614,14.3517089,16.9421387Q14.351758,16.942688,14.3518062,16.9432373L14.3756104,16.9432373Q14.375659899999999,16.9421721,14.3757091,16.9411077Q14.3948865,16.5280361,14.4851069,16.1339111L14.8423223,14.4637313L15.5562735,11.1256101L17.151123,11.1256101L16.8845,12.1256101L15.1849365,18.5L13.4377441,18.5L12.5584936,15.1362009L12.180907699999999,13.6916504Q12.0811496,13.3021169,12.0619726,12.879402200000001Q12.0619307,12.8784828,12.0618892,12.877563L12.0428462,12.877563Q12.0428052,12.877993100000001,12.0427637,12.8784232Q11.9951653,13.3729568,11.909545900000001,13.6916504L11.5241466,15.1333303Z'%20fill-rule='evenodd'%20fill='%233B82F6'%20fill-opacity='1'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e";function oF(e){const t=new URL(e);return t.hostname=t.hostname.replace(/\.$/,""),(t.hostname==="localhost"||t.hostname==="[::1]"||t.hostname==="0.0.0.0"||t.hostname==="host.docker.internal"||t.hostname.endsWith(".localhost")||/^127\./.test(t.hostname))&&(t.hostname="localhost"),t.origin}function vce(e,t,n){try{const s=new URL(e.trim());if(!["http:","https:"].includes(s.protocol)||s.username||s.password||s.hostname.endsWith(".")||!/^[a-z0-9._-]+$/i.test(s.hostname))return;const r=[oF(new URL(t)),oF(new URL(n,t))],o=new URL(s);return o.protocol="https:",r.includes(oF(s))||r.includes(oF(o))?void 0:s}catch{return}}function E8(e){return e.replaceAll("&","&").replaceAll('"',""").replaceAll("<","<").replaceAll(">",">")}function WJt(e,t){const n=`default-src 'none'; script-src 'none'; style-src 'unsafe-inline'; frame-src ${e.origin}; base-uri 'none'; form-action 'none'`;return`<!doctype html><html><head>
|
|
1919
1919
|
<meta http-equiv="Content-Security-Policy" content="${E8(n)}">
|
|
@@ -1922,7 +1922,7 @@ License: MIT
|
|
|
1922
1922
|
</head><body><iframe title="${E8(t)}" src="${E8(e.href)}" sandbox="allow-scripts allow-same-origin allow-forms" referrerpolicy="no-referrer"></iframe></body></html>`}function H0e(e,t){const n=V0e(t);if(q0e.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 HJt=new Set([".doc",".docx",".docm",".dotx",".xls",".xlsx",".xlsm",".xlsb",".ppt",".pptx",".pptm",".odt",".ods",".odp"]),q0e=new Set([".m4a",".mp3",".ogg",".wav"]),qJt=new Set([...HJt,...q0e,".mp4",".mov",".webm"]);function y9(e,t){const n=b9(e);return n?n===".xlsx":mw(t)==="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}const yce="application/vnd.openxmlformats-officedocument.wordprocessingml.document";function w9(e,t){const n=b9(e);return n?n===".docx":mw(t)===yce}function V2(e){return b9(e.workspacePath)===".pdf"||mw(e.mimeType)==="application/pdf"||e.kind==="pdf"}function bXe(e){if(y9(e.workspacePath,e.mimeType))return!1;const t=b9(e.workspacePath),n=mw(e.mimeType);return t===".svg"||n==="image/svg+xml"?!0:w9(e.workspacePath,e.mimeType)?!1:qJt.has(t)?!0:V2(e)||G0e(e)||t===".md"||t===".markdown"||t===".html"||t===".htm"||n==="text/markdown"||n==="text/html"?!1:e.kind==="image"||e.kind==="document"||e.kind==="video"||e.kind==="audio"}function V0e(e){return b9((e??"").split(/[?#]/,1)[0])}function b9(e){const t=(e??"").split(/[/\\]/).pop()??"",n=t.lastIndexOf(".");return n>=0?t.slice(n).toLowerCase():""}function VJt(e,t){return q0e.has(V0e(e))||mw(t).startsWith("audio/")}const GJt="qwen.workspace.sha256";function yAe(e){const t=e.metadata?.[GJt],n=typeof t=="string"?t:"";return`${e.status}:${e.updatedAt}:${n}`}function KJt(e){const t=e.metadata?.artifactType;return typeof t=="string"&&t?t:H0e(e.kind,e.workspacePath??e.url??e.title)}function VY(e){return e===void 0?"":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}const xXe={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"},YJt=100*1024*1024,XJt=256*1024;function mw(e){return e?.split(";",1)[0]?.trim().toLowerCase()??""}function G0e(e){const t=mw(e.mimeType);return t.startsWith("image/")?t==="image/jpg"?"image/jpeg":Object.values(xXe).includes(t)?t:void 0:G2(e.workspacePath??"")}function G2(e){const t=e.toLowerCase(),n=t.includes(".")?t.split(".").pop():void 0;return n?xXe[n]:void 0}function JJt(e){return/\.html?$/i.test(e)?"text/html":"text/markdown"}async function IT(e,t,n,s){const r=[],o=s.maxBytes??YJt,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:XJt});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 d=atob(c.contentBase64),h=new Uint8Array(d.length);for(let f=0;f<d.length;f++)h[f]=d.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 x9(e,t,n="application/octet-stream",s){const r=await IT((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=K0e(t)??t,i.addEventListener("click",l=>l.stopPropagation()),document.body.appendChild(i),i.click(),i.remove()}finally{setTimeout(()=>URL.revokeObjectURL(o),1e3)}}function QJt(e){return e.workspacePath??e.url??e.managedId??""}function k9(e){return K0e(e.workspacePath)||e.title||"Artifact"}function K0e(e){return e?.split("/").at(-1)||void 0}function K2(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 fL(e,t){const n=K2(e),s=K2(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 Y0e(e,t,n){const s=fL(e??"",n),r=fL(t??"",n);return!!s&&s===r}const wce="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 kXe(e,t){return bce(xce(e),t)}function bce(e,t){return`<!doctype html><html><head>
|
|
1923
1923
|
<meta http-equiv="Content-Security-Policy" content="${wce} frame-src 'none';">
|
|
1924
1924
|
<style>html,body,iframe{width:100%;height:100%;margin:0;border:0;display:block;overflow:hidden}</style>
|
|
1925
|
-
</head><body><iframe title="${E8(t)}" sandbox="allow-scripts" referrerpolicy="no-referrer" srcdoc="${E8(e)}"></iframe></body></html>`}let iF;async function ZJt(e,t,n){if(iF?.content===e&&iF.title===t)return iF.document;const s=await eQt(e,t,n);return iF={content:e,title:t,document:s},s}async function eQt(e,t,n){if(typeof DOMParser>"u")return kXe(e,t);const s=new DOMParser().parseFromString(e,"text/html");if(!s.querySelector('script#transcript-document[type="application/json"]'))return bce(xce(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,d])=>{const h=s.querySelector(i),f=h?.getAttribute(l)??"",p=h?.getAttribute("integrity")??"";if(!h)return;const m=`https://unpkg.com/@qwen-code/qwen-code@0.27.2
|
|
1925
|
+
</head><body><iframe title="${E8(t)}" sandbox="allow-scripts" referrerpolicy="no-referrer" srcdoc="${E8(e)}"></iframe></body></html>`}let iF;async function ZJt(e,t,n){if(iF?.content===e&&iF.title===t)return iF.document;const s=await eQt(e,t,n);return iF={content:e,title:t,document:s},s}async function eQt(e,t,n){if(typeof DOMParser>"u")return kXe(e,t);const s=new DOMParser().parseFromString(e,"text/html");if(!s.querySelector('script#transcript-document[type="application/json"]'))return bce(xce(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,d])=>{const h=s.querySelector(i),f=h?.getAttribute(l)??"",p=h?.getAttribute("integrity")??"";if(!h)return;const m=`https://unpkg.com/@qwen-code/qwen-code@0.27.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:d}),b=await new Promise((y,w)=>{const x=new FileReader;x.onload=()=>y(x.result),x.onerror=()=>w(x.error),x.readAsDataURL(v)});h.setAttribute(l,b),h.removeAttribute("integrity"),h.removeAttribute("crossorigin")}))}finally{n.removeEventListener("abort",o),r.abort()}return bce(xce(s),t)}function xce(e){if(typeof e=="string"&&typeof DOMParser>"u")return`<!doctype html><html><head><meta http-equiv="Content-Security-Policy" content="${wce}"></head><body>${tQt(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=wce,t.head.prepend(n),`<!doctype html>${t.documentElement.outerHTML}`}function tQt(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 _Xe={csv:MJt,file:PJt,html:DJt,image:LJt,link:OJt,md:BJt,pdf:$Jt,spreadsheet:FJt,video:zJt,word:UJt},nQt={csv:"csv",html:"html",image:"image",link:"link",markdown:"md",md:"md",pdf:"pdf",spreadsheet:"spreadsheet",video:"video",word:"word"},sQt={audio:Tge,document:F2,notebook:B6t},wAe={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 SXe(e){if(!e)return"file";const t=e.workspacePath??e.url??e.title,n=V0e(t).slice(1);if(n&&wAe[n])return wAe[n];const s=mw(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":nQt[e.kind]??"file"}function CXe({artifact:e,className:t}){const{artifact:n}=jh(),s=e?n?.renderImage?.(e):void 0;if(s!=null&&s!==!1)return s;const r=SXe(e),o=e?e.workspacePath??e.url??e.title:void 0,i=r==="file"&&e?VJt(o,e.mimeType)?"audio":e.kind:void 0,l=i?sQt[i]:void 0;return l?a.jsx(l,{className:t,"data-artifact-icon":i,"aria-hidden":"true"}):a.jsx("img",{className:t,src:_Xe[r],"data-artifact-icon":r,alt:""})}const rQt=[[new Set(["json","jsonl","geojson"]),KMt],[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"]),rq],[new Set(["zip","tar","gz","tgz","bz2","xz","7z","rar"]),Y3t],[new Set(["csv","tsv","xls","xlsx","ods"]),r5t],[new Set(["ppt","pptx","odp"]),aPt],[new Set(["png","jpg","jpeg","gif","webp","bmp","ico","tif","tiff"]),Kqe],[new Set(["mp3","wav","ogg","m4a","aac","flac"]),Tge],[new Set(["mp4","mov","webm","avi","mkv"]),Yqe],[new Set(["txt","md","mdx","log","pdf","doc","docx","rtf"]),F2]];function oQt(e,t){const n=e.split(".").pop()?.toLowerCase()??"";for(const[s,r]of rQt)if(s.has(n))return r;return t?.startsWith("image/")?Kqe:t?.startsWith("audio/")?Tge:t?.startsWith("video/")?Yqe:t?.startsWith("text/")?F2:Xqe}function ub({name:e,mimeType:t,size:n=24,absoluteStrokeWidth:s,...r}){const o=oQt(e,t),i=SXe({kind:"file",title:e.replace(/[?#]/g,"_"),mimeType:t});return i!=="file"||o===Xqe?a.jsx("svg",{width:n,height:n,...r,"data-file-type-icon":i,children:a.jsx("image",{href:_Xe[i],width:"100%",height:"100%"})}):a.jsx(o,{size:n,absoluteStrokeWidth:s,...r})}const iQt="_icon_h5emn_1",aQt="_details_h5emn_13",lQt="_name_h5emn_23",cQt="_type_h5emn_24",aF={icon:iQt,details:aQt,name:lQt,type:cQt};function TXe({name:e,mimeType:t}){const s=/\.([^.\\/]+)$/.exec(e)?.[1]?.toUpperCase()||t||"FILE";return a.jsxs(a.Fragment,{children:[a.jsx("span",{className:aF.icon,children:a.jsx(ub,{name:e,mimeType:t,size:24,"aria-hidden":"true"})}),a.jsxs("span",{className:aF.details,children:[a.jsx("span",{className:aF.name,title:e,children:e}),a.jsx("span",{className:aF.type,title:s,children:s})]})]})}/**
|
|
1926
1926
|
* @license
|
|
1927
1927
|
* Copyright 2025 Qwen Team
|
|
1928
1928
|
* SPDX-License-Identifier: Apache-2.0
|
|
@@ -2696,7 +2696,7 @@ ${I("managed.truncated")}`:""))}}},[m,e,L,I]),Ee=u.useCallback(Pe=>{e&&vt({sessi
|
|
|
2696
2696
|
`));if(vt.discoveryState==="completed"||vt.initialized&&vt.discoveryState==="not_started"&&vt.servers.length===0){ze=!0;break}}}if(!ze)throw new Error(d("mcp.discovery.timeout"))}catch(jt){Bt&&pt(jt instanceof Error?jt.message:String(jt))}finally{Bt&&Ge(!1)}})(),()=>{Bt=!1}},[x,S,_,k,E,d,h]),u.useEffect(()=>{if(h||Be)return;if(!Dn){ee({});return}let Bt=!0;return Re(!0),be(null),Promise.all(kn.map(async gt=>{const jt=await w(gt);return{serverName:gt,tools:jt.tools.filter(Qt=>Qt.isValid),error:jt.errors?.length?`${gt}: ${jt.errors.map(Qt=>Qt.error||Qt.hint||Qt.kind).join(", ")}`:void 0}})).then(gt=>{if(!Bt)return;ee(Object.fromEntries(gt.map(({serverName:Qt,tools:wn})=>[Qt,wn])));const jt=gt.flatMap(({error:Qt})=>Qt?[Qt]:[]);be(jt.length>0?jt.join(`
|
|
2697
2697
|
`):null)}).catch(gt=>{Bt&&be(gt instanceof Error?gt.message:String(gt))}).finally(()=>{Bt&&Re(!1)}),()=>{Bt=!1}},[Dn,kn,Be,w,h]);function Tn(Bt){if(!Bt){for(const gt of["description","systemPrompt"])ht.current[gt]+=1,We.current[gt]?.abort(),delete We.current[gt];Ke(new Set)}ge(Bt)}function xs(){Ue(A),J(P),we(null),ge(!0)}function Et(Bt){ht.current[Bt]+=1,We.current[Bt]?.abort(),delete We.current[Bt],Ke(gt=>{const jt=new Set(gt);return jt.delete(Bt),jt})}async function ln(Bt){const gt=_e.trim();if(!gt||We.current[Bt])return;const jt=ht.current[Bt]+1;ht.current[Bt]=jt;const Qt=new AbortController;We.current[Bt]=Qt,Ke(ze=>new Set(ze).add(Bt)),we(null);const wn=Bt==="description"?Ue:J;wn("");try{const ze=Bt==="description"?`Return only a concise one-sentence ${h?"persistent Agent":"subagent"} description explaining when this agent should be used. Do not return JSON, Markdown, a label, or commentary.`:`Return only the complete ${h?"persistent Agent":"subagent"} system prompt. Do not return JSON, a Markdown code block, a name, a description, or commentary.`;let Qe="";for await(const vt of m(`${gt}
|
|
2698
2698
|
|
|
2699
|
-
${ze}`,{signal:Qt.signal})){if(ht.current[Bt]!==jt)return;if(vt.type==="delta")Qe+=vt.text,wn(Qe);else if(vt.type==="error")throw new Error(vt.message)}if(ht.current[Bt]!==jt)return;wn(Qe.trim())}catch(ze){if(ht.current[Bt]!==jt||Qt.signal.aborted)return;we(d("agent.create.generateFailed",{error:ze instanceof Error?ze.message:String(ze)}))}finally{ht.current[Bt]===jt&&(Ke(ze=>{const Qe=new Set(ze);return Qe.delete(Bt),Qe}),We.current[Bt]===Qt&&delete We.current[Bt])}}function nn(){M(je.trim()),D(q.trim()),Tn(!1)}function Nt(Bt){const gt=t?.mcpServers?.[Bt];if(bC(gt))return gt;const jt=Ot[Bt];if(bC(jt))return jt;const Qt=I==="workspace"?Ft.find(wn=>wn.name===Bt)?.config:void 0;return bC(Qt)?Qt:void 0}async function Jt(){if(!Un){Dt(d("agent.create.required"));return}it(!0),Dt(null);try{if(c){const vt=Number(ue);if(!Number.isInteger(vt)||vt<1||vt>8)throw new Error(d("collab.agent.concurrencyInvalid"));const rt=T.trim();await c({name:rt,...A.trim()?{description:A.trim()}:{},...P.trim()?{instructions:P.trim()}:{},...ae?{agentType:ae}:{},...O.trim()?{model:O.trim()}:{},maxConcurrentRuns:vt,...X.size>0?{execution:{mode:"managed-host",hostIds:[...X],...G?{provider:G}:{}}}:G&&G!=="qwen"?{execution:{mode:"local",provider:G}}:{}}),s(rt);return}const Bt=re.trim()?Number(re.trim()):void 0;if(Bt!==void 0&&(!Number.isSafeInteger(Bt)||Bt<=0))throw new Error(d("agent.create.maxTurnsInvalid"));const gt=[...z],jt=[...$],Qt=SJn(Ne,"hooks"),wn=Object.fromEntries([...ve].flatMap(vt=>{const rt=Nt(vt);return rt?[[vt,rt]]:[]})),ze={description:A.trim(),systemPrompt:P.trim(),tools:t||gt.length>0?gt:void 0,disallowedTools:t||jt.length>0?jt:void 0,mcpServers:t||Object.keys(wn).length>0?wn:void 0,hooks:t?Qt??{}:Qt},Qe=t?await p(t.name,{...ze,model:O.trim()||null,approvalMode:H==="inherit"?null:H,maxTurns:Bt??null,color:me==="inherit"?null:me},I):await f({name:T.trim(),scope:I,...ze,model:O.trim()||void 0,approvalMode:H==="inherit"?void 0:H,maxTurns:Bt,color:me==="inherit"?void 0:me});s(Qe.agent.name)}catch(Bt){Dt(CJn(Bt))}finally{it(!1)}}return a.jsxs("div",{className:"flex w-full max-w-5xl flex-col gap-6",children:[a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsx("h1",{className:"text-xl font-semibold text-balance",children:d(h?"collab.agent.new":t?"agent.edit":"agent.create")}),a.jsxs(Ae,{type:"button",variant:"outline",onClick:xs,children:[a.jsx(nk,{"data-icon":"inline-start"}),d("agent.create.modelGenerate")]})]}),_t?a.jsx(yg,{tone:"error",noticeKey:_t,closeLabel:d("common.close"),onDismiss:()=>Dt(null),children:_t}):null,h&&a.jsx("p",{className:"text-sm text-muted-foreground",children:d("collab.agent.joins",{project:o?.split(/[\\/]/).filter(Boolean).at(-1)??""})}),a.jsxs(Mv,{defaultValue:"overview",children:[!h&&a.jsxs(Pv,{className:"max-w-full overflow-x-auto",children:[a.jsx(ya,{value:"overview",children:d("agent.detail.overview")}),a.jsx(ya,{value:"prompt",children:d("agent.detail.systemPrompt")}),a.jsx(ya,{value:"tools",children:d("agent.detail.tools")}),a.jsx(ya,{value:"mcp",children:d("agent.detail.mcp")}),a.jsx(ya,{value:"hooks",children:d("agent.detail.hooks")})]}),a.jsx(Ll,{value:"overview",className:"pt-4",children:a.jsxs(S_,{className:"grid grid-cols-1 gap-5 lg:grid-cols-2",children:[h?null:a.jsxs(ea,{children:[a.jsx(Ca,{htmlFor:"agent-scope",children:d("agent.create.scope")}),a.jsxs(Ii,{value:I,disabled:!!t,onValueChange:Bt=>R(Bt),children:[a.jsx(Ei,{id:"agent-scope",className:"w-full",children:a.jsx(Ri,{})}),a.jsxs(Ai,{children:[a.jsx(Br,{value:"workspace",children:d("agent.create.project.cli")}),a.jsx(Br,{value:"global",children:d("agent.create.user.cli")})]})]})]}),a.jsxs(ea,{children:[a.jsx(Ca,{htmlFor:"agent-name",children:d("agent.create.name")}),a.jsx(gr,{id:"agent-name",value:T,onChange:Bt=>N(Bt.target.value),placeholder:d("agent.create.namePlaceholder"),disabled:!!t}),a.jsx(bl,{children:d(h?"collab.agent.nameHelp":"agent.create.nameHelp")})]}),h&&a.jsxs(ea,{children:[a.jsx(Ca,{htmlFor:"agent-role",children:d("collab.agent.role")}),a.jsxs(Ii,{value:ae||Ere,disabled:X.size>0,onValueChange:Bt=>se(Bt===Ere?"":Bt),children:[a.jsx(Ei,{id:"agent-role",className:"w-full",children:a.jsx(Ri,{})}),a.jsxs(Ai,{children:[a.jsx(Br,{value:Ere,children:d("collab.agent.roleNone")}),g.map(Bt=>a.jsx(Br,{value:Bt.name,children:Bt.name},Bt.name))]})]}),a.jsx(bl,{children:d("collab.agent.roleHint")})]}),h&&a.jsxs(ea,{className:"lg:col-span-2",children:[a.jsx(Ca,{htmlFor:"agent-workspace-prompt",children:d("collab.agent.instructions")}),a.jsx(hm,{id:"agent-workspace-prompt",value:P,onChange:Bt=>D(Bt.target.value),rows:6,placeholder:d("collab.agent.instructionsHint")})]}),a.jsxs(ea,{className:"lg:col-span-2",children:[a.jsx(Ca,{htmlFor:"agent-description",children:d(h?"collab.agent.description":"agent.create.description")}),a.jsx(hm,{id:"agent-description",value:A,onChange:Bt=>M(Bt.target.value),placeholder:d("agent.create.manualDescPlaceholder"),rows:3})]}),a.jsxs(ea,{children:[a.jsx(Ca,{htmlFor:"agent-model",children:d("agent.create.model")}),a.jsx(gr,{id:"agent-model",disabled:h&&X.size>0,value:O,onChange:Bt=>W(Bt.target.value),placeholder:"inherit / fast / provider:model"})]}),h?a.jsxs(a.Fragment,{children:[a.jsxs(ea,{children:[a.jsx(Ca,{htmlFor:"agent-concurrency",children:d("collab.agent.concurrency")}),a.jsx(gr,{id:"agent-concurrency",type:"number",min:"1",max:"8",step:"1",value:ue,onChange:Bt=>de(Bt.target.value)})]}),a.jsxs(ea,{className:"lg:col-span-2",children:[a.jsx(Ca,{children:d("collab.agent.runsOn")}),a.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[a.jsxs("label",{className:"flex items-start gap-2 rounded-md border border-border p-3 text-sm",children:[a.jsx("input",{type:"radio",name:"agent-execution-location",checked:X.size===0,onChange:()=>{pe(new Set),Y(U[0])}}),a.jsxs("span",{children:[d("collab.agent.thisComputer"),a.jsx("span",{className:"block break-all text-xs text-muted-foreground",children:o})]})]}),r.map(Bt=>a.jsxs("label",{className:"flex items-start gap-2 rounded-md border border-border p-3 text-sm",children:[a.jsx("input",{type:"radio",name:"agent-execution-location",checked:X.has(Bt.id),onChange:()=>{pe(new Set([Bt.id])),Y(Cz(Bt)[0]),se(""),W("")}}),a.jsxs("span",{children:[Bt.label,Bt.status==="offline"&&a.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:d("collab.agentStatus.offline")}),a.jsx("span",{className:"block break-all text-xs text-muted-foreground",children:Bt.workspaceCwd??d("collab.agent.cwdUnknown")})]})]},Bt.id))]}),a.jsx(bl,{children:d(X.size>0?"collab.agent.hostPersona":"collab.agent.runsOnHint")})]}),(()=>{const Bt=r.find(Qt=>X.has(Qt.id)),gt=Bt?Cz(Bt):U,jt=Qt=>gt.includes(Qt)?void 0:d(Bt||l!==void 0?"collab.agent.programMissing":"collab.agent.programLocal");return a.jsxs(ea,{className:"lg:col-span-2",children:[a.jsx(Ca,{children:d("collab.runtime.program")}),a.jsx("div",{role:"radiogroup","aria-label":d("collab.runtime.program"),className:"grid gap-2 sm:grid-cols-2",children:wat.map(Qt=>{const wn=jt(Qt);return a.jsxs("label",{className:"flex items-start gap-2 rounded-md border border-border p-3 text-sm has-[:disabled]:opacity-60",children:[a.jsx("input",{type:"radio",name:"agent-execution-provider",disabled:wn!==void 0,checked:G===Qt,onChange:()=>Y(Qt)}),a.jsxs("span",{children:[bat(Qt),wn&&a.jsx("span",{className:"block text-xs text-muted-foreground",children:wn})]})]},Qt)})})]})})(),a.jsx(ea,{className:"lg:col-span-2",children:a.jsx(bl,{children:d("collab.agent.afterCreate")})})]}):a.jsxs(a.Fragment,{children:[a.jsxs(ea,{children:[a.jsx(Ca,{htmlFor:"agent-approval",children:d("agent.create.approvalMode")}),a.jsxs(Ii,{value:H,onValueChange:Q,children:[a.jsx(Ei,{id:"agent-approval",className:"w-full",children:a.jsx(Ri,{children:A6e(H,d)})}),a.jsx(Ai,{children:V.map(Bt=>a.jsx(Br,{value:Bt,disabled:Bt==="bubble",children:A6e(Bt,d)},Bt))})]}),a.jsx(bl,{children:EJn(H,d)})]}),a.jsxs(ea,{children:[a.jsx(Ca,{htmlFor:"agent-max-turns",children:d("agent.create.maxTurns")}),a.jsx(gr,{id:"agent-max-turns",type:"number",min:"1",step:"1",value:re,onChange:Bt=>Z(Bt.target.value)}),a.jsx(bl,{children:d("agent.create.maxTurnsHelp")})]}),a.jsxs(ea,{children:[a.jsx(Ca,{htmlFor:"agent-color",children:d("agent.create.color")}),a.jsxs(Ii,{value:me,onValueChange:ye,children:[a.jsx(Ei,{id:"agent-color",className:"w-full",children:a.jsx(Ri,{})}),a.jsx(Ai,{children:["inherit","auto","red","blue","green","yellow","purple","orange","pink","cyan"].map(Bt=>a.jsx(Br,{value:Bt,children:Bt},Bt))})]})]})]})]})}),!h&&a.jsx(Ll,{value:"prompt",className:"pt-4",children:a.jsxs(ea,{children:[a.jsx(hm,{id:"agent-prompt","aria-label":d("agent.create.prompt"),value:P,onChange:Bt=>D(Bt.target.value),placeholder:d("agent.create.promptPlaceholder.cli"),rows:16,className:"min-h-80 max-h-[60vh] overflow-y-auto"}),a.jsx(bl,{children:d("agent.create.promptHelp")})]})}),a.jsx(Ll,{value:"tools",className:"pt-4",children:a.jsxs(S_,{children:[a.jsxs(ea,{children:[a.jsx(Ca,{children:d("agent.create.tools")}),a.jsx(bl,{children:d("agent.create.toolsSelectHelp")}),a.jsx(E6e,{idPrefix:"agent-allowed-tool",selection:z,onSelectionChange:B,builtInTools:tt,mcpServers:Mt,mcpTools:ce,t:d}),Be||fe?a.jsx(j6e,{label:d("agent.create.tools.initializing")}):null,Ve||Me?a.jsx("div",{className:"whitespace-pre-wrap text-sm text-destructive",children:Ve||Me}):null]}),a.jsxs(ea,{children:[a.jsx(Ca,{children:d("agent.create.disallowedTools")}),a.jsx(E6e,{idPrefix:"agent-disallowed-tool",selection:$,onSelectionChange:L,builtInTools:tt,mcpServers:Mt,mcpTools:ce,t:d})]})]})}),a.jsx(Ll,{value:"mcp",className:"pt-4",children:a.jsxs(ea,{children:[a.jsx(Ca,{children:d("agent.create.mcpServers")}),a.jsx(RJn,{selection:ve,onSelectionChange:Te,servers:Mt,t:d}),y.loading?a.jsx(j6e,{label:d("common.loading")}):y.error?a.jsx(AJn,{error:y.error}):null]})}),a.jsx(Ll,{value:"hooks",className:"pt-4",children:a.jsxs(ea,{children:[a.jsx(Ca,{htmlFor:"agent-hooks",children:"Hooks"}),a.jsx(hm,{id:"agent-hooks",value:Ne,onChange:Bt=>Ie(Bt.target.value),placeholder:'{"PreToolUse":[...] }',rows:10,className:"min-h-64 max-h-[60vh] overflow-y-auto font-mono text-xs"}),a.jsx(bl,{children:d("agent.create.jsonObjectHelp")})]})})]}),a.jsxs("div",{className:"flex justify-end gap-2 border-t pt-4",children:[a.jsx(Ae,{variant:"outline",onClick:n,disabled:lt,children:d("common.cancel")}),a.jsxs(Ae,{onClick:()=>void Jt(),disabled:!Un||lt,children:[lt?a.jsx(Ur,{"data-icon":"inline-start"}):null,d(t?"agent.edit.save":"agent.create.save")]})]}),a.jsx(Td,{open:Fe,onOpenChange:Tn,children:a.jsxs(Id,{className:"max-h-[calc(100vh-2rem)] overflow-y-auto sm:max-w-2xl",children:[a.jsxs(fu,{children:[a.jsx(Rd,{children:d("agent.create.modelGenerate")}),a.jsx($u,{children:d("agent.create.modelGenerate.description")})]}),Rt?a.jsx(yg,{tone:"error",noticeKey:Rt,closeLabel:d("common.close"),onDismiss:()=>we(null),children:Rt}):null,a.jsxs(S_,{children:[a.jsxs(ea,{children:[a.jsx(Ca,{htmlFor:"agent-generation-requirements",children:d("agent.create.describeAgent")}),a.jsx(hm,{id:"agent-generation-requirements",value:_e,onChange:Bt=>Ce(Bt.target.value),placeholder:d("agent.create.qwenPlaceholder"),rows:4}),a.jsx(bl,{children:d("agent.create.qwenHint")})]}),a.jsxs(ea,{children:[a.jsx(R6e,{htmlFor:"agent-generated-description",label:d("agent.create.generatedDescription"),active:Tt.has("description"),disabled:!_e.trim(),onGenerate:()=>void ln("description"),onCancel:()=>Et("description"),t:d}),a.jsx(hm,{id:"agent-generated-description",value:je,onChange:Bt=>Ue(Bt.target.value),rows:3,readOnly:Tt.has("description")})]}),a.jsxs(ea,{children:[a.jsx(R6e,{htmlFor:"agent-generated-prompt",label:d("agent.create.generatedSystemPrompt"),active:Tt.has("systemPrompt"),disabled:!_e.trim(),onGenerate:()=>void ln("systemPrompt"),onCancel:()=>Et("systemPrompt"),t:d}),a.jsx(hm,{id:"agent-generated-prompt",value:q,onChange:Bt=>J(Bt.target.value),rows:10,readOnly:Tt.has("systemPrompt"),className:"min-h-64 max-h-64 overflow-y-auto"})]})]}),a.jsxs(Hp,{children:[a.jsx(Ae,{type:"button",variant:"outline",onClick:()=>Tn(!1),children:d("common.cancel")}),a.jsx(Ae,{type:"button",onClick:nn,disabled:Tt.size>0||!je.trim()||!q.trim(),children:d("agent.create.useGenerated")})]})]})})]})}function R6e({htmlFor:e,label:t,active:n,disabled:s,onGenerate:r,onCancel:o,t:i}){return a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ca,{htmlFor:e,children:t}),n?a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground",children:[a.jsx(Ur,{className:"size-3"}),i("agent.create.generatingPrompt")]}),a.jsx(Ae,{type:"button",variant:"outline",size:"sm",className:"ml-auto",onClick:o,children:i("common.cancel")})]}):a.jsxs(Ae,{type:"button",variant:"outline",size:"sm",className:"ml-auto",disabled:s,onClick:r,children:[a.jsx(nk,{"data-icon":"inline-start"}),i("agent.create.generate")]})]})}function E6e({idPrefix:e,selection:t,onSelectionChange:n,builtInTools:s,mcpServers:r,mcpTools:o,t:i}){const[l,c]=u.useState("builtin"),[d,h]=u.useState(""),f=r.filter(g=>!g.disabled),p=l==="builtin"?s:o[d]??[],m=new Map;for(const g of s)m.set(g.name,g.displayName||g.name);for(const[g,v]of Object.entries(o))for(const b of v)m.set(b.name,`${g} / ${b.serverToolName||b.name}`);return a.jsxs("div",{className:"grid gap-3 rounded-lg border p-4",children:[a.jsxs("div",{className:`grid gap-3 ${l==="mcp"?"sm:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]":"sm:grid-cols-[minmax(0,1fr)]"}`,children:[a.jsxs(Ii,{value:l,onValueChange:g=>{c(g),h("")},children:[a.jsx(Ei,{id:`${e}-kind`,className:"w-full","aria-label":i("agent.create.tools.type"),children:a.jsx(Ri,{})}),a.jsxs(Ai,{children:[a.jsx(Br,{value:"builtin",children:i("agent.create.tools.builtin")}),a.jsx(Br,{value:"mcp",children:i("agent.create.tools.mcp")})]})]}),l==="mcp"?a.jsxs(Ii,{value:d||void 0,onValueChange:h,children:[a.jsx(Ei,{id:`${e}-server`,className:"w-full","aria-label":i("agent.create.tools.selectServer"),children:a.jsx(Ri,{placeholder:i("agent.create.tools.selectServer")})}),a.jsx(Ai,{children:f.map(g=>a.jsxs(Br,{value:g.name,disabled:g.mcpStatus!=="connected"&&(o[g.name]?.length??0)===0,children:[g.name,g.mcpStatus?` · ${i(`mcp.status.${g.mcpStatus}`)}`:""]},g.name))})]}):null]}),a.jsx("div",{className:"max-h-64 overflow-y-auto rounded-md border",children:p.length>0?a.jsx(Ou,{delayDuration:300,children:a.jsx("div",{className:"divide-y",children:p.map(g=>{const v=l==="builtin"?g.displayName||g.name:g.serverToolName||g.name;return a.jsxs("label",{className:"flex cursor-pointer items-start gap-3 px-3 py-2.5 hover:bg-accent/30",children:[a.jsx(bm,{id:`${e}-${g.name}`,checked:t.has(g.name),onCheckedChange:b=>n(ohe(t,g.name,b===!0))}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block truncate text-sm font-medium",children:v}),g.description?a.jsxs(Hc,{children:[a.jsx(qc,{asChild:!0,children:a.jsx("span",{className:"mt-0.5 block truncate text-xs text-muted-foreground",children:g.description})}),a.jsx(Vc,{className:"max-w-sm whitespace-normal",children:g.description})]}):null]})]},g.name)})})}):a.jsx("div",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:i("agent.create.tools.empty")})}),t.size>0?a.jsx("div",{className:"flex flex-wrap gap-2",children:[...t].map(g=>a.jsxs("span",{className:"inline-flex max-w-full items-center gap-1 rounded-md bg-muted px-2 py-1 text-sm",title:g,children:[a.jsx("span",{className:"truncate",children:m.get(g)||g}),a.jsx("button",{type:"button",className:"rounded-sm text-muted-foreground hover:text-foreground","aria-label":i("agent.create.removeSelection",{name:g}),onClick:()=>n(ohe(t,g,!1)),children:a.jsx(Yh,{className:"size-3.5"})})]},g))}):a.jsx("div",{className:"text-sm text-muted-foreground",children:i("agent.create.tools.noneSelected")})]})}function RJn({selection:e,onSelectionChange:t,servers:n,t:s}){return a.jsx("div",{className:"max-h-64 overflow-y-auto rounded-lg border",children:n.length>0?a.jsx("div",{className:"divide-y",children:n.map(r=>a.jsxs("label",{className:"flex cursor-pointer items-center gap-3 px-3 py-2.5 hover:bg-accent/30",children:[a.jsx(bm,{id:`agent-mcp-server-${r.name}`,checked:e.has(r.name),onCheckedChange:o=>t(ohe(e,r.name,o===!0))}),a.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:r.name}),r.mcpStatus?a.jsx(Qr,{variant:"secondary",className:r.mcpStatus==="connected"?"bg-[var(--success-bg)] text-[var(--success-color)]":void 0,children:s(`mcp.status.${r.mcpStatus}`)}):null]},r.name))}):a.jsx("div",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:s("agent.create.mcpServers.empty")})})}function A6e(e,t){return t(e==="inherit"||e==="bubble"?`agent.approval.${e}`:`mode.listLabel.${e}`)}function EJn(e,t){return t(e==="inherit"||e==="bubble"?`agent.approval.desc.${e}`:`mode.desc.${e}`)}function j6e({label:e}){return a.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[a.jsx(Ur,{}),e]})}function AJn({error:e}){return a.jsx("div",{className:"text-sm text-destructive",children:e?.message})}const jJn=u.lazy(async()=>({default:(await bt(()=>import("./agents-route-Bp0Yjhm4.js"),__vite__mapDeps([93,94]))).AgentsRoute}));function NJn(e){return a.jsx(u.Suspense,{fallback:null,children:a.jsx(jJn,{...e})})}function lT({className:e,...t}){return a.jsx("nav",{"aria-label":"breadcrumb","data-slot":"breadcrumb",className:Ts(e),...t})}function cT({className:e,...t}){return a.jsx("ol",{"data-slot":"breadcrumb-list",className:Ts("flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground",e),...t})}function nd({className:e,...t}){return a.jsx("li",{"data-slot":"breadcrumb-item",className:Ts("inline-flex items-center gap-1",e),...t})}function Gx({asChild:e,className:t,...n}){const s=e?Ome:"a";return a.jsx(s,{"data-slot":"breadcrumb-link",className:Ts("transition-colors hover:text-foreground",t),...n})}function lg({className:e,...t}){return a.jsx("span",{"data-slot":"breadcrumb-page",role:"link","aria-disabled":"true","aria-current":"page",className:Ts("font-normal text-foreground",e),...t})}function Kx({children:e,className:t,...n}){return a.jsx("li",{"data-slot":"breadcrumb-separator",role:"presentation","aria-hidden":"true",className:Ts("[&>svg]:size-3.5",t),...n,children:e??a.jsx(Ol,{})})}const MJn=tA("group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent hover:bg-muted"},size:{default:"h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",sm:"h-7 min-w-7 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2"}},defaultVariants:{variant:"default",size:"default"}}),xat=u.createContext({size:"default",variant:"default",spacing:2,orientation:"horizontal"});function vbe({className:e,variant:t,size:n,spacing:s=2,orientation:r="horizontal",children:o,...i}){return a.jsx(vge,{orientation:r,"data-slot":"toggle-group","data-variant":t,"data-size":n,"data-spacing":s,"data-orientation":r,style:{"--gap":s},className:Ts("group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-vertical:flex-col data-vertical:items-stretch",e),...i,children:a.jsx(xat.Provider,{value:{variant:t,size:n,spacing:s,orientation:r},children:o})})}function ybe({className:e,children:t,variant:n="default",size:s="default",...r}){const o=u.useContext(xat);return a.jsx(cqe,{"data-slot":"toggle-group-item","data-variant":o.variant||n,"data-size":o.size||s,"data-spacing":o.spacing,className:Ts("shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pr-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:pl-1.5 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t",MJn({variant:o.variant||n,size:o.size||s}),e),...r,children:t})}const PJn="_agentGrid_1rdw6_1",DJn={agentGrid:PJn};function Are(e,t){return e==="project"?t("agent.level.project"):e==="user"?t("agent.level.user"):e==="builtin"?t("agent.level.builtin"):e==="extension"?t("agent.level.extension"):e}function LJn(e,t){return e?e==="inherit"||e==="bubble"?t(`agent.approval.${e}`):UM.some(n=>n===e)?t(`mode.listLabel.${e}`):e:"—"}function HI({label:e,value:t}){return a.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[a.jsx("div",{className:"text-sm font-medium",children:e}),a.jsx("div",{className:"break-words text-sm text-muted-foreground",children:t})]})}function N6e(e){return e?JSON.stringify(e,null,2):"—"}function OJn(e){return e.replace(/\r\n?/g,`
|
|
2699
|
+
${ze}`,{signal:Qt.signal})){if(ht.current[Bt]!==jt)return;if(vt.type==="delta")Qe+=vt.text,wn(Qe);else if(vt.type==="error")throw new Error(vt.message)}if(ht.current[Bt]!==jt)return;wn(Qe.trim())}catch(ze){if(ht.current[Bt]!==jt||Qt.signal.aborted)return;we(d("agent.create.generateFailed",{error:ze instanceof Error?ze.message:String(ze)}))}finally{ht.current[Bt]===jt&&(Ke(ze=>{const Qe=new Set(ze);return Qe.delete(Bt),Qe}),We.current[Bt]===Qt&&delete We.current[Bt])}}function nn(){M(je.trim()),D(q.trim()),Tn(!1)}function Nt(Bt){const gt=t?.mcpServers?.[Bt];if(bC(gt))return gt;const jt=Ot[Bt];if(bC(jt))return jt;const Qt=I==="workspace"?Ft.find(wn=>wn.name===Bt)?.config:void 0;return bC(Qt)?Qt:void 0}async function Jt(){if(!Un){Dt(d("agent.create.required"));return}it(!0),Dt(null);try{if(c){const vt=Number(ue);if(!Number.isInteger(vt)||vt<1||vt>8)throw new Error(d("collab.agent.concurrencyInvalid"));const rt=T.trim();await c({name:rt,...A.trim()?{description:A.trim()}:{},...P.trim()?{instructions:P.trim()}:{},...ae?{agentType:ae}:{},...O.trim()?{model:O.trim()}:{},maxConcurrentRuns:vt,...X.size>0?{execution:{mode:"managed-host",hostIds:[...X],...G?{provider:G}:{}}}:G&&G!=="qwen"?{execution:{mode:"local",provider:G}}:{}}),s(rt);return}const Bt=re.trim()?Number(re.trim()):void 0;if(Bt!==void 0&&(!Number.isSafeInteger(Bt)||Bt<=0))throw new Error(d("agent.create.maxTurnsInvalid"));const gt=[...z],jt=[...$],Qt=SJn(Ne,"hooks"),wn=Object.fromEntries([...ve].flatMap(vt=>{const rt=Nt(vt);return rt?[[vt,rt]]:[]})),ze={description:A.trim(),systemPrompt:P.trim(),tools:t||gt.length>0?gt:void 0,disallowedTools:t||jt.length>0?jt:void 0,mcpServers:t||Object.keys(wn).length>0?wn:void 0,hooks:t?Qt??{}:Qt},Qe=t?await p(t.name,{...ze,model:O.trim()||null,approvalMode:H==="inherit"?null:H,maxTurns:Bt??null,color:me==="inherit"?null:me},I):await f({name:T.trim(),scope:I,...ze,model:O.trim()||void 0,approvalMode:H==="inherit"?void 0:H,maxTurns:Bt,color:me==="inherit"?void 0:me});s(Qe.agent.name)}catch(Bt){Dt(CJn(Bt))}finally{it(!1)}}return a.jsxs("div",{className:"flex w-full max-w-5xl flex-col gap-6",children:[a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsx("h1",{className:"text-xl font-semibold text-balance",children:d(h?"collab.agent.new":t?"agent.edit":"agent.create")}),a.jsxs(Ae,{type:"button",variant:"outline",onClick:xs,children:[a.jsx(nk,{"data-icon":"inline-start"}),d("agent.create.modelGenerate")]})]}),_t?a.jsx(yg,{tone:"error",noticeKey:_t,closeLabel:d("common.close"),onDismiss:()=>Dt(null),children:_t}):null,h&&a.jsx("p",{className:"text-sm text-muted-foreground",children:d("collab.agent.joins",{project:o?.split(/[\\/]/).filter(Boolean).at(-1)??""})}),a.jsxs(Mv,{defaultValue:"overview",children:[!h&&a.jsxs(Pv,{className:"max-w-full overflow-x-auto",children:[a.jsx(ya,{value:"overview",children:d("agent.detail.overview")}),a.jsx(ya,{value:"prompt",children:d("agent.detail.systemPrompt")}),a.jsx(ya,{value:"tools",children:d("agent.detail.tools")}),a.jsx(ya,{value:"mcp",children:d("agent.detail.mcp")}),a.jsx(ya,{value:"hooks",children:d("agent.detail.hooks")})]}),a.jsx(Ll,{value:"overview",className:"pt-4",children:a.jsxs(S_,{className:"grid grid-cols-1 gap-5 lg:grid-cols-2",children:[h?null:a.jsxs(ea,{children:[a.jsx(Ca,{htmlFor:"agent-scope",children:d("agent.create.scope")}),a.jsxs(Ii,{value:I,disabled:!!t,onValueChange:Bt=>R(Bt),children:[a.jsx(Ei,{id:"agent-scope",className:"w-full",children:a.jsx(Ri,{})}),a.jsxs(Ai,{children:[a.jsx(Br,{value:"workspace",children:d("agent.create.project.cli")}),a.jsx(Br,{value:"global",children:d("agent.create.user.cli")})]})]})]}),a.jsxs(ea,{children:[a.jsx(Ca,{htmlFor:"agent-name",children:d("agent.create.name")}),a.jsx(gr,{id:"agent-name",value:T,onChange:Bt=>N(Bt.target.value),placeholder:d("agent.create.namePlaceholder"),disabled:!!t}),a.jsx(bl,{children:d(h?"collab.agent.nameHelp":"agent.create.nameHelp")})]}),h&&a.jsxs(ea,{children:[a.jsx(Ca,{htmlFor:"agent-role",children:d("collab.agent.role")}),a.jsxs(Ii,{value:ae||Ere,disabled:X.size>0,onValueChange:Bt=>se(Bt===Ere?"":Bt),children:[a.jsx(Ei,{id:"agent-role",className:"w-full",children:a.jsx(Ri,{})}),a.jsxs(Ai,{children:[a.jsx(Br,{value:Ere,children:d("collab.agent.roleNone")}),g.map(Bt=>a.jsx(Br,{value:Bt.name,children:Bt.name},Bt.name))]})]}),a.jsx(bl,{children:d("collab.agent.roleHint")})]}),h&&a.jsxs(ea,{className:"lg:col-span-2",children:[a.jsx(Ca,{htmlFor:"agent-workspace-prompt",children:d("collab.agent.instructions")}),a.jsx(hm,{id:"agent-workspace-prompt",value:P,onChange:Bt=>D(Bt.target.value),rows:6,placeholder:d("collab.agent.instructionsHint")})]}),a.jsxs(ea,{className:"lg:col-span-2",children:[a.jsx(Ca,{htmlFor:"agent-description",children:d(h?"collab.agent.description":"agent.create.description")}),a.jsx(hm,{id:"agent-description",value:A,onChange:Bt=>M(Bt.target.value),placeholder:d("agent.create.manualDescPlaceholder"),rows:3})]}),a.jsxs(ea,{children:[a.jsx(Ca,{htmlFor:"agent-model",children:d("agent.create.model")}),a.jsx(gr,{id:"agent-model",disabled:h&&X.size>0,value:O,onChange:Bt=>W(Bt.target.value),placeholder:"inherit / fast / provider:model"})]}),h?a.jsxs(a.Fragment,{children:[a.jsxs(ea,{children:[a.jsx(Ca,{htmlFor:"agent-concurrency",children:d("collab.agent.concurrency")}),a.jsx(gr,{id:"agent-concurrency",type:"number",min:"1",max:"8",step:"1",value:ue,onChange:Bt=>de(Bt.target.value)})]}),a.jsxs(ea,{className:"lg:col-span-2",children:[a.jsx(Ca,{children:d("collab.agent.runsOn")}),a.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[a.jsxs("label",{className:"flex items-start gap-2 rounded-md border border-border p-3 text-sm",children:[a.jsx("input",{type:"radio",name:"agent-execution-location",checked:X.size===0,onChange:()=>{pe(new Set),Y(U[0])}}),a.jsxs("span",{children:[d("collab.agent.thisComputer"),a.jsx("span",{className:"block break-all text-xs text-muted-foreground",children:o})]})]}),r.map(Bt=>a.jsxs("label",{className:"flex items-start gap-2 rounded-md border border-border p-3 text-sm",children:[a.jsx("input",{type:"radio",name:"agent-execution-location",checked:X.has(Bt.id),onChange:()=>{pe(new Set([Bt.id])),Y(Cz(Bt)[0]),se(""),W("")}}),a.jsxs("span",{children:[Bt.label,Bt.status==="offline"&&a.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:d("collab.agentStatus.offline")}),a.jsx("span",{className:"block break-all text-xs text-muted-foreground",children:Bt.workspaceCwd??d("collab.agent.cwdUnknown")})]})]},Bt.id))]}),a.jsx(bl,{children:d(X.size>0?"collab.agent.hostPersona":"collab.agent.runsOnHint")})]}),(()=>{const Bt=r.find(Qt=>X.has(Qt.id)),gt=Bt?Cz(Bt):U,jt=Qt=>gt.includes(Qt)?void 0:d(Bt||l!==void 0?"collab.agent.programMissing":"collab.agent.programLocal");return a.jsxs(ea,{className:"lg:col-span-2",children:[a.jsx(Ca,{children:d("collab.runtime.program")}),a.jsx("div",{role:"radiogroup","aria-label":d("collab.runtime.program"),className:"grid gap-2 sm:grid-cols-2",children:wat.map(Qt=>{const wn=jt(Qt);return a.jsxs("label",{className:"flex items-start gap-2 rounded-md border border-border p-3 text-sm has-[:disabled]:opacity-60",children:[a.jsx("input",{type:"radio",name:"agent-execution-provider",disabled:wn!==void 0,checked:G===Qt,onChange:()=>Y(Qt)}),a.jsxs("span",{children:[bat(Qt),wn&&a.jsx("span",{className:"block text-xs text-muted-foreground",children:wn})]})]},Qt)})})]})})(),a.jsx(ea,{className:"lg:col-span-2",children:a.jsx(bl,{children:d("collab.agent.afterCreate")})})]}):a.jsxs(a.Fragment,{children:[a.jsxs(ea,{children:[a.jsx(Ca,{htmlFor:"agent-approval",children:d("agent.create.approvalMode")}),a.jsxs(Ii,{value:H,onValueChange:Q,children:[a.jsx(Ei,{id:"agent-approval",className:"w-full",children:a.jsx(Ri,{children:A6e(H,d)})}),a.jsx(Ai,{children:V.map(Bt=>a.jsx(Br,{value:Bt,disabled:Bt==="bubble",children:A6e(Bt,d)},Bt))})]}),a.jsx(bl,{children:EJn(H,d)})]}),a.jsxs(ea,{children:[a.jsx(Ca,{htmlFor:"agent-max-turns",children:d("agent.create.maxTurns")}),a.jsx(gr,{id:"agent-max-turns",type:"number",min:"1",step:"1",value:re,onChange:Bt=>Z(Bt.target.value)}),a.jsx(bl,{children:d("agent.create.maxTurnsHelp")})]}),a.jsxs(ea,{children:[a.jsx(Ca,{htmlFor:"agent-color",children:d("agent.create.color")}),a.jsxs(Ii,{value:me,onValueChange:ye,children:[a.jsx(Ei,{id:"agent-color",className:"w-full",children:a.jsx(Ri,{})}),a.jsx(Ai,{children:["inherit","auto","red","blue","green","yellow","purple","orange","pink","cyan"].map(Bt=>a.jsx(Br,{value:Bt,children:Bt},Bt))})]})]})]})]})}),!h&&a.jsx(Ll,{value:"prompt",className:"pt-4",children:a.jsxs(ea,{children:[a.jsx(hm,{id:"agent-prompt","aria-label":d("agent.create.prompt"),value:P,onChange:Bt=>D(Bt.target.value),placeholder:d("agent.create.promptPlaceholder.cli"),rows:16,className:"min-h-80 max-h-[60vh] overflow-y-auto"}),a.jsx(bl,{children:d("agent.create.promptHelp")})]})}),a.jsx(Ll,{value:"tools",className:"pt-4",children:a.jsxs(S_,{children:[a.jsxs(ea,{children:[a.jsx(Ca,{children:d("agent.create.tools")}),a.jsx(bl,{children:d("agent.create.toolsSelectHelp")}),a.jsx(E6e,{idPrefix:"agent-allowed-tool",selection:z,onSelectionChange:B,builtInTools:tt,mcpServers:Mt,mcpTools:ce,t:d}),Be||fe?a.jsx(j6e,{label:d("agent.create.tools.initializing")}):null,Ve||Me?a.jsx("div",{className:"whitespace-pre-wrap text-sm text-destructive",children:Ve||Me}):null]}),a.jsxs(ea,{children:[a.jsx(Ca,{children:d("agent.create.disallowedTools")}),a.jsx(E6e,{idPrefix:"agent-disallowed-tool",selection:$,onSelectionChange:L,builtInTools:tt,mcpServers:Mt,mcpTools:ce,t:d})]})]})}),a.jsx(Ll,{value:"mcp",className:"pt-4",children:a.jsxs(ea,{children:[a.jsx(Ca,{children:d("agent.create.mcpServers")}),a.jsx(RJn,{selection:ve,onSelectionChange:Te,servers:Mt,t:d}),y.loading?a.jsx(j6e,{label:d("common.loading")}):y.error?a.jsx(AJn,{error:y.error}):null]})}),a.jsx(Ll,{value:"hooks",className:"pt-4",children:a.jsxs(ea,{children:[a.jsx(Ca,{htmlFor:"agent-hooks",children:"Hooks"}),a.jsx(hm,{id:"agent-hooks",value:Ne,onChange:Bt=>Ie(Bt.target.value),placeholder:'{"PreToolUse":[...] }',rows:10,className:"min-h-64 max-h-[60vh] overflow-y-auto font-mono text-xs"}),a.jsx(bl,{children:d("agent.create.jsonObjectHelp")})]})})]}),a.jsxs("div",{className:"flex justify-end gap-2 border-t pt-4",children:[a.jsx(Ae,{variant:"outline",onClick:n,disabled:lt,children:d("common.cancel")}),a.jsxs(Ae,{onClick:()=>void Jt(),disabled:!Un||lt,children:[lt?a.jsx(Ur,{"data-icon":"inline-start"}):null,d(t?"agent.edit.save":"agent.create.save")]})]}),a.jsx(Td,{open:Fe,onOpenChange:Tn,children:a.jsxs(Id,{className:"max-h-[calc(100vh-2rem)] overflow-y-auto sm:max-w-2xl",children:[a.jsxs(fu,{children:[a.jsx(Rd,{children:d("agent.create.modelGenerate")}),a.jsx($u,{children:d("agent.create.modelGenerate.description")})]}),Rt?a.jsx(yg,{tone:"error",noticeKey:Rt,closeLabel:d("common.close"),onDismiss:()=>we(null),children:Rt}):null,a.jsxs(S_,{children:[a.jsxs(ea,{children:[a.jsx(Ca,{htmlFor:"agent-generation-requirements",children:d("agent.create.describeAgent")}),a.jsx(hm,{id:"agent-generation-requirements",value:_e,onChange:Bt=>Ce(Bt.target.value),placeholder:d("agent.create.qwenPlaceholder"),rows:4}),a.jsx(bl,{children:d("agent.create.qwenHint")})]}),a.jsxs(ea,{children:[a.jsx(R6e,{htmlFor:"agent-generated-description",label:d("agent.create.generatedDescription"),active:Tt.has("description"),disabled:!_e.trim(),onGenerate:()=>void ln("description"),onCancel:()=>Et("description"),t:d}),a.jsx(hm,{id:"agent-generated-description",value:je,onChange:Bt=>Ue(Bt.target.value),rows:3,readOnly:Tt.has("description")})]}),a.jsxs(ea,{children:[a.jsx(R6e,{htmlFor:"agent-generated-prompt",label:d("agent.create.generatedSystemPrompt"),active:Tt.has("systemPrompt"),disabled:!_e.trim(),onGenerate:()=>void ln("systemPrompt"),onCancel:()=>Et("systemPrompt"),t:d}),a.jsx(hm,{id:"agent-generated-prompt",value:q,onChange:Bt=>J(Bt.target.value),rows:10,readOnly:Tt.has("systemPrompt"),className:"min-h-64 max-h-64 overflow-y-auto"})]})]}),a.jsxs(Hp,{children:[a.jsx(Ae,{type:"button",variant:"outline",onClick:()=>Tn(!1),children:d("common.cancel")}),a.jsx(Ae,{type:"button",onClick:nn,disabled:Tt.size>0||!je.trim()||!q.trim(),children:d("agent.create.useGenerated")})]})]})})]})}function R6e({htmlFor:e,label:t,active:n,disabled:s,onGenerate:r,onCancel:o,t:i}){return a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ca,{htmlFor:e,children:t}),n?a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground",children:[a.jsx(Ur,{className:"size-3"}),i("agent.create.generatingPrompt")]}),a.jsx(Ae,{type:"button",variant:"outline",size:"sm",className:"ml-auto",onClick:o,children:i("common.cancel")})]}):a.jsxs(Ae,{type:"button",variant:"outline",size:"sm",className:"ml-auto",disabled:s,onClick:r,children:[a.jsx(nk,{"data-icon":"inline-start"}),i("agent.create.generate")]})]})}function E6e({idPrefix:e,selection:t,onSelectionChange:n,builtInTools:s,mcpServers:r,mcpTools:o,t:i}){const[l,c]=u.useState("builtin"),[d,h]=u.useState(""),f=r.filter(g=>!g.disabled),p=l==="builtin"?s:o[d]??[],m=new Map;for(const g of s)m.set(g.name,g.displayName||g.name);for(const[g,v]of Object.entries(o))for(const b of v)m.set(b.name,`${g} / ${b.serverToolName||b.name}`);return a.jsxs("div",{className:"grid gap-3 rounded-lg border p-4",children:[a.jsxs("div",{className:`grid gap-3 ${l==="mcp"?"sm:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]":"sm:grid-cols-[minmax(0,1fr)]"}`,children:[a.jsxs(Ii,{value:l,onValueChange:g=>{c(g),h("")},children:[a.jsx(Ei,{id:`${e}-kind`,className:"w-full","aria-label":i("agent.create.tools.type"),children:a.jsx(Ri,{})}),a.jsxs(Ai,{children:[a.jsx(Br,{value:"builtin",children:i("agent.create.tools.builtin")}),a.jsx(Br,{value:"mcp",children:i("agent.create.tools.mcp")})]})]}),l==="mcp"?a.jsxs(Ii,{value:d||void 0,onValueChange:h,children:[a.jsx(Ei,{id:`${e}-server`,className:"w-full","aria-label":i("agent.create.tools.selectServer"),children:a.jsx(Ri,{placeholder:i("agent.create.tools.selectServer")})}),a.jsx(Ai,{children:f.map(g=>a.jsxs(Br,{value:g.name,disabled:g.mcpStatus!=="connected"&&(o[g.name]?.length??0)===0,children:[g.name,g.mcpStatus?` · ${i(`mcp.status.${g.mcpStatus}`)}`:""]},g.name))})]}):null]}),a.jsx("div",{className:"max-h-64 overflow-y-auto rounded-md border",children:p.length>0?a.jsx(Ou,{delayDuration:300,children:a.jsx("div",{className:"divide-y",children:p.map(g=>{const v=l==="builtin"?g.displayName||g.name:g.serverToolName||g.name;return a.jsxs("label",{className:"flex cursor-pointer items-start gap-3 px-3 py-2.5 hover:bg-accent/30",children:[a.jsx(bm,{id:`${e}-${g.name}`,checked:t.has(g.name),onCheckedChange:b=>n(ohe(t,g.name,b===!0))}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block truncate text-sm font-medium",children:v}),g.description?a.jsxs(Hc,{children:[a.jsx(qc,{asChild:!0,children:a.jsx("span",{className:"mt-0.5 block truncate text-xs text-muted-foreground",children:g.description})}),a.jsx(Vc,{className:"max-w-sm whitespace-normal",children:g.description})]}):null]})]},g.name)})})}):a.jsx("div",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:i("agent.create.tools.empty")})}),t.size>0?a.jsx("div",{className:"flex flex-wrap gap-2",children:[...t].map(g=>a.jsxs("span",{className:"inline-flex max-w-full items-center gap-1 rounded-md bg-muted px-2 py-1 text-sm",title:g,children:[a.jsx("span",{className:"truncate",children:m.get(g)||g}),a.jsx("button",{type:"button",className:"rounded-sm text-muted-foreground hover:text-foreground","aria-label":i("agent.create.removeSelection",{name:g}),onClick:()=>n(ohe(t,g,!1)),children:a.jsx(Yh,{className:"size-3.5"})})]},g))}):a.jsx("div",{className:"text-sm text-muted-foreground",children:i("agent.create.tools.noneSelected")})]})}function RJn({selection:e,onSelectionChange:t,servers:n,t:s}){return a.jsx("div",{className:"max-h-64 overflow-y-auto rounded-lg border",children:n.length>0?a.jsx("div",{className:"divide-y",children:n.map(r=>a.jsxs("label",{className:"flex cursor-pointer items-center gap-3 px-3 py-2.5 hover:bg-accent/30",children:[a.jsx(bm,{id:`agent-mcp-server-${r.name}`,checked:e.has(r.name),onCheckedChange:o=>t(ohe(e,r.name,o===!0))}),a.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:r.name}),r.mcpStatus?a.jsx(Qr,{variant:"secondary",className:r.mcpStatus==="connected"?"bg-[var(--success-bg)] text-[var(--success-color)]":void 0,children:s(`mcp.status.${r.mcpStatus}`)}):null]},r.name))}):a.jsx("div",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:s("agent.create.mcpServers.empty")})})}function A6e(e,t){return t(e==="inherit"||e==="bubble"?`agent.approval.${e}`:`mode.listLabel.${e}`)}function EJn(e,t){return t(e==="inherit"||e==="bubble"?`agent.approval.desc.${e}`:`mode.desc.${e}`)}function j6e({label:e}){return a.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[a.jsx(Ur,{}),e]})}function AJn({error:e}){return a.jsx("div",{className:"text-sm text-destructive",children:e?.message})}const jJn=u.lazy(async()=>({default:(await bt(()=>import("./agents-route-4f6fKJaY.js"),__vite__mapDeps([93,94]))).AgentsRoute}));function NJn(e){return a.jsx(u.Suspense,{fallback:null,children:a.jsx(jJn,{...e})})}function lT({className:e,...t}){return a.jsx("nav",{"aria-label":"breadcrumb","data-slot":"breadcrumb",className:Ts(e),...t})}function cT({className:e,...t}){return a.jsx("ol",{"data-slot":"breadcrumb-list",className:Ts("flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground",e),...t})}function nd({className:e,...t}){return a.jsx("li",{"data-slot":"breadcrumb-item",className:Ts("inline-flex items-center gap-1",e),...t})}function Gx({asChild:e,className:t,...n}){const s=e?Ome:"a";return a.jsx(s,{"data-slot":"breadcrumb-link",className:Ts("transition-colors hover:text-foreground",t),...n})}function lg({className:e,...t}){return a.jsx("span",{"data-slot":"breadcrumb-page",role:"link","aria-disabled":"true","aria-current":"page",className:Ts("font-normal text-foreground",e),...t})}function Kx({children:e,className:t,...n}){return a.jsx("li",{"data-slot":"breadcrumb-separator",role:"presentation","aria-hidden":"true",className:Ts("[&>svg]:size-3.5",t),...n,children:e??a.jsx(Ol,{})})}const MJn=tA("group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent hover:bg-muted"},size:{default:"h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",sm:"h-7 min-w-7 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2"}},defaultVariants:{variant:"default",size:"default"}}),xat=u.createContext({size:"default",variant:"default",spacing:2,orientation:"horizontal"});function vbe({className:e,variant:t,size:n,spacing:s=2,orientation:r="horizontal",children:o,...i}){return a.jsx(vge,{orientation:r,"data-slot":"toggle-group","data-variant":t,"data-size":n,"data-spacing":s,"data-orientation":r,style:{"--gap":s},className:Ts("group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-vertical:flex-col data-vertical:items-stretch",e),...i,children:a.jsx(xat.Provider,{value:{variant:t,size:n,spacing:s,orientation:r},children:o})})}function ybe({className:e,children:t,variant:n="default",size:s="default",...r}){const o=u.useContext(xat);return a.jsx(cqe,{"data-slot":"toggle-group-item","data-variant":o.variant||n,"data-size":o.size||s,"data-spacing":o.spacing,className:Ts("shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pr-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:pl-1.5 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t",MJn({variant:o.variant||n,size:o.size||s}),e),...r,children:t})}const PJn="_agentGrid_1rdw6_1",DJn={agentGrid:PJn};function Are(e,t){return e==="project"?t("agent.level.project"):e==="user"?t("agent.level.user"):e==="builtin"?t("agent.level.builtin"):e==="extension"?t("agent.level.extension"):e}function LJn(e,t){return e?e==="inherit"||e==="bubble"?t(`agent.approval.${e}`):UM.some(n=>n===e)?t(`mode.listLabel.${e}`):e:"—"}function HI({label:e,value:t}){return a.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[a.jsx("div",{className:"text-sm font-medium",children:e}),a.jsx("div",{className:"break-words text-sm text-muted-foreground",children:t})]})}function N6e(e){return e?JSON.stringify(e,null,2):"—"}function OJn(e){return e.replace(/\r\n?/g,`
|
|
2700
2700
|
`).replace(/(?<!\n)\n(?!\n|[ \t]*(?:#{1,6}\s|[-*+]\s|\d+\.\s|```|>\s|\*\*[^*\n]+\*\*:))/g," ")}function kat({initialAgentView:e,onClose:t,embedded:n,initialCreateScope:s,workspaceCwd:r,onMentionAgent:o}){const{t:i}=et(),{agents:l,loading:c,error:d,reload:h,getAgent:f,deleteAgent:p}=rze({autoLoad:!0}),[m,g]=u.useState(""),[v,b]=u.useState("all"),[y,w]=u.useState(null),[x,k]=u.useState(null),[_,S]=u.useState(!1),[E,j]=u.useState(!1),[I,R]=u.useState(!1),[T,N]=u.useState(()=>!!s),[A,M]=u.useState(!1),P=Co(),D=Lit(P.capabilities,r),[z,B]=u.useState(()=>!s&&!n&&D);u.useEffect(()=>{D||B(!1)},[D]);const[$,L]=u.useState(null),[O,W]=u.useState(null),[H,Q]=u.useState(null),[V,re]=u.useState(!1),Z=u.useMemo(()=>wJn(l,m,v),[l,m,v]),ue=u.useMemo(()=>_6e(y,l),[l,y]),de=y?.name??null;u.useEffect(()=>{w(se=>_6e(se,l))},[l]),u.useEffect(()=>{n?.onDetailChange(!!(de||T||A||z))},[T,A,n,z,de]),u.useEffect(()=>{if(!y){k(null),Q(null);return}let se=!0;return k(null),Q(null),S(!0),f(y.name,C6e(y.level)).then(me=>{se&&k(me)}).catch(me=>{se&&Q(me instanceof Error?me.message:String(me))}).finally(()=>{se&&S(!1)}),()=>{se=!1}},[y,f]),u.useEffect(()=>{re(!1)},[d]),u.useEffect(()=>{s&&(B(!1),N(!0))},[s]);function U(){B(!1),N(!1),M(!1),w(null),k(null),W(null),h()}async function G(){if(!x||!ue)return;const se=C6e(ue.level);if(se){j(!0);try{await p(ue.name,se),R(!1),w(null),k(null),L(i("agent.deleted",{name:x.name})),await h()}catch(me){R(!1),W(me instanceof Error?me.message:String(me))}finally{j(!1)}}}const Y=[{value:"all",label:i("skills.filter.all")},{value:"project",label:i("agent.level.project")},{value:"user",label:i("agent.level.user")},{value:"builtin",label:i("agent.level.builtin")},{value:"extension",label:i("agent.level.extension")}],X=A?i("agent.edit"):de??(T?i("agent.create.button"):null),pe=a.jsx(lT,{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:a.jsxs(cT,{className:"text-base",children:[a.jsx(nd,{children:a.jsx(Ae,{variant:"ghost",size:"icon",onClick:t,"aria-label":i("common.back"),children:a.jsx(Up,{})})}),a.jsx(nd,{children:X?a.jsx(Gx,{asChild:!0,children:a.jsx("button",{type:"button",onClick:U,children:i("agents.title")})}):a.jsx(lg,{children:i("agents.title")})}),X?a.jsx(Kx,{}):null,X?a.jsx(nd,{children:a.jsx(lg,{children:X})}):null]})}),ae=n?X?a.jsx(lT,{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:a.jsxs(cT,{className:"h-8 text-sm",children:[n.onBack?a.jsx(nd,{children:a.jsx(Ae,{variant:"ghost",size:"icon",onClick:n.onBack,"aria-label":i("common.back"),children:a.jsx(Up,{})})}):null,a.jsx(nd,{children:a.jsx(Gx,{asChild:!0,children:a.jsx("button",{type:"button",onClick:()=>{U(),n.onDetailChange(!1)},children:i("agents.title")})})}),a.jsx(Kx,{}),a.jsx(nd,{children:a.jsx(lg,{children:X})})]})}):null:pe;if(z&&D)return a.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[ae,a.jsx(NJn,{initialView:e,workspaceCwd:r,...o?{onMentionAgent:o}:{},onOpenDefinitions:()=>B(!1)})]});if(T)return a.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[ae,a.jsx(I6e,{initialScope:s??"global",onCancel:U,onCreated:se=>{N(!1),L(i("agent.created",{name:se})),h()}})]});if(A&&x)return a.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[ae,a.jsx(I6e,{agent:x,onCancel:()=>M(!1),onCreated:se=>{M(!1),w(null),k(null),L(i("agent.updated",{name:se})),h()}})]});if(de&&x){const se=bJn(x),me=!x.tools||x.tools.length===0||x.tools.includes("*")?i("agent.create.tools.all"):x.tools.join(", "),ye=x.disallowedTools?.join(", ")||"—";return a.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[ae,a.jsxs("div",{className:"flex w-full flex-col gap-6",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("div",{className:"flex size-12 shrink-0 items-center justify-center rounded-xl bg-muted",children:a.jsx(tk,{})}),a.jsx("div",{className:"min-w-0 flex-1",children:a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx("h1",{className:"break-words text-xl font-semibold text-balance",children:x.name}),a.jsx(Qr,{variant:"outline",children:Are(x.level,i)}),S6e(x,l)?a.jsx(Qr,{variant:"secondary",children:i("agent.overriddenBadge")}):null]})}),se?a.jsxs(tf,{children:[a.jsx(Eh,{asChild:!0,children:a.jsx(Ae,{variant:"ghost",size:"icon",disabled:E,"aria-label":i("agent.chooseAction",{name:x.name}),children:E?a.jsx(Ur,{}):a.jsx(vb,{})})}),a.jsx(Ah,{align:"end",onCloseAutoFocus:ve=>ve.preventDefault(),children:a.jsxs(B_,{children:[a.jsxs(jr,{onSelect:()=>M(!0),children:[a.jsx(cb,{"data-icon":"inline-start"}),i("agent.edit")]}),a.jsxs(jr,{variant:"destructive",disabled:E,onSelect:()=>R(!0),children:[a.jsx(Tf,{"data-icon":"inline-start"}),i("agent.delete")]})]})})]}):null]}),O?a.jsx(yg,{tone:"error",noticeKey:O,closeLabel:i("common.close"),onDismiss:()=>W(null),children:O}):null,a.jsxs(Mv,{defaultValue:"overview",children:[a.jsxs(Pv,{className:"max-w-full overflow-x-auto",children:[a.jsx(ya,{value:"overview",children:i("agent.detail.overview")}),a.jsx(ya,{value:"prompt",children:i("agent.detail.systemPrompt")}),a.jsx(ya,{value:"tools",children:i("agent.detail.tools")}),a.jsx(ya,{value:"mcp",children:i("agent.detail.mcp")}),a.jsx(ya,{value:"hooks",children:i("agent.detail.hooks")})]}),a.jsx(Ll,{value:"overview",className:"pt-4",children:a.jsxs(Vl,{children:[a.jsxs(cu,{children:[a.jsx(du,{className:"text-sm",children:i("agent.descriptionLabel")}),a.jsx(Sv,{children:x.description||"—"})]}),a.jsxs(Gd,{className:"grid gap-6 sm:grid-cols-2",children:[a.jsx(HI,{label:i("agent.filePathLabel"),value:x.filePath||"—"}),a.jsx(HI,{label:i("agent.modelLabel"),value:x.model||"—"}),a.jsx(HI,{label:i("agent.level.label"),value:Are(x.level,i)}),a.jsx(HI,{label:i("agent.create.approvalMode"),value:LJn(x.approvalMode||x.permissionMode,i)}),a.jsx(HI,{label:i("agent.create.maxTurns"),value:x.maxTurns?.toString()||"—"}),a.jsx(HI,{label:i("agent.create.color"),value:x.color||"—"})]})]})}),a.jsx(Ll,{value:"prompt",className:"pt-4",children:a.jsx(Vl,{children:a.jsx(Gd,{children:a.jsx("div",{className:"max-h-[60vh] w-full overflow-auto break-words whitespace-pre-line text-sm leading-6 text-muted-foreground",children:x.systemPrompt?OJn(x.systemPrompt):"—"})})})}),a.jsx(Ll,{value:"tools",className:"pt-4",children:a.jsxs(Vl,{children:[a.jsxs(cu,{children:[a.jsx(du,{className:"text-sm",children:i("agent.toolsLabel")}),a.jsx(Sv,{children:me})]}),a.jsx(Gd,{className:"flex flex-col gap-6",children:a.jsx(HI,{label:i("agent.create.disallowedTools"),value:ye})})]})}),a.jsx(Ll,{value:"mcp",className:"pt-4",children:a.jsxs(Vl,{children:[a.jsx(cu,{children:a.jsx(du,{className:"text-sm",children:i("agent.create.mcpServers")})}),a.jsx(Gd,{children:a.jsx("pre",{className:"max-h-64 overflow-auto whitespace-pre-wrap break-words text-xs text-muted-foreground",children:N6e(x.mcpServers)})})]})}),a.jsx(Ll,{value:"hooks",className:"pt-4",children:a.jsxs(Vl,{children:[a.jsx(cu,{children:a.jsx(du,{className:"text-sm",children:i("agent.detail.hooks")})}),a.jsx(Gd,{children:a.jsx("pre",{className:"max-h-64 overflow-auto whitespace-pre-wrap break-words text-xs text-muted-foreground",children:N6e(x.hooks)})})]})})]}),a.jsx(aw,{open:I,onOpenChange:ve=>{!ve&&E||R(ve)},children:a.jsxs(lw,{children:[a.jsxs(cw,{children:[a.jsx(uw,{children:i("agent.delete.title",{name:x.name})}),a.jsx(hw,{children:i("agent.delete.confirm",{name:x.name})})]}),a.jsxs(dw,{children:[a.jsx(fw,{disabled:E,children:i("common.cancel")}),a.jsxs(bk,{variant:"destructive",disabled:E,onClick:ve=>{ve.preventDefault(),G()},children:[E?a.jsx(Ur,{"data-icon":"inline-start"}):null,i("agent.delete.yes")]})]})]})})]})]})}return de&&_?a.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[ae,a.jsx("div",{className:"flex items-center justify-center py-12",children:a.jsx(Ur,{className:"size-6"})})]}):de&&H?a.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[ae,a.jsx(yg,{tone:"error",noticeKey:H,closeLabel:i("common.close"),onDismiss:U,children:H})]}):a.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[ae,a.jsxs("div",{className:"flex w-full flex-col gap-6",children:[a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-xl font-semibold text-balance",children:i("agents.title")}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground tabular-nums",children:i("agents.description")}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground tabular-nums",children:i("agent.count",{count:l.length})})]}),a.jsxs("div",{className:"flex gap-2",children:[D?a.jsx(Ae,{variant:"outline",onClick:()=>B(!0),children:i("collab.sharedThreads")}):null,a.jsxs(Ae,{variant:"outline",disabled:c,onClick:()=>void h(),children:[c?a.jsx(Ur,{"data-icon":"inline-start"}):a.jsx(ih,{"data-icon":"inline-start"}),i("common.refresh")]}),a.jsxs(Ae,{onClick:()=>N(!0),children:[a.jsx(Ef,{"data-icon":"inline-start"}),i("agent.create.button")]})]})]}),d&&!V?a.jsx(yg,{tone:"error",noticeKey:d.message,closeLabel:i("common.close"),onDismiss:()=>re(!0),children:d.message}):null,$?a.jsx(yg,{tone:"success",noticeKey:$,closeLabel:i("common.close"),onDismiss:()=>L(null),children:$}):null,a.jsxs("div",{className:"relative",children:[a.jsx(Wp,{className:"pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground"}),a.jsx(gr,{name:"agent-search","aria-label":i("common.search"),autoComplete:"off",value:m,onChange:se=>g(se.target.value),placeholder:i("common.search"),className:"pl-9"})]}),a.jsx(vbe,{type:"single",value:v,onValueChange:se=>{se&&b(se)},variant:"outline",size:"sm","aria-label":i("agent.level.filter"),children:Y.map(se=>a.jsx(ybe,{value:se.value,children:se.label},se.value))}),Z.length?a.jsx("div",{className:DJn.agentGrid,"data-column-count":Math.min(Z.length,4),children:Z.map(se=>a.jsx(Vl,{size:"sm",role:"button",tabIndex:0,"aria-label":se.name,className:"cursor-pointer transition-colors hover:bg-accent/30 focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-none",onClick:()=>{L(null),W(null),w({name:se.name,level:se.level})},onKeyDown:me=>{(me.key==="Enter"||me.key===" ")&&(me.preventDefault(),L(null),W(null),w({name:se.name,level:se.level}))},children:a.jsx(cu,{className:"block",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-lg bg-muted",children:a.jsx(tk,{className:"size-5"})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex min-w-0 items-start justify-between gap-2",children:[a.jsx(du,{className:"min-w-0 flex-1 truncate",children:se.name}),a.jsxs("div",{className:"flex shrink-0 gap-1",children:[a.jsx(Qr,{variant:"outline",className:"text-[10px]",children:Are(se.level,i)}),S6e(se,l)?a.jsx(Qr,{variant:"secondary",className:"text-[10px]",children:i("agent.overriddenBadge")}):null]})]}),a.jsx(Sv,{className:"mt-1 min-w-0 text-xs",children:a.jsx(Ou,{delayDuration:300,children:a.jsxs(Hc,{children:[a.jsx(qc,{asChild:!0,children:a.jsx("span",{className:"block truncate",children:se.description||"—"})}),a.jsx(Vc,{children:se.description||"—"})]})})})]})]})})},`${se.level}:${se.name}`))}):a.jsx(Tv,{className:"border",children:a.jsxs(fb,{children:[a.jsx(Iv,{variant:"icon",children:m||v!=="all"?a.jsx(Wp,{}):a.jsx(tk,{})}),a.jsx(pb,{children:i(m||v!=="all"?"agent.noMatches":"agent.empty")})]})})]})]})}/**
|
|
2701
2701
|
* @license
|
|
2702
2702
|
* Copyright 2026 Qwen Team
|
|
@@ -2882,7 +2882,7 @@ ${e}`:t}function Jre(e,t){return e.length!==t.length?!1:e.every((n,s)=>{const r=
|
|
|
2882
2882
|
`):void 0,onClick:()=>y?d?.(g):p(W=>!W),children:O}):a.jsx("div",{className:dc.header,children:O}),k&&a.jsxs("div",{className:dc.descriptionRow,children:[a.jsx("span",{className:dc.object,title:k,children:k}),w&&a.jsx(Gce,{iconOnly:!0,tool:g,workspaceCwd:l,onOpen:c})]}),f&&R&&a.jsxs("div",{className:dc.details,children:[j&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:dc.detailLabel,children:h("turnCalls.arguments")}),a.jsx(yhe,{text:j})]}),(E||S||I)&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:`${dc.detailLabel} flex items-center gap-1.5`,children:h("turnCalls.result")}),S?a.jsxs(a.Fragment,{children:[a.jsx(T9,{diff:S.slice(0,fE)}),S.length>fE&&a.jsx("p",{className:"text-xs text-muted-foreground",children:h("gitDiff.truncated")})]}):a.jsx(yhe,{text:I||h(Ic(g.status)?"shell.result.waiting":"shell.result.empty")})]}),E?.other&&a.jsxs("details",{className:dc.other,children:[a.jsx("summary",{children:h("turnCalls.other")}),a.jsx("pre",{className:vhe.detailBody,children:E.other})]})]})]})});function Fus({status:e}){const{t}=et();return e==="completed"||e==="success"?a.jsxs("span",{className:`${dc.status} ${dc.completed}`,children:[a.jsx(gb,{size:12,"aria-hidden":"true"}),t("turnCalls.completed")]}):e==="failed"||e==="error"?a.jsxs("span",{className:`${dc.status} ${dc.failed}`,children:[a.jsx($2,{size:12,"aria-hidden":"true"}),t("tool.status.failed")]}):e==="in_progress"||e==="running"?a.jsxs("span",{className:dc.status,children:[a.jsx(Ur,{className:"size-3","aria-hidden":"true"}),t("turnCalls.running")]}):e==="cancelled"||e==="canceled"?a.jsxs("span",{className:`${dc.status} text-[var(--warning-color)]`,children:[a.jsx(Hqe,{size:12,"aria-hidden":"true"}),t("turnCalls.cancelled")]}):e==="pending"?a.jsxs("span",{className:dc.status,children:[a.jsx(Sge,{size:12,"aria-hidden":"true"}),t("turnCalls.pending")]}):a.jsx("span",{className:dc.status,children:t("turnCalls.unknown")})}const zus="_root_9kme4_1",Uus="_intro_9kme4_8",Wus="_toolbar_9kme4_14",Hus="_count_9kme4_22",qus="_toolbarActions_9kme4_28",Vus="_primaryButton_9kme4_34",Gus="_secondaryButton_9kme4_35",Kus="_formFields_9kme4_73",Yus="_field_9kme4_79",Xus="_fieldGrow_9kme4_86",Jus="_fieldLabel_9kme4_90",Qus="_required_9kme4_96",Zus="_fieldHint_9kme4_101",ehs="_input_9kme4_107",ths="_textarea_9kme4_108",nhs="_select_9kme4_109",shs="_promptEditorWrap_9kme4_127",rhs="_promptEditor_9kme4_127",ohs="_promptPlaceholder_9kme4_160",ihs="_promptTag_9kme4_174",ahs="_promptTagIcon_9kme4_190",lhs="_promptTagValue_9kme4_201",chs="_promptTagRemove_9kme4_211",dhs="_referencePopover_9kme4_239",uhs="_referenceBar_9kme4_243",hhs="_referenceButton_9kme4_250",fhs="_referenceButtonActive_9kme4_267",phs="_referenceButtonIcon_9kme4_272",mhs="_referencePicker_9kme4_282",ghs="_referenceItem_9kme4_295",vhs="_referenceItemLabel_9kme4_318",yhs="_referenceItemDescription_9kme4_319",whs="_referenceEmpty_9kme4_336",bhs="_referenceError_9kme4_337",xhs="_routingFields_9kme4_347",khs="_newGroupFields_9kme4_357",_hs="_inlineError_9kme4_364",Shs="_scheduleRow_9kme4_377",Chs="_preview_9kme4_389",Ths="_previewLabel_9kme4_397",Ihs="_previewCron_9kme4_402",Rhs="_previewInvalid_9kme4_412",Ehs="_formError_9kme4_417",Ahs="_loadError_9kme4_418",jhs="_formActions_9kme4_424",Nhs="_empty_9kme4_432",Mhs="_list_9kme4_439",Phs="_card_9kme4_447",Dhs="_cardDisabled_9kme4_458",Lhs="_cardHeader_9kme4_462",Ohs="_cardTitle_9kme4_468",Bhs="_cardMenu_9kme4_479",$hs="_iconAction_9kme4_486",Fhs="_toggle_9kme4_518",zhs="_toggleOn_9kme4_537",Uhs="_toggleKnob_9kme4_541",Whs="_cardPrompt_9kme4_556",Hhs="_cardFooter_9kme4_569",qhs="_schedulePill_9kme4_578",Vhs="_clockIcon_9kme4_590",Ghs="_recurringTag_9kme4_601",Khs="_sessionModeTag_9kme4_606",Yhs="_workspacePill_9kme4_628",Xhs="_workspaceIcon_9kme4_646",Jhs="_workspaceName_9kme4_652",Qhs="_countdown_9kme4_664",Zhs="_hourglassIcon_9kme4_675",efs="_lastFired_9kme4_686",tfs="_runsToggle_9kme4_694",nfs="_runsList_9kme4_711",sfs="_runsItem_9kme4_725",rfs="_runLink_9kme4_732",yn={root:zus,intro:Uus,toolbar:Wus,count:Hus,toolbarActions:qus,primaryButton:Vus,secondaryButton:Gus,formFields:Kus,field:Yus,fieldGrow:Xus,fieldLabel:Jus,required:Qus,fieldHint:Zus,input:ehs,textarea:ths,select:nhs,promptEditorWrap:shs,promptEditor:rhs,promptPlaceholder:ohs,promptTag:ihs,promptTagIcon:ahs,promptTagValue:lhs,promptTagRemove:chs,referencePopover:dhs,referenceBar:uhs,referenceButton:hhs,referenceButtonActive:fhs,referenceButtonIcon:phs,referencePicker:mhs,referenceItem:ghs,referenceItemLabel:vhs,referenceItemDescription:yhs,referenceEmpty:whs,referenceError:bhs,routingFields:xhs,newGroupFields:khs,inlineError:_hs,scheduleRow:Shs,preview:Chs,previewLabel:Ths,previewCron:Ihs,previewInvalid:Rhs,formError:Ehs,loadError:Ahs,formActions:jhs,empty:Nhs,list:Mhs,card:Phs,cardDisabled:Dhs,cardHeader:Lhs,cardTitle:Ohs,cardMenu:Bhs,iconAction:$hs,toggle:Fhs,toggleOn:zhs,toggleKnob:Uhs,cardPrompt:Whs,cardFooter:Hhs,schedulePill:qhs,clockIcon:Vhs,recurringTag:Ghs,sessionModeTag:Khs,workspacePill:Yhs,workspaceIcon:Xhs,workspaceName:Jhs,countdown:Qhs,hourglassIcon:Zhs,lastFired:efs,runsToggle:tfs,runsList:nfs,runsItem:sfs,runLink:rfs},ofs="_panel_1ry1z_1",ifs="_panelDrawer_1ry1z_11",afs="_panelFullscreen_1ry1z_12",lfs="_header_1ry1z_23",cfs="_tabs_1ry1z_43",dfs="_tabItem_1ry1z_52",ufs="_tab_1ry1z_43",hfs="_tabTitle_1ry1z_80",ffs="_tabTitleInner_1ry1z_96",pfs="_tabIcon_1ry1z_120",mfs="_tabIconSvg_1ry1z_130",gfs="_tabArtifactIcon_1ry1z_136",vfs="_tabActive_1ry1z_141",yfs="_tabCloseButton_1ry1z_156",wfs="_tabCloseIcon_1ry1z_186",bfs="_iconButton_1ry1z_192",xfs="_iconButtonActive_1ry1z_211",kfs="_headerActions_1ry1z_215",_fs="_addButton_1ry1z_226",Sfs="_fullscreenButton_1ry1z_230",Cfs="_panelToggleButton_1ry1z_234",Tfs="_panelToggleIcon_1ry1z_246",Ifs="_toolbarIcon_1ry1z_252",Rfs="_body_1ry1z_258",Efs="_bodySideTask_1ry1z_266",Afs="_terminalPane_1ry1z_271",jfs="_terminalPaneHidden_1ry1z_275",Nfs="_attachmentPreviewButton_1ry1z_279",Mfs="_pdfAttachmentPreview_1ry1z_324",Pfs="_unsupportedAttachmentPreview_1ry1z_332",Dfs="_unsupportedAttachmentMeta_1ry1z_350",Lfs="_empty_1ry1z_355",Ofs="_emptyActions_1ry1z_361",Bfs="_emptyAction_1ry1z_361",$fs="_emptyActionIcon_1ry1z_395",Ffs="_emptyActionTitle_1ry1z_409",zfs="_emptyActionHint_1ry1z_413",Ufs="_emptyActionChevron_1ry1z_423",Wfs="_sideTaskListTitle_1ry1z_430",Hfs="_sideTaskListTime_1ry1z_438",qfs="_sideTaskNewIcon_1ry1z_446",Vfs="_meta_1ry1z_483",Gfs="_detail_1ry1z_488",Kfs="_section_1ry1z_493",Yfs="_sectionTitle_1ry1z_498",Xfs="_description_1ry1z_505",Jfs="_actionsRow_1ry1z_509",Qfs="_fieldGrid_1ry1z_516",Zfs="_fieldLabel_1ry1z_523",eps="_fieldValue_1ry1z_532",tps="_link_1ry1z_537",nps="_locationRow_1ry1z_546",sps="_openButton_1ry1z_553",rps="_review_1ry1z_571",ops="_reviewToolbar_1ry1z_578",ips="_reviewToolbarTitle_1ry1z_587",aps="_reviewToolbarActions_1ry1z_594",lps="_reviewTotalsButton_1ry1z_600",cps="_reviewContent_1ry1z_618",dps="_reviewContentListOnly_1ry1z_628",ups="_reviewContentStacked_1ry1z_632",hps="_reviewList_1ry1z_637",fps="_reviewListWithExpanded_1ry1z_645",pps="_reviewSplitHandle_1ry1z_658",mps="_reviewItem_1ry1z_673",gps="_reviewItemExpanded_1ry1z_678",vps="_reviewRow_1ry1z_685",yps="_reviewRowToggle_1ry1z_707",wps="_reviewFileName_1ry1z_728",bps="_reviewOpenButton_1ry1z_735",xps="_fileIcon_1ry1z_758",kps="_reviewPath_1ry1z_772",_ps="_treeName_1ry1z_773",Sps="_pathPrefix_1ry1z_789",Cps="_pathFileName_1ry1z_795",Tps="_lineStats_1ry1z_803",Ips="_additions_1ry1z_812",Rps="_deletions_1ry1z_816",Eps="_chevron_1ry1z_820",Aps="_chevronOpen_1ry1z_826",jps="_chevronIcon_1ry1z_830",Nps="_diffPreview_1ry1z_836",Mps="_codeMirrorDiff_1ry1z_846",Pps="_codeMirrorDiffWrap_1ry1z_854",Dps="_diffError_1ry1z_862",Lps="_codeMirrorFile_1ry1z_887",Ops="_diffEmpty_1ry1z_953",Bps="_tree_1ry1z_773",$ps="_treeNode_1ry1z_966",Fps="_treeChildren_1ry1z_970",zps="_treeRow_1ry1z_984",Ups="_treeFolder_1ry1z_1017",Wps="_treeFile_1ry1z_1021",Hps="_treeTwisty_1ry1z_1030",qps="_treeChevronIcon_1ry1z_1039",Vps="_treeChevron_1ry1z_1039",Gps="_treeChevronClosed_1ry1z_1050",Kps="_treeContent_1ry1z_1054",Yps="_reviewBadge_1ry1z_1077",Xps="_htmlPreviewWrap_1ry1z_1090",Jps="_markdownPreviewWrap_1ry1z_1097",Qps="_imagePreviewWrap_1ry1z_1103",Zps="_imagePreview_1ry1z_1103",ems="_imageDownloadButton_1ry1z_1120",tms="_downloadRow_1ry1z_1152",nms="_downloadButton_1ry1z_1156",sms="_htmlPreview_1ry1z_1090",rms="_previewError_1ry1z_1188",oms="_filePreviewWrap_1ry1z_1194",It={panel:ofs,panelDrawer:ifs,panelFullscreen:afs,header:lfs,tabs:cfs,tabItem:dfs,tab:ufs,tabTitle:hfs,tabTitleInner:ffs,tabIcon:pfs,tabIconSvg:mfs,tabArtifactIcon:gfs,tabActive:vfs,tabCloseButton:yfs,tabCloseIcon:wfs,iconButton:bfs,iconButtonActive:xfs,headerActions:kfs,addButton:_fs,fullscreenButton:Sfs,panelToggleButton:Cfs,panelToggleIcon:Tfs,toolbarIcon:Ifs,body:Rfs,bodySideTask:Efs,terminalPane:Afs,terminalPaneHidden:jfs,attachmentPreviewButton:Nfs,pdfAttachmentPreview:Mfs,unsupportedAttachmentPreview:Pfs,unsupportedAttachmentMeta:Dfs,empty:Lfs,emptyActions:Ofs,emptyAction:Bfs,emptyActionIcon:$fs,emptyActionTitle:Ffs,emptyActionHint:zfs,emptyActionChevron:Ufs,sideTaskListTitle:Wfs,sideTaskListTime:Hfs,sideTaskNewIcon:qfs,meta:Vfs,detail:Gfs,section:Kfs,sectionTitle:Yfs,description:Xfs,actionsRow:Jfs,fieldGrid:Qfs,fieldLabel:Zfs,fieldValue:eps,link:tps,locationRow:nps,openButton:sps,review:rps,reviewToolbar:ops,reviewToolbarTitle:ips,reviewToolbarActions:aps,reviewTotalsButton:lps,reviewContent:cps,reviewContentListOnly:dps,reviewContentStacked:ups,reviewList:hps,reviewListWithExpanded:fps,reviewSplitHandle:pps,reviewItem:mps,reviewItemExpanded:gps,reviewRow:vps,reviewRowToggle:yps,reviewFileName:wps,reviewOpenButton:bps,fileIcon:xps,reviewPath:kps,treeName:_ps,pathPrefix:Sps,pathFileName:Cps,lineStats:Tps,additions:Ips,deletions:Rps,chevron:Eps,chevronOpen:Aps,chevronIcon:jps,diffPreview:Nps,codeMirrorDiff:Mps,codeMirrorDiffWrap:Pps,diffError:Dps,codeMirrorFile:Lps,diffEmpty:Ops,tree:Bps,treeNode:$ps,treeChildren:Fps,treeRow:zps,treeFolder:Ups,treeFile:Wps,treeTwisty:Hps,treeChevronIcon:qps,treeChevron:Vps,treeChevronClosed:Gps,treeContent:Kps,reviewBadge:Yps,htmlPreviewWrap:Xps,markdownPreviewWrap:Jps,imagePreviewWrap:Qps,imagePreview:Zps,imageDownloadButton:ems,downloadRow:tms,downloadButton:nms,htmlPreview:sms,previewError:rms,filePreviewWrap:oms},ims="_root_1xnu0_1",ams="_summary_1xnu0_7",lms="_eyebrow_1xnu0_18",cms="_verdict_1xnu0_26",dms="_meta_1xnu0_32",ums="_path_1xnu0_33",hms="_metrics_1xnu0_39",fms="_metric_1xnu0_39",pms="_caps_1xnu0_63",mms="_filters_1xnu0_74",gms="_primaryButton_1xnu0_98",vms="_secondaryButton_1xnu0_99",yms="_findings_1xnu0_104",wms="_finding_1xnu0_104",bms="_detailBlock_1xnu0_118",xms="_findingHeader_1xnu0_127",kms="_severity_1xnu0_135",_ms="_notLinked_1xnu0_162",Sms="_report_1xnu0_203",Cms="_evidenceImage_1xnu0_208",Tms="_empty_1xnu0_217",Ims="_errorFallback_1xnu0_223",Rms="_error_1xnu0_223",bc={root:ims,summary:ams,eyebrow:lms,verdict:cms,meta:dms,path:ums,metrics:hms,metric:fms,caps:pms,filters:mms,primaryButton:gms,secondaryButton:vms,findings:yms,finding:wms,detailBlock:bms,findingHeader:xms,severity:kms,notLinked:_ms,report:Sms,evidenceImage:Cms,empty:Tms,errorFallback:Ims,error:Rms},IG=["Critical","Suggestion","Nice to have"],RG=["high","low"],Ems=["review","build","test","probe","lint"],Ams=["fixed","skipped","no_change_needed"];function pE(e,t){if(e===null||typeof e!="object"||Array.isArray(e))throw new Error(`${t} must be an object.`);return e}function Ly(e,t){if(typeof e!="string"||e.trim()==="")throw new Error(`${t} must be a non-empty string.`);return e}function Mj(e,t){if(e!==void 0)return Ly(e,t)}function EG(e,t){if(typeof e!="number"||!Number.isSafeInteger(e)||e<0)throw new Error(`${t} must be a non-negative safe integer.`);return e}function jms(e,t){const n=EG(e,t);if(n===0)throw new Error(`${t} must be a positive safe integer.`);return n}function Nms(e){const t=Ly(e,"markdownReportPath");if(t.startsWith("/")||t.split("/").includes("..")||!t.endsWith(".md"))throw new Error('markdownReportPath must be a relative .md path without ".." segments.');if(!t.startsWith(".qwen/reviews/"))throw new Error("markdownReportPath must be a file under .qwen/reviews/.");return t}function JN(e,t,n){if(typeof e!="string"||!t.includes(e))throw new Error(`${n} has an unsupported value.`);return e}function bhe(e,t){if(!Array.isArray(e))throw new Error(`${t} must be an array.`);return e.map((n,s)=>Ly(n,`${t}[${s}]`))}function _Pe(e,t,n){const s=pE(e,n);return Object.fromEntries(t.map(r=>[r,EG(s[r],`${n}.${r}`)]))}function Mms(e,t){const n=`findings[${t}]`,s=pE(e,n);if(!Array.isArray(s.locations)||s.locations.length===0)throw new Error(`${n}.locations must be a non-empty array.`);const r=s.locations.map((i,l)=>{const c=pE(i,`${n}.locations[${l}]`);return{file:Ly(c.file,`${n}.locations[${l}].file`),...c.line===void 0?{}:{line:jms(c.line,`${n}.locations[${l}].line`)},...Mj(c.anchor,`${n}.locations[${l}].anchor`)?{anchor:c.anchor}:{}}}),o=s.outcome===void 0?void 0:JN(s.outcome,Ams,`${n}.outcome`);return{id:Ly(s.id,`${n}.id`),severity:JN(s.severity,IG,`${n}.severity`),confidence:JN(s.confidence,RG,`${n}.confidence`),source:JN(s.source,Ems,`${n}.source`),summary:Ly(s.summary,`${n}.summary`),shortSummary:Ly(s.shortSummary,`${n}.shortSummary`),failureScenario:Ly(s.failureScenario,`${n}.failureScenario`),...Mj(s.witness,`${n}.witness`)?{witness:s.witness}:{},...Mj(s.suggestedFix,`${n}.suggestedFix`)?{suggestedFix:s.suggestedFix}:{},...Mj(s.fixWitness,`${n}.fixWitness`)?{fixWitness:s.fixWitness}:{},...Mj(s.category,`${n}.category`)?{category:s.category}:{},locations:r,...s.assetFiles===void 0?{}:{assetFiles:bhe(s.assetFiles,`${n}.assetFiles`)},...s.assets===void 0?{}:{assets:bhe(s.assets,`${n}.assets`)},...o?{outcome:o}:{},...Mj(s.outcomeNote,`${n}.outcomeNote`)?{outcomeNote:s.outcomeNote}:{},...s.heldByMeasurement===void 0?{}:{heldByMeasurement:{file:Ly(pE(s.heldByMeasurement,`${n}.heldByMeasurement`).file,`${n}.heldByMeasurement.file`)}}}}function Pms(e){let t;try{t=JSON.parse(e)}catch(o){throw new Error(`Malformed code review JSON: ${o instanceof Error?o.message:String(o)}`)}const n=pE(t,"Code review document");if(n.schemaVersion!==1)throw new Error(`Unsupported code review schemaVersion: ${JSON.stringify(n.schemaVersion)}. Expected 1.`);if(!Array.isArray(n.findings))throw new Error("findings must be an array.");const s=pE(n.verdict,"verdict"),r=pE(n.counts,"counts");return{schemaVersion:1,target:Ly(n.target,"target"),effort:Ly(n.effort,"effort"),verdict:{event:JN(s.event,["APPROVE","COMMENT","REQUEST_CHANGES"],"verdict.event"),verdictLine:Ly(s.verdictLine,"verdict.verdictLine"),baseEvent:JN(s.baseEvent,["APPROVE","COMMENT","REQUEST_CHANGES"],"verdict.baseEvent"),cappedBy:bhe(s.cappedBy,"verdict.cappedBy")},findings:n.findings.map(Mms),counts:{total:EG(r.total,"counts.total"),bySeverity:_Pe(r.bySeverity,IG,"counts.bySeverity"),byConfidence:_Pe(r.byConfidence,RG,"counts.byConfidence"),held:EG(r.held,"counts.held")},markdownReportPath:Nms(n.markdownReportPath)}}function Dms({workspacePath:e,artifactVersion:t,workspaceActions:n}){const{t:s}=et(),r=Pm(),[o,i]=u.useState(null),[l,c]=u.useState(null),[d,h]=u.useState(!1),[f,p]=u.useState("all"),[m,g]=u.useState("all"),[v,b]=u.useState(null),[y,w]=u.useState(null),[x,k]=u.useState(null),[_,S]=u.useState(!1),E=u.useRef(0);u.useEffect(()=>{let A=!1;return E.current+=1,i(null),c(null),h(!1),p("all"),g("all"),b(null),w(null),k(null),S(!1),n.readWorkspaceFile(e).then(M=>{if(!A){if(M.truncated){h(!0);return}i(M.content)}}).catch(M=>{A||c(M instanceof Error?M.message:String(M))}),()=>{A=!0,E.current+=1}},[t,n,e]);const j=u.useMemo(()=>{if(o===null)return null;try{return{document:Pms(o),error:null}}catch(A){return{document:null,error:A instanceof Error?A.message:String(A)}}},[o]),I=A=>{const M=++E.current;b(A),w(null),k(null),S(!0),n.readWorkspaceFile(A).then(P=>{M===E.current&&(P.truncated?k(s("codeReview.reportTruncated")):w(P.content))}).catch(P=>{M===E.current&&k(P instanceof Error?P.message:String(P))}).finally(()=>{M===E.current&&S(!1)})};if(y!==null||x)return a.jsxs("div",{className:bc.report,children:[a.jsx("button",{type:"button",className:bc.secondaryButton,onClick:()=>{E.current+=1,b(null),w(null),k(null),S(!1)},children:s("codeReview.back")}),a.jsx("div",{className:bc.path,children:v}),x?a.jsx("div",{className:bc.error,role:"alert",children:x}):a.jsx(cp,{content:y??""})]});const R=d?s("codeReview.artifactTruncated"):l;if(R||j?.error){const A=e.endsWith(".json")?`${e.slice(0,-5)}.md`:null;return a.jsxs("div",{className:bc.errorFallback,children:[a.jsxs("div",{className:bc.error,role:"alert",children:[a.jsx("strong",{children:s("codeReview.loadErrorTitle")}),a.jsx("span",{children:R??j?.error})]}),A&&a.jsx("button",{type:"button",className:bc.secondaryButton,onClick:()=>I(A),disabled:_,children:s(_?"codeReview.loadingReport":"codeReview.openReport")})]})}if(!j?.document)return a.jsx("div",{className:bc.empty,children:s("codeReview.loading")});const T=j.document,N=T.findings.filter(A=>(f==="all"||A.severity===f)&&(m==="all"||A.confidence===m));return a.jsxs("div",{className:bc.root,children:[a.jsxs("section",{className:bc.summary,children:[a.jsxs("div",{children:[a.jsx("div",{className:bc.eyebrow,children:s("codeReview.authoritativeVerdict")}),a.jsx("h2",{className:bc.verdict,children:T.verdict.verdictLine}),a.jsx("div",{className:bc.meta,children:s("codeReview.targetEffort",{target:T.target,effort:T.effort})})]}),a.jsx("button",{type:"button",className:bc.primaryButton,onClick:()=>I(T.markdownReportPath),disabled:_,children:s(_?"codeReview.loadingReport":"codeReview.openReport")})]}),a.jsxs("section",{className:bc.metrics,"aria-label":s("codeReview.reviewCounts"),children:[a.jsx(Lz,{label:s("codeReview.total"),value:T.counts.total}),IG.map(A=>a.jsx(Lz,{label:A,value:T.counts.bySeverity[A]},A)),RG.map(A=>a.jsx(Lz,{label:s("codeReview.confidence",{value:A}),value:T.counts.byConfidence[A]},A)),a.jsx(Lz,{label:s("codeReview.held"),value:T.counts.held})]}),a.jsxs("section",{className:bc.caps,children:[a.jsx("span",{className:bc.eyebrow,children:s("codeReview.caps")}),a.jsx("span",{children:T.verdict.cappedBy.length>0?T.verdict.cappedBy.join(", "):s("codeReview.none")})]}),a.jsxs("div",{className:bc.filters,children:[a.jsxs("label",{children:[s("codeReview.severity"),a.jsxs("select",{"aria-label":s("codeReview.severity"),value:f,onChange:A=>p(A.target.value),children:[a.jsx("option",{value:"all",children:s("codeReview.all")}),IG.map(A=>a.jsxs("option",{value:A,children:[A," (",T.counts.bySeverity[A],")"]},A))]})]}),a.jsxs("label",{children:[s("codeReview.confidenceLabel"),a.jsxs("select",{"aria-label":s("codeReview.confidenceLabel"),value:m,onChange:A=>g(A.target.value),children:[a.jsx("option",{value:"all",children:s("codeReview.all")}),RG.map(A=>a.jsxs("option",{value:A,children:[A," (",T.counts.byConfidence[A],")"]},A))]})]})]}),a.jsx("div",{className:bc.findings,children:N.length===0?a.jsx("div",{className:bc.empty,children:s("codeReview.noMatches")}):N.map(A=>a.jsxs("article",{className:bc.finding,children:[a.jsxs("div",{className:bc.findingHeader,children:[a.jsx("span",{className:bc.severity,children:A.severity}),a.jsx("span",{children:s("codeReview.confidence",{value:A.confidence})}),a.jsx("span",{children:s("codeReview.source",{value:A.source})}),A.category&&a.jsx("span",{children:A.category})]}),a.jsx("h3",{children:A.summary}),a.jsx(Pj,{label:s("codeReview.failureScenario"),value:A.failureScenario}),A.witness&&a.jsx(Pj,{label:s("codeReview.witness"),value:A.witness}),A.suggestedFix&&a.jsx(Pj,{label:s("codeReview.suggestedFix"),value:A.suggestedFix}),A.fixWitness&&a.jsx(Pj,{label:s("codeReview.fixWitness"),value:A.fixWitness}),A.outcome&&a.jsx(Pj,{label:s("codeReview.outcome"),value:`${A.outcome}${A.outcomeNote?` — ${A.outcomeNote}`:""}`}),A.heldByMeasurement&&a.jsx(Pj,{label:s("codeReview.heldByMeasurement"),value:A.heldByMeasurement.file}),a.jsxs("div",{className:bc.detailBlock,children:[a.jsx("strong",{children:s("codeReview.locations")}),a.jsx("ul",{children:A.locations.map((M,P)=>a.jsxs("li",{children:[a.jsxs("code",{children:[M.file,M.line===void 0?"":`:${M.line}`]}),M.anchor&&a.jsxs("span",{children:[" — ",M.anchor]})]},`${M.file}:${M.line??""}:${P}`))})]}),(A.assets&&A.assets.length>0||A.assetFiles&&A.assetFiles.length>0)&&a.jsxs("div",{className:bc.detailBlock,children:[a.jsx("strong",{children:s("codeReview.evidence")}),a.jsxs("ul",{children:[(A.assets??[]).map((M,P)=>a.jsx("li",{children:TT(M)?a.jsx("a",{href:M,target:"_blank",rel:"noopener noreferrer",onClick:D=>r(D,M),children:M}):a.jsxs("span",{className:bc.notLinked,children:[M," (",s("codeReview.notLinked"),")"]})},`${M}-${P}`)),(A.assetFiles??[]).map((M,P)=>a.jsx(Lms,{path:M,workspaceActions:n},`${M}-${P}`))]})]})]},A.id))})]})}function Lms({path:e,workspaceActions:t}){const n=G2(e),[s,r]=u.useState(null);return u.useEffect(()=>{if(!n)return;let o=!1,i;return IT((l,c)=>t.readFileBytes(l,c),e,n,{statFile:l=>t.stat(l),isCancelled:()=>o}).then(l=>{o||(i=URL.createObjectURL(l),r(i))}).catch(()=>{}),()=>{o=!0,i&&URL.revokeObjectURL(i)}},[n,e,t]),a.jsxs("li",{children:[s&&a.jsx("img",{className:bc.evidenceImage,src:s,alt:e}),a.jsx("code",{children:e})]})}function Lz({label:e,value:t}){return a.jsxs("div",{className:bc.metric,children:[a.jsx("strong",{children:t}),a.jsx("span",{children:e})]})}function Pj({label:e,value:t}){return a.jsxs("div",{className:bc.detailBlock,children:[a.jsx("strong",{children:e}),a.jsx("p",{children:t})]})}const noe=10*1024*1024,Oms=`<!doctype html><html><head>
|
|
2883
2883
|
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; base-uri 'none'; form-action 'none'; style-src 'unsafe-inline'; img-src data:; font-src data:;">
|
|
2884
2884
|
<style>html,body{margin:0;background:#eee;color:#000}body{overflow:auto}.docx-wrapper{width:max-content;min-width:100%;box-sizing:border-box}</style>
|
|
2885
|
-
</head><body></body></html>`;function Bms({workspacePath:e,workspaceActions:t,data:n,artifactVersion:s,downloadName:r}){const{t:o}=et(),[i,l]=u.useState(),[c,d]=u.useState(!1),[h,f]=u.useState(),[p,m]=u.useState(),[g,v]=u.useState(),[b,y]=u.useState(!1),[w,x]=u.useState(0),k=u.useRef(void 0);return u.useEffect(()=>{const _={};if(k.current=_,!i)return()=>{k.current=void 0};let S=!1,E=!1,j,I;const R=i.createElement("div");i.body.replaceChildren(R);const T=A=>{S||E||(E=!0,clearTimeout(j),R.remove(),f(A))};return d(!1),f(void 0),m(void 0),v(void 0),y(!1),(async()=>{const A=n??await IT(t.readFileBytes,e,yce,{statFile:async D=>{const z=await t.stat(D);if(z.sizeBytes>noe)throw new Error(o("docx.tooLarge"));return z},isCancelled:()=>S,maxBytes:noe});if(S)return;if(I=URL.createObjectURL(A),m(I),A.size>noe){T(o("docx.tooLarge"));return}j=setTimeout(()=>T(o("docx.timeout")),3e4);const M=await A.arrayBuffer(),{renderAsync:P}=await bt(async()=>{const{renderAsync:D}=await import("./docx-preview-DHO0seXT.js");return{renderAsync:D}},[]);if(!(S||E)){try{await P(M,R,R,{useBase64URL:!0,renderAltChunks:!1})}catch{T(o("docx.invalid"));return}if(!(S||E)){clearTimeout(j);for(const D of R.querySelectorAll("a")){const z=D.getAttribute("href");z?.startsWith("#")?D.addEventListener("click",B=>{B.preventDefault(),i.getElementById(z.slice(1))?.scrollIntoView()}):D.removeAttribute("href"),D.removeAttribute("target")}d(!0)}}})().catch(A=>{T(ja(A))}),()=>{S=!0,k.current=void 0,clearTimeout(j),R.remove(),I&&URL.revokeObjectURL(I)}},[i,n,e,t,s,w,o]),a.jsxs("div",{"data-web-shell-docx-preview":!0,className:"flex h-full min-h-0 flex-col",children:[a.jsx("div",{className:"flex justify-end border-b border-border p-1",children:p?a.jsx(Ae,{variant:"ghost",size:"sm",asChild:!0,children:a.jsxs("a",{href:p,download:r??K0e(e),onClick:_=>_.stopPropagation(),children:[a.jsx(Zy,{"aria-hidden":"true"}),o("common.download")]})}):t?a.jsxs(Ae,{variant:"ghost",size:"sm",disabled:b,onClick:()=>{const _=k.current,S=()=>k.current!==_;y(!0),v(void 0),x9(t,e,yce,S).catch(E=>{S()||v(ja(E))}).finally(()=>{S()||y(!1)})},children:[a.jsx(Zy,{"aria-hidden":"true"}),o("common.download")]}):null}),g&&a.jsx("p",{role:"alert",className:"p-3 text-sm text-destructive",children:g}),a.jsxs("div",{className:"relative min-h-0 flex-1",children:[a.jsx("iframe",{title:`Preview ${e}`,className:"h-full w-full border-0",style:{visibility:c?"visible":"hidden"},srcDoc:Oms,sandbox:"allow-same-origin",referrerPolicy:"no-referrer",onLoad:_=>{l(_.currentTarget.contentDocument??void 0)}}),h?a.jsxs("div",{role:"alert",className:"absolute inset-0 space-y-3 p-4 text-sm",children:[a.jsx("p",{children:h}),a.jsx(Ae,{variant:"outline",size:"sm",onClick:()=>x(_=>_+1),children:o("common.retry")})]}):c?null:a.jsx("div",{role:"status",className:"absolute inset-0 p-4 text-sm text-muted-foreground",children:o("attachment.loadingPreview")})]})]})}const $ms="_detail_4ah9l_1",Fms="_state_4ah9l_9",zms="_overview_4ah9l_17",Ums="_descriptionRow_4ah9l_25",Wms="_statusTag_4ah9l_33",Hms="_statusActions_4ah9l_38",qms="_stopButton_4ah9l_45",Vms="_stopError_4ah9l_67",Gms="_description_4ah9l_25",Kms="_transcript_4ah9l_114",Yms="_retry_4ah9l_122",by={detail:$ms,state:Fms,overview:zms,descriptionRow:Ums,statusTag:Wms,statusActions:Hms,stopButton:qms,stopError:Vms,description:Gms,transcript:Kms,retry:Yms};function Xms(e,t){const n=typeof e.rawOutput=="object"&&e.rawOutput!==null?e.rawOutput:void 0,s=typeof n?.executionSummary=="object"&&n.executionSummary!==null?n.executionSummary:void 0,r=s?.totalDurationMs,o=s?.inputTokens,i=s?.outputTokens,l=s?.cachedTokens;return{status:t.status,durationMs:typeof r=="number"?r:e.endTime&&e.startTime?Math.max(0,e.endTime-e.startTime):t.durationMs,inputTokens:typeof o=="number"?o:t.inputTokens,outputTokens:typeof i=="number"?i:t.outputTokens,cachedTokens:typeof l=="number"?l:t.cachedTokens}}function SPe(){return`subagent-detail:${typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Math.random().toString(36).slice(2)}`}function Jms(e,t){for(const n of e){if(n.role!=="tool_group")continue;const s=n.tools.find(r=>r.callId===t);if(s)return s}}function Qms(e,t){switch(e){case"completed":case"success":return t("subagent.completed");case"failed":case"error":return t("subagent.failed");case"cancelled":case"canceled":return t("subagent.cancelled");case"paused":return t("subagent.paused");default:return t("subagent.running")}}function Zms({rootTool:e,resolution:t,onStop:n,onRightPanelOpen:s,onArtifactsChange:r,onOpenSubagent:o,onError:i}){const{t:l}=et(),c=ba(),{blocks:d,blockChangeSummary:h}=pA(),f=aJ(l,d,h),{artifacts:p}=Tbe(),m=u.useMemo(()=>FN(f,p,c.workspaceCwd||""),[p,c.workspaceCwd,f]),g=ibe(f,m,c.workspaceCwd||c.standaloneSession?.projectlessOutputDirectory||"",c.sessionId?obe(c.sessionId):void 0,c.workspaceCwd?void 0:null),v=_9(e),b=u.useMemo(()=>Xms(e,t),[t,e]),y=b.status==="running"||b.status==="in_progress",[w,x]=u.useState(!1),[k,_]=u.useState("");u.useEffect(()=>{const R=c.sessionId;if(R)return r?.(R,p),()=>{r?.(R,[])}},[p,c.sessionId,r]);const S=u.useRef({messages:f,artifactsByTurn:m});S.current={messages:f,artifactsByTurn:m};const E=u.useCallback(R=>{const T=S.current;s?.({...R,...R.kind==="review"?{unfilteredChanges:v4(T.messages,T.artifactsByTurn,c.workspaceCwd||c.standaloneSession?.projectlessOutputDirectory||"").get(R.turnId)??R.changes}:{},sourceSessionId:c.sessionId})},[c.sessionId,c.workspaceCwd,c.standaloneSession?.projectlessOutputDirectory,s]);u.useEffect(()=>{y||(x(!1),_(""))},[y]);const j=async()=>{if(!(w||!n)){x(!0),_("");try{(await n()).cancelled||x(!1)}catch{x(!1),_(l("tasks.cancelFailed"))}}},I=a.jsx(lX,{messages:f,pendingApproval:null,loadingTranscript:c.loadingTranscript,catchingUp:c.catchingUp,isResponding:y,activeTurnStartedAt:y?e.startTime:void 0,workspaceCwd:c.workspaceCwd||"",hideSessionTimeline:!0,firstTurnMetrics:b,includeSubagentToolUsageInMetrics:!1,turnFileChanges:g,sourceSessionId:c.sessionId,turnArtifacts:m,onTurnOutputOpen:E,onError:i});return a.jsxs("div",{className:by.detail,children:[a.jsxs("div",{className:by.overview,children:[a.jsxs("div",{className:by.descriptionRow,children:[v&&a.jsx("div",{className:by.description,children:v}),a.jsxs("div",{className:by.statusActions,children:[a.jsx(Qr,{variant:"outline",className:by.statusTag,"data-status":b.status,children:Qms(b.status,l)}),y&&n&&a.jsx("button",{type:"button",className:by.stopButton,disabled:w,onClick:()=>void j(),children:l(w?"common.loading":"tasks.action.stop")})]})]}),k&&a.jsx("div",{className:by.stopError,children:k})]}),a.jsx("div",{className:by.transcript,children:o?a.jsx(yve,{onOpen:o,children:I}):I})]})}function egs({sessionId:e,rootToolCallId:t,initialRootTool:n,workspaceCwd:s,onRightPanelOpen:r,onArtifactsChange:o,onOpenSubagent:i,onError:l}){const{t:c}=et(),d=Co(),h=ba(),{blocks:f,blockChangeSummary:p}=pA(),m=aJ(c,f,p),g=(h.sessionId===e?Jms(m,t):void 0)??n,[v,b]=u.useState(()=>({key:0,clientId:SPe()})),y=Fu(),[w,x]=u.useState(),[k,_]=u.useState(!1);return u.useEffect(()=>{let S=!1,E=!1,j=0,I=!1,R=!1,T=!1,N;x(void 0),_(!1);const A=async()=>{if(!(R||y&&y.getSnapshot()!=="available")){R=!0;try{const D=await d.client.resolveSubagentSession(e,t);if(S)return;E=!0,j=0,I=D.status==="running",x(D),_(!1),D.status==="running"&&(!y||y.getSnapshot()==="available")&&(N=setTimeout(()=>void A(),3e3))}catch(D){if(S||Yl(D)||y&&y.getSnapshot()!=="available")return;j<3?(j+=1,N=setTimeout(()=>void A(),3e3)):E?I&&(N=setTimeout(()=>void A(),3e4)):_(!0)}finally{R=!1,T&&!S&&(!y||y.getSnapshot()==="available")&&(T=!1,N&&clearTimeout(N),A())}}};let M=y?.getSnapshot()==="available";const P=y?.subscribe(()=>{const D=y.getSnapshot()==="available";D!==M&&(M=D,N&&clearTimeout(N),D&&(!E||I)&&(R?T=!0:A()))});return A(),()=>{S=!0,P?.(),N&&clearTimeout(N)}},[y,v.key,t,e,d.client]),k?a.jsxs("div",{className:by.state,children:[a.jsx("div",{children:c("subagent.detailsLoadFailed")}),a.jsx("button",{type:"button",className:by.retry,onClick:()=>b(S=>({key:S.key+1,clientId:SPe()})),children:c("common.retry")})]}):w?a.jsx(IK,{sessionId:w.sessionId,workspaceCwd:s,clientId:v.clientId,maxQueued:256,maxBlocks:TK,subagentTranscriptMode:"full",suppressOwnUserEcho:!0,children:a.jsx(Zms,{rootTool:g,resolution:w,onRightPanelOpen:r,onArtifactsChange:o,onOpenSubagent:i?(S,E)=>i(S,E??e,s):void 0,onError:l,onStop:n.rawOutput&&typeof n.rawOutput=="object"&&"workflowRunId"in n.rawOutput?void 0:()=>d.client.cancelSubagentSession(e,t)})},`${v.key}:${w.sessionId}`):a.jsx("div",{className:by.state,children:c("subagent.detailsLoading")})}const tgs="_viewport_7jcdi_1",ngs="_canvas_7jcdi_14",sgs="_edges_7jcdi_20",rgs="_edgeRunning_7jcdi_33",ogs="_node_7jcdi_39",igs="_nodeTitle_7jcdi_78",ags="_mainNode_7jcdi_88",lgs="_nodeMeta_7jcdi_108",cgs="_status_7jcdi_114",dgs="_statusRunning_7jcdi_136",ugs="_duration_7jcdi_140",hgs="_empty_7jcdi_146",fgs="_loading_7jcdi_147",Xm={viewport:tgs,canvas:ngs,edges:sgs,edgeRunning:rgs,node:ogs,nodeTitle:igs,mainNode:ags,nodeMeta:lgs,status:cgs,statusRunning:dgs,duration:ugs,empty:hgs,loading:fgs},QN=184,xhe=68,Oz=32,pgs=72,O6=32,rD="__main__";function CPe(e){return e?{left:e.x,top:e.y}:void 0}function mgs(e){const t=new Map(e.map(h=>[h.id,h])),n=new Map;for(const h of e){const f=h.parentAgentId&&t.has(h.parentAgentId)?h.parentAgentId:rD,p=n.get(f)??[];p.push(h),n.set(f,p)}const s=new Map,r=new Set,o=h=>{const f=s.get(h);if(f!==void 0)return f;if(r.has(h))return QN;r.add(h);const p=n.get(h)??[],m=Math.max(QN,p.reduce((g,v)=>g+o(v.id),0)+Math.max(0,p.length-1)*Oz);return r.delete(h),s.set(h,m),m},i=new Map,l=new Set,c=(h,f,p)=>{if(l.has(h))return;l.add(h);const m=o(h);i.set(h,{x:f+(m-QN)/2,y:O6+p*(xhe+pgs)});let g=f;for(const v of n.get(h)??[])c(v.id,g,p+1),g+=o(v.id)+Oz};c(rD,O6,0);let d=O6+o(rD)+Oz;for(const h of e)l.has(h.id)||(c(h.id,d,1),d+=o(h.id)+Oz);return{positions:i,width:Math.max(360,...Array.from(i.values(),({x:h})=>h+QN+O6)),height:Math.max(220,...Array.from(i.values(),({y:h})=>h+xhe+O6))}}function ggs(e,t,n){const s=(e.subagentType?.toLowerCase()==="fork"?e.label.replace(/^fork:\s*/i,""):e.label).trim();return s&&s.toLowerCase()!=="agent"?s:n(t+1)}function vgs(e,t){return e.status==="running"?e.startTime>0?Math.max(e.runtimeMs,t-e.startTime):e.runtimeMs:e.endTime===void 0?e.runtimeMs:Math.max(0,e.endTime-e.startTime)||e.runtimeMs}function ygs({tasks:e,loading:t=!1,error:n,onOpenAgent:s}){const{t:r}=et(),o=u.useMemo(()=>mgs(e),[e]),i=e.some(d=>d.status==="running"),[l,c]=u.useState(Date.now);return u.useEffect(()=>{if(!i)return;c(Date.now());const d=window.setInterval(()=>c(Date.now()),1e3);return()=>window.clearInterval(d)},[i]),t?a.jsxs("div",{className:Xm.loading,role:"status","aria-label":r("common.loading"),children:[a.jsx(Vx,{className:"h-[68px] w-[184px] rounded-xl"}),a.jsx(Vx,{className:"h-[68px] w-[184px] rounded-xl"})]}):n?a.jsx("div",{className:Xm.empty,children:n}):e.length===0?a.jsx("div",{className:Xm.empty,children:r("workflow.empty")}):a.jsx("div",{className:Xm.viewport,"data-testid":"agent-workflow",children:a.jsxs("div",{className:Xm.canvas,style:{width:o.width,height:o.height},children:[a.jsx("svg",{className:Xm.edges,"data-testid":"agent-workflow-edges",width:o.width,height:o.height,"aria-hidden":"true",children:e.map(d=>{const h=o.positions.get(d.parentAgentId??"")??o.positions.get(rD),f=o.positions.get(d.id),p=h.x+QN/2,m=h.y+xhe,g=f.x+QN/2,v=f.y,b=(m+v)/2;return a.jsx("path",{className:d.status==="running"?Xm.edgeRunning:"",d:`M ${p} ${m} C ${p} ${b}, ${g} ${b}, ${g} ${v}`},d.id)})}),a.jsxs("div",{className:`${Xm.node} ${Xm.mainNode}`,style:CPe(o.positions.get(rD)),children:[a.jsx(tk,{}),a.jsx("span",{children:r("workflow.mainAgent")})]}),e.map((d,h)=>a.jsxs("button",{type:"button",className:Xm.node,"data-status":d.status,style:CPe(o.positions.get(d.id)),onClick:()=>s?.(d),disabled:!s,title:d.description||d.label,children:[a.jsxs("span",{className:Xm.nodeTitle,children:[a.jsx(tk,{}),a.jsx("span",{children:ggs(d,h,f=>r("environment.unnamedAgent",{index:f}))})]}),a.jsxs("span",{className:Xm.nodeMeta,children:[a.jsxs("span",{className:Xm.status,"data-status":d.status,children:[d.status==="completed"&&a.jsx(gb,{}),d.status==="running"&&a.jsx(sh,{className:Xm.statusRunning}),d.status==="paused"&&a.jsx(Wqe,{}),d.status==="failed"&&a.jsx($2,{}),d.status==="cancelled"&&a.jsx(qqe,{}),r(`tasks.${d.status}`)]}),a.jsx("span",{className:Xm.duration,children:ta(vgs(d,l))})]})]},d.id))]})})}const wgs=3;function bgs({tabId:e,sessionId:t,parentSessionId:n,workspaceCwd:s,title:r,shouldNameFromFirstPrompt:o,initialPrompt:i,createSession:l,onCreated:c,onTitleChange:d,onRightPanelOpen:h,onArtifactsChange:f,onError:p,sessionWorkflowEnabled:m,modelManagement:g,unavailableModels:v,mountUnavailableModelTooltip:b,onImageIngestionNotice:y,onInitialPromptRefused:w}){return t?a.jsx(IK,{sessionId:t,workspaceCwd:s,clientId:`side-task:${n}:${e}`,autoConnect:!0,historyPageSize:Gg,subagentTranscriptMode:"summary",maxBlocks:TK,suppressOwnUserEcho:!0,children:a.jsx(kgs,{tabId:e,title:r,shouldNameFromFirstPrompt:o,initialPrompt:i,workspaceCwd:s,onTitleChange:d,onRightPanelOpen:h,onArtifactsChange:f,onError:p,sessionWorkflowEnabled:m,modelManagement:g,unavailableModels:v,mountUnavailableModelTooltip:b,onImageIngestionNotice:y,onInitialPromptRefused:w})}):a.jsx(xgs,{tabId:e,parentSessionId:n,title:r,createSession:l,onCreated:c,onTitleChange:d,onError:p})}function xgs({tabId:e,parentSessionId:t,title:n,createSession:s,onCreated:r,onTitleChange:o,onError:i}){const{t:l}=et(),c=u.useRef(!1),d=u.useRef(!1),h=u.useRef(!0),[f,p]=u.useState();u.useEffect(()=>(h.current=!0,()=>{h.current=!1}),[]);const m=u.useCallback(async()=>{if(!c.current){c.current=!0,p(void 0);try{const g=await s(e,t,n);r(e,g.sessionId),h.current&&g.displayName&&o(e,g.displayName)}catch(g){if(!h.current)return;p(g),i?.(g,l("sideTask.createFailed"))}finally{c.current=!1}}},[s,r,i,o,t,l,e,n]);return u.useEffect(()=>{d.current||(d.current=!0,m())},[m]),f?a.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 text-sm text-muted-foreground",children:[a.jsx("span",{children:l("sideTask.createFailed")}),a.jsx(Ae,{type:"button",variant:"outline",onClick:()=>void m(),children:l("common.retry")})]}):a.jsxs("div",{className:"flex h-full items-center justify-center gap-2 text-sm text-muted-foreground",role:"status",children:[a.jsx(Ur,{}),a.jsx("span",{children:l("sideTask.creating")})]})}function kgs({tabId:e,title:t,shouldNameFromFirstPrompt:n,initialPrompt:s,workspaceCwd:r,onTitleChange:o,onRightPanelOpen:i,onArtifactsChange:l,onError:c,sessionWorkflowEnabled:d,modelManagement:h,unavailableModels:f,mountUnavailableModelTooltip:p,onImageIngestionNotice:m,onInitialPromptRefused:g}){const{t:v}=et(),b=ba(),y=nf(),w=Co(),x=cS(w.client),k=Ime(),_=Tme(),S=b.workspaceCwd&&r&&b.workspaceCwd!==r?void 0:b.workspaceCwd??r,E=k.some(D=>D.kind==="user"&&(typeof D.text=="string"?D.text.trim().length>0:!D.images?.length)),j=k.some(D=>D.kind!=="user"?!1:D.images?.length||D.files?.length||D.resourceLinks?.length?!0:typeof D.text!="string"||D.text.trim().length>0),I=b.status==="connected"&&!b.loadingTranscript&&!b.catchingUp&&!_.loading&&!_.hasMore&&!_.capacityReached&&!_.paginationError,R=I&&!j,T=!E&&(n||I&&!E);u.useEffect(()=>{const D=b.displayName?.trim();D&&o(e,D)},[b.displayName,o,e]);const N=u.useCallback(D=>{const z=Array.from(D.trim()).slice(0,200).join("");z&&(o(e,z),(async()=>{let B;for(let $=0;$<wgs;$++)try{await y.renameSession(z),b.sessionId&&S&&x.renamed(S,b.sessionId,z),o(e,z,!0);return}catch(L){B=L}S&&x.invalidateWorkspace(S),c?.(B,v("sideTask.renameFailed"))})())},[y,S,b.sessionId,c,o,x,v,e]),A=u.useRef(!1),M=!!(s?.trim()&&R&&!A.current&&!yG(h).allowAdd&&!xit(b.commands)&&Uy(s)),P=u.useRef(m);return P.current=m,u.useEffect(()=>{if(!M)return;const D=setTimeout(()=>{P.current?.("warning",v("sideTask.commandsLoadingTimedOut"))},5e3);return()=>clearTimeout(D)},[M,s,b.sessionId,v]),u.useEffect(()=>{const D=s?.trim();if(!(!D||!R||A.current||M)){if(A.current=!0,!yG(h).allowAdd&&Uy(D,b.commands)){m?.("warning",v("settings.models.addDisabled")),g?.(e);return}y.sendPrompt(D,{onAdmitted:()=>{b.sessionId&&S&&x.promptAdmitted(S,b.sessionId),N(D)}}).catch(z=>{A.current=!1,c?.(z,v("sideTask.promptFailed"))})}},[y,S,b.commands,b.sessionId,s,h,m,g,N,c,R,M,x,v,e]),b.sessionId?a.jsx(Clt,{title:b.displayName?.trim()||t,workspaceCwd:r,onError:c,onImageIngestionNotice:m,embedded:!0,onFirstPromptAdmitted:T?N:void 0,onRightPanelOpen:i,onPaneArtifactsChange:l,sessionWorkflowEnabled:d,modelManagement:h,unavailableModels:f,mountUnavailableModelTooltip:p}):a.jsx("div",{className:"flex h-full items-center justify-center",children:a.jsx(Ur,{})})}const _gs="_inspector_cn1ku_1",Sgs="_summary_cn1ku_20",Cgs="_detail_cn1ku_21",Tgs="_attention_cn1ku_22",Igs="_steps_cn1ku_23",Rgs="_collapsible_cn1ku_24",Egs="_summaryHeading_cn1ku_38",Ags="_sectionHeading_cn1ku_39",jgs="_compactHeading_cn1ku_40",Ngs="_summaryCount_cn1ku_72",Mgs="_progress_cn1ku_87",Pgs="_summaryMeta_cn1ku_108",Dgs="_expandButton_cn1ku_116",Lgs="_stepList_cn1ku_177",Ogs="_linkedAgents_cn1ku_178",Bgs="_deliverables_cn1ku_179",$gs="_activityList_cn1ku_180",Fgs="_attentionGlyph_cn1ku_216",zgs="_status_cn1ku_228",Ugs="_stepId_cn1ku_254",Wgs="_dependencies_cn1ku_262",Hgs="_dependencyList_cn1ku_291",qgs="_dependencyLink_cn1ku_309",Vgs="_dependencyNumber_cn1ku_333",Ggs="_showAllActivity_cn1ku_358",Kgs="_itemText_cn1ku_398",Ygs="_stepIndex_cn1ku_474",Xgs="_metrics_cn1ku_349",Jgs="_stateLabel_cn1ku_545",Qgs="_activityAvatar_cn1ku_605",Zgs="_canvasHint_cn1ku_617",e0s="_empty_cn1ku_633",aa={inspector:_gs,summary:Sgs,detail:Cgs,attention:Tgs,steps:Igs,collapsible:Rgs,summaryHeading:Egs,sectionHeading:Ags,compactHeading:jgs,summaryCount:Ngs,progress:Mgs,summaryMeta:Pgs,expandButton:Dgs,stepList:Lgs,linkedAgents:Ogs,deliverables:Bgs,activityList:$gs,attentionGlyph:Fgs,status:zgs,stepId:Ugs,dependencies:Wgs,dependencyList:Hgs,dependencyLink:qgs,dependencyNumber:Vgs,showAllActivity:Ggs,itemText:Kgs,stepIndex:Ygs,metrics:Xgs,stateLabel:Jgs,activityAvatar:Qgs,canvasHint:Zgs,empty:e0s},TPe=6;function t0s({todos:e,tools:t,tasks:n,projection:s,artifacts:r,selectedTodoId:o,onSelectedTodoIdChange:i,onExpandGraph:l,onOpenSubagent:c,onOpenArtifact:d,canvasMode:h=!1}){const{language:f,t:p}=et(),m=u.useMemo(()=>s??XY(e,t,n),[s,n,e,t]),g=cJe(e,m),v=u.useMemo(()=>{const T=new Map;return e.forEach((N,A)=>T.set(N.id,A+1)),T},[e]),[b,y]=u.useState(!1),w=m.todosById.has(o??"")?o:g,x=m.todosById.get(w??"");u.useEffect(()=>{w!==o&&i(w)},[w,i,o]);const k=T=>{np(T)||c(T)};if(e.length===0)return a.jsxs("div",{className:aa.empty,"data-testid":"workflow-inspector-empty",children:[a.jsx(nh,{"aria-hidden":"true"}),a.jsx("strong",{children:p("workflow.empty.title")}),a.jsx("p",{children:p("workflow.empty.copy")})]});const _=x?m.states.get(x.id):void 0,S=x?m.agentToolsByTodo.get(x.id)??[]:[],E=x?[...new Set(x.blockedBy??[])].filter(T=>T!==x.id&&m.todosById.has(T)):void 0,j=x?m.dependentsByTodo.get(x.id)??[]:[],I=T=>{const N=m.todosById.get(T),A=v.get(T);return a.jsx("li",{children:a.jsxs("button",{className:aa.dependencyLink,"data-plan-interactive":!0,"data-testid":`workflow-dependency-${T}`,onClick:()=>i(T),title:N?.content,type:"button",children:[A!==void 0&&a.jsx("span",{className:aa.dependencyNumber,children:A}),a.jsx("span",{children:N?.content??T})]})},T)},R=x&&_&&a.jsxs("section",{className:aa.detail,"data-testid":"workflow-step-detail",children:[a.jsxs("div",{className:aa.sectionHeading,children:[a.jsxs("div",{children:[a.jsx("span",{children:p("workflow.inspector.selectedStep")}),a.jsx("h2",{children:x.content})]}),a.jsx("span",{className:aa.status,"data-status":_.status,children:p(`planExecution.status.${_.status}`)})]}),a.jsx("code",{className:aa.stepId,children:x.id}),a.jsxs("dl",{className:aa.dependencies,children:[a.jsxs("div",{children:[a.jsx("dt",{children:p("workflow.dependencies.upstream")}),a.jsx("dd",{children:E?.length?a.jsx("ul",{className:aa.dependencyList,children:E.map(T=>I(T))}):p("workflow.dependencies.none")})]}),a.jsxs("div",{children:[a.jsx("dt",{children:p("workflow.dependencies.unblocks")}),a.jsx("dd",{children:j.length?a.jsx("ul",{className:aa.dependencyList,children:j.map(T=>I(T.id))}):p("workflow.dependencies.noDownstream")})]})]}),a.jsxs("div",{className:aa.linkedAgents,children:[a.jsx("h3",{children:p("planExecution.subagents")}),S.length?S.map(T=>{const N=m.tasksByTool.get(T),A=N?[N.startTime>0?Tm(N.runtimeMs):"",N.stats?.toolUses===void 0?"":p("planExecution.toolCalls",{count:N.stats.toolUses}),N.stats?.totalTokens===void 0?"":p("planExecution.tokens",{count:N.stats.totalTokens.toLocaleString()})].filter(Boolean):[];return a.jsxs("button",{"aria-disabled":!!np(T)||void 0,title:p(np(T)??"planExecution.openDetails"),onClick:()=>k(T),type:"button",children:[a.jsxs("span",{className:aa.itemText,children:[a.jsx("strong",{children:T.title||String(T.args?.description??"Agent")}),N&&a.jsx("small",{children:N.recentActivities?.at(-1)?.description||N.description}),A.length>0&&a.jsx("small",{className:aa.metrics,children:A.map(M=>a.jsx("span",{children:M},M))})]}),N&&a.jsx("span",{className:aa.stateLabel,"data-status":N.status,children:p(MAe(N.status))}),a.jsx(dle,{"aria-hidden":"true"})]},T.callId)}):a.jsx("p",{children:p("planExecution.noSubagents")})]})]});return h?a.jsxs("div",{className:aa.inspector,"data-testid":"workflow-canvas-detail",children:[a.jsxs("div",{className:aa.canvasHint,children:[a.jsx(nh,{"aria-hidden":"true"}),a.jsx("span",{children:p("workflow.inspector.canvasHint")})]}),R]}):a.jsxs("div",{className:aa.inspector,"data-testid":"workflow-inspector",children:[a.jsxs("section",{className:aa.summary,children:[a.jsxs("div",{className:aa.summaryHeading,children:[a.jsxs("div",{children:[a.jsx("span",{children:p("workflow.inspector.summary")}),a.jsx("strong",{children:p(m.taskStatusI18nKey)})]}),a.jsxs("span",{className:aa.summaryCount,"data-status":m.taskStatusTone,children:[m.completedCount,"/",e.length]})]}),a.jsx("div",{className:aa.progress,role:"progressbar","aria-label":p("planExecution.overallProgress"),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":m.progressPercent,children:a.jsx("span",{style:{width:`${m.progressPercent}%`}})}),a.jsxs("div",{className:aa.summaryMeta,children:[a.jsx("span",{children:p("workflow.inspector.activeAgents",{count:m.activeAgents.length})}),a.jsx("span",{children:p("workflow.inspector.attentionCount",{count:m.attentionTodos.length})})]}),a.jsxs("button",{className:aa.expandButton,onClick:l,type:"button",children:[a.jsx(nh,{"aria-hidden":"true"}),p("workflow.inspector.expandGraph"),a.jsx(Ol,{"aria-hidden":"true"})]})]}),m.attentionTodos.length>0&&a.jsxs("section",{className:aa.attention,children:[a.jsxs("div",{className:aa.compactHeading,children:[a.jsx("h2",{children:p("workflow.tabs.attention")}),a.jsx("span",{children:m.attentionTodos.length})]}),m.attentionTodos.map(T=>a.jsxs("button",{"aria-pressed":w===T.id,onClick:()=>i(T.id),type:"button",children:[a.jsx(od,{"aria-hidden":"true",className:aa.attentionGlyph}),a.jsx("span",{children:T.content}),a.jsx(Ol,{"aria-hidden":"true"})]},T.id))]}),a.jsxs("section",{className:aa.steps,"data-testid":"workflow-step-list",children:[a.jsxs("div",{className:aa.compactHeading,children:[a.jsx("h2",{children:p("workflow.inspector.allSteps")}),a.jsx("span",{children:e.length})]}),a.jsx("div",{className:aa.stepList,children:e.map((T,N)=>{const A=m.states.get(T.id);return a.jsxs("button",{"aria-pressed":w===T.id,onClick:()=>i(T.id),type:"button",children:[a.jsx("span",{className:aa.stepIndex,"data-status":A?.status,children:N+1}),a.jsxs("span",{className:aa.itemText,children:[a.jsx("strong",{children:T.content}),a.jsx("small",{children:T.id})]}),A&&a.jsx("span",{className:aa.stateLabel,"data-status":A.status,children:p(`planExecution.status.${A.status}`)})]},T.id)})})]}),R,a.jsxs("details",{className:aa.collapsible,open:!0,children:[a.jsxs("summary",{children:[a.jsx("span",{children:p("workflow.inspector.recentActivity")}),a.jsx("small",{children:m.activity.length})]}),a.jsxs("div",{className:aa.activityList,children:[(b?m.activity:m.activity.slice(0,TPe)).map(T=>{const N=m.toolsByTaskId.get(T.id),A=T.endTime??T.startTime,M=a.jsxs(a.Fragment,{children:[a.jsx("time",{dateTime:A?new Date(A).toISOString():void 0,children:Krn(A,f)}),a.jsx("span",{className:aa.activityAvatar,children:Grn(T.subagentType||T.label)}),a.jsxs("span",{className:aa.itemText,children:[a.jsx("strong",{children:T.label}),a.jsx("small",{children:T.recentActivities?.at(-1)?.description||T.description})]}),a.jsx("span",{className:aa.stateLabel,"data-status":T.status,children:p(MAe(T.status))})]});return N?a.jsx("button",{"aria-disabled":!!np(N)||void 0,title:p(np(N)??"planExecution.openDetails"),onClick:()=>k(N),type:"button",children:M},T.id):a.jsx("div",{children:M},T.id)}),m.activity.length===0&&a.jsx("p",{children:p("workflow.activity.empty")}),!b&&m.activity.length>TPe&&a.jsx("button",{className:aa.showAllActivity,"data-plan-interactive":!0,"data-testid":"workflow-activity-show-all",onClick:()=>y(!0),type:"button",children:p("workflow.activity.showAll",{count:m.activity.length})})]})]}),a.jsxs("details",{className:aa.collapsible,open:r.length>0,children:[a.jsxs("summary",{children:[a.jsx("span",{children:p("workflow.deliverables.title")}),a.jsx("small",{children:r.length})]}),a.jsxs("div",{className:aa.deliverables,children:[r.map(T=>a.jsxs("button",{disabled:!d,onClick:()=>d?.(T.id),type:"button",children:[a.jsxs("span",{className:aa.itemText,children:[a.jsx("strong",{children:k9(T)}),a.jsxs("small",{className:aa.metrics,children:[a.jsx("span",{children:T.kind}),a.jsx("span",{children:T.status})]})]}),a.jsx(dle,{"aria-hidden":"true"})]},T.id)),r.length===0&&a.jsx("p",{children:p("workflow.deliverables.none")})]})]})]})}/**
|
|
2885
|
+
</head><body></body></html>`;function Bms({workspacePath:e,workspaceActions:t,data:n,artifactVersion:s,downloadName:r}){const{t:o}=et(),[i,l]=u.useState(),[c,d]=u.useState(!1),[h,f]=u.useState(),[p,m]=u.useState(),[g,v]=u.useState(),[b,y]=u.useState(!1),[w,x]=u.useState(0),k=u.useRef(void 0);return u.useEffect(()=>{const _={};if(k.current=_,!i)return()=>{k.current=void 0};let S=!1,E=!1,j,I;const R=i.createElement("div");i.body.replaceChildren(R);const T=A=>{S||E||(E=!0,clearTimeout(j),R.remove(),f(A))};return d(!1),f(void 0),m(void 0),v(void 0),y(!1),(async()=>{const A=n??await IT(t.readFileBytes,e,yce,{statFile:async D=>{const z=await t.stat(D);if(z.sizeBytes>noe)throw new Error(o("docx.tooLarge"));return z},isCancelled:()=>S,maxBytes:noe});if(S)return;if(I=URL.createObjectURL(A),m(I),A.size>noe){T(o("docx.tooLarge"));return}j=setTimeout(()=>T(o("docx.timeout")),3e4);const M=await A.arrayBuffer(),{renderAsync:P}=await bt(async()=>{const{renderAsync:D}=await import("./docx-preview-CfGqg6IJ.js");return{renderAsync:D}},[]);if(!(S||E)){try{await P(M,R,R,{useBase64URL:!0,renderAltChunks:!1})}catch{T(o("docx.invalid"));return}if(!(S||E)){clearTimeout(j);for(const D of R.querySelectorAll("a")){const z=D.getAttribute("href");z?.startsWith("#")?D.addEventListener("click",B=>{B.preventDefault(),i.getElementById(z.slice(1))?.scrollIntoView()}):D.removeAttribute("href"),D.removeAttribute("target")}d(!0)}}})().catch(A=>{T(ja(A))}),()=>{S=!0,k.current=void 0,clearTimeout(j),R.remove(),I&&URL.revokeObjectURL(I)}},[i,n,e,t,s,w,o]),a.jsxs("div",{"data-web-shell-docx-preview":!0,className:"flex h-full min-h-0 flex-col",children:[a.jsx("div",{className:"flex justify-end border-b border-border p-1",children:p?a.jsx(Ae,{variant:"ghost",size:"sm",asChild:!0,children:a.jsxs("a",{href:p,download:r??K0e(e),onClick:_=>_.stopPropagation(),children:[a.jsx(Zy,{"aria-hidden":"true"}),o("common.download")]})}):t?a.jsxs(Ae,{variant:"ghost",size:"sm",disabled:b,onClick:()=>{const _=k.current,S=()=>k.current!==_;y(!0),v(void 0),x9(t,e,yce,S).catch(E=>{S()||v(ja(E))}).finally(()=>{S()||y(!1)})},children:[a.jsx(Zy,{"aria-hidden":"true"}),o("common.download")]}):null}),g&&a.jsx("p",{role:"alert",className:"p-3 text-sm text-destructive",children:g}),a.jsxs("div",{className:"relative min-h-0 flex-1",children:[a.jsx("iframe",{title:`Preview ${e}`,className:"h-full w-full border-0",style:{visibility:c?"visible":"hidden"},srcDoc:Oms,sandbox:"allow-same-origin",referrerPolicy:"no-referrer",onLoad:_=>{l(_.currentTarget.contentDocument??void 0)}}),h?a.jsxs("div",{role:"alert",className:"absolute inset-0 space-y-3 p-4 text-sm",children:[a.jsx("p",{children:h}),a.jsx(Ae,{variant:"outline",size:"sm",onClick:()=>x(_=>_+1),children:o("common.retry")})]}):c?null:a.jsx("div",{role:"status",className:"absolute inset-0 p-4 text-sm text-muted-foreground",children:o("attachment.loadingPreview")})]})]})}const $ms="_detail_4ah9l_1",Fms="_state_4ah9l_9",zms="_overview_4ah9l_17",Ums="_descriptionRow_4ah9l_25",Wms="_statusTag_4ah9l_33",Hms="_statusActions_4ah9l_38",qms="_stopButton_4ah9l_45",Vms="_stopError_4ah9l_67",Gms="_description_4ah9l_25",Kms="_transcript_4ah9l_114",Yms="_retry_4ah9l_122",by={detail:$ms,state:Fms,overview:zms,descriptionRow:Ums,statusTag:Wms,statusActions:Hms,stopButton:qms,stopError:Vms,description:Gms,transcript:Kms,retry:Yms};function Xms(e,t){const n=typeof e.rawOutput=="object"&&e.rawOutput!==null?e.rawOutput:void 0,s=typeof n?.executionSummary=="object"&&n.executionSummary!==null?n.executionSummary:void 0,r=s?.totalDurationMs,o=s?.inputTokens,i=s?.outputTokens,l=s?.cachedTokens;return{status:t.status,durationMs:typeof r=="number"?r:e.endTime&&e.startTime?Math.max(0,e.endTime-e.startTime):t.durationMs,inputTokens:typeof o=="number"?o:t.inputTokens,outputTokens:typeof i=="number"?i:t.outputTokens,cachedTokens:typeof l=="number"?l:t.cachedTokens}}function SPe(){return`subagent-detail:${typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Math.random().toString(36).slice(2)}`}function Jms(e,t){for(const n of e){if(n.role!=="tool_group")continue;const s=n.tools.find(r=>r.callId===t);if(s)return s}}function Qms(e,t){switch(e){case"completed":case"success":return t("subagent.completed");case"failed":case"error":return t("subagent.failed");case"cancelled":case"canceled":return t("subagent.cancelled");case"paused":return t("subagent.paused");default:return t("subagent.running")}}function Zms({rootTool:e,resolution:t,onStop:n,onRightPanelOpen:s,onArtifactsChange:r,onOpenSubagent:o,onError:i}){const{t:l}=et(),c=ba(),{blocks:d,blockChangeSummary:h}=pA(),f=aJ(l,d,h),{artifacts:p}=Tbe(),m=u.useMemo(()=>FN(f,p,c.workspaceCwd||""),[p,c.workspaceCwd,f]),g=ibe(f,m,c.workspaceCwd||c.standaloneSession?.projectlessOutputDirectory||"",c.sessionId?obe(c.sessionId):void 0,c.workspaceCwd?void 0:null),v=_9(e),b=u.useMemo(()=>Xms(e,t),[t,e]),y=b.status==="running"||b.status==="in_progress",[w,x]=u.useState(!1),[k,_]=u.useState("");u.useEffect(()=>{const R=c.sessionId;if(R)return r?.(R,p),()=>{r?.(R,[])}},[p,c.sessionId,r]);const S=u.useRef({messages:f,artifactsByTurn:m});S.current={messages:f,artifactsByTurn:m};const E=u.useCallback(R=>{const T=S.current;s?.({...R,...R.kind==="review"?{unfilteredChanges:v4(T.messages,T.artifactsByTurn,c.workspaceCwd||c.standaloneSession?.projectlessOutputDirectory||"").get(R.turnId)??R.changes}:{},sourceSessionId:c.sessionId})},[c.sessionId,c.workspaceCwd,c.standaloneSession?.projectlessOutputDirectory,s]);u.useEffect(()=>{y||(x(!1),_(""))},[y]);const j=async()=>{if(!(w||!n)){x(!0),_("");try{(await n()).cancelled||x(!1)}catch{x(!1),_(l("tasks.cancelFailed"))}}},I=a.jsx(lX,{messages:f,pendingApproval:null,loadingTranscript:c.loadingTranscript,catchingUp:c.catchingUp,isResponding:y,activeTurnStartedAt:y?e.startTime:void 0,workspaceCwd:c.workspaceCwd||"",hideSessionTimeline:!0,firstTurnMetrics:b,includeSubagentToolUsageInMetrics:!1,turnFileChanges:g,sourceSessionId:c.sessionId,turnArtifacts:m,onTurnOutputOpen:E,onError:i});return a.jsxs("div",{className:by.detail,children:[a.jsxs("div",{className:by.overview,children:[a.jsxs("div",{className:by.descriptionRow,children:[v&&a.jsx("div",{className:by.description,children:v}),a.jsxs("div",{className:by.statusActions,children:[a.jsx(Qr,{variant:"outline",className:by.statusTag,"data-status":b.status,children:Qms(b.status,l)}),y&&n&&a.jsx("button",{type:"button",className:by.stopButton,disabled:w,onClick:()=>void j(),children:l(w?"common.loading":"tasks.action.stop")})]})]}),k&&a.jsx("div",{className:by.stopError,children:k})]}),a.jsx("div",{className:by.transcript,children:o?a.jsx(yve,{onOpen:o,children:I}):I})]})}function egs({sessionId:e,rootToolCallId:t,initialRootTool:n,workspaceCwd:s,onRightPanelOpen:r,onArtifactsChange:o,onOpenSubagent:i,onError:l}){const{t:c}=et(),d=Co(),h=ba(),{blocks:f,blockChangeSummary:p}=pA(),m=aJ(c,f,p),g=(h.sessionId===e?Jms(m,t):void 0)??n,[v,b]=u.useState(()=>({key:0,clientId:SPe()})),y=Fu(),[w,x]=u.useState(),[k,_]=u.useState(!1);return u.useEffect(()=>{let S=!1,E=!1,j=0,I=!1,R=!1,T=!1,N;x(void 0),_(!1);const A=async()=>{if(!(R||y&&y.getSnapshot()!=="available")){R=!0;try{const D=await d.client.resolveSubagentSession(e,t);if(S)return;E=!0,j=0,I=D.status==="running",x(D),_(!1),D.status==="running"&&(!y||y.getSnapshot()==="available")&&(N=setTimeout(()=>void A(),3e3))}catch(D){if(S||Yl(D)||y&&y.getSnapshot()!=="available")return;j<3?(j+=1,N=setTimeout(()=>void A(),3e3)):E?I&&(N=setTimeout(()=>void A(),3e4)):_(!0)}finally{R=!1,T&&!S&&(!y||y.getSnapshot()==="available")&&(T=!1,N&&clearTimeout(N),A())}}};let M=y?.getSnapshot()==="available";const P=y?.subscribe(()=>{const D=y.getSnapshot()==="available";D!==M&&(M=D,N&&clearTimeout(N),D&&(!E||I)&&(R?T=!0:A()))});return A(),()=>{S=!0,P?.(),N&&clearTimeout(N)}},[y,v.key,t,e,d.client]),k?a.jsxs("div",{className:by.state,children:[a.jsx("div",{children:c("subagent.detailsLoadFailed")}),a.jsx("button",{type:"button",className:by.retry,onClick:()=>b(S=>({key:S.key+1,clientId:SPe()})),children:c("common.retry")})]}):w?a.jsx(IK,{sessionId:w.sessionId,workspaceCwd:s,clientId:v.clientId,maxQueued:256,maxBlocks:TK,subagentTranscriptMode:"full",suppressOwnUserEcho:!0,children:a.jsx(Zms,{rootTool:g,resolution:w,onRightPanelOpen:r,onArtifactsChange:o,onOpenSubagent:i?(S,E)=>i(S,E??e,s):void 0,onError:l,onStop:n.rawOutput&&typeof n.rawOutput=="object"&&"workflowRunId"in n.rawOutput?void 0:()=>d.client.cancelSubagentSession(e,t)})},`${v.key}:${w.sessionId}`):a.jsx("div",{className:by.state,children:c("subagent.detailsLoading")})}const tgs="_viewport_7jcdi_1",ngs="_canvas_7jcdi_14",sgs="_edges_7jcdi_20",rgs="_edgeRunning_7jcdi_33",ogs="_node_7jcdi_39",igs="_nodeTitle_7jcdi_78",ags="_mainNode_7jcdi_88",lgs="_nodeMeta_7jcdi_108",cgs="_status_7jcdi_114",dgs="_statusRunning_7jcdi_136",ugs="_duration_7jcdi_140",hgs="_empty_7jcdi_146",fgs="_loading_7jcdi_147",Xm={viewport:tgs,canvas:ngs,edges:sgs,edgeRunning:rgs,node:ogs,nodeTitle:igs,mainNode:ags,nodeMeta:lgs,status:cgs,statusRunning:dgs,duration:ugs,empty:hgs,loading:fgs},QN=184,xhe=68,Oz=32,pgs=72,O6=32,rD="__main__";function CPe(e){return e?{left:e.x,top:e.y}:void 0}function mgs(e){const t=new Map(e.map(h=>[h.id,h])),n=new Map;for(const h of e){const f=h.parentAgentId&&t.has(h.parentAgentId)?h.parentAgentId:rD,p=n.get(f)??[];p.push(h),n.set(f,p)}const s=new Map,r=new Set,o=h=>{const f=s.get(h);if(f!==void 0)return f;if(r.has(h))return QN;r.add(h);const p=n.get(h)??[],m=Math.max(QN,p.reduce((g,v)=>g+o(v.id),0)+Math.max(0,p.length-1)*Oz);return r.delete(h),s.set(h,m),m},i=new Map,l=new Set,c=(h,f,p)=>{if(l.has(h))return;l.add(h);const m=o(h);i.set(h,{x:f+(m-QN)/2,y:O6+p*(xhe+pgs)});let g=f;for(const v of n.get(h)??[])c(v.id,g,p+1),g+=o(v.id)+Oz};c(rD,O6,0);let d=O6+o(rD)+Oz;for(const h of e)l.has(h.id)||(c(h.id,d,1),d+=o(h.id)+Oz);return{positions:i,width:Math.max(360,...Array.from(i.values(),({x:h})=>h+QN+O6)),height:Math.max(220,...Array.from(i.values(),({y:h})=>h+xhe+O6))}}function ggs(e,t,n){const s=(e.subagentType?.toLowerCase()==="fork"?e.label.replace(/^fork:\s*/i,""):e.label).trim();return s&&s.toLowerCase()!=="agent"?s:n(t+1)}function vgs(e,t){return e.status==="running"?e.startTime>0?Math.max(e.runtimeMs,t-e.startTime):e.runtimeMs:e.endTime===void 0?e.runtimeMs:Math.max(0,e.endTime-e.startTime)||e.runtimeMs}function ygs({tasks:e,loading:t=!1,error:n,onOpenAgent:s}){const{t:r}=et(),o=u.useMemo(()=>mgs(e),[e]),i=e.some(d=>d.status==="running"),[l,c]=u.useState(Date.now);return u.useEffect(()=>{if(!i)return;c(Date.now());const d=window.setInterval(()=>c(Date.now()),1e3);return()=>window.clearInterval(d)},[i]),t?a.jsxs("div",{className:Xm.loading,role:"status","aria-label":r("common.loading"),children:[a.jsx(Vx,{className:"h-[68px] w-[184px] rounded-xl"}),a.jsx(Vx,{className:"h-[68px] w-[184px] rounded-xl"})]}):n?a.jsx("div",{className:Xm.empty,children:n}):e.length===0?a.jsx("div",{className:Xm.empty,children:r("workflow.empty")}):a.jsx("div",{className:Xm.viewport,"data-testid":"agent-workflow",children:a.jsxs("div",{className:Xm.canvas,style:{width:o.width,height:o.height},children:[a.jsx("svg",{className:Xm.edges,"data-testid":"agent-workflow-edges",width:o.width,height:o.height,"aria-hidden":"true",children:e.map(d=>{const h=o.positions.get(d.parentAgentId??"")??o.positions.get(rD),f=o.positions.get(d.id),p=h.x+QN/2,m=h.y+xhe,g=f.x+QN/2,v=f.y,b=(m+v)/2;return a.jsx("path",{className:d.status==="running"?Xm.edgeRunning:"",d:`M ${p} ${m} C ${p} ${b}, ${g} ${b}, ${g} ${v}`},d.id)})}),a.jsxs("div",{className:`${Xm.node} ${Xm.mainNode}`,style:CPe(o.positions.get(rD)),children:[a.jsx(tk,{}),a.jsx("span",{children:r("workflow.mainAgent")})]}),e.map((d,h)=>a.jsxs("button",{type:"button",className:Xm.node,"data-status":d.status,style:CPe(o.positions.get(d.id)),onClick:()=>s?.(d),disabled:!s,title:d.description||d.label,children:[a.jsxs("span",{className:Xm.nodeTitle,children:[a.jsx(tk,{}),a.jsx("span",{children:ggs(d,h,f=>r("environment.unnamedAgent",{index:f}))})]}),a.jsxs("span",{className:Xm.nodeMeta,children:[a.jsxs("span",{className:Xm.status,"data-status":d.status,children:[d.status==="completed"&&a.jsx(gb,{}),d.status==="running"&&a.jsx(sh,{className:Xm.statusRunning}),d.status==="paused"&&a.jsx(Wqe,{}),d.status==="failed"&&a.jsx($2,{}),d.status==="cancelled"&&a.jsx(qqe,{}),r(`tasks.${d.status}`)]}),a.jsx("span",{className:Xm.duration,children:ta(vgs(d,l))})]})]},d.id))]})})}const wgs=3;function bgs({tabId:e,sessionId:t,parentSessionId:n,workspaceCwd:s,title:r,shouldNameFromFirstPrompt:o,initialPrompt:i,createSession:l,onCreated:c,onTitleChange:d,onRightPanelOpen:h,onArtifactsChange:f,onError:p,sessionWorkflowEnabled:m,modelManagement:g,unavailableModels:v,mountUnavailableModelTooltip:b,onImageIngestionNotice:y,onInitialPromptRefused:w}){return t?a.jsx(IK,{sessionId:t,workspaceCwd:s,clientId:`side-task:${n}:${e}`,autoConnect:!0,historyPageSize:Gg,subagentTranscriptMode:"summary",maxBlocks:TK,suppressOwnUserEcho:!0,children:a.jsx(kgs,{tabId:e,title:r,shouldNameFromFirstPrompt:o,initialPrompt:i,workspaceCwd:s,onTitleChange:d,onRightPanelOpen:h,onArtifactsChange:f,onError:p,sessionWorkflowEnabled:m,modelManagement:g,unavailableModels:v,mountUnavailableModelTooltip:b,onImageIngestionNotice:y,onInitialPromptRefused:w})}):a.jsx(xgs,{tabId:e,parentSessionId:n,title:r,createSession:l,onCreated:c,onTitleChange:d,onError:p})}function xgs({tabId:e,parentSessionId:t,title:n,createSession:s,onCreated:r,onTitleChange:o,onError:i}){const{t:l}=et(),c=u.useRef(!1),d=u.useRef(!1),h=u.useRef(!0),[f,p]=u.useState();u.useEffect(()=>(h.current=!0,()=>{h.current=!1}),[]);const m=u.useCallback(async()=>{if(!c.current){c.current=!0,p(void 0);try{const g=await s(e,t,n);r(e,g.sessionId),h.current&&g.displayName&&o(e,g.displayName)}catch(g){if(!h.current)return;p(g),i?.(g,l("sideTask.createFailed"))}finally{c.current=!1}}},[s,r,i,o,t,l,e,n]);return u.useEffect(()=>{d.current||(d.current=!0,m())},[m]),f?a.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 text-sm text-muted-foreground",children:[a.jsx("span",{children:l("sideTask.createFailed")}),a.jsx(Ae,{type:"button",variant:"outline",onClick:()=>void m(),children:l("common.retry")})]}):a.jsxs("div",{className:"flex h-full items-center justify-center gap-2 text-sm text-muted-foreground",role:"status",children:[a.jsx(Ur,{}),a.jsx("span",{children:l("sideTask.creating")})]})}function kgs({tabId:e,title:t,shouldNameFromFirstPrompt:n,initialPrompt:s,workspaceCwd:r,onTitleChange:o,onRightPanelOpen:i,onArtifactsChange:l,onError:c,sessionWorkflowEnabled:d,modelManagement:h,unavailableModels:f,mountUnavailableModelTooltip:p,onImageIngestionNotice:m,onInitialPromptRefused:g}){const{t:v}=et(),b=ba(),y=nf(),w=Co(),x=cS(w.client),k=Ime(),_=Tme(),S=b.workspaceCwd&&r&&b.workspaceCwd!==r?void 0:b.workspaceCwd??r,E=k.some(D=>D.kind==="user"&&(typeof D.text=="string"?D.text.trim().length>0:!D.images?.length)),j=k.some(D=>D.kind!=="user"?!1:D.images?.length||D.files?.length||D.resourceLinks?.length?!0:typeof D.text!="string"||D.text.trim().length>0),I=b.status==="connected"&&!b.loadingTranscript&&!b.catchingUp&&!_.loading&&!_.hasMore&&!_.capacityReached&&!_.paginationError,R=I&&!j,T=!E&&(n||I&&!E);u.useEffect(()=>{const D=b.displayName?.trim();D&&o(e,D)},[b.displayName,o,e]);const N=u.useCallback(D=>{const z=Array.from(D.trim()).slice(0,200).join("");z&&(o(e,z),(async()=>{let B;for(let $=0;$<wgs;$++)try{await y.renameSession(z),b.sessionId&&S&&x.renamed(S,b.sessionId,z),o(e,z,!0);return}catch(L){B=L}S&&x.invalidateWorkspace(S),c?.(B,v("sideTask.renameFailed"))})())},[y,S,b.sessionId,c,o,x,v,e]),A=u.useRef(!1),M=!!(s?.trim()&&R&&!A.current&&!yG(h).allowAdd&&!xit(b.commands)&&Uy(s)),P=u.useRef(m);return P.current=m,u.useEffect(()=>{if(!M)return;const D=setTimeout(()=>{P.current?.("warning",v("sideTask.commandsLoadingTimedOut"))},5e3);return()=>clearTimeout(D)},[M,s,b.sessionId,v]),u.useEffect(()=>{const D=s?.trim();if(!(!D||!R||A.current||M)){if(A.current=!0,!yG(h).allowAdd&&Uy(D,b.commands)){m?.("warning",v("settings.models.addDisabled")),g?.(e);return}y.sendPrompt(D,{onAdmitted:()=>{b.sessionId&&S&&x.promptAdmitted(S,b.sessionId),N(D)}}).catch(z=>{A.current=!1,c?.(z,v("sideTask.promptFailed"))})}},[y,S,b.commands,b.sessionId,s,h,m,g,N,c,R,M,x,v,e]),b.sessionId?a.jsx(Clt,{title:b.displayName?.trim()||t,workspaceCwd:r,onError:c,onImageIngestionNotice:m,embedded:!0,onFirstPromptAdmitted:T?N:void 0,onRightPanelOpen:i,onPaneArtifactsChange:l,sessionWorkflowEnabled:d,modelManagement:h,unavailableModels:f,mountUnavailableModelTooltip:p}):a.jsx("div",{className:"flex h-full items-center justify-center",children:a.jsx(Ur,{})})}const _gs="_inspector_cn1ku_1",Sgs="_summary_cn1ku_20",Cgs="_detail_cn1ku_21",Tgs="_attention_cn1ku_22",Igs="_steps_cn1ku_23",Rgs="_collapsible_cn1ku_24",Egs="_summaryHeading_cn1ku_38",Ags="_sectionHeading_cn1ku_39",jgs="_compactHeading_cn1ku_40",Ngs="_summaryCount_cn1ku_72",Mgs="_progress_cn1ku_87",Pgs="_summaryMeta_cn1ku_108",Dgs="_expandButton_cn1ku_116",Lgs="_stepList_cn1ku_177",Ogs="_linkedAgents_cn1ku_178",Bgs="_deliverables_cn1ku_179",$gs="_activityList_cn1ku_180",Fgs="_attentionGlyph_cn1ku_216",zgs="_status_cn1ku_228",Ugs="_stepId_cn1ku_254",Wgs="_dependencies_cn1ku_262",Hgs="_dependencyList_cn1ku_291",qgs="_dependencyLink_cn1ku_309",Vgs="_dependencyNumber_cn1ku_333",Ggs="_showAllActivity_cn1ku_358",Kgs="_itemText_cn1ku_398",Ygs="_stepIndex_cn1ku_474",Xgs="_metrics_cn1ku_349",Jgs="_stateLabel_cn1ku_545",Qgs="_activityAvatar_cn1ku_605",Zgs="_canvasHint_cn1ku_617",e0s="_empty_cn1ku_633",aa={inspector:_gs,summary:Sgs,detail:Cgs,attention:Tgs,steps:Igs,collapsible:Rgs,summaryHeading:Egs,sectionHeading:Ags,compactHeading:jgs,summaryCount:Ngs,progress:Mgs,summaryMeta:Pgs,expandButton:Dgs,stepList:Lgs,linkedAgents:Ogs,deliverables:Bgs,activityList:$gs,attentionGlyph:Fgs,status:zgs,stepId:Ugs,dependencies:Wgs,dependencyList:Hgs,dependencyLink:qgs,dependencyNumber:Vgs,showAllActivity:Ggs,itemText:Kgs,stepIndex:Ygs,metrics:Xgs,stateLabel:Jgs,activityAvatar:Qgs,canvasHint:Zgs,empty:e0s},TPe=6;function t0s({todos:e,tools:t,tasks:n,projection:s,artifacts:r,selectedTodoId:o,onSelectedTodoIdChange:i,onExpandGraph:l,onOpenSubagent:c,onOpenArtifact:d,canvasMode:h=!1}){const{language:f,t:p}=et(),m=u.useMemo(()=>s??XY(e,t,n),[s,n,e,t]),g=cJe(e,m),v=u.useMemo(()=>{const T=new Map;return e.forEach((N,A)=>T.set(N.id,A+1)),T},[e]),[b,y]=u.useState(!1),w=m.todosById.has(o??"")?o:g,x=m.todosById.get(w??"");u.useEffect(()=>{w!==o&&i(w)},[w,i,o]);const k=T=>{np(T)||c(T)};if(e.length===0)return a.jsxs("div",{className:aa.empty,"data-testid":"workflow-inspector-empty",children:[a.jsx(nh,{"aria-hidden":"true"}),a.jsx("strong",{children:p("workflow.empty.title")}),a.jsx("p",{children:p("workflow.empty.copy")})]});const _=x?m.states.get(x.id):void 0,S=x?m.agentToolsByTodo.get(x.id)??[]:[],E=x?[...new Set(x.blockedBy??[])].filter(T=>T!==x.id&&m.todosById.has(T)):void 0,j=x?m.dependentsByTodo.get(x.id)??[]:[],I=T=>{const N=m.todosById.get(T),A=v.get(T);return a.jsx("li",{children:a.jsxs("button",{className:aa.dependencyLink,"data-plan-interactive":!0,"data-testid":`workflow-dependency-${T}`,onClick:()=>i(T),title:N?.content,type:"button",children:[A!==void 0&&a.jsx("span",{className:aa.dependencyNumber,children:A}),a.jsx("span",{children:N?.content??T})]})},T)},R=x&&_&&a.jsxs("section",{className:aa.detail,"data-testid":"workflow-step-detail",children:[a.jsxs("div",{className:aa.sectionHeading,children:[a.jsxs("div",{children:[a.jsx("span",{children:p("workflow.inspector.selectedStep")}),a.jsx("h2",{children:x.content})]}),a.jsx("span",{className:aa.status,"data-status":_.status,children:p(`planExecution.status.${_.status}`)})]}),a.jsx("code",{className:aa.stepId,children:x.id}),a.jsxs("dl",{className:aa.dependencies,children:[a.jsxs("div",{children:[a.jsx("dt",{children:p("workflow.dependencies.upstream")}),a.jsx("dd",{children:E?.length?a.jsx("ul",{className:aa.dependencyList,children:E.map(T=>I(T))}):p("workflow.dependencies.none")})]}),a.jsxs("div",{children:[a.jsx("dt",{children:p("workflow.dependencies.unblocks")}),a.jsx("dd",{children:j.length?a.jsx("ul",{className:aa.dependencyList,children:j.map(T=>I(T.id))}):p("workflow.dependencies.noDownstream")})]})]}),a.jsxs("div",{className:aa.linkedAgents,children:[a.jsx("h3",{children:p("planExecution.subagents")}),S.length?S.map(T=>{const N=m.tasksByTool.get(T),A=N?[N.startTime>0?Tm(N.runtimeMs):"",N.stats?.toolUses===void 0?"":p("planExecution.toolCalls",{count:N.stats.toolUses}),N.stats?.totalTokens===void 0?"":p("planExecution.tokens",{count:N.stats.totalTokens.toLocaleString()})].filter(Boolean):[];return a.jsxs("button",{"aria-disabled":!!np(T)||void 0,title:p(np(T)??"planExecution.openDetails"),onClick:()=>k(T),type:"button",children:[a.jsxs("span",{className:aa.itemText,children:[a.jsx("strong",{children:T.title||String(T.args?.description??"Agent")}),N&&a.jsx("small",{children:N.recentActivities?.at(-1)?.description||N.description}),A.length>0&&a.jsx("small",{className:aa.metrics,children:A.map(M=>a.jsx("span",{children:M},M))})]}),N&&a.jsx("span",{className:aa.stateLabel,"data-status":N.status,children:p(MAe(N.status))}),a.jsx(dle,{"aria-hidden":"true"})]},T.callId)}):a.jsx("p",{children:p("planExecution.noSubagents")})]})]});return h?a.jsxs("div",{className:aa.inspector,"data-testid":"workflow-canvas-detail",children:[a.jsxs("div",{className:aa.canvasHint,children:[a.jsx(nh,{"aria-hidden":"true"}),a.jsx("span",{children:p("workflow.inspector.canvasHint")})]}),R]}):a.jsxs("div",{className:aa.inspector,"data-testid":"workflow-inspector",children:[a.jsxs("section",{className:aa.summary,children:[a.jsxs("div",{className:aa.summaryHeading,children:[a.jsxs("div",{children:[a.jsx("span",{children:p("workflow.inspector.summary")}),a.jsx("strong",{children:p(m.taskStatusI18nKey)})]}),a.jsxs("span",{className:aa.summaryCount,"data-status":m.taskStatusTone,children:[m.completedCount,"/",e.length]})]}),a.jsx("div",{className:aa.progress,role:"progressbar","aria-label":p("planExecution.overallProgress"),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":m.progressPercent,children:a.jsx("span",{style:{width:`${m.progressPercent}%`}})}),a.jsxs("div",{className:aa.summaryMeta,children:[a.jsx("span",{children:p("workflow.inspector.activeAgents",{count:m.activeAgents.length})}),a.jsx("span",{children:p("workflow.inspector.attentionCount",{count:m.attentionTodos.length})})]}),a.jsxs("button",{className:aa.expandButton,onClick:l,type:"button",children:[a.jsx(nh,{"aria-hidden":"true"}),p("workflow.inspector.expandGraph"),a.jsx(Ol,{"aria-hidden":"true"})]})]}),m.attentionTodos.length>0&&a.jsxs("section",{className:aa.attention,children:[a.jsxs("div",{className:aa.compactHeading,children:[a.jsx("h2",{children:p("workflow.tabs.attention")}),a.jsx("span",{children:m.attentionTodos.length})]}),m.attentionTodos.map(T=>a.jsxs("button",{"aria-pressed":w===T.id,onClick:()=>i(T.id),type:"button",children:[a.jsx(od,{"aria-hidden":"true",className:aa.attentionGlyph}),a.jsx("span",{children:T.content}),a.jsx(Ol,{"aria-hidden":"true"})]},T.id))]}),a.jsxs("section",{className:aa.steps,"data-testid":"workflow-step-list",children:[a.jsxs("div",{className:aa.compactHeading,children:[a.jsx("h2",{children:p("workflow.inspector.allSteps")}),a.jsx("span",{children:e.length})]}),a.jsx("div",{className:aa.stepList,children:e.map((T,N)=>{const A=m.states.get(T.id);return a.jsxs("button",{"aria-pressed":w===T.id,onClick:()=>i(T.id),type:"button",children:[a.jsx("span",{className:aa.stepIndex,"data-status":A?.status,children:N+1}),a.jsxs("span",{className:aa.itemText,children:[a.jsx("strong",{children:T.content}),a.jsx("small",{children:T.id})]}),A&&a.jsx("span",{className:aa.stateLabel,"data-status":A.status,children:p(`planExecution.status.${A.status}`)})]},T.id)})})]}),R,a.jsxs("details",{className:aa.collapsible,open:!0,children:[a.jsxs("summary",{children:[a.jsx("span",{children:p("workflow.inspector.recentActivity")}),a.jsx("small",{children:m.activity.length})]}),a.jsxs("div",{className:aa.activityList,children:[(b?m.activity:m.activity.slice(0,TPe)).map(T=>{const N=m.toolsByTaskId.get(T.id),A=T.endTime??T.startTime,M=a.jsxs(a.Fragment,{children:[a.jsx("time",{dateTime:A?new Date(A).toISOString():void 0,children:Krn(A,f)}),a.jsx("span",{className:aa.activityAvatar,children:Grn(T.subagentType||T.label)}),a.jsxs("span",{className:aa.itemText,children:[a.jsx("strong",{children:T.label}),a.jsx("small",{children:T.recentActivities?.at(-1)?.description||T.description})]}),a.jsx("span",{className:aa.stateLabel,"data-status":T.status,children:p(MAe(T.status))})]});return N?a.jsx("button",{"aria-disabled":!!np(N)||void 0,title:p(np(N)??"planExecution.openDetails"),onClick:()=>k(N),type:"button",children:M},T.id):a.jsx("div",{children:M},T.id)}),m.activity.length===0&&a.jsx("p",{children:p("workflow.activity.empty")}),!b&&m.activity.length>TPe&&a.jsx("button",{className:aa.showAllActivity,"data-plan-interactive":!0,"data-testid":"workflow-activity-show-all",onClick:()=>y(!0),type:"button",children:p("workflow.activity.showAll",{count:m.activity.length})})]})]}),a.jsxs("details",{className:aa.collapsible,open:r.length>0,children:[a.jsxs("summary",{children:[a.jsx("span",{children:p("workflow.deliverables.title")}),a.jsx("small",{children:r.length})]}),a.jsxs("div",{className:aa.deliverables,children:[r.map(T=>a.jsxs("button",{disabled:!d,onClick:()=>d?.(T.id),type:"button",children:[a.jsxs("span",{className:aa.itemText,children:[a.jsx("strong",{children:k9(T)}),a.jsxs("small",{className:aa.metrics,children:[a.jsx("span",{children:T.kind}),a.jsx("span",{children:T.status})]})]}),a.jsx(dle,{"aria-hidden":"true"})]},T.id)),r.length===0&&a.jsx("p",{children:p("workflow.deliverables.none")})]})]})]})}/**
|
|
2886
2886
|
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
2887
2887
|
* @license MIT
|
|
2888
2888
|
*
|
|
@@ -2965,7 +2965,7 @@ ${i("terminal.notice.protocolMismatch")}`),U.close(4002,"Terminal protocol misma
|
|
|
2965
2965
|
* Copyright 2025 Qwen Team
|
|
2966
2966
|
* SPDX-License-Identifier: Apache-2.0
|
|
2967
2967
|
*/const B_s=2048,$_s=8192,F_s=4096,z_s=2097152,woe=8,U_s=512,W_s=256,boe=65536;function H_s(e){if(e.kind==="request")return e.status==="ok"?"success":e.status;if(e.kind==="tool")switch(e.toolStatus??e.block.status){case"success":case"completed":return"success";case"error":case"failed":return"error";case"cancelled":case"canceled":return"cancelled";case"pending":case"in_progress":case"running":return"running";default:return"unknown"}}function q_s(e){switch(e.kind){case"request":return[e.model,e.recordId,e.responseId,e.promptId,e.subagentId,e.parentToolCallId];case"tool":return[e.block.toolName,e.block.toolCallId,e.block.parentToolCallId,e.block.subagentType,e.block.title];case"user":case"message":return[e.block.id];case"other":return[e.block.kind,e.block.id]}}function V_s(e){if(e.kind==="request")return[];if(e.kind==="tool")return[e.block.rawInput,e.block.rawOutput===void 0?e.block.content:e.block.rawOutput];if(e.kind==="user"||e.kind==="message")return[e.block.text];switch(e.block.kind){case"shell":case"status":case"error":case"debug":return[e.block.text];case"user_shell":return[e.block.command,e.block.text];case"permission":return[e.block.title];case"prompt_cancelled":return[e.block.reason];default:return[]}}function G_s(e){let t=z_s,n=0;return{rows:[...e.rows].reverse().map(r=>{const o=[];let i=!1,l=B_s,c=boe;const d=m=>{const g=m.slice(0,c);c-=g.length,g.length<m.length&&(i=!0);const v=w=>{const x=w.slice(0,l);x.length<w.length&&(i=!0),l-=x.length,x.length>0&&o.push(x.toLowerCase())},b=/data:(?:[a-z0-9!#$&^_.+-]{1,128}\/[a-z0-9!#$&^_.+-]{1,128})?(?:;[^,\s;"'<>]{1,128}){0,4},[^\s"'<>)]*/gi;let y=0;for(const w of g.matchAll(b))v(g.slice(y,w.index)),y=w.index+w[0].length;v(g.slice(y))};for(const m of q_s(r))m!==void 0&&d(m);let h=$_s,f=U_s,p=boe;for(const m of V_s(r)){const g=r.kind==="tool"||r.kind==="other"&&r.block.kind==="user_shell";l=Math.min(g?F_s:h,t);const v=l;c=g?boe:p;let b=g?W_s:f;const y=b,w=new Set,x=(_,S)=>{if(S>woe||b===0){i=!0;return}if(b--,_!==void 0){if(_===null||typeof _=="string"||typeof _=="boolean"||typeof _=="number"){d(String(_));return}if(typeof _=="object"&&!(!Array.isArray(_)&&Object.getPrototypeOf(_)!==Object.prototype&&Object.getPrototypeOf(_)!==null)){if(w.has(_)){i=!0;return}if(w.add(_),Array.isArray(_))for(let E=0;E<_.length;E++){if(b===0||l===0||S===woe){i=!0;break}x(_[E],S+1)}else{const E=_,j=I=>b===0||l===0||S===woe||(x(I,S+1),b===0||l===0)?(i=!0,!1):(x(E[I],S+1),!0);for(const I in E)if(Object.hasOwn(E,I)&&!(["base64","blob","inlineData","inline_data","mimeType","mime_type"].includes(I)||I==="data"&&typeof E[I]=="string")&&!j(I))break}w.delete(_)}}};x(m,0);const k=v-l;t-=k,h-=k,f-=y-b,p=c}return i&&n++,{key:r.key,kind:r.kind,status:H_s(r),fields:o}}).reverse(),truncatedCount:n}}function sDe(e,t){const n=t.query.trim().toLowerCase();return e.rows.filter(s=>(t.type==="all"||s.kind===t.type)&&(t.status==="all"||s.status===t.status)&&(!n||s.fields.some(r=>r.includes(n)))).map(s=>s.key)}const q6={query:"",type:"all",status:"all"};function rDe(e){return e.query.trim()!==""||e.type!=="all"||e.status!=="all"}function xoe(e,t,n){return JSON.stringify([e.query.trim().toLowerCase(),e.type,e.status,t?.start,t?.end,n])}const hx=34,K_s=960;function Y_s(e){return`${gE(e.inputTokens)} → ${gE(e.outputTokens)}`}const X_s=/-call_[A-Za-z0-9]+$/;function J_s(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(X_s,"")}function vE(e){const t=e.trim(),n=t.indexOf(`
|
|
2968
|
-
`);return n===-1?t:t.slice(0,n)}function Q_s(e,t){if(e.kind==="request"){const n=[ta(e.timing.durationMs)];return e.timing.ttftMs!==void 0&&n.push(t("trajectory.ttft",{duration:ta(e.timing.ttftMs)})),e.usage&&n.push(Y_s(e.usage)),n}if(e.kind==="tool"){const n=[];if(e.timing&&n.push(ta(e.timing.durationMs)),e.subagentSummary){const{requests:s,tools:r,requestMs:o}=e.subagentSummary;n.push(t("trajectory.subagentRollup",{requests:s,tools:r,duration:ta(o)}))}return n}return[]}function koe(e){const t=e.toolStatus??e.block.status;if(t==="error"||t==="failed")return No.toneError;if(t==="cancelled"||t==="canceled")return No.toneMuted}function pfe(e,t){switch(e.kind){case"user":return{badge:t("trajectory.badge.user"),text:vE(e.block.text)};case"request":{const n=J_s(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:No.toneError}:{},text:s?`${r} · ${t("trajectory.requestFailed")}`:r}}case"message":return{badge:e.thought?t("trajectory.badge.thought"):t("trajectory.badge.message"),text:vE(e.block.text),faint:e.thought};case"tool":return{badge:e.block.toolName??t("trajectory.badge.tool"),...koe(e)?{badgeTone:koe(e)}:{},text:`${e.block.title||(e.block.toolName??"")}${koe(e)===No.toneError?` · ${t("trajectory.toolFailed")}`:""}`};default:return Z_s(e.block,t)}}function Z_s(e,t){switch(e.kind){case"shell":return{badge:t("trajectory.badge.shell"),text:vE(e.text)};case"user_shell":return{badge:t("trajectory.badge.shell"),text:vE(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:No.toneError}:{},text:vE(e.text),faint:e.kind!=="error"};case"prompt_cancelled":return{badge:t("trajectory.badge.cancelled"),badgeTone:No.toneMuted,text:e.reason??t("trajectory.cancelled"),faint:!0};default:return{badge:t("trajectory.badge.other"),text:""}}}function eSs(e){return e.rows.some(t=>t.kind==="request"||t.kind==="tool"&&t.timing!==void 0)}function tSs({loadPage:e,historyGapRevision:t=0}){const{t:n,language:s}=et(),r=u.useRef(null),[o,i]=u.useState(!1);u.useLayoutEffect(()=>{const te=r.current;if(!te)return;const an=()=>i(te.clientWidth>=K_s);if(an(),typeof ResizeObserver>"u")return;const Vs=new ResizeObserver(an);return Vs.observe(te),()=>Vs.disconnect()},[]);const l=u.useRef(e);u.useLayoutEffect(()=>{l.current=e},[e]);const c=u.useCallback(()=>{if(l.current!==e)return;const te=r.current?.querySelector('[data-testid="trajectory-executions"]');(te?.querySelector('[role="grid"]')??te?.querySelector("button")??ce.current)?.focus({preventScroll:!0})},[e]),{trajectory:d,lifecycle:h,status:f,error:p,loadedPages:m,windowPages:g,truncated:v,olderFailure:b,refresh:y,retry:w,older:x,newer:k,mode:_,navigationVersion:S,navigationError:E,loadingKind:j,canRefresh:I,canOlder:R,canNewer:T,historyReleased:N}=Ubs(e),[A,M]=u.useState({loader:e,paused:!1});A.loader!==e&&M({loader:e,paused:!1});const P=u.useCallback(()=>{M(te=>te.loader!==e||te.paused&&!te.pending?te:{loader:e,paused:!0})},[e]),D=u.useRef({loader:e,status:h.status});u.useLayoutEffect(()=>{const te=D.current;D.current={loader:e,status:h.status},te.loader===e&&te.status==="live"&&h.status!=="live"&&P()},[e,h.status,P]);const z=A.loader===e&&!A.paused&&_==="latest",B=A.loader===e&&!!A.pending,[$,L]=u.useState({loader:e,revision:0}),O=u.useRef(void 0),W=u.useCallback(()=>{O.current={revision:t,trajectory:d},y()},[t,d,y]),H=u.useCallback(()=>{I&&(M({loader:e,paused:!0,pending:{of:d}}),W())},[I,e,d,W]);u.useEffect(()=>{O.current=void 0},[e]),u.useEffect(()=>{const te=O.current;te&&f!=="loading"&&p?O.current=void 0:te&&f==="ready"&&d!==te.trajectory&&(L({loader:e,revision:te.revision}),O.current=void 0)},[f,d,p,e]);const Q=t>($.loader===e?$.revision:0),V=u.useRef(!1),[re,Z]=u.useState({loader:e,version:S,selectionLost:!1}),[ue,de]=u.useState(!1),[U,G]=u.useState(!1),[Y,X]=u.useState({loader:e,value:q6,scope:0});Y.loader!==e&&X({loader:e,value:q6,scope:Y.scope+1});const pe=Y.loader===e?Y.value:q6,ae=u.useCallback(te=>{P(),X(an=>an.loader===e&&an.value.query===te.query&&an.value.type===te.type&&an.value.status===te.status?an:{loader:e,value:te,scope:an.scope})},[e,P]),se=u.useCallback(()=>ae(q6),[ae]),me=rDe(pe),ye=u.useMemo(()=>d?G_s(d):void 0,[d]),ve=u.useMemo(()=>ye?sDe(ye,pe):[],[ye,pe]),Te=u.useMemo(()=>new Set(ve),[ve]),[Ne,Ie]=u.useState(void 0),[Fe,ge]=u.useState(),_e=u.useMemo(()=>T1s(h,Zat(e)),[h,e]),[Ce,je]=u.useState(),Ue=Ce?.loader===e?_e.rows.find(te=>te.key===Ce?.key):void 0,[q,J]=u.useState(!1);u.useEffect(()=>{Ce&&!Ue&&je(void 0)},[Ce,Ue]),u.useEffect(()=>{J(!1),ge(void 0),je(void 0)},[e]),u.useEffect(()=>{Fe?.of&&d&&Fe.of!==d&&ge({...Fe,of:void 0})},[Fe,d]);const ce=u.useRef(null),ee=u.useRef(!1),fe=u.useRef(0),Re=u.useId(),Me=u.useCallback(te=>`${Re}-row-${te}`,[Re]),be=u.useCallback((te,an)=>{te.scrollTop=an,fe.current=te.scrollTop},[]),Be=u.useRef(void 0),[Ge,Ve]=u.useState("active"),pt=u.useMemo(()=>d?Act(d,{mode:Ge}):void 0,[d,Ge]),lt=f_s(pt),it=u.useMemo(()=>new Map(pt?.spans.map(te=>[te.row.key,te])),[pt]),[Tt,Ke]=u.useState(void 0),_t=Tt!==void 0&&Tt.of===d&&Tt.mode===Ge?Tt.range:void 0,Dt=u.useCallback(te=>{P(),Ke(te!==void 0&&d!==void 0?{range:te,of:d,mode:Ge}:void 0)},[d,Ge,P]);u.useEffect(()=>{Tt&&(Tt.of!==d||Tt.mode!==Ge)&&Ke(void 0)},[Tt,d,Ge]);const Rt=u.useMemo(()=>_t&&pt?jct(pt,_t):void 0,[_t,pt]),we=u.useMemo(()=>d?d_s(d):void 0,[d]),ht=u.useMemo(()=>new Map((we?.rows??[]).flatMap(te=>te.kind==="turn"?[[te.key,te.turn]]:[])),[we]),[We,tt]=u.useState(),Ft=u.useMemo(()=>!we||!We||We.loader!==e?new Set:We.of===we?We.keys:new Set([...We.keys].filter(te=>{const an=we.groupIdentities.get(te);return an!==void 0&&an===We.of.groupIdentities.get(te)})),[We,we,e]);u.useEffect(()=>{We&&(We.of!==we||We.loader!==e)&&tt(we?{of:we,loader:e,keys:Ft}:void 0)},[We,we,e,Ft]);const Ot=u.useMemo(()=>ve.filter(te=>!Rt||Rt.has(te)),[ve,Rt]),Mt=u.useMemo(()=>me?new Set(Ot):Rt,[me,Ot,Rt]),kn=xoe(pe,_t,Ge),[Dn,Un]=u.useState(),Tn=u.useMemo(()=>Dn?.of===d&&Dn?.loader===e&&Dn?.signature===kn?Dn.overrides:new Map,[Dn,d,e,kn]);u.useEffect(()=>{Dn&&(!me||Dn.of!==d||Dn.loader!==e||Dn.signature!==kn)&&Un(void 0)},[Dn,me,d,e,kn]);const xs=u.useMemo(()=>{if(!me)return Ft;const te=new Set(Ft);for(const an of Ot)for(const Vs of we?.ancestors.get(an)??[])te.delete(Vs);for(const[an,Vs]of Tn)Vs?te.add(an):te.delete(an);return te},[me,Ft,Ot,we,Tn]),Et=u.useMemo(()=>we?u_s(we,Mt):[],[we,Mt]),ln=u.useMemo(()=>new Set(Et.map(te=>te.key)),[Et]),nn=u.useMemo(()=>we?h_s(we,Et,xs):[],[we,Et,xs]),Nt=u.useMemo(()=>new Set(nn.map(te=>te.key)),[nn]),Jt=we&&Ne?Z8e(we,Ne,Nt):void 0,Bt=u.useMemo(()=>{const te=new Map;for(const an of Et)if(an.kind==="row")for(const Vs of we?.ancestors.get(an.key)??[])te.set(Vs,(te.get(Vs)??0)+1);return te},[we,Et]),gt=_==="history",jt=U0e({count:nn.length,getScrollElement:()=>ce.current,getItemKey:te=>nn[te]?.key??te,estimateSize:()=>hx,paddingStart:hx,paddingEnd:gt?hx:0,overscan:12}),Qt=u.useCallback(te=>{te===0?jt.scrollToOffset(0):jt.scrollToIndex(te,{align:"auto"})},[jt]),wn=u.useCallback(te=>{if(!d||!we?.groups.has(te))return;P();const an=ce.current;if(an){const qe=an.scrollTop-hx,Xt=Math.max(0,Math.min(nn.length-1,Math.floor(qe/hx))),en=nn[Xt];en&&(Be.current={key:en.key,offset:qe-Xt*hx})}const Vs=new Set(xs);if(Vs.has(te)?Vs.delete(te):Vs.add(te),me){const qe=new Map(Tn);qe.set(te,Vs.has(te)),Un({of:d,loader:e,signature:kn,overrides:qe})}else tt({of:we,loader:e,keys:Vs});ce.current?.focus({preventScroll:!0})},[d,we,nn,xs,e,me,kn,Tn,P]);u.useLayoutEffect(()=>{const te=Be.current;if(!te||!we||!ce.current)return;Be.current=void 0;const an=Z8e(we,te.key,Nt),Vs=nn.findIndex(qe=>qe.key===an);Vs>=0&&be(ce.current,(Vs+1)*hx+te.offset)},[we,nn,Nt,be]);const ze=nn.length>0;u.useLayoutEffect(()=>{const te=ce.current;if(!te||typeof ResizeObserver>"u")return;let an=0;const Vs=()=>{te.scrollTop===0&&fe.current>0&&(te.scrollTop=fe.current)},qe=new ResizeObserver(()=>{Vs(),an=requestAnimationFrame(Vs)});return qe.observe(te),()=>{qe.disconnect(),an!==0&&cancelAnimationFrame(an)}},[ze]),u.useEffect(()=>{if(f!=="ready"||ee.current||nn.length===0)return;ee.current=!0;const te=ce.current;te&&be(te,te.scrollHeight)},[be,f,nn.length]);const Qe=u.useMemo(()=>Jt===void 0?-1:nn.findIndex(te=>te.key===Jt),[Jt,nn]),vt=u.useRef(Qe);vt.current=Qe,u.useLayoutEffect(()=>{const te=vt.current;if(!q||te<0)return;const an=requestAnimationFrame(()=>{Qt(te)});return()=>cancelAnimationFrame(an)},[q,Qt]);const rt=u.useCallback(te=>{if(nn.length===0)return;P();const an=Math.min(Math.max(te,0),nn.length-1),Vs=nn[an].key;je(void 0),Ie(Vs),q&&d&&e&&ge({of:d,loader:e,key:Vs}),Qt(an)},[q,e,d,Qt,nn,P]),Ee=u.useCallback((te,an=!0)=>{P(),je(void 0),Ie(te),q&&d&&e&&ge({of:d,loader:e,key:te}),an&&ce.current?.focus({preventScroll:!0})},[q,d,e,P]),Ze=u.useCallback((te=Ne)=>{!d||!e||!te||!d.rowIndexByKey.has(te)&&!ht.has(te)||(P(),je(void 0),ge({of:d,loader:e,key:te}),Ie(te),J(!0))},[d,e,Ne,P,ht]),Oe=u.useCallback(te=>{Ee(te),Ze(te)},[Ee,Ze]),Le=u.useRef(null),ft=u.useRef(void 0),Lt=q||!!Ue,mt=o?"side":"drill-in",Ut=Lt&&mt==="drill-in";u.useLayoutEffect(()=>{Le.current?.toggleAttribute("inert",Ut);const te=ft.current;Ut||!te||(ft.current=void 0,te())},[Ut,Lt]);const Gt=u.useCallback(te=>{ft.current=te},[]),cn=u.useCallback(()=>{ce.current?.focus({preventScroll:!0})},[]),pn=u.useCallback(()=>{J(!1),ge(void 0),Gt(cn)},[Gt,cn]),Ss=u.useCallback(te=>{if(te.target!==te.currentTarget&&te.target.tabIndex>=0){if(!["ArrowDown","ArrowUp","Home","End"].includes(te.key))return;te.currentTarget.focus({preventScroll:!0})}if(te.key==="Escape"){_t!==void 0&&(te.preventDefault(),Dt(void 0));return}if(nn.length===0)return;if(te.key==="Enter"){te.preventDefault(),Jt&&Oe(Jt);return}if((te.key==="ArrowLeft"||te.key==="ArrowRight")&&Jt&&we?.groups.has(Jt)&&(Bt.get(Jt)??0)>0){const Vs=te.key==="ArrowLeft";xs.has(Jt)!==Vs&&(te.preventDefault(),wn(Jt));return}const an=Qe<0?-1:Qe;te.key==="ArrowDown"?(te.preventDefault(),rt(an+1)):te.key==="ArrowUp"?(te.preventDefault(),rt(an<=0?0:an-1)):te.key==="Home"?(te.preventDefault(),rt(0)):te.key==="End"?(te.preventDefault(),rt(nn.length-1)):(te.key==="PageUp"||te.key==="PageDown"||te.key===" ")&&P()},[rt,Oe,_t,Qe,Dt,nn,Jt,we,Bt,xs,wn,P]),_r=u.useMemo(()=>d?Hbs(d):void 0,[d]),Zs=Fe!==void 0&&Fe.of===d&&Fe.loader===e,ds=Zs?d?.rowIndexByKey.get(Fe.key):void 0,Ht=Zs?ht.get(Fe.key):void 0,Fn=Ht?Ht.userRowKey===void 0?void 0:d?.rows[d.rowIndexByKey.get(Ht.userRowKey)??-1]:ds===void 0?void 0:d?.rows[ds],Yn=(f==="ready"||f==="error"&&d!==void 0)&&nn.length===0,ot=d!==void 0&&d.rows.length>0&&!eSs(d),Ct=_r!==void 0&&_r.plottedCount===0&&_r.missingStartCount>0,Yt=u.useMemo(()=>{if(!(!d||!_t&&!me&&xs.size===0))return{shown:nn.filter(te=>te.kind==="row").length,total:d.rows.length}},[_t,d,nn,xs,me]),vn=b===void 0?void 0:b.kind==="partial"?n("trajectory.olderPartial"):b.kind==="unreadable"?n("trajectory.olderFailed",{message:b.message}):n(`trajectory.window.${b.kind}`),fn=u.useRef(void 0);if(re.loader!==e||re.version!==S){const te=re.loader!==e;V.current=!te,Z({loader:e,version:S,selectionLost:!te&&Ne!==void 0}),Ie(void 0),ge(void 0),J(!1),tt(void 0),Un(void 0),Ke(void 0),Be.current=void 0,fn.current=void 0,fe.current=0,ee.current=!te}u.useLayoutEffect(()=>{V.current&&ce.current&&(V.current=!1,jt.scrollToOffset(0),be(ce.current,0))},[S,ze,jt,be]);const Xe=u.useRef(!1);u.useEffect(()=>{const te=A.loader===e&&A.pending;!te||f==="loading"||(p||b||E?P():f==="ready"&&d!==te.of&&_==="latest"&&(Xe.current=!0,M({loader:e,paused:!1}),Ie(void 0),je(void 0),J(!1),ge(void 0),X(an=>({...an,value:q6})),Ke(void 0)))},[A,e,f,p,b,E,d,_,P]),u.useLayoutEffect(()=>{if(!Xe.current)return;Xe.current=!1;const te=ce.current;te&&(be(te,te.scrollHeight),cL(te.getRootNode())&&te.focus({preventScroll:!0}))},[z,nn,be]);const kt=u.useRef(void 0);u.useLayoutEffect(()=>{const te=kt.current,an=r.current;!te||!an||f==="loading"||(kt.current=void 0,cL(an.getRootNode())&&(an.querySelector(`[data-testid="${te}"]`)??ce.current)?.focus({preventScroll:!0}))},[S,f,ze]);const Rn=u.useCallback(()=>{const te=ce.current;G(!!te&&te.scrollHeight-te.clientHeight-te.scrollTop>hx)},[]),On=jt.getTotalSize(),us=nn.length>0;u.useLayoutEffect(()=>{Rn()},[Rn,On,us]);const Es=u.useCallback(te=>{const an=nn.findIndex(Vs=>Vs.key===te);if(an<0&&d&&we){fn.current=te;const Vs=me&&!ln.has(te)&&!Te.has(te),qe=_t!==void 0&&!ln.has(te)&&!Rt?.has(te);Vs&&se(),qe&&Dt(void 0);const Xt=we.ancestors.get(te)??[];if(me&&!Vs){const en=new Map(qe?[]:Tn);for(const rs of Xt)en.set(rs,!1);Un({of:d,loader:e,signature:xoe(pe,qe?void 0:_t,Ge),overrides:en})}else{const en=new Set(Ft);for(const rs of Xt)en.delete(rs);tt({of:we,loader:e,keys:en})}Ee(te);return}Ee(te),an>=0&&Qt(an)},[d,we,Te,ln,Rt,me,se,Tn,pe,_t,Ge,Ft,e,Ee,Dt,Qt,nn]),fr=u.useCallback((te,an=pe)=>{if(!rDe(an)||!ye||!d||!we)return;ae(an);const Vs=sDe(ye,an).filter(er=>!Rt||Rt.has(er));if(!Vs.length)return;const qe=Ne?Vs.indexOf(Ne):-1,Xt=qe<0?te===1?0:Vs.length-1:(qe+te+Vs.length)%Vs.length,en=Vs[Xt],rs=we.ancestors.get(en)??[],nr=xoe(an,_t,Ge),mr=new Map(nr===kn?Tn:[]);for(const er of rs)mr.set(er,!1);Un({of:d,loader:e,signature:nr,overrides:mr}),fn.current=en,Ee(en,!1)},[ye,d,we,ae,pe,Rt,Ne,_t,Ge,kn,Tn,e,Ee]);u.useLayoutEffect(()=>{const te=fn.current;if(te===void 0)return;fn.current=void 0;const an=nn.findIndex(Vs=>Vs.key===te);an>=0&&Qt(an)},[Qt,nn]);const An=u.useCallback(te=>{const an=[pfe(te.row,n).text],Vs=te.row.kind==="request"||te.row.kind==="tool"?te.row.timing?.startedAt:void 0;return Vs!==void 0&&an.push(`${new Date(Vs).toLocaleString()}–${new Date(Vs+te.end-te.start).toLocaleString()}`),an.push(ta(te.end-te.start)),te.ttftEnd!==void 0&&an.push(n("trajectory.ttft",{duration:ta(te.ttftEnd-te.start)})),an.filter(Boolean).join(" · ")},[n]),fs=ue&&_e.rows.length>0,Ls=xxs({windowMode:_,following:z,returning:B,liveStatus:h.status}),Cs=kxs({hasTrajectory:d!==void 0,error:p,navigationError:E,historyStale:Q,lifecycleIncomplete:h.incomplete&&h.status!=="unavailable"||h.truncated}),bn=_xs({truncated:v,loading:f==="loading"&&j!=="latest",olderFailure:b}),qn=_t&&pt?`${afe(pt,_t.start,_t.end-_t.start,s)} – ${afe(pt,_t.end,_t.end-_t.start,s)}`:void 0,ks=a.jsx("div",{className:No.boundary,"aria-live":"polite","data-testid":"trajectory-older-bar","data-state":bn,children:bn==="failed"?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:`${No.boundaryText} ${No.toneError}`,"data-testid":"trajectory-older-failed",title:vn,children:vn}),a.jsx("button",{type:"button",className:No.boundaryButton,onClick:()=>{f!=="loading"&&w()},"aria-disabled":f==="loading"||b!==void 0&&!lfe(b),"data-testid":"trajectory-older-retry",children:n("common.retry")})]}):bn==="loading"||bn==="earlier"?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:No.boundaryText,...bn==="earlier"?{"data-testid":"trajectory-truncated"}:{},children:bn==="loading"?n("trajectory.loadingPages",{pages:m}):n(_==="history"?"trajectory.window.outside":"trajectory.boundary.earlier")}),v&&a.jsx("button",{type:"button",className:No.boundaryButton,"aria-disabled":!R,onClick:()=>{R&&(P(),kt.current="trajectory-window-older",x())},"data-testid":"trajectory-window-older",children:n("trajectory.boundary.loadEarlier")})]}):a.jsx("span",{className:No.boundaryText,children:n("trajectory.boundary.start")})}),Zr=a.jsxs("div",{className:No.boundary,children:[a.jsx("button",{type:"button",className:No.boundaryButton,"aria-disabled":!T,onClick:()=>{T&&(P(),kt.current="trajectory-window-newer",k())},"data-testid":"trajectory-window-newer",children:n("trajectory.boundary.newer")}),a.jsx("button",{type:"button",className:No.boundaryButton,"aria-disabled":!I,onClick:()=>{I&&(kt.current="trajectory-window-latest",H())},"data-testid":"trajectory-window-latest",children:n("trajectory.window.return")}),N&&!T&&f!=="loading"&&!E&&!p&&!b&&a.jsx("span",{className:No.boundaryText,children:n("trajectory.window.released")})]}),Er=Fn&&!Ht,eo=Ue?a.jsx(A8e,{presentation:mt,execution:Ue,title:Ue.name,onClose:()=>{je(void 0),Gt(c)},onFocusedUnmount:c,onLocateExecution:Ue.historyRowKey?()=>{const te=Ue.historyRowKey;Es(te),Ze(te)}:void 0},Ue.key):q&&Fe!==void 0&&Fe.loader===e?a.jsx(A8e,{presentation:mt,row:Fn,turn:Ht,lifecycle:Zs&&Fn&&!Ht?h.byRowKey.get(Fn.key):void 0,stale:!Zs,title:Ht?n(Ht.partial?"trajectory.turnPartial":"trajectory.turn",{index:Ht.index}):Fn?pfe(Fn,n).text:void 0,hiddenByRange:!!(_t&&Er&&!ln.has(Fn.key)&&!Rt?.has(Fn.key)),hiddenByFilter:!!(me&&Er&&!ln.has(Fn.key)&&!Te.has(Fn.key)),onClearFilter:se,hiddenByCollapse:!!(Er&&we?.ancestors.get(Fn.key)?.some(te=>xs.has(te))),onReveal:()=>{Fn&&Es(Fn.key)},onClearRange:()=>Dt(void 0),onClose:pn,onStep:te=>rt(Qe+te),onFocusedUnmount:cn}):void 0;return a.jsxs("div",{ref:r,className:No.panel,"data-testid":"trajectory-panel",children:[a.jsx(Hxs,{summary:_r,pill:Ls,onPill:()=>{Ls==="paused"||Ls==="history"?H():P()},warnings:Cs,onRetry:w,onRefresh:()=>{P(),W()},onReturnToLatest:H,canRefresh:I,history:_==="history",failuresOn:pe.status==="error",onToggleFailures:()=>ae({...pe,status:pe.status==="error"?"all":"error"}),about:{pages:g,searchExcluded:ye?.truncatedCount??0,executionsOmitted:_e.omitted,executionsOutside:h.outsideWindow.length}}),a.jsx(bxs,{model:pt,viewportControl:{...lt,applyViewport:te=>{P(),lt.applyViewport(te)}},...ot||Ct?{notice:n(Ct?"trajectory.noStart":"trajectory.noTiming")}:{},selectedKey:Ne,onSelect:Es,describe:An,..._t!==void 0?{range:_t}:{},onRangeChange:Dt,onModeChange:te=>{P(),Ve(te)}}),a.jsxs(Zct,{className:No.split,orientation:"horizontal","data-testid":"trajectory-split",children:[a.jsxs(ffe,{id:"trajectory-records",className:No.recordsPanel,minSize:320,children:[a.jsxs("div",{ref:Le,className:No.records,children:[d&&d.rows.length>0&&a.jsx(O_s,{value:pe,onChange:ae,onNavigate:fr,onClear:se,count:me?Ot.length:0,position:me&&Ne?Ot.indexOf(Ne)+1:0,truncatedCount:ye?.truncatedCount??0,...qn!==void 0?{range:qn}:{},onClearRange:()=>Dt(void 0),...Yt?{status:n("trajectory.range.status",Yt)}:{}},Y.scope),a.jsx(C1s,{rows:_e.rows,selectedKey:Ue?.key,following:z,liveStatus:h.status,historySnapshot:d,onPause:P,onUpdatedChange:de,onFocusLost:()=>ce.current?.focus({preventScroll:!0}),onSelect:te=>{P(),Ie(void 0),J(!1),je({loader:e,key:te})}},`executions-${Y.scope}`),a.jsxs("div",{className:No.tableWrap,children:[a.jsx("span",{className:No.srOnly,role:"status","data-testid":"trajectory-window-changed",children:re.selectionLost&&!Ne?n("trajectory.window.changed"):""}),nn.length===0?a.jsxs(a.Fragment,{children:[d&&ks,f==="error"&&p&&!d?a.jsxs("div",{className:No.placeholder,role:"alert",children:[a.jsx("span",{children:zbe(p,n)})," ",lfe(p)&&a.jsx("button",{type:"button",className:No.headerButton,onClick:w,children:n("common.retry")})]}):me?a.jsxs("div",{className:No.placeholder,"data-testid":"trajectory-filter-empty",children:[a.jsx("span",{children:n("trajectory.filter.empty")})," ",a.jsx("button",{type:"button",className:No.headerButton,onClick:se,children:n("trajectory.filter.clear")})]}):_t!==void 0?a.jsxs("div",{className:No.placeholder,"data-testid":"trajectory-range-empty",children:[a.jsx("span",{children:n("trajectory.range.empty")})," ",a.jsx("button",{type:"button",className:No.headerButton,onClick:()=>Dt(void 0),children:n("trajectory.range.clear")})]}):a.jsx("div",{className:No.placeholder,role:"status",children:Yn?n("trajectory.empty"):m>0?n("trajectory.loadingPages",{pages:m}):n("common.loading")}),d&>&&Zr]}):a.jsx("div",{ref:ce,className:No.scroll,role:"grid",tabIndex:0,"aria-label":n("trajectory.title"),"aria-rowcount":nn.length,"aria-activedescendant":jt.getVirtualItems().some(te=>te.index===Qe)?Me(Qe):void 0,onKeyDown:Ss,onWheel:P,onPointerDown:P,onScroll:te=>{fe.current=te.currentTarget.scrollTop,Rn()},"data-testid":"trajectory-rows",children:a.jsxs("div",{className:No.virtualBody,style:{height:`${jt.getTotalSize()}px`},children:[a.jsx("div",{className:No.virtualBoundary,children:ks}),jt.getVirtualItems().map(te=>{const an=nn[te.index];return a.jsx("div",{id:Me(te.index),className:No.virtualRow,style:{height:`${hx}px`,transform:`translateY(${te.start}px)`},role:"row","aria-rowindex":te.index+1,children:an.kind==="turn"?a.jsx(nSs,{turn:an.turn,prompt:an.turn.userRowKey?d?.rows[d.rowIndexByKey.get(an.turn.userRowKey)??-1]:void 0,collapsed:xs.has(an.key),hiddenCount:Bt.get(an.key)??0,onToggle:()=>wn(an.key),selected:an.key===Jt,onSelect:()=>Oe(an.key)}):a.jsx(sSs,{row:an.row,grouped:(we?.ancestors.get(an.key)?.length??0)>1,unresolvedParent:we?.unresolvedParents.has(an.key)??!1,fold:we?.groups.has(an.key)&&(Bt.get(an.key)??0)>0?{collapsed:xs.has(an.key),hiddenCount:Bt.get(an.key)??0,onToggle:()=>wn(an.key)}:void 0,span:it.get(an.key),total:pt?.total??0,viewport:lt.viewport,range:_t,context:!!Mt&&!Mt.has(an.key),selected:an.key===Jt,onSelect:()=>Oe(an.key)})},te.key)}),gt&&a.jsx("div",{className:No.virtualBoundary,style:{transform:`translateY(${jt.getTotalSize()-hx}px)`},children:Zr})]})}),Ls==="paused"&&(U||fs)&&a.jsxs("button",{type:"button",className:No.jumpLatest,"aria-disabled":!I,onClick:()=>{I&&H()},"data-testid":"trajectory-jump-latest",children:[a.jsx(kge,{size:13,"aria-hidden":"true"}),n("trajectory.jumpLatest"),fs&&a.jsx("span",{className:No.updatedDot,role:"img","aria-label":n("trajectory.jumpLatest.updated")})]})]})]}),mt==="drill-in"&&eo]}),mt==="side"&&Lt&&a.jsxs(a.Fragment,{children:[a.jsx(edt,{className:No.splitHandle,"aria-label":n("trajectory.detail.resize")}),a.jsx(ffe,{id:"trajectory-detail-panel",className:No.detailPanel,defaultSize:"40%",minSize:320,maxSize:"60%",children:eo})]})]})]})}function nSs({turn:e,prompt:t,collapsed:n,hiddenCount:s,onToggle:r,selected:o,onSelect:i}){const{t:l}=et();return a.jsxs("div",{className:`${No.turnHeader} ${o?No.selected:""}`,onClick:i,"aria-selected":o,"data-selected":o?"true":void 0,role:"gridcell","data-testid":"trajectory-turn",children:[a.jsx(tdt,{collapsed:n,name:l("trajectory.turn",{index:e.index}),onToggle:r}),a.jsx("span",{className:No.turnTitle,children:e.partial?l("trajectory.turnPartial",{index:e.index}):l("trajectory.turn",{index:e.index})}),t?.kind==="user"&&a.jsx("span",{className:No.turnPrompt,title:vE(t.block.text),children:vE(t.block.text).slice(0,160)}),n&&s>0&&a.jsx("span",{className:No.foldCount,children:l("trajectory.collapsed",{count:s})}),a.jsx("span",{className:No.turnSummary,children:l("trajectory.turnSummary",{requests:e.requestCount,tools:e.toolCount,duration:e.requestCount>0?ta(e.requestMs):"—"})})]})}function sSs({row:e,grouped:t,unresolvedParent:n,fold:s,span:r,total:o,viewport:i,range:l,context:c,selected:d,onSelect:h}){const{t:f}=et(),p=pfe(e,f),m=Q_s(e,f);return a.jsxs("div",{className:`${No.record} ${d?No.selected:""}`,role:"gridcell","aria-selected":d,"data-selected":d?"true":void 0,onClick:h,"data-testid":`trajectory-row-${e.kind}`,"data-depth":e.depth,"data-grouped":t||void 0,"data-context":c||void 0,"data-row-key":e.key,children:[s?a.jsx(tdt,{collapsed:s.collapsed,name:p.text,onToggle:s.onToggle}):a.jsx("span",{className:No.foldSpacer}),e.depth>0&&a.jsx(B3t,{size:12,strokeWidth:1.6,className:No.nestMarker,"aria-hidden":"true"}),a.jsx("span",{className:`${No.badge} ${p.badgeTone??""}`,children:p.badge}),a.jsx("span",{className:`${No.text} ${p.faint?No.faint:""}`,children:p.text}),n&&a.jsx("span",{className:No.parentNotice,title:f("trajectory.parentUnresolved"),children:f("trajectory.parentUnresolved")}),c&&a.jsx("span",{className:No.foldCount,children:f("trajectory.contextRow")}),s?.collapsed&&a.jsx("span",{className:No.foldCount,children:f("trajectory.collapsed",{count:s.hiddenCount})}),a.jsx("span",{className:No.waterfallSlot,children:a.jsx(w_s,{span:r,total:o,viewport:i,range:l,title:m.join(" · ")})}),a.jsx("span",{className:No.rowMetrics,"data-testid":"trajectory-row-metrics",title:m.length>0?m.join(" · "):void 0,children:m.length>0?m.join(" · "):"—"})]})}function tdt({collapsed:e,name:t,onToggle:n}){const{t:s}=et();return a.jsx("button",{type:"button",tabIndex:-1,className:No.foldButton,"aria-expanded":!e,"aria-label":s(e?"trajectory.expand":"trajectory.collapse",{name:t}),onClick:r=>{r.stopPropagation(),n()},children:e?a.jsx(Ol,{size:13,"aria-hidden":"true"}):a.jsx(sd,{size:13,"aria-hidden":"true"})})}const rSs="_panel_pwtdr_1",oSs="_toolbar_pwtdr_5",iSs="_actions_pwtdr_15",aSs="_feedback_pwtdr_21",lSs="_state_pwtdr_31",S1={panel:rSs,toolbar:oSs,actions:iSs,feedback:aSs,state:lSs};function cSs({sessionActions:e,sessionId:t,controls:n,onOpenMemoryFile:s}){const{t:r}=et(),[o,i]=u.useState(null),[l,c]=u.useState(!0),[d,h]=u.useState(!1),f=u.useRef(0),p=u.useRef(()=>{}),m=u.useRef(null),g=n?.sessionId===t?n:void 0,v=g?.getContextUsage??e?.getContextUsage,b=u.useRef(g);b.current=g;const y=g?.result,[w,x]=u.useState(y),k=!!(y&&y!==w&&(y.kind!=="completed"||!d));u.useEffect(()=>{y?.kind==="completed"&&(f.current++,i(y.usage),h(!1))},[y]),u.useEffect(()=>{let E=!0,j=!1;const I=b.current?.result;i(T=>T?.sessionId===t?T:I?.kind==="completed"?I.usage:null),h(!1),c(!!v);const R=async()=>{if(!E||j||!v)return;j=!0,c(!0),h(!1);const T=f.current,N=m.current,A=N&&N.getContextUsage===v&&N.sessionId===t?N:{getContextUsage:v,sessionId:t,promise:v({detail:!0,silent:!0,...b.current?.result?{syncCounters:!0}:{}})};m.current=A;try{const M=await A.promise;if(!E||T!==f.current)return;i(M.sessionId===t&&M.usage.contextWindowSize>0?M:null)}catch(M){if(!E||T!==f.current)return;h(LH(M)?"transient":"hard")}finally{j=!1,m.current===A&&(m.current=null),E&&c(!1)}};return p.current=()=>void R(),R(),()=>{E=!1}},[v,t]);const _=!v||l||g?.compressing,S=()=>{x(y),p.current()};return a.jsxs("div",{className:S1.panel,"aria-busy":l,children:[a.jsxs("div",{className:S1.toolbar,children:[a.jsx("span",{children:r("contextUsage.title")}),a.jsxs("div",{className:S1.actions,children:[a.jsx(Ae,{type:"button",variant:"ghost",size:"icon-sm","aria-label":r("contextUsage.refresh"),title:r("contextUsage.refresh"),disabled:_,onClick:S,children:a.jsx(ih,{"aria-hidden":"true"})}),a.jsx("span",{title:g?.compressing?void 0:g?.canCompress?l?r("common.loading"):void 0:r("contextUsage.compressUnavailable"),children:a.jsx(Ae,{type:"button",variant:"outline",size:"sm",disabled:!g?.canCompress||l,onClick:()=>void g?.compress(),children:r(g?.compressing?"contextUsage.compressing":"contextUsage.compress")})})]})]}),(g?.compressing||k)&&a.jsx(Yst,{controls:g,className:S1.feedback}),d==="transient"&&o&&a.jsx("div",{className:S1.feedback,role:"status",children:r("contextUsage.previousReading")}),d==="hard"?a.jsxs("div",{className:S1.state,role:"alert",children:[a.jsx("span",{children:r("contextUsage.loadError")}),a.jsx(Ae,{type:"button",variant:"outline",size:"sm",disabled:_,onClick:S,children:r("contextUsage.retry")})]}):v?l&&!o?a.jsx("div",{className:S1.state,role:"status",children:r("common.loading")}):o?a.jsx(nJe,{status:o,compact:!0,onOpenMemoryFile:s?E=>s(E,o.workspaceRoot??o.workspaceCwd):void 0}):a.jsx("div",{className:S1.state,children:r("contextUsage.unavailable")}):a.jsx("div",{className:S1.state,children:r("contextUsage.unavailable")})]})}class ndt extends Error{}function sdt(e){throw new ndt(e instanceof Error?e.message:String(e))}const dSs=()=>bt(()=>import("./WorkspaceFileBrowser-CGi_eR1a.js"),__vite__mapDeps([95,96])).then(e=>({default:e.WorkspaceFileBrowser})).catch(sdt),uSs=()=>bt(()=>import("./PierreFilePreview-Dx075_VT.js"),[]).catch(sdt),hSs=u.lazy(()=>bt(()=>import("./SpreadsheetPreview-l2R-Y1o6.js"),[])),fSs=700,pSs=["daily","weekdays","weekly","hourly","minutes","custom"],mSs=[1,2,3,4,5,6,10,12,15,20,30],gSs=(e,t)=>{},vSs=(e,t,n)=>{},ySs=()=>Promise.reject(new Error("Side-task session creation is unavailable"));function oDe(e){return e.kind==="review"||e.kind==="file"||e.kind==="artifact"||e.kind==="scheduled_task"}function C1(e){return e.kind==="pending"?e.targetKind:e.kind}function wSs(e){return`image.${(e.match(/^data:image\/([a-z0-9+.+-]+)/i)?.[1]??"png").split("+")[0].toLowerCase()}`}const bSs=["review","sideTask"];function xSs({tab:e,workspaceCwd:t,onOpenFilePreview:n,onReferenceFile:s,onClose:r}){const{t:o,language:i}=et(),l=KO(),c=u.useMemo(()=>u.lazy(dSs),[]),d=u.useMemo(()=>u.lazy(uSs),[]),h=cA(e.workspaceCwd),f=h?.workspaceId===e.workspaceId?h?.actions:void 0;if(!f)return a.jsx("div",{className:It.empty,role:"alert",children:o("workspace.notFoundDescription")});const p=(m,g)=>{const v=m instanceof ndt,b=()=>!!(l&&(!l.activeToken||ape()));return v&&!b()?a.jsxs("div",{role:"alert",className:It.empty,children:[a.jsx("p",{children:o("files.loadFailed")}),a.jsx("p",{children:o("files.reloadUnavailable")}),a.jsx(Ae,{onClick:r,children:o("files.close")})]}):a.jsx(ZX,{error:m,language:i,retryMode:v?"reload":"reset",onRetry:v?()=>{b()?window.location.reload():r()}:g})};return a.jsx(Rm,{label:"workspace file browser",fallback:p,children:a.jsx(u.Suspense,{fallback:a.jsx("div",{className:`${It.empty} text-center`,role:"status",children:o("common.loading")}),children:a.jsx(c,{workspaceCwd:e.workspaceCwd,actions:f,onOpenPreview:m=>n(m,e.workspaceCwd,e.workspaceId),onReferenceFile:e.workspaceCwd===t?s:void 0,renderPreview:(m,g,v)=>a.jsx(c7,{workspacePath:m,workspaceActions:f,previewKind:g?"source":void 0,sourceRenderer:b=>a.jsx(Rm,{label:"workspace file source",resetKeys:[m],fallback:p,children:a.jsx(u.Suspense,{fallback:a.jsx("div",{className:It.empty,children:o("common.loading")}),children:a.jsx(d,{path:m,content:b})})})},`${m}:${g}:${v}`)},`${e.workspaceCwd}:${e.workspaceId??""}`)})})}function iDe({contextUsageControls:e,artifacts:t,tabs:n,activeTabId:s,reviewChanges:r,selectedReviewPath:o,panelWidth:i,workspaceCwd:l,loading:c,restoring:d=!1,error:h,onSelectTab:f,onSelectTurnCallsPrompt:p,onCloseTab:m,onOpenFilePreview:g,onOpenMemoryFile:v,latestReviewAvailable:b=!1,onOpenLatestReview:y,onOpenTerminal:w,onOpenTrajectory:x,trajectoryTabId:k,onOpenFiles:_,onReferenceFile:S,onOpenWebPreview:E,onWebPreviewChange:j,items:I=bSs,sideTaskAvailable:R=!1,sideTasks:T=[],archivedSideTasks:N=[],sideTasksLoading:A=!1,onCreateSideTask:M,onOpenSideTask:P,onArchiveSideTasks:D,onUnarchiveSideTasks:z,onSideTaskMenuOpen:B,onCreateSideTaskSession:$,onSideTaskCreated:L,onSideTaskTitleChange:O,onSideTaskInitialPromptRefused:W,onNestedRightPanelOpen:H,onNestedArtifactsChange:Q,onOpenNestedSubagent:V,agentTasks:re=[],agentTraceLoading:Z=!1,agentTraceError:ue,onOpenWorkflowAgent:de,onError:U,sessionWorkflowEnabled:G,modelManagement:Y,unavailableModels:X,mountUnavailableModelTooltip:pe,workflow:ae,onImageIngestionNotice:se,deferSubagentMount:me=!1,onClose:ye,variant:ve="docked",fullscreen:Te=!1,onToggleFullscreen:Ne}){const{t:Ie}=et(),Fe=Co(),ge=z1(Fe.capabilities,l),[_e,Ce]=u.useState(!1),[je,Ue]=u.useState(),q=u.useRef(null),J=u.useCallback(()=>{q.current&&(clearTimeout(q.current),q.current=null),Ce(!0)},[]),ce=u.useCallback(()=>{q.current&&clearTimeout(q.current),q.current=setTimeout(()=>{Ce(!1),q.current=null},120)},[]);u.useEffect(()=>{_e&&B?.()},[B,_e]),u.useEffect(()=>()=>{q.current&&clearTimeout(q.current)},[]);const ee=n.find(we=>we.id===s)??n[0],fe=ee?.kind==="file"&&ee.sourcePreview&&(/\.html?$/i.test(ee.workspacePath)||mw(ee.previewMimeType||ee.previewData?.type)==="text/html"),Re=ee?.kind==="file"&&ee.previewOnly===!0&&!fe&&/\.(?:html?|md|markdown)$/i.test(ee.workspacePath)&&(ee.previewContent!==void 0||!ee.previewData||!!EM(ee.previewMimeType||ee.previewData.type,ee.workspacePath)),Me=je===ee?.id,be=I.includes("review")&&!n.some(we=>C1(we)==="review"),Be=I.includes("sideTask")&&R&&!!M,Ge=T.some(we=>we.archivable===!0),Ve=!!w,pt=I.includes("webPreview")&&!!E,lt=I.includes("trajectory")&&!!x&&!n.some(we=>we.id===k),it=I.includes("files")&&!!_&&!n.some(we=>we.kind==="files"&&we.workspaceCwd===l&&we.workspaceId===ge?.id),Tt=!!ee&&(it||be||Be||Ve||pt||lt),Ke=ee&&oDe(ee)?{workspaceCwd:ee.workspaceCwd,workspaceId:ee.workspaceId}:void 0,_t=cA(Ke?.workspaceCwd),Dt=_t?.workspaceId===Ke?.workspaceId?_t?.actions:void 0,Rt=ee?.kind==="artifact"?t.find(we=>we.id===ee.artifactId):void 0;return a.jsxs("aside",{className:`${It.panel} ${ve==="drawer"?It.panelDrawer:""} ${Te?It.panelFullscreen:""}`,style:ve==="docked"&&i&&!Te?{flexBasis:i,width:i}:void 0,"aria-label":"Right panel",children:[a.jsxs("div",{className:It.header,children:[n.length>0&&a.jsx("div",{className:It.tabs,role:"tablist","aria-label":"Right panel",children:n.map(we=>a.jsxs("div",{className:[It.tabItem,we.id===ee?.id?It.tabActive:""].filter(Boolean).join(" "),children:[a.jsxs("button",{type:"button",role:"tab","aria-selected":we.id===ee?.id,className:It.tab,onClick:()=>f(we.id),onMouseEnter:ht=>C_(ht.currentTarget),onFocus:ht=>C_(ht.currentTarget),title:we.kind==="turn_calls"?Ie("turnCalls.title"):we.title,children:[a.jsx("span",{className:`${It.tabIcon} ${C1(we)==="artifact"?It.tabArtifactIcon:""}`,"aria-hidden":"true",children:C1(we)==="review"?a.jsx(_oe,{}):we.kind==="files"?a.jsx(x8,{className:It.tabIconSvg}):we.kind==="workflow"?a.jsx(oVe,{className:It.tabIconSvg,strokeWidth:1.6}):we.kind==="file"?a.jsx(ub,{name:we.workspacePath,className:It.tabIconSvg,strokeWidth:1.6}):C1(we)==="artifact"?a.jsx(CXe,{artifact:t.find(ht=>"artifactId"in we&&ht.id===we.artifactId),className:It.tabIconSvg}):C1(we)==="subagent"?a.jsx(kSs,{}):C1(we)==="monitor"?a.jsx(dVe,{className:It.tabIconSvg,strokeWidth:1.6}):C1(we)==="shell"?a.jsx(PN,{className:It.tabIconSvg,strokeWidth:1.6}):C1(we)==="side_task"?a.jsx(F$,{className:It.tabIconSvg,strokeWidth:1.6}):we.kind==="web_preview"?a.jsx(f4,{className:It.tabIconSvg}):we.kind==="terminal"?a.jsx(PN,{className:It.tabIconSvg,strokeWidth:1.6}):C1(we)==="image"?a.jsx(Zqe,{className:It.tabIconSvg,strokeWidth:1.6}):we.kind==="context_usage"?a.jsx(yY,{className:It.tabIconSvg,strokeWidth:1.6}):we.kind==="token_usage"?a.jsx(gY,{className:It.tabIconSvg,strokeWidth:1.6}):we.kind==="turn_calls"?a.jsx(XD,{className:It.tabIconSvg,strokeWidth:1.6}):we.kind==="trajectory"?a.jsx(gte,{className:It.tabIconSvg,strokeWidth:1.6}):a.jsx(SSs,{})}),a.jsx("span",{className:It.tabTitle,"data-web-shell-session-title":!0,children:a.jsx("span",{className:It.tabTitleInner,children:we.kind==="turn_calls"?Ie("turnCalls.title"):we.title})})]}),a.jsx("button",{type:"button",className:It.tabCloseButton,onClick:()=>m(we.id),"aria-label":`Close ${we.kind==="turn_calls"?Ie("turnCalls.title"):we.title}`,title:"Close",children:a.jsx(_Ss,{})})]},we.id))}),a.jsxs("div",{className:It.headerActions,children:[Tt&&a.jsxs(tf,{modal:!1,children:[a.jsx(Eh,{asChild:!0,children:a.jsx("button",{type:"button",className:`${It.iconButton} ${It.addButton}`,"aria-label":Ie("rightPanel.add"),title:Ie("rightPanel.add"),children:a.jsx(Ef,{className:It.toolbarIcon})})}),a.jsxs(Ah,{align:"end",className:"w-64",children:[it&&a.jsxs(jr,{onSelect:_,children:[a.jsx(x8,{}),a.jsx("span",{className:It.sideTaskListTitle,children:Ie("files.title")})]}),be&&a.jsxs(jr,{disabled:!b||!y,onSelect:y,children:[a.jsx(_oe,{}),a.jsx("span",{className:It.sideTaskListTitle,children:Ie("turnOutputs.review")})]}),be&&Be&&a.jsx(ug,{}),Be&&a.jsxs(jr,{disabled:A,onSelect:M,children:[a.jsx(F$,{className:It.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:It.sideTaskListTitle,children:Ie("sideTask.create")})]}),Ve&&(be||Be)&&a.jsx(ug,{}),Ve&&a.jsxs(jr,{onSelect:()=>w?.(),children:[a.jsx(PN,{className:It.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:It.sideTaskListTitle,children:Ie("terminal.title")})]}),pt&&a.jsxs(jr,{onSelect:E,children:[a.jsx(f4,{className:It.sideTaskNewIcon}),a.jsx("span",{className:It.sideTaskListTitle,children:Ie("webPreview.title")})]}),lt&&a.jsxs(jr,{onSelect:()=>x?.(),children:[a.jsx(gte,{className:It.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:It.sideTaskListTitle,children:Ie("trajectory.title")})]})]})]}),Ne&&a.jsx("button",{type:"button",className:`${It.iconButton} ${It.fullscreenButton} ${Te?It.iconButtonActive:""}`,onClick:Ne,"aria-label":Ie(Te?"common.exitFullscreen":"common.fullscreen"),"aria-pressed":Te,title:Ie(Te?"common.exitFullscreen":"common.fullscreen"),children:Te?a.jsx(bY,{className:It.toolbarIcon,"aria-hidden":!0}):a.jsx(mY,{className:It.toolbarIcon,"aria-hidden":!0})}),a.jsx("button",{type:"button",className:`${It.iconButton} ${It.panelToggleButton}`,onClick:ye,"aria-label":Ie("chatHeader.toggleRightPanel"),"aria-pressed":"true",title:Ie("chatHeader.toggleRightPanel"),children:a.jsx(iVe,{className:It.panelToggleIcon})})]})]}),(Te||ve==="drawer")&&a.jsx(bit,{}),a.jsxs("div",{className:`${It.body} ${ee?.kind==="side_task"||ee?.kind==="files"?It.bodySideTask:""}`.trim(),children:[n.filter(we=>we.kind==="web_preview").map(we=>a.jsx("div",{className:"h-full",hidden:we.id!==ee?.id,children:a.jsx(wws,{state:we,onChange:ht=>j?.(we.id,ht)})},we.id)),n.filter(we=>we.kind==="files").map(we=>a.jsx("div",{className:"h-full",hidden:we.id!==ee?.id,children:a.jsx(xSs,{onClose:()=>m(we.id),tab:we,workspaceCwd:l,onOpenFilePreview:g,onReferenceFile:S})},we.id)),n.filter(we=>we.kind==="terminal").map(we=>a.jsx("div",{className:`${It.terminalPane} ${we.id===ee?.id?"":It.terminalPaneHidden}`.trim(),"aria-hidden":we.id===ee?.id?void 0:!0,children:a.jsx(yws,{terminalId:we.id,cwd:we.workspaceCwd??l,active:we.id===ee?.id,enabled:we.initialized!==!1})},we.id)),Re&&a.jsxs("button",{type:"button",className:It.attachmentPreviewButton,onClick:()=>Ue(Me?void 0:ee?.id),"aria-label":Ie(Me?"attachment.showSource":"attachment.showPreview"),"aria-pressed":Me,children:[Me?a.jsx(N3t,{"aria-hidden":!0}):a.jsx(sq,{"aria-hidden":!0}),Ie(Me?"attachment.showSource":"attachment.showPreview")]}),d&&!ee?a.jsxs("div",{className:"flex flex-col gap-4 p-5","data-testid":"right-panel-loading-skeleton",role:"status","aria-label":Ie("common.loading"),children:[a.jsx(Vx,{className:"h-5 w-2/5"}),a.jsx(Vx,{className:"h-32 w-full"}),a.jsx(Vx,{className:"h-4 w-4/5"}),a.jsx(Vx,{className:"h-4 w-3/5"})]}):ee?.kind==="terminal"||ee?.kind==="web_preview"||ee?.kind==="files"?null:ee?ee.kind==="pending"?a.jsx("div",{className:It.empty,role:ee.loadError?"alert":"status",children:ee.loadError??Ie("common.loading")}):ee.kind==="workflow"?ee.sessionId?a.jsx(ygs,{tasks:re,loading:Z,error:ue,onOpenAgent:de}):ae?a.jsx(t0s,{...ae}):a.jsx("div",{className:It.empty,children:Ie("workflow.empty.title")}):oDe(ee)&&(ee.kind!=="scheduled_task"||ee.task.durable)&&(ee.kind!=="file"||!ee.previewOnly)&&(ee.kind!=="review"||!(ee.changes??r).some(we=>we.diffs.length>0))&&(ee.kind!=="artifact"||Rt?.metadata?.artifactType!=="web_preview_snapshot")&&!Dt?a.jsx("div",{className:It.empty,role:"alert",children:Ie("workspace.notFoundDescription")}):ee.kind==="review"?a.jsx(ISs,{changes:ee.changes??r,selectedPath:ee.selectedPath??o,workspaceCwd:ee.workspaceCwd??l,onOpenFilePreview:Dt?we=>g(we,ee.workspaceCwd??l,ee.workspaceId):void 0,onDownloadFile:Dt?(we,ht)=>x9(Dt,we.path,JJt(we.path),ht):void 0,onDownloadError:we=>{const ht=Ie("common.downloadFailed",{message:ja(we)});U?U(new Error(ht,{cause:we}),ht):console.error(ht,we)}}):ee.kind==="file"?ee.attachmentId&&!ee.previewData&&ee.previewContent===void 0?a.jsx("div",{className:It.empty,role:ee.loadError?"alert":"status",children:ee.loadError??Ie("common.loading")}):ee.sourcePreview&&ee.previewData&&!w9(ee.workspacePath,ee.previewMimeType||ee.previewData.type)&&!y9(ee.workspacePath,ee.previewMimeType||ee.previewData.type)&&!V2({workspacePath:ee.workspacePath,mimeType:ee.previewMimeType||ee.previewData.type})&&!EM(ee.previewMimeType||ee.previewData.type,ee.workspacePath)?a.jsx(Jbe,{data:ee.previewData,title:ee.title,image:!!G2(ee.workspacePath)&&ee.previewData.type.startsWith("image/")}):a.jsx(c7,{workspacePath:ee.workspacePath,artifactVersion:String(ee.previewVersion??0),workspaceActions:Dt,previewContent:ee.previewContent,previewData:ee.previewData,previewMimeType:ee.previewMimeType,previewOnly:ee.previewOnly,previewKind:fe||ee.previewOnly&&!Me?"source":void 0},ee.id):ee.kind==="source"?a.jsx(WSs,{tab:ee},ee.id):ee.kind==="artifact"?a.jsx(CSs,{artifacts:t,artifactId:ee.artifactId,sourceSessionId:ee.sourceSessionId,workspaceActions:Dt,previewContent:ee.previewContent,loading:c,error:h},ee.id):ee.kind==="subagent"?me?null:a.jsx(egs,{sessionId:ee.sessionId,rootToolCallId:ee.rootToolCallId,initialRootTool:ee.rootTool,workspaceCwd:ee.workspaceCwd??l,onRightPanelOpen:H,onArtifactsChange:Q,onOpenSubagent:V,onError:U}):ee.kind==="monitor"?a.jsx(Pln,{task:ee.task,actions:ee.sessionActions},ee.id):ee.kind==="shell"?a.jsx(Dln,{task:ee.task,actions:ee.sessionActions},ee.id):ee.kind==="side_task"?a.jsx(bgs,{tabId:ee.id,sessionId:ee.sessionId,parentSessionId:ee.parentSessionId,workspaceCwd:ee.workspaceCwd??l,title:ee.title,shouldNameFromFirstPrompt:ee.nameFromFirstPrompt,initialPrompt:ee.initialPrompt,createSession:$??ySs,onCreated:L??gSs,onTitleChange:O??vSs,onInitialPromptRefused:W,onRightPanelOpen:H,onArtifactsChange:Q,onError:U,sessionWorkflowEnabled:G,modelManagement:Y,unavailableModels:X,mountUnavailableModelTooltip:pe,onImageIngestionNotice:se},ee.id):ee.kind==="image"?ee.src?a.jsxs("div",{className:It.imagePreviewWrap,children:[a.jsx("img",{src:ee.src,alt:ee.alt??ee.title,className:It.imagePreview}),a.jsx("a",{className:It.imageDownloadButton,href:ee.src,download:wSs(ee.src),"aria-label":Ie("common.download"),title:Ie("common.download"),children:a.jsx(Zy,{size:16,strokeWidth:1.8})})]}):a.jsx("div",{className:It.empty,role:ee.loadError?"alert":"status",children:ee.loadError??Ie("common.loading")}):ee.kind==="context_usage"?a.jsx(cSs,{controls:e?.[ee.sessionId],sessionActions:ee.sessionActions,sessionId:ee.sessionId,onOpenMemoryFile:v},ee.id):ee.kind==="trajectory"?a.jsx(tSs,{loadPage:ee.loadPage,historyGapRevision:ee.historyGapRevision},ee.id):ee.kind==="token_usage"?a.jsx(Ibs,{sessionActions:ee.sessionActions,sessionId:ee.sessionId},ee.id):ee.kind==="turn_calls"?a.jsx(Bus,{turnId:ee.turnId,ownerSessionId:ee.sessionId,recordId:ee.recordId,promptId:ee.promptId,promptLabel:ee.promptLabel,onSelectPrompt:p,workspaceCwd:l,onOpenFile:H,onOpenAgent:V},`${ee.sessionId}:${l}`):a.jsx(TSs,{task:ee.task,actions:Dt},ee.id):a.jsxs("div",{className:It.emptyActions,"data-testid":"right-panel-empty-actions",children:[I.includes("files")&&a.jsxs("button",{type:"button",className:It.emptyAction,disabled:!_,onClick:_,children:[a.jsx("span",{className:It.emptyActionIcon,"aria-hidden":"true",children:a.jsx(x8,{})}),a.jsx("span",{className:It.emptyActionTitle,children:Ie("files.title")}),a.jsx("span",{className:It.emptyActionHint,children:Ie("files.description")}),a.jsx(Ol,{className:It.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]}),I.includes("review")&&a.jsxs("button",{type:"button",className:It.emptyAction,disabled:!b||!y,onClick:y,children:[a.jsx("span",{className:It.emptyActionIcon,"aria-hidden":"true",children:a.jsx(_oe,{})}),a.jsx("span",{className:It.emptyActionTitle,children:Ie("turnOutputs.review")}),a.jsx("span",{className:It.emptyActionHint,children:Ie("turnOutputs.reviewLatest")}),a.jsx(Ol,{className:It.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]}),I.includes("sideTask")&&R&&M&&(T.length===0&&N.length===0?a.jsxs("button",{type:"button",className:It.emptyAction,disabled:A,"aria-busy":A,onClick:M,children:[a.jsx("span",{className:It.emptyActionIcon,"aria-hidden":"true",children:a.jsx(F$,{strokeWidth:1.6})}),a.jsx("span",{className:It.emptyActionTitle,children:Ie("sideTask.title")}),a.jsx("span",{className:It.emptyActionHint,children:Ie("sideTask.description")}),a.jsx(Ol,{className:It.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]}):a.jsxs(tf,{open:_e,onOpenChange:Ce,modal:!1,children:[a.jsx(Eh,{asChild:!0,children:a.jsxs("button",{type:"button",className:It.emptyAction,"aria-expanded":_e,onMouseEnter:J,onMouseLeave:ce,children:[a.jsx("span",{className:It.emptyActionIcon,"aria-hidden":"true",children:a.jsx(F$,{strokeWidth:1.6})}),a.jsx("span",{className:It.emptyActionTitle,children:Ie("sideTask.title")}),a.jsx("span",{className:It.emptyActionHint,children:Ie("sideTask.description")}),a.jsx(Ol,{className:It.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]})}),a.jsxs(Ah,{align:"end",className:"w-80",onMouseEnter:J,onMouseLeave:ce,children:[T.map(we=>{const ht=a.jsxs(a.Fragment,{children:[a.jsx("span",{className:It.sideTaskListTitle,children:we.title}),we.updatedAt&&a.jsx("span",{className:It.sideTaskListTime,children:aT(we.updatedAt,Ie)})]});return D?a.jsxs(BC,{children:[a.jsx($C,{children:ht}),a.jsxs(FC,{onMouseEnter:J,onMouseLeave:ce,children:[a.jsxs(jr,{onSelect:()=>P?.(we),children:[a.jsx(sq,{}),Ie("common.open")]}),a.jsxs(jr,{disabled:we.archivable!==!0,title:we.archivable===!0?void 0:Ie("sideTask.archiveUnavailable"),onSelect:()=>{D([we])},children:[a.jsx(b2,{}),Ie("sidebar.archive")]})]})]},we.sessionId):a.jsx(jr,{onSelect:()=>P?.(we),children:ht},we.sessionId)}),D&&T.length>0&&a.jsx(ug,{}),D&&T.length>0&&a.jsxs(jr,{disabled:!Ge,onSelect:()=>{D(T)},children:[a.jsx(b2,{}),a.jsx("span",{className:It.sideTaskListTitle,children:Ie("sideTask.archiveCompleted")})]}),z&&N.length>0&&a.jsxs(a.Fragment,{children:[T.length>0&&a.jsx(ug,{}),a.jsxs(BC,{children:[a.jsxs($C,{children:[a.jsx(cle,{}),a.jsxs("span",{className:It.sideTaskListTitle,children:[Ie("sidebar.archivedTitle")," (",N.length,")"]})]}),a.jsx(FC,{className:"max-h-(--radix-dropdown-menu-content-available-height) overflow-x-hidden overflow-y-auto",onMouseEnter:J,onMouseLeave:ce,children:N.map(we=>a.jsxs(jr,{onSelect:()=>{z([we])},children:[a.jsx(cle,{}),a.jsx("span",{className:It.sideTaskListTitle,children:we.title}),a.jsx("span",{className:It.sideTaskListTime,children:Ie("sidebar.unarchive")})]},we.sessionId))})]})]}),T.length>0&&a.jsx(ug,{}),a.jsxs(jr,{onSelect:M,children:[a.jsx(k3t,{className:It.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:It.sideTaskListTitle,children:Ie("sideTask.new")})]})]})]})),pt&&a.jsxs("button",{type:"button",className:It.emptyAction,"data-testid":"right-panel-open-web-preview",onClick:E,children:[a.jsx("span",{className:It.emptyActionIcon,"aria-hidden":"true",children:a.jsx(f4,{strokeWidth:1.6})}),a.jsx("span",{className:It.emptyActionTitle,children:Ie("webPreview.title")}),a.jsx("span",{className:It.emptyActionHint,children:Ie("webPreview.openHint")}),a.jsx(Ol,{className:It.emptyActionChevron,"aria-hidden":"true"})]}),lt&&a.jsxs("button",{type:"button",className:It.emptyAction,onClick:()=>x?.(),"data-testid":"right-panel-open-trajectory",children:[a.jsx("span",{className:It.emptyActionIcon,"aria-hidden":"true",children:a.jsx(gte,{strokeWidth:1.6})}),a.jsx("span",{className:It.emptyActionTitle,children:Ie("trajectory.title")}),a.jsx("span",{className:It.emptyActionHint,children:Ie("trajectory.description")}),a.jsx(Ol,{className:It.emptyActionChevron,"aria-hidden":"true"})]}),w&&a.jsxs("button",{type:"button",className:It.emptyAction,onClick:()=>w(),children:[a.jsx("span",{className:It.emptyActionIcon,"aria-hidden":"true",children:a.jsx(PN,{strokeWidth:1.6})}),a.jsx("span",{className:It.emptyActionTitle,children:Ie("terminal.title")}),a.jsx("span",{className:It.emptyActionHint,children:Ie("terminal.open")}),a.jsx(Ol,{className:It.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]})]})]})]})}function kSs(){return a.jsxs("svg",{className:It.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 _Ss(){return a.jsx("svg",{className:It.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 _oe(){return a.jsxs("svg",{className:It.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 SSs(){return a.jsxs("svg",{className:It.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 CSs({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(BSs,{artifact:l,sourceSessionId:n,workspaceActions:s,previewContent:r}):o?a.jsx("div",{className:It.empty,children:"Loading artifact..."}):i?a.jsx("div",{className:It.empty,children:i}):a.jsx("div",{className:It.empty,children:"Artifact not found."})}function TSs({task:e,actions:t}){const{t:n}=et(),[s,r]=u.useState(null),[o,i]=u.useState(!0),[l,c]=u.useState(null),[d,h]=u.useState(""),[f,p]=u.useState(e.prompt),[m,g]=u.useState(()=>gC(e.cron)),[v,b]=u.useState(!1),[y,w]=u.useState(!1),[x,k]=u.useState(!1),[_,S]=u.useState(!1),[E,j]=u.useState(null),I=u.useRef(0),R=u.useRef(0),T=u.useRef({actions:t,taskId:e.id,workspaceId:e.workspaceId});T.current={actions:t,taskId:e.id,workspaceId:e.workspaceId};const N=u.useCallback((U,G,Y,X)=>{const pe=T.current;return U===I.current&&pe.actions===G&&pe.taskId===Y&&pe.workspaceId===X},[]),A=u.useCallback((U,G,Y,X)=>{const pe=T.current;return U===R.current&&pe.actions===G&&pe.taskId===Y&&pe.workspaceId===X},[]);u.useEffect(()=>()=>{I.current+=1,R.current+=1},[]),u.useEffect(()=>{k(!1),S(!1),j(null)},[t,e.id,e.workspaceId]);const M=u.useCallback(async()=>{const U=++I.current,G=++R.current,Y=e.id,X=e.workspaceId;if(!e.durable||!t){r(null),h(""),p(e.prompt),g(gC(e.cron)),c(null),i(!1);return}i(!0),c(null);try{const pe=await t.listScheduledTasks(X);if(!N(U,t,Y,X))return;const ae=pe.find(se=>se.id===e.id)??null;r(ae),ae?(h(ae.name??""),p(ae.prompt),g(gC(ae.cron))):(h(""),p(e.prompt),g(gC(e.cron)))}catch(pe){A(G,t,Y,X)&&c(pe instanceof Error?pe.message:String(pe))}finally{A(G,t,Y,X)&&i(!1)}},[t,A,N,e.cron,e.durable,e.id,e.prompt,e.workspaceId]);u.useEffect(()=>{M()},[M]);const P=!e.durable,D=e.durable&&!o&&!l&&!s,z=!!s,B=s?.name||s?.prompt||e.title,$=s?.prompt??e.prompt,L=s?.cron??e.cron,O=s?.recurring??e.recurring,W=s?.enabled,H=u.useCallback(()=>{s&&(h(s.name??""),p(s.prompt),g(gC(s.cron)),j(null),b(!0))},[s]),Q=u.useCallback(()=>{b(!1),j(null),s&&(h(s.name??""),p(s.prompt),g(gC(s.cron)))},[s]),V=u.useCallback(async()=>{if(!s||!t)return;const U=Oq(m);if(!U){j(n("scheduledTasks.error.invalidSchedule"));return}if(f.trim().length===0){j(n("scheduledTasks.error.emptyPrompt"));return}const G=++I.current,Y=e.id,X=e.workspaceId;S(!0),j(null);try{const pe=await t.updateScheduledTask(s.id,{cron:U,prompt:f.trim(),name:d.trim()||null},X);if(!N(G,t,Y,X))return;r(pe),h(pe.name??""),p(pe.prompt),g(gC(pe.cron)),b(!1)}catch(pe){N(G,t,Y,X)&&j(pe instanceof Error?pe.message:String(pe))}finally{N(G,t,Y,X)&&S(!1)}},[t,m,N,s,d,f,n,e.id,e.workspaceId]),re=u.useCallback(async()=>{if(!s||!t)return;const U=++I.current,G=e.id,Y=e.workspaceId;k(!0),j(null);try{const X=await t.updateScheduledTask(s.id,{enabled:!s.enabled},Y);if(!N(U,t,G,Y))return;r(X)}catch(X){N(U,t,G,Y)&&j(X instanceof Error?X.message:String(X))}finally{N(U,t,G,Y)&&k(!1)}},[t,N,s,e.id,e.workspaceId]),Z=u.useCallback(async()=>{if(!s||!t)return;const U=++I.current,G=e.id,Y=e.workspaceId;k(!0),j(null);try{if(await t.deleteScheduledTask(s.id,Y),!N(U,t,G,Y))return;r(null),w(!1)}catch(X){N(U,t,G,Y)&&j(X instanceof Error?X.message:String(X))}finally{N(U,t,G,Y)&&k(!1)}},[t,N,s,e.id,e.workspaceId]),ue=Oq(m),de=ue?dM(ue,n):null;return a.jsxs("div",{className:It.detail,children:[o&&a.jsx("div",{className:It.empty,children:n("scheduledTasks.loading")}),l&&a.jsx("div",{className:yn.loadError,children:l}),D&&a.jsx("div",{className:It.empty,children:n("scheduledTasks.deletedSnapshot")}),P&&a.jsx("div",{className:It.empty,children:n("scheduledTasks.sessionScopedSnapshot")}),!D&&a.jsx("div",{className:It.section,children:a.jsxs("div",{className:It.fieldGrid,children:[a.jsx("span",{className:It.fieldLabel,children:n("scheduledTasks.name")}),a.jsx("span",{className:It.fieldValue,children:B}),a.jsx("span",{className:It.fieldLabel,children:n("scheduledTasks.taskId")}),a.jsx("span",{className:It.fieldValue,children:e.id}),a.jsx("span",{className:It.fieldLabel,children:n("scheduledTasks.schedule")}),a.jsx("span",{className:It.fieldValue,children:dM(L,n)}),a.jsx("span",{className:It.fieldLabel,children:"Cron"}),a.jsx("span",{className:It.fieldValue,children:L}),a.jsx("span",{className:It.fieldLabel,children:n("scheduledTasks.type")}),a.jsx("span",{className:It.fieldValue,children:n(O?"scheduledTasks.repeats":"scheduledTasks.runsOnce")}),W!==void 0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:It.fieldLabel,children:n("scheduledTasks.status")}),a.jsx("span",{className:It.fieldValue,children:n(W?"scheduledTasks.enable":"scheduledTasks.disable")})]})]})}),!D&&a.jsxs("div",{className:It.section,children:[a.jsx("div",{className:It.sectionTitle,children:"Prompt"}),a.jsx("div",{className:It.description,children:$})]}),E&&a.jsx("div",{className:yn.formError,children:E}),a.jsxs("div",{className:It.actionsRow,children:[a.jsx("button",{type:"button",className:yn.primaryButton,disabled:!z||x,onClick:H,children:n("scheduledTasks.edit")}),a.jsx("button",{type:"button",className:yn.secondaryButton,disabled:!z||x,onClick:()=>void re(),children:s?.enabled?n("scheduledTasks.disable"):n("scheduledTasks.enable")}),a.jsx("button",{type:"button",className:yn.secondaryButton,disabled:!z||x,onClick:()=>w(!0),children:n("scheduledTasks.delete")})]}),y&&s&&a.jsx(Ja,{title:n("scheduledTasks.deleteConfirmTitle"),size:"sm",onClose:()=>w(!1),children:a.jsxs("div",{className:yn.formFields,children:[a.jsx("div",{className:It.description,children:n("scheduledTasks.deleteConfirm",{name:s.name||s.prompt})}),E&&a.jsx("div",{className:yn.formError,children:E}),a.jsxs("div",{className:yn.formActions,children:[a.jsx("button",{type:"button",className:yn.secondaryButton,onClick:()=>w(!1),disabled:x,children:n("scheduledTasks.cancel")}),a.jsx("button",{type:"button",className:yn.primaryButton,onClick:()=>void Z(),disabled:x,children:n("scheduledTasks.delete")})]})]})}),v&&a.jsx(Ja,{title:n("scheduledTasks.editTitle"),size:"md",onClose:Q,children:a.jsxs("div",{className:yn.formFields,children:[a.jsxs("label",{className:yn.field,children:[a.jsx("span",{className:yn.fieldLabel,children:n("scheduledTasks.name")}),a.jsx("input",{className:yn.input,type:"text",value:d,maxLength:200,placeholder:n("scheduledTasks.namePlaceholder"),onChange:U=>h(U.target.value)})]}),a.jsxs("label",{className:yn.field,children:[a.jsxs("span",{className:yn.fieldLabel,children:[n("scheduledTasks.prompt"),a.jsx("span",{className:yn.required,children:"*"})]}),a.jsx("textarea",{className:yn.textarea,value:f,rows:4,maxLength:1e5,placeholder:n("scheduledTasks.promptPlaceholder"),onChange:U=>p(U.target.value)})]}),a.jsxs("div",{className:yn.scheduleRow,children:[a.jsxs("label",{className:yn.field,children:[a.jsx("span",{className:yn.fieldLabel,children:n("scheduledTasks.frequency")}),a.jsx("select",{className:yn.select,value:m.frequency,onChange:U=>{const G=U.target.value;g(Y=>({...Y,frequency:G,...G==="hourly"?{time:"00:00"}:{}}))},children:pSs.map(U=>a.jsx("option",{value:U,children:n(`scheduledTasks.freq.${U}`)},U))})]}),(m.frequency==="daily"||m.frequency==="weekdays"||m.frequency==="weekly")&&a.jsxs("label",{className:yn.field,children:[a.jsx("span",{className:yn.fieldLabel,children:n("scheduledTasks.time")}),a.jsx("input",{className:yn.input,type:"time",value:m.time,onChange:U=>g(G=>({...G,time:U.target.value}))})]}),m.frequency==="weekly"&&a.jsxs("label",{className:yn.field,children:[a.jsx("span",{className:yn.fieldLabel,children:n("scheduledTasks.weekday")}),a.jsx("select",{className:yn.select,value:m.weekday,onChange:U=>g(G=>({...G,weekday:Number(U.target.value)})),children:n("scheduledTasks.weekdayNames").split(",").map((U,G)=>a.jsx("option",{value:G,children:U},G))})]}),m.frequency==="minutes"&&a.jsxs("label",{className:yn.field,children:[a.jsx("span",{className:yn.fieldLabel,children:n("scheduledTasks.interval")}),a.jsx("select",{className:yn.select,value:m.minuteInterval,onChange:U=>g(G=>({...G,minuteInterval:Number(U.target.value)})),children:mSs.map(U=>a.jsx("option",{value:U,children:U},U))})]}),m.frequency==="custom"&&a.jsxs("label",{className:`${yn.field} ${yn.fieldGrow}`,children:[a.jsx("span",{className:yn.fieldLabel,children:n("scheduledTasks.cron")}),a.jsx("input",{className:yn.input,type:"text",value:m.customCron,spellCheck:!1,placeholder:"0 9 * * 1-5",onChange:U=>g(G=>({...G,customCron:U.target.value}))})]})]}),a.jsx("div",{className:yn.preview,children:de?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:yn.previewLabel,children:de}),a.jsx("code",{className:yn.previewCron,children:ue})]}):a.jsx("span",{className:yn.previewInvalid,children:n("scheduledTasks.error.invalidSchedule")})}),E&&a.jsx("div",{className:yn.formError,children:E}),a.jsxs("div",{className:yn.formActions,children:[a.jsx("button",{type:"button",className:yn.secondaryButton,onClick:Q,disabled:_,children:n("scheduledTasks.cancel")}),a.jsx("button",{type:"button",className:yn.primaryButton,onClick:()=>void V(),disabled:_,children:n(_?"scheduledTasks.saving":"scheduledTasks.save")})]})]})})]})}function ISs({changes:e,selectedPath:t,workspaceCwd:n,onOpenFilePreview:s,onDownloadFile:r,onDownloadError:o}){const{t:i}=et(),[l,c]=u.useState(!1),[d,h]=u.useState(!0),[f,p]=u.useState(!1),[m,g]=u.useState(520),v=u.useRef(m),b=u.useRef(null),y=u.useRef(null),[w,x]=u.useState(null),[k,_]=u.useState(()=>new Set),S=u.useRef(!0);u.useEffect(()=>(S.current=!0,()=>{S.current=!1}),[]);const E=l,j=u.useMemo(()=>OSs(e,n),[e,n]);u.useEffect(()=>{x(t)},[t]),u.useEffect(()=>{v.current=m},[m]),u.useEffect(()=>{const A=b.current;if(!A)return;const M=()=>{p(A.clientWidth<fSs)};M();const P=new ResizeObserver(M);return P.observe(A),()=>P.disconnect()},[d]),u.useEffect(()=>()=>y.current?.(),[]);const I=u.useCallback(A=>{const M=b.current;if(!M)return;A.preventDefault();const P=A.currentTarget;P.setPointerCapture(A.pointerId);const D=A.clientX,z=v.current,B=M.getBoundingClientRect().width,$=Math.max(180,B-180),L=document.body.style.cursor,O=document.body.style.userSelect;let W=z,H=null;document.body.style.cursor="col-resize",document.body.style.userSelect="none";const Q=()=>{H=null,g(W)},V=ue=>{W=Math.min($,Math.max(180,z+(ue.clientX-D))),H===null&&(H=window.requestAnimationFrame(Q))};let re=()=>{};const Z=ue=>{y.current=null,H!==null&&(window.cancelAnimationFrame(H),H=null),ue&&g(W),P.hasPointerCapture(A.pointerId)&&P.releasePointerCapture(A.pointerId),document.body.style.cursor=L,document.body.style.userSelect=O,window.removeEventListener("pointermove",V),window.removeEventListener("pointerup",re),window.removeEventListener("pointercancel",re)};re=()=>Z(!0),y.current=()=>Z(!1),window.addEventListener("pointermove",V),window.addEventListener("pointerup",re),window.addEventListener("pointercancel",re)},[]);if(e.length===0)return a.jsx("div",{className:It.empty,children:"No file changes to review."});const R=jZe(e),T=A=>{x(M=>M===A?null:A)},N=async A=>{if(!(!r||k.has(A.path))){_(M=>new Set(M).add(A.path));try{await r(A,()=>!S.current)}catch(M){S.current&&o(M)}finally{_(M=>{const P=new Set(M);return P.delete(A.path),P})}}};return a.jsxs("div",{className:It.review,children:[a.jsxs("div",{className:It.reviewToolbar,children:[a.jsxs("div",{className:It.reviewToolbarTitle,children:[a.jsx("span",{children:i("turnOutputs.previousTurn")}),a.jsx(rV,{additions:R?.additions,deletions:R?.deletions,className:It.lineStats,additionsClassName:It.additions,deletionsClassName:It.deletions})]}),a.jsxs("div",{className:It.reviewToolbarActions,children:[a.jsxs("button",{type:"button",className:It.reviewTotalsButton,onClick:()=>h(A=>!A),"aria-expanded":d,children:[a.jsx("span",{children:i("turnOutputs.fileCount",{count:e.length})}),a.jsx("span",{className:[It.chevron,d?It.chevronOpen:""].filter(Boolean).join(" "),"aria-hidden":"true",children:a.jsx(lDe,{})})]}),a.jsx("button",{type:"button",className:[It.iconButton,l?It.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(DSs,{}):a.jsx(PSs,{})})]})]}),d&&a.jsxs("div",{ref:b,className:[It.reviewContent,E?"":It.reviewContentListOnly,E&&f?It.reviewContentStacked:""].filter(Boolean).join(" "),style:{"--review-list-width":`${m}px`},children:[a.jsx("div",{className:[It.reviewList,w?It.reviewListWithExpanded:""].filter(Boolean).join(" "),children:e.map(A=>{const M=w===A.path,P=s&&DZe(A.path),D=r&&okn(A.path);return a.jsxs("div",{className:[It.reviewItem,M?It.reviewItemExpanded:""].filter(Boolean).join(" "),children:[a.jsxs("div",{className:It.reviewRow,"data-selected":A.path===t||void 0,children:[a.jsx("button",{type:"button",className:It.reviewRowToggle,onClick:()=>T(A.path),"aria-label":A.path,"aria-expanded":M}),a.jsx("span",{className:It.fileIcon,children:adt(A.path)}),a.jsxs("span",{className:It.reviewFileName,children:[a.jsx(jSs,{path:iX(A.path,n),title:A.path}),P&&a.jsx("button",{type:"button",className:It.reviewOpenButton,onClick:()=>s?.(A),title:`${i("turnOutputs.preview")} ${A.path}`,children:i("turnOutputs.preview")}),D&&a.jsx("button",{type:"button",className:It.reviewOpenButton,onClick:()=>void N(A),title:`${i("common.download")} ${A.path}`,disabled:k.has(A.path),children:i(k.has(A.path)?"common.downloading":"common.download")})]}),a.jsx(rV,{additions:A.additions,deletions:A.deletions,className:It.lineStats,additionsClassName:It.additions,deletionsClassName:It.deletions}),a.jsx("span",{className:[It.chevron,M?It.chevronOpen:""].filter(Boolean).join(" "),"aria-hidden":"true",children:a.jsx(lDe,{})})]}),M&&a.jsx(RSs,{change:A})]},`${A.toolCallId}:${A.path}`)})}),E&&!f&&a.jsx("div",{className:It.reviewSplitHandle,role:"separator","aria-orientation":"vertical",onPointerDown:I}),E&&a.jsx("div",{className:It.tree,children:j.children.map(A=>a.jsx(rdt,{node:A,depth:0,selectedPath:t},A.path))})]})]})}function RSs({change:e}){if(e.diffs.length===0)return a.jsx("div",{className:It.diffEmpty,children:"No diff available."});const t=ESs(e.diffs);return a.jsx("div",{className:It.diffPreview,children:t.map((n,s)=>n.fileDiff&&!n.fullContent?a.jsx(T9,{diff:n.fileDiff},s):a.jsx(ASs,{oldText:n.oldText,newText:n.newText},s))})}function ESs(e){for(let t=e.length-1;t>=0;t--)if(e[t]?.fullContent)return e.slice(t);return e}function ASs({oldText:e,newText:t}){const n=u.useRef(null),[s,r]=u.useState(null),[o,i]=u.useState(null);return u.useEffect(()=>{const l=n.current;if(!l)return;const c=()=>r(l.clientWidth>=720);c();const d=new ResizeObserver(c);return d.observe(l),()=>d.disconnect()},[]),u.useEffect(()=>{const l=n.current;if(!l||s===null)return;l.replaceChildren(),i(null);let c=!1,d=null;const h=[Qnt,ur.editable.of(!1),ll.readOnly.of(!0),ur.lineWrapping],f={scanLimit:1e3,timeout:500},p={margin:3,minSize:8};return bt(async()=>{const{MergeView:m,unifiedMergeView:g}=await import("./index-C-YHF5xI.js");return{MergeView:m,unifiedMergeView:g}},[]).then(({MergeView:m,unifiedMergeView:g})=>{if(!c)try{if(s){d=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}d=new ur({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,d?.destroy()}},[s,t,e]),a.jsxs("div",{className:It.codeMirrorDiffWrap,children:[a.jsx("div",{ref:n,className:It.codeMirrorDiff}),o&&a.jsxs("div",{className:It.diffError,children:["Diff unavailable: ",o]})]})}function rdt({node:e,depth:t,selectedPath:n}){const s=!!e.file,[r,o]=u.useState(!0),i=[It.treeRow,s?It.treeFile:It.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`},d=a.jsxs(a.Fragment,{children:[a.jsx("span",{className:It.treeTwisty,children:!s&&a.jsx("span",{className:[It.treeChevron,r?"":It.treeChevronClosed].filter(Boolean).join(" "),children:a.jsx(LSs,{})})}),a.jsxs("span",{className:It.treeContent,children:[s&&a.jsx("span",{className:It.fileIcon,children:adt(e.path)}),a.jsx("span",{className:It.treeName,children:e.name})]}),e.file?.isArtifact&&a.jsx("span",{className:It.reviewBadge,children:"artifact"})]});return a.jsxs("div",{className:It.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:d}):a.jsx("button",{type:"button",className:i,"data-depth":t,style:l,title:e.path,"aria-expanded":r,onClick:()=>o(h=>!h),children:d}),!s&&r&&e.children.length>0&&a.jsx("div",{className:It.treeChildren,style:c,children:e.children.map(h=>a.jsx(rdt,{node:h,depth:t+1,selectedPath:n},h.path))})]})}function jSs({path:e,title:t}){const n=u.useRef(null),[s,r]=u.useState(()=>odt(e));return u.useLayoutEffect(()=>{const o=n.current;if(!o)return;const i=()=>r(NSs(e,o));i();const l=new ResizeObserver(i);return l.observe(o),()=>l.disconnect()},[e]),a.jsxs("span",{ref:n,className:It.reviewPath,title:t??e,children:[s.prefix&&a.jsx("span",{className:It.pathPrefix,children:s.prefix}),a.jsx("span",{className:It.pathFileName,children:s.leaf})]})}function odt(e){const t=e.lastIndexOf("/");return t<0?{prefix:"",leaf:e}:{prefix:e.slice(0,t+1),leaf:e.slice(t+1)}}let aDe=null;function NSs(e,t){const n=odt(e),s=t.clientWidth;if(s<=0)return n;const r=MSs(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 d=1;d<o.length;d++){const f=`.../${o.slice(o.length-1-d,-1).join("/")}/`;if(r(f)+l>s)break;c=f}return{prefix:c,leaf:i}}function MSs(e){aDe??=document.createElement("canvas");const t=aDe.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 PSs(){return a.jsxs("svg",{className:It.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 DSs(){return a.jsxs("svg",{className:It.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 lDe(){return a.jsx("svg",{className:It.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 LSs(){return a.jsx("svg",{className:It.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 OSs(e,t){const n={name:"",path:"",children:[]};for(const s of e){const r=iX(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 d=o.children.find(h=>h.name===l);d||(d={name:l,path:c,children:[]},o.children.push(d)),i===r.length-1&&(d.file=s),o=d}}return idt(n),n}function idt(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)idt(t)}function N4(e){return K2(e).split("/").filter(Boolean).at(-1)??e}function adt(e){const t=N4(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 BSs({artifact:e,sourceSessionId:t,workspaceActions:n,previewContent:s}){const{t:r}=et(),o=Pm(),i=QJt(e),l=TT(e.url)?e.url:void 0,c=e.metadata?.artifactType==="automation_snapshot",d=e.metadata?.artifactType==="code_review",h=e.storage==="workspace"&&!!e.workspacePath,f=G0e(e);return e.metadata?.artifactType==="web_preview_snapshot"?a.jsx(bws,{artifact:e,sourceSessionId:t}):d?e.status!=="available"?a.jsx($Ss,{status:e.status}):!h||!e.workspacePath?a.jsx(FSs,{}):a.jsx(Dms,{workspacePath:e.workspacePath,artifactVersion:yAe(e),workspaceActions:n}):h&&e.workspacePath?bXe(e)||(w9(e.workspacePath,e.mimeType)||y9(e.workspacePath,e.mimeType)||V2(e))&&e.status!=="available"&&e.status!=="changed"?a.jsx(ldt,{artifact:e,workspaceActions:n}):a.jsx(c7,{workspacePath:e.workspacePath,artifactVersion:yAe(e),workspaceActions:n,previewContent:s,previewSizeBytes:e.sizeBytes,previewMimeType:V2(e)?"application/pdf":e.mimeType,imageMimeType:f,previewKind:zSs(e)?"html":USs(e)?"markdown":f?"image":"source"}):a.jsxs("div",{className:It.detail,children:[a.jsxs("div",{className:It.section,children:[a.jsx("div",{className:It.sectionTitle,children:c?"Automation Snapshot":"Artifact"}),a.jsxs("div",{className:It.fieldGrid,children:[a.jsx(Qg,{label:"Type",value:H0e(e.kind,e.workspacePath)}),a.jsx(Qg,{label:"Storage",value:e.storage}),a.jsx(Qg,{label:"Status",value:e.status}),a.jsx(Qg,{label:"Source",value:e.source}),a.jsx(Qg,{label:"Size",value:VY(e.sizeBytes)}),a.jsx(Qg,{label:"Created",value:e.createdAt}),a.jsx(Qg,{label:"Updated",value:e.updatedAt}),e.toolName&&a.jsx(Qg,{label:"Tool",value:e.toolName}),e.toolCallId&&a.jsx(Qg,{label:"Tool call",value:e.toolCallId})]})]}),e.description&&a.jsxs("div",{className:It.section,children:[a.jsx("div",{className:It.sectionTitle,children:"Description"}),a.jsx("div",{className:It.description,children:e.description})]}),c&&e.metadata&&a.jsxs("div",{className:It.section,children:[a.jsx("div",{className:It.sectionTitle,children:"Details"}),a.jsxs("div",{className:It.fieldGrid,children:[Bj(e.metadata,"automationId","Automation ID"),Bj(e.metadata,"schedule","Schedule"),Bj(e.metadata,"timezone","Timezone"),Bj(e.metadata,"status","Status"),Bj(e.metadata,"nextRunAt","Next run"),Bj(e.metadata,"prompt","Prompt")]})]}),(i||l)&&a.jsxs("div",{className:It.section,children:[a.jsx("div",{className:It.sectionTitle,children:"Location"}),l?a.jsxs("div",{className:It.locationRow,children:[a.jsx("a",{className:It.link,href:l,target:"_blank",rel:"noopener noreferrer",onClick:p=>o(p,l),children:l}),a.jsx("a",{className:It.openButton,href:l,target:"_blank",rel:"noopener noreferrer",onClick:p=>o(p,l),children:r("artifact.openLink")})]}):a.jsx("div",{className:It.meta,children:i})]})]})}function $Ss({status:e}){const{t}=et();return a.jsx("div",{className:It.previewError,role:"alert",children:t("codeReview.unavailable",{status:e})})}function FSs(){const{t:e}=et();return a.jsx("div",{className:It.previewError,role:"alert",children:e("codeReview.workspaceRequired")})}function zSs(e){const t=e.workspacePath?.toLowerCase()??"",n=mw(e.mimeType);return e.kind==="html"||t.endsWith(".html")||t.endsWith(".htm")||n==="text/html"}function USs(e){const t=e.workspacePath?.toLowerCase()??"",n=mw(e.mimeType);return t.endsWith(".md")||t.endsWith(".markdown")||n==="text/markdown"}function ldt({artifact:e,workspaceActions:t}){const{t:n}=et(),[s,r]=u.useState(null),[o,i]=u.useState(!1),l=u.useRef(!0),c=e.workspacePath;u.useEffect(()=>(l.current=!0,()=>{l.current=!1}),[]);const d=async()=>{if(e.workspacePath){i(!0),r(null);try{await x9(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:It.detail,children:a.jsxs("div",{className:It.section,children:[a.jsx("div",{className:It.sectionTitle,children:n("common.download")}),a.jsxs("div",{className:It.fieldGrid,children:[a.jsx(Qg,{label:"Type",value:H0e(e.kind,e.workspacePath)}),a.jsx(Qg,{label:"Size",value:VY(e.sizeBytes)}),c?a.jsx(Qg,{label:"Location",value:c}):null,e.status!=="available"&&e.status!=="changed"?a.jsx(Qg,{label:"Status",value:e.status??"missing"}):null]}),a.jsx("div",{className:It.downloadRow,children:a.jsx("button",{type:"button",className:It.downloadButton,onClick:()=>{d()},disabled:o||e.status!=="available"&&e.status!=="changed",children:n(o?"common.downloading":"common.download")})}),s&&a.jsx("div",{className:It.previewError,children:s})]})})}function WSs({tab:e}){const{t}=et(),n=ba(),s=cA(e.workspaceCwd),r=s?.actions,o=Pm(),[i,l]=u.useState(0),[c,d]=u.useState(),[h,f]=u.useState(),[p,m]=u.useState(),g=e.source,v=g.locator,b=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),y=v.type==="workspace_file"?v.workspacePath:v.type==="attachment"?v.attachmentId:"",w=V2({workspacePath:y});if(u.useEffect(()=>{let k=!1;return d(void 0),f(void 0),m(void 0),!b||v.type==="url"?void 0:((async()=>{if(v.type==="attachment"){const S=await e.sessionActions.readAttachment(v.attachmentId);if(k||!e.owner.isCurrent())return;const E=Uint8Array.from(atob(S.data),j=>j.charCodeAt(0));d(new Blob([E],{type:S.mimeType}))}else if(w&&r){const S=await IT(r.readFileBytes,y,"application/pdf",{statFile:r.stat,isCancelled:()=>k||!e.owner.isCurrent()});!k&&e.owner.isCurrent()&&d(S)}})().catch(S=>{!k&&e.owner.isCurrent()&&f(ja(S))}),()=>{k=!0})},[i,b,v,y,w,e.owner,e.sessionActions,r]),b&&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}),TT(v.url)&&a.jsx("a",{className:"text-primary underline",href:v.url,target:"_blank",rel:"noopener noreferrer",onClick:k=>o(k,v.url),children:t("sources.openOriginal")})]});if(!b||!s&&v.type!=="attachment")return a.jsx("div",{className:It.empty,role:"alert",children:t("sources.unavailable")});const x=v.type==="workspace_file"&&!w&&bXe({workspacePath:y});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:y,children:y}),a.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[p&&a.jsx(Ae,{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(Zy,{})})}),h&&a.jsx(Ae,{variant:"ghost",size:"sm",onClick:()=>l(k=>k+1),children:t("common.retry")})]})]}),h?a.jsx("div",{className:It.previewError,role:"alert",children:h}):x?a.jsxs("div",{className:"p-4",children:[a.jsx("p",{children:t("attachment.previewUnsupported")}),a.jsx(Ae,{onClick:()=>void x9(r,y,"application/octet-stream",()=>!e.owner.isCurrent()).catch(k=>{e.owner.isCurrent()&&f(ja(k))}),children:t("common.download")})]}):(v.type==="attachment"||w)&&!c?a.jsx("div",{className:It.empty,role:"status",children:t("common.loading")}):c&&!w9(y,c.type)&&!y9(y,c.type)&&!V2({workspacePath:y,mimeType:c.type})&&!EM(c.type,y)?a.jsx(Jbe,{data:c,title:g.title,onDownloadUrl:m,showDownload:!1,image:!!G2(y)&&c.type.startsWith("image/")}):a.jsx("div",{className:"relative min-h-0 flex-1 overflow-auto",children:a.jsx(c7,{workspacePath:y,workspaceActions:r,onLoadError:f,previewData:c,previewOnly:v.type==="attachment",downloadName:v.type==="attachment"?g.title:void 0,previewMimeType:c?.type,previewKind:/\.html?$/i.test(y)||mw(c?.type)==="text/html"?"source":void 0},i)})]})}function Jbe({data:e,title:t,image:n,onDownloadUrl:s,showDownload:r=!0}){const[o,i]=u.useState();return u.useEffect(()=>{const l=URL.createObjectURL(e);return i(l),s?.(l),()=>URL.revokeObjectURL(l)},[e,s]),o?a.jsxs("div",{className:It.imagePreviewWrap,children:[n?a.jsx("img",{className:It.imagePreview,src:o,alt:t}):a.jsx(ddt,{name:t,mimeType:e.type,size:e.size}),r&&a.jsx("a",{href:o,download:t,"aria-label":`Download ${t}`,children:a.jsx(Zy,{})})]}):null}function c7({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewData:o,previewMimeType:i,imageMimeType:l,previewKind:c,previewOnly:d,onLoadError:h,sourceRenderer:f,downloadName:p}){const{t:m}=et();if(w9(e,i||o?.type))return a.jsx(Bms,{workspacePath:e,workspaceActions:n,data:o,artifactVersion:t,downloadName:p});if(y9(e,i||o?.type))return a.jsx(Rm,{resetKeys:[e,n,o,t],fallback:a.jsxs("div",{children:[a.jsx("div",{role:"alert",className:It.previewError,children:m("excel.invalid")}),o?a.jsx(Jbe,{data:o,title:e.split(/[/\\]/).pop(),image:!1}):n?a.jsx(ldt,{artifact:{workspacePath:e,kind:"document",mimeType:i,status:"available"},workspaceActions:n},e):null]}),children:a.jsx(u.Suspense,{fallback:a.jsx("div",{className:It.empty,role:"status",children:m("common.loading")}),children:a.jsx(hSs,{workspacePath:e,workspaceActions:n,data:o,artifactVersion:t})})});if(o)return a.jsx(HSs,{workspacePath:e,workspaceActions:n,data:o,mimeType:i,previewKind:c,onLoadError:h});if(V2({workspacePath:e,mimeType:i}))return a.jsx(VSs,{workspacePath:e,artifactVersion:t,workspaceActions:n,onLoadError:h});const g=e.toLowerCase(),v=l??G2(e),b=c??(g.endsWith(".html")||g.endsWith(".htm")?"html":g.endsWith(".md")||g.endsWith(".markdown")?"markdown":v?"image":"source");return b==="html"?a.jsx(KSs,{workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:d,onLoadError:h}):b==="markdown"?a.jsx(XSs,{workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:d,onLoadError:h}):b==="image"&&v?a.jsx(GSs,{workspacePath:e,artifactVersion:t,workspaceActions:n,mimeType:v,onLoadError:h}):a.jsx(udt,{sourceRenderer:f,workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:d,onLoadError:h})}function HSs({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 V2({workspacePath:e,mimeType:i})?a.jsx(cdt,{data:n,mimeType:"application/pdf",title:e}):EM(i,e)?a.jsx(qSs,{workspacePath:e,workspaceActions:t,data:n,previewKind:r,onLoadError:o}):a.jsx(ddt,{name:e,mimeType:i,size:n.size})}function qSs({workspacePath:e,workspaceActions:t,data:n,previewKind:s,onLoadError:r}){const{t:o}=et(),[i,l]=u.useState(),[c,d]=u.useState();return u.useEffect(()=>{const h=new FileReader;return l(void 0),d(void 0),h.onload=()=>l(String(h.result??"")),h.onerror=()=>{const f=o("attachment.readFailed");d(f),r?.(f)},h.readAsText(n),()=>{h.readyState===FileReader.LOADING&&h.abort()}},[n,r,o]),c?a.jsx("div",{className:It.previewError,children:c}):i===void 0?a.jsx("div",{className:It.empty,children:o("attachment.loadingFile")}):a.jsx(c7,{workspacePath:e,workspaceActions:t,previewContent:i,previewSizeBytes:n.size,previewOnly:!0,previewKind:s})}function VSs({workspacePath:e,artifactVersion:t,workspaceActions:n,onLoadError:s}){const{t:r}=et(),[o,i]=u.useState(),[l,c]=u.useState(),[d,h]=u.useState(0);return u.useEffect(()=>{let f=!1;return i(void 0),c(void 0),IT(n.readFileBytes,e,"application/pdf",{statFile:n.stat,isCancelled:()=>f}).then(p=>{f||i(p)},p=>{if(f)return;const m=ja(p);c(m),s?.(m)}),()=>{f=!0}},[e,n,t,d,s]),l?a.jsxs("div",{className:It.empty,children:[a.jsx("div",{role:"alert",className:It.previewError,children:l}),a.jsx(Ae,{onClick:()=>h(f=>f+1),children:r("common.retry")})]}):o?a.jsx(cdt,{data:o,mimeType:"application/pdf",title:e}):a.jsx("div",{className:It.empty,role:"status",children:r("attachment.loadingPreview")})}function cdt({data:e,mimeType:t,title:n}){const{t:s}=et(),[r,o]=u.useState();return u.useEffect(()=>{const i=URL.createObjectURL(e.type===t?e:new Blob([e],{type:t}));return o(i),()=>URL.revokeObjectURL(i)},[e,t]),r?a.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[a.jsx("div",{className:"flex justify-end border-b border-border p-1",children:a.jsx(Ae,{variant:"ghost",size:"sm",asChild:!0,children:a.jsxs("a",{href:r,download:N4(n),"aria-label":`Download ${N4(n)}`,children:[a.jsx(Zy,{"aria-hidden":"true"}),s("common.download")]})})}),navigator.pdfViewerEnabled===!1?a.jsx("div",{className:It.empty,children:s("attachment.previewUnsupported")}):a.jsx("iframe",{className:`${It.pdfAttachmentPreview} min-h-0 flex-1`,src:r,title:`Preview ${n}`})]}):a.jsx("div",{className:It.empty,children:s("attachment.loadingPreview")})}function ddt({name:e,mimeType:t,size:n}){const{t:s}=et();return a.jsxs("div",{className:It.unsupportedAttachmentPreview,children:[a.jsx(ub,{name:e,mimeType:t,"aria-hidden":"true"}),a.jsx("div",{children:s("attachment.previewUnsupported")}),a.jsxs("div",{className:It.unsupportedAttachmentMeta,children:[t," · ",VY(n)]})]})}function GSs({workspacePath:e,artifactVersion:t,workspaceActions:n,mimeType:s,onLoadError:r}){const[o,i]=u.useState(null),[l,c]=u.useState(null);return u.useEffect(()=>{let d=!1,h;return i(null),c(null),IT((f,p)=>n.readFileBytes(f,p),e,s,{statFile:f=>n.stat(f),isCancelled:()=>d}).then(f=>{d||(h=URL.createObjectURL(f),i(h))}).catch(f=>{if(d)return;const p=f instanceof Error?f.message:String(f);c(p),r?.(p)}),()=>{d=!0,h&&URL.revokeObjectURL(h)}},[t,s,r,n,e]),a.jsxs("div",{className:It.imagePreviewWrap,children:[o?a.jsxs(a.Fragment,{children:[a.jsx("img",{className:It.imagePreview,src:o,alt:N4(e)}),a.jsx("a",{className:It.imageDownloadButton,href:o,download:N4(e),"aria-label":`Download ${N4(e)}`,title:"Download",children:a.jsx(Zy,{size:16,strokeWidth:1.8})})]}):l?null:a.jsx("div",{className:It.empty,children:"Loading image..."}),l&&a.jsx("div",{className:It.previewError,children:l})]})}function Qbe({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:r,onLoadError:o,maxPreviewBytes:i}){const{t:l}=et(),[c,d]=u.useState(s??null),[h,f]=u.useState(),[p,m]=u.useState(null);return u.useEffect(()=>{let g=!1;if(d(s??null),m(null),f(void 0),!r)return n.stat(e).then(v=>{if(!g){if(v.type==="directory")throw new Error("Directories cannot be opened as artifacts.");if(i!==void 0&&v.sizeBytes>i)throw new Error(l("files.sourceTooLarge"));return n.readWorkspaceFile(e,{maxBytes:256*1024})}}).then(async v=>{if(g||!v||!v.truncated)return v;const b=await IT((y,w)=>n.readFileBytes(y,w),e,"application/octet-stream",{statFile:y=>n.stat(y),isCancelled:()=>g,maxBytes:i});return{sizeBytes:b.size,content:new TextDecoder(v.encoding||"utf-8").decode(await b.arrayBuffer())}}).then(v=>{g||!v||(f(v.sizeBytes),d(v.content))}).catch(v=>{if(g)return;const b=v instanceof Error?v.message:String(v);m(b),o?.(b)}),()=>{g=!0}},[t,s,r,o,n,e,i,l]),{content:c,error:p,sizeBytes:h}}function KSs({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:o,onLoadError:i}){const{content:l,error:c,sizeBytes:d}=Qbe({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:o,onLoadError:i});return a.jsxs("div",{className:It.htmlPreviewWrap,children:[l===null?!c&&a.jsx("div",{className:It.empty,children:"Loading preview..."}):a.jsx(hdt,{content:l,sizeBytes:d??r,workspacePath:e,workspaceActions:n,children:()=>a.jsx(YSs,{content:l,workspacePath:e})}),c&&a.jsx("div",{className:It.previewError,children:c})]})}function YSs({content:e,workspacePath:t}){const n=`Preview ${t}`,{t:s}=et(),[r,o]=u.useState(null),[i,l]=u.useState(null);return u.useEffect(()=>{const c=new AbortController;return o(null),l(null),ZJt(e,n,c.signal).then(d=>{c.signal.aborted||o(d)},d=>{c.signal.aborted||l(ja(d))}),()=>c.abort()},[e,n]),i?a.jsx("div",{className:It.previewError,children:s("artifact.previewFailed",{message:i})}):r===null?a.jsx("div",{className:It.empty,children:s("attachment.loadingPreview")}):a.jsx("iframe",{className:It.htmlPreview,referrerPolicy:"no-referrer",sandbox:"allow-scripts",srcDoc:r,title:n})}function udt({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:r,onLoadError:o,sourceRenderer:i}){const l=u.useRef(null),[c,d]=u.useState(null),{content:h,error:f}=Qbe({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:r,onLoadError:o,maxPreviewBytes:i?4*1024*1024:void 0});return u.useEffect(()=>{const p=l.current;if(!p||h===null)return;p.replaceChildren(),d(null);let m;try{m=new ur({doc:h,extensions:[Qnt,ur.editable.of(!1),ll.readOnly.of(!0),ur.lineWrapping],parent:p})}catch(g){d(g instanceof Error?g.message:String(g));return}return()=>m.destroy()},[h,i]),a.jsxs("div",{className:It.filePreviewWrap,children:[h===null?!f&&a.jsx("div",{className:It.empty,children:"Loading file..."}):i?a.jsx("div",{className:It.codeMirrorFile,children:i(h)}):a.jsx("div",{ref:l,className:It.codeMirrorFile}),(f||c)&&a.jsx("div",{className:It.previewError,children:f||c})]})}function hdt({content:e,sizeBytes:t,workspacePath:n,workspaceActions:s,children:r}){const{t:o}=et(),[i,l]=u.useState(null);if(!u.useMemo(()=>(t??new TextEncoder().encode(e).byteLength)>1024*1024,[e,t]))return r();const d=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(Ae,{className:"ml-auto shrink-0",variant:"outline",size:"sm",onClick:()=>l(d?null:e),children:o(d?"artifact.showSource":"artifact.renderFullPreview")})]}),a.jsx("div",{className:"relative min-h-0 flex-1 overflow-auto",children:d?r():a.jsx(udt,{workspacePath:n,workspaceActions:s,previewContent:e,previewOnly:!0})})]})}function XSs({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:o,onLoadError:i}){const{content:l,error:c,sizeBytes:d}=Qbe({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:o,onLoadError:i});return a.jsxs("div",{className:It.htmlPreviewWrap,children:[l===null?!c&&a.jsx("div",{className:It.empty,children:"Loading preview..."}):a.jsx(hdt,{content:l,sizeBytes:d??r,workspacePath:e,workspaceActions:n,children:()=>a.jsx("div",{className:It.markdownPreviewWrap,children:a.jsx(cp,{content:l})})}),c&&a.jsx("div",{className:It.previewError,children:c})]})}function Qg({label:e,value:t}){return t?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:It.fieldLabel,children:e}),a.jsx("span",{className:It.fieldValue,children:t})]}):null}function Bj(e,t,n){const s=e[t];return s==null||s===""?null:a.jsx(Qg,{label:n,value:String(s)},t)}/**
|
|
2968
|
+
`);return n===-1?t:t.slice(0,n)}function Q_s(e,t){if(e.kind==="request"){const n=[ta(e.timing.durationMs)];return e.timing.ttftMs!==void 0&&n.push(t("trajectory.ttft",{duration:ta(e.timing.ttftMs)})),e.usage&&n.push(Y_s(e.usage)),n}if(e.kind==="tool"){const n=[];if(e.timing&&n.push(ta(e.timing.durationMs)),e.subagentSummary){const{requests:s,tools:r,requestMs:o}=e.subagentSummary;n.push(t("trajectory.subagentRollup",{requests:s,tools:r,duration:ta(o)}))}return n}return[]}function koe(e){const t=e.toolStatus??e.block.status;if(t==="error"||t==="failed")return No.toneError;if(t==="cancelled"||t==="canceled")return No.toneMuted}function pfe(e,t){switch(e.kind){case"user":return{badge:t("trajectory.badge.user"),text:vE(e.block.text)};case"request":{const n=J_s(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:No.toneError}:{},text:s?`${r} · ${t("trajectory.requestFailed")}`:r}}case"message":return{badge:e.thought?t("trajectory.badge.thought"):t("trajectory.badge.message"),text:vE(e.block.text),faint:e.thought};case"tool":return{badge:e.block.toolName??t("trajectory.badge.tool"),...koe(e)?{badgeTone:koe(e)}:{},text:`${e.block.title||(e.block.toolName??"")}${koe(e)===No.toneError?` · ${t("trajectory.toolFailed")}`:""}`};default:return Z_s(e.block,t)}}function Z_s(e,t){switch(e.kind){case"shell":return{badge:t("trajectory.badge.shell"),text:vE(e.text)};case"user_shell":return{badge:t("trajectory.badge.shell"),text:vE(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:No.toneError}:{},text:vE(e.text),faint:e.kind!=="error"};case"prompt_cancelled":return{badge:t("trajectory.badge.cancelled"),badgeTone:No.toneMuted,text:e.reason??t("trajectory.cancelled"),faint:!0};default:return{badge:t("trajectory.badge.other"),text:""}}}function eSs(e){return e.rows.some(t=>t.kind==="request"||t.kind==="tool"&&t.timing!==void 0)}function tSs({loadPage:e,historyGapRevision:t=0}){const{t:n,language:s}=et(),r=u.useRef(null),[o,i]=u.useState(!1);u.useLayoutEffect(()=>{const te=r.current;if(!te)return;const an=()=>i(te.clientWidth>=K_s);if(an(),typeof ResizeObserver>"u")return;const Vs=new ResizeObserver(an);return Vs.observe(te),()=>Vs.disconnect()},[]);const l=u.useRef(e);u.useLayoutEffect(()=>{l.current=e},[e]);const c=u.useCallback(()=>{if(l.current!==e)return;const te=r.current?.querySelector('[data-testid="trajectory-executions"]');(te?.querySelector('[role="grid"]')??te?.querySelector("button")??ce.current)?.focus({preventScroll:!0})},[e]),{trajectory:d,lifecycle:h,status:f,error:p,loadedPages:m,windowPages:g,truncated:v,olderFailure:b,refresh:y,retry:w,older:x,newer:k,mode:_,navigationVersion:S,navigationError:E,loadingKind:j,canRefresh:I,canOlder:R,canNewer:T,historyReleased:N}=Ubs(e),[A,M]=u.useState({loader:e,paused:!1});A.loader!==e&&M({loader:e,paused:!1});const P=u.useCallback(()=>{M(te=>te.loader!==e||te.paused&&!te.pending?te:{loader:e,paused:!0})},[e]),D=u.useRef({loader:e,status:h.status});u.useLayoutEffect(()=>{const te=D.current;D.current={loader:e,status:h.status},te.loader===e&&te.status==="live"&&h.status!=="live"&&P()},[e,h.status,P]);const z=A.loader===e&&!A.paused&&_==="latest",B=A.loader===e&&!!A.pending,[$,L]=u.useState({loader:e,revision:0}),O=u.useRef(void 0),W=u.useCallback(()=>{O.current={revision:t,trajectory:d},y()},[t,d,y]),H=u.useCallback(()=>{I&&(M({loader:e,paused:!0,pending:{of:d}}),W())},[I,e,d,W]);u.useEffect(()=>{O.current=void 0},[e]),u.useEffect(()=>{const te=O.current;te&&f!=="loading"&&p?O.current=void 0:te&&f==="ready"&&d!==te.trajectory&&(L({loader:e,revision:te.revision}),O.current=void 0)},[f,d,p,e]);const Q=t>($.loader===e?$.revision:0),V=u.useRef(!1),[re,Z]=u.useState({loader:e,version:S,selectionLost:!1}),[ue,de]=u.useState(!1),[U,G]=u.useState(!1),[Y,X]=u.useState({loader:e,value:q6,scope:0});Y.loader!==e&&X({loader:e,value:q6,scope:Y.scope+1});const pe=Y.loader===e?Y.value:q6,ae=u.useCallback(te=>{P(),X(an=>an.loader===e&&an.value.query===te.query&&an.value.type===te.type&&an.value.status===te.status?an:{loader:e,value:te,scope:an.scope})},[e,P]),se=u.useCallback(()=>ae(q6),[ae]),me=rDe(pe),ye=u.useMemo(()=>d?G_s(d):void 0,[d]),ve=u.useMemo(()=>ye?sDe(ye,pe):[],[ye,pe]),Te=u.useMemo(()=>new Set(ve),[ve]),[Ne,Ie]=u.useState(void 0),[Fe,ge]=u.useState(),_e=u.useMemo(()=>T1s(h,Zat(e)),[h,e]),[Ce,je]=u.useState(),Ue=Ce?.loader===e?_e.rows.find(te=>te.key===Ce?.key):void 0,[q,J]=u.useState(!1);u.useEffect(()=>{Ce&&!Ue&&je(void 0)},[Ce,Ue]),u.useEffect(()=>{J(!1),ge(void 0),je(void 0)},[e]),u.useEffect(()=>{Fe?.of&&d&&Fe.of!==d&&ge({...Fe,of:void 0})},[Fe,d]);const ce=u.useRef(null),ee=u.useRef(!1),fe=u.useRef(0),Re=u.useId(),Me=u.useCallback(te=>`${Re}-row-${te}`,[Re]),be=u.useCallback((te,an)=>{te.scrollTop=an,fe.current=te.scrollTop},[]),Be=u.useRef(void 0),[Ge,Ve]=u.useState("active"),pt=u.useMemo(()=>d?Act(d,{mode:Ge}):void 0,[d,Ge]),lt=f_s(pt),it=u.useMemo(()=>new Map(pt?.spans.map(te=>[te.row.key,te])),[pt]),[Tt,Ke]=u.useState(void 0),_t=Tt!==void 0&&Tt.of===d&&Tt.mode===Ge?Tt.range:void 0,Dt=u.useCallback(te=>{P(),Ke(te!==void 0&&d!==void 0?{range:te,of:d,mode:Ge}:void 0)},[d,Ge,P]);u.useEffect(()=>{Tt&&(Tt.of!==d||Tt.mode!==Ge)&&Ke(void 0)},[Tt,d,Ge]);const Rt=u.useMemo(()=>_t&&pt?jct(pt,_t):void 0,[_t,pt]),we=u.useMemo(()=>d?d_s(d):void 0,[d]),ht=u.useMemo(()=>new Map((we?.rows??[]).flatMap(te=>te.kind==="turn"?[[te.key,te.turn]]:[])),[we]),[We,tt]=u.useState(),Ft=u.useMemo(()=>!we||!We||We.loader!==e?new Set:We.of===we?We.keys:new Set([...We.keys].filter(te=>{const an=we.groupIdentities.get(te);return an!==void 0&&an===We.of.groupIdentities.get(te)})),[We,we,e]);u.useEffect(()=>{We&&(We.of!==we||We.loader!==e)&&tt(we?{of:we,loader:e,keys:Ft}:void 0)},[We,we,e,Ft]);const Ot=u.useMemo(()=>ve.filter(te=>!Rt||Rt.has(te)),[ve,Rt]),Mt=u.useMemo(()=>me?new Set(Ot):Rt,[me,Ot,Rt]),kn=xoe(pe,_t,Ge),[Dn,Un]=u.useState(),Tn=u.useMemo(()=>Dn?.of===d&&Dn?.loader===e&&Dn?.signature===kn?Dn.overrides:new Map,[Dn,d,e,kn]);u.useEffect(()=>{Dn&&(!me||Dn.of!==d||Dn.loader!==e||Dn.signature!==kn)&&Un(void 0)},[Dn,me,d,e,kn]);const xs=u.useMemo(()=>{if(!me)return Ft;const te=new Set(Ft);for(const an of Ot)for(const Vs of we?.ancestors.get(an)??[])te.delete(Vs);for(const[an,Vs]of Tn)Vs?te.add(an):te.delete(an);return te},[me,Ft,Ot,we,Tn]),Et=u.useMemo(()=>we?u_s(we,Mt):[],[we,Mt]),ln=u.useMemo(()=>new Set(Et.map(te=>te.key)),[Et]),nn=u.useMemo(()=>we?h_s(we,Et,xs):[],[we,Et,xs]),Nt=u.useMemo(()=>new Set(nn.map(te=>te.key)),[nn]),Jt=we&&Ne?Z8e(we,Ne,Nt):void 0,Bt=u.useMemo(()=>{const te=new Map;for(const an of Et)if(an.kind==="row")for(const Vs of we?.ancestors.get(an.key)??[])te.set(Vs,(te.get(Vs)??0)+1);return te},[we,Et]),gt=_==="history",jt=U0e({count:nn.length,getScrollElement:()=>ce.current,getItemKey:te=>nn[te]?.key??te,estimateSize:()=>hx,paddingStart:hx,paddingEnd:gt?hx:0,overscan:12}),Qt=u.useCallback(te=>{te===0?jt.scrollToOffset(0):jt.scrollToIndex(te,{align:"auto"})},[jt]),wn=u.useCallback(te=>{if(!d||!we?.groups.has(te))return;P();const an=ce.current;if(an){const qe=an.scrollTop-hx,Xt=Math.max(0,Math.min(nn.length-1,Math.floor(qe/hx))),en=nn[Xt];en&&(Be.current={key:en.key,offset:qe-Xt*hx})}const Vs=new Set(xs);if(Vs.has(te)?Vs.delete(te):Vs.add(te),me){const qe=new Map(Tn);qe.set(te,Vs.has(te)),Un({of:d,loader:e,signature:kn,overrides:qe})}else tt({of:we,loader:e,keys:Vs});ce.current?.focus({preventScroll:!0})},[d,we,nn,xs,e,me,kn,Tn,P]);u.useLayoutEffect(()=>{const te=Be.current;if(!te||!we||!ce.current)return;Be.current=void 0;const an=Z8e(we,te.key,Nt),Vs=nn.findIndex(qe=>qe.key===an);Vs>=0&&be(ce.current,(Vs+1)*hx+te.offset)},[we,nn,Nt,be]);const ze=nn.length>0;u.useLayoutEffect(()=>{const te=ce.current;if(!te||typeof ResizeObserver>"u")return;let an=0;const Vs=()=>{te.scrollTop===0&&fe.current>0&&(te.scrollTop=fe.current)},qe=new ResizeObserver(()=>{Vs(),an=requestAnimationFrame(Vs)});return qe.observe(te),()=>{qe.disconnect(),an!==0&&cancelAnimationFrame(an)}},[ze]),u.useEffect(()=>{if(f!=="ready"||ee.current||nn.length===0)return;ee.current=!0;const te=ce.current;te&&be(te,te.scrollHeight)},[be,f,nn.length]);const Qe=u.useMemo(()=>Jt===void 0?-1:nn.findIndex(te=>te.key===Jt),[Jt,nn]),vt=u.useRef(Qe);vt.current=Qe,u.useLayoutEffect(()=>{const te=vt.current;if(!q||te<0)return;const an=requestAnimationFrame(()=>{Qt(te)});return()=>cancelAnimationFrame(an)},[q,Qt]);const rt=u.useCallback(te=>{if(nn.length===0)return;P();const an=Math.min(Math.max(te,0),nn.length-1),Vs=nn[an].key;je(void 0),Ie(Vs),q&&d&&e&&ge({of:d,loader:e,key:Vs}),Qt(an)},[q,e,d,Qt,nn,P]),Ee=u.useCallback((te,an=!0)=>{P(),je(void 0),Ie(te),q&&d&&e&&ge({of:d,loader:e,key:te}),an&&ce.current?.focus({preventScroll:!0})},[q,d,e,P]),Ze=u.useCallback((te=Ne)=>{!d||!e||!te||!d.rowIndexByKey.has(te)&&!ht.has(te)||(P(),je(void 0),ge({of:d,loader:e,key:te}),Ie(te),J(!0))},[d,e,Ne,P,ht]),Oe=u.useCallback(te=>{Ee(te),Ze(te)},[Ee,Ze]),Le=u.useRef(null),ft=u.useRef(void 0),Lt=q||!!Ue,mt=o?"side":"drill-in",Ut=Lt&&mt==="drill-in";u.useLayoutEffect(()=>{Le.current?.toggleAttribute("inert",Ut);const te=ft.current;Ut||!te||(ft.current=void 0,te())},[Ut,Lt]);const Gt=u.useCallback(te=>{ft.current=te},[]),cn=u.useCallback(()=>{ce.current?.focus({preventScroll:!0})},[]),pn=u.useCallback(()=>{J(!1),ge(void 0),Gt(cn)},[Gt,cn]),Ss=u.useCallback(te=>{if(te.target!==te.currentTarget&&te.target.tabIndex>=0){if(!["ArrowDown","ArrowUp","Home","End"].includes(te.key))return;te.currentTarget.focus({preventScroll:!0})}if(te.key==="Escape"){_t!==void 0&&(te.preventDefault(),Dt(void 0));return}if(nn.length===0)return;if(te.key==="Enter"){te.preventDefault(),Jt&&Oe(Jt);return}if((te.key==="ArrowLeft"||te.key==="ArrowRight")&&Jt&&we?.groups.has(Jt)&&(Bt.get(Jt)??0)>0){const Vs=te.key==="ArrowLeft";xs.has(Jt)!==Vs&&(te.preventDefault(),wn(Jt));return}const an=Qe<0?-1:Qe;te.key==="ArrowDown"?(te.preventDefault(),rt(an+1)):te.key==="ArrowUp"?(te.preventDefault(),rt(an<=0?0:an-1)):te.key==="Home"?(te.preventDefault(),rt(0)):te.key==="End"?(te.preventDefault(),rt(nn.length-1)):(te.key==="PageUp"||te.key==="PageDown"||te.key===" ")&&P()},[rt,Oe,_t,Qe,Dt,nn,Jt,we,Bt,xs,wn,P]),_r=u.useMemo(()=>d?Hbs(d):void 0,[d]),Zs=Fe!==void 0&&Fe.of===d&&Fe.loader===e,ds=Zs?d?.rowIndexByKey.get(Fe.key):void 0,Ht=Zs?ht.get(Fe.key):void 0,Fn=Ht?Ht.userRowKey===void 0?void 0:d?.rows[d.rowIndexByKey.get(Ht.userRowKey)??-1]:ds===void 0?void 0:d?.rows[ds],Yn=(f==="ready"||f==="error"&&d!==void 0)&&nn.length===0,ot=d!==void 0&&d.rows.length>0&&!eSs(d),Ct=_r!==void 0&&_r.plottedCount===0&&_r.missingStartCount>0,Yt=u.useMemo(()=>{if(!(!d||!_t&&!me&&xs.size===0))return{shown:nn.filter(te=>te.kind==="row").length,total:d.rows.length}},[_t,d,nn,xs,me]),vn=b===void 0?void 0:b.kind==="partial"?n("trajectory.olderPartial"):b.kind==="unreadable"?n("trajectory.olderFailed",{message:b.message}):n(`trajectory.window.${b.kind}`),fn=u.useRef(void 0);if(re.loader!==e||re.version!==S){const te=re.loader!==e;V.current=!te,Z({loader:e,version:S,selectionLost:!te&&Ne!==void 0}),Ie(void 0),ge(void 0),J(!1),tt(void 0),Un(void 0),Ke(void 0),Be.current=void 0,fn.current=void 0,fe.current=0,ee.current=!te}u.useLayoutEffect(()=>{V.current&&ce.current&&(V.current=!1,jt.scrollToOffset(0),be(ce.current,0))},[S,ze,jt,be]);const Xe=u.useRef(!1);u.useEffect(()=>{const te=A.loader===e&&A.pending;!te||f==="loading"||(p||b||E?P():f==="ready"&&d!==te.of&&_==="latest"&&(Xe.current=!0,M({loader:e,paused:!1}),Ie(void 0),je(void 0),J(!1),ge(void 0),X(an=>({...an,value:q6})),Ke(void 0)))},[A,e,f,p,b,E,d,_,P]),u.useLayoutEffect(()=>{if(!Xe.current)return;Xe.current=!1;const te=ce.current;te&&(be(te,te.scrollHeight),cL(te.getRootNode())&&te.focus({preventScroll:!0}))},[z,nn,be]);const kt=u.useRef(void 0);u.useLayoutEffect(()=>{const te=kt.current,an=r.current;!te||!an||f==="loading"||(kt.current=void 0,cL(an.getRootNode())&&(an.querySelector(`[data-testid="${te}"]`)??ce.current)?.focus({preventScroll:!0}))},[S,f,ze]);const Rn=u.useCallback(()=>{const te=ce.current;G(!!te&&te.scrollHeight-te.clientHeight-te.scrollTop>hx)},[]),On=jt.getTotalSize(),us=nn.length>0;u.useLayoutEffect(()=>{Rn()},[Rn,On,us]);const Es=u.useCallback(te=>{const an=nn.findIndex(Vs=>Vs.key===te);if(an<0&&d&&we){fn.current=te;const Vs=me&&!ln.has(te)&&!Te.has(te),qe=_t!==void 0&&!ln.has(te)&&!Rt?.has(te);Vs&&se(),qe&&Dt(void 0);const Xt=we.ancestors.get(te)??[];if(me&&!Vs){const en=new Map(qe?[]:Tn);for(const rs of Xt)en.set(rs,!1);Un({of:d,loader:e,signature:xoe(pe,qe?void 0:_t,Ge),overrides:en})}else{const en=new Set(Ft);for(const rs of Xt)en.delete(rs);tt({of:we,loader:e,keys:en})}Ee(te);return}Ee(te),an>=0&&Qt(an)},[d,we,Te,ln,Rt,me,se,Tn,pe,_t,Ge,Ft,e,Ee,Dt,Qt,nn]),fr=u.useCallback((te,an=pe)=>{if(!rDe(an)||!ye||!d||!we)return;ae(an);const Vs=sDe(ye,an).filter(er=>!Rt||Rt.has(er));if(!Vs.length)return;const qe=Ne?Vs.indexOf(Ne):-1,Xt=qe<0?te===1?0:Vs.length-1:(qe+te+Vs.length)%Vs.length,en=Vs[Xt],rs=we.ancestors.get(en)??[],nr=xoe(an,_t,Ge),mr=new Map(nr===kn?Tn:[]);for(const er of rs)mr.set(er,!1);Un({of:d,loader:e,signature:nr,overrides:mr}),fn.current=en,Ee(en,!1)},[ye,d,we,ae,pe,Rt,Ne,_t,Ge,kn,Tn,e,Ee]);u.useLayoutEffect(()=>{const te=fn.current;if(te===void 0)return;fn.current=void 0;const an=nn.findIndex(Vs=>Vs.key===te);an>=0&&Qt(an)},[Qt,nn]);const An=u.useCallback(te=>{const an=[pfe(te.row,n).text],Vs=te.row.kind==="request"||te.row.kind==="tool"?te.row.timing?.startedAt:void 0;return Vs!==void 0&&an.push(`${new Date(Vs).toLocaleString()}–${new Date(Vs+te.end-te.start).toLocaleString()}`),an.push(ta(te.end-te.start)),te.ttftEnd!==void 0&&an.push(n("trajectory.ttft",{duration:ta(te.ttftEnd-te.start)})),an.filter(Boolean).join(" · ")},[n]),fs=ue&&_e.rows.length>0,Ls=xxs({windowMode:_,following:z,returning:B,liveStatus:h.status}),Cs=kxs({hasTrajectory:d!==void 0,error:p,navigationError:E,historyStale:Q,lifecycleIncomplete:h.incomplete&&h.status!=="unavailable"||h.truncated}),bn=_xs({truncated:v,loading:f==="loading"&&j!=="latest",olderFailure:b}),qn=_t&&pt?`${afe(pt,_t.start,_t.end-_t.start,s)} – ${afe(pt,_t.end,_t.end-_t.start,s)}`:void 0,ks=a.jsx("div",{className:No.boundary,"aria-live":"polite","data-testid":"trajectory-older-bar","data-state":bn,children:bn==="failed"?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:`${No.boundaryText} ${No.toneError}`,"data-testid":"trajectory-older-failed",title:vn,children:vn}),a.jsx("button",{type:"button",className:No.boundaryButton,onClick:()=>{f!=="loading"&&w()},"aria-disabled":f==="loading"||b!==void 0&&!lfe(b),"data-testid":"trajectory-older-retry",children:n("common.retry")})]}):bn==="loading"||bn==="earlier"?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:No.boundaryText,...bn==="earlier"?{"data-testid":"trajectory-truncated"}:{},children:bn==="loading"?n("trajectory.loadingPages",{pages:m}):n(_==="history"?"trajectory.window.outside":"trajectory.boundary.earlier")}),v&&a.jsx("button",{type:"button",className:No.boundaryButton,"aria-disabled":!R,onClick:()=>{R&&(P(),kt.current="trajectory-window-older",x())},"data-testid":"trajectory-window-older",children:n("trajectory.boundary.loadEarlier")})]}):a.jsx("span",{className:No.boundaryText,children:n("trajectory.boundary.start")})}),Zr=a.jsxs("div",{className:No.boundary,children:[a.jsx("button",{type:"button",className:No.boundaryButton,"aria-disabled":!T,onClick:()=>{T&&(P(),kt.current="trajectory-window-newer",k())},"data-testid":"trajectory-window-newer",children:n("trajectory.boundary.newer")}),a.jsx("button",{type:"button",className:No.boundaryButton,"aria-disabled":!I,onClick:()=>{I&&(kt.current="trajectory-window-latest",H())},"data-testid":"trajectory-window-latest",children:n("trajectory.window.return")}),N&&!T&&f!=="loading"&&!E&&!p&&!b&&a.jsx("span",{className:No.boundaryText,children:n("trajectory.window.released")})]}),Er=Fn&&!Ht,eo=Ue?a.jsx(A8e,{presentation:mt,execution:Ue,title:Ue.name,onClose:()=>{je(void 0),Gt(c)},onFocusedUnmount:c,onLocateExecution:Ue.historyRowKey?()=>{const te=Ue.historyRowKey;Es(te),Ze(te)}:void 0},Ue.key):q&&Fe!==void 0&&Fe.loader===e?a.jsx(A8e,{presentation:mt,row:Fn,turn:Ht,lifecycle:Zs&&Fn&&!Ht?h.byRowKey.get(Fn.key):void 0,stale:!Zs,title:Ht?n(Ht.partial?"trajectory.turnPartial":"trajectory.turn",{index:Ht.index}):Fn?pfe(Fn,n).text:void 0,hiddenByRange:!!(_t&&Er&&!ln.has(Fn.key)&&!Rt?.has(Fn.key)),hiddenByFilter:!!(me&&Er&&!ln.has(Fn.key)&&!Te.has(Fn.key)),onClearFilter:se,hiddenByCollapse:!!(Er&&we?.ancestors.get(Fn.key)?.some(te=>xs.has(te))),onReveal:()=>{Fn&&Es(Fn.key)},onClearRange:()=>Dt(void 0),onClose:pn,onStep:te=>rt(Qe+te),onFocusedUnmount:cn}):void 0;return a.jsxs("div",{ref:r,className:No.panel,"data-testid":"trajectory-panel",children:[a.jsx(Hxs,{summary:_r,pill:Ls,onPill:()=>{Ls==="paused"||Ls==="history"?H():P()},warnings:Cs,onRetry:w,onRefresh:()=>{P(),W()},onReturnToLatest:H,canRefresh:I,history:_==="history",failuresOn:pe.status==="error",onToggleFailures:()=>ae({...pe,status:pe.status==="error"?"all":"error"}),about:{pages:g,searchExcluded:ye?.truncatedCount??0,executionsOmitted:_e.omitted,executionsOutside:h.outsideWindow.length}}),a.jsx(bxs,{model:pt,viewportControl:{...lt,applyViewport:te=>{P(),lt.applyViewport(te)}},...ot||Ct?{notice:n(Ct?"trajectory.noStart":"trajectory.noTiming")}:{},selectedKey:Ne,onSelect:Es,describe:An,..._t!==void 0?{range:_t}:{},onRangeChange:Dt,onModeChange:te=>{P(),Ve(te)}}),a.jsxs(Zct,{className:No.split,orientation:"horizontal","data-testid":"trajectory-split",children:[a.jsxs(ffe,{id:"trajectory-records",className:No.recordsPanel,minSize:320,children:[a.jsxs("div",{ref:Le,className:No.records,children:[d&&d.rows.length>0&&a.jsx(O_s,{value:pe,onChange:ae,onNavigate:fr,onClear:se,count:me?Ot.length:0,position:me&&Ne?Ot.indexOf(Ne)+1:0,truncatedCount:ye?.truncatedCount??0,...qn!==void 0?{range:qn}:{},onClearRange:()=>Dt(void 0),...Yt?{status:n("trajectory.range.status",Yt)}:{}},Y.scope),a.jsx(C1s,{rows:_e.rows,selectedKey:Ue?.key,following:z,liveStatus:h.status,historySnapshot:d,onPause:P,onUpdatedChange:de,onFocusLost:()=>ce.current?.focus({preventScroll:!0}),onSelect:te=>{P(),Ie(void 0),J(!1),je({loader:e,key:te})}},`executions-${Y.scope}`),a.jsxs("div",{className:No.tableWrap,children:[a.jsx("span",{className:No.srOnly,role:"status","data-testid":"trajectory-window-changed",children:re.selectionLost&&!Ne?n("trajectory.window.changed"):""}),nn.length===0?a.jsxs(a.Fragment,{children:[d&&ks,f==="error"&&p&&!d?a.jsxs("div",{className:No.placeholder,role:"alert",children:[a.jsx("span",{children:zbe(p,n)})," ",lfe(p)&&a.jsx("button",{type:"button",className:No.headerButton,onClick:w,children:n("common.retry")})]}):me?a.jsxs("div",{className:No.placeholder,"data-testid":"trajectory-filter-empty",children:[a.jsx("span",{children:n("trajectory.filter.empty")})," ",a.jsx("button",{type:"button",className:No.headerButton,onClick:se,children:n("trajectory.filter.clear")})]}):_t!==void 0?a.jsxs("div",{className:No.placeholder,"data-testid":"trajectory-range-empty",children:[a.jsx("span",{children:n("trajectory.range.empty")})," ",a.jsx("button",{type:"button",className:No.headerButton,onClick:()=>Dt(void 0),children:n("trajectory.range.clear")})]}):a.jsx("div",{className:No.placeholder,role:"status",children:Yn?n("trajectory.empty"):m>0?n("trajectory.loadingPages",{pages:m}):n("common.loading")}),d&>&&Zr]}):a.jsx("div",{ref:ce,className:No.scroll,role:"grid",tabIndex:0,"aria-label":n("trajectory.title"),"aria-rowcount":nn.length,"aria-activedescendant":jt.getVirtualItems().some(te=>te.index===Qe)?Me(Qe):void 0,onKeyDown:Ss,onWheel:P,onPointerDown:P,onScroll:te=>{fe.current=te.currentTarget.scrollTop,Rn()},"data-testid":"trajectory-rows",children:a.jsxs("div",{className:No.virtualBody,style:{height:`${jt.getTotalSize()}px`},children:[a.jsx("div",{className:No.virtualBoundary,children:ks}),jt.getVirtualItems().map(te=>{const an=nn[te.index];return a.jsx("div",{id:Me(te.index),className:No.virtualRow,style:{height:`${hx}px`,transform:`translateY(${te.start}px)`},role:"row","aria-rowindex":te.index+1,children:an.kind==="turn"?a.jsx(nSs,{turn:an.turn,prompt:an.turn.userRowKey?d?.rows[d.rowIndexByKey.get(an.turn.userRowKey)??-1]:void 0,collapsed:xs.has(an.key),hiddenCount:Bt.get(an.key)??0,onToggle:()=>wn(an.key),selected:an.key===Jt,onSelect:()=>Oe(an.key)}):a.jsx(sSs,{row:an.row,grouped:(we?.ancestors.get(an.key)?.length??0)>1,unresolvedParent:we?.unresolvedParents.has(an.key)??!1,fold:we?.groups.has(an.key)&&(Bt.get(an.key)??0)>0?{collapsed:xs.has(an.key),hiddenCount:Bt.get(an.key)??0,onToggle:()=>wn(an.key)}:void 0,span:it.get(an.key),total:pt?.total??0,viewport:lt.viewport,range:_t,context:!!Mt&&!Mt.has(an.key),selected:an.key===Jt,onSelect:()=>Oe(an.key)})},te.key)}),gt&&a.jsx("div",{className:No.virtualBoundary,style:{transform:`translateY(${jt.getTotalSize()-hx}px)`},children:Zr})]})}),Ls==="paused"&&(U||fs)&&a.jsxs("button",{type:"button",className:No.jumpLatest,"aria-disabled":!I,onClick:()=>{I&&H()},"data-testid":"trajectory-jump-latest",children:[a.jsx(kge,{size:13,"aria-hidden":"true"}),n("trajectory.jumpLatest"),fs&&a.jsx("span",{className:No.updatedDot,role:"img","aria-label":n("trajectory.jumpLatest.updated")})]})]})]}),mt==="drill-in"&&eo]}),mt==="side"&&Lt&&a.jsxs(a.Fragment,{children:[a.jsx(edt,{className:No.splitHandle,"aria-label":n("trajectory.detail.resize")}),a.jsx(ffe,{id:"trajectory-detail-panel",className:No.detailPanel,defaultSize:"40%",minSize:320,maxSize:"60%",children:eo})]})]})]})}function nSs({turn:e,prompt:t,collapsed:n,hiddenCount:s,onToggle:r,selected:o,onSelect:i}){const{t:l}=et();return a.jsxs("div",{className:`${No.turnHeader} ${o?No.selected:""}`,onClick:i,"aria-selected":o,"data-selected":o?"true":void 0,role:"gridcell","data-testid":"trajectory-turn",children:[a.jsx(tdt,{collapsed:n,name:l("trajectory.turn",{index:e.index}),onToggle:r}),a.jsx("span",{className:No.turnTitle,children:e.partial?l("trajectory.turnPartial",{index:e.index}):l("trajectory.turn",{index:e.index})}),t?.kind==="user"&&a.jsx("span",{className:No.turnPrompt,title:vE(t.block.text),children:vE(t.block.text).slice(0,160)}),n&&s>0&&a.jsx("span",{className:No.foldCount,children:l("trajectory.collapsed",{count:s})}),a.jsx("span",{className:No.turnSummary,children:l("trajectory.turnSummary",{requests:e.requestCount,tools:e.toolCount,duration:e.requestCount>0?ta(e.requestMs):"—"})})]})}function sSs({row:e,grouped:t,unresolvedParent:n,fold:s,span:r,total:o,viewport:i,range:l,context:c,selected:d,onSelect:h}){const{t:f}=et(),p=pfe(e,f),m=Q_s(e,f);return a.jsxs("div",{className:`${No.record} ${d?No.selected:""}`,role:"gridcell","aria-selected":d,"data-selected":d?"true":void 0,onClick:h,"data-testid":`trajectory-row-${e.kind}`,"data-depth":e.depth,"data-grouped":t||void 0,"data-context":c||void 0,"data-row-key":e.key,children:[s?a.jsx(tdt,{collapsed:s.collapsed,name:p.text,onToggle:s.onToggle}):a.jsx("span",{className:No.foldSpacer}),e.depth>0&&a.jsx(B3t,{size:12,strokeWidth:1.6,className:No.nestMarker,"aria-hidden":"true"}),a.jsx("span",{className:`${No.badge} ${p.badgeTone??""}`,children:p.badge}),a.jsx("span",{className:`${No.text} ${p.faint?No.faint:""}`,children:p.text}),n&&a.jsx("span",{className:No.parentNotice,title:f("trajectory.parentUnresolved"),children:f("trajectory.parentUnresolved")}),c&&a.jsx("span",{className:No.foldCount,children:f("trajectory.contextRow")}),s?.collapsed&&a.jsx("span",{className:No.foldCount,children:f("trajectory.collapsed",{count:s.hiddenCount})}),a.jsx("span",{className:No.waterfallSlot,children:a.jsx(w_s,{span:r,total:o,viewport:i,range:l,title:m.join(" · ")})}),a.jsx("span",{className:No.rowMetrics,"data-testid":"trajectory-row-metrics",title:m.length>0?m.join(" · "):void 0,children:m.length>0?m.join(" · "):"—"})]})}function tdt({collapsed:e,name:t,onToggle:n}){const{t:s}=et();return a.jsx("button",{type:"button",tabIndex:-1,className:No.foldButton,"aria-expanded":!e,"aria-label":s(e?"trajectory.expand":"trajectory.collapse",{name:t}),onClick:r=>{r.stopPropagation(),n()},children:e?a.jsx(Ol,{size:13,"aria-hidden":"true"}):a.jsx(sd,{size:13,"aria-hidden":"true"})})}const rSs="_panel_pwtdr_1",oSs="_toolbar_pwtdr_5",iSs="_actions_pwtdr_15",aSs="_feedback_pwtdr_21",lSs="_state_pwtdr_31",S1={panel:rSs,toolbar:oSs,actions:iSs,feedback:aSs,state:lSs};function cSs({sessionActions:e,sessionId:t,controls:n,onOpenMemoryFile:s}){const{t:r}=et(),[o,i]=u.useState(null),[l,c]=u.useState(!0),[d,h]=u.useState(!1),f=u.useRef(0),p=u.useRef(()=>{}),m=u.useRef(null),g=n?.sessionId===t?n:void 0,v=g?.getContextUsage??e?.getContextUsage,b=u.useRef(g);b.current=g;const y=g?.result,[w,x]=u.useState(y),k=!!(y&&y!==w&&(y.kind!=="completed"||!d));u.useEffect(()=>{y?.kind==="completed"&&(f.current++,i(y.usage),h(!1))},[y]),u.useEffect(()=>{let E=!0,j=!1;const I=b.current?.result;i(T=>T?.sessionId===t?T:I?.kind==="completed"?I.usage:null),h(!1),c(!!v);const R=async()=>{if(!E||j||!v)return;j=!0,c(!0),h(!1);const T=f.current,N=m.current,A=N&&N.getContextUsage===v&&N.sessionId===t?N:{getContextUsage:v,sessionId:t,promise:v({detail:!0,silent:!0,...b.current?.result?{syncCounters:!0}:{}})};m.current=A;try{const M=await A.promise;if(!E||T!==f.current)return;i(M.sessionId===t&&M.usage.contextWindowSize>0?M:null)}catch(M){if(!E||T!==f.current)return;h(LH(M)?"transient":"hard")}finally{j=!1,m.current===A&&(m.current=null),E&&c(!1)}};return p.current=()=>void R(),R(),()=>{E=!1}},[v,t]);const _=!v||l||g?.compressing,S=()=>{x(y),p.current()};return a.jsxs("div",{className:S1.panel,"aria-busy":l,children:[a.jsxs("div",{className:S1.toolbar,children:[a.jsx("span",{children:r("contextUsage.title")}),a.jsxs("div",{className:S1.actions,children:[a.jsx(Ae,{type:"button",variant:"ghost",size:"icon-sm","aria-label":r("contextUsage.refresh"),title:r("contextUsage.refresh"),disabled:_,onClick:S,children:a.jsx(ih,{"aria-hidden":"true"})}),a.jsx("span",{title:g?.compressing?void 0:g?.canCompress?l?r("common.loading"):void 0:r("contextUsage.compressUnavailable"),children:a.jsx(Ae,{type:"button",variant:"outline",size:"sm",disabled:!g?.canCompress||l,onClick:()=>void g?.compress(),children:r(g?.compressing?"contextUsage.compressing":"contextUsage.compress")})})]})]}),(g?.compressing||k)&&a.jsx(Yst,{controls:g,className:S1.feedback}),d==="transient"&&o&&a.jsx("div",{className:S1.feedback,role:"status",children:r("contextUsage.previousReading")}),d==="hard"?a.jsxs("div",{className:S1.state,role:"alert",children:[a.jsx("span",{children:r("contextUsage.loadError")}),a.jsx(Ae,{type:"button",variant:"outline",size:"sm",disabled:_,onClick:S,children:r("contextUsage.retry")})]}):v?l&&!o?a.jsx("div",{className:S1.state,role:"status",children:r("common.loading")}):o?a.jsx(nJe,{status:o,compact:!0,onOpenMemoryFile:s?E=>s(E,o.workspaceRoot??o.workspaceCwd):void 0}):a.jsx("div",{className:S1.state,children:r("contextUsage.unavailable")}):a.jsx("div",{className:S1.state,children:r("contextUsage.unavailable")})]})}class ndt extends Error{}function sdt(e){throw new ndt(e instanceof Error?e.message:String(e))}const dSs=()=>bt(()=>import("./WorkspaceFileBrowser-DIWHfhtl.js"),__vite__mapDeps([95,96])).then(e=>({default:e.WorkspaceFileBrowser})).catch(sdt),uSs=()=>bt(()=>import("./PierreFilePreview-DtTOu9VE.js"),[]).catch(sdt),hSs=u.lazy(()=>bt(()=>import("./SpreadsheetPreview-C21imJIX.js"),[])),fSs=700,pSs=["daily","weekdays","weekly","hourly","minutes","custom"],mSs=[1,2,3,4,5,6,10,12,15,20,30],gSs=(e,t)=>{},vSs=(e,t,n)=>{},ySs=()=>Promise.reject(new Error("Side-task session creation is unavailable"));function oDe(e){return e.kind==="review"||e.kind==="file"||e.kind==="artifact"||e.kind==="scheduled_task"}function C1(e){return e.kind==="pending"?e.targetKind:e.kind}function wSs(e){return`image.${(e.match(/^data:image\/([a-z0-9+.+-]+)/i)?.[1]??"png").split("+")[0].toLowerCase()}`}const bSs=["review","sideTask"];function xSs({tab:e,workspaceCwd:t,onOpenFilePreview:n,onReferenceFile:s,onClose:r}){const{t:o,language:i}=et(),l=KO(),c=u.useMemo(()=>u.lazy(dSs),[]),d=u.useMemo(()=>u.lazy(uSs),[]),h=cA(e.workspaceCwd),f=h?.workspaceId===e.workspaceId?h?.actions:void 0;if(!f)return a.jsx("div",{className:It.empty,role:"alert",children:o("workspace.notFoundDescription")});const p=(m,g)=>{const v=m instanceof ndt,b=()=>!!(l&&(!l.activeToken||ape()));return v&&!b()?a.jsxs("div",{role:"alert",className:It.empty,children:[a.jsx("p",{children:o("files.loadFailed")}),a.jsx("p",{children:o("files.reloadUnavailable")}),a.jsx(Ae,{onClick:r,children:o("files.close")})]}):a.jsx(ZX,{error:m,language:i,retryMode:v?"reload":"reset",onRetry:v?()=>{b()?window.location.reload():r()}:g})};return a.jsx(Rm,{label:"workspace file browser",fallback:p,children:a.jsx(u.Suspense,{fallback:a.jsx("div",{className:`${It.empty} text-center`,role:"status",children:o("common.loading")}),children:a.jsx(c,{workspaceCwd:e.workspaceCwd,actions:f,onOpenPreview:m=>n(m,e.workspaceCwd,e.workspaceId),onReferenceFile:e.workspaceCwd===t?s:void 0,renderPreview:(m,g,v)=>a.jsx(c7,{workspacePath:m,workspaceActions:f,previewKind:g?"source":void 0,sourceRenderer:b=>a.jsx(Rm,{label:"workspace file source",resetKeys:[m],fallback:p,children:a.jsx(u.Suspense,{fallback:a.jsx("div",{className:It.empty,children:o("common.loading")}),children:a.jsx(d,{path:m,content:b})})})},`${m}:${g}:${v}`)},`${e.workspaceCwd}:${e.workspaceId??""}`)})})}function iDe({contextUsageControls:e,artifacts:t,tabs:n,activeTabId:s,reviewChanges:r,selectedReviewPath:o,panelWidth:i,workspaceCwd:l,loading:c,restoring:d=!1,error:h,onSelectTab:f,onSelectTurnCallsPrompt:p,onCloseTab:m,onOpenFilePreview:g,onOpenMemoryFile:v,latestReviewAvailable:b=!1,onOpenLatestReview:y,onOpenTerminal:w,onOpenTrajectory:x,trajectoryTabId:k,onOpenFiles:_,onReferenceFile:S,onOpenWebPreview:E,onWebPreviewChange:j,items:I=bSs,sideTaskAvailable:R=!1,sideTasks:T=[],archivedSideTasks:N=[],sideTasksLoading:A=!1,onCreateSideTask:M,onOpenSideTask:P,onArchiveSideTasks:D,onUnarchiveSideTasks:z,onSideTaskMenuOpen:B,onCreateSideTaskSession:$,onSideTaskCreated:L,onSideTaskTitleChange:O,onSideTaskInitialPromptRefused:W,onNestedRightPanelOpen:H,onNestedArtifactsChange:Q,onOpenNestedSubagent:V,agentTasks:re=[],agentTraceLoading:Z=!1,agentTraceError:ue,onOpenWorkflowAgent:de,onError:U,sessionWorkflowEnabled:G,modelManagement:Y,unavailableModels:X,mountUnavailableModelTooltip:pe,workflow:ae,onImageIngestionNotice:se,deferSubagentMount:me=!1,onClose:ye,variant:ve="docked",fullscreen:Te=!1,onToggleFullscreen:Ne}){const{t:Ie}=et(),Fe=Co(),ge=z1(Fe.capabilities,l),[_e,Ce]=u.useState(!1),[je,Ue]=u.useState(),q=u.useRef(null),J=u.useCallback(()=>{q.current&&(clearTimeout(q.current),q.current=null),Ce(!0)},[]),ce=u.useCallback(()=>{q.current&&clearTimeout(q.current),q.current=setTimeout(()=>{Ce(!1),q.current=null},120)},[]);u.useEffect(()=>{_e&&B?.()},[B,_e]),u.useEffect(()=>()=>{q.current&&clearTimeout(q.current)},[]);const ee=n.find(we=>we.id===s)??n[0],fe=ee?.kind==="file"&&ee.sourcePreview&&(/\.html?$/i.test(ee.workspacePath)||mw(ee.previewMimeType||ee.previewData?.type)==="text/html"),Re=ee?.kind==="file"&&ee.previewOnly===!0&&!fe&&/\.(?:html?|md|markdown)$/i.test(ee.workspacePath)&&(ee.previewContent!==void 0||!ee.previewData||!!EM(ee.previewMimeType||ee.previewData.type,ee.workspacePath)),Me=je===ee?.id,be=I.includes("review")&&!n.some(we=>C1(we)==="review"),Be=I.includes("sideTask")&&R&&!!M,Ge=T.some(we=>we.archivable===!0),Ve=!!w,pt=I.includes("webPreview")&&!!E,lt=I.includes("trajectory")&&!!x&&!n.some(we=>we.id===k),it=I.includes("files")&&!!_&&!n.some(we=>we.kind==="files"&&we.workspaceCwd===l&&we.workspaceId===ge?.id),Tt=!!ee&&(it||be||Be||Ve||pt||lt),Ke=ee&&oDe(ee)?{workspaceCwd:ee.workspaceCwd,workspaceId:ee.workspaceId}:void 0,_t=cA(Ke?.workspaceCwd),Dt=_t?.workspaceId===Ke?.workspaceId?_t?.actions:void 0,Rt=ee?.kind==="artifact"?t.find(we=>we.id===ee.artifactId):void 0;return a.jsxs("aside",{className:`${It.panel} ${ve==="drawer"?It.panelDrawer:""} ${Te?It.panelFullscreen:""}`,style:ve==="docked"&&i&&!Te?{flexBasis:i,width:i}:void 0,"aria-label":"Right panel",children:[a.jsxs("div",{className:It.header,children:[n.length>0&&a.jsx("div",{className:It.tabs,role:"tablist","aria-label":"Right panel",children:n.map(we=>a.jsxs("div",{className:[It.tabItem,we.id===ee?.id?It.tabActive:""].filter(Boolean).join(" "),children:[a.jsxs("button",{type:"button",role:"tab","aria-selected":we.id===ee?.id,className:It.tab,onClick:()=>f(we.id),onMouseEnter:ht=>C_(ht.currentTarget),onFocus:ht=>C_(ht.currentTarget),title:we.kind==="turn_calls"?Ie("turnCalls.title"):we.title,children:[a.jsx("span",{className:`${It.tabIcon} ${C1(we)==="artifact"?It.tabArtifactIcon:""}`,"aria-hidden":"true",children:C1(we)==="review"?a.jsx(_oe,{}):we.kind==="files"?a.jsx(x8,{className:It.tabIconSvg}):we.kind==="workflow"?a.jsx(oVe,{className:It.tabIconSvg,strokeWidth:1.6}):we.kind==="file"?a.jsx(ub,{name:we.workspacePath,className:It.tabIconSvg,strokeWidth:1.6}):C1(we)==="artifact"?a.jsx(CXe,{artifact:t.find(ht=>"artifactId"in we&&ht.id===we.artifactId),className:It.tabIconSvg}):C1(we)==="subagent"?a.jsx(kSs,{}):C1(we)==="monitor"?a.jsx(dVe,{className:It.tabIconSvg,strokeWidth:1.6}):C1(we)==="shell"?a.jsx(PN,{className:It.tabIconSvg,strokeWidth:1.6}):C1(we)==="side_task"?a.jsx(F$,{className:It.tabIconSvg,strokeWidth:1.6}):we.kind==="web_preview"?a.jsx(f4,{className:It.tabIconSvg}):we.kind==="terminal"?a.jsx(PN,{className:It.tabIconSvg,strokeWidth:1.6}):C1(we)==="image"?a.jsx(Zqe,{className:It.tabIconSvg,strokeWidth:1.6}):we.kind==="context_usage"?a.jsx(yY,{className:It.tabIconSvg,strokeWidth:1.6}):we.kind==="token_usage"?a.jsx(gY,{className:It.tabIconSvg,strokeWidth:1.6}):we.kind==="turn_calls"?a.jsx(XD,{className:It.tabIconSvg,strokeWidth:1.6}):we.kind==="trajectory"?a.jsx(gte,{className:It.tabIconSvg,strokeWidth:1.6}):a.jsx(SSs,{})}),a.jsx("span",{className:It.tabTitle,"data-web-shell-session-title":!0,children:a.jsx("span",{className:It.tabTitleInner,children:we.kind==="turn_calls"?Ie("turnCalls.title"):we.title})})]}),a.jsx("button",{type:"button",className:It.tabCloseButton,onClick:()=>m(we.id),"aria-label":`Close ${we.kind==="turn_calls"?Ie("turnCalls.title"):we.title}`,title:"Close",children:a.jsx(_Ss,{})})]},we.id))}),a.jsxs("div",{className:It.headerActions,children:[Tt&&a.jsxs(tf,{modal:!1,children:[a.jsx(Eh,{asChild:!0,children:a.jsx("button",{type:"button",className:`${It.iconButton} ${It.addButton}`,"aria-label":Ie("rightPanel.add"),title:Ie("rightPanel.add"),children:a.jsx(Ef,{className:It.toolbarIcon})})}),a.jsxs(Ah,{align:"end",className:"w-64",children:[it&&a.jsxs(jr,{onSelect:_,children:[a.jsx(x8,{}),a.jsx("span",{className:It.sideTaskListTitle,children:Ie("files.title")})]}),be&&a.jsxs(jr,{disabled:!b||!y,onSelect:y,children:[a.jsx(_oe,{}),a.jsx("span",{className:It.sideTaskListTitle,children:Ie("turnOutputs.review")})]}),be&&Be&&a.jsx(ug,{}),Be&&a.jsxs(jr,{disabled:A,onSelect:M,children:[a.jsx(F$,{className:It.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:It.sideTaskListTitle,children:Ie("sideTask.create")})]}),Ve&&(be||Be)&&a.jsx(ug,{}),Ve&&a.jsxs(jr,{onSelect:()=>w?.(),children:[a.jsx(PN,{className:It.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:It.sideTaskListTitle,children:Ie("terminal.title")})]}),pt&&a.jsxs(jr,{onSelect:E,children:[a.jsx(f4,{className:It.sideTaskNewIcon}),a.jsx("span",{className:It.sideTaskListTitle,children:Ie("webPreview.title")})]}),lt&&a.jsxs(jr,{onSelect:()=>x?.(),children:[a.jsx(gte,{className:It.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:It.sideTaskListTitle,children:Ie("trajectory.title")})]})]})]}),Ne&&a.jsx("button",{type:"button",className:`${It.iconButton} ${It.fullscreenButton} ${Te?It.iconButtonActive:""}`,onClick:Ne,"aria-label":Ie(Te?"common.exitFullscreen":"common.fullscreen"),"aria-pressed":Te,title:Ie(Te?"common.exitFullscreen":"common.fullscreen"),children:Te?a.jsx(bY,{className:It.toolbarIcon,"aria-hidden":!0}):a.jsx(mY,{className:It.toolbarIcon,"aria-hidden":!0})}),a.jsx("button",{type:"button",className:`${It.iconButton} ${It.panelToggleButton}`,onClick:ye,"aria-label":Ie("chatHeader.toggleRightPanel"),"aria-pressed":"true",title:Ie("chatHeader.toggleRightPanel"),children:a.jsx(iVe,{className:It.panelToggleIcon})})]})]}),(Te||ve==="drawer")&&a.jsx(bit,{}),a.jsxs("div",{className:`${It.body} ${ee?.kind==="side_task"||ee?.kind==="files"?It.bodySideTask:""}`.trim(),children:[n.filter(we=>we.kind==="web_preview").map(we=>a.jsx("div",{className:"h-full",hidden:we.id!==ee?.id,children:a.jsx(wws,{state:we,onChange:ht=>j?.(we.id,ht)})},we.id)),n.filter(we=>we.kind==="files").map(we=>a.jsx("div",{className:"h-full",hidden:we.id!==ee?.id,children:a.jsx(xSs,{onClose:()=>m(we.id),tab:we,workspaceCwd:l,onOpenFilePreview:g,onReferenceFile:S})},we.id)),n.filter(we=>we.kind==="terminal").map(we=>a.jsx("div",{className:`${It.terminalPane} ${we.id===ee?.id?"":It.terminalPaneHidden}`.trim(),"aria-hidden":we.id===ee?.id?void 0:!0,children:a.jsx(yws,{terminalId:we.id,cwd:we.workspaceCwd??l,active:we.id===ee?.id,enabled:we.initialized!==!1})},we.id)),Re&&a.jsxs("button",{type:"button",className:It.attachmentPreviewButton,onClick:()=>Ue(Me?void 0:ee?.id),"aria-label":Ie(Me?"attachment.showSource":"attachment.showPreview"),"aria-pressed":Me,children:[Me?a.jsx(N3t,{"aria-hidden":!0}):a.jsx(sq,{"aria-hidden":!0}),Ie(Me?"attachment.showSource":"attachment.showPreview")]}),d&&!ee?a.jsxs("div",{className:"flex flex-col gap-4 p-5","data-testid":"right-panel-loading-skeleton",role:"status","aria-label":Ie("common.loading"),children:[a.jsx(Vx,{className:"h-5 w-2/5"}),a.jsx(Vx,{className:"h-32 w-full"}),a.jsx(Vx,{className:"h-4 w-4/5"}),a.jsx(Vx,{className:"h-4 w-3/5"})]}):ee?.kind==="terminal"||ee?.kind==="web_preview"||ee?.kind==="files"?null:ee?ee.kind==="pending"?a.jsx("div",{className:It.empty,role:ee.loadError?"alert":"status",children:ee.loadError??Ie("common.loading")}):ee.kind==="workflow"?ee.sessionId?a.jsx(ygs,{tasks:re,loading:Z,error:ue,onOpenAgent:de}):ae?a.jsx(t0s,{...ae}):a.jsx("div",{className:It.empty,children:Ie("workflow.empty.title")}):oDe(ee)&&(ee.kind!=="scheduled_task"||ee.task.durable)&&(ee.kind!=="file"||!ee.previewOnly)&&(ee.kind!=="review"||!(ee.changes??r).some(we=>we.diffs.length>0))&&(ee.kind!=="artifact"||Rt?.metadata?.artifactType!=="web_preview_snapshot")&&!Dt?a.jsx("div",{className:It.empty,role:"alert",children:Ie("workspace.notFoundDescription")}):ee.kind==="review"?a.jsx(ISs,{changes:ee.changes??r,selectedPath:ee.selectedPath??o,workspaceCwd:ee.workspaceCwd??l,onOpenFilePreview:Dt?we=>g(we,ee.workspaceCwd??l,ee.workspaceId):void 0,onDownloadFile:Dt?(we,ht)=>x9(Dt,we.path,JJt(we.path),ht):void 0,onDownloadError:we=>{const ht=Ie("common.downloadFailed",{message:ja(we)});U?U(new Error(ht,{cause:we}),ht):console.error(ht,we)}}):ee.kind==="file"?ee.attachmentId&&!ee.previewData&&ee.previewContent===void 0?a.jsx("div",{className:It.empty,role:ee.loadError?"alert":"status",children:ee.loadError??Ie("common.loading")}):ee.sourcePreview&&ee.previewData&&!w9(ee.workspacePath,ee.previewMimeType||ee.previewData.type)&&!y9(ee.workspacePath,ee.previewMimeType||ee.previewData.type)&&!V2({workspacePath:ee.workspacePath,mimeType:ee.previewMimeType||ee.previewData.type})&&!EM(ee.previewMimeType||ee.previewData.type,ee.workspacePath)?a.jsx(Jbe,{data:ee.previewData,title:ee.title,image:!!G2(ee.workspacePath)&&ee.previewData.type.startsWith("image/")}):a.jsx(c7,{workspacePath:ee.workspacePath,artifactVersion:String(ee.previewVersion??0),workspaceActions:Dt,previewContent:ee.previewContent,previewData:ee.previewData,previewMimeType:ee.previewMimeType,previewOnly:ee.previewOnly,previewKind:fe||ee.previewOnly&&!Me?"source":void 0},ee.id):ee.kind==="source"?a.jsx(WSs,{tab:ee},ee.id):ee.kind==="artifact"?a.jsx(CSs,{artifacts:t,artifactId:ee.artifactId,sourceSessionId:ee.sourceSessionId,workspaceActions:Dt,previewContent:ee.previewContent,loading:c,error:h},ee.id):ee.kind==="subagent"?me?null:a.jsx(egs,{sessionId:ee.sessionId,rootToolCallId:ee.rootToolCallId,initialRootTool:ee.rootTool,workspaceCwd:ee.workspaceCwd??l,onRightPanelOpen:H,onArtifactsChange:Q,onOpenSubagent:V,onError:U}):ee.kind==="monitor"?a.jsx(Pln,{task:ee.task,actions:ee.sessionActions},ee.id):ee.kind==="shell"?a.jsx(Dln,{task:ee.task,actions:ee.sessionActions},ee.id):ee.kind==="side_task"?a.jsx(bgs,{tabId:ee.id,sessionId:ee.sessionId,parentSessionId:ee.parentSessionId,workspaceCwd:ee.workspaceCwd??l,title:ee.title,shouldNameFromFirstPrompt:ee.nameFromFirstPrompt,initialPrompt:ee.initialPrompt,createSession:$??ySs,onCreated:L??gSs,onTitleChange:O??vSs,onInitialPromptRefused:W,onRightPanelOpen:H,onArtifactsChange:Q,onError:U,sessionWorkflowEnabled:G,modelManagement:Y,unavailableModels:X,mountUnavailableModelTooltip:pe,onImageIngestionNotice:se},ee.id):ee.kind==="image"?ee.src?a.jsxs("div",{className:It.imagePreviewWrap,children:[a.jsx("img",{src:ee.src,alt:ee.alt??ee.title,className:It.imagePreview}),a.jsx("a",{className:It.imageDownloadButton,href:ee.src,download:wSs(ee.src),"aria-label":Ie("common.download"),title:Ie("common.download"),children:a.jsx(Zy,{size:16,strokeWidth:1.8})})]}):a.jsx("div",{className:It.empty,role:ee.loadError?"alert":"status",children:ee.loadError??Ie("common.loading")}):ee.kind==="context_usage"?a.jsx(cSs,{controls:e?.[ee.sessionId],sessionActions:ee.sessionActions,sessionId:ee.sessionId,onOpenMemoryFile:v},ee.id):ee.kind==="trajectory"?a.jsx(tSs,{loadPage:ee.loadPage,historyGapRevision:ee.historyGapRevision},ee.id):ee.kind==="token_usage"?a.jsx(Ibs,{sessionActions:ee.sessionActions,sessionId:ee.sessionId},ee.id):ee.kind==="turn_calls"?a.jsx(Bus,{turnId:ee.turnId,ownerSessionId:ee.sessionId,recordId:ee.recordId,promptId:ee.promptId,promptLabel:ee.promptLabel,onSelectPrompt:p,workspaceCwd:l,onOpenFile:H,onOpenAgent:V},`${ee.sessionId}:${l}`):a.jsx(TSs,{task:ee.task,actions:Dt},ee.id):a.jsxs("div",{className:It.emptyActions,"data-testid":"right-panel-empty-actions",children:[I.includes("files")&&a.jsxs("button",{type:"button",className:It.emptyAction,disabled:!_,onClick:_,children:[a.jsx("span",{className:It.emptyActionIcon,"aria-hidden":"true",children:a.jsx(x8,{})}),a.jsx("span",{className:It.emptyActionTitle,children:Ie("files.title")}),a.jsx("span",{className:It.emptyActionHint,children:Ie("files.description")}),a.jsx(Ol,{className:It.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]}),I.includes("review")&&a.jsxs("button",{type:"button",className:It.emptyAction,disabled:!b||!y,onClick:y,children:[a.jsx("span",{className:It.emptyActionIcon,"aria-hidden":"true",children:a.jsx(_oe,{})}),a.jsx("span",{className:It.emptyActionTitle,children:Ie("turnOutputs.review")}),a.jsx("span",{className:It.emptyActionHint,children:Ie("turnOutputs.reviewLatest")}),a.jsx(Ol,{className:It.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]}),I.includes("sideTask")&&R&&M&&(T.length===0&&N.length===0?a.jsxs("button",{type:"button",className:It.emptyAction,disabled:A,"aria-busy":A,onClick:M,children:[a.jsx("span",{className:It.emptyActionIcon,"aria-hidden":"true",children:a.jsx(F$,{strokeWidth:1.6})}),a.jsx("span",{className:It.emptyActionTitle,children:Ie("sideTask.title")}),a.jsx("span",{className:It.emptyActionHint,children:Ie("sideTask.description")}),a.jsx(Ol,{className:It.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]}):a.jsxs(tf,{open:_e,onOpenChange:Ce,modal:!1,children:[a.jsx(Eh,{asChild:!0,children:a.jsxs("button",{type:"button",className:It.emptyAction,"aria-expanded":_e,onMouseEnter:J,onMouseLeave:ce,children:[a.jsx("span",{className:It.emptyActionIcon,"aria-hidden":"true",children:a.jsx(F$,{strokeWidth:1.6})}),a.jsx("span",{className:It.emptyActionTitle,children:Ie("sideTask.title")}),a.jsx("span",{className:It.emptyActionHint,children:Ie("sideTask.description")}),a.jsx(Ol,{className:It.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]})}),a.jsxs(Ah,{align:"end",className:"w-80",onMouseEnter:J,onMouseLeave:ce,children:[T.map(we=>{const ht=a.jsxs(a.Fragment,{children:[a.jsx("span",{className:It.sideTaskListTitle,children:we.title}),we.updatedAt&&a.jsx("span",{className:It.sideTaskListTime,children:aT(we.updatedAt,Ie)})]});return D?a.jsxs(BC,{children:[a.jsx($C,{children:ht}),a.jsxs(FC,{onMouseEnter:J,onMouseLeave:ce,children:[a.jsxs(jr,{onSelect:()=>P?.(we),children:[a.jsx(sq,{}),Ie("common.open")]}),a.jsxs(jr,{disabled:we.archivable!==!0,title:we.archivable===!0?void 0:Ie("sideTask.archiveUnavailable"),onSelect:()=>{D([we])},children:[a.jsx(b2,{}),Ie("sidebar.archive")]})]})]},we.sessionId):a.jsx(jr,{onSelect:()=>P?.(we),children:ht},we.sessionId)}),D&&T.length>0&&a.jsx(ug,{}),D&&T.length>0&&a.jsxs(jr,{disabled:!Ge,onSelect:()=>{D(T)},children:[a.jsx(b2,{}),a.jsx("span",{className:It.sideTaskListTitle,children:Ie("sideTask.archiveCompleted")})]}),z&&N.length>0&&a.jsxs(a.Fragment,{children:[T.length>0&&a.jsx(ug,{}),a.jsxs(BC,{children:[a.jsxs($C,{children:[a.jsx(cle,{}),a.jsxs("span",{className:It.sideTaskListTitle,children:[Ie("sidebar.archivedTitle")," (",N.length,")"]})]}),a.jsx(FC,{className:"max-h-(--radix-dropdown-menu-content-available-height) overflow-x-hidden overflow-y-auto",onMouseEnter:J,onMouseLeave:ce,children:N.map(we=>a.jsxs(jr,{onSelect:()=>{z([we])},children:[a.jsx(cle,{}),a.jsx("span",{className:It.sideTaskListTitle,children:we.title}),a.jsx("span",{className:It.sideTaskListTime,children:Ie("sidebar.unarchive")})]},we.sessionId))})]})]}),T.length>0&&a.jsx(ug,{}),a.jsxs(jr,{onSelect:M,children:[a.jsx(k3t,{className:It.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:It.sideTaskListTitle,children:Ie("sideTask.new")})]})]})]})),pt&&a.jsxs("button",{type:"button",className:It.emptyAction,"data-testid":"right-panel-open-web-preview",onClick:E,children:[a.jsx("span",{className:It.emptyActionIcon,"aria-hidden":"true",children:a.jsx(f4,{strokeWidth:1.6})}),a.jsx("span",{className:It.emptyActionTitle,children:Ie("webPreview.title")}),a.jsx("span",{className:It.emptyActionHint,children:Ie("webPreview.openHint")}),a.jsx(Ol,{className:It.emptyActionChevron,"aria-hidden":"true"})]}),lt&&a.jsxs("button",{type:"button",className:It.emptyAction,onClick:()=>x?.(),"data-testid":"right-panel-open-trajectory",children:[a.jsx("span",{className:It.emptyActionIcon,"aria-hidden":"true",children:a.jsx(gte,{strokeWidth:1.6})}),a.jsx("span",{className:It.emptyActionTitle,children:Ie("trajectory.title")}),a.jsx("span",{className:It.emptyActionHint,children:Ie("trajectory.description")}),a.jsx(Ol,{className:It.emptyActionChevron,"aria-hidden":"true"})]}),w&&a.jsxs("button",{type:"button",className:It.emptyAction,onClick:()=>w(),children:[a.jsx("span",{className:It.emptyActionIcon,"aria-hidden":"true",children:a.jsx(PN,{strokeWidth:1.6})}),a.jsx("span",{className:It.emptyActionTitle,children:Ie("terminal.title")}),a.jsx("span",{className:It.emptyActionHint,children:Ie("terminal.open")}),a.jsx(Ol,{className:It.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]})]})]})]})}function kSs(){return a.jsxs("svg",{className:It.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 _Ss(){return a.jsx("svg",{className:It.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 _oe(){return a.jsxs("svg",{className:It.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 SSs(){return a.jsxs("svg",{className:It.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 CSs({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(BSs,{artifact:l,sourceSessionId:n,workspaceActions:s,previewContent:r}):o?a.jsx("div",{className:It.empty,children:"Loading artifact..."}):i?a.jsx("div",{className:It.empty,children:i}):a.jsx("div",{className:It.empty,children:"Artifact not found."})}function TSs({task:e,actions:t}){const{t:n}=et(),[s,r]=u.useState(null),[o,i]=u.useState(!0),[l,c]=u.useState(null),[d,h]=u.useState(""),[f,p]=u.useState(e.prompt),[m,g]=u.useState(()=>gC(e.cron)),[v,b]=u.useState(!1),[y,w]=u.useState(!1),[x,k]=u.useState(!1),[_,S]=u.useState(!1),[E,j]=u.useState(null),I=u.useRef(0),R=u.useRef(0),T=u.useRef({actions:t,taskId:e.id,workspaceId:e.workspaceId});T.current={actions:t,taskId:e.id,workspaceId:e.workspaceId};const N=u.useCallback((U,G,Y,X)=>{const pe=T.current;return U===I.current&&pe.actions===G&&pe.taskId===Y&&pe.workspaceId===X},[]),A=u.useCallback((U,G,Y,X)=>{const pe=T.current;return U===R.current&&pe.actions===G&&pe.taskId===Y&&pe.workspaceId===X},[]);u.useEffect(()=>()=>{I.current+=1,R.current+=1},[]),u.useEffect(()=>{k(!1),S(!1),j(null)},[t,e.id,e.workspaceId]);const M=u.useCallback(async()=>{const U=++I.current,G=++R.current,Y=e.id,X=e.workspaceId;if(!e.durable||!t){r(null),h(""),p(e.prompt),g(gC(e.cron)),c(null),i(!1);return}i(!0),c(null);try{const pe=await t.listScheduledTasks(X);if(!N(U,t,Y,X))return;const ae=pe.find(se=>se.id===e.id)??null;r(ae),ae?(h(ae.name??""),p(ae.prompt),g(gC(ae.cron))):(h(""),p(e.prompt),g(gC(e.cron)))}catch(pe){A(G,t,Y,X)&&c(pe instanceof Error?pe.message:String(pe))}finally{A(G,t,Y,X)&&i(!1)}},[t,A,N,e.cron,e.durable,e.id,e.prompt,e.workspaceId]);u.useEffect(()=>{M()},[M]);const P=!e.durable,D=e.durable&&!o&&!l&&!s,z=!!s,B=s?.name||s?.prompt||e.title,$=s?.prompt??e.prompt,L=s?.cron??e.cron,O=s?.recurring??e.recurring,W=s?.enabled,H=u.useCallback(()=>{s&&(h(s.name??""),p(s.prompt),g(gC(s.cron)),j(null),b(!0))},[s]),Q=u.useCallback(()=>{b(!1),j(null),s&&(h(s.name??""),p(s.prompt),g(gC(s.cron)))},[s]),V=u.useCallback(async()=>{if(!s||!t)return;const U=Oq(m);if(!U){j(n("scheduledTasks.error.invalidSchedule"));return}if(f.trim().length===0){j(n("scheduledTasks.error.emptyPrompt"));return}const G=++I.current,Y=e.id,X=e.workspaceId;S(!0),j(null);try{const pe=await t.updateScheduledTask(s.id,{cron:U,prompt:f.trim(),name:d.trim()||null},X);if(!N(G,t,Y,X))return;r(pe),h(pe.name??""),p(pe.prompt),g(gC(pe.cron)),b(!1)}catch(pe){N(G,t,Y,X)&&j(pe instanceof Error?pe.message:String(pe))}finally{N(G,t,Y,X)&&S(!1)}},[t,m,N,s,d,f,n,e.id,e.workspaceId]),re=u.useCallback(async()=>{if(!s||!t)return;const U=++I.current,G=e.id,Y=e.workspaceId;k(!0),j(null);try{const X=await t.updateScheduledTask(s.id,{enabled:!s.enabled},Y);if(!N(U,t,G,Y))return;r(X)}catch(X){N(U,t,G,Y)&&j(X instanceof Error?X.message:String(X))}finally{N(U,t,G,Y)&&k(!1)}},[t,N,s,e.id,e.workspaceId]),Z=u.useCallback(async()=>{if(!s||!t)return;const U=++I.current,G=e.id,Y=e.workspaceId;k(!0),j(null);try{if(await t.deleteScheduledTask(s.id,Y),!N(U,t,G,Y))return;r(null),w(!1)}catch(X){N(U,t,G,Y)&&j(X instanceof Error?X.message:String(X))}finally{N(U,t,G,Y)&&k(!1)}},[t,N,s,e.id,e.workspaceId]),ue=Oq(m),de=ue?dM(ue,n):null;return a.jsxs("div",{className:It.detail,children:[o&&a.jsx("div",{className:It.empty,children:n("scheduledTasks.loading")}),l&&a.jsx("div",{className:yn.loadError,children:l}),D&&a.jsx("div",{className:It.empty,children:n("scheduledTasks.deletedSnapshot")}),P&&a.jsx("div",{className:It.empty,children:n("scheduledTasks.sessionScopedSnapshot")}),!D&&a.jsx("div",{className:It.section,children:a.jsxs("div",{className:It.fieldGrid,children:[a.jsx("span",{className:It.fieldLabel,children:n("scheduledTasks.name")}),a.jsx("span",{className:It.fieldValue,children:B}),a.jsx("span",{className:It.fieldLabel,children:n("scheduledTasks.taskId")}),a.jsx("span",{className:It.fieldValue,children:e.id}),a.jsx("span",{className:It.fieldLabel,children:n("scheduledTasks.schedule")}),a.jsx("span",{className:It.fieldValue,children:dM(L,n)}),a.jsx("span",{className:It.fieldLabel,children:"Cron"}),a.jsx("span",{className:It.fieldValue,children:L}),a.jsx("span",{className:It.fieldLabel,children:n("scheduledTasks.type")}),a.jsx("span",{className:It.fieldValue,children:n(O?"scheduledTasks.repeats":"scheduledTasks.runsOnce")}),W!==void 0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:It.fieldLabel,children:n("scheduledTasks.status")}),a.jsx("span",{className:It.fieldValue,children:n(W?"scheduledTasks.enable":"scheduledTasks.disable")})]})]})}),!D&&a.jsxs("div",{className:It.section,children:[a.jsx("div",{className:It.sectionTitle,children:"Prompt"}),a.jsx("div",{className:It.description,children:$})]}),E&&a.jsx("div",{className:yn.formError,children:E}),a.jsxs("div",{className:It.actionsRow,children:[a.jsx("button",{type:"button",className:yn.primaryButton,disabled:!z||x,onClick:H,children:n("scheduledTasks.edit")}),a.jsx("button",{type:"button",className:yn.secondaryButton,disabled:!z||x,onClick:()=>void re(),children:s?.enabled?n("scheduledTasks.disable"):n("scheduledTasks.enable")}),a.jsx("button",{type:"button",className:yn.secondaryButton,disabled:!z||x,onClick:()=>w(!0),children:n("scheduledTasks.delete")})]}),y&&s&&a.jsx(Ja,{title:n("scheduledTasks.deleteConfirmTitle"),size:"sm",onClose:()=>w(!1),children:a.jsxs("div",{className:yn.formFields,children:[a.jsx("div",{className:It.description,children:n("scheduledTasks.deleteConfirm",{name:s.name||s.prompt})}),E&&a.jsx("div",{className:yn.formError,children:E}),a.jsxs("div",{className:yn.formActions,children:[a.jsx("button",{type:"button",className:yn.secondaryButton,onClick:()=>w(!1),disabled:x,children:n("scheduledTasks.cancel")}),a.jsx("button",{type:"button",className:yn.primaryButton,onClick:()=>void Z(),disabled:x,children:n("scheduledTasks.delete")})]})]})}),v&&a.jsx(Ja,{title:n("scheduledTasks.editTitle"),size:"md",onClose:Q,children:a.jsxs("div",{className:yn.formFields,children:[a.jsxs("label",{className:yn.field,children:[a.jsx("span",{className:yn.fieldLabel,children:n("scheduledTasks.name")}),a.jsx("input",{className:yn.input,type:"text",value:d,maxLength:200,placeholder:n("scheduledTasks.namePlaceholder"),onChange:U=>h(U.target.value)})]}),a.jsxs("label",{className:yn.field,children:[a.jsxs("span",{className:yn.fieldLabel,children:[n("scheduledTasks.prompt"),a.jsx("span",{className:yn.required,children:"*"})]}),a.jsx("textarea",{className:yn.textarea,value:f,rows:4,maxLength:1e5,placeholder:n("scheduledTasks.promptPlaceholder"),onChange:U=>p(U.target.value)})]}),a.jsxs("div",{className:yn.scheduleRow,children:[a.jsxs("label",{className:yn.field,children:[a.jsx("span",{className:yn.fieldLabel,children:n("scheduledTasks.frequency")}),a.jsx("select",{className:yn.select,value:m.frequency,onChange:U=>{const G=U.target.value;g(Y=>({...Y,frequency:G,...G==="hourly"?{time:"00:00"}:{}}))},children:pSs.map(U=>a.jsx("option",{value:U,children:n(`scheduledTasks.freq.${U}`)},U))})]}),(m.frequency==="daily"||m.frequency==="weekdays"||m.frequency==="weekly")&&a.jsxs("label",{className:yn.field,children:[a.jsx("span",{className:yn.fieldLabel,children:n("scheduledTasks.time")}),a.jsx("input",{className:yn.input,type:"time",value:m.time,onChange:U=>g(G=>({...G,time:U.target.value}))})]}),m.frequency==="weekly"&&a.jsxs("label",{className:yn.field,children:[a.jsx("span",{className:yn.fieldLabel,children:n("scheduledTasks.weekday")}),a.jsx("select",{className:yn.select,value:m.weekday,onChange:U=>g(G=>({...G,weekday:Number(U.target.value)})),children:n("scheduledTasks.weekdayNames").split(",").map((U,G)=>a.jsx("option",{value:G,children:U},G))})]}),m.frequency==="minutes"&&a.jsxs("label",{className:yn.field,children:[a.jsx("span",{className:yn.fieldLabel,children:n("scheduledTasks.interval")}),a.jsx("select",{className:yn.select,value:m.minuteInterval,onChange:U=>g(G=>({...G,minuteInterval:Number(U.target.value)})),children:mSs.map(U=>a.jsx("option",{value:U,children:U},U))})]}),m.frequency==="custom"&&a.jsxs("label",{className:`${yn.field} ${yn.fieldGrow}`,children:[a.jsx("span",{className:yn.fieldLabel,children:n("scheduledTasks.cron")}),a.jsx("input",{className:yn.input,type:"text",value:m.customCron,spellCheck:!1,placeholder:"0 9 * * 1-5",onChange:U=>g(G=>({...G,customCron:U.target.value}))})]})]}),a.jsx("div",{className:yn.preview,children:de?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:yn.previewLabel,children:de}),a.jsx("code",{className:yn.previewCron,children:ue})]}):a.jsx("span",{className:yn.previewInvalid,children:n("scheduledTasks.error.invalidSchedule")})}),E&&a.jsx("div",{className:yn.formError,children:E}),a.jsxs("div",{className:yn.formActions,children:[a.jsx("button",{type:"button",className:yn.secondaryButton,onClick:Q,disabled:_,children:n("scheduledTasks.cancel")}),a.jsx("button",{type:"button",className:yn.primaryButton,onClick:()=>void V(),disabled:_,children:n(_?"scheduledTasks.saving":"scheduledTasks.save")})]})]})})]})}function ISs({changes:e,selectedPath:t,workspaceCwd:n,onOpenFilePreview:s,onDownloadFile:r,onDownloadError:o}){const{t:i}=et(),[l,c]=u.useState(!1),[d,h]=u.useState(!0),[f,p]=u.useState(!1),[m,g]=u.useState(520),v=u.useRef(m),b=u.useRef(null),y=u.useRef(null),[w,x]=u.useState(null),[k,_]=u.useState(()=>new Set),S=u.useRef(!0);u.useEffect(()=>(S.current=!0,()=>{S.current=!1}),[]);const E=l,j=u.useMemo(()=>OSs(e,n),[e,n]);u.useEffect(()=>{x(t)},[t]),u.useEffect(()=>{v.current=m},[m]),u.useEffect(()=>{const A=b.current;if(!A)return;const M=()=>{p(A.clientWidth<fSs)};M();const P=new ResizeObserver(M);return P.observe(A),()=>P.disconnect()},[d]),u.useEffect(()=>()=>y.current?.(),[]);const I=u.useCallback(A=>{const M=b.current;if(!M)return;A.preventDefault();const P=A.currentTarget;P.setPointerCapture(A.pointerId);const D=A.clientX,z=v.current,B=M.getBoundingClientRect().width,$=Math.max(180,B-180),L=document.body.style.cursor,O=document.body.style.userSelect;let W=z,H=null;document.body.style.cursor="col-resize",document.body.style.userSelect="none";const Q=()=>{H=null,g(W)},V=ue=>{W=Math.min($,Math.max(180,z+(ue.clientX-D))),H===null&&(H=window.requestAnimationFrame(Q))};let re=()=>{};const Z=ue=>{y.current=null,H!==null&&(window.cancelAnimationFrame(H),H=null),ue&&g(W),P.hasPointerCapture(A.pointerId)&&P.releasePointerCapture(A.pointerId),document.body.style.cursor=L,document.body.style.userSelect=O,window.removeEventListener("pointermove",V),window.removeEventListener("pointerup",re),window.removeEventListener("pointercancel",re)};re=()=>Z(!0),y.current=()=>Z(!1),window.addEventListener("pointermove",V),window.addEventListener("pointerup",re),window.addEventListener("pointercancel",re)},[]);if(e.length===0)return a.jsx("div",{className:It.empty,children:"No file changes to review."});const R=jZe(e),T=A=>{x(M=>M===A?null:A)},N=async A=>{if(!(!r||k.has(A.path))){_(M=>new Set(M).add(A.path));try{await r(A,()=>!S.current)}catch(M){S.current&&o(M)}finally{_(M=>{const P=new Set(M);return P.delete(A.path),P})}}};return a.jsxs("div",{className:It.review,children:[a.jsxs("div",{className:It.reviewToolbar,children:[a.jsxs("div",{className:It.reviewToolbarTitle,children:[a.jsx("span",{children:i("turnOutputs.previousTurn")}),a.jsx(rV,{additions:R?.additions,deletions:R?.deletions,className:It.lineStats,additionsClassName:It.additions,deletionsClassName:It.deletions})]}),a.jsxs("div",{className:It.reviewToolbarActions,children:[a.jsxs("button",{type:"button",className:It.reviewTotalsButton,onClick:()=>h(A=>!A),"aria-expanded":d,children:[a.jsx("span",{children:i("turnOutputs.fileCount",{count:e.length})}),a.jsx("span",{className:[It.chevron,d?It.chevronOpen:""].filter(Boolean).join(" "),"aria-hidden":"true",children:a.jsx(lDe,{})})]}),a.jsx("button",{type:"button",className:[It.iconButton,l?It.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(DSs,{}):a.jsx(PSs,{})})]})]}),d&&a.jsxs("div",{ref:b,className:[It.reviewContent,E?"":It.reviewContentListOnly,E&&f?It.reviewContentStacked:""].filter(Boolean).join(" "),style:{"--review-list-width":`${m}px`},children:[a.jsx("div",{className:[It.reviewList,w?It.reviewListWithExpanded:""].filter(Boolean).join(" "),children:e.map(A=>{const M=w===A.path,P=s&&DZe(A.path),D=r&&okn(A.path);return a.jsxs("div",{className:[It.reviewItem,M?It.reviewItemExpanded:""].filter(Boolean).join(" "),children:[a.jsxs("div",{className:It.reviewRow,"data-selected":A.path===t||void 0,children:[a.jsx("button",{type:"button",className:It.reviewRowToggle,onClick:()=>T(A.path),"aria-label":A.path,"aria-expanded":M}),a.jsx("span",{className:It.fileIcon,children:adt(A.path)}),a.jsxs("span",{className:It.reviewFileName,children:[a.jsx(jSs,{path:iX(A.path,n),title:A.path}),P&&a.jsx("button",{type:"button",className:It.reviewOpenButton,onClick:()=>s?.(A),title:`${i("turnOutputs.preview")} ${A.path}`,children:i("turnOutputs.preview")}),D&&a.jsx("button",{type:"button",className:It.reviewOpenButton,onClick:()=>void N(A),title:`${i("common.download")} ${A.path}`,disabled:k.has(A.path),children:i(k.has(A.path)?"common.downloading":"common.download")})]}),a.jsx(rV,{additions:A.additions,deletions:A.deletions,className:It.lineStats,additionsClassName:It.additions,deletionsClassName:It.deletions}),a.jsx("span",{className:[It.chevron,M?It.chevronOpen:""].filter(Boolean).join(" "),"aria-hidden":"true",children:a.jsx(lDe,{})})]}),M&&a.jsx(RSs,{change:A})]},`${A.toolCallId}:${A.path}`)})}),E&&!f&&a.jsx("div",{className:It.reviewSplitHandle,role:"separator","aria-orientation":"vertical",onPointerDown:I}),E&&a.jsx("div",{className:It.tree,children:j.children.map(A=>a.jsx(rdt,{node:A,depth:0,selectedPath:t},A.path))})]})]})}function RSs({change:e}){if(e.diffs.length===0)return a.jsx("div",{className:It.diffEmpty,children:"No diff available."});const t=ESs(e.diffs);return a.jsx("div",{className:It.diffPreview,children:t.map((n,s)=>n.fileDiff&&!n.fullContent?a.jsx(T9,{diff:n.fileDiff},s):a.jsx(ASs,{oldText:n.oldText,newText:n.newText},s))})}function ESs(e){for(let t=e.length-1;t>=0;t--)if(e[t]?.fullContent)return e.slice(t);return e}function ASs({oldText:e,newText:t}){const n=u.useRef(null),[s,r]=u.useState(null),[o,i]=u.useState(null);return u.useEffect(()=>{const l=n.current;if(!l)return;const c=()=>r(l.clientWidth>=720);c();const d=new ResizeObserver(c);return d.observe(l),()=>d.disconnect()},[]),u.useEffect(()=>{const l=n.current;if(!l||s===null)return;l.replaceChildren(),i(null);let c=!1,d=null;const h=[Qnt,ur.editable.of(!1),ll.readOnly.of(!0),ur.lineWrapping],f={scanLimit:1e3,timeout:500},p={margin:3,minSize:8};return bt(async()=>{const{MergeView:m,unifiedMergeView:g}=await import("./index-YpdTDWts.js");return{MergeView:m,unifiedMergeView:g}},[]).then(({MergeView:m,unifiedMergeView:g})=>{if(!c)try{if(s){d=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}d=new ur({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,d?.destroy()}},[s,t,e]),a.jsxs("div",{className:It.codeMirrorDiffWrap,children:[a.jsx("div",{ref:n,className:It.codeMirrorDiff}),o&&a.jsxs("div",{className:It.diffError,children:["Diff unavailable: ",o]})]})}function rdt({node:e,depth:t,selectedPath:n}){const s=!!e.file,[r,o]=u.useState(!0),i=[It.treeRow,s?It.treeFile:It.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`},d=a.jsxs(a.Fragment,{children:[a.jsx("span",{className:It.treeTwisty,children:!s&&a.jsx("span",{className:[It.treeChevron,r?"":It.treeChevronClosed].filter(Boolean).join(" "),children:a.jsx(LSs,{})})}),a.jsxs("span",{className:It.treeContent,children:[s&&a.jsx("span",{className:It.fileIcon,children:adt(e.path)}),a.jsx("span",{className:It.treeName,children:e.name})]}),e.file?.isArtifact&&a.jsx("span",{className:It.reviewBadge,children:"artifact"})]});return a.jsxs("div",{className:It.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:d}):a.jsx("button",{type:"button",className:i,"data-depth":t,style:l,title:e.path,"aria-expanded":r,onClick:()=>o(h=>!h),children:d}),!s&&r&&e.children.length>0&&a.jsx("div",{className:It.treeChildren,style:c,children:e.children.map(h=>a.jsx(rdt,{node:h,depth:t+1,selectedPath:n},h.path))})]})}function jSs({path:e,title:t}){const n=u.useRef(null),[s,r]=u.useState(()=>odt(e));return u.useLayoutEffect(()=>{const o=n.current;if(!o)return;const i=()=>r(NSs(e,o));i();const l=new ResizeObserver(i);return l.observe(o),()=>l.disconnect()},[e]),a.jsxs("span",{ref:n,className:It.reviewPath,title:t??e,children:[s.prefix&&a.jsx("span",{className:It.pathPrefix,children:s.prefix}),a.jsx("span",{className:It.pathFileName,children:s.leaf})]})}function odt(e){const t=e.lastIndexOf("/");return t<0?{prefix:"",leaf:e}:{prefix:e.slice(0,t+1),leaf:e.slice(t+1)}}let aDe=null;function NSs(e,t){const n=odt(e),s=t.clientWidth;if(s<=0)return n;const r=MSs(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 d=1;d<o.length;d++){const f=`.../${o.slice(o.length-1-d,-1).join("/")}/`;if(r(f)+l>s)break;c=f}return{prefix:c,leaf:i}}function MSs(e){aDe??=document.createElement("canvas");const t=aDe.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 PSs(){return a.jsxs("svg",{className:It.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 DSs(){return a.jsxs("svg",{className:It.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 lDe(){return a.jsx("svg",{className:It.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 LSs(){return a.jsx("svg",{className:It.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 OSs(e,t){const n={name:"",path:"",children:[]};for(const s of e){const r=iX(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 d=o.children.find(h=>h.name===l);d||(d={name:l,path:c,children:[]},o.children.push(d)),i===r.length-1&&(d.file=s),o=d}}return idt(n),n}function idt(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)idt(t)}function N4(e){return K2(e).split("/").filter(Boolean).at(-1)??e}function adt(e){const t=N4(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 BSs({artifact:e,sourceSessionId:t,workspaceActions:n,previewContent:s}){const{t:r}=et(),o=Pm(),i=QJt(e),l=TT(e.url)?e.url:void 0,c=e.metadata?.artifactType==="automation_snapshot",d=e.metadata?.artifactType==="code_review",h=e.storage==="workspace"&&!!e.workspacePath,f=G0e(e);return e.metadata?.artifactType==="web_preview_snapshot"?a.jsx(bws,{artifact:e,sourceSessionId:t}):d?e.status!=="available"?a.jsx($Ss,{status:e.status}):!h||!e.workspacePath?a.jsx(FSs,{}):a.jsx(Dms,{workspacePath:e.workspacePath,artifactVersion:yAe(e),workspaceActions:n}):h&&e.workspacePath?bXe(e)||(w9(e.workspacePath,e.mimeType)||y9(e.workspacePath,e.mimeType)||V2(e))&&e.status!=="available"&&e.status!=="changed"?a.jsx(ldt,{artifact:e,workspaceActions:n}):a.jsx(c7,{workspacePath:e.workspacePath,artifactVersion:yAe(e),workspaceActions:n,previewContent:s,previewSizeBytes:e.sizeBytes,previewMimeType:V2(e)?"application/pdf":e.mimeType,imageMimeType:f,previewKind:zSs(e)?"html":USs(e)?"markdown":f?"image":"source"}):a.jsxs("div",{className:It.detail,children:[a.jsxs("div",{className:It.section,children:[a.jsx("div",{className:It.sectionTitle,children:c?"Automation Snapshot":"Artifact"}),a.jsxs("div",{className:It.fieldGrid,children:[a.jsx(Qg,{label:"Type",value:H0e(e.kind,e.workspacePath)}),a.jsx(Qg,{label:"Storage",value:e.storage}),a.jsx(Qg,{label:"Status",value:e.status}),a.jsx(Qg,{label:"Source",value:e.source}),a.jsx(Qg,{label:"Size",value:VY(e.sizeBytes)}),a.jsx(Qg,{label:"Created",value:e.createdAt}),a.jsx(Qg,{label:"Updated",value:e.updatedAt}),e.toolName&&a.jsx(Qg,{label:"Tool",value:e.toolName}),e.toolCallId&&a.jsx(Qg,{label:"Tool call",value:e.toolCallId})]})]}),e.description&&a.jsxs("div",{className:It.section,children:[a.jsx("div",{className:It.sectionTitle,children:"Description"}),a.jsx("div",{className:It.description,children:e.description})]}),c&&e.metadata&&a.jsxs("div",{className:It.section,children:[a.jsx("div",{className:It.sectionTitle,children:"Details"}),a.jsxs("div",{className:It.fieldGrid,children:[Bj(e.metadata,"automationId","Automation ID"),Bj(e.metadata,"schedule","Schedule"),Bj(e.metadata,"timezone","Timezone"),Bj(e.metadata,"status","Status"),Bj(e.metadata,"nextRunAt","Next run"),Bj(e.metadata,"prompt","Prompt")]})]}),(i||l)&&a.jsxs("div",{className:It.section,children:[a.jsx("div",{className:It.sectionTitle,children:"Location"}),l?a.jsxs("div",{className:It.locationRow,children:[a.jsx("a",{className:It.link,href:l,target:"_blank",rel:"noopener noreferrer",onClick:p=>o(p,l),children:l}),a.jsx("a",{className:It.openButton,href:l,target:"_blank",rel:"noopener noreferrer",onClick:p=>o(p,l),children:r("artifact.openLink")})]}):a.jsx("div",{className:It.meta,children:i})]})]})}function $Ss({status:e}){const{t}=et();return a.jsx("div",{className:It.previewError,role:"alert",children:t("codeReview.unavailable",{status:e})})}function FSs(){const{t:e}=et();return a.jsx("div",{className:It.previewError,role:"alert",children:e("codeReview.workspaceRequired")})}function zSs(e){const t=e.workspacePath?.toLowerCase()??"",n=mw(e.mimeType);return e.kind==="html"||t.endsWith(".html")||t.endsWith(".htm")||n==="text/html"}function USs(e){const t=e.workspacePath?.toLowerCase()??"",n=mw(e.mimeType);return t.endsWith(".md")||t.endsWith(".markdown")||n==="text/markdown"}function ldt({artifact:e,workspaceActions:t}){const{t:n}=et(),[s,r]=u.useState(null),[o,i]=u.useState(!1),l=u.useRef(!0),c=e.workspacePath;u.useEffect(()=>(l.current=!0,()=>{l.current=!1}),[]);const d=async()=>{if(e.workspacePath){i(!0),r(null);try{await x9(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:It.detail,children:a.jsxs("div",{className:It.section,children:[a.jsx("div",{className:It.sectionTitle,children:n("common.download")}),a.jsxs("div",{className:It.fieldGrid,children:[a.jsx(Qg,{label:"Type",value:H0e(e.kind,e.workspacePath)}),a.jsx(Qg,{label:"Size",value:VY(e.sizeBytes)}),c?a.jsx(Qg,{label:"Location",value:c}):null,e.status!=="available"&&e.status!=="changed"?a.jsx(Qg,{label:"Status",value:e.status??"missing"}):null]}),a.jsx("div",{className:It.downloadRow,children:a.jsx("button",{type:"button",className:It.downloadButton,onClick:()=>{d()},disabled:o||e.status!=="available"&&e.status!=="changed",children:n(o?"common.downloading":"common.download")})}),s&&a.jsx("div",{className:It.previewError,children:s})]})})}function WSs({tab:e}){const{t}=et(),n=ba(),s=cA(e.workspaceCwd),r=s?.actions,o=Pm(),[i,l]=u.useState(0),[c,d]=u.useState(),[h,f]=u.useState(),[p,m]=u.useState(),g=e.source,v=g.locator,b=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),y=v.type==="workspace_file"?v.workspacePath:v.type==="attachment"?v.attachmentId:"",w=V2({workspacePath:y});if(u.useEffect(()=>{let k=!1;return d(void 0),f(void 0),m(void 0),!b||v.type==="url"?void 0:((async()=>{if(v.type==="attachment"){const S=await e.sessionActions.readAttachment(v.attachmentId);if(k||!e.owner.isCurrent())return;const E=Uint8Array.from(atob(S.data),j=>j.charCodeAt(0));d(new Blob([E],{type:S.mimeType}))}else if(w&&r){const S=await IT(r.readFileBytes,y,"application/pdf",{statFile:r.stat,isCancelled:()=>k||!e.owner.isCurrent()});!k&&e.owner.isCurrent()&&d(S)}})().catch(S=>{!k&&e.owner.isCurrent()&&f(ja(S))}),()=>{k=!0})},[i,b,v,y,w,e.owner,e.sessionActions,r]),b&&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}),TT(v.url)&&a.jsx("a",{className:"text-primary underline",href:v.url,target:"_blank",rel:"noopener noreferrer",onClick:k=>o(k,v.url),children:t("sources.openOriginal")})]});if(!b||!s&&v.type!=="attachment")return a.jsx("div",{className:It.empty,role:"alert",children:t("sources.unavailable")});const x=v.type==="workspace_file"&&!w&&bXe({workspacePath:y});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:y,children:y}),a.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[p&&a.jsx(Ae,{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(Zy,{})})}),h&&a.jsx(Ae,{variant:"ghost",size:"sm",onClick:()=>l(k=>k+1),children:t("common.retry")})]})]}),h?a.jsx("div",{className:It.previewError,role:"alert",children:h}):x?a.jsxs("div",{className:"p-4",children:[a.jsx("p",{children:t("attachment.previewUnsupported")}),a.jsx(Ae,{onClick:()=>void x9(r,y,"application/octet-stream",()=>!e.owner.isCurrent()).catch(k=>{e.owner.isCurrent()&&f(ja(k))}),children:t("common.download")})]}):(v.type==="attachment"||w)&&!c?a.jsx("div",{className:It.empty,role:"status",children:t("common.loading")}):c&&!w9(y,c.type)&&!y9(y,c.type)&&!V2({workspacePath:y,mimeType:c.type})&&!EM(c.type,y)?a.jsx(Jbe,{data:c,title:g.title,onDownloadUrl:m,showDownload:!1,image:!!G2(y)&&c.type.startsWith("image/")}):a.jsx("div",{className:"relative min-h-0 flex-1 overflow-auto",children:a.jsx(c7,{workspacePath:y,workspaceActions:r,onLoadError:f,previewData:c,previewOnly:v.type==="attachment",downloadName:v.type==="attachment"?g.title:void 0,previewMimeType:c?.type,previewKind:/\.html?$/i.test(y)||mw(c?.type)==="text/html"?"source":void 0},i)})]})}function Jbe({data:e,title:t,image:n,onDownloadUrl:s,showDownload:r=!0}){const[o,i]=u.useState();return u.useEffect(()=>{const l=URL.createObjectURL(e);return i(l),s?.(l),()=>URL.revokeObjectURL(l)},[e,s]),o?a.jsxs("div",{className:It.imagePreviewWrap,children:[n?a.jsx("img",{className:It.imagePreview,src:o,alt:t}):a.jsx(ddt,{name:t,mimeType:e.type,size:e.size}),r&&a.jsx("a",{href:o,download:t,"aria-label":`Download ${t}`,children:a.jsx(Zy,{})})]}):null}function c7({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewData:o,previewMimeType:i,imageMimeType:l,previewKind:c,previewOnly:d,onLoadError:h,sourceRenderer:f,downloadName:p}){const{t:m}=et();if(w9(e,i||o?.type))return a.jsx(Bms,{workspacePath:e,workspaceActions:n,data:o,artifactVersion:t,downloadName:p});if(y9(e,i||o?.type))return a.jsx(Rm,{resetKeys:[e,n,o,t],fallback:a.jsxs("div",{children:[a.jsx("div",{role:"alert",className:It.previewError,children:m("excel.invalid")}),o?a.jsx(Jbe,{data:o,title:e.split(/[/\\]/).pop(),image:!1}):n?a.jsx(ldt,{artifact:{workspacePath:e,kind:"document",mimeType:i,status:"available"},workspaceActions:n},e):null]}),children:a.jsx(u.Suspense,{fallback:a.jsx("div",{className:It.empty,role:"status",children:m("common.loading")}),children:a.jsx(hSs,{workspacePath:e,workspaceActions:n,data:o,artifactVersion:t})})});if(o)return a.jsx(HSs,{workspacePath:e,workspaceActions:n,data:o,mimeType:i,previewKind:c,onLoadError:h});if(V2({workspacePath:e,mimeType:i}))return a.jsx(VSs,{workspacePath:e,artifactVersion:t,workspaceActions:n,onLoadError:h});const g=e.toLowerCase(),v=l??G2(e),b=c??(g.endsWith(".html")||g.endsWith(".htm")?"html":g.endsWith(".md")||g.endsWith(".markdown")?"markdown":v?"image":"source");return b==="html"?a.jsx(KSs,{workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:d,onLoadError:h}):b==="markdown"?a.jsx(XSs,{workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:d,onLoadError:h}):b==="image"&&v?a.jsx(GSs,{workspacePath:e,artifactVersion:t,workspaceActions:n,mimeType:v,onLoadError:h}):a.jsx(udt,{sourceRenderer:f,workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:d,onLoadError:h})}function HSs({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 V2({workspacePath:e,mimeType:i})?a.jsx(cdt,{data:n,mimeType:"application/pdf",title:e}):EM(i,e)?a.jsx(qSs,{workspacePath:e,workspaceActions:t,data:n,previewKind:r,onLoadError:o}):a.jsx(ddt,{name:e,mimeType:i,size:n.size})}function qSs({workspacePath:e,workspaceActions:t,data:n,previewKind:s,onLoadError:r}){const{t:o}=et(),[i,l]=u.useState(),[c,d]=u.useState();return u.useEffect(()=>{const h=new FileReader;return l(void 0),d(void 0),h.onload=()=>l(String(h.result??"")),h.onerror=()=>{const f=o("attachment.readFailed");d(f),r?.(f)},h.readAsText(n),()=>{h.readyState===FileReader.LOADING&&h.abort()}},[n,r,o]),c?a.jsx("div",{className:It.previewError,children:c}):i===void 0?a.jsx("div",{className:It.empty,children:o("attachment.loadingFile")}):a.jsx(c7,{workspacePath:e,workspaceActions:t,previewContent:i,previewSizeBytes:n.size,previewOnly:!0,previewKind:s})}function VSs({workspacePath:e,artifactVersion:t,workspaceActions:n,onLoadError:s}){const{t:r}=et(),[o,i]=u.useState(),[l,c]=u.useState(),[d,h]=u.useState(0);return u.useEffect(()=>{let f=!1;return i(void 0),c(void 0),IT(n.readFileBytes,e,"application/pdf",{statFile:n.stat,isCancelled:()=>f}).then(p=>{f||i(p)},p=>{if(f)return;const m=ja(p);c(m),s?.(m)}),()=>{f=!0}},[e,n,t,d,s]),l?a.jsxs("div",{className:It.empty,children:[a.jsx("div",{role:"alert",className:It.previewError,children:l}),a.jsx(Ae,{onClick:()=>h(f=>f+1),children:r("common.retry")})]}):o?a.jsx(cdt,{data:o,mimeType:"application/pdf",title:e}):a.jsx("div",{className:It.empty,role:"status",children:r("attachment.loadingPreview")})}function cdt({data:e,mimeType:t,title:n}){const{t:s}=et(),[r,o]=u.useState();return u.useEffect(()=>{const i=URL.createObjectURL(e.type===t?e:new Blob([e],{type:t}));return o(i),()=>URL.revokeObjectURL(i)},[e,t]),r?a.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[a.jsx("div",{className:"flex justify-end border-b border-border p-1",children:a.jsx(Ae,{variant:"ghost",size:"sm",asChild:!0,children:a.jsxs("a",{href:r,download:N4(n),"aria-label":`Download ${N4(n)}`,children:[a.jsx(Zy,{"aria-hidden":"true"}),s("common.download")]})})}),navigator.pdfViewerEnabled===!1?a.jsx("div",{className:It.empty,children:s("attachment.previewUnsupported")}):a.jsx("iframe",{className:`${It.pdfAttachmentPreview} min-h-0 flex-1`,src:r,title:`Preview ${n}`})]}):a.jsx("div",{className:It.empty,children:s("attachment.loadingPreview")})}function ddt({name:e,mimeType:t,size:n}){const{t:s}=et();return a.jsxs("div",{className:It.unsupportedAttachmentPreview,children:[a.jsx(ub,{name:e,mimeType:t,"aria-hidden":"true"}),a.jsx("div",{children:s("attachment.previewUnsupported")}),a.jsxs("div",{className:It.unsupportedAttachmentMeta,children:[t," · ",VY(n)]})]})}function GSs({workspacePath:e,artifactVersion:t,workspaceActions:n,mimeType:s,onLoadError:r}){const[o,i]=u.useState(null),[l,c]=u.useState(null);return u.useEffect(()=>{let d=!1,h;return i(null),c(null),IT((f,p)=>n.readFileBytes(f,p),e,s,{statFile:f=>n.stat(f),isCancelled:()=>d}).then(f=>{d||(h=URL.createObjectURL(f),i(h))}).catch(f=>{if(d)return;const p=f instanceof Error?f.message:String(f);c(p),r?.(p)}),()=>{d=!0,h&&URL.revokeObjectURL(h)}},[t,s,r,n,e]),a.jsxs("div",{className:It.imagePreviewWrap,children:[o?a.jsxs(a.Fragment,{children:[a.jsx("img",{className:It.imagePreview,src:o,alt:N4(e)}),a.jsx("a",{className:It.imageDownloadButton,href:o,download:N4(e),"aria-label":`Download ${N4(e)}`,title:"Download",children:a.jsx(Zy,{size:16,strokeWidth:1.8})})]}):l?null:a.jsx("div",{className:It.empty,children:"Loading image..."}),l&&a.jsx("div",{className:It.previewError,children:l})]})}function Qbe({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:r,onLoadError:o,maxPreviewBytes:i}){const{t:l}=et(),[c,d]=u.useState(s??null),[h,f]=u.useState(),[p,m]=u.useState(null);return u.useEffect(()=>{let g=!1;if(d(s??null),m(null),f(void 0),!r)return n.stat(e).then(v=>{if(!g){if(v.type==="directory")throw new Error("Directories cannot be opened as artifacts.");if(i!==void 0&&v.sizeBytes>i)throw new Error(l("files.sourceTooLarge"));return n.readWorkspaceFile(e,{maxBytes:256*1024})}}).then(async v=>{if(g||!v||!v.truncated)return v;const b=await IT((y,w)=>n.readFileBytes(y,w),e,"application/octet-stream",{statFile:y=>n.stat(y),isCancelled:()=>g,maxBytes:i});return{sizeBytes:b.size,content:new TextDecoder(v.encoding||"utf-8").decode(await b.arrayBuffer())}}).then(v=>{g||!v||(f(v.sizeBytes),d(v.content))}).catch(v=>{if(g)return;const b=v instanceof Error?v.message:String(v);m(b),o?.(b)}),()=>{g=!0}},[t,s,r,o,n,e,i,l]),{content:c,error:p,sizeBytes:h}}function KSs({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:o,onLoadError:i}){const{content:l,error:c,sizeBytes:d}=Qbe({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:o,onLoadError:i});return a.jsxs("div",{className:It.htmlPreviewWrap,children:[l===null?!c&&a.jsx("div",{className:It.empty,children:"Loading preview..."}):a.jsx(hdt,{content:l,sizeBytes:d??r,workspacePath:e,workspaceActions:n,children:()=>a.jsx(YSs,{content:l,workspacePath:e})}),c&&a.jsx("div",{className:It.previewError,children:c})]})}function YSs({content:e,workspacePath:t}){const n=`Preview ${t}`,{t:s}=et(),[r,o]=u.useState(null),[i,l]=u.useState(null);return u.useEffect(()=>{const c=new AbortController;return o(null),l(null),ZJt(e,n,c.signal).then(d=>{c.signal.aborted||o(d)},d=>{c.signal.aborted||l(ja(d))}),()=>c.abort()},[e,n]),i?a.jsx("div",{className:It.previewError,children:s("artifact.previewFailed",{message:i})}):r===null?a.jsx("div",{className:It.empty,children:s("attachment.loadingPreview")}):a.jsx("iframe",{className:It.htmlPreview,referrerPolicy:"no-referrer",sandbox:"allow-scripts",srcDoc:r,title:n})}function udt({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:r,onLoadError:o,sourceRenderer:i}){const l=u.useRef(null),[c,d]=u.useState(null),{content:h,error:f}=Qbe({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:r,onLoadError:o,maxPreviewBytes:i?4*1024*1024:void 0});return u.useEffect(()=>{const p=l.current;if(!p||h===null)return;p.replaceChildren(),d(null);let m;try{m=new ur({doc:h,extensions:[Qnt,ur.editable.of(!1),ll.readOnly.of(!0),ur.lineWrapping],parent:p})}catch(g){d(g instanceof Error?g.message:String(g));return}return()=>m.destroy()},[h,i]),a.jsxs("div",{className:It.filePreviewWrap,children:[h===null?!f&&a.jsx("div",{className:It.empty,children:"Loading file..."}):i?a.jsx("div",{className:It.codeMirrorFile,children:i(h)}):a.jsx("div",{ref:l,className:It.codeMirrorFile}),(f||c)&&a.jsx("div",{className:It.previewError,children:f||c})]})}function hdt({content:e,sizeBytes:t,workspacePath:n,workspaceActions:s,children:r}){const{t:o}=et(),[i,l]=u.useState(null);if(!u.useMemo(()=>(t??new TextEncoder().encode(e).byteLength)>1024*1024,[e,t]))return r();const d=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(Ae,{className:"ml-auto shrink-0",variant:"outline",size:"sm",onClick:()=>l(d?null:e),children:o(d?"artifact.showSource":"artifact.renderFullPreview")})]}),a.jsx("div",{className:"relative min-h-0 flex-1 overflow-auto",children:d?r():a.jsx(udt,{workspacePath:n,workspaceActions:s,previewContent:e,previewOnly:!0})})]})}function XSs({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:o,onLoadError:i}){const{content:l,error:c,sizeBytes:d}=Qbe({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:o,onLoadError:i});return a.jsxs("div",{className:It.htmlPreviewWrap,children:[l===null?!c&&a.jsx("div",{className:It.empty,children:"Loading preview..."}):a.jsx(hdt,{content:l,sizeBytes:d??r,workspacePath:e,workspaceActions:n,children:()=>a.jsx("div",{className:It.markdownPreviewWrap,children:a.jsx(cp,{content:l})})}),c&&a.jsx("div",{className:It.previewError,children:c})]})}function Qg({label:e,value:t}){return t?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:It.fieldLabel,children:e}),a.jsx("span",{className:It.fieldValue,children:t})]}):null}function Bj(e,t,n){const s=e[t];return s==null||s===""?null:a.jsx(Qg,{label:n,value:String(s)},t)}/**
|
|
2969
2969
|
* @license
|
|
2970
2970
|
* Copyright 2025 Qwen Team
|
|
2971
2971
|
* SPDX-License-Identifier: Apache-2.0
|