@qwen-code/qwen-code 0.24.4 → 0.24.5-preview.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundled/agent-delegation/SKILL.md +56 -0
- package/bundled/qc-helper/docs/features/context-cost.md +7 -5
- package/chunks/{MaxSizedBox-YRUOD55W.js → MaxSizedBox-3RXPTLCS.js} +18 -18
- package/chunks/{StandaloneSessionPicker-IIVDYLNQ.js → StandaloneSessionPicker-74775YBZ.js} +31 -31
- package/chunks/{acp-subagent-executor-5U2LT2ZS.js → acp-subagent-executor-OQXOMTFK.js} +21 -21
- package/chunks/{acpAgent-GQCJ4KZY.js → acpAgent-MD56LD7L.js} +57 -57
- package/chunks/{agent-ZD5N6BSU.js → agent-75EZNG2Q.js} +8 -8
- package/chunks/{agent-headless-ZYDEB4YW.js → agent-headless-TQ6MWUDT.js} +8 -8
- package/chunks/{anthropicContentGenerator-JOZNOMSX.js → anthropicContentGenerator-DCDXTX3R.js} +3 -3
- package/chunks/{bridge-6BVTQBUK.js → bridge-KGJYQUWD.js} +21 -21
- package/chunks/{channel-settings-store-GKXGAWDF.js → channel-settings-store-773UOD6B.js} +23 -23
- package/chunks/{chunk-ILXHAHOV.js → chunk-2JHQ2J3Y.js} +5 -5
- package/chunks/{chunk-DYLGEL4Y.js → chunk-2KZURPTB.js} +1 -1
- package/chunks/{chunk-UNN4M5Z7.js → chunk-35SABQFH.js} +1 -1
- package/chunks/{chunk-BNPJT34T.js → chunk-3DBI3LLL.js} +3 -3
- package/chunks/{chunk-CK5HUN74.js → chunk-3JSIWFNA.js} +4 -4
- package/chunks/{chunk-62DRQAZM.js → chunk-3NG2ZQAJ.js} +1 -1
- package/chunks/{chunk-ZLGYH2QW.js → chunk-3SK2A75W.js} +3 -3
- package/chunks/{chunk-REFGAEP6.js → chunk-3TQVPDCN.js} +2 -2
- package/chunks/{chunk-4EQCVDVE.js → chunk-3X5BDEXS.js} +8 -8
- package/chunks/{chunk-H4ET3HHT.js → chunk-3XHMOJCP.js} +1 -1
- package/chunks/{chunk-7WVZQVYU.js → chunk-4A255ZI6.js} +2 -2
- package/chunks/{chunk-P5OXAI4R.js → chunk-4FCWKBOC.js} +6 -6
- package/chunks/{chunk-QROZDIMB.js → chunk-4INF7OYV.js} +1 -1
- package/chunks/{chunk-Z4RLAAF3.js → chunk-4V5YKOBI.js} +3 -3
- package/chunks/{chunk-TBJBJDC3.js → chunk-5FZKG4JB.js} +1 -1
- package/chunks/{chunk-WXCSKU3W.js → chunk-5SZSV2CK.js} +3 -3
- package/chunks/{chunk-4JCRSCRO.js → chunk-6KQQPPFF.js} +1 -1
- package/chunks/{chunk-K5NFICAO.js → chunk-7IVZOKKW.js} +3 -3
- package/chunks/{chunk-DKXSLDQN.js → chunk-AOW7WIWE.js} +4 -4
- package/chunks/{chunk-2B2U26TT.js → chunk-B3XMX4SN.js} +4 -4
- package/chunks/{chunk-TZOI5TKT.js → chunk-B53FO7JN.js} +2 -2
- package/chunks/{chunk-E2FFBBLC.js → chunk-BBCH7PBA.js} +2 -2
- package/chunks/{chunk-A5QPMBRL.js → chunk-BVFBDXI2.js} +1 -1
- package/chunks/{chunk-5SLIP7KC.js → chunk-CAORZAZD.js} +10 -10
- package/chunks/{chunk-NIB5MPTB.js → chunk-DBYUN4U3.js} +1 -1
- package/chunks/{chunk-MVLIEY6W.js → chunk-DCTJ3GVF.js} +3 -3
- package/chunks/{chunk-J5C5SQQJ.js → chunk-E3TLOFX7.js} +3 -3
- package/chunks/{chunk-32MV4KJS.js → chunk-E4HNTYHK.js} +1 -1
- package/chunks/{chunk-L4N5IWLI.js → chunk-EBRC4GX2.js} +1 -1
- package/chunks/{chunk-HS2VQRHZ.js → chunk-EIHZ4FFM.js} +3 -3
- package/chunks/{chunk-UBBHH6V4.js → chunk-FBLGI2SO.js} +7 -7
- package/chunks/{chunk-SNMYJZZG.js → chunk-FLRFAPDA.js} +3 -3
- package/chunks/{chunk-SAP35BR2.js → chunk-G2AE7GYZ.js} +1 -1
- package/chunks/{chunk-XWCLIEJ2.js → chunk-GG3MO6NO.js} +2 -2
- package/chunks/{chunk-ODAWVZRE.js → chunk-GPTEZLRR.js} +3 -3
- package/chunks/{chunk-CN6WQ2RW.js → chunk-H2GVLBFU.js} +1 -1
- package/chunks/{chunk-3KD5I3G5.js → chunk-HD4IXPPC.js} +3 -3
- package/chunks/{chunk-TOKDUK22.js → chunk-HRVFPNGT.js} +3 -3
- package/chunks/{chunk-VTNSZQOF.js → chunk-JCMDVGPR.js} +2 -2
- package/chunks/{chunk-N3HID7XO.js → chunk-JEIPBSGX.js} +5 -5
- package/chunks/{chunk-WH7PDTZL.js → chunk-JM76TMGV.js} +31 -31
- package/chunks/{chunk-CDPBJGOO.js → chunk-JNQEW7B2.js} +5 -5
- package/chunks/{chunk-RIQQLEYE.js → chunk-JOFZBTVL.js} +1 -1
- package/chunks/{chunk-RFD37KE2.js → chunk-KFLDZ3HB.js} +1 -1
- package/chunks/{chunk-LCTSR5TZ.js → chunk-KMQ2ZH3Q.js} +2 -2
- package/chunks/{chunk-6IGW6HIV.js → chunk-LISITUEH.js} +1 -1
- package/chunks/{chunk-H5I6FURC.js → chunk-LOTGIM6V.js} +12 -12
- package/chunks/{chunk-K22NDLL4.js → chunk-LWRJLRZS.js} +3 -3
- package/chunks/{chunk-OQMLQJEX.js → chunk-MBUUQJPV.js} +5 -5
- package/chunks/{chunk-2QLTKHIH.js → chunk-MICQVBPI.js} +1 -1
- package/chunks/{chunk-2VS5EEXU.js → chunk-MZRJ2JJS.js} +1 -1
- package/chunks/{chunk-MAY3R2RG.js → chunk-O346IB64.js} +1 -1
- package/chunks/{chunk-52YR7XBE.js → chunk-O4IH5UEC.js} +15 -15
- package/chunks/{chunk-73BAOEMB.js → chunk-OB444SG3.js} +1 -1
- package/chunks/{chunk-KYFJLESB.js → chunk-OM5NSL25.js} +26 -26
- package/chunks/{chunk-LYEINKJD.js → chunk-OQE7AA2W.js} +4 -4
- package/chunks/{chunk-VOHPPFJI.js → chunk-OU4ZCLGJ.js} +1 -1
- package/chunks/{chunk-2WXS6WNU.js → chunk-PJ546DX4.js} +5 -5
- package/chunks/{chunk-U6BUJ2ZJ.js → chunk-Q5IEY2TN.js} +1 -1
- package/chunks/{chunk-5OEY6RVW.js → chunk-QR4U27UW.js} +4 -4
- package/chunks/{chunk-DPEB6S2R.js → chunk-RL2HSTEB.js} +2082 -1982
- package/chunks/{chunk-4QYFUIEV.js → chunk-RO5K7QUL.js} +4 -4
- package/chunks/{chunk-5NZED4YR.js → chunk-RXB6Y33E.js} +1 -1
- package/chunks/{chunk-F7ZEBIEN.js → chunk-SLSH5TFD.js} +2 -2
- package/chunks/{chunk-U2BS2NNZ.js → chunk-SRZA7OU4.js} +9 -87
- package/chunks/{chunk-GNTHJTS2.js → chunk-STKUN7BR.js} +1 -1
- package/chunks/{chunk-TYMHGPN6.js → chunk-SXFZ5P7F.js} +1 -1
- package/chunks/{chunk-GHJRFVPF.js → chunk-TDLEDOJN.js} +4 -4
- package/chunks/{chunk-DXXCNZW4.js → chunk-TFBQ5CKI.js} +7 -7
- package/chunks/{chunk-OD6ZS4US.js → chunk-TKOQGFRE.js} +1 -1
- package/chunks/{chunk-GZKSQ222.js → chunk-TNWJJEDT.js} +6 -6
- package/chunks/{chunk-IFWXQC7B.js → chunk-U5DPG7JW.js} +1 -1
- package/chunks/{chunk-7I63HEBQ.js → chunk-VIA4STCR.js} +3 -3
- package/chunks/{chunk-QZGPSTNK.js → chunk-VJCKLKZX.js} +2 -2
- package/chunks/{chunk-5A5VS7QC.js → chunk-VTFLRL55.js} +2 -2
- package/chunks/{chunk-BTEPFM7T.js → chunk-VUYJRNG5.js} +3 -3
- package/chunks/{chunk-42HJVUP3.js → chunk-WPHZEGFC.js} +1 -1
- package/chunks/{chunk-I46MJUYS.js → chunk-WVNCMGAO.js} +1 -1
- package/chunks/{chunk-ADPNUPK3.js → chunk-WVNML4HH.js} +1 -1
- package/chunks/{chunk-D2H63VR2.js → chunk-WVTM33Q3.js} +3 -3
- package/chunks/{chunk-NBWGGZY2.js → chunk-XCU752HT.js} +12 -12
- package/chunks/{chunk-DBEN5QEB.js → chunk-XEXNBTYX.js} +3 -3
- package/chunks/{chunk-JVKG7KDB.js → chunk-Y53WH7VD.js} +3 -3
- package/chunks/{chunk-6VYKKLTW.js → chunk-YSZ2XZTG.js} +1 -1
- package/chunks/{chunk-B3BOQ562.js → chunk-ZEGLZ3MN.js} +2 -2
- package/chunks/{chunk-TX5DMDUG.js → chunk-ZHQSWNO6.js} +1 -1
- package/chunks/{chunk-72PBMHN5.js → chunk-ZKDUQHU4.js} +9 -9
- package/chunks/{codex-subagent-executor-VSB4XPDB.js → codex-subagent-executor-437LQYGM.js} +21 -21
- package/chunks/{config-utils-DDUKVYVI.js → config-utils-CVLI36KM.js} +18 -18
- package/chunks/{contextCommand-GOW5PPVJ.js → contextCommand-2KSW7H5F.js} +19 -19
- package/chunks/{core-runtime-RP5WAAAJ.js → core-runtime-4IB27E7J.js} +18 -18
- package/chunks/{create-sub-session-JTEIPMTJ.js → create-sub-session-A73TQDAN.js} +19 -19
- package/chunks/{daemon-git-worktree-guard-W5I6GKLX.js → daemon-git-worktree-guard-BTKVV3DZ.js} +18 -18
- package/chunks/{daemon-status-provider-PJDKC6U5.js → daemon-status-provider-ETDIOWMS.js} +26 -26
- package/chunks/{daemon-trust-policy-VXNR5PJS.js → daemon-trust-policy-U5SPHJLP.js} +23 -23
- package/chunks/{daemon-trust-policy-monitor-VKUSL32L.js → daemon-trust-policy-monitor-QKRCO5WI.js} +23 -23
- package/chunks/{deferred-core-runtime-PCWM2NAR.js → deferred-core-runtime-FRELZPIE.js} +18 -18
- package/chunks/{edit-NZLWHALE.js → edit-TQ3CABYP.js} +10 -10
- package/chunks/{enterPlanMode-I4IZ27WH.js → enterPlanMode-JHOWELZO.js} +8 -8
- package/chunks/{environment-RF7WL5VP.js → environment-LUM7XX27.js} +20 -20
- package/chunks/{errors-5F35O3KE.js → errors-SH32ID5I.js} +20 -20
- package/chunks/{execution-tool-EWS25O7E.js → execution-tool-IIEL25CL.js} +10 -10
- package/chunks/{execution-worker-UAASM5HN.js → execution-worker-NKKEZ4XF.js} +13 -13
- package/chunks/{exitPlanMode-HEBWGYVF.js → exitPlanMode-PUICCCQ5.js} +8 -8
- package/chunks/{fast-path-O2LJG7DE.js → fast-path-QH3QTZZA.js} +2 -2
- package/chunks/{glob-YKXRLC3S.js → glob-OEB4WH3Z.js} +8 -8
- package/chunks/{goal-tools-QSX7V2QH.js → goal-tools-KWGKFUSK.js} +8 -8
- package/chunks/{handleAutoUpdate-JVVDCWPS.js → handleAutoUpdate-KEA7JSUD.js} +20 -20
- package/chunks/{i18n-TA4BNBF7.js → i18n-AC3MUXKZ.js} +18 -18
- package/chunks/{initializer-ZHOONLTG.js → initializer-WBD32BEX.js} +23 -23
- package/chunks/{installationInfo-22Q7JVZC.js → installationInfo-JRGFTKWY.js} +18 -18
- package/chunks/{list-5DY27M3G.js → list-S7KW7NBX.js} +26 -26
- package/chunks/{llm-T6YVOAHI.js → llm-E32WLISX.js} +51 -51
- package/chunks/{llm-content-generator-7ZKU73HA.js → llm-content-generator-OMKJHC5P.js} +3 -3
- package/chunks/{loadedSettingsAdapter-JFIYHT25.js → loadedSettingsAdapter-5OSU3J46.js} +23 -23
- package/chunks/{local-execution-environment-6VWOEJYW.js → local-execution-environment-IQHCTUJ5.js} +13 -13
- package/chunks/{loggingContentGenerator-DIC5SOXG.js → loggingContentGenerator-JIYG3LJS.js} +9 -9
- package/chunks/{managed-npm-update-5TDNQ2XJ.js → managed-npm-update-RKAT7AMQ.js} +18 -18
- package/chunks/{mcp-7ZE6BR36.js → mcp-SV72BZKG.js} +23 -23
- package/chunks/{model-call-collection-W2WDYVH7.js → model-call-collection-PKDMVCZN.js} +1 -1
- package/chunks/{model-configuration-WUA7G4GY.js → model-configuration-A52XMQW7.js} +23 -23
- package/chunks/{modelConfigUtils-CSAC36WP.js → modelConfigUtils-7O4P3SLE.js} +19 -19
- package/chunks/{monitor-XCEGKLFN.js → monitor-ZXRV2DJB.js} +8 -8
- package/chunks/{nonInteractiveCli-L7ON6MBN.js → nonInteractiveCli-UPSGIYRC.js} +48 -48
- package/chunks/{nonInteractiveToolExecutor-KLKO6IKA.js → nonInteractiveToolExecutor-TDKVR43J.js} +9 -9
- package/chunks/{notebook-edit-QCYO2MGD.js → notebook-edit-FBVHAHYM.js} +9 -9
- package/chunks/{omni-QWKKNBSE.js → omni-3NREMV2Q.js} +7 -7
- package/chunks/{openaiContentGenerator-PFU4NAXB.js → openaiContentGenerator-EWPBZFIT.js} +6 -6
- package/chunks/{openaiResponsesContentGenerator-MBZKLYFV.js → openaiResponsesContentGenerator-3CI3PINB.js} +2 -2
- package/chunks/{pidfile-Y6JFLZSG.js → pidfile-BBUANGZX.js} +18 -18
- package/chunks/{processUtils-WGMBDDAF.js → processUtils-6OHQLG7W.js} +2 -2
- package/chunks/{prompt-terminal-ledger-DKFZL5ZJ.js → prompt-terminal-ledger-ZBFYXJ4L.js} +19 -19
- package/chunks/{qwenContentGenerator-Q6QY4LGK.js → qwenContentGenerator-62F5IKXJ.js} +10 -10
- package/chunks/{reactive-degrade-V2VC7H7O.js → reactive-degrade-URJMXJ7N.js} +6 -6
- package/chunks/{read-file-NFZY7N2C.js → read-file-IM4Q5TKI.js} +2 -2
- package/chunks/{resumeHistoryUtils-HPFUAULU.js → resumeHistoryUtils-O3NQMDVR.js} +19 -19
- package/chunks/{ripGrep-PNFY7H5A.js → ripGrep-BG2FEVIV.js} +3 -3
- package/chunks/{run-qwen-serve-LHARMZ7C.js → run-qwen-serve-GMLWJITM.js} +38 -38
- package/chunks/{runtime-R3ECTRPN.js → runtime-SSGPOXRZ.js} +24 -24
- package/chunks/{sandboxConfig-LQ2JAICC.js → sandboxConfig-ALYLLNWY.js} +18 -18
- package/chunks/{scheduled-tasks-SHRO5IGN.js → scheduled-tasks-QJTC5XQ7.js} +24 -24
- package/chunks/{scheduler-SDVHFPG4.js → scheduler-PEXTY7IG.js} +20 -20
- package/chunks/{serve-ZIDUQEXD.js → serve-OVAUTKXK.js} +23 -23
- package/chunks/{server-5R5R5J4B.js → server-3MMYOOJW.js} +54 -54
- package/chunks/{session-JP4CDING.js → session-PZBIKBQJ.js} +49 -49
- package/chunks/{session-attachments-root-UMG3UM6R.js → session-attachments-root-ESP5CNBV.js} +18 -18
- package/chunks/{session-pr-refresh-VCZDCDQF.js → session-pr-refresh-B3N7PKUP.js} +23 -23
- package/chunks/{settings-ARQIF4FZ.js → settings-KSQ2DGPY.js} +22 -22
- package/chunks/{shell-EM2EW5GF.js → shell-3V26EVNC.js} +8 -8
- package/chunks/{skill-ARBE3YO6.js → skill-XP7F3LBV.js} +3 -3
- package/chunks/{skill-settings-XUKYH6QL.js → skill-settings-PDESL7S3.js} +23 -23
- package/chunks/{spawnChannel-OUG6AG5B.js → spawnChannel-NVO7CCBW.js} +20 -20
- package/chunks/{standalone-update-ITTOS33Q.js → standalone-update-FDWS2EGF.js} +19 -19
- package/chunks/{start-opentui-ui-HPBFC62Q.js → start-opentui-ui-WIFFY5UD.js} +54 -54
- package/chunks/{startInteractiveUI-PJDI6SSE.js → startInteractiveUI-YBLIRIHD.js} +60 -60
- package/chunks/{team-create-TBFNDDRY.js → team-create-Z5JUEMB7.js} +8 -8
- package/chunks/{team-plan-approval-57CJ2K3A.js → team-plan-approval-ZLLHMEQN.js} +8 -8
- package/chunks/{terminal-image-renderer-QQ4343Q3.js → terminal-image-renderer-QFO2JTTT.js} +18 -18
- package/chunks/{theme-manager-CNGZ6T4K.js → theme-manager-N7ILUTRY.js} +18 -18
- package/chunks/{tool-result-media-R2EWIHTZ.js → tool-result-media-OAHUKGRK.js} +7 -7
- package/chunks/{tool-search-WPQALMLE.js → tool-search-534QKE2X.js} +2 -2
- package/chunks/{total-session-admission-MXIAY76R.js → total-session-admission-EZJQKTPF.js} +21 -21
- package/chunks/{trustedFolders-ZQQ2ETMA.js → trustedFolders-4ZEV6RXD.js} +19 -19
- package/chunks/{update-relaunch-XVIHEJCH.js → update-relaunch-GB3SGRDP.js} +5 -5
- package/chunks/{updateCheck-YQBGCMNZ.js → updateCheck-DVAGAEQ4.js} +18 -18
- package/chunks/{upload-config-UW6QN3CL.js → upload-config-DMZVTDH7.js} +4 -4
- package/chunks/{useAutoAcceptIndicator-GKQRK7OB.js → useAutoAcceptIndicator-PTQBS42B.js} +24 -24
- package/chunks/{validateNonInterActiveAuth-JJTHAV5P.js → validateNonInterActiveAuth-DU3WXVSU.js} +46 -46
- package/chunks/{version-MZOCP6O7.js → version-PNMZGKCV.js} +1 -1
- package/chunks/{web-fetch-NX5NKVE3.js → web-fetch-LMCOAHW6.js} +2 -2
- package/chunks/{web-search-VLFIKS3K.js → web-search-N7RR74LA.js} +4 -4
- package/chunks/{workflow-EGMC2K5T.js → workflow-ZZPHI7FK.js} +12 -12
- package/chunks/{workspace-providers-status-KPBNO6UE.js → workspace-providers-status-TU73CNRF.js} +28 -28
- package/chunks/{workspace-registration-store-WWCOY7D7.js → workspace-registration-store-743FRSOU.js} +1 -1
- package/chunks/{workspace-registry-LAS7KJOK.js → workspace-registry-S7QTXFWM.js} +21 -21
- package/chunks/{workspace-runtime-coordinator-7VEYHXEU.js → workspace-runtime-coordinator-GWNDUIGO.js} +22 -22
- package/chunks/{workspace-service-OUE5MDOT.js → workspace-service-CERZFJ3B.js} +24 -24
- package/chunks/{workspace-skills-status-OHGY3ENO.js → workspace-skills-status-5M3EIAUY.js} +26 -26
- package/chunks/{workspace-trust-reconciler-E766QSRS.js → workspace-trust-reconciler-Q3LUKMQB.js} +26 -26
- package/chunks/{write-file-ZLRRA4ZT.js → write-file-CT54LXQL.js} +10 -10
- package/chunks/{zoom-image-EX3C2PMJ.js → zoom-image-EU3PGSZM.js} +2 -2
- package/cli.js +12 -12
- package/execution-worker.js +1 -1
- package/export-transcript-document.js +1 -1
- package/package.json +3 -3
- package/web-shell/assets/{abnfDiagram-VCTEODGH-Dbkc1x4g.js → abnfDiagram-VCTEODGH-DDYEvG-M.js} +1 -1
- package/web-shell/assets/{arc-BCuaHw2a.js → arc-DQncKWFX.js} +1 -1
- package/web-shell/assets/{architectureDiagram-5GKGNRK7-CYnlVHx4.js → architectureDiagram-5GKGNRK7-C0-8u9zj.js} +1 -1
- package/web-shell/assets/{blockDiagram-NRAW4CY4-fvsmUmR-.js → blockDiagram-NRAW4CY4-Cpt59Ge5.js} +1 -1
- package/web-shell/assets/{c4Diagram-UCG6FXSJ-BAjnpe2_.js → c4Diagram-UCG6FXSJ-BvESWh83.js} +1 -1
- package/web-shell/assets/channel-B88Zt8_x.js +1 -0
- package/web-shell/assets/{chunk-2Q5K7J3B-B92_XH72.js → chunk-2Q5K7J3B-wKulGIU6.js} +1 -1
- package/web-shell/assets/{chunk-5VM5RSS4-nFcltF2f.js → chunk-5VM5RSS4-BX6kRoq7.js} +1 -1
- package/web-shell/assets/{chunk-F27PBJKO-DuQ75APu.js → chunk-F27PBJKO-wA4IqTt-.js} +1 -1
- package/web-shell/assets/{chunk-G27WJ6UU-CmXIQ06U.js → chunk-G27WJ6UU-B7hzevlb.js} +1 -1
- package/web-shell/assets/{chunk-JWPE2WC7-pplos71B.js → chunk-JWPE2WC7-BdBg9pJg.js} +1 -1
- package/web-shell/assets/{chunk-LCL6LL3I-BHK6p5jT.js → chunk-LCL6LL3I-DghmF6LJ.js} +1 -1
- package/web-shell/assets/{chunk-POPQ4Y6H-Bw6egCVb.js → chunk-POPQ4Y6H-BbReTOod.js} +1 -1
- package/web-shell/assets/{chunk-SVP7TREG-BKSUyFl-.js → chunk-SVP7TREG-C1t0_19D.js} +1 -1
- package/web-shell/assets/{chunk-XXDRQBXY-DBK4vu_O.js → chunk-XXDRQBXY-DQBby5mI.js} +1 -1
- package/web-shell/assets/classDiagram-DTDB5LWJ-Dp-7ruHm.js +1 -0
- package/web-shell/assets/classDiagram-v2-JRS7N3AN-Dp-7ruHm.js +1 -0
- package/web-shell/assets/{cose-bilkent-JH36ORCC-D8AjDuhC.js → cose-bilkent-JH36ORCC-CNrSyg7B.js} +1 -1
- package/web-shell/assets/{cynefin-OW5HDTMX-F6ziGG13.js → cynefin-OW5HDTMX-DoxgDRN-.js} +1 -1
- package/web-shell/assets/{cynefinDiagram-5FMLGOSQ-1GrUeu9I.js → cynefinDiagram-5FMLGOSQ-BmUwbS8Q.js} +1 -1
- package/web-shell/assets/{dagre-3AP2YEHR-CUMduMoA.js → dagre-3AP2YEHR-BJrOVIjc.js} +1 -1
- package/web-shell/assets/{diagram-S7CK7UJ4-B0LbPx0Y.js → diagram-S7CK7UJ4-TDX4KU9V.js} +1 -1
- package/web-shell/assets/{diagram-UQ7AKVKN-Vl7zFXEJ.js → diagram-UQ7AKVKN-D3VUQkGl.js} +1 -1
- package/web-shell/assets/{diagram-VSXAHHWV-C4khzWQM.js → diagram-VSXAHHWV-CqCpgViy.js} +1 -1
- package/web-shell/assets/{diagram-VX7I27RA-PqprIzeP.js → diagram-VX7I27RA-CthqfwCs.js} +1 -1
- package/web-shell/assets/{diagram-Z3DM3KII-CbGTxGOI.js → diagram-Z3DM3KII-BRY3Ahvu.js} +1 -1
- package/web-shell/assets/{ebnfDiagram-PWID7BFC-CigwMsaO.js → ebnfDiagram-PWID7BFC-tJvTnIwp.js} +1 -1
- package/web-shell/assets/{erDiagram-SSCWMZ5O-L4s33GGv.js → erDiagram-SSCWMZ5O-DT4b7w5B.js} +1 -1
- package/web-shell/assets/{flowDiagram-A5DVABFB-D7mgIH88.js → flowDiagram-A5DVABFB-C5oirWSf.js} +1 -1
- package/web-shell/assets/{ganttDiagram-EL5Y4UJY-D0YhclTy.js → ganttDiagram-EL5Y4UJY-ZD3kNlO4.js} +1 -1
- package/web-shell/assets/{gitGraphDiagram-WWUBYQGX-Bwf59IHb.js → gitGraphDiagram-WWUBYQGX-Bp1sg_wH.js} +1 -1
- package/web-shell/assets/{index-C0YFCwlu.js → index-CpxLhWqx.js} +3 -3
- package/web-shell/assets/{index-CJ63h8ay.js → index-DSIzVof7.js} +1 -1
- package/web-shell/assets/{infoDiagram-RXCK75RN-T0Ewe5gl.js → infoDiagram-RXCK75RN-Btumz_CZ.js} +1 -1
- package/web-shell/assets/{ishikawaDiagram-5VMMS53U-BIdQGz1A.js → ishikawaDiagram-5VMMS53U-Dx8_uvso.js} +1 -1
- package/web-shell/assets/{journeyDiagram-EYS64GPL-BNxIYRys.js → journeyDiagram-EYS64GPL-DS5spUhj.js} +1 -1
- package/web-shell/assets/{kanban-definition-3QL26DDD-DCSrG78S.js → kanban-definition-3QL26DDD-DttC9d4D.js} +1 -1
- package/web-shell/assets/{layout-Br6mhJlI.js → layout-BDOJQJbX.js} +1 -1
- package/web-shell/assets/{linear-DCb_qQM9.js → linear-BsUVMxld.js} +1 -1
- package/web-shell/assets/{mermaid.core-U7MUxrwT.js → mermaid.core-De4-EW4Z.js} +6 -6
- package/web-shell/assets/{mindmap-definition-FBJOCRG2-B-E16G7A.js → mindmap-definition-FBJOCRG2-BsYY98Wv.js} +1 -1
- package/web-shell/assets/{pegDiagram-XKGWAZYB-DprVaT2C.js → pegDiagram-XKGWAZYB-DXnnQrVY.js} +1 -1
- package/web-shell/assets/{pieDiagram-E7YTZNPT-BpWhdw8B.js → pieDiagram-E7YTZNPT-DGLAGUYR.js} +1 -1
- package/web-shell/assets/{quadrantDiagram-AXDQQJYC-B_rgquel.js → quadrantDiagram-AXDQQJYC-Y8DcMTa5.js} +1 -1
- package/web-shell/assets/{railroadDiagram-O6MQD6OU-tn5q9Df1.js → railroadDiagram-O6MQD6OU-ZgauslUZ.js} +1 -1
- package/web-shell/assets/{requirementDiagram-EFPCY7ZU-DcXXYQ7a.js → requirementDiagram-EFPCY7ZU-Kxtu4twe.js} +1 -1
- package/web-shell/assets/{sankeyDiagram-P5KCCOFB-XFCBKj8s.js → sankeyDiagram-P5KCCOFB-BKsLF9EA.js} +1 -1
- package/web-shell/assets/{sequenceDiagram-WJ2MYXX4-C9HOvsOz.js → sequenceDiagram-WJ2MYXX4-D8sCv1NK.js} +1 -1
- package/web-shell/assets/{sizeCapture-X5ZJPWSS-BF4RFDcQ.js → sizeCapture-X5ZJPWSS-BX8sokZX.js} +1 -1
- package/web-shell/assets/{stateDiagram-HBIQ2CUA-CFvvXZXi.js → stateDiagram-HBIQ2CUA-DFMl58kv.js} +1 -1
- package/web-shell/assets/stateDiagram-v2-4QOOHH4V-B3HSbbo2.js +1 -0
- package/web-shell/assets/{swimlanes-XN3QIQJK-BeHFLDui.js → swimlanes-XN3QIQJK-BnMwURLN.js} +1 -1
- package/web-shell/assets/swimlanesDiagram-VK2B7HYN-FnO0SUMi.js +8 -0
- package/web-shell/assets/{timeline-definition-24CTP7MA-D563SQiU.js → timeline-definition-24CTP7MA-C8y77DDz.js} +1 -1
- package/web-shell/assets/{vennDiagram-4TSXK5OY-BmVC7Jer.js → vennDiagram-4TSXK5OY-DOWQgX9u.js} +1 -1
- package/web-shell/assets/{wardleyDiagram-VM6X3IG4-Dlzz2LC2.js → wardleyDiagram-VM6X3IG4-BM0AVIzE.js} +1 -1
- package/web-shell/assets/{xychartDiagram-S5SC5T6Z-CiOybQQL.js → xychartDiagram-S5SC5T6Z-B18-YghG.js} +1 -1
- package/web-shell/index.html +1 -1
- package/web-shell/sw.js +1 -1
- package/web-shell/assets/channel-BzQAUXQG.js +0 -1
- package/web-shell/assets/classDiagram-DTDB5LWJ-D8E4B_In.js +0 -1
- package/web-shell/assets/classDiagram-v2-JRS7N3AN-D8E4B_In.js +0 -1
- package/web-shell/assets/stateDiagram-v2-4QOOHH4V-1C9qvD3x.js +0 -1
- package/web-shell/assets/swimlanesDiagram-VK2B7HYN-H_KJGVAj.js +0 -8
|
@@ -1124,7 +1124,7 @@ ${n}`:n}function Bae(e){const t=e.data.indexOf(","),n=e.data.startsWith("data:")
|
|
|
1124
1124
|
</head><body><iframe title="${DR(t)}" src="${DR(e.href)}" sandbox="allow-scripts allow-same-origin allow-forms" referrerpolicy="no-referrer"></iframe></body></html>`}function hJ(e,t){const n=RD(t);if(fJ.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 xct=new Set([".doc",".docx",".docm",".dotx",".xls",".xlsx",".xlsm",".xlsb",".ppt",".pptx",".pptm",".odt",".ods",".odp"]),fJ=new Set([".m4a",".mp3",".ogg",".wav"]),kct=new Set([...xct,...fJ,".pdf",".mp4",".mov",".webm"]);function nIe(e){const t=RD(e.workspacePath),n=Qw(e.mimeType);return t===".svg"||n==="image/svg+xml"||kct.has(t)?!0:rIe(e)||t===".md"||t===".markdown"||t===".html"||t===".htm"||n==="text/markdown"||n==="text/html"?!1:e.kind==="image"||e.kind==="document"||e.kind==="pdf"||e.kind==="video"||e.kind==="audio"}function RD(e){const n=(e??"").split(/[?#]/,1)[0].split(/[/\\]/).pop()??"",s=n.lastIndexOf(".");return s>=0?n.slice(s).toLowerCase():""}function _ct(e,t){return fJ.has(RD(e))||Qw(t).startsWith("audio/")}const Sct="qwen.workspace.sha256";function zce(e){const t=e.metadata?.[Sct],n=typeof t=="string"?t:"";return`${e.status}:${e.updatedAt}:${n}`}function Cct(e){const t=e.metadata?.artifactType;return typeof t=="string"&&t?t:hJ(e.kind,e.workspacePath??e.url??e.title)}function AD(e){return e===void 0?"":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}const sIe={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"},Tct=100*1024*1024,Ict=256*1024;function Qw(e){return e?.split(";",1)[0]?.trim().toLowerCase()??""}function rIe(e){const t=Qw(e.mimeType);return t.startsWith("image/")?t==="image/jpg"?"image/jpeg":Object.values(sIe).includes(t)?t:void 0:Q_(e.workspacePath??"")}function Q_(e){const t=e.toLowerCase(),n=t.includes(".")?t.split(".").pop():void 0;return n?sIe[n]:void 0}function Ect(e){return/\.html?$/i.test(e)?"text/html":"text/markdown"}async function n4(e,t,n,s){const r=[],i=s.maxBytes??Tct,o=await s.statFile(t);if(s.isCancelled?.())throw new Error("File loading was cancelled.");if(o.type==="directory")throw new Error("Directories cannot be opened or downloaded as artifacts.");if(o.sizeBytes>i)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:Ict});if(s.isCancelled?.())throw new Error("File loading was cancelled.");if(c.sizeBytes!==o.sizeBytes)throw new Error("File changed while loading. Please retry.");if(c.returnedBytes<=0&&l<o.sizeBytes)throw new Error("File loading made no progress.");const u=atob(c.contentBase64),h=new Uint8Array(u.length);for(let f=0;f<u.length;f++)h[f]=u.charCodeAt(f);if(r.push(h),l=c.offset+c.returnedBytes,l>=o.sizeBytes){const f=await s.statFile(t);if(s.isCancelled?.())throw new Error("File loading was cancelled.");if(f.sizeBytes!==o.sizeBytes||f.modifiedMs!==o.modifiedMs)throw new Error("File changed while loading. Please retry.");return new Blob(r,{type:n})}}}async function jD(e,t,n="application/octet-stream",s){const r=await n4((o,l)=>e.readFileBytes(o,l),t,n,{statFile:o=>e.stat(o),isCancelled:s}),i=URL.createObjectURL(r);try{const o=document.createElement("a");o.href=i,o.download=Jw(t).split("/").at(-1)??t,document.body.appendChild(o),o.click(),o.remove()}finally{URL.revokeObjectURL(i)}}function iIe(e){return e.workspacePath??e.url??e.managedId??""}function Jw(e){const t=(e??"").replaceAll("\\","/").replace(/^\.\//,"").replace(/\/+$/,""),n=t.startsWith("/"),s=[];for(const i of t.split("/"))if(!(!i||i===".")){if(i===".."){s.length>0&&s.at(-1)!==".."?s.pop():n||s.push(i);continue}s.push(i)}const r=s.join("/");return n?`/${r}`:r}function U3(e,t){const n=Jw(e),s=Jw(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 pJ(e,t,n){const s=U3(e??"",n),r=U3(t??"",n);return!!s&&s===r}const BV="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 oIe(e,t){return FV(zV(e),t)}function FV(e,t){return`<!doctype html><html><head>
|
|
1125
1125
|
<meta http-equiv="Content-Security-Policy" content="${BV} frame-src 'none';">
|
|
1126
1126
|
<style>html,body,iframe{width:100%;height:100%;margin:0;border:0;display:block;overflow:hidden}</style>
|
|
1127
|
-
</head><body><iframe title="${DR(t)}" sandbox="allow-scripts" referrerpolicy="no-referrer" srcdoc="${DR(e)}"></iframe></body></html>`}let iN;async function Rct(e,t,n){if(iN?.content===e&&iN.title===t)return iN.document;const s=await Act(e,t,n);return iN={content:e,title:t,document:s},s}async function Act(e,t,n){if(typeof DOMParser>"u")return oIe(e,t);const s=new DOMParser().parseFromString(e,"text/html");if(!s.querySelector('script#transcript-document[type="application/json"]'))return FV(zV(s),t);const r=new AbortController,i=()=>r.abort();n.addEventListener("abort",i,{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([o,l,c,u])=>{const h=s.querySelector(o),f=h?.getAttribute(l)??"",p=h?.getAttribute("integrity")??"";if(!h)return;const m=`https://unpkg.com/@qwen-code/qwen-code@0.24.4/export-transcript-document.${c}`;if(f!==m||!/^sha384-[A-Za-z0-9+/]{64}$/.test(p))throw new Error("Unsupported export preview resource; use an export matching the current Web Shell version.");const g=await fetch(f,{integrity:p,signal:r.signal,credentials:"omit",referrerPolicy:"no-referrer",redirect:"error"});if(!g.ok)throw new Error(`Could not load export renderer (${g.status}).`);const v=new Blob([await g.arrayBuffer()],{type:u}),y=await new Promise((w,b)=>{const x=new FileReader;x.onload=()=>w(x.result),x.onerror=()=>b(x.error),x.readAsDataURL(v)});h.setAttribute(l,y),h.removeAttribute("integrity"),h.removeAttribute("crossorigin")}))}finally{n.removeEventListener("abort",i),r.abort()}return FV(zV(s),t)}function zV(e){if(typeof e=="string"&&typeof DOMParser>"u")return`<!doctype html><html><head><meta http-equiv="Content-Security-Policy" content="${BV}"></head><body>${jct(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=BV,t.head.prepend(n),`<!doctype html>${t.documentElement.outerHTML}`}function jct(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 aIe={csv:uct,file:dct,html:hct,image:fct,link:pct,md:mct,pdf:gct,spreadsheet:vct,video:wct,word:yct},Nct={csv:"csv",html:"html",image:"image",link:"link",markdown:"md",md:"md",pdf:"pdf",spreadsheet:"spreadsheet",video:"video",word:"word"},Mct={audio:aJ,document:t4,notebook:Oat},Hce={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 lIe(e){if(!e)return"file";const t=e.workspacePath??e.url??e.title,n=RD(t).slice(1);if(n&&Hce[n])return Hce[n];const s=Qw(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":Nct[e.kind]??"file"}function cIe({artifact:e,className:t}){const{artifact:n}=Md(),s=e?n?.renderImage?.(e):void 0;if(s!=null&&s!==!1)return s;const r=lIe(e),i=e?e.workspacePath??e.url??e.title:void 0,o=r==="file"&&e?_ct(i,e.mimeType)?"audio":e.kind:void 0,l=o?Mct[o]:void 0;return l?a.jsx(l,{className:t,"data-artifact-icon":o,"aria-hidden":"true"}):a.jsx("img",{className:t,src:aIe[r],"data-artifact-icon":r,alt:""})}const Pct=[[new Set(["json","jsonl","geojson"]),dit],[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"]),g7],[new Set(["zip","tar","gz","tgz","bz2","xz","7z","rar"]),uot],[new Set(["csv","tsv","xls","xlsx","ods"]),vot],[new Set(["ppt","pptx","odp"]),tlt],[new Set(["png","jpg","jpeg","gif","webp","bmp","ico","tif","tiff"]),P4e],[new Set(["mp3","wav","ogg","m4a","aac","flac"]),aJ],[new Set(["mp4","mov","webm","avi","mkv"]),L4e],[new Set(["txt","md","mdx","log","pdf","doc","docx","rtf"]),t4]];function Lct(e,t){const n=e.split(".").pop()?.toLowerCase()??"";for(const[s,r]of Pct)if(s.has(n))return r;return t?.startsWith("image/")?P4e:t?.startsWith("audio/")?aJ:t?.startsWith("video/")?L4e:t?.startsWith("text/")?t4:D4e}function vg({name:e,mimeType:t,size:n=24,absoluteStrokeWidth:s,...r}){const i=Lct(e,t),o=lIe({kind:"file",title:e.replace(/[?#]/g,"_"),mimeType:t});return o!=="file"||i===D4e?a.jsx("svg",{width:n,height:n,...r,"data-file-type-icon":o,children:a.jsx("image",{href:aIe[o],width:"100%",height:"100%"})}):a.jsx(i,{size:n,absoluteStrokeWidth:s,...r})}const Dct="_panel_19vsn_1",Oct="_floating_19vsn_16",$ct="_section_19vsn_26",Bct="_sectionHeader_19vsn_40",Fct="_sectionHeaderRow_19vsn_59",zct="_sectionAction_19vsn_70",Hct="_sectionContent_19vsn_111",Uct="_row_19vsn_115",qct="_workspaceIcon_19vsn_158",Wct="_rowActionIcon_19vsn_162",Vct="_label_19vsn_168",Gct="_branchName_19vsn_173",Kct="_value_19vsn_181",Yct="_tasks_19vsn_191",Xct="_task_19vsn_191",Zct="_taskIcon_19vsn_229",Qct="_taskLabel_19vsn_240",Jct="_agentName_19vsn_248",eut="_taskName_19vsn_249",tut="_agentColor_19vsn_260",nut="_agentTag_19vsn_269",sut="_taskStatus_19vsn_280",rut="_statusRunning_19vsn_301",iut="_attachmentFiles_19vsn_311",out="_attachmentFile_19vsn_311",aut="_attachmentFileIcon_19vsn_344",lut="_attachmentFileName_19vsn_348",cut="_emptyDescription_19vsn_356",uut="_sourceTitle_19vsn_363",wr={panel:Dct,floating:Oct,section:$ct,sectionHeader:Bct,sectionHeaderRow:Fct,sectionAction:zct,sectionContent:Hct,row:Uct,workspaceIcon:qct,rowActionIcon:Wct,label:Vct,branchName:Gct,value:Kct,tasks:Yct,task:Xct,taskIcon:Zct,taskLabel:Qct,agentName:Jct,taskName:eut,agentColor:tut,agentTag:nut,taskStatus:sut,statusRunning:rut,attachmentFiles:iut,attachmentFile:out,attachmentFileIcon:aut,attachmentFileName:lut,emptyDescription:cut,sourceTitle:uut};function uIe({entries:e,onOpen:t}){const{t:n}=lt();return a.jsx("ul",{className:wr.attachmentFiles,children:e.map(s=>a.jsx("li",{children:a.jsxs("button",{type:"button",className:wr.attachmentFile,title:$ce(s),"aria-label":s.type==="source"?`${n("sources.open")} ${Oce(s)}`:void 0,disabled:!t,onClick:()=>t?.(s),children:[s.type==="source"&&s.source.kind==="link"?a.jsx(B4e,{size:16,strokeWidth:1.7,className:wr.attachmentFileIcon}):a.jsx(vg,{name:$ce(s),mimeType:s.type==="attachment"?s.attachment.mimeType:void 0,size:16,strokeWidth:1.7,className:wr.attachmentFileIcon,"aria-hidden":"true"}),a.jsx("span",{className:wr.attachmentFileName,children:Oce(s)})]})},b8(s)))})}function O0({className:e,...t}){return a.jsx("div",{"data-slot":"skeleton",className:Fn("animate-pulse rounded-md bg-muted",e),...t})}function dut(){return typeof window>"u"?!1:new URLSearchParams(window.location.search).get("addSource")==="1"}function hut({hidden:e=!1,state:t,attachments:n=[],attachmentsLoading:s=!1,attachmentsError:r,onRetryAttachments:i,onOpen:o,retryRegistration:l,onDialogOpenChange:c,onReadImage:u,onImagePreview:h,onAttachmentPreview:f,onAttachmentPreviewError:p}){const{t:m}=lt(),[g,v]=d.useState(!1),[y,w]=d.useState(!1);d.useEffect(()=>{e&&w(!1)},[e]),d.useEffect(()=>{w(!1),v(!1)},[t?.owner,t?.supported]),d.useEffect(()=>(c?.(y&&t?.supported===!0),()=>c?.(!1)),[y,c,t?.supported]);const b=t?.supported?t.sources:[],x=Q4e(b,n);if(!t?.supported&&!x.length&&!s&&!r)return null;const k=s||t?.supported&&t.loading;return a.jsxs("section",{className:wr.section,"aria-label":m("sources.title"),"data-testid":"sources-section",children:[a.jsxs("div",{className:wr.sectionHeaderRow,children:[a.jsxs("h3",{className:`${wr.sectionHeader} ${wr.sourceTitle}`,children:[m("sources.title")," ",a.jsx("span",{className:"text-muted-foreground",children:x.length})]}),t?.supported&&dut()&&a.jsx("button",{type:"button",className:wr.sectionAction,"aria-label":m("sources.add"),onClick:()=>w(!0),children:a.jsx(ah,{})})]}),l&&a.jsxs("div",{className:wr.emptyDescription,role:"alert",children:[m("sources.registrationFailed")," ",a.jsx(ht,{size:"sm",variant:"link",onClick:()=>void l(),children:m("common.retry")})]}),t?.supported&&t.error&&a.jsxs("div",{className:"mt-2 text-xs text-destructive",role:"alert",children:[t.error," ",a.jsx(ht,{size:"sm",variant:"link",onClick:()=>void t.refresh(),children:m("common.retry")})]}),r&&a.jsxs("div",{className:"mt-2 text-xs text-destructive",role:"alert",children:[m("sources.attachmentsLoadFailed",{error:r})," ",a.jsx(ht,{size:"sm",variant:"link",onClick:i,children:m("common.retry")})]}),a.jsx(uIe,{entries:g?x:x.slice(0,3),onOpen:S=>dIe(S,{onOpen:o,onReadImage:u,onImagePreview:h,onAttachmentPreview:f,onAttachmentPreviewError:p})}),k&&!x.length&&a.jsx("ul",{className:wr.attachmentFiles,"data-testid":"environment-file-list-skeleton",role:"status","aria-label":m("common.loading"),children:[72,88,64].map(S=>a.jsxs("li",{className:wr.attachmentFile,children:[a.jsx(O0,{className:"size-4 shrink-0 rounded-sm"}),a.jsx(O0,{className:"h-4",style:{width:`${S}%`}})]},S))}),!k&&!x.length&&t?.hydrated&&!t.error&&!r&&a.jsx("p",{className:wr.emptyDescription,children:m("sources.empty")}),x.length>3&&a.jsx("button",{type:"button",className:wr.attachmentFile,"aria-expanded":g,onClick:()=>v(S=>!S),children:m(g?"common.collapse":"sources.viewAll")}),y&&t?.supported&&a.jsx(fut,{state:t,onClose:()=>w(!1)})]})}function fut({state:e,onClose:t}){const{t:n}=lt(),[s,r]=d.useState("workspace_file"),[i,o]=d.useState(""),[l,c]=d.useState(""),[u,h]=d.useState(""),[f,p]=d.useState(),[m,g]=d.useState(!1),v=async()=>{g(!0),p(void 0);try{const y=s==="url"?new URL(i).hostname:i.split(/[\\/]/).at(-1)||i,w=s==="workspace_file"?{type:s,workspacePath:i}:{type:s,url:i};await e.upsert({title:l.trim()||y.trim().slice(0,200),locator:w,...u?{description:u}:{}}),e.owner.isCurrent()&&t()}catch(y){e.owner.isCurrent()&&p(y instanceof Error?y.message:String(y))}finally{e.owner.isCurrent()&&g(!1)}};return a.jsx(Xo,{title:n("sources.add"),subtitle:n("sources.explanation"),onClose:t,size:"sm",children:a.jsxs("form",{className:"flex flex-col gap-3",onSubmit:y=>{y.preventDefault(),v()},children:[a.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[n("sources.type"),a.jsxs("select",{className:"h-8 rounded-lg border border-input bg-background px-2",value:s,onChange:y=>{r(y.target.value),o(""),p(void 0)},children:[a.jsx("option",{value:"workspace_file",children:n("sources.workspaceFile")}),a.jsx("option",{value:"url",children:n("sources.link")})]})]}),a.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[n("sources.location"),a.jsx(Vr,{value:i,onChange:y=>o(y.target.value),required:!0,maxLength:s==="url"?2048:500,placeholder:s==="url"?"https://example.com":"docs/requirements.md"})]}),a.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[n("sources.name"),a.jsx(Vr,{value:l,maxLength:200,onChange:y=>c(y.target.value)})]}),a.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[n("sources.description"),a.jsx(Vr,{value:u,maxLength:1e3,onChange:y=>h(y.target.value)})]}),f&&a.jsx("div",{role:"alert",className:"text-xs text-destructive",children:f}),a.jsx(ht,{type:"submit",disabled:m||!i,children:n("sources.add")})]})})}function dIe(e,t){if(e.type==="source"){t.onOpen?.(e.source);return}const n=e.attachment;if(n.type==="image"){t.onReadImage?.(n.attachmentId).then(s=>t.onImagePreview?.(s,n.attachmentId,{kind:"attachment",attachmentId:n.attachmentId})).catch(s=>t.onAttachmentPreviewError?.(s));return}t.onAttachmentPreview?.({name:n.attachmentId,mimeType:n.mimeType,attachmentId:n.attachmentId})}/**
|
|
1127
|
+
</head><body><iframe title="${DR(t)}" sandbox="allow-scripts" referrerpolicy="no-referrer" srcdoc="${DR(e)}"></iframe></body></html>`}let iN;async function Rct(e,t,n){if(iN?.content===e&&iN.title===t)return iN.document;const s=await Act(e,t,n);return iN={content:e,title:t,document:s},s}async function Act(e,t,n){if(typeof DOMParser>"u")return oIe(e,t);const s=new DOMParser().parseFromString(e,"text/html");if(!s.querySelector('script#transcript-document[type="application/json"]'))return FV(zV(s),t);const r=new AbortController,i=()=>r.abort();n.addEventListener("abort",i,{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([o,l,c,u])=>{const h=s.querySelector(o),f=h?.getAttribute(l)??"",p=h?.getAttribute("integrity")??"";if(!h)return;const m=`https://unpkg.com/@qwen-code/qwen-code@0.24.5-preview.0/export-transcript-document.${c}`;if(f!==m||!/^sha384-[A-Za-z0-9+/]{64}$/.test(p))throw new Error("Unsupported export preview resource; use an export matching the current Web Shell version.");const g=await fetch(f,{integrity:p,signal:r.signal,credentials:"omit",referrerPolicy:"no-referrer",redirect:"error"});if(!g.ok)throw new Error(`Could not load export renderer (${g.status}).`);const v=new Blob([await g.arrayBuffer()],{type:u}),y=await new Promise((w,b)=>{const x=new FileReader;x.onload=()=>w(x.result),x.onerror=()=>b(x.error),x.readAsDataURL(v)});h.setAttribute(l,y),h.removeAttribute("integrity"),h.removeAttribute("crossorigin")}))}finally{n.removeEventListener("abort",i),r.abort()}return FV(zV(s),t)}function zV(e){if(typeof e=="string"&&typeof DOMParser>"u")return`<!doctype html><html><head><meta http-equiv="Content-Security-Policy" content="${BV}"></head><body>${jct(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=BV,t.head.prepend(n),`<!doctype html>${t.documentElement.outerHTML}`}function jct(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 aIe={csv:uct,file:dct,html:hct,image:fct,link:pct,md:mct,pdf:gct,spreadsheet:vct,video:wct,word:yct},Nct={csv:"csv",html:"html",image:"image",link:"link",markdown:"md",md:"md",pdf:"pdf",spreadsheet:"spreadsheet",video:"video",word:"word"},Mct={audio:aJ,document:t4,notebook:Oat},Hce={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 lIe(e){if(!e)return"file";const t=e.workspacePath??e.url??e.title,n=RD(t).slice(1);if(n&&Hce[n])return Hce[n];const s=Qw(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":Nct[e.kind]??"file"}function cIe({artifact:e,className:t}){const{artifact:n}=Md(),s=e?n?.renderImage?.(e):void 0;if(s!=null&&s!==!1)return s;const r=lIe(e),i=e?e.workspacePath??e.url??e.title:void 0,o=r==="file"&&e?_ct(i,e.mimeType)?"audio":e.kind:void 0,l=o?Mct[o]:void 0;return l?a.jsx(l,{className:t,"data-artifact-icon":o,"aria-hidden":"true"}):a.jsx("img",{className:t,src:aIe[r],"data-artifact-icon":r,alt:""})}const Pct=[[new Set(["json","jsonl","geojson"]),dit],[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"]),g7],[new Set(["zip","tar","gz","tgz","bz2","xz","7z","rar"]),uot],[new Set(["csv","tsv","xls","xlsx","ods"]),vot],[new Set(["ppt","pptx","odp"]),tlt],[new Set(["png","jpg","jpeg","gif","webp","bmp","ico","tif","tiff"]),P4e],[new Set(["mp3","wav","ogg","m4a","aac","flac"]),aJ],[new Set(["mp4","mov","webm","avi","mkv"]),L4e],[new Set(["txt","md","mdx","log","pdf","doc","docx","rtf"]),t4]];function Lct(e,t){const n=e.split(".").pop()?.toLowerCase()??"";for(const[s,r]of Pct)if(s.has(n))return r;return t?.startsWith("image/")?P4e:t?.startsWith("audio/")?aJ:t?.startsWith("video/")?L4e:t?.startsWith("text/")?t4:D4e}function vg({name:e,mimeType:t,size:n=24,absoluteStrokeWidth:s,...r}){const i=Lct(e,t),o=lIe({kind:"file",title:e.replace(/[?#]/g,"_"),mimeType:t});return o!=="file"||i===D4e?a.jsx("svg",{width:n,height:n,...r,"data-file-type-icon":o,children:a.jsx("image",{href:aIe[o],width:"100%",height:"100%"})}):a.jsx(i,{size:n,absoluteStrokeWidth:s,...r})}const Dct="_panel_19vsn_1",Oct="_floating_19vsn_16",$ct="_section_19vsn_26",Bct="_sectionHeader_19vsn_40",Fct="_sectionHeaderRow_19vsn_59",zct="_sectionAction_19vsn_70",Hct="_sectionContent_19vsn_111",Uct="_row_19vsn_115",qct="_workspaceIcon_19vsn_158",Wct="_rowActionIcon_19vsn_162",Vct="_label_19vsn_168",Gct="_branchName_19vsn_173",Kct="_value_19vsn_181",Yct="_tasks_19vsn_191",Xct="_task_19vsn_191",Zct="_taskIcon_19vsn_229",Qct="_taskLabel_19vsn_240",Jct="_agentName_19vsn_248",eut="_taskName_19vsn_249",tut="_agentColor_19vsn_260",nut="_agentTag_19vsn_269",sut="_taskStatus_19vsn_280",rut="_statusRunning_19vsn_301",iut="_attachmentFiles_19vsn_311",out="_attachmentFile_19vsn_311",aut="_attachmentFileIcon_19vsn_344",lut="_attachmentFileName_19vsn_348",cut="_emptyDescription_19vsn_356",uut="_sourceTitle_19vsn_363",wr={panel:Dct,floating:Oct,section:$ct,sectionHeader:Bct,sectionHeaderRow:Fct,sectionAction:zct,sectionContent:Hct,row:Uct,workspaceIcon:qct,rowActionIcon:Wct,label:Vct,branchName:Gct,value:Kct,tasks:Yct,task:Xct,taskIcon:Zct,taskLabel:Qct,agentName:Jct,taskName:eut,agentColor:tut,agentTag:nut,taskStatus:sut,statusRunning:rut,attachmentFiles:iut,attachmentFile:out,attachmentFileIcon:aut,attachmentFileName:lut,emptyDescription:cut,sourceTitle:uut};function uIe({entries:e,onOpen:t}){const{t:n}=lt();return a.jsx("ul",{className:wr.attachmentFiles,children:e.map(s=>a.jsx("li",{children:a.jsxs("button",{type:"button",className:wr.attachmentFile,title:$ce(s),"aria-label":s.type==="source"?`${n("sources.open")} ${Oce(s)}`:void 0,disabled:!t,onClick:()=>t?.(s),children:[s.type==="source"&&s.source.kind==="link"?a.jsx(B4e,{size:16,strokeWidth:1.7,className:wr.attachmentFileIcon}):a.jsx(vg,{name:$ce(s),mimeType:s.type==="attachment"?s.attachment.mimeType:void 0,size:16,strokeWidth:1.7,className:wr.attachmentFileIcon,"aria-hidden":"true"}),a.jsx("span",{className:wr.attachmentFileName,children:Oce(s)})]})},b8(s)))})}function O0({className:e,...t}){return a.jsx("div",{"data-slot":"skeleton",className:Fn("animate-pulse rounded-md bg-muted",e),...t})}function dut(){return typeof window>"u"?!1:new URLSearchParams(window.location.search).get("addSource")==="1"}function hut({hidden:e=!1,state:t,attachments:n=[],attachmentsLoading:s=!1,attachmentsError:r,onRetryAttachments:i,onOpen:o,retryRegistration:l,onDialogOpenChange:c,onReadImage:u,onImagePreview:h,onAttachmentPreview:f,onAttachmentPreviewError:p}){const{t:m}=lt(),[g,v]=d.useState(!1),[y,w]=d.useState(!1);d.useEffect(()=>{e&&w(!1)},[e]),d.useEffect(()=>{w(!1),v(!1)},[t?.owner,t?.supported]),d.useEffect(()=>(c?.(y&&t?.supported===!0),()=>c?.(!1)),[y,c,t?.supported]);const b=t?.supported?t.sources:[],x=Q4e(b,n);if(!t?.supported&&!x.length&&!s&&!r)return null;const k=s||t?.supported&&t.loading;return a.jsxs("section",{className:wr.section,"aria-label":m("sources.title"),"data-testid":"sources-section",children:[a.jsxs("div",{className:wr.sectionHeaderRow,children:[a.jsxs("h3",{className:`${wr.sectionHeader} ${wr.sourceTitle}`,children:[m("sources.title")," ",a.jsx("span",{className:"text-muted-foreground",children:x.length})]}),t?.supported&&dut()&&a.jsx("button",{type:"button",className:wr.sectionAction,"aria-label":m("sources.add"),onClick:()=>w(!0),children:a.jsx(ah,{})})]}),l&&a.jsxs("div",{className:wr.emptyDescription,role:"alert",children:[m("sources.registrationFailed")," ",a.jsx(ht,{size:"sm",variant:"link",onClick:()=>void l(),children:m("common.retry")})]}),t?.supported&&t.error&&a.jsxs("div",{className:"mt-2 text-xs text-destructive",role:"alert",children:[t.error," ",a.jsx(ht,{size:"sm",variant:"link",onClick:()=>void t.refresh(),children:m("common.retry")})]}),r&&a.jsxs("div",{className:"mt-2 text-xs text-destructive",role:"alert",children:[m("sources.attachmentsLoadFailed",{error:r})," ",a.jsx(ht,{size:"sm",variant:"link",onClick:i,children:m("common.retry")})]}),a.jsx(uIe,{entries:g?x:x.slice(0,3),onOpen:S=>dIe(S,{onOpen:o,onReadImage:u,onImagePreview:h,onAttachmentPreview:f,onAttachmentPreviewError:p})}),k&&!x.length&&a.jsx("ul",{className:wr.attachmentFiles,"data-testid":"environment-file-list-skeleton",role:"status","aria-label":m("common.loading"),children:[72,88,64].map(S=>a.jsxs("li",{className:wr.attachmentFile,children:[a.jsx(O0,{className:"size-4 shrink-0 rounded-sm"}),a.jsx(O0,{className:"h-4",style:{width:`${S}%`}})]},S))}),!k&&!x.length&&t?.hydrated&&!t.error&&!r&&a.jsx("p",{className:wr.emptyDescription,children:m("sources.empty")}),x.length>3&&a.jsx("button",{type:"button",className:wr.attachmentFile,"aria-expanded":g,onClick:()=>v(S=>!S),children:m(g?"common.collapse":"sources.viewAll")}),y&&t?.supported&&a.jsx(fut,{state:t,onClose:()=>w(!1)})]})}function fut({state:e,onClose:t}){const{t:n}=lt(),[s,r]=d.useState("workspace_file"),[i,o]=d.useState(""),[l,c]=d.useState(""),[u,h]=d.useState(""),[f,p]=d.useState(),[m,g]=d.useState(!1),v=async()=>{g(!0),p(void 0);try{const y=s==="url"?new URL(i).hostname:i.split(/[\\/]/).at(-1)||i,w=s==="workspace_file"?{type:s,workspacePath:i}:{type:s,url:i};await e.upsert({title:l.trim()||y.trim().slice(0,200),locator:w,...u?{description:u}:{}}),e.owner.isCurrent()&&t()}catch(y){e.owner.isCurrent()&&p(y instanceof Error?y.message:String(y))}finally{e.owner.isCurrent()&&g(!1)}};return a.jsx(Xo,{title:n("sources.add"),subtitle:n("sources.explanation"),onClose:t,size:"sm",children:a.jsxs("form",{className:"flex flex-col gap-3",onSubmit:y=>{y.preventDefault(),v()},children:[a.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[n("sources.type"),a.jsxs("select",{className:"h-8 rounded-lg border border-input bg-background px-2",value:s,onChange:y=>{r(y.target.value),o(""),p(void 0)},children:[a.jsx("option",{value:"workspace_file",children:n("sources.workspaceFile")}),a.jsx("option",{value:"url",children:n("sources.link")})]})]}),a.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[n("sources.location"),a.jsx(Vr,{value:i,onChange:y=>o(y.target.value),required:!0,maxLength:s==="url"?2048:500,placeholder:s==="url"?"https://example.com":"docs/requirements.md"})]}),a.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[n("sources.name"),a.jsx(Vr,{value:l,maxLength:200,onChange:y=>c(y.target.value)})]}),a.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[n("sources.description"),a.jsx(Vr,{value:u,maxLength:1e3,onChange:y=>h(y.target.value)})]}),f&&a.jsx("div",{role:"alert",className:"text-xs text-destructive",children:f}),a.jsx(ht,{type:"submit",disabled:m||!i,children:n("sources.add")})]})})}function dIe(e,t){if(e.type==="source"){t.onOpen?.(e.source);return}const n=e.attachment;if(n.type==="image"){t.onReadImage?.(n.attachmentId).then(s=>t.onImagePreview?.(s,n.attachmentId,{kind:"attachment",attachmentId:n.attachmentId})).catch(s=>t.onAttachmentPreviewError?.(s));return}t.onAttachmentPreview?.({name:n.attachmentId,mimeType:n.mimeType,attachmentId:n.attachmentId})}/**
|
|
1128
1128
|
* @license
|
|
1129
1129
|
* Copyright 2026 Qwen Team
|
|
1130
1130
|
* SPDX-License-Identifier: Apache-2.0
|
|
@@ -1644,7 +1644,7 @@ License: MIT
|
|
|
1644
1644
|
})();`,_Ct=`<!doctype html>
|
|
1645
1645
|
<html><head><meta charset="utf-8"><meta http-equiv="Content-Security-Policy" content="${bCt}"></head>
|
|
1646
1646
|
<body><script>${kCt}<\/script></body></html>`;function SCt(){const e=globalThis.crypto;if(!e?.getRandomValues)throw new As("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 khe(){return new DOMException("The temporary legacy chart operation was aborted","AbortError")}function CCt(e){if(e.signal.aborted)return Promise.reject(khe());if(!Number.isSafeInteger(e.timeoutMs)||e.timeoutMs<=0)return Promise.reject(new As("SCHEMA_INVALID","Legacy sandbox timeout must be a positive safe integer"));if(typeof document>"u"||!document.body)return Promise.reject(new As("LEGACY_SANDBOX_UNAVAILABLE","The temporary legacy sandbox requires a browser document body"));const t=SCt(),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=_Ct,new Promise((s,r)=>{let i=!1,o=!1,l;const c=()=>{window.removeEventListener("message",p),e.signal.removeEventListener("abort",f),n.onload=null,n.onerror=null,l!==void 0&&clearTimeout(l),n.remove()},u=(m,g)=>{i||(i=!0,c(),m(g))},h=m=>{i||(i=!0,c(),r(m))},f=()=>h(khe()),p=m=>{if(!(m.source!==n.contentWindow||!zo(m.data))&&!(m.data.channel!==FG||m.data.requestId!==t)){if(m.data.type==="error"){h(new As("LEGACY_SANDBOX_EXECUTION_FAILED","Temporary legacy chart source failed in the isolated worker"));return}if(m.data.type==="result")try{const g=hEe(m.data.option);if(!zo(g))throw new As("SCHEMA_INVALID","Temporary legacy chart source must produce a JSON object option");u(s,g)}catch(g){h(g)}}};window.addEventListener("message",p),e.signal.addEventListener("abort",f,{once:!0}),n.onerror=()=>h(new As("LEGACY_SANDBOX_EXECUTION_FAILED","Temporary legacy chart sandbox failed to load")),n.onload=()=>{if(!o){if(o=!0,n.onload=null,i||e.signal.aborted){f();return}n.contentWindow?.postMessage({channel:FG,type:"execute",requestId:t,source:e.source,inputData:e.inputData},"*")}},l=setTimeout(()=>h(new As("LEGACY_SANDBOX_TIMEOUT",`Temporary legacy chart sandbox exceeded ${e.timeoutMs}ms`)),e.timeoutMs),document.body.append(n)})}var Z3e=class extends Error{constructor(t,n,s){super(n,s&&"cause"in s?{cause:s.cause}:void 0);Ge(this,"code");Ge(this,"cause");this.name="LegacySandboxError",this.code=t,this.cause=s?.cause}},TCt=Object.freeze({maxArtifactContentBytes:5*1024*1024,maxRows:2e3,maxColumns:200,maxCells:4e4,executionTimeoutMs:5e3});function ICt(e,t){const n={...TCt,...e,...t};for(const[s,r]of Object.entries(n))if(!Number.isSafeInteger(r)||r<=0)throw new As("SCHEMA_INVALID",`legacyArtifactLimits.${s} must be a positive safe integer`);return n}async function Q3e(e){let t;try{t=await e.resolveContent()}catch(i){throw e.signal.aborted||e.preserveLegacySandboxError&&i instanceof Z3e?i:new As("REF_RESOLUTION_FAILED",e.resolutionError,{cause:i})}if(typeof t!="string")throw new As("SCHEMA_INVALID",e.returnTypeError);if(e.signal.aborted)throw new DOMException("The temporary legacy chart operation was aborted","AbortError");const n=gCt(t,e.limits),s=yCt(e.source);if(!s)throw new As("SCHEMA_INVALID","Temporary legacy chart source is empty after sanitization");const r=await CCt({source:s,inputData:n.source,signal:e.signal,timeoutMs:e.limits.executionTimeoutMs});return{data:n,spec:r}}async function ECt(e){return Q3e({source:e.block.source,signal:e.signal,limits:e.limits,resolveContent:()=>e.resolveArtifactContent({language:e.block.language,jobId:e.block.jobId,index:e.block.index,signal:e.signal}),resolutionError:"The temporary ChatBI ArtifactContent could not be resolved",returnTypeError:"resolveLegacyArtifactContent must return the raw CSV ArtifactContent string",preserveLegacySandboxError:e.preserveLegacySandboxError===!0})}async function RCt(e){return Q3e({source:e.block.source,signal:e.signal,limits:e.limits,resolveContent:()=>e.resolveSandboxFileContent({language:e.block.language,filePath:e.block.filePath,signal:e.signal}),resolutionError:"The temporary ChatBI sandbox file could not be resolved",returnTypeError:"resolveLegacySandboxFileContent must return a raw CSV string",preserveLegacySandboxError:e.preserveLegacySandboxError===!0})}var ACt=Object.freeze({maxRows:2e3,maxCells:4e4,maxSeries:100,maxDepth:40,maxNodes:1e5}),jCt=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"]),NCt=new Set(["__proto__","prototype","constructor","extracsstext","renderitem","graphic","image","toolbox","dataview","transform","link","sublink","href","src","url"]),MCt=/(?:url|uri|href|src|link)$/i,PCt=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/,_he=/(?:^|[\s("'=])(?:https?:|file:|ftp:|blob:|data:|javascript:|vbscript:|\/\/|image:\/\/)/i,LCt=/\burl\s*\(/i,DCt=/<\s*\/?\s*[a-z][^>]*>/i,OCt=/&(?:#\d+|#x[\da-f]+|[a-z][\da-z]+);/i,$Ct=/^[A-Za-z_][A-Za-z0-9_]*$/;function ea(e){throw new As("SCHEMA_INVALID",e)}function zG(e,t,n){for(const s of Object.keys(e))t.has(s)||ea(`${n}.${s} is not allowed`)}function She(e,t){if(!Array.isArray(e)||e.length===0)return ea(`${t} must be a non-empty array`);const n=e.map((s,r)=>typeof s!="string"||!$Ct.test(s)?ea(`${t}[${r}] must be a stable ASCII identifier`):s);return new Set(n).size!==n.length?ea(`${t} must not contain duplicate dimensions`):n}function BCt(e,t){if(!zo(e)||typeof e.kind!="string")return ea("echarts-fulldata.data must be an inline or ref dataset object");if(e.kind==="inline"){zG(e,new Set(["kind","dimensions","source"]),"echarts-fulldata.data");const n=She(e.dimensions,"echarts-fulldata.data.dimensions");if(!Array.isArray(e.source))return ea("echarts-fulldata.data.source must be an array");e.source.forEach((r,i)=>{Array.isArray(r)||ea(`echarts-fulldata.data.source[${i}] must be an array`),r.length!==n.length&&ea(`echarts-fulldata.data.source[${i}] must contain ${n.length} cells`)});const s=sO(e.source,t,"echarts-fulldata.data.source");return{kind:"inline",dimensions:n,source:s}}if(e.kind==="ref"){if(zG(e,new Set(["kind","ref","format","dimensions"]),"echarts-fulldata.data"),typeof e.ref!="string"||e.ref.trim().length===0)return ea("echarts-fulldata.data.ref must be a non-empty string");if(e.format!=="csv"&&e.format!=="json")return ea("echarts-fulldata.data.format must be csv or json");const n=She(e.dimensions,"echarts-fulldata.data.dimensions");return{kind:"ref",ref:e.ref,format:e.format,dimensions:n}}return ea(`Unsupported echarts-fulldata.data.kind: ${e.kind}`)}function J3e(e){const t=Array.isArray(e.title),n=t?e.title:[e.title];for(const[s,r]of n.entries()){if(!zo(r)||typeof r.text!="string")continue;const i=r.text.trim();if(i)return{index:s,isArray:t,title:r,text:i}}}function FCt(e){return J3e(e)?.text}function zCt(e,t){const n=J3e(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 ty(e){return Array.isArray(e)?e.map(t=>ty(t)):zo(e)?Object.fromEntries(Object.entries(e).map(([t,n])=>[t,ty(n)])):e}function e5e(e,t){if(e!==void 0)return(!Array.isArray(e)||e.some(n=>typeof n!="string"||n.length===0))&&ea(`${t} must be an array of non-empty strings`),[...e]}function sO(e,t,n){if(Array.isArray(e)||ea(`${n} must be an array`),e.length>t.maxRows)throw new As("LIMIT_EXCEEDED",`${n} exceeds the ${t.maxRows} row limit`);let s=0;const r=e.map((i,o)=>{if(Array.isArray(i)){const l=i.map((c,u)=>(c!==null&&!["string","number","boolean"].includes(typeof c)&&ea(`${n}[${o}][${u}] must be a JSON scalar`),c));return s+=l.length,l}if(zo(i)){const l={};for(const[c,u]of Object.entries(i))u!==null&&!["string","number","boolean"].includes(typeof u)&&ea(`${n}[${o}].${c} must be a JSON scalar`),l[c]=u,s+=1;return l}return ea(`${n}[${o}] must be an array or object`)});if(s>t.maxCells)throw new As("LIMIT_EXCEEDED",`${n} exceeds the ${t.maxCells} cell limit`);return r}function HCt(e,t){if(!zo(e)||typeof e.kind!="string")return ea("echarts.data must be an inline or ref dataset object");const n=e5e(e.dimensions,"echarts.data.dimensions");if(e.kind==="inline"){const s=sO(e.source,t,"echarts.data.source");return n?{kind:"inline",dimensions:n,source:s}:{kind:"inline",source:s}}return e.kind==="ref"?typeof e.ref!="string"||e.ref.length===0?ea("echarts.data.ref must be a non-empty string"):e.format!==void 0&&e.format!=="csv"&&e.format!=="json"?ea("echarts.data.format must be csv or json"):{kind:"ref",ref:e.ref,...e.format?{format:e.format}:{},...n?{dimensions:n}:{}}:ea(`Unsupported echarts.data.kind: ${e.kind}`)}function Che(e,t){if(PCt.test(e))throw new As("UNSAFE_SPEC",`${t} contains an ASCII control character`);const n=e.replace(/[\n\r\t]/g,""),s=e.trim();if(_he.test(s)||_he.test(n.trim())||LCt.test(e)||DCt.test(e)||OCt.test(e))throw new As("UNSAFE_SPEC",`${t} contains a URL, CSS URL, or unsafe markup`)}function UCt(e,t){for(const r of Object.keys(e))if(!jCt.has(r))throw new As("UNSAFE_SPEC",`echarts.option.${r} is not allowed`);let n=0;const s=(r,i,o)=>{if(n+=1,n>t.maxNodes)throw new As("LIMIT_EXCEEDED",`ECharts option exceeds the ${t.maxNodes} node limit`);if(o>t.maxDepth)throw new As("LIMIT_EXCEEDED",`ECharts option exceeds the ${t.maxDepth} depth limit`);if(typeof r=="string"){Che(r,i);return}if(Array.isArray(r)){r.forEach((l,c)=>s(l,`${i}[${c}]`,o+1));return}if(zo(r))for(const[l,c]of Object.entries(r)){const u=l.toLowerCase();if(u==="formatter"){if(typeof c!="string")throw new As("UNSAFE_SPEC",`${i}.${l} must be a string`);Che(c,`${i}.${l}`);continue}if(NCt.has(u)||MCt.test(l))throw new As("UNSAFE_SPEC",`${i}.${l} is not allowed`);if(l==="type"&&c==="custom")throw new As("UNSAFE_SPEC","Custom ECharts series are not allowed");s(c,`${i}.${l}`,o+1)}};if(s(e,"echarts.option",0),Array.isArray(e.series)&&e.series.length>t.maxSeries)throw new As("LIMIT_EXCEEDED",`ECharts option exceeds the ${t.maxSeries} series limit`);e.dataset!==void 0&&(Array.isArray(e.dataset)?e.dataset:[e.dataset]).forEach((i,o)=>{zo(i)||ea(`echarts.option.dataset[${o}] must be an object`),i.source!==void 0&&sO(i.source,t,`echarts.option.dataset[${o}].source`)})}function HG(e,t,n){if(!zo(e))return ea("ECharts specification must be an object");if(Object.prototype.hasOwnProperty.call(e,"option")||Object.prototype.hasOwnProperty.call(e,"data"))return ea("Canonical markdown-chart data must be a sibling of spec; spec must contain the ECharts option directly");const s=ty(e),r=t===void 0?void 0:HCt(t,n);return r&&Object.prototype.hasOwnProperty.call(s,"dataset")?ea("echarts.option.dataset cannot be combined with echarts.data"):(UCt(s,n),{option:s,data:r})}function qCt(e,t){if(!zo(e))return ea("echarts-fulldata must contain an object");if(zG(e,new Set(["version","data","option"]),"echarts-fulldata"),e.version!==1)throw new As("UNSUPPORTED_VERSION","Only echarts-fulldata version 1 is supported");if(!Object.prototype.hasOwnProperty.call(e,"data"))return ea("echarts-fulldata.data is required");if(!zo(e.option))return ea("echarts-fulldata.option must be an object");const n=BCt(e.data,t);return HG(e.option,n,t)}function WCt(e){const t="default"in e?e.default:e;if(!t||typeof t.init!="function")throw new As("RUNTIME_LOAD_FAILED","The supplied ECharts runtime has no init function");return t}function The(e,t){const n=sO(e.source,t,"resolvedDataset.source"),s=e.dimensions?e5e(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 VCt={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 hg(e,t){const n={...ty(e),...t};for(const[s,r]of Object.entries(e)){const i=t[s];zo(r)&&zo(i)&&(n[s]=hg(r,i))}return n}function ZE(e,t){return Array.isArray(e)?e.map(n=>zo(n)?hg(t,n):n):zo(e)?hg(t,e):e??ty(t)}function t5e(e){const t=n=>zo(n)?{...n,appendToBody:!1,confine:!0,enterable:!1,renderMode:"richText"}:n;return Array.isArray(e)?e.map(t):t(e)}function n5(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function GCt(e,t){const n=s=>{if(!n5(s,"top")&&!n5(s,"bottom"))return hg(t,s);const r=ty(t);return delete r.top,delete r.bottom,hg(r,s)};return Array.isArray(e)?e.map(s=>zo(s)?n(s):s):zo(e)?n(e):e??ty(t)}var KCt=740,n5e=10,Ihe=KCt*n5e/100,YCt=24,XCt=24,Ehe=16,ZCt=24;function s5e(e){if(typeof e=="number")return Number.isFinite(e)&&e>=0&&e<=Ihe?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<=n5e?Ihe:null}function QCt(e){return["text","subtext"].some(t=>typeof e[t]=="string"&&e[t].trim().length>0)}function JCt(e){return e.show===!1||!QCt(e)?null:n5(e,"top")?s5e(e.top):n5(e,"bottom")?null:0}function e2t(e){return e.show===!1||!n5(e,"top")?null:s5e(e.top)}function Rhe(e){return Array.isArray(e)?e.filter(zo):zo(e)?[e]:[]}function t2t(e,t){const n=Rhe(e).flatMap(r=>{const i=JCt(r);return i===null?[]:[i+YCt+Ehe]}),s=Rhe(t).flatMap(r=>{const i=e2t(r);return i===null?[]:[i+XCt+Ehe]});return Math.max(ZCt,...n,...s)}function Ahe(e,t){return Array.isArray(e)?e.map((n,s)=>zo(n)?hg(t(s),n):n):zo(e)?hg(t(0),e):e}function jhe(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=hg(s,{lineStyle:{width:2},itemStyle:{borderWidth:1},symbol:"circle",symbolSize:4}):n==="bar"?s=hg(s,{barCategoryGap:"48%",barMaxWidth:42,itemStyle:{borderRadius:[3,3,0,0]}}):n==="pie"&&(s=hg(s,{itemStyle:{borderColor:t.seriesBorder,borderWidth:2}}));const r=hg(s,e);return Object.prototype.hasOwnProperty.call(e,"tooltip")&&(r.tooltip=t5e(ZE(e.tooltip,{appendToBody:!1,confine:!0,enterable:!1,renderMode:"richText"}))),r}var r5e=new Set(["pie","funnel","gauge","radar","treemap"]),n2t=new Set([...r5e,"graph","chord","themeRiver"]);function i5e(e){return Array.isArray(e.series)?e.series.filter(zo):zo(e.series)?[e.series]:[]}function s2t(e){if(Object.prototype.hasOwnProperty.call(e,"legend"))return!0;const t=i5e(e);return t.some(n=>typeof n.type=="string"&&n2t.has(n.type))?!0:t.filter(n=>typeof n.name=="string"&&n.name.trim().length>0).length>1}function r2t(e){if(!Object.prototype.hasOwnProperty.call(e,"xAxis")&&!Object.prototype.hasOwnProperty.call(e,"yAxis"))return"item";const t=i5e(e);return t.length>0&&t.every(n=>typeof n.type=="string"&&r5e.has(n.type))?"item":"axis"}function i2t(e){return e==null||e==="light"?"light":e==="dark"?"dark":void 0}function o2t(e,t="light"){const n=VCt[t],s=ty(e);return s.backgroundColor??=n.background,s.color??=[...n.palette],s.textStyle=ZE(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=ZE(s.title,{textStyle:{color:n.titleText},subtextStyle:{color:n.subtext}})),s.tooltip=t5e(ZE(s.tooltip,{trigger:r2t(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}}})),s2t(e)&&(s.legend=GCt(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=ZE(s.grid,{top:t2t(s.title,s.legend),right:36,bottom:48,left:24,containLabel:!0}),s.xAxis!==void 0&&(s.xAxis=Ahe(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=Ahe(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=>zo(r)?jhe(r,n):r):zo(s.series)&&(s.series=jhe(s.series,n)),s}var dH={dispose(){}};function a2t(e={}){const t={...ACt,...e.limits},n=e.legacySandbox?.resolveLegacyArtifactContent,s=e.legacySandbox?.resolveLegacySandboxFileContent,r=e.legacySandbox?ICt({maxRows:t.maxRows,maxCells:t.maxCells},void 0):void 0,i=e.loadECharts??(async()=>await He(()=>import("./index-DohPy72Z.js"),[])),o=async(l,c)=>{if(e.validateDataRef&&!e.validateDataRef(l.ref))throw new As("REF_REJECTED","The host rejected the chart data reference");if(!e.resolveDataRef)throw new As("REF_RESOLVER_MISSING","A resolveDataRef callback is required");let u;try{u=await e.resolveDataRef(l.ref,{format:l.format,dimensions:l.dimensions,signal:c})}catch(f){if(c.aborted)return;throw new As("REF_RESOLUTION_FAILED","The chart dataset could not be resolved",{cause:f})}if(c.aborted)return;const h=u.dimensions||!l.dimensions?u:{...u,dimensions:l.dimensions};return The(h,t).data};return{id:"echarts",aliases:["echarts-fulldata"],matchLanguage:hCt,parse(l,c){return c.language==="echarts-fulldata"?qCt(l,t):HG(l,c.data,t)},parseSource(l,c){return X3e(c.language)?{option:{},data:void 0,legacyEChartSandboxFile:pCt(c.rawLanguage??c.language,l)}:{option:{},data:void 0,legacyEChartQuery:fCt(c.language,l)}},getTitle(l){return FCt(l.option)},async materialize(l,c){if(!l.legacyEChartQuery&&!l.legacyEChartSandboxFile){if(l.data?.kind==="ref"){const p=await o(l.data,c.signal);return p?{parsed:{...l,data:p},data:p}:{parsed:l,data:c.data}}return{parsed:l,data:l.data}}if(l.legacyEChartQuery&&!n)throw new As("REF_RESOLVER_MISSING","legacySandbox is required for this temporary ChatBI query fence");if(l.legacyEChartSandboxFile&&!s)throw new As("REF_RESOLVER_MISSING","legacySandbox is required for this temporary ChatBI sandbox-file fence");let u;try{l.legacyEChartSandboxFile?u=await RCt({block:l.legacyEChartSandboxFile,signal:c.signal,resolveSandboxFileContent:s,limits:r,preserveLegacySandboxError:e.legacySandbox!==void 0}):u=await ECt({block:l.legacyEChartQuery,signal:c.signal,resolveArtifactContent:n,limits:r,preserveLegacySandboxError:!0})}catch(p){if(c.signal.aborted)return{parsed:l,data:c.data};throw p instanceof As||p instanceof Z3e?p:new As("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=hEe(u,{maxDepth:t.maxDepth,maxNodes:t.maxNodes})}catch(p){throw p instanceof As?p:new As("SCHEMA_INVALID","Temporary ChatBI resolver returned a non-JSON result",{cause:p})}if(!zo(h))return ea("Temporary ChatBI resolver must return an object");if(!Object.prototype.hasOwnProperty.call(h,"data")||!Object.prototype.hasOwnProperty.call(h,"spec"))return ea("Temporary ChatBI resolver must return data and spec");const f=HG(h.spec,h.data,t);return f.data?.kind!=="inline"?ea("Temporary ChatBI resolver must return inline data"):{parsed:f,data:f.data}},async mount(l,c,u){if(c.legacyEChartQuery||c.legacyEChartSandboxFile)return ea("Temporary ChatBI charts must be materialized before mounting");const h=ty(c.option);if(u.externalizedTitle&&zCt(h,u.externalizedTitle),c.data){let y;if(c.data.kind==="inline")y=c.data;else{const b=await o(c.data,u.signal);if(!b)return dH;y=b}const w=The(y,t);h.dataset=w.option}if(u.signal.aborted)return dH;let f;try{f=WCt(await i())}catch(y){throw y instanceof As?y:new As("RUNTIME_LOAD_FAILED","The ECharts runtime could not be loaded",{cause:y})}if(u.signal.aborted)return dH;let p,m;try{const y=typeof u.theme=="string"||zo(u.theme)?u.theme:void 0;p=f.init(l,y);const w=i2t(u.theme),b=e.defaultStyle===!1||!w?h:o2t(h,w);p.setOption(b,{notMerge:!0,lazyUpdate:!1}),e.resizeObserver!==!1&&typeof ResizeObserver<"u"&&(m=new ResizeObserver(()=>p?.resize()),m.observe(l))}catch(y){try{m?.disconnect()}catch{}try{p?.dispose()}catch{}throw new As("RENDER_FAILED","ECharts failed to render the chart",{cause:y})}const g=p;let v=!1;return{resize:()=>g.resize(),dispose(){v||(v=!0,m?.disconnect(),g.dispose())}}}}}var bee=d.createContext(null);function l2t(e){if(d.isValidElement(e))return typeof e.props.children=="string"?e.props.children:void 0}function c2t(e){const t=e.source??l2t(e.children),n=d.useMemo(()=>({registry:e.registry,theme:e.theme,streaming:e.streaming??!1,source:t,loadingLabel:e.loadingLabel,labels:e.labels,onError:e.onError}),[e.registry,e.theme,e.streaming,t,e.loadingLabel,e.labels,e.onError]);return d.createElement(bee.Provider,{value:n},e.children)}function u2t(e){const t=d.useContext(bee);if(!t)throw new Error("MarkdownChartBlock must be rendered inside MarkdownChartProvider");const n=d.useRef(null),s=e.streaming??t.streaming,r=e.loadingLabel??t.loadingLabel,i=e.labels??t.labels,o=d.useMemo(()=>pEe(i),[i]);d.useEffect(()=>{const c=n.current;if(!c)return;const u=new _gt(t.registry);let h=!1;return u.render(c,{language:e.language,source:e.source,theme:t.theme,streaming:s,...r!==void 0?{loadingLabel:r}:{},...i!==void 0?{labels:i}:{}}).catch(f=>{h||(c.classList.add("markdown-chart-error"),c.setAttribute("role","alert"),c.textContent=o.chartUnavailable,t.onError?.(f,{language:e.language,source:e.source}))}),()=>{h=!0,u.dispose()}},[t.registry,t.theme,t.onError,r,i,o,e.language,e.source,s]);const l=["markdown-chart-placeholder",s?"markdown-chart-streaming":void 0,e.className].filter(Boolean).join(" ");return d.createElement("div",{ref:n,className:l,style:e.style,"aria-label":o.chart,"aria-busy":s||void 0,"data-markdown-chart-complete":String(!s)})}function d2t(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(`
|
|
1647
|
-
`,Math.max(0,n-1))+1,i=e.slice(r,n),o=/^(?: {0,3}>[ \t]?)+$/.test(i)?r:n;return gEe(e.slice(o,s))||e.slice(s).trim().length>0}function o5e(e,t){return e===_8||t?.has(e)===!0}function h2t(e={}){return{code({node:n,...s}){return d.createElement("code",s)},pre:function({node:s,children:r,...i}){const o=d.useContext(bee);if(d.isValidElement(r)){const l=r,u=/(?:^|\s)language-([^\s]+)/.exec(l.props.className??"")?.[1],h=u?.toLowerCase();if(u&&h&&o5e(h,o?.registry)){const f=d.Children.toArray(l.props.children).map(p=>typeof p=="string"||typeof p=="number"?String(p):"").join("");return d.createElement(u2t,{language:u,source:f,streaming:o?.streaming===!0&&!d2t(o.source,s),...e.chartClassName?{className:e.chartClassName}:{},...e.chartStyle?{style:e.chartStyle}:{}})}}return d.createElement("pre",i,r)}}}const f2t=3e4,p2t=["artifact://","session-file://"],m2t=/^[a-z]:/i;function g2t(e={}){const{resolveDataRef:t,validateDataRef:n=x2t,...s}=e,r=e.validateDataRef===void 0,i=t?async(o,l)=>{const c=r?a5e(o):o;if(!c)throw new Error("Chart data reference is not supported.");return k2t(Promise.resolve(t(c,l)),"Chart data reference resolution")}:void 0;return new agt().register(a2t({...s,resolveDataRef:i,validateDataRef:n}))}const v2t={registry:g2t()};function w2t(e,t={}){const n=h2t(t).pre;if(!n)throw new Error("markdown-chart React adapter did not provide a pre renderer");return function({children:r,...i}){if(d.isValidElement(r)){const o=r,c=/(?:^|\s)language-([^\s]+)/.exec(o.props.className??"")?.[1]?.toLowerCase();if(c&&o5e(c,e))return d.createElement(n,i,r)}return d.createElement(d.Fragment,null,r)}}function y2t({customization:e,source:t,streaming:n,theme:s,children:r}){const i=b2t(e.labels),{t:o}=lt();return a.jsx(c2t,{registry:e.registry,source:t,streaming:n,theme:s,loadingLabel:e.loadingLabel??o("echartsChart.rendering"),labels:i,onError:e.onError,children:r})}function b2t(e){const{t}=lt();return d.useMemo(()=>({chartUnavailable:t("echartsChart.renderFailed"),viewMode:t("echartsChart.viewMode"),chart:t("echartsChart.chart"),data:t("echartsChart.data"),showChart:t("echartsChart.showChart"),showData:t("echartsChart.showData"),noData:t("echartsChart.noData"),tableNotice:({visibleRows:n,totalRows:s,visibleColumns:r,totalColumns:i})=>t("echartsChart.tableNotice",{visibleRows:n,totalRows:s,visibleColumns:r,totalColumns:i,omittedRows:s-n,omittedColumns:i-r}),...e}),[e,t])}function Nhe(e){return/\s/.test(e)||Array.from(e).some(t=>{const n=t.codePointAt(0);return n!==void 0&&(n<=31||n===127)})}function a5e(e){if(e.trim()!==e||!e||Nhe(e))return;const t=e.toLowerCase(),n=p2t.find(o=>t.startsWith(o));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)||Nhe(r))return;const i=r.split("/");if(!i.some(o=>o.length===0||o==="."||o===".."||m2t.test(o)))return`${n}${i.join("/")}`}function x2t(e){return a5e(e)!==void 0}function k2t(e,t){return new Promise((n,s)=>{const r=globalThis.setTimeout(()=>s(new Error(`${t} timed out.`)),f2t);e.then(n,s).finally(()=>globalThis.clearTimeout(r))})}const _2t="_content_1ns4y_1",S2t="_streamingPlainText_1ns4y_11",C2t="_inlineCode_1ns4y_135",T2t="_link_1ns4y_147",I2t="_tableWrapper_1ns4y_157",E2t="_table_1ns4y_157",R2t="_image_1ns4y_187",A2t="_codeBlock_1ns4y_195",j2t="_codeBlockHeader_1ns4y_204",N2t="_codeBlockLang_1ns4y_213",M2t="_codeBlockCopy_1ns4y_221",P2t="_codeBlockContent_1ns4y_244",L2t="_codeBlockPlain_1ns4y_264",D2t="_mermaidBlock_1ns4y_282",O2t="_mermaidInline_1ns4y_294",$2t="_mermaidStage_1ns4y_308",B2t="_mermaidLoading_1ns4y_331",F2t="_mermaidActions_1ns4y_338",z2t="_mermaidZoomWrapper_1ns4y_343",H2t="_mermaidPannable_1ns4y_358",U2t="_mermaidDragging_1ns4y_362",Ti={content:_2t,streamingPlainText:S2t,inlineCode:C2t,link:T2t,tableWrapper:I2t,table:E2t,image:R2t,codeBlock:A2t,codeBlockHeader:j2t,codeBlockLang:N2t,codeBlockCopy:M2t,codeBlockContent:P2t,codeBlockPlain:L2t,mermaidBlock:D2t,mermaidInline:O2t,mermaidStage:$2t,mermaidLoading:B2t,mermaidActions:F2t,mermaidZoomWrapper:z2t,mermaidPannable:H2t,mermaidDragging:U2t},q2t=32e3,W2t=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"]),Mhe={"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 xee(e){const t=(e||"").toLowerCase(),n=Object.hasOwn(Mhe,t)?Mhe[t]:t,s=W2t.has(n)?n:"text";return{label:(e||"").trim()||"text",lang:n,resolvedLang:s}}const l5e=/^(https?:|mailto:)/i,V2t=/^data:image\/(png|jpeg|gif|webp|bmp);base64,/i,c5e=/^data:image\/(png|jpeg|gif|webp);base64,[A-Za-z0-9+/]*={0,2}$/i;function d4(e){if(!e)return!1;const t=e.trim();return t?t.startsWith("#")||t.startsWith("/")&&!t.startsWith("//")?!0:l5e.test(t):!1}function xv(e,t=!1){if(!e)return!1;const n=e.trim();return n?t?c5e.test(n):n.startsWith("#")||n.startsWith("/")&&!n.startsWith("//")||V2t.test(n)?!0:l5e.test(n):!1}let Phe,Lhe=Promise.resolve(),G2t=0;const K2t=5e4,Y2t=500,X2t=1e4,Dhe=16;function Z2t({code:e}){const{t}=lt(),n=gy(),s=Qa()!=="interactive",[r,i]=d.useState(null),[o,l]=d.useState(null),[c,u]=d.useState("diagram"),[h,f]=R1(),[p,m]=d.useState(1),[g,v]=d.useState(!1),y=d.useRef(null),[w,b]=d.useState(!1),[x,k]=d.useState(!1),[S,T]=d.useState(null),E=d.useRef(null),A=d.useRef(null),C=n==="light"?"default":"dark",I=.5,R=3,N=.25,j=()=>{m(X=>Math.min(R,Math.round((X+N)*100)/100))},P=()=>{m(X=>Math.max(I,Math.round((X-N)*100)/100))},D=d.useCallback(()=>{A.current=null,v(!1),m(1);const X=y.current;X&&(X.scrollLeft=0,X.scrollTop=0),b(!1)},[]),M=d.useCallback(X=>{const ee=y.current;ee&&(X.preventDefault(),v(!0),A.current={startX:X.clientX,startY:X.clientY,startLeft:ee.scrollLeft,startTop:ee.scrollTop})},[]),q=d.useCallback(X=>{const{scrollLeft:ee,scrollTop:H}=X.currentTarget;b(ee!==0||H!==0)},[]),V=d.useCallback(()=>{const X=y.current;X&&(k(X.scrollWidth>X.clientWidth||X.scrollHeight>X.clientHeight),b(X.scrollLeft!==0||X.scrollTop!==0))},[]),z=d.useCallback(()=>{const X=y.current,ee=E.current?.querySelector("svg");if(!X||!ee)return;const[,,H,Q]=(ee.getAttribute("viewBox")??"").split(/[\s,]+/).map(Number),de=(ee.getAttribute("width")??"").trim(),ve=Number.parseFloat(ee.getAttribute("height")??""),B=H>0&&Q>0,G=B?H:Number.parseFloat(de),W=B?Q:ve;if(!(G>0)||!(W>0)){T(null);return}const F=X.clientWidth-Dhe*2,pe=de.endsWith("%")&&F>0?Math.min(G,F):G,J=Math.max(0,X.offsetHeight-X.clientHeight);T({stageWidth:pe,canvasHeight:pe*W/G+Dhe*2+J})},[]);d.useEffect(()=>{if(!g)return;const X=H=>{const Q=y.current,de=A.current;!Q||!de||(Q.scrollLeft=de.startLeft-(H.clientX-de.startX),Q.scrollTop=de.startTop-(H.clientY-de.startY),b(Q.scrollLeft!==0||Q.scrollTop!==0))},ee=()=>{A.current=null,v(!1)};return window.addEventListener("mousemove",X),window.addEventListener("mouseup",ee),window.addEventListener("blur",ee),()=>{window.removeEventListener("mousemove",X),window.removeEventListener("mouseup",ee),window.removeEventListener("blur",ee)}},[g]),d.useEffect(()=>{D()},[e,D]),d.useLayoutEffect(()=>{z(),V()},[r,p,c,z,V]),d.useEffect(()=>{const X=y.current;if(!X)return;const ee=new ResizeObserver(()=>{z(),V()});return ee.observe(X),()=>ee.disconnect()},[r,c,z,V]),d.useEffect(()=>{let X=!1;i(null),l(null);const ee=setTimeout(()=>{He(()=>import("./mermaid.core-U7MUxrwT.js").then(H=>H.cb),[]).then(async H=>{if(X)return;const Q=H.default,de=`${C}:${s?"hardened":"runtime"}`,ve=Lhe.then(async()=>{if(X)throw new Error("Mermaid render skipped");Phe!==de&&(Q.initialize({startOnLoad:!1,theme:C,securityLevel:"strict",suppressErrorRendering:!0,...s?{maxTextSize:K2t,maxEdges:Y2t}:{},flowchart:{wrappingWidth:300,useMaxWidth:!1}}),Phe=de);const G=`mermaid-${++G2t}`;if(!s)return Q.render(G,e.trim());let W;try{return await Promise.race([Q.render(G,e.trim()),new Promise((F,pe)=>{W=setTimeout(()=>pe(new Error("Mermaid render timed out")),X2t)})])}finally{W!==void 0&&clearTimeout(W)}});Lhe=ve.then(()=>{},()=>{});const{svg:B}=await ve;X||i(B)}).catch(H=>{X||l(H instanceof Error?H.message:"Mermaid render failed")})},150);return()=>{X=!0,clearTimeout(ee)}},[e,s,C]);const L=()=>{Hh(e).then(()=>{f()}).catch(wg)};return o?a.jsxs("div",{className:Ti.codeBlock,children:[a.jsx("div",{className:Ti.codeBlockHeader,children:a.jsx("span",{className:Ti.codeBlockLang,children:t("mermaid.errorLabel")})}),a.jsx("pre",{className:`${Ti.codeBlockContent} ${Ti.codeBlockPlain}`,children:a.jsx("code",{children:e})})]}):a.jsxs("div",{className:Ti.codeBlock,children:[a.jsxs("div",{className:Ti.codeBlockHeader,children:[a.jsx("span",{className:Ti.codeBlockLang,children:t("mermaid.label")}),a.jsxs("span",{className:Ti.mermaidActions,children:[c==="diagram"&&a.jsxs(a.Fragment,{children:[a.jsx("button",{className:Ti.codeBlockCopy,onClick:P,title:t("mermaid.zoomOut"),disabled:p<=I,children:t("mermaid.zoomOut")}),a.jsx("button",{className:Ti.codeBlockCopy,onClick:D,title:t("mermaid.zoomReset"),disabled:p===1&&!w,children:t("mermaid.zoomReset")}),a.jsx("button",{className:Ti.codeBlockCopy,onClick:j,title:t("mermaid.zoomIn"),disabled:p>=R,children:t("mermaid.zoomIn")})]}),a.jsx("button",{className:Ti.codeBlockCopy,onClick:()=>u(c==="diagram"?"code":"diagram"),children:t(c==="diagram"?"mermaid.viewCode":"mermaid.viewDiagram")}),a.jsx("button",{className:Ti.codeBlockCopy,onClick:L,children:t(h?"code.copied":"code.copy")})]})]}),c==="code"?a.jsx("pre",{className:`${Ti.codeBlockContent} ${Ti.codeBlockPlain}`,children:a.jsx("code",{children:e})}):r?a.jsx("div",{className:`${Ti.mermaidZoomWrapper} ${x?Ti.mermaidPannable:""} ${x&&g?Ti.mermaidDragging:""}`,ref:y,style:S?{height:S.canvasHeight}:void 0,onMouseDown:M,onDoubleClick:D,onScroll:q,children:a.jsx("div",{className:`${Ti.mermaidBlock} ${Ti.mermaidStage}`,ref:E,style:{...S?{width:S.stageWidth}:{},...p===1?{}:{zoom:p}},dangerouslySetInnerHTML:{__html:r}})}):a.jsx("div",{className:`${Ti.mermaidBlock} ${Ti.mermaidLoading} ${Ti.mermaidInline}`,children:a.jsx("span",{children:t("mermaid.rendering")})})]})}function Q2t({className:e,children:t,isStreaming:n}){const{t:s}=lt(),r=gy(),i=Qa()==="document",[o,l]=d.useState(null),[c,u]=R1(),{label:h,lang:f,resolvedLang:p}=xee(u5e(e)),m=String(t).replace(/\n$/,""),g=r==="light"?"github-light-default":"github-dark-default";d.useEffect(()=>{if(i||n||f==="mermaid"||p==="text"||DG(m)){l(null);return}const y=Kkt(m,p,g);if(y!==null){l(y);return}const w=fhe(m,p,g,!0);if(w!==null){l(w);return}l(null);let b=!1;return N3e(p).then(()=>{if(b)return;const x=fhe(m,p,g,!0);x!==null&&l(x)}).catch(x=>{b||(console.warn("[web-shell] highlight failed for lang=%s",p,x),l(null))}),()=>{b=!0}},[m,i,f,p,g,n]);const v=()=>{Hh(m).then(()=>{u()}).catch(wg)};return f==="mermaid"&&!n&&!i?a.jsx(Z2t,{code:m}):a.jsxs("div",{className:Ti.codeBlock,children:[a.jsxs("div",{className:Ti.codeBlockHeader,children:[a.jsx("span",{className:Ti.codeBlockLang,children:h}),a.jsx("button",{className:Ti.codeBlockCopy,onClick:v,children:s(c?"code.copied":"code.copy")})]}),!i&&!n&&o!==null?a.jsx("div",{className:Ti.codeBlockContent,dangerouslySetInnerHTML:{__html:o}}):a.jsx("pre",{className:`${Ti.codeBlockContent} ${Ti.codeBlockPlain}`,children:a.jsx("code",{children:m})})]})}function u5e(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 J2t({children:e}){return a.jsx("code",{className:Ti.inlineCode,children:e})}function Ohe({children:e}){return a.jsx("div",{className:Ti.tableWrapper,children:a.jsx("table",{className:Ti.table,children:e})})}const d5e=d.createContext(!1),h5e=d.createContext(void 0),f5e=d.createContext(void 0);function eTt(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:!gEe(e.slice(s,r))&&e.slice(r).trim().length===0}function tTt({className:e,children:t,node:n}){const s=d.useContext(d5e),r=d.useContext(f5e);return e?.startsWith("language-")||typeof t=="string"&&t.includes(`
|
|
1647
|
+
`,Math.max(0,n-1))+1,i=e.slice(r,n),o=/^(?: {0,3}>[ \t]?)+$/.test(i)?r:n;return gEe(e.slice(o,s))||e.slice(s).trim().length>0}function o5e(e,t){return e===_8||t?.has(e)===!0}function h2t(e={}){return{code({node:n,...s}){return d.createElement("code",s)},pre:function({node:s,children:r,...i}){const o=d.useContext(bee);if(d.isValidElement(r)){const l=r,u=/(?:^|\s)language-([^\s]+)/.exec(l.props.className??"")?.[1],h=u?.toLowerCase();if(u&&h&&o5e(h,o?.registry)){const f=d.Children.toArray(l.props.children).map(p=>typeof p=="string"||typeof p=="number"?String(p):"").join("");return d.createElement(u2t,{language:u,source:f,streaming:o?.streaming===!0&&!d2t(o.source,s),...e.chartClassName?{className:e.chartClassName}:{},...e.chartStyle?{style:e.chartStyle}:{}})}}return d.createElement("pre",i,r)}}}const f2t=3e4,p2t=["artifact://","session-file://"],m2t=/^[a-z]:/i;function g2t(e={}){const{resolveDataRef:t,validateDataRef:n=x2t,...s}=e,r=e.validateDataRef===void 0,i=t?async(o,l)=>{const c=r?a5e(o):o;if(!c)throw new Error("Chart data reference is not supported.");return k2t(Promise.resolve(t(c,l)),"Chart data reference resolution")}:void 0;return new agt().register(a2t({...s,resolveDataRef:i,validateDataRef:n}))}const v2t={registry:g2t()};function w2t(e,t={}){const n=h2t(t).pre;if(!n)throw new Error("markdown-chart React adapter did not provide a pre renderer");return function({children:r,...i}){if(d.isValidElement(r)){const o=r,c=/(?:^|\s)language-([^\s]+)/.exec(o.props.className??"")?.[1]?.toLowerCase();if(c&&o5e(c,e))return d.createElement(n,i,r)}return d.createElement(d.Fragment,null,r)}}function y2t({customization:e,source:t,streaming:n,theme:s,children:r}){const i=b2t(e.labels),{t:o}=lt();return a.jsx(c2t,{registry:e.registry,source:t,streaming:n,theme:s,loadingLabel:e.loadingLabel??o("echartsChart.rendering"),labels:i,onError:e.onError,children:r})}function b2t(e){const{t}=lt();return d.useMemo(()=>({chartUnavailable:t("echartsChart.renderFailed"),viewMode:t("echartsChart.viewMode"),chart:t("echartsChart.chart"),data:t("echartsChart.data"),showChart:t("echartsChart.showChart"),showData:t("echartsChart.showData"),noData:t("echartsChart.noData"),tableNotice:({visibleRows:n,totalRows:s,visibleColumns:r,totalColumns:i})=>t("echartsChart.tableNotice",{visibleRows:n,totalRows:s,visibleColumns:r,totalColumns:i,omittedRows:s-n,omittedColumns:i-r}),...e}),[e,t])}function Nhe(e){return/\s/.test(e)||Array.from(e).some(t=>{const n=t.codePointAt(0);return n!==void 0&&(n<=31||n===127)})}function a5e(e){if(e.trim()!==e||!e||Nhe(e))return;const t=e.toLowerCase(),n=p2t.find(o=>t.startsWith(o));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)||Nhe(r))return;const i=r.split("/");if(!i.some(o=>o.length===0||o==="."||o===".."||m2t.test(o)))return`${n}${i.join("/")}`}function x2t(e){return a5e(e)!==void 0}function k2t(e,t){return new Promise((n,s)=>{const r=globalThis.setTimeout(()=>s(new Error(`${t} timed out.`)),f2t);e.then(n,s).finally(()=>globalThis.clearTimeout(r))})}const _2t="_content_1ns4y_1",S2t="_streamingPlainText_1ns4y_11",C2t="_inlineCode_1ns4y_135",T2t="_link_1ns4y_147",I2t="_tableWrapper_1ns4y_157",E2t="_table_1ns4y_157",R2t="_image_1ns4y_187",A2t="_codeBlock_1ns4y_195",j2t="_codeBlockHeader_1ns4y_204",N2t="_codeBlockLang_1ns4y_213",M2t="_codeBlockCopy_1ns4y_221",P2t="_codeBlockContent_1ns4y_244",L2t="_codeBlockPlain_1ns4y_264",D2t="_mermaidBlock_1ns4y_282",O2t="_mermaidInline_1ns4y_294",$2t="_mermaidStage_1ns4y_308",B2t="_mermaidLoading_1ns4y_331",F2t="_mermaidActions_1ns4y_338",z2t="_mermaidZoomWrapper_1ns4y_343",H2t="_mermaidPannable_1ns4y_358",U2t="_mermaidDragging_1ns4y_362",Ti={content:_2t,streamingPlainText:S2t,inlineCode:C2t,link:T2t,tableWrapper:I2t,table:E2t,image:R2t,codeBlock:A2t,codeBlockHeader:j2t,codeBlockLang:N2t,codeBlockCopy:M2t,codeBlockContent:P2t,codeBlockPlain:L2t,mermaidBlock:D2t,mermaidInline:O2t,mermaidStage:$2t,mermaidLoading:B2t,mermaidActions:F2t,mermaidZoomWrapper:z2t,mermaidPannable:H2t,mermaidDragging:U2t},q2t=32e3,W2t=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"]),Mhe={"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 xee(e){const t=(e||"").toLowerCase(),n=Object.hasOwn(Mhe,t)?Mhe[t]:t,s=W2t.has(n)?n:"text";return{label:(e||"").trim()||"text",lang:n,resolvedLang:s}}const l5e=/^(https?:|mailto:)/i,V2t=/^data:image\/(png|jpeg|gif|webp|bmp);base64,/i,c5e=/^data:image\/(png|jpeg|gif|webp);base64,[A-Za-z0-9+/]*={0,2}$/i;function d4(e){if(!e)return!1;const t=e.trim();return t?t.startsWith("#")||t.startsWith("/")&&!t.startsWith("//")?!0:l5e.test(t):!1}function xv(e,t=!1){if(!e)return!1;const n=e.trim();return n?t?c5e.test(n):n.startsWith("#")||n.startsWith("/")&&!n.startsWith("//")||V2t.test(n)?!0:l5e.test(n):!1}let Phe,Lhe=Promise.resolve(),G2t=0;const K2t=5e4,Y2t=500,X2t=1e4,Dhe=16;function Z2t({code:e}){const{t}=lt(),n=gy(),s=Qa()!=="interactive",[r,i]=d.useState(null),[o,l]=d.useState(null),[c,u]=d.useState("diagram"),[h,f]=R1(),[p,m]=d.useState(1),[g,v]=d.useState(!1),y=d.useRef(null),[w,b]=d.useState(!1),[x,k]=d.useState(!1),[S,T]=d.useState(null),E=d.useRef(null),A=d.useRef(null),C=n==="light"?"default":"dark",I=.5,R=3,N=.25,j=()=>{m(X=>Math.min(R,Math.round((X+N)*100)/100))},P=()=>{m(X=>Math.max(I,Math.round((X-N)*100)/100))},D=d.useCallback(()=>{A.current=null,v(!1),m(1);const X=y.current;X&&(X.scrollLeft=0,X.scrollTop=0),b(!1)},[]),M=d.useCallback(X=>{const ee=y.current;ee&&(X.preventDefault(),v(!0),A.current={startX:X.clientX,startY:X.clientY,startLeft:ee.scrollLeft,startTop:ee.scrollTop})},[]),q=d.useCallback(X=>{const{scrollLeft:ee,scrollTop:H}=X.currentTarget;b(ee!==0||H!==0)},[]),V=d.useCallback(()=>{const X=y.current;X&&(k(X.scrollWidth>X.clientWidth||X.scrollHeight>X.clientHeight),b(X.scrollLeft!==0||X.scrollTop!==0))},[]),z=d.useCallback(()=>{const X=y.current,ee=E.current?.querySelector("svg");if(!X||!ee)return;const[,,H,Q]=(ee.getAttribute("viewBox")??"").split(/[\s,]+/).map(Number),de=(ee.getAttribute("width")??"").trim(),ve=Number.parseFloat(ee.getAttribute("height")??""),B=H>0&&Q>0,G=B?H:Number.parseFloat(de),W=B?Q:ve;if(!(G>0)||!(W>0)){T(null);return}const F=X.clientWidth-Dhe*2,pe=de.endsWith("%")&&F>0?Math.min(G,F):G,J=Math.max(0,X.offsetHeight-X.clientHeight);T({stageWidth:pe,canvasHeight:pe*W/G+Dhe*2+J})},[]);d.useEffect(()=>{if(!g)return;const X=H=>{const Q=y.current,de=A.current;!Q||!de||(Q.scrollLeft=de.startLeft-(H.clientX-de.startX),Q.scrollTop=de.startTop-(H.clientY-de.startY),b(Q.scrollLeft!==0||Q.scrollTop!==0))},ee=()=>{A.current=null,v(!1)};return window.addEventListener("mousemove",X),window.addEventListener("mouseup",ee),window.addEventListener("blur",ee),()=>{window.removeEventListener("mousemove",X),window.removeEventListener("mouseup",ee),window.removeEventListener("blur",ee)}},[g]),d.useEffect(()=>{D()},[e,D]),d.useLayoutEffect(()=>{z(),V()},[r,p,c,z,V]),d.useEffect(()=>{const X=y.current;if(!X)return;const ee=new ResizeObserver(()=>{z(),V()});return ee.observe(X),()=>ee.disconnect()},[r,c,z,V]),d.useEffect(()=>{let X=!1;i(null),l(null);const ee=setTimeout(()=>{He(()=>import("./mermaid.core-De4-EW4Z.js").then(H=>H.cb),[]).then(async H=>{if(X)return;const Q=H.default,de=`${C}:${s?"hardened":"runtime"}`,ve=Lhe.then(async()=>{if(X)throw new Error("Mermaid render skipped");Phe!==de&&(Q.initialize({startOnLoad:!1,theme:C,securityLevel:"strict",suppressErrorRendering:!0,...s?{maxTextSize:K2t,maxEdges:Y2t}:{},flowchart:{wrappingWidth:300,useMaxWidth:!1}}),Phe=de);const G=`mermaid-${++G2t}`;if(!s)return Q.render(G,e.trim());let W;try{return await Promise.race([Q.render(G,e.trim()),new Promise((F,pe)=>{W=setTimeout(()=>pe(new Error("Mermaid render timed out")),X2t)})])}finally{W!==void 0&&clearTimeout(W)}});Lhe=ve.then(()=>{},()=>{});const{svg:B}=await ve;X||i(B)}).catch(H=>{X||l(H instanceof Error?H.message:"Mermaid render failed")})},150);return()=>{X=!0,clearTimeout(ee)}},[e,s,C]);const L=()=>{Hh(e).then(()=>{f()}).catch(wg)};return o?a.jsxs("div",{className:Ti.codeBlock,children:[a.jsx("div",{className:Ti.codeBlockHeader,children:a.jsx("span",{className:Ti.codeBlockLang,children:t("mermaid.errorLabel")})}),a.jsx("pre",{className:`${Ti.codeBlockContent} ${Ti.codeBlockPlain}`,children:a.jsx("code",{children:e})})]}):a.jsxs("div",{className:Ti.codeBlock,children:[a.jsxs("div",{className:Ti.codeBlockHeader,children:[a.jsx("span",{className:Ti.codeBlockLang,children:t("mermaid.label")}),a.jsxs("span",{className:Ti.mermaidActions,children:[c==="diagram"&&a.jsxs(a.Fragment,{children:[a.jsx("button",{className:Ti.codeBlockCopy,onClick:P,title:t("mermaid.zoomOut"),disabled:p<=I,children:t("mermaid.zoomOut")}),a.jsx("button",{className:Ti.codeBlockCopy,onClick:D,title:t("mermaid.zoomReset"),disabled:p===1&&!w,children:t("mermaid.zoomReset")}),a.jsx("button",{className:Ti.codeBlockCopy,onClick:j,title:t("mermaid.zoomIn"),disabled:p>=R,children:t("mermaid.zoomIn")})]}),a.jsx("button",{className:Ti.codeBlockCopy,onClick:()=>u(c==="diagram"?"code":"diagram"),children:t(c==="diagram"?"mermaid.viewCode":"mermaid.viewDiagram")}),a.jsx("button",{className:Ti.codeBlockCopy,onClick:L,children:t(h?"code.copied":"code.copy")})]})]}),c==="code"?a.jsx("pre",{className:`${Ti.codeBlockContent} ${Ti.codeBlockPlain}`,children:a.jsx("code",{children:e})}):r?a.jsx("div",{className:`${Ti.mermaidZoomWrapper} ${x?Ti.mermaidPannable:""} ${x&&g?Ti.mermaidDragging:""}`,ref:y,style:S?{height:S.canvasHeight}:void 0,onMouseDown:M,onDoubleClick:D,onScroll:q,children:a.jsx("div",{className:`${Ti.mermaidBlock} ${Ti.mermaidStage}`,ref:E,style:{...S?{width:S.stageWidth}:{},...p===1?{}:{zoom:p}},dangerouslySetInnerHTML:{__html:r}})}):a.jsx("div",{className:`${Ti.mermaidBlock} ${Ti.mermaidLoading} ${Ti.mermaidInline}`,children:a.jsx("span",{children:t("mermaid.rendering")})})]})}function Q2t({className:e,children:t,isStreaming:n}){const{t:s}=lt(),r=gy(),i=Qa()==="document",[o,l]=d.useState(null),[c,u]=R1(),{label:h,lang:f,resolvedLang:p}=xee(u5e(e)),m=String(t).replace(/\n$/,""),g=r==="light"?"github-light-default":"github-dark-default";d.useEffect(()=>{if(i||n||f==="mermaid"||p==="text"||DG(m)){l(null);return}const y=Kkt(m,p,g);if(y!==null){l(y);return}const w=fhe(m,p,g,!0);if(w!==null){l(w);return}l(null);let b=!1;return N3e(p).then(()=>{if(b)return;const x=fhe(m,p,g,!0);x!==null&&l(x)}).catch(x=>{b||(console.warn("[web-shell] highlight failed for lang=%s",p,x),l(null))}),()=>{b=!0}},[m,i,f,p,g,n]);const v=()=>{Hh(m).then(()=>{u()}).catch(wg)};return f==="mermaid"&&!n&&!i?a.jsx(Z2t,{code:m}):a.jsxs("div",{className:Ti.codeBlock,children:[a.jsxs("div",{className:Ti.codeBlockHeader,children:[a.jsx("span",{className:Ti.codeBlockLang,children:h}),a.jsx("button",{className:Ti.codeBlockCopy,onClick:v,children:s(c?"code.copied":"code.copy")})]}),!i&&!n&&o!==null?a.jsx("div",{className:Ti.codeBlockContent,dangerouslySetInnerHTML:{__html:o}}):a.jsx("pre",{className:`${Ti.codeBlockContent} ${Ti.codeBlockPlain}`,children:a.jsx("code",{children:m})})]})}function u5e(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 J2t({children:e}){return a.jsx("code",{className:Ti.inlineCode,children:e})}function Ohe({children:e}){return a.jsx("div",{className:Ti.tableWrapper,children:a.jsx("table",{className:Ti.table,children:e})})}const d5e=d.createContext(!1),h5e=d.createContext(void 0),f5e=d.createContext(void 0);function eTt(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:!gEe(e.slice(s,r))&&e.slice(r).trim().length===0}function tTt({className:e,children:t,node:n}){const s=d.useContext(d5e),r=d.useContext(f5e);return e?.startsWith("language-")||typeof t=="string"&&t.includes(`
|
|
1648
1648
|
`)?a.jsx(nTt,{className:e,isStreaming:s,isIncomplete:eTt(r,n,s),children:t}):a.jsx(J2t,{children:t})}function nTt({className:e,children:t,isStreaming:n,isIncomplete:s}){const r=d.useContext(h5e),i=gy(),{markdown:o}=Md(),l=String(t),c=l.replace(/\n$/,""),u=a.jsx(Q2t,{className:e,isStreaming:n,children:l}),h=u5e(e),{resolvedLang:f}=xee(h);if(!!r&&!!e&&!!h)try{const m=o?.renderCodeBlock?.({language:h,resolvedLanguage:f,className:e,code:c,isStreaming:!!n,isIncomplete:!!s,source:r,theme:i});if(m!=null&&typeof m!="boolean")return a.jsx(_g,{fallback:u,label:`custom code block component render (lang=${h})`,resetKeys:[h,r,i,n?"streaming":"settled",s?"incomplete":"complete",c],children:m})}catch(m){console.error("[web-shell] custom code block renderer call failed (lang=%s):",h,m)}return u}function sTt({children:e}){return a.jsx(a.Fragment,{children:e})}const UG=/^qwen-session:\/\//i;function $he(e,t=!1){return t&&c5e.test(e.trim())||UG.test(e.trim())?e:uEe(e)}function p5e({href:e,children:t,node:n,id:s,"aria-label":r,"aria-describedby":i}){const o=Qa(),l=Lf();if((n?.properties.dataFootnoteRef!==void 0||n?.properties.dataFootnoteBackref!==void 0)&&e?.startsWith("#"))return a.jsx("a",{id:s,href:e,className:Ti.link,"aria-label":r,"aria-describedby":i,"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&&UG.test(e.trim())){if(o!=="interactive")return a.jsx("span",{className:Ti.link,children:t});const h=e.trim().replace(UG,"");return a.jsx("a",{href:"#",role:"button",className:Ti.link,onClick:f=>{f.preventDefault(),f.stopPropagation(),window.dispatchEvent(new CustomEvent("qwen:open-session",{detail:h}))},children:t})}const u=d4(e)?e:void 0;return a.jsx("a",{href:u,target:"_blank",rel:"noopener noreferrer",className:Ti.link,onClick:h=>l(h,u),children:t})}function rTt({src:e,alt:t}){const n=Qa(),s=xv(e,n==="document")?e:void 0;return a.jsx("img",{src:s,alt:t||"",className:Ti.image})}function iTt(e,t,n=80){const[s,r]=d.useState(e),i=d.useRef(s);i.current=s;const o=d.useRef(0),l=d.useRef(null),c=d.useRef(e);return c.current=e,d.useEffect(()=>{if(!t){l.current&&(clearTimeout(l.current),l.current=null),i.current!==e&&r(e);return}const u=Date.now(),h=u-o.current;h>=n?(o.current=u,r(c.current)):l.current||(l.current=setTimeout(()=>{o.current=Date.now(),l.current=null,r(c.current)},n-h))},[e,t,n]),d.useEffect(()=>()=>{l.current&&(clearTimeout(l.current),l.current=null)},[]),!t||typeof e=="string"&&typeof s=="string"&&!e.startsWith(s)?e:s}function m5e(e="basic",t=""){return{code:tTt,pre:sTt,a:p5e,img:rTt,sup:W3e,section:V3e,table({children:n}){if(e==="advanced"){const s=a.jsx(Ohe,{children:n});return a.jsx(_g,{fallback:s,label:"enhanced markdown table",resetKeys:[t],children:a.jsx(eCt,{fallback:s,children:n})})}return a.jsx(Ohe,{children:n})}}}const oTt=m5e(),aTt=d.memo(function({content:t,components:n,remarkPlugins:s,rehypePlugins:r,urlTransform:i}){return a.jsx(Zmt,{components:n,remarkPlugins:s,rehypePlugins:r,urlTransform:i,children:t})}),xp=d.memo(function({content:t,source:n,isStreaming:s,tableMode:r}){const{markdown:i,markdownTableMode:o}=Md(),l=gy(),c=Qa()==="document",u=`footnote-${d.useId()}-`,h=n?i:void 0,f=iTt(t??"",s),p=s===!0&&f.length>q2t,m=d.useMemo(()=>f&&n&&h?.transformMarkdown?h.transformMarkdown(f,{source:n,isStreaming:s===!0}):f,[n,h,f,s]),g=s?"basic":r??o??"basic",v=d.useMemo(()=>g==="advanced"?m5e("advanced",m):oTt,[g,m]),y=h?.components,w=h?.getInlineFootnoteIcon,b=h?.mountFootnotePreview,x=d.useMemo(()=>{if(!y&&!w&&!b)return v;const N={...v,...y,...g==="advanced"?{table:v.table}:{}},j=y?.a;return y&&(N.a=P=>{if(P.node?.properties.dataFootnoteRef!==void 0||P.node?.properties.dataFootnoteBackref!==void 0||!j)return a.jsx(p5e,{...P});if(typeof j!="string")return d.createElement(j,P);const{node:M,...q}=P;return d.createElement(j,q)}),y?.sup||(N.sup=P=>a.jsx(W3e,{...P,linkComponent:j,iconResolver:w,mountPreview:b}),N.section=P=>a.jsx(V3e,{...P,sectionComponent:y?.section})),N},[v,g,y,w,b]),k=!c&&n==="assistant"&&!y?.code&&!y?.pre?h?.chart??(h?.renderCodeBlock?void 0:v2t):void 0,S=d.useMemo(()=>k?w2t(k.registry,{chartClassName:k.chartClassName,chartStyle:{minHeight:360,...k.chartStyle}}):void 0,[k]),T=d.useMemo(()=>S?{...x,pre:S}:x,[S,x]),E=d.useMemo(()=>h?.remarkPlugins?[Yue,Lde,Kde,...h.remarkPlugins]:[Yue,Lde,Kde],[h?.remarkPlugins]),A=d.useMemo(()=>[ubt,...h?.rehypePlugins??[],[lCt,{prefix:u,group:!c&&!y?.sup,safeHref:d4,safeImage:xv,transformUrl:$he}]],[h?.rehypePlugins,u,c,y?.sup]),C=d.useMemo(()=>N=>$he(N,c),[c]);if(!t)return null;if(p)return a.jsx("div",{className:n!=="thinking"?Ti.content:void 0,"data-markdown-source":n,"data-markdown-streaming-plain-text":"true",children:a.jsx("pre",{className:Ti.streamingPlainText,children:m})});const I=a.jsx(aTt,{content:m,components:T,remarkPlugins:E,rehypePlugins:A,urlTransform:C}),R=k?a.jsx(y2t,{customization:k,source:m,streaming:!!s,theme:l,children:I}):I;return a.jsx("div",{className:n!=="thinking"?Ti.content:void 0,"data-markdown-source":n,children:a.jsx(d5e.Provider,{value:!!s,children:a.jsx(h5e.Provider,{value:n,children:a.jsx(f5e.Provider,{value:m,children:R})})})})}),hH=/https?:\/\/[A-Za-z0-9\-._~:/?#[\]{}@!$&'()*+,;=%]+/gi,lTt=new Set([...".,;:!?'*_~"]),cTt={")":"(","]":"[","}":"{"},uTt=/^https?:\/\/./i;function Bhe(e,t){let n=0;for(const s of e)s===t&&(n+=1);return n}function dTt(e){const t={};for(const[s,r]of Object.entries(cTt))t[s]=Bhe(e,s)-Bhe(e,r);let n=e.length;for(;n>0;){const s=e.charAt(n-1);if(Object.hasOwn(t,s)){if(t[s]<=0)break;t[s]--,n--;continue}if(!lTt.has(s))break;n--}return e.slice(0,n)}function hTt(e){const t=[];let n=0;hH.lastIndex=0;for(let s=hH.exec(e);s!==null;s=hH.exec(e)){const r=dTt(s[0]);if(!uTt.test(r))continue;const i=s.index;i>n&&t.push({type:"text",value:e.slice(n,i)}),t.push({type:"url",value:r}),n=i+r.length}return n<e.length&&t.push({type:"text",value:e.slice(n)}),t}const Y7=d.memo(function({text:t}){const n=Lf(),s=d.useMemo(()=>hTt(t),[t]);return s.every(r=>r.type==="text")?t:s.map((r,i)=>{if(r.type==="text")return r.value;const o=r.value.replace(/%(?![0-9A-Za-z]{2})/g,"%25"),l=d4(o)?o:void 0;return a.jsx("a",{href:l,target:"_blank",rel:"noopener noreferrer",className:Ti.link,onClick:c=>n(c,l),children:r.value},i)})}),fTt="_flash_96ig5_1",ny={flash:fTt},pTt="_chatMessageRow_qnd03_41",mTt="_chatMessageColumn_qnd03_48",gTt="_chatBubble_qnd03_55",vTt="_scheduledTaskBubble_qnd03_68",wTt="_scheduledTaskRun_qnd03_76",yTt="_scheduledTaskHeader_qnd03_83",bTt="_scheduledTaskIcon_qnd03_90",xTt="_scheduledTaskHeading_qnd03_108",kTt="_scheduledTaskEyebrow_qnd03_115",_Tt="_scheduledTaskName_qnd03_122",STt="_scheduledTaskMeta_qnd03_131",CTt="_scheduledTaskMetaItem_qnd03_138",TTt="_scheduledTaskBadge_qnd03_158",ITt="_scheduledTaskId_qnd03_170",ETt="_scheduledTaskPrompt_qnd03_181",RTt="_sendFailure_qnd03_191",ATt="_retryButton_qnd03_201",jTt="_editArea_qnd03_229",NTt="_editInput_qnd03_237",MTt="_editActions_qnd03_258",PTt="_editCancel_qnd03_264",LTt="_editSubmit_qnd03_265",DTt="_chatContent_qnd03_294",OTt="_messageTag_qnd03_299",$Tt="_messageTagTooltip_qnd03_317",BTt="_messageTagClickable_qnd03_351",FTt="_messageTagIcon_qnd03_364",zTt="_messageTagLabel_qnd03_376",HTt="_messageTagValue_qnd03_377",UTt="_chatContentCollapsed_qnd03_400",qTt="_toggleButton_qnd03_405",WTt="_toggleIcon_qnd03_426",VTt="_toggleIconExpanded_qnd03_433",GTt="_chatImages_qnd03_437",KTt="_chatImageThumb_qnd03_445",YTt="_chatImageThumbInteractive_qnd03_453",XTt="_chatFiles_qnd03_462",ZTt="_chatFileChip_qnd03_470",QTt="_chatFileChipPreviewable_qnd03_483",JTt="_fileTagIcon_qnd03_492",pi={chatMessageRow:pTt,chatMessageColumn:mTt,chatBubble:gTt,scheduledTaskBubble:vTt,scheduledTaskRun:wTt,scheduledTaskHeader:yTt,scheduledTaskIcon:bTt,scheduledTaskHeading:xTt,scheduledTaskEyebrow:kTt,scheduledTaskName:_Tt,scheduledTaskMeta:STt,scheduledTaskMetaItem:CTt,scheduledTaskBadge:TTt,scheduledTaskId:ITt,scheduledTaskPrompt:ETt,sendFailure:RTt,retryButton:ATt,editArea:jTt,editInput:NTt,editActions:MTt,editCancel:PTt,editSubmit:LTt,chatContent:DTt,messageTag:OTt,messageTagTooltip:$Tt,messageTagClickable:BTt,messageTagIcon:FTt,messageTagLabel:zTt,messageTagValue:HTt,chatContentCollapsed:UTt,toggleButton:qTt,toggleIcon:WTt,toggleIconExpanded:VTt,chatImages:GTt,chatImageThumb:KTt,chatImageThumbInteractive:YTt,chatFiles:XTt,chatFileChip:ZTt,chatFileChipPreviewable:QTt,fileTagIcon:JTt},e4t="This is a scheduled task run. Execute the instructions below now. Do not create or modify a schedule unless the instructions explicitly ask you to.";function t4t(e){const t=`
|
|
1649
1649
|
|
|
1650
1650
|
${e4t}
|
|
@@ -2266,7 +2266,7 @@ ${o("terminal.notice.protocolMismatch")}`),de.close(4002,"Terminal protocol mism
|
|
|
2266
2266
|
* Copyright 2025 Qwen Team
|
|
2267
2267
|
* SPDX-License-Identifier: Apache-2.0
|
|
2268
2268
|
*/const P3n=250,hq={truncated:!1,status:"idle"};function L3n(e){if(e instanceof Error&&e.message)return e.message;const t=String(e??"");return t.length>0?t:"Unknown error"}function D3n(e){return e.replayError?{kind:"unreadable",message:e.replayError}:e.partial?{kind:"partial"}:void 0}function O3n(e,t={}){const n=t.pageSize??P3n,[s,r]=d.useState(hq),i=d.useRef(0),o=d.useCallback(()=>{if(!e)return;const u=++i.current;r(h=>({...h,status:"loading",error:void 0})),e({limit:n}).then(h=>{if(i.current!==u)return;const f=D3n(h);if(f!==void 0){r(p=>({...p,status:"error",error:f}));return}r({events:h.events,truncated:h.hasMore,status:"ready"})},h=>{i.current===u&&r(f=>({...f,status:"error",error:{kind:"unreadable",message:L3n(h)}}))})},[e,n]);d.useEffect(()=>{if(!e){i.current+=1,r(hq);return}return r(hq),o(),()=>{i.current+=1}},[e,o]);const l=s.events;return{trajectory:d.useMemo(()=>l===void 0?void 0:A3n(M3n(l)),[l]),status:s.status,...s.error!==void 0?{error:s.error}:{},truncated:s.truncated,refresh:o}}const $3n="_panel_1ploj_1",B3n="_header_1ploj_8",F3n="_summary_1ploj_17",z3n="_headerActions_1ploj_26",H3n="_headerButton_1ploj_33",U3n="_iconButton_1ploj_54",q3n="_error_1ploj_78",W3n="_notice_1ploj_91",V3n="_tableWrap_1ploj_100",G3n="_placeholder_1ploj_107",K3n="_scroll_1ploj_114",Y3n="_olderBar_1ploj_126",X3n="_olderNotice_1ploj_132",Z3n="_virtualBody_1ploj_137",Q3n="_virtualRow_1ploj_142",J3n="_turnHeader_1ploj_151",e5n="_turnTitle_1ploj_167",t5n="_turnSummary_1ploj_171",n5n="_record_1ploj_179",s5n="_nestMarker_1ploj_198",r5n="_selected_1ploj_203",i5n="_badge_1ploj_208",o5n="_text_1ploj_221",a5n="_faint_1ploj_230",l5n="_metrics_1ploj_235",c5n="_toneError_1ploj_244",u5n="_toneMuted_1ploj_248",Yo={panel:$3n,header:B3n,summary:F3n,headerActions:z3n,headerButton:H3n,iconButton:U3n,error:q3n,notice:W3n,tableWrap:V3n,placeholder:G3n,scroll:K3n,olderBar:Y3n,olderNotice:X3n,virtualBody:Z3n,virtualRow:Q3n,turnHeader:J3n,turnTitle:e5n,turnSummary:t5n,record:n5n,nestMarker:s5n,selected:r5n,badge:i5n,text:o5n,faint:a5n,metrics:l5n,toneError:c5n,toneMuted:u5n},ewe=34;function twe(e){return e>=999950?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function d5n(e){return`${twe(e.inputTokens)} → ${twe(e.outputTokens)}`}const h5n=/-call_[A-Za-z0-9]+$/;function f5n(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(h5n,"")}function l3(e){const t=e.trim(),n=t.indexOf(`
|
|
2269
|
-
`);return n===-1?t:t.slice(0,n)}function p5n(e,t){if(e.kind==="request"){const n=[Ed(e.timing.durationMs)];return e.timing.ttftMs!==void 0&&n.push(t("trajectory.ttft",{duration:Ed(e.timing.ttftMs)})),e.usage&&n.push(d5n(e.usage)),n}if(e.kind==="tool"){const n=[];if(e.timing&&n.push(Ed(e.timing.durationMs)),e.subagentSummary){const{requests:s,tools:r,requestMs:i}=e.subagentSummary;n.push(t("trajectory.subagentRollup",{requests:s,tools:r,duration:Ed(i)}))}return n}return[]}function nwe(e){const t=e.toolStatus??e.block.status;if(t==="error"||t==="failed")return Yo.toneError;if(t==="cancelled")return Yo.toneMuted}function m5n(e,t){switch(e.kind){case"user":return{badge:t("trajectory.badge.user"),text:l3(e.block.text)};case"request":{const n=f5n(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:Yo.toneError}:{},text:s?`${r} · ${t("trajectory.requestFailed")}`:r}}case"message":return{badge:e.thought?t("trajectory.badge.thought"):t("trajectory.badge.message"),text:l3(e.block.text),faint:e.thought};case"tool":return{badge:e.block.toolName??t("trajectory.badge.tool"),...nwe(e)?{badgeTone:nwe(e)}:{},text:e.block.title||(e.block.toolName??"")};default:return g5n(e.block,t)}}function g5n(e,t){switch(e.kind){case"shell":return{badge:t("trajectory.badge.shell"),text:l3(e.text)};case"user_shell":return{badge:t("trajectory.badge.shell"),text:l3(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:Yo.toneError}:{},text:l3(e.text),faint:e.kind!=="error"};case"prompt_cancelled":return{badge:t("trajectory.badge.cancelled"),badgeTone:Yo.toneMuted,text:e.reason??t("trajectory.cancelled"),faint:!0};default:return{badge:t("trajectory.badge.other"),text:""}}}function v5n(e){return e.rows.some(t=>t.kind==="request"||t.kind==="tool"&&t.timing!==void 0)}function w5n({loadPage:e}){const{t}=lt(),{trajectory:n,status:s,error:r,truncated:i,refresh:o}=O3n(e),[l,c]=d.useState(void 0),u=d.useRef(null),h=d.useRef(!1),f=d.useRef(0),p=d.useId(),m=d.useCallback(C=>`${p}-row-${C}`,[p]),g=d.useCallback((C,I)=>{C.scrollTop=I,f.current=C.scrollTop},[]),v=d.useMemo(()=>{if(!n)return[];const C=new Map(n.rows.map(R=>[R.key,R])),I=[];for(const R of n.turns){const N=R.userRowKey??`ordinal:${R.index}`;I.push({kind:"turn",key:`turn:${N}`,turn:R});for(const j of R.rowKeys){const P=C.get(j);P&&I.push({kind:"row",key:j,row:P})}}return I},[n]),y=vIe({count:v.length,getScrollElement:()=>u.current,getItemKey:C=>v[C]?.key??C,estimateSize:()=>ewe,overscan:12}),w=v.length>0;d.useLayoutEffect(()=>{const C=u.current;if(!C||typeof ResizeObserver>"u")return;let I=0;const R=()=>{C.scrollTop===0&&f.current>0&&(C.scrollTop=f.current)},N=new ResizeObserver(()=>{R(),I=requestAnimationFrame(R)});return N.observe(C),()=>{N.disconnect(),I!==0&&cancelAnimationFrame(I)}},[w]),d.useEffect(()=>{if(s!=="ready"||h.current||v.length===0)return;h.current=!0;const C=u.current;C&&g(C,C.scrollHeight)},[g,s,v.length]);const b=d.useMemo(()=>l===void 0?-1:v.findIndex(C=>C.key===l),[l,v]),x=d.useCallback(C=>{if(v.length===0)return;const I=Math.min(Math.max(C,0),v.length-1);c(v[I].key),y.scrollToIndex(I,{align:"auto"})},[y,v]),k=d.useCallback(C=>{c(C),u.current?.focus({preventScroll:!0})},[]),S=d.useCallback(C=>{if(v.length===0)return;const I=b<0?-1:b;C.key==="ArrowDown"?(C.preventDefault(),x(I+1)):C.key==="ArrowUp"?(C.preventDefault(),x(I<=0?0:I-1)):C.key==="Home"?(C.preventDefault(),x(0)):C.key==="End"&&(C.preventDefault(),x(v.length-1))},[x,b,v]),T=d.useMemo(()=>{if(!n)return;let C=0,I=0,R=0;for(const N of n.turns)C+=N.requestCount,I+=N.toolCount,R+=N.requestMs;return{turns:n.turns.length,requests:C,tools:I,durationMs:R}},[n]),E=s==="ready"&&v.length===0,A=n!==void 0&&v.length>0&&!v5n(n);return a.jsxs("div",{className:Yo.panel,"data-testid":"trajectory-panel",children:[a.jsxs("div",{className:Yo.header,children:[a.jsx("div",{className:Yo.summary,children:T?a.jsx("span",{"data-testid":"trajectory-totals",children:t("trajectory.totals",{turns:T.turns,requests:T.requests,tools:T.tools,duration:T.durationMs>0?Ed(T.durationMs):"—"})}):a.jsx("span",{children:t("trajectory.title")})}),a.jsx("div",{className:Yo.headerActions,children:a.jsx("button",{type:"button",className:Yo.iconButton,onClick:o,disabled:!e||s==="loading",title:t("common.refresh"),"aria-label":t("common.refresh"),children:a.jsx(Vh,{size:14,strokeWidth:1.6})})})]}),r!==void 0&&a.jsxs("div",{className:Yo.error,role:"alert",children:[a.jsx("span",{children:r.kind==="partial"?t("trajectory.partial"):t("trajectory.loadFailed",{message:r.message})}),a.jsx("button",{type:"button",className:Yo.headerButton,onClick:o,disabled:s==="loading",children:t("common.retry")})]}),A&&a.jsx("div",{className:Yo.notice,role:"status",children:t("trajectory.noTiming")}),a.jsx("div",{className:Yo.tableWrap,children:v.length===0?s==="error"?null:a.jsx("div",{className:Yo.placeholder,role:"status",children:t(E?"trajectory.empty":"common.loading")}):a.jsxs(a.Fragment,{children:[i&&a.jsx("div",{className:Yo.olderBar,children:a.jsx("span",{className:Yo.olderNotice,"data-testid":"trajectory-truncated",children:t("trajectory.truncated")})}),a.jsx("div",{ref:u,className:Yo.scroll,role:"grid",tabIndex:0,"aria-label":t("trajectory.title"),"aria-rowcount":v.length,"aria-activedescendant":b>=0?m(b):void 0,onKeyDown:S,onScroll:C=>{f.current=C.currentTarget.scrollTop},"data-testid":"trajectory-rows",children:a.jsx("div",{className:Yo.virtualBody,style:{height:`${y.getTotalSize()}px`},children:y.getVirtualItems().map(C=>{const I=v[C.index];return a.jsx("div",{id:m(C.index),className:Yo.virtualRow,style:{height:`${ewe}px`,transform:`translateY(${C.start}px)`},role:"row","aria-rowindex":C.index+1,children:I.kind==="turn"?a.jsx(y5n,{turn:I.turn,selected:I.key===l,onSelect:()=>k(I.key)}):a.jsx(b5n,{row:I.row,selected:I.key===l,onSelect:()=>k(I.key)})},C.key)})})})]})})]})}function y5n({turn:e,selected:t,onSelect:n}){const{t:s}=lt();return a.jsxs("div",{className:`${Yo.turnHeader} ${t?Yo.selected:""}`,onClick:n,"aria-selected":t,"data-selected":t?"true":void 0,role:"gridcell","data-testid":"trajectory-turn",children:[a.jsx("span",{className:Yo.turnTitle,children:e.partial?s("trajectory.turnPartial",{index:e.index}):s("trajectory.turn",{index:e.index})}),a.jsx("span",{className:Yo.turnSummary,children:s("trajectory.turnSummary",{requests:e.requestCount,tools:e.toolCount,duration:e.requestMs>0?Ed(e.requestMs):"—"})})]})}function b5n({row:e,selected:t,onSelect:n}){const{t:s}=lt(),r=m5n(e,s),i=p5n(e,s);return a.jsxs("div",{className:`${Yo.record} ${t?Yo.selected:""}`,role:"gridcell","aria-selected":t,"data-selected":t?"true":void 0,onClick:n,"data-testid":`trajectory-row-${e.kind}`,"data-depth":e.depth,children:[e.depth>0&&a.jsx(Zit,{size:12,strokeWidth:1.6,className:Yo.nestMarker,"aria-hidden":"true"}),a.jsx("span",{className:`${Yo.badge} ${r.badgeTone??""}`,children:r.badge}),a.jsx("span",{className:`${Yo.text} ${r.faint?Yo.faint:""}`,children:r.text}),a.jsx("span",{className:Yo.metrics,"data-testid":"trajectory-row-metrics",children:i.length>0?i.join(" · "):"—"})]})}const x5n="_panel_pwtdr_1",k5n="_toolbar_pwtdr_5",_5n="_actions_pwtdr_15",S5n="_feedback_pwtdr_21",C5n="_state_pwtdr_31",Qv={panel:x5n,toolbar:k5n,actions:_5n,feedback:S5n,state:C5n};function T5n({sessionActions:e,sessionId:t,controls:n}){const{t:s}=lt(),[r,i]=d.useState(null),[o,l]=d.useState(!0),[c,u]=d.useState(!1),h=d.useRef(0),f=d.useRef(()=>{}),p=d.useRef(null),m=n?.sessionId===t?n:void 0,g=m?.getContextUsage??e?.getContextUsage,v=d.useRef(m);v.current=m;const y=m?.result,[w,b]=d.useState(y),x=!!(y&&y!==w&&(y.kind!=="completed"||!c));d.useEffect(()=>{y?.kind==="completed"&&(h.current++,i(y.usage),u(!1))},[y]),d.useEffect(()=>{let T=!0,E=!1;const A=v.current?.result;i(I=>I?.sessionId===t?I:A?.kind==="completed"?A.usage:null),u(!1),l(!!g);const C=async()=>{if(!T||E||!g)return;E=!0,l(!0),u(!1);const I=h.current,R=p.current,N=R&&R.getContextUsage===g&&R.sessionId===t?R:{getContextUsage:g,sessionId:t,promise:g({detail:!0,silent:!0,...v.current?.result?{syncCounters:!0}:{}})};p.current=N;try{const j=await N.promise;if(!T||I!==h.current)return;i(j.sessionId===t&&j.usage.contextWindowSize>0?j:null)}catch(j){if(!T||I!==h.current)return;u(nQ(j)?"transient":"hard")}finally{E=!1,p.current===N&&(p.current=null),T&&l(!1)}};return f.current=()=>void C(),C(),()=>{T=!1}},[g,t]);const k=!g||o||m?.compressing,S=()=>{b(y),f.current()};return a.jsxs("div",{className:Qv.panel,"aria-busy":o,children:[a.jsxs("div",{className:Qv.toolbar,children:[a.jsx("span",{children:s("contextUsage.title")}),a.jsxs("div",{className:Qv.actions,children:[a.jsx(ht,{type:"button",variant:"ghost",size:"icon-sm","aria-label":s("contextUsage.refresh"),title:s("contextUsage.refresh"),disabled:k,onClick:S,children:a.jsx(Vh,{"aria-hidden":"true"})}),a.jsx("span",{title:m?.compressing?void 0:m?.canCompress?o?s("common.loading"):void 0:s("contextUsage.compressUnavailable"),children:a.jsx(ht,{type:"button",variant:"outline",size:"sm",disabled:!m?.canCompress||o,onClick:()=>void m?.compress(),children:s(m?.compressing?"contextUsage.compressing":"contextUsage.compress")})})]})]}),(m?.compressing||x)&&a.jsx(c9e,{controls:m,className:Qv.feedback}),c==="transient"&&r&&a.jsx("div",{className:Qv.feedback,role:"status",children:s("contextUsage.previousReading")}),c==="hard"?a.jsxs("div",{className:Qv.state,role:"alert",children:[a.jsx("span",{children:s("contextUsage.loadError")}),a.jsx(ht,{type:"button",variant:"outline",size:"sm",disabled:k,onClick:S,children:s("contextUsage.retry")})]}):g?o&&!r?a.jsx("div",{className:Qv.state,role:"status",children:s("common.loading")}):r?a.jsx(C5e,{status:r,compact:!0}):a.jsx("div",{className:Qv.state,children:s("contextUsage.unavailable")}):a.jsx("div",{className:Qv.state,children:s("contextUsage.unavailable")})]})}const I5n=700,E5n=["daily","weekdays","weekly","hourly","minutes","custom"],R5n=[1,2,3,4,5,6,10,12,15,20,30],A5n=(e,t)=>{},j5n=(e,t,n)=>{},N5n=()=>Promise.reject(new Error("Side-task session creation is unavailable"));function swe(e){return e.kind==="review"||e.kind==="file"||e.kind==="artifact"||e.kind==="scheduled_task"}function Jv(e){return e.kind==="pending"?e.targetKind:e.kind}function M5n(e){return`image.${(e.match(/^data:image\/([a-z0-9+.+-]+)/i)?.[1]??"png").split("+")[0].toLowerCase()}`}const P5n=["review","sideTask"];function rwe({contextUsageControls:e,artifacts:t,tabs:n,activeTabId:s,reviewChanges:r,selectedReviewPath:i,panelWidth:o,workspaceCwd:l,loading:c,restoring:u=!1,error:h,onSelectTab:f,onCloseTab:p,onOpenFilePreview:m,latestReviewAvailable:g=!1,onOpenLatestReview:v,onOpenTerminal:y,onOpenTrajectory:w,trajectoryTabId:b,onOpenWebPreview:x,onWebPreviewChange:k,items:S=P5n,sideTaskAvailable:T=!1,sideTasks:E=[],sideTasksLoading:A=!1,onCreateSideTask:C,onOpenSideTask:I,onCreateSideTaskSession:R,onSideTaskCreated:N,onSideTaskTitleChange:j,onNestedRightPanelOpen:P,onNestedArtifactsChange:D,onOpenNestedSubagent:M,agentTasks:q=[],agentTraceLoading:V=!1,agentTraceError:z,onOpenWorkflowAgent:L,onError:X,sessionWorkflowEnabled:ee,workflow:H,onImageIngestionNotice:Q,deferSubagentMount:de=!1,onClose:ve,variant:B="docked",fullscreen:G=!1,onToggleFullscreen:W}){const{t:F}=lt(),[pe,J]=d.useState(!1),[ue,ie]=d.useState(),ye=d.useRef(null),me=d.useCallback(()=>{ye.current&&(clearTimeout(ye.current),ye.current=null),J(!0)},[]),fe=d.useCallback(()=>{ye.current&&clearTimeout(ye.current),ye.current=setTimeout(()=>{J(!1),ye.current=null},120)},[]);d.useEffect(()=>()=>{ye.current&&clearTimeout(ye.current)},[]);const ke=n.find(be=>be.id===s)??n[0],De=ke?.kind==="file"&&ke.sourcePreview&&(/\.html?$/i.test(ke.workspacePath)||Qw(ke.previewMimeType||ke.previewData?.type)==="text/html"),We=ke?.kind==="file"&&ke.previewOnly===!0&&!De&&/\.(?:html?|md|markdown)$/i.test(ke.workspacePath)&&(ke.previewContent!==void 0||!ke.previewData||!!OT(ke.previewMimeType||ke.previewData.type,ke.workspacePath)),rt=ue===ke?.id,Ee=S.includes("review")&&!n.some(be=>Jv(be)==="review"),Ue=S.includes("sideTask")&&T&&!!C,Ce=!!y,ae=S.includes("webPreview")&&!!x,O=S.includes("trajectory")&&!!w&&!n.some(be=>be.id===b),Y=!!ke&&(Ee||Ue||Ce||ae||O),oe=ke&&swe(ke)?{workspaceCwd:ke.workspaceCwd,workspaceId:ke.workspaceId}:void 0,_e=g4(oe?.workspaceCwd),Fe=_e?.workspaceId===oe?.workspaceId?_e?.actions:void 0,ge=ke?.kind==="artifact"?t.find(be=>be.id===ke.artifactId):void 0;return a.jsxs("aside",{className:`${tt.panel} ${B==="drawer"?tt.panelDrawer:""} ${G?tt.panelFullscreen:""}`,style:B==="docked"&&o&&!G?{flexBasis:o,width:o}:void 0,"aria-label":"Right panel",children:[a.jsxs("div",{className:tt.header,children:[n.length>0&&a.jsx("div",{className:tt.tabs,role:"tablist","aria-label":"Right panel",children:n.map(be=>a.jsxs("div",{className:[tt.tabItem,be.id===ke?.id?tt.tabActive:""].filter(Boolean).join(" "),children:[a.jsxs("button",{type:"button",role:"tab","aria-selected":be.id===ke?.id,className:tt.tab,onClick:()=>f(be.id),onMouseEnter:Ie=>O2(Ie.currentTarget),onFocus:Ie=>O2(Ie.currentTarget),title:be.title,children:[a.jsx("span",{className:`${tt.tabIcon} ${Jv(be)==="artifact"?tt.tabArtifactIcon:""}`,"aria-hidden":"true",children:Jv(be)==="review"?a.jsx(fq,{}):be.kind==="workflow"?a.jsx(F4e,{className:tt.tabIconSvg,strokeWidth:1.6}):be.kind==="file"?a.jsx(vg,{name:be.workspacePath,className:tt.tabIconSvg,strokeWidth:1.6}):Jv(be)==="artifact"?a.jsx(cIe,{artifact:t.find(Ie=>"artifactId"in be&&Ie.id===be.artifactId),className:tt.tabIconSvg}):Jv(be)==="subagent"?a.jsx(L5n,{}):Jv(be)==="monitor"?a.jsx(K4e,{className:tt.tabIconSvg,strokeWidth:1.6}):Jv(be)==="shell"?a.jsx(i2,{className:tt.tabIconSvg,strokeWidth:1.6}):Jv(be)==="side_task"?a.jsx(nN,{className:tt.tabIconSvg,strokeWidth:1.6}):be.kind==="web_preview"?a.jsx(A2,{className:tt.tabIconSvg}):be.kind==="terminal"?a.jsx(i2,{className:tt.tabIconSvg,strokeWidth:1.6}):Jv(be)==="image"?a.jsx(Qot,{className:tt.tabIconSvg,strokeWidth:1.6}):be.kind==="context_usage"?a.jsx(ED,{className:tt.tabIconSvg,strokeWidth:1.6}):be.kind==="token_usage"?a.jsx(lJ,{className:tt.tabIconSvg,strokeWidth:1.6}):be.kind==="trajectory"?a.jsx(fz,{className:tt.tabIconSvg,strokeWidth:1.6}):a.jsx(O5n,{})}),a.jsx("span",{className:tt.tabTitle,"data-web-shell-session-title":!0,children:a.jsx("span",{className:tt.tabTitleInner,children:be.title})})]}),a.jsx("button",{type:"button",className:tt.tabCloseButton,onClick:()=>p(be.id),"aria-label":`Close ${be.title}`,title:"Close",children:a.jsx(D5n,{})})]},be.id))}),a.jsxs("div",{className:tt.headerActions,children:[Y&&a.jsxs(Nm,{modal:!1,children:[a.jsx(_p,{asChild:!0,children:a.jsx("button",{type:"button",className:`${tt.iconButton} ${tt.addButton}`,"aria-label":F("rightPanel.add"),title:F("rightPanel.add"),children:a.jsx(ah,{className:tt.toolbarIcon})})}),a.jsxs(Sp,{align:"end",className:"w-64",children:[Ee&&a.jsxs(Ii,{disabled:!g||!v,onSelect:v,children:[a.jsx(fq,{}),a.jsx("span",{className:tt.sideTaskListTitle,children:F("turnOutputs.review")})]}),Ee&&Ue&&a.jsx(Fw,{}),Ue&&a.jsxs(Ii,{disabled:A,onSelect:C,children:[a.jsx(nN,{className:tt.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:tt.sideTaskListTitle,children:F("sideTask.create")})]}),Ce&&(Ee||Ue)&&a.jsx(Fw,{}),Ce&&a.jsxs(Ii,{onSelect:()=>y?.(),children:[a.jsx(i2,{className:tt.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:tt.sideTaskListTitle,children:F("terminal.title")})]}),ae&&a.jsxs(Ii,{onSelect:x,children:[a.jsx(A2,{className:tt.sideTaskNewIcon}),a.jsx("span",{className:tt.sideTaskListTitle,children:F("webPreview.title")})]}),O&&a.jsxs(Ii,{onSelect:()=>w?.(),children:[a.jsx(fz,{className:tt.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:tt.sideTaskListTitle,children:F("trajectory.title")})]})]})]}),W&&a.jsx("button",{type:"button",className:`${tt.iconButton} ${tt.fullscreenButton} ${G?tt.iconButtonActive:""}`,onClick:W,"aria-label":F(G?"common.exitFullscreen":"common.fullscreen"),"aria-pressed":G,title:F(G?"common.exitFullscreen":"common.fullscreen"),children:G?a.jsx(uJ,{className:tt.toolbarIcon,"aria-hidden":!0}):a.jsx(oJ,{className:tt.toolbarIcon,"aria-hidden":!0})}),a.jsx("button",{type:"button",className:`${tt.iconButton} ${tt.panelToggleButton}`,onClick:ve,"aria-label":F("chatHeader.toggleRightPanel"),"aria-pressed":"true",title:F("chatHeader.toggleRightPanel"),children:a.jsx(z4e,{className:tt.panelToggleIcon})})]})]}),a.jsxs("div",{className:`${tt.body} ${ke?.kind==="side_task"?tt.bodySideTask:""}`.trim(),children:[n.filter(be=>be.kind==="web_preview").map(be=>a.jsx("div",{className:"h-full",hidden:be.id!==ke?.id,children:a.jsx(LRn,{state:be,onChange:Ie=>k?.(be.id,Ie)})},be.id)),n.filter(be=>be.kind==="terminal").map(be=>a.jsx("div",{className:`${tt.terminalPane} ${be.id===ke?.id?"":tt.terminalPaneHidden}`.trim(),"aria-hidden":be.id===ke?.id?void 0:!0,children:a.jsx(PRn,{terminalId:be.id,cwd:be.workspaceCwd??l,active:be.id===ke?.id,enabled:be.initialized!==!1})},be.id)),We&&a.jsxs("button",{type:"button",className:tt.attachmentPreviewButton,onClick:()=>ie(rt?void 0:ke?.id),"aria-label":F(rt?"attachment.showSource":"attachment.showPreview"),"aria-pressed":rt,children:[rt?a.jsx(qit,{"aria-hidden":!0}):a.jsx(N4e,{"aria-hidden":!0}),F(rt?"attachment.showSource":"attachment.showPreview")]}),u&&!ke?a.jsxs("div",{className:"flex flex-col gap-4 p-5","data-testid":"right-panel-loading-skeleton",role:"status","aria-label":F("common.loading"),children:[a.jsx(O0,{className:"h-5 w-2/5"}),a.jsx(O0,{className:"h-32 w-full"}),a.jsx(O0,{className:"h-4 w-4/5"}),a.jsx(O0,{className:"h-4 w-3/5"})]}):ke?.kind==="terminal"||ke?.kind==="web_preview"?null:ke?ke.kind==="pending"?a.jsx("div",{className:tt.empty,role:ke.loadError?"alert":"status",children:ke.loadError??F("common.loading")}):ke.kind==="workflow"?ke.sessionId?a.jsx(ETn,{tasks:q,loading:V,error:z,onOpenAgent:L}):H?a.jsx(g4n,{...H}):a.jsx("div",{className:tt.empty,children:F("workflow.empty.title")}):swe(ke)&&(ke.kind!=="scheduled_task"||ke.task.durable)&&(ke.kind!=="file"||!ke.previewOnly)&&(ke.kind!=="artifact"||ge?.metadata?.artifactType!=="web_preview_snapshot")&&!Fe?a.jsx("div",{className:tt.empty,role:"alert",children:F("workspace.notFoundDescription")}):ke.kind==="review"?a.jsx(F5n,{changes:ke.changes??r,selectedPath:ke.selectedPath??i,workspaceCwd:ke.workspaceCwd??l,onOpenFilePreview:be=>m(be,ke.workspaceCwd??l,ke.workspaceId),onDownloadFile:(be,Ie)=>jD(Fe,be.path,Ect(be.path),Ie),onDownloadError:be=>{const Ie=F("common.downloadFailed",{message:qa(be)});X?X(new Error(Ie,{cause:be}),Ie):console.error(Ie,be)}}):ke.kind==="file"?ke.attachmentId&&!ke.previewData&&ke.previewContent===void 0?a.jsx("div",{className:tt.empty,role:ke.loadError?"alert":"status",children:ke.loadError??F("common.loading")}):ke.sourcePreview&&ke.previewData&&Qw(ke.previewMimeType||ke.previewData.type)!=="application/pdf"&&!OT(ke.previewMimeType||ke.previewData.type,ke.workspacePath)?a.jsx(jPe,{data:ke.previewData,title:ke.title,image:!!Q_(ke.workspacePath)&&ke.previewData.type.startsWith("image/")}):a.jsx(WO,{workspacePath:ke.workspacePath,artifactVersion:String(ke.previewVersion??0),workspaceActions:Fe,previewContent:ke.previewContent,previewData:ke.previewData,previewMimeType:ke.previewMimeType,previewOnly:ke.previewOnly,previewKind:De||ke.previewOnly&&!rt?"source":void 0},ke.id):ke.kind==="source"?a.jsx(sAn,{tab:ke},ke.id):ke.kind==="artifact"?a.jsx($5n,{artifacts:t,artifactId:ke.artifactId,sourceSessionId:ke.sourceSessionId,workspaceActions:Fe,previewContent:ke.previewContent,loading:c,error:h},ke.id):ke.kind==="subagent"?de?null:a.jsx(uTn,{sessionId:ke.sessionId,rootToolCallId:ke.rootToolCallId,initialRootTool:ke.rootTool,workspaceCwd:ke.workspaceCwd??l,onRightPanelOpen:P,onArtifactsChange:D,onOpenSubagent:M,onError:X}):ke.kind==="monitor"?a.jsx(m6t,{task:ke.task,actions:ke.sessionActions},ke.id):ke.kind==="shell"?a.jsx(g6t,{task:ke.task,actions:ke.sessionActions},ke.id):ke.kind==="side_task"?a.jsx(ATn,{tabId:ke.id,sessionId:ke.sessionId,parentSessionId:ke.parentSessionId,workspaceCwd:ke.workspaceCwd??l,title:ke.title,shouldNameFromFirstPrompt:ke.nameFromFirstPrompt,initialPrompt:ke.initialPrompt,createSession:R??N5n,onCreated:N??A5n,onTitleChange:j??j5n,onRightPanelOpen:P,onArtifactsChange:D,onError:X,sessionWorkflowEnabled:ee,onImageIngestionNotice:Q},ke.id):ke.kind==="image"?ke.src?a.jsxs("div",{className:tt.imagePreviewWrap,children:[a.jsx("img",{src:ke.src,alt:ke.alt??ke.title,className:tt.imagePreview}),a.jsx("a",{className:tt.imageDownloadButton,href:ke.src,download:M5n(ke.src),"aria-label":F("common.download"),title:F("common.download"),children:a.jsx(Mw,{size:16,strokeWidth:1.8})})]}):a.jsx("div",{className:tt.empty,role:ke.loadError?"alert":"status",children:ke.loadError??F("common.loading")}):ke.kind==="context_usage"?a.jsx(T5n,{controls:e?.[ke.sessionId],sessionActions:ke.sessionActions,sessionId:ke.sessionId},ke.id):ke.kind==="trajectory"?a.jsx(w5n,{loadPage:ke.loadPage},ke.id):ke.kind==="token_usage"?a.jsx(k3n,{sessionActions:ke.sessionActions,sessionId:ke.sessionId},ke.id):a.jsx(B5n,{task:ke.task,actions:Fe},ke.id):a.jsxs("div",{className:tt.emptyActions,"data-testid":"right-panel-empty-actions",children:[S.includes("review")&&a.jsxs("button",{type:"button",className:tt.emptyAction,disabled:!g||!v,onClick:v,children:[a.jsx("span",{className:tt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(fq,{})}),a.jsx("span",{className:tt.emptyActionTitle,children:F("turnOutputs.review")}),a.jsx("span",{className:tt.emptyActionHint,children:F("turnOutputs.reviewLatest")}),a.jsx(Va,{className:tt.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]}),S.includes("sideTask")&&T&&C&&(E.length===0?a.jsxs("button",{type:"button",className:tt.emptyAction,disabled:A,"aria-busy":A,onClick:C,children:[a.jsx("span",{className:tt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(nN,{strokeWidth:1.6})}),a.jsx("span",{className:tt.emptyActionTitle,children:F("sideTask.title")}),a.jsx("span",{className:tt.emptyActionHint,children:F("sideTask.description")}),a.jsx(Va,{className:tt.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]}):a.jsxs(Nm,{open:pe,onOpenChange:J,modal:!1,children:[a.jsx(_p,{asChild:!0,children:a.jsxs("button",{type:"button",className:tt.emptyAction,"aria-expanded":pe,onMouseEnter:me,onMouseLeave:fe,children:[a.jsx("span",{className:tt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(nN,{strokeWidth:1.6})}),a.jsx("span",{className:tt.emptyActionTitle,children:F("sideTask.title")}),a.jsx("span",{className:tt.emptyActionHint,children:F("sideTask.description")}),a.jsx(Va,{className:tt.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]})}),a.jsxs(Sp,{align:"end",className:"w-80",onMouseEnter:me,onMouseLeave:fe,children:[E.map(be=>a.jsxs(Ii,{onSelect:()=>I?.(be),children:[a.jsx("span",{className:tt.sideTaskListTitle,children:be.title}),be.updatedAt&&a.jsx("span",{className:tt.sideTaskListTime,children:$T(be.updatedAt,F)})]},be.sessionId)),a.jsx(Fw,{}),a.jsxs(Ii,{onSelect:C,children:[a.jsx(Nit,{className:tt.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:tt.sideTaskListTitle,children:F("sideTask.new")})]})]})]})),ae&&a.jsxs("button",{type:"button",className:tt.emptyAction,onClick:x,children:[a.jsx("span",{className:tt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(A2,{strokeWidth:1.6})}),a.jsx("span",{className:tt.emptyActionTitle,children:F("webPreview.title")}),a.jsx("span",{className:tt.emptyActionHint,children:F("webPreview.openHint")}),a.jsx(Va,{className:tt.emptyActionChevron,"aria-hidden":"true"})]}),O&&a.jsxs("button",{type:"button",className:tt.emptyAction,onClick:()=>w?.(),"data-testid":"right-panel-open-trajectory",children:[a.jsx("span",{className:tt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(fz,{strokeWidth:1.6})}),a.jsx("span",{className:tt.emptyActionTitle,children:F("trajectory.title")}),a.jsx("span",{className:tt.emptyActionHint,children:F("trajectory.description")}),a.jsx(Va,{className:tt.emptyActionChevron,"aria-hidden":"true"})]}),y&&a.jsxs("button",{type:"button",className:tt.emptyAction,onClick:()=>y(),children:[a.jsx("span",{className:tt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(i2,{strokeWidth:1.6})}),a.jsx("span",{className:tt.emptyActionTitle,children:F("terminal.title")}),a.jsx("span",{className:tt.emptyActionHint,children:F("terminal.open")}),a.jsx(Va,{className:tt.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]})]})]})]})}function L5n(){return a.jsxs("svg",{className:tt.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 D5n(){return a.jsx("svg",{className:tt.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 fq(){return a.jsxs("svg",{className:tt.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 O5n(){return a.jsxs("svg",{className:tt.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 $5n({artifacts:e,artifactId:t,sourceSessionId:n,workspaceActions:s,previewContent:r,loading:i,error:o}){const l=e.find(c=>c.id===t);return l?a.jsx(Z5n,{artifact:l,sourceSessionId:n,workspaceActions:s,previewContent:r}):i?a.jsx("div",{className:tt.empty,children:"Loading artifact..."}):o?a.jsx("div",{className:tt.empty,children:o}):a.jsx("div",{className:tt.empty,children:"Artifact not found."})}function B5n({task:e,actions:t}){const{t:n}=lt(),[s,r]=d.useState(null),[i,o]=d.useState(!0),[l,c]=d.useState(null),[u,h]=d.useState(""),[f,p]=d.useState(e.prompt),[m,g]=d.useState(()=>bb(e.cron)),[v,y]=d.useState(!1),[w,b]=d.useState(!1),[x,k]=d.useState(!1),[S,T]=d.useState(!1),[E,A]=d.useState(null),C=d.useRef(0),I=d.useRef(0),R=d.useRef({actions:t,taskId:e.id,workspaceId:e.workspaceId});R.current={actions:t,taskId:e.id,workspaceId:e.workspaceId};const N=d.useCallback((F,pe,J,ue)=>{const ie=R.current;return F===C.current&&ie.actions===pe&&ie.taskId===J&&ie.workspaceId===ue},[]),j=d.useCallback((F,pe,J,ue)=>{const ie=R.current;return F===I.current&&ie.actions===pe&&ie.taskId===J&&ie.workspaceId===ue},[]);d.useEffect(()=>()=>{C.current+=1,I.current+=1},[]),d.useEffect(()=>{k(!1),T(!1),A(null)},[t,e.id,e.workspaceId]);const P=d.useCallback(async()=>{const F=++C.current,pe=++I.current,J=e.id,ue=e.workspaceId;if(!e.durable||!t){r(null),h(""),p(e.prompt),g(bb(e.cron)),c(null),o(!1);return}o(!0),c(null);try{const ie=await t.listScheduledTasks(ue);if(!N(F,t,J,ue))return;const ye=ie.find(me=>me.id===e.id)??null;r(ye),ye?(h(ye.name??""),p(ye.prompt),g(bb(ye.cron))):(h(""),p(e.prompt),g(bb(e.cron)))}catch(ie){j(pe,t,J,ue)&&c(ie instanceof Error?ie.message:String(ie))}finally{j(pe,t,J,ue)&&o(!1)}},[t,j,N,e.cron,e.durable,e.id,e.prompt,e.workspaceId]);d.useEffect(()=>{P()},[P]);const D=!e.durable,M=e.durable&&!i&&!l&&!s,q=!!s,V=s?.name||s?.prompt||e.title,z=s?.prompt??e.prompt,L=s?.cron??e.cron,X=s?.recurring??e.recurring,ee=s?.enabled,H=d.useCallback(()=>{s&&(h(s.name??""),p(s.prompt),g(bb(s.cron)),A(null),y(!0))},[s]),Q=d.useCallback(()=>{y(!1),A(null),s&&(h(s.name??""),p(s.prompt),g(bb(s.cron)))},[s]),de=d.useCallback(async()=>{if(!s||!t)return;const F=k7(m);if(!F){A(n("scheduledTasks.error.invalidSchedule"));return}if(f.trim().length===0){A(n("scheduledTasks.error.emptyPrompt"));return}const pe=++C.current,J=e.id,ue=e.workspaceId;T(!0),A(null);try{const ie=await t.updateScheduledTask(s.id,{cron:F,prompt:f.trim(),name:u.trim()||null},ue);if(!N(pe,t,J,ue))return;r(ie),h(ie.name??""),p(ie.prompt),g(bb(ie.cron)),y(!1)}catch(ie){N(pe,t,J,ue)&&A(ie instanceof Error?ie.message:String(ie))}finally{N(pe,t,J,ue)&&T(!1)}},[t,m,N,s,u,f,n,e.id,e.workspaceId]),ve=d.useCallback(async()=>{if(!s||!t)return;const F=++C.current,pe=e.id,J=e.workspaceId;k(!0),A(null);try{const ue=await t.updateScheduledTask(s.id,{enabled:!s.enabled},J);if(!N(F,t,pe,J))return;r(ue)}catch(ue){N(F,t,pe,J)&&A(ue instanceof Error?ue.message:String(ue))}finally{N(F,t,pe,J)&&k(!1)}},[t,N,s,e.id,e.workspaceId]),B=d.useCallback(async()=>{if(!s||!t)return;const F=++C.current,pe=e.id,J=e.workspaceId;k(!0),A(null);try{if(await t.deleteScheduledTask(s.id,J),!N(F,t,pe,J))return;r(null),b(!1)}catch(ue){N(F,t,pe,J)&&A(ue instanceof Error?ue.message:String(ue))}finally{N(F,t,pe,J)&&k(!1)}},[t,N,s,e.id,e.workspaceId]),G=k7(m),W=G?gT(G,n):null;return a.jsxs("div",{className:tt.detail,children:[i&&a.jsx("div",{className:tt.empty,children:n("scheduledTasks.loading")}),l&&a.jsx("div",{className:Wt.loadError,children:l}),M&&a.jsx("div",{className:tt.empty,children:n("scheduledTasks.deletedSnapshot")}),D&&a.jsx("div",{className:tt.empty,children:n("scheduledTasks.sessionScopedSnapshot")}),!M&&a.jsx("div",{className:tt.section,children:a.jsxs("div",{className:tt.fieldGrid,children:[a.jsx("span",{className:tt.fieldLabel,children:n("scheduledTasks.name")}),a.jsx("span",{className:tt.fieldValue,children:V}),a.jsx("span",{className:tt.fieldLabel,children:n("scheduledTasks.taskId")}),a.jsx("span",{className:tt.fieldValue,children:e.id}),a.jsx("span",{className:tt.fieldLabel,children:n("scheduledTasks.schedule")}),a.jsx("span",{className:tt.fieldValue,children:gT(L,n)}),a.jsx("span",{className:tt.fieldLabel,children:"Cron"}),a.jsx("span",{className:tt.fieldValue,children:L}),a.jsx("span",{className:tt.fieldLabel,children:n("scheduledTasks.type")}),a.jsx("span",{className:tt.fieldValue,children:n(X?"scheduledTasks.repeats":"scheduledTasks.runsOnce")}),ee!==void 0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:tt.fieldLabel,children:n("scheduledTasks.status")}),a.jsx("span",{className:tt.fieldValue,children:n(ee?"scheduledTasks.enable":"scheduledTasks.disable")})]})]})}),!M&&a.jsxs("div",{className:tt.section,children:[a.jsx("div",{className:tt.sectionTitle,children:"Prompt"}),a.jsx("div",{className:tt.description,children:z})]}),E&&a.jsx("div",{className:Wt.formError,children:E}),a.jsxs("div",{className:tt.actionsRow,children:[a.jsx("button",{type:"button",className:Wt.primaryButton,disabled:!q||x,onClick:H,children:n("scheduledTasks.edit")}),a.jsx("button",{type:"button",className:Wt.secondaryButton,disabled:!q||x,onClick:()=>void ve(),children:s?.enabled?n("scheduledTasks.disable"):n("scheduledTasks.enable")}),a.jsx("button",{type:"button",className:Wt.secondaryButton,disabled:!q||x,onClick:()=>b(!0),children:n("scheduledTasks.delete")})]}),w&&s&&a.jsx(Xo,{title:n("scheduledTasks.deleteConfirmTitle"),size:"sm",onClose:()=>b(!1),children:a.jsxs("div",{className:Wt.formFields,children:[a.jsx("div",{className:tt.description,children:n("scheduledTasks.deleteConfirm",{name:s.name||s.prompt})}),E&&a.jsx("div",{className:Wt.formError,children:E}),a.jsxs("div",{className:Wt.formActions,children:[a.jsx("button",{type:"button",className:Wt.secondaryButton,onClick:()=>b(!1),disabled:x,children:n("scheduledTasks.cancel")}),a.jsx("button",{type:"button",className:Wt.primaryButton,onClick:()=>void B(),disabled:x,children:n("scheduledTasks.delete")})]})]})}),v&&a.jsx(Xo,{title:n("scheduledTasks.editTitle"),size:"md",onClose:Q,children:a.jsxs("div",{className:Wt.formFields,children:[a.jsxs("label",{className:Wt.field,children:[a.jsx("span",{className:Wt.fieldLabel,children:n("scheduledTasks.name")}),a.jsx("input",{className:Wt.input,type:"text",value:u,maxLength:200,placeholder:n("scheduledTasks.namePlaceholder"),onChange:F=>h(F.target.value)})]}),a.jsxs("label",{className:Wt.field,children:[a.jsxs("span",{className:Wt.fieldLabel,children:[n("scheduledTasks.prompt"),a.jsx("span",{className:Wt.required,children:"*"})]}),a.jsx("textarea",{className:Wt.textarea,value:f,rows:4,maxLength:1e5,placeholder:n("scheduledTasks.promptPlaceholder"),onChange:F=>p(F.target.value)})]}),a.jsxs("div",{className:Wt.scheduleRow,children:[a.jsxs("label",{className:Wt.field,children:[a.jsx("span",{className:Wt.fieldLabel,children:n("scheduledTasks.frequency")}),a.jsx("select",{className:Wt.select,value:m.frequency,onChange:F=>{const pe=F.target.value;g(J=>({...J,frequency:pe,...pe==="hourly"?{time:"00:00"}:{}}))},children:E5n.map(F=>a.jsx("option",{value:F,children:n(`scheduledTasks.freq.${F}`)},F))})]}),(m.frequency==="daily"||m.frequency==="weekdays"||m.frequency==="weekly")&&a.jsxs("label",{className:Wt.field,children:[a.jsx("span",{className:Wt.fieldLabel,children:n("scheduledTasks.time")}),a.jsx("input",{className:Wt.input,type:"time",value:m.time,onChange:F=>g(pe=>({...pe,time:F.target.value}))})]}),m.frequency==="weekly"&&a.jsxs("label",{className:Wt.field,children:[a.jsx("span",{className:Wt.fieldLabel,children:n("scheduledTasks.weekday")}),a.jsx("select",{className:Wt.select,value:m.weekday,onChange:F=>g(pe=>({...pe,weekday:Number(F.target.value)})),children:n("scheduledTasks.weekdayNames").split(",").map((F,pe)=>a.jsx("option",{value:pe,children:F},pe))})]}),m.frequency==="minutes"&&a.jsxs("label",{className:Wt.field,children:[a.jsx("span",{className:Wt.fieldLabel,children:n("scheduledTasks.interval")}),a.jsx("select",{className:Wt.select,value:m.minuteInterval,onChange:F=>g(pe=>({...pe,minuteInterval:Number(F.target.value)})),children:R5n.map(F=>a.jsx("option",{value:F,children:F},F))})]}),m.frequency==="custom"&&a.jsxs("label",{className:`${Wt.field} ${Wt.fieldGrow}`,children:[a.jsx("span",{className:Wt.fieldLabel,children:n("scheduledTasks.cron")}),a.jsx("input",{className:Wt.input,type:"text",value:m.customCron,spellCheck:!1,placeholder:"0 9 * * 1-5",onChange:F=>g(pe=>({...pe,customCron:F.target.value}))})]})]}),a.jsx("div",{className:Wt.preview,children:W?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:Wt.previewLabel,children:W}),a.jsx("code",{className:Wt.previewCron,children:G})]}):a.jsx("span",{className:Wt.previewInvalid,children:n("scheduledTasks.error.invalidSchedule")})}),E&&a.jsx("div",{className:Wt.formError,children:E}),a.jsxs("div",{className:Wt.formActions,children:[a.jsx("button",{type:"button",className:Wt.secondaryButton,onClick:Q,disabled:S,children:n("scheduledTasks.cancel")}),a.jsx("button",{type:"button",className:Wt.primaryButton,onClick:()=>void de(),disabled:S,children:n(S?"scheduledTasks.saving":"scheduledTasks.save")})]})]})})]})}function F5n({changes:e,selectedPath:t,workspaceCwd:n,onOpenFilePreview:s,onDownloadFile:r,onDownloadError:i}){const{t:o}=lt(),[l,c]=d.useState(!1),[u,h]=d.useState(!0),[f,p]=d.useState(!1),[m,g]=d.useState(520),v=d.useRef(m),y=d.useRef(null),w=d.useRef(null),[b,x]=d.useState(null),[k,S]=d.useState(()=>new Set),T=d.useRef(!0);d.useEffect(()=>(T.current=!0,()=>{T.current=!1}),[]);const E=l,A=d.useMemo(()=>X5n(e,n),[e,n]);d.useEffect(()=>{x(t)},[t]),d.useEffect(()=>{v.current=m},[m]),d.useEffect(()=>{const j=y.current;if(!j)return;const P=()=>{p(j.clientWidth<I5n)};P();const D=new ResizeObserver(P);return D.observe(j),()=>D.disconnect()},[u]),d.useEffect(()=>()=>w.current?.(),[]);const C=d.useCallback(j=>{const P=y.current;if(!P)return;j.preventDefault();const D=j.currentTarget;D.setPointerCapture(j.pointerId);const M=j.clientX,q=v.current,V=P.getBoundingClientRect().width,z=Math.max(180,V-180),L=document.body.style.cursor,X=document.body.style.userSelect;let ee=q,H=null;document.body.style.cursor="col-resize",document.body.style.userSelect="none";const Q=()=>{H=null,g(ee)},de=G=>{ee=Math.min(z,Math.max(180,q+(G.clientX-M))),H===null&&(H=window.requestAnimationFrame(Q))};let ve=()=>{};const B=G=>{w.current=null,H!==null&&(window.cancelAnimationFrame(H),H=null),G&&g(ee),D.hasPointerCapture(j.pointerId)&&D.releasePointerCapture(j.pointerId),document.body.style.cursor=L,document.body.style.userSelect=X,window.removeEventListener("pointermove",de),window.removeEventListener("pointerup",ve),window.removeEventListener("pointercancel",ve)};ve=()=>B(!0),w.current=()=>B(!1),window.addEventListener("pointermove",de),window.addEventListener("pointerup",ve),window.addEventListener("pointercancel",ve)},[]);if(e.length===0)return a.jsx("div",{className:tt.empty,children:"No file changes to review."});const I=I6e(e),R=j=>{x(P=>P===j?null:j)},N=async j=>{if(!k.has(j.path)){S(P=>new Set(P).add(j.path));try{await r(j,()=>!T.current)}catch(P){T.current&&i(P)}finally{S(P=>{const D=new Set(P);return D.delete(j.path),D})}}};return a.jsxs("div",{className:tt.review,children:[a.jsxs("div",{className:tt.reviewToolbar,children:[a.jsxs("div",{className:tt.reviewToolbarTitle,children:[a.jsx("span",{children:o("turnOutputs.previousTurn")}),a.jsx(dP,{additions:I?.additions,deletions:I?.deletions,className:tt.lineStats,additionsClassName:tt.additions,deletionsClassName:tt.deletions})]}),a.jsxs("div",{className:tt.reviewToolbarActions,children:[a.jsxs("button",{type:"button",className:tt.reviewTotalsButton,onClick:()=>h(j=>!j),"aria-expanded":u,children:[a.jsx("span",{children:o("turnOutputs.fileCount",{count:e.length})}),a.jsx("span",{className:[tt.chevron,u?tt.chevronOpen:""].filter(Boolean).join(" "),"aria-hidden":"true",children:a.jsx(owe,{})})]}),a.jsx("button",{type:"button",className:[tt.iconButton,l?tt.iconButtonActive:""].filter(Boolean).join(" "),onClick:()=>c(j=>!j),"aria-label":o(l?"turnOutputs.closeFileTree":"turnOutputs.openFileTree"),title:o(l?"turnOutputs.closeFileTree":"turnOutputs.openFileTree"),children:l?a.jsx(K5n,{}):a.jsx(G5n,{})})]})]}),u&&a.jsxs("div",{ref:y,className:[tt.reviewContent,E?"":tt.reviewContentListOnly,E&&f?tt.reviewContentStacked:""].filter(Boolean).join(" "),style:{"--review-list-width":`${m}px`},children:[a.jsx("div",{className:[tt.reviewList,b?tt.reviewListWithExpanded:""].filter(Boolean).join(" "),children:e.map(j=>{const P=b===j.path,D=A6e(j.path),M=IBt(j.path);return a.jsxs("div",{className:[tt.reviewItem,P?tt.reviewItemExpanded:""].filter(Boolean).join(" "),children:[a.jsxs("div",{className:tt.reviewRow,"data-selected":j.path===t||void 0,children:[a.jsx("button",{type:"button",className:tt.reviewRowToggle,onClick:()=>R(j.path),"aria-label":j.path,"aria-expanded":P}),a.jsx("span",{className:tt.fileIcon,children:APe(j.path)}),a.jsxs("span",{className:tt.reviewFileName,children:[a.jsx(q5n,{path:mO(j.path,n),title:j.path}),D&&a.jsx("button",{type:"button",className:tt.reviewOpenButton,onClick:()=>s(j),title:`${o("turnOutputs.preview")} ${j.path}`,children:o("turnOutputs.preview")}),M&&a.jsx("button",{type:"button",className:tt.reviewOpenButton,onClick:()=>void N(j),title:`${o("common.download")} ${j.path}`,disabled:k.has(j.path),children:o(k.has(j.path)?"common.downloading":"common.download")})]}),a.jsx(dP,{additions:j.additions,deletions:j.deletions,className:tt.lineStats,additionsClassName:tt.additions,deletionsClassName:tt.deletions}),a.jsx("span",{className:[tt.chevron,P?tt.chevronOpen:""].filter(Boolean).join(" "),"aria-hidden":"true",children:a.jsx(owe,{})})]}),P&&a.jsx(z5n,{change:j})]},`${j.toolCallId}:${j.path}`)})}),E&&!f&&a.jsx("div",{className:tt.reviewSplitHandle,role:"separator","aria-orientation":"vertical",onPointerDown:C}),E&&a.jsx("div",{className:tt.tree,children:A.children.map(j=>a.jsx(IPe,{node:j,depth:0,selectedPath:t},j.path))})]})]})}function z5n({change:e}){if(e.diffs.length===0)return a.jsx("div",{className:tt.diffEmpty,children:"No diff available."});const t=H5n(e.diffs);return a.jsx("div",{className:tt.diffPreview,children:t.map((n,s)=>n.fileDiff&&!n.fullContent?a.jsx(Dee,{diff:n.fileDiff},s):a.jsx(U5n,{oldText:n.oldText,newText:n.newText},s))})}function H5n(e){for(let t=e.length-1;t>=0;t--)if(e[t]?.fullContent)return e.slice(t);return e}function U5n({oldText:e,newText:t}){const n=d.useRef(null),[s,r]=d.useState(null),[i,o]=d.useState(null);return d.useEffect(()=>{const l=n.current;if(!l)return;const c=()=>r(l.clientWidth>=720);c();const u=new ResizeObserver(c);return u.observe(l),()=>u.disconnect()},[]),d.useEffect(()=>{const l=n.current;if(!l||s===null)return;l.replaceChildren(),o(null);let c=!1,u=null;const h=[b8e,ls.editable.of(!1),Co.readOnly.of(!0),ls.lineWrapping],f={scanLimit:1e3,timeout:500},p={margin:3,minSize:8};return He(async()=>{const{MergeView:m,unifiedMergeView:g}=await import("./index-CJ63h8ay.js");return{MergeView:m,unifiedMergeView:g}},[]).then(({MergeView:m,unifiedMergeView:g})=>{if(!c)try{if(s){u=new m({a:{doc:e,extensions:h},b:{doc:t,extensions:h},parent:l,highlightChanges:!0,gutter:!0,revertControls:void 0,collapseUnchanged:p,diffConfig:f});return}u=new ls({doc:t,extensions:[...h,g({original:e,highlightChanges:!0,gutter:!0,mergeControls:!1,allowInlineDiffs:!0,collapseUnchanged:p,diffConfig:f})],parent:l})}catch(v){c||o(v instanceof Error?v.message:String(v))}}).catch(m=>{c||o(m instanceof Error?m.message:String(m))}),()=>{c=!0,u?.destroy()}},[s,t,e]),a.jsxs("div",{className:tt.codeMirrorDiffWrap,children:[a.jsx("div",{ref:n,className:tt.codeMirrorDiff}),i&&a.jsxs("div",{className:tt.diffError,children:["Diff unavailable: ",i]})]})}function IPe({node:e,depth:t,selectedPath:n}){const s=!!e.file,[r,i]=d.useState(!0),o=[tt.treeRow,s?tt.treeFile:tt.treeFolder].filter(Boolean).join(" "),l={paddingLeft:10+t*18,"--tree-row-line-left":`${19+Math.max(0,t-1)*18}px`},c={"--tree-children-line-left":`${19+t*18}px`},u=a.jsxs(a.Fragment,{children:[a.jsx("span",{className:tt.treeTwisty,children:!s&&a.jsx("span",{className:[tt.treeChevron,r?"":tt.treeChevronClosed].filter(Boolean).join(" "),children:a.jsx(Y5n,{})})}),a.jsxs("span",{className:tt.treeContent,children:[s&&a.jsx("span",{className:tt.fileIcon,children:APe(e.path)}),a.jsx("span",{className:tt.treeName,children:e.name})]}),e.file?.isArtifact&&a.jsx("span",{className:tt.reviewBadge,children:"artifact"})]});return a.jsxs("div",{className:tt.treeNode,children:[s?a.jsx("div",{className:o,"data-selected":e.file?.path===n||void 0,"data-depth":t,style:l,title:e.path,children:u}):a.jsx("button",{type:"button",className:o,"data-depth":t,style:l,title:e.path,"aria-expanded":r,onClick:()=>i(h=>!h),children:u}),!s&&r&&e.children.length>0&&a.jsx("div",{className:tt.treeChildren,style:c,children:e.children.map(h=>a.jsx(IPe,{node:h,depth:t+1,selectedPath:n},h.path))})]})}function q5n({path:e,title:t}){const n=d.useRef(null),[s,r]=d.useState(()=>EPe(e));return d.useLayoutEffect(()=>{const i=n.current;if(!i)return;const o=()=>r(W5n(e,i));o();const l=new ResizeObserver(o);return l.observe(i),()=>l.disconnect()},[e]),a.jsxs("span",{ref:n,className:tt.reviewPath,title:t??e,children:[s.prefix&&a.jsx("span",{className:tt.pathPrefix,children:s.prefix}),a.jsx("span",{className:tt.pathFileName,children:s.leaf})]})}function EPe(e){const t=e.lastIndexOf("/");return t<0?{prefix:"",leaf:e}:{prefix:e.slice(0,t+1),leaf:e.slice(t+1)}}let iwe=null;function W5n(e,t){const n=EPe(e),s=t.clientWidth;if(s<=0)return n;const r=V5n(t);if(r(e)<=s)return n;const i=e.split("/").filter(Boolean),o=i.at(-1)??e,l=r(o);if(i.length<=1||l+r(".../")>s)return{prefix:"",leaf:o};let c=".../";for(let u=1;u<i.length;u++){const f=`.../${i.slice(i.length-1-u,-1).join("/")}/`;if(r(f)+l>s)break;c=f}return{prefix:c,leaf:o}}function V5n(e){iwe??=document.createElement("canvas");const t=iwe.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 G5n(){return a.jsxs("svg",{className:tt.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 K5n(){return a.jsxs("svg",{className:tt.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 owe(){return a.jsx("svg",{className:tt.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 Y5n(){return a.jsx("svg",{className:tt.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 X5n(e,t){const n={name:"",path:"",children:[]};for(const s of e){const r=mO(s.path,t).split("/").filter(Boolean);let i=n;for(let o=0;o<r.length;o++){const l=r[o],c=r.slice(0,o+1).join("/");let u=i.children.find(h=>h.name===l);u||(u={name:l,path:c,children:[]},i.children.push(u)),o===r.length-1&&(u.file=s),i=u}}return RPe(n),n}function RPe(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)RPe(t)}function a9(e){return Jw(e).split("/").filter(Boolean).at(-1)??e}function APe(e){const t=a9(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 Z5n({artifact:e,sourceSessionId:t,workspaceActions:n,previewContent:s}){const{t:r}=lt(),i=Lf(),o=iIe(e),l=d4(e.url)?e.url:void 0,c=e.metadata?.artifactType==="automation_snapshot",u=e.metadata?.artifactType==="code_review",h=e.storage==="workspace"&&!!e.workspacePath,f=rIe(e);return e.metadata?.artifactType==="web_preview_snapshot"?a.jsx(DRn,{artifact:e,sourceSessionId:t}):u?e.status!=="available"?a.jsx(Q5n,{status:e.status}):!h||!e.workspacePath?a.jsx(J5n,{}):a.jsx(G2n,{workspacePath:e.workspacePath,artifactVersion:zce(e),workspaceActions:n}):h&&e.workspacePath?nIe(e)?a.jsx(nAn,{artifact:e,workspaceActions:n}):a.jsx(WO,{workspacePath:e.workspacePath,artifactVersion:zce(e),workspaceActions:n,previewContent:s,previewSizeBytes:e.sizeBytes,imageMimeType:f,previewKind:eAn(e)?"html":tAn(e)?"markdown":f?"image":"source"}):a.jsxs("div",{className:tt.detail,children:[a.jsxs("div",{className:tt.section,children:[a.jsx("div",{className:tt.sectionTitle,children:c?"Automation Snapshot":"Artifact"}),a.jsxs("div",{className:tt.fieldGrid,children:[a.jsx(hf,{label:"Type",value:hJ(e.kind,e.workspacePath)}),a.jsx(hf,{label:"Storage",value:e.storage}),a.jsx(hf,{label:"Status",value:e.status}),a.jsx(hf,{label:"Source",value:e.source}),a.jsx(hf,{label:"Size",value:AD(e.sizeBytes)}),a.jsx(hf,{label:"Created",value:e.createdAt}),a.jsx(hf,{label:"Updated",value:e.updatedAt}),e.toolName&&a.jsx(hf,{label:"Tool",value:e.toolName}),e.toolCallId&&a.jsx(hf,{label:"Tool call",value:e.toolCallId})]})]}),e.description&&a.jsxs("div",{className:tt.section,children:[a.jsx("div",{className:tt.sectionTitle,children:"Description"}),a.jsx("div",{className:tt.description,children:e.description})]}),c&&e.metadata&&a.jsxs("div",{className:tt.section,children:[a.jsx("div",{className:tt.sectionTitle,children:"Details"}),a.jsxs("div",{className:tt.fieldGrid,children:[wC(e.metadata,"automationId","Automation ID"),wC(e.metadata,"schedule","Schedule"),wC(e.metadata,"timezone","Timezone"),wC(e.metadata,"status","Status"),wC(e.metadata,"nextRunAt","Next run"),wC(e.metadata,"prompt","Prompt")]})]}),(o||l)&&a.jsxs("div",{className:tt.section,children:[a.jsx("div",{className:tt.sectionTitle,children:"Location"}),l?a.jsxs("div",{className:tt.locationRow,children:[a.jsx("a",{className:tt.link,href:l,target:"_blank",rel:"noopener noreferrer",onClick:p=>i(p,l),children:l}),a.jsx("a",{className:tt.openButton,href:l,target:"_blank",rel:"noopener noreferrer",onClick:p=>i(p,l),children:r("artifact.openLink")})]}):a.jsx("div",{className:tt.meta,children:o})]})]})}function Q5n({status:e}){const{t}=lt();return a.jsx("div",{className:tt.previewError,role:"alert",children:t("codeReview.unavailable",{status:e})})}function J5n(){const{t:e}=lt();return a.jsx("div",{className:tt.previewError,role:"alert",children:e("codeReview.workspaceRequired")})}function eAn(e){const t=e.workspacePath?.toLowerCase()??"",n=Qw(e.mimeType);return e.kind==="html"||t.endsWith(".html")||t.endsWith(".htm")||n==="text/html"}function tAn(e){const t=e.workspacePath?.toLowerCase()??"",n=Qw(e.mimeType);return t.endsWith(".md")||t.endsWith(".markdown")||n==="text/markdown"}function nAn({artifact:e,workspaceActions:t}){const{t:n}=lt(),[s,r]=d.useState(null),[i,o]=d.useState(!1),l=d.useRef(!0),c=iIe(e);d.useEffect(()=>(l.current=!0,()=>{l.current=!1}),[]);const u=async()=>{if(e.workspacePath){o(!0),r(null);try{await jD(t,e.workspacePath,e.mimeType,()=>!l.current)}catch(h){if(!l.current)return;r(h instanceof Error?h.message:String(h))}finally{l.current&&o(!1)}}};return a.jsx("div",{className:tt.detail,children:a.jsxs("div",{className:tt.section,children:[a.jsx("div",{className:tt.sectionTitle,children:n("common.download")}),a.jsxs("div",{className:tt.fieldGrid,children:[a.jsx(hf,{label:"Type",value:hJ(e.kind,e.workspacePath)}),a.jsx(hf,{label:"Size",value:AD(e.sizeBytes)}),c?a.jsx(hf,{label:"Location",value:c}):null,e.status!=="available"&&e.status!=="changed"?a.jsx(hf,{label:"Status",value:e.status??"missing"}):null]}),a.jsx("div",{className:tt.downloadRow,children:a.jsx("button",{type:"button",className:tt.downloadButton,onClick:()=>{u()},disabled:i||e.status!=="available"&&e.status!=="changed",children:n(i?"common.downloading":"common.download")})}),s&&a.jsx("div",{className:tt.previewError,children:s})]})})}function sAn({tab:e}){const{t}=lt(),n=la(),s=g4(e.workspaceCwd),r=s?.actions,i=Lf(),[o,l]=d.useState(0),[c,u]=d.useState(),[h,f]=d.useState(),[p,m]=d.useState(),g=e.source,v=g.locator,y=e.owner.isCurrent()&&n.sessionId===e.sourceSessionId&&n.capabilities?.features.includes("session_sources")&&s?.workspaceId===e.workspaceId&&(!!s||e.workspaceCwd===void 0&&v.type!=="workspace_file")&&(v.type!=="workspace_file"||g.workspaceCwd===n.workspaceCwd),w=v.type==="workspace_file"?v.workspacePath:v.type==="attachment"?v.attachmentId:"",b=/\.pdf$/i.test(w);if(d.useEffect(()=>{let k=!1;return u(void 0),f(void 0),m(void 0),!y||v.type==="url"?void 0:((async()=>{if(v.type==="attachment"){const T=await e.sessionActions.readAttachment(v.attachmentId);if(k||!e.owner.isCurrent())return;const E=Uint8Array.from(atob(T.data),A=>A.charCodeAt(0));u(new Blob([E],{type:T.mimeType}))}else if(b&&r){const T=await n4(r.readFileBytes,w,"application/pdf",{statFile:r.stat,isCancelled:()=>k||!e.owner.isCurrent()});!k&&e.owner.isCurrent()&&u(T)}})().catch(T=>{!k&&e.owner.isCurrent()&&f(qa(T))}),()=>{k=!0})},[o,y,v,w,b,e.owner,e.sessionActions,r]),y&&v.type==="url")return a.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[a.jsx("h3",{children:g.title}),g.description&&a.jsx("p",{children:g.description}),a.jsx("p",{className:"break-all text-sm text-muted-foreground",children:v.url}),d4(v.url)&&a.jsx("a",{className:"text-primary underline",href:v.url,target:"_blank",rel:"noopener noreferrer",onClick:k=>i(k,v.url),children:t("sources.openOriginal")})]});if(!y||!s&&v.type!=="attachment")return a.jsx("div",{className:tt.empty,role:"alert",children:t("sources.unavailable")});const x=v.type==="workspace_file"&&!b&&nIe({workspacePath:w});return a.jsxs("div",{className:"flex h-full min-h-0 flex-1 flex-col",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-border px-3 py-2",children:[a.jsx("span",{className:"truncate text-xs text-muted-foreground",title:w,children:w}),a.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[p&&a.jsx(ht,{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(Mw,{})})}),h&&a.jsx(ht,{variant:"ghost",size:"sm",onClick:()=>l(k=>k+1),children:t("common.retry")})]})]}),h?a.jsx("div",{className:tt.previewError,role:"alert",children:h}):x?a.jsxs("div",{className:"p-4",children:[a.jsx("p",{children:t("attachment.previewUnsupported")}),a.jsx(ht,{onClick:()=>void jD(r,w,"application/octet-stream",()=>!e.owner.isCurrent()).catch(k=>{e.owner.isCurrent()&&f(qa(k))}),children:t("common.download")})]}):(v.type==="attachment"||b)&&!c?a.jsx("div",{className:tt.empty,role:"status",children:t("common.loading")}):c&&c.type!=="application/pdf"&&!OT(c.type,w)?a.jsx(jPe,{data:c,title:g.title,onDownloadUrl:m,showDownload:!1,image:!!Q_(w)&&c.type.startsWith("image/")}):a.jsx("div",{className:"relative min-h-0 flex-1 overflow-auto",children:a.jsx(WO,{workspacePath:w,workspaceActions:r,onLoadError:f,previewData:c,previewOnly:v.type==="attachment",previewMimeType:c?.type,previewKind:/\.html?$/i.test(w)||Qw(c?.type)==="text/html"?"source":void 0},o)})]})}function jPe({data:e,title:t,image:n,onDownloadUrl:s,showDownload:r=!0}){const[i,o]=d.useState();return d.useEffect(()=>{const l=URL.createObjectURL(e);return o(l),s?.(l),()=>URL.revokeObjectURL(l)},[e,s]),i?a.jsxs("div",{className:tt.imagePreviewWrap,children:[n?a.jsx("img",{className:tt.imagePreview,src:i,alt:t}):a.jsx(NPe,{name:t,mimeType:e.type,size:e.size}),r&&a.jsx("a",{href:i,download:t,"aria-label":`Download ${t}`,children:a.jsx(Mw,{})})]}):null}function WO({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewData:i,previewMimeType:o,imageMimeType:l,previewKind:c,previewOnly:u,onLoadError:h}){if(i)return a.jsx(rAn,{workspacePath:e,workspaceActions:n,data:i,mimeType:o,previewKind:c,onLoadError:h});const f=e.toLowerCase(),p=l??Q_(e),m=c??(f.endsWith(".html")||f.endsWith(".htm")?"html":f.endsWith(".md")||f.endsWith(".markdown")?"markdown":p?"image":"source");return m==="html"?a.jsx(lAn,{workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:u,onLoadError:h}):m==="markdown"?a.jsx(uAn,{workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:u,onLoadError:h}):m==="image"&&p?a.jsx(aAn,{workspacePath:e,artifactVersion:t,workspaceActions:n,mimeType:p,onLoadError:h}):a.jsx(MPe,{workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:u,onLoadError:h})}function rAn({workspacePath:e,workspaceActions:t,data:n,mimeType:s,previewKind:r,onLoadError:i}){const o=(s||n.type||"application/octet-stream").split(";",1)[0].trim().toLowerCase();return o==="application/pdf"?a.jsx(oAn,{data:n,mimeType:o,title:e}):OT(o,e)?a.jsx(iAn,{workspacePath:e,workspaceActions:t,data:n,previewKind:r,onLoadError:i}):a.jsx(NPe,{name:e,mimeType:o,size:n.size})}function iAn({workspacePath:e,workspaceActions:t,data:n,previewKind:s,onLoadError:r}){const{t:i}=lt(),[o,l]=d.useState(),[c,u]=d.useState();return d.useEffect(()=>{const h=new FileReader;return l(void 0),u(void 0),h.onload=()=>l(String(h.result??"")),h.onerror=()=>{const f=i("attachment.readFailed");u(f),r?.(f)},h.readAsText(n),()=>{h.readyState===FileReader.LOADING&&h.abort()}},[n,r,i]),c?a.jsx("div",{className:tt.previewError,children:c}):o===void 0?a.jsx("div",{className:tt.empty,children:i("attachment.loadingFile")}):a.jsx(WO,{workspacePath:e,workspaceActions:t,previewContent:o,previewSizeBytes:n.size,previewOnly:!0,previewKind:s})}function oAn({data:e,mimeType:t,title:n}){const{t:s}=lt(),[r,i]=d.useState();return d.useEffect(()=>{const o=URL.createObjectURL(e.type===t?e:new Blob([e],{type:t}));return i(o),()=>URL.revokeObjectURL(o)},[e,t]),r?a.jsx("iframe",{className:tt.pdfAttachmentPreview,src:r,title:`Preview ${n}`}):a.jsx("div",{className:tt.empty,children:s("attachment.loadingPreview")})}function NPe({name:e,mimeType:t,size:n}){const{t:s}=lt();return a.jsxs("div",{className:tt.unsupportedAttachmentPreview,children:[a.jsx(vg,{name:e,mimeType:t,"aria-hidden":"true"}),a.jsx("div",{children:s("attachment.previewUnsupported")}),a.jsxs("div",{className:tt.unsupportedAttachmentMeta,children:[t," · ",AD(n)]})]})}function aAn({workspacePath:e,artifactVersion:t,workspaceActions:n,mimeType:s,onLoadError:r}){const[i,o]=d.useState(null),[l,c]=d.useState(null);return d.useEffect(()=>{let u=!1,h;return o(null),c(null),n4((f,p)=>n.readFileBytes(f,p),e,s,{statFile:f=>n.stat(f),isCancelled:()=>u}).then(f=>{u||(h=URL.createObjectURL(f),o(h))}).catch(f=>{if(u)return;const p=f instanceof Error?f.message:String(f);c(p),r?.(p)}),()=>{u=!0,h&&URL.revokeObjectURL(h)}},[t,s,r,n,e]),a.jsxs("div",{className:tt.imagePreviewWrap,children:[i?a.jsxs(a.Fragment,{children:[a.jsx("img",{className:tt.imagePreview,src:i,alt:a9(e)}),a.jsx("a",{className:tt.imageDownloadButton,href:i,download:a9(e),"aria-label":`Download ${a9(e)}`,title:"Download",children:a.jsx(Mw,{size:16,strokeWidth:1.8})})]}):l?null:a.jsx("div",{className:tt.empty,children:"Loading image..."}),l&&a.jsx("div",{className:tt.previewError,children:l})]})}function Hne({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:r,onLoadError:i}){const[o,l]=d.useState(s??null),[c,u]=d.useState(),[h,f]=d.useState(null);return d.useEffect(()=>{let p=!1;if(l(s??null),f(null),u(void 0),!r)return n.stat(e).then(m=>{if(!p){if(m.type==="directory")throw new Error("Directories cannot be opened as artifacts.");return n.readWorkspaceFile(e,{maxBytes:256*1024})}}).then(async m=>{if(p||!m||!m.truncated)return m;const g=await n4((v,y)=>n.readFileBytes(v,y),e,"application/octet-stream",{statFile:v=>n.stat(v),isCancelled:()=>p});return{sizeBytes:g.size,content:new TextDecoder(m.encoding||"utf-8").decode(await g.arrayBuffer())}}).then(m=>{p||!m||(u(m.sizeBytes),l(m.content))}).catch(m=>{if(p)return;const g=m instanceof Error?m.message:String(m);f(g),i?.(g)}),()=>{p=!0}},[t,s,r,i,n,e]),{content:o,error:h,sizeBytes:c}}function lAn({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:i,onLoadError:o}){const{content:l,error:c,sizeBytes:u}=Hne({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:i,onLoadError:o});return a.jsxs("div",{className:tt.htmlPreviewWrap,children:[l===null?!c&&a.jsx("div",{className:tt.empty,children:"Loading preview..."}):a.jsx(PPe,{content:l,sizeBytes:u??r,workspacePath:e,workspaceActions:n,children:()=>a.jsx(cAn,{content:l,workspacePath:e})}),c&&a.jsx("div",{className:tt.previewError,children:c})]})}function cAn({content:e,workspacePath:t}){const n=`Preview ${t}`,{t:s}=lt(),[r,i]=d.useState(null),[o,l]=d.useState(null);return d.useEffect(()=>{const c=new AbortController;return i(null),l(null),Rct(e,n,c.signal).then(u=>{c.signal.aborted||i(u)},u=>{c.signal.aborted||l(qa(u))}),()=>c.abort()},[e,n]),o?a.jsx("div",{className:tt.previewError,children:s("artifact.previewFailed",{message:o})}):r===null?a.jsx("div",{className:tt.empty,children:s("attachment.loadingPreview")}):a.jsx("iframe",{className:tt.htmlPreview,referrerPolicy:"no-referrer",sandbox:"allow-scripts",srcDoc:r,title:n})}function MPe({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:r,onLoadError:i}){const o=d.useRef(null),[l,c]=d.useState(null),{content:u,error:h}=Hne({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:r,onLoadError:i});return d.useEffect(()=>{const f=o.current;if(!f||u===null)return;f.replaceChildren(),c(null);let p;try{p=new ls({doc:u,extensions:[b8e,ls.editable.of(!1),Co.readOnly.of(!0),ls.lineWrapping],parent:f})}catch(m){c(m instanceof Error?m.message:String(m));return}return()=>p.destroy()},[u]),a.jsxs("div",{className:tt.filePreviewWrap,children:[u===null?!h&&a.jsx("div",{className:tt.empty,children:"Loading file..."}):a.jsx("div",{ref:o,className:tt.codeMirrorFile}),(h||l)&&a.jsx("div",{className:tt.previewError,children:h||l})]})}function PPe({content:e,sizeBytes:t,workspacePath:n,workspaceActions:s,children:r}){const{t:i}=lt(),[o,l]=d.useState(null);if(!d.useMemo(()=>(t??new TextEncoder().encode(e).byteLength)>1024*1024,[e,t]))return r();const u=o===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:i("artifact.longDocument")}),a.jsx(ht,{className:"ml-auto shrink-0",variant:"outline",size:"sm",onClick:()=>l(u?null:e),children:i(u?"artifact.showSource":"artifact.renderFullPreview")})]}),a.jsx("div",{className:"relative min-h-0 flex-1 overflow-auto",children:u?r():a.jsx(MPe,{workspacePath:n,workspaceActions:s,previewContent:e,previewOnly:!0})})]})}function uAn({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:i,onLoadError:o}){const{content:l,error:c,sizeBytes:u}=Hne({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:i,onLoadError:o});return a.jsxs("div",{className:tt.htmlPreviewWrap,children:[l===null?!c&&a.jsx("div",{className:tt.empty,children:"Loading preview..."}):a.jsx(PPe,{content:l,sizeBytes:u??r,workspacePath:e,workspaceActions:n,children:()=>a.jsx("div",{className:tt.markdownPreviewWrap,children:a.jsx(xp,{content:l})})}),c&&a.jsx("div",{className:tt.previewError,children:c})]})}function hf({label:e,value:t}){return t?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:tt.fieldLabel,children:e}),a.jsx("span",{className:tt.fieldValue,children:t})]}):null}function wC(e,t,n){const s=e[t];return s==null||s===""?null:a.jsx(hf,{label:n,value:String(s)},t)}/**
|
|
2269
|
+
`);return n===-1?t:t.slice(0,n)}function p5n(e,t){if(e.kind==="request"){const n=[Ed(e.timing.durationMs)];return e.timing.ttftMs!==void 0&&n.push(t("trajectory.ttft",{duration:Ed(e.timing.ttftMs)})),e.usage&&n.push(d5n(e.usage)),n}if(e.kind==="tool"){const n=[];if(e.timing&&n.push(Ed(e.timing.durationMs)),e.subagentSummary){const{requests:s,tools:r,requestMs:i}=e.subagentSummary;n.push(t("trajectory.subagentRollup",{requests:s,tools:r,duration:Ed(i)}))}return n}return[]}function nwe(e){const t=e.toolStatus??e.block.status;if(t==="error"||t==="failed")return Yo.toneError;if(t==="cancelled")return Yo.toneMuted}function m5n(e,t){switch(e.kind){case"user":return{badge:t("trajectory.badge.user"),text:l3(e.block.text)};case"request":{const n=f5n(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:Yo.toneError}:{},text:s?`${r} · ${t("trajectory.requestFailed")}`:r}}case"message":return{badge:e.thought?t("trajectory.badge.thought"):t("trajectory.badge.message"),text:l3(e.block.text),faint:e.thought};case"tool":return{badge:e.block.toolName??t("trajectory.badge.tool"),...nwe(e)?{badgeTone:nwe(e)}:{},text:e.block.title||(e.block.toolName??"")};default:return g5n(e.block,t)}}function g5n(e,t){switch(e.kind){case"shell":return{badge:t("trajectory.badge.shell"),text:l3(e.text)};case"user_shell":return{badge:t("trajectory.badge.shell"),text:l3(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:Yo.toneError}:{},text:l3(e.text),faint:e.kind!=="error"};case"prompt_cancelled":return{badge:t("trajectory.badge.cancelled"),badgeTone:Yo.toneMuted,text:e.reason??t("trajectory.cancelled"),faint:!0};default:return{badge:t("trajectory.badge.other"),text:""}}}function v5n(e){return e.rows.some(t=>t.kind==="request"||t.kind==="tool"&&t.timing!==void 0)}function w5n({loadPage:e}){const{t}=lt(),{trajectory:n,status:s,error:r,truncated:i,refresh:o}=O3n(e),[l,c]=d.useState(void 0),u=d.useRef(null),h=d.useRef(!1),f=d.useRef(0),p=d.useId(),m=d.useCallback(C=>`${p}-row-${C}`,[p]),g=d.useCallback((C,I)=>{C.scrollTop=I,f.current=C.scrollTop},[]),v=d.useMemo(()=>{if(!n)return[];const C=new Map(n.rows.map(R=>[R.key,R])),I=[];for(const R of n.turns){const N=R.userRowKey??`ordinal:${R.index}`;I.push({kind:"turn",key:`turn:${N}`,turn:R});for(const j of R.rowKeys){const P=C.get(j);P&&I.push({kind:"row",key:j,row:P})}}return I},[n]),y=vIe({count:v.length,getScrollElement:()=>u.current,getItemKey:C=>v[C]?.key??C,estimateSize:()=>ewe,overscan:12}),w=v.length>0;d.useLayoutEffect(()=>{const C=u.current;if(!C||typeof ResizeObserver>"u")return;let I=0;const R=()=>{C.scrollTop===0&&f.current>0&&(C.scrollTop=f.current)},N=new ResizeObserver(()=>{R(),I=requestAnimationFrame(R)});return N.observe(C),()=>{N.disconnect(),I!==0&&cancelAnimationFrame(I)}},[w]),d.useEffect(()=>{if(s!=="ready"||h.current||v.length===0)return;h.current=!0;const C=u.current;C&&g(C,C.scrollHeight)},[g,s,v.length]);const b=d.useMemo(()=>l===void 0?-1:v.findIndex(C=>C.key===l),[l,v]),x=d.useCallback(C=>{if(v.length===0)return;const I=Math.min(Math.max(C,0),v.length-1);c(v[I].key),y.scrollToIndex(I,{align:"auto"})},[y,v]),k=d.useCallback(C=>{c(C),u.current?.focus({preventScroll:!0})},[]),S=d.useCallback(C=>{if(v.length===0)return;const I=b<0?-1:b;C.key==="ArrowDown"?(C.preventDefault(),x(I+1)):C.key==="ArrowUp"?(C.preventDefault(),x(I<=0?0:I-1)):C.key==="Home"?(C.preventDefault(),x(0)):C.key==="End"&&(C.preventDefault(),x(v.length-1))},[x,b,v]),T=d.useMemo(()=>{if(!n)return;let C=0,I=0,R=0;for(const N of n.turns)C+=N.requestCount,I+=N.toolCount,R+=N.requestMs;return{turns:n.turns.length,requests:C,tools:I,durationMs:R}},[n]),E=s==="ready"&&v.length===0,A=n!==void 0&&v.length>0&&!v5n(n);return a.jsxs("div",{className:Yo.panel,"data-testid":"trajectory-panel",children:[a.jsxs("div",{className:Yo.header,children:[a.jsx("div",{className:Yo.summary,children:T?a.jsx("span",{"data-testid":"trajectory-totals",children:t("trajectory.totals",{turns:T.turns,requests:T.requests,tools:T.tools,duration:T.durationMs>0?Ed(T.durationMs):"—"})}):a.jsx("span",{children:t("trajectory.title")})}),a.jsx("div",{className:Yo.headerActions,children:a.jsx("button",{type:"button",className:Yo.iconButton,onClick:o,disabled:!e||s==="loading",title:t("common.refresh"),"aria-label":t("common.refresh"),children:a.jsx(Vh,{size:14,strokeWidth:1.6})})})]}),r!==void 0&&a.jsxs("div",{className:Yo.error,role:"alert",children:[a.jsx("span",{children:r.kind==="partial"?t("trajectory.partial"):t("trajectory.loadFailed",{message:r.message})}),a.jsx("button",{type:"button",className:Yo.headerButton,onClick:o,disabled:s==="loading",children:t("common.retry")})]}),A&&a.jsx("div",{className:Yo.notice,role:"status",children:t("trajectory.noTiming")}),a.jsx("div",{className:Yo.tableWrap,children:v.length===0?s==="error"?null:a.jsx("div",{className:Yo.placeholder,role:"status",children:t(E?"trajectory.empty":"common.loading")}):a.jsxs(a.Fragment,{children:[i&&a.jsx("div",{className:Yo.olderBar,children:a.jsx("span",{className:Yo.olderNotice,"data-testid":"trajectory-truncated",children:t("trajectory.truncated")})}),a.jsx("div",{ref:u,className:Yo.scroll,role:"grid",tabIndex:0,"aria-label":t("trajectory.title"),"aria-rowcount":v.length,"aria-activedescendant":b>=0?m(b):void 0,onKeyDown:S,onScroll:C=>{f.current=C.currentTarget.scrollTop},"data-testid":"trajectory-rows",children:a.jsx("div",{className:Yo.virtualBody,style:{height:`${y.getTotalSize()}px`},children:y.getVirtualItems().map(C=>{const I=v[C.index];return a.jsx("div",{id:m(C.index),className:Yo.virtualRow,style:{height:`${ewe}px`,transform:`translateY(${C.start}px)`},role:"row","aria-rowindex":C.index+1,children:I.kind==="turn"?a.jsx(y5n,{turn:I.turn,selected:I.key===l,onSelect:()=>k(I.key)}):a.jsx(b5n,{row:I.row,selected:I.key===l,onSelect:()=>k(I.key)})},C.key)})})})]})})]})}function y5n({turn:e,selected:t,onSelect:n}){const{t:s}=lt();return a.jsxs("div",{className:`${Yo.turnHeader} ${t?Yo.selected:""}`,onClick:n,"aria-selected":t,"data-selected":t?"true":void 0,role:"gridcell","data-testid":"trajectory-turn",children:[a.jsx("span",{className:Yo.turnTitle,children:e.partial?s("trajectory.turnPartial",{index:e.index}):s("trajectory.turn",{index:e.index})}),a.jsx("span",{className:Yo.turnSummary,children:s("trajectory.turnSummary",{requests:e.requestCount,tools:e.toolCount,duration:e.requestMs>0?Ed(e.requestMs):"—"})})]})}function b5n({row:e,selected:t,onSelect:n}){const{t:s}=lt(),r=m5n(e,s),i=p5n(e,s);return a.jsxs("div",{className:`${Yo.record} ${t?Yo.selected:""}`,role:"gridcell","aria-selected":t,"data-selected":t?"true":void 0,onClick:n,"data-testid":`trajectory-row-${e.kind}`,"data-depth":e.depth,children:[e.depth>0&&a.jsx(Zit,{size:12,strokeWidth:1.6,className:Yo.nestMarker,"aria-hidden":"true"}),a.jsx("span",{className:`${Yo.badge} ${r.badgeTone??""}`,children:r.badge}),a.jsx("span",{className:`${Yo.text} ${r.faint?Yo.faint:""}`,children:r.text}),a.jsx("span",{className:Yo.metrics,"data-testid":"trajectory-row-metrics",children:i.length>0?i.join(" · "):"—"})]})}const x5n="_panel_pwtdr_1",k5n="_toolbar_pwtdr_5",_5n="_actions_pwtdr_15",S5n="_feedback_pwtdr_21",C5n="_state_pwtdr_31",Qv={panel:x5n,toolbar:k5n,actions:_5n,feedback:S5n,state:C5n};function T5n({sessionActions:e,sessionId:t,controls:n}){const{t:s}=lt(),[r,i]=d.useState(null),[o,l]=d.useState(!0),[c,u]=d.useState(!1),h=d.useRef(0),f=d.useRef(()=>{}),p=d.useRef(null),m=n?.sessionId===t?n:void 0,g=m?.getContextUsage??e?.getContextUsage,v=d.useRef(m);v.current=m;const y=m?.result,[w,b]=d.useState(y),x=!!(y&&y!==w&&(y.kind!=="completed"||!c));d.useEffect(()=>{y?.kind==="completed"&&(h.current++,i(y.usage),u(!1))},[y]),d.useEffect(()=>{let T=!0,E=!1;const A=v.current?.result;i(I=>I?.sessionId===t?I:A?.kind==="completed"?A.usage:null),u(!1),l(!!g);const C=async()=>{if(!T||E||!g)return;E=!0,l(!0),u(!1);const I=h.current,R=p.current,N=R&&R.getContextUsage===g&&R.sessionId===t?R:{getContextUsage:g,sessionId:t,promise:g({detail:!0,silent:!0,...v.current?.result?{syncCounters:!0}:{}})};p.current=N;try{const j=await N.promise;if(!T||I!==h.current)return;i(j.sessionId===t&&j.usage.contextWindowSize>0?j:null)}catch(j){if(!T||I!==h.current)return;u(nQ(j)?"transient":"hard")}finally{E=!1,p.current===N&&(p.current=null),T&&l(!1)}};return f.current=()=>void C(),C(),()=>{T=!1}},[g,t]);const k=!g||o||m?.compressing,S=()=>{b(y),f.current()};return a.jsxs("div",{className:Qv.panel,"aria-busy":o,children:[a.jsxs("div",{className:Qv.toolbar,children:[a.jsx("span",{children:s("contextUsage.title")}),a.jsxs("div",{className:Qv.actions,children:[a.jsx(ht,{type:"button",variant:"ghost",size:"icon-sm","aria-label":s("contextUsage.refresh"),title:s("contextUsage.refresh"),disabled:k,onClick:S,children:a.jsx(Vh,{"aria-hidden":"true"})}),a.jsx("span",{title:m?.compressing?void 0:m?.canCompress?o?s("common.loading"):void 0:s("contextUsage.compressUnavailable"),children:a.jsx(ht,{type:"button",variant:"outline",size:"sm",disabled:!m?.canCompress||o,onClick:()=>void m?.compress(),children:s(m?.compressing?"contextUsage.compressing":"contextUsage.compress")})})]})]}),(m?.compressing||x)&&a.jsx(c9e,{controls:m,className:Qv.feedback}),c==="transient"&&r&&a.jsx("div",{className:Qv.feedback,role:"status",children:s("contextUsage.previousReading")}),c==="hard"?a.jsxs("div",{className:Qv.state,role:"alert",children:[a.jsx("span",{children:s("contextUsage.loadError")}),a.jsx(ht,{type:"button",variant:"outline",size:"sm",disabled:k,onClick:S,children:s("contextUsage.retry")})]}):g?o&&!r?a.jsx("div",{className:Qv.state,role:"status",children:s("common.loading")}):r?a.jsx(C5e,{status:r,compact:!0}):a.jsx("div",{className:Qv.state,children:s("contextUsage.unavailable")}):a.jsx("div",{className:Qv.state,children:s("contextUsage.unavailable")})]})}const I5n=700,E5n=["daily","weekdays","weekly","hourly","minutes","custom"],R5n=[1,2,3,4,5,6,10,12,15,20,30],A5n=(e,t)=>{},j5n=(e,t,n)=>{},N5n=()=>Promise.reject(new Error("Side-task session creation is unavailable"));function swe(e){return e.kind==="review"||e.kind==="file"||e.kind==="artifact"||e.kind==="scheduled_task"}function Jv(e){return e.kind==="pending"?e.targetKind:e.kind}function M5n(e){return`image.${(e.match(/^data:image\/([a-z0-9+.+-]+)/i)?.[1]??"png").split("+")[0].toLowerCase()}`}const P5n=["review","sideTask"];function rwe({contextUsageControls:e,artifacts:t,tabs:n,activeTabId:s,reviewChanges:r,selectedReviewPath:i,panelWidth:o,workspaceCwd:l,loading:c,restoring:u=!1,error:h,onSelectTab:f,onCloseTab:p,onOpenFilePreview:m,latestReviewAvailable:g=!1,onOpenLatestReview:v,onOpenTerminal:y,onOpenTrajectory:w,trajectoryTabId:b,onOpenWebPreview:x,onWebPreviewChange:k,items:S=P5n,sideTaskAvailable:T=!1,sideTasks:E=[],sideTasksLoading:A=!1,onCreateSideTask:C,onOpenSideTask:I,onCreateSideTaskSession:R,onSideTaskCreated:N,onSideTaskTitleChange:j,onNestedRightPanelOpen:P,onNestedArtifactsChange:D,onOpenNestedSubagent:M,agentTasks:q=[],agentTraceLoading:V=!1,agentTraceError:z,onOpenWorkflowAgent:L,onError:X,sessionWorkflowEnabled:ee,workflow:H,onImageIngestionNotice:Q,deferSubagentMount:de=!1,onClose:ve,variant:B="docked",fullscreen:G=!1,onToggleFullscreen:W}){const{t:F}=lt(),[pe,J]=d.useState(!1),[ue,ie]=d.useState(),ye=d.useRef(null),me=d.useCallback(()=>{ye.current&&(clearTimeout(ye.current),ye.current=null),J(!0)},[]),fe=d.useCallback(()=>{ye.current&&clearTimeout(ye.current),ye.current=setTimeout(()=>{J(!1),ye.current=null},120)},[]);d.useEffect(()=>()=>{ye.current&&clearTimeout(ye.current)},[]);const ke=n.find(be=>be.id===s)??n[0],De=ke?.kind==="file"&&ke.sourcePreview&&(/\.html?$/i.test(ke.workspacePath)||Qw(ke.previewMimeType||ke.previewData?.type)==="text/html"),We=ke?.kind==="file"&&ke.previewOnly===!0&&!De&&/\.(?:html?|md|markdown)$/i.test(ke.workspacePath)&&(ke.previewContent!==void 0||!ke.previewData||!!OT(ke.previewMimeType||ke.previewData.type,ke.workspacePath)),rt=ue===ke?.id,Ee=S.includes("review")&&!n.some(be=>Jv(be)==="review"),Ue=S.includes("sideTask")&&T&&!!C,Ce=!!y,ae=S.includes("webPreview")&&!!x,O=S.includes("trajectory")&&!!w&&!n.some(be=>be.id===b),Y=!!ke&&(Ee||Ue||Ce||ae||O),oe=ke&&swe(ke)?{workspaceCwd:ke.workspaceCwd,workspaceId:ke.workspaceId}:void 0,_e=g4(oe?.workspaceCwd),Fe=_e?.workspaceId===oe?.workspaceId?_e?.actions:void 0,ge=ke?.kind==="artifact"?t.find(be=>be.id===ke.artifactId):void 0;return a.jsxs("aside",{className:`${tt.panel} ${B==="drawer"?tt.panelDrawer:""} ${G?tt.panelFullscreen:""}`,style:B==="docked"&&o&&!G?{flexBasis:o,width:o}:void 0,"aria-label":"Right panel",children:[a.jsxs("div",{className:tt.header,children:[n.length>0&&a.jsx("div",{className:tt.tabs,role:"tablist","aria-label":"Right panel",children:n.map(be=>a.jsxs("div",{className:[tt.tabItem,be.id===ke?.id?tt.tabActive:""].filter(Boolean).join(" "),children:[a.jsxs("button",{type:"button",role:"tab","aria-selected":be.id===ke?.id,className:tt.tab,onClick:()=>f(be.id),onMouseEnter:Ie=>O2(Ie.currentTarget),onFocus:Ie=>O2(Ie.currentTarget),title:be.title,children:[a.jsx("span",{className:`${tt.tabIcon} ${Jv(be)==="artifact"?tt.tabArtifactIcon:""}`,"aria-hidden":"true",children:Jv(be)==="review"?a.jsx(fq,{}):be.kind==="workflow"?a.jsx(F4e,{className:tt.tabIconSvg,strokeWidth:1.6}):be.kind==="file"?a.jsx(vg,{name:be.workspacePath,className:tt.tabIconSvg,strokeWidth:1.6}):Jv(be)==="artifact"?a.jsx(cIe,{artifact:t.find(Ie=>"artifactId"in be&&Ie.id===be.artifactId),className:tt.tabIconSvg}):Jv(be)==="subagent"?a.jsx(L5n,{}):Jv(be)==="monitor"?a.jsx(K4e,{className:tt.tabIconSvg,strokeWidth:1.6}):Jv(be)==="shell"?a.jsx(i2,{className:tt.tabIconSvg,strokeWidth:1.6}):Jv(be)==="side_task"?a.jsx(nN,{className:tt.tabIconSvg,strokeWidth:1.6}):be.kind==="web_preview"?a.jsx(A2,{className:tt.tabIconSvg}):be.kind==="terminal"?a.jsx(i2,{className:tt.tabIconSvg,strokeWidth:1.6}):Jv(be)==="image"?a.jsx(Qot,{className:tt.tabIconSvg,strokeWidth:1.6}):be.kind==="context_usage"?a.jsx(ED,{className:tt.tabIconSvg,strokeWidth:1.6}):be.kind==="token_usage"?a.jsx(lJ,{className:tt.tabIconSvg,strokeWidth:1.6}):be.kind==="trajectory"?a.jsx(fz,{className:tt.tabIconSvg,strokeWidth:1.6}):a.jsx(O5n,{})}),a.jsx("span",{className:tt.tabTitle,"data-web-shell-session-title":!0,children:a.jsx("span",{className:tt.tabTitleInner,children:be.title})})]}),a.jsx("button",{type:"button",className:tt.tabCloseButton,onClick:()=>p(be.id),"aria-label":`Close ${be.title}`,title:"Close",children:a.jsx(D5n,{})})]},be.id))}),a.jsxs("div",{className:tt.headerActions,children:[Y&&a.jsxs(Nm,{modal:!1,children:[a.jsx(_p,{asChild:!0,children:a.jsx("button",{type:"button",className:`${tt.iconButton} ${tt.addButton}`,"aria-label":F("rightPanel.add"),title:F("rightPanel.add"),children:a.jsx(ah,{className:tt.toolbarIcon})})}),a.jsxs(Sp,{align:"end",className:"w-64",children:[Ee&&a.jsxs(Ii,{disabled:!g||!v,onSelect:v,children:[a.jsx(fq,{}),a.jsx("span",{className:tt.sideTaskListTitle,children:F("turnOutputs.review")})]}),Ee&&Ue&&a.jsx(Fw,{}),Ue&&a.jsxs(Ii,{disabled:A,onSelect:C,children:[a.jsx(nN,{className:tt.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:tt.sideTaskListTitle,children:F("sideTask.create")})]}),Ce&&(Ee||Ue)&&a.jsx(Fw,{}),Ce&&a.jsxs(Ii,{onSelect:()=>y?.(),children:[a.jsx(i2,{className:tt.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:tt.sideTaskListTitle,children:F("terminal.title")})]}),ae&&a.jsxs(Ii,{onSelect:x,children:[a.jsx(A2,{className:tt.sideTaskNewIcon}),a.jsx("span",{className:tt.sideTaskListTitle,children:F("webPreview.title")})]}),O&&a.jsxs(Ii,{onSelect:()=>w?.(),children:[a.jsx(fz,{className:tt.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:tt.sideTaskListTitle,children:F("trajectory.title")})]})]})]}),W&&a.jsx("button",{type:"button",className:`${tt.iconButton} ${tt.fullscreenButton} ${G?tt.iconButtonActive:""}`,onClick:W,"aria-label":F(G?"common.exitFullscreen":"common.fullscreen"),"aria-pressed":G,title:F(G?"common.exitFullscreen":"common.fullscreen"),children:G?a.jsx(uJ,{className:tt.toolbarIcon,"aria-hidden":!0}):a.jsx(oJ,{className:tt.toolbarIcon,"aria-hidden":!0})}),a.jsx("button",{type:"button",className:`${tt.iconButton} ${tt.panelToggleButton}`,onClick:ve,"aria-label":F("chatHeader.toggleRightPanel"),"aria-pressed":"true",title:F("chatHeader.toggleRightPanel"),children:a.jsx(z4e,{className:tt.panelToggleIcon})})]})]}),a.jsxs("div",{className:`${tt.body} ${ke?.kind==="side_task"?tt.bodySideTask:""}`.trim(),children:[n.filter(be=>be.kind==="web_preview").map(be=>a.jsx("div",{className:"h-full",hidden:be.id!==ke?.id,children:a.jsx(LRn,{state:be,onChange:Ie=>k?.(be.id,Ie)})},be.id)),n.filter(be=>be.kind==="terminal").map(be=>a.jsx("div",{className:`${tt.terminalPane} ${be.id===ke?.id?"":tt.terminalPaneHidden}`.trim(),"aria-hidden":be.id===ke?.id?void 0:!0,children:a.jsx(PRn,{terminalId:be.id,cwd:be.workspaceCwd??l,active:be.id===ke?.id,enabled:be.initialized!==!1})},be.id)),We&&a.jsxs("button",{type:"button",className:tt.attachmentPreviewButton,onClick:()=>ie(rt?void 0:ke?.id),"aria-label":F(rt?"attachment.showSource":"attachment.showPreview"),"aria-pressed":rt,children:[rt?a.jsx(qit,{"aria-hidden":!0}):a.jsx(N4e,{"aria-hidden":!0}),F(rt?"attachment.showSource":"attachment.showPreview")]}),u&&!ke?a.jsxs("div",{className:"flex flex-col gap-4 p-5","data-testid":"right-panel-loading-skeleton",role:"status","aria-label":F("common.loading"),children:[a.jsx(O0,{className:"h-5 w-2/5"}),a.jsx(O0,{className:"h-32 w-full"}),a.jsx(O0,{className:"h-4 w-4/5"}),a.jsx(O0,{className:"h-4 w-3/5"})]}):ke?.kind==="terminal"||ke?.kind==="web_preview"?null:ke?ke.kind==="pending"?a.jsx("div",{className:tt.empty,role:ke.loadError?"alert":"status",children:ke.loadError??F("common.loading")}):ke.kind==="workflow"?ke.sessionId?a.jsx(ETn,{tasks:q,loading:V,error:z,onOpenAgent:L}):H?a.jsx(g4n,{...H}):a.jsx("div",{className:tt.empty,children:F("workflow.empty.title")}):swe(ke)&&(ke.kind!=="scheduled_task"||ke.task.durable)&&(ke.kind!=="file"||!ke.previewOnly)&&(ke.kind!=="artifact"||ge?.metadata?.artifactType!=="web_preview_snapshot")&&!Fe?a.jsx("div",{className:tt.empty,role:"alert",children:F("workspace.notFoundDescription")}):ke.kind==="review"?a.jsx(F5n,{changes:ke.changes??r,selectedPath:ke.selectedPath??i,workspaceCwd:ke.workspaceCwd??l,onOpenFilePreview:be=>m(be,ke.workspaceCwd??l,ke.workspaceId),onDownloadFile:(be,Ie)=>jD(Fe,be.path,Ect(be.path),Ie),onDownloadError:be=>{const Ie=F("common.downloadFailed",{message:qa(be)});X?X(new Error(Ie,{cause:be}),Ie):console.error(Ie,be)}}):ke.kind==="file"?ke.attachmentId&&!ke.previewData&&ke.previewContent===void 0?a.jsx("div",{className:tt.empty,role:ke.loadError?"alert":"status",children:ke.loadError??F("common.loading")}):ke.sourcePreview&&ke.previewData&&Qw(ke.previewMimeType||ke.previewData.type)!=="application/pdf"&&!OT(ke.previewMimeType||ke.previewData.type,ke.workspacePath)?a.jsx(jPe,{data:ke.previewData,title:ke.title,image:!!Q_(ke.workspacePath)&&ke.previewData.type.startsWith("image/")}):a.jsx(WO,{workspacePath:ke.workspacePath,artifactVersion:String(ke.previewVersion??0),workspaceActions:Fe,previewContent:ke.previewContent,previewData:ke.previewData,previewMimeType:ke.previewMimeType,previewOnly:ke.previewOnly,previewKind:De||ke.previewOnly&&!rt?"source":void 0},ke.id):ke.kind==="source"?a.jsx(sAn,{tab:ke},ke.id):ke.kind==="artifact"?a.jsx($5n,{artifacts:t,artifactId:ke.artifactId,sourceSessionId:ke.sourceSessionId,workspaceActions:Fe,previewContent:ke.previewContent,loading:c,error:h},ke.id):ke.kind==="subagent"?de?null:a.jsx(uTn,{sessionId:ke.sessionId,rootToolCallId:ke.rootToolCallId,initialRootTool:ke.rootTool,workspaceCwd:ke.workspaceCwd??l,onRightPanelOpen:P,onArtifactsChange:D,onOpenSubagent:M,onError:X}):ke.kind==="monitor"?a.jsx(m6t,{task:ke.task,actions:ke.sessionActions},ke.id):ke.kind==="shell"?a.jsx(g6t,{task:ke.task,actions:ke.sessionActions},ke.id):ke.kind==="side_task"?a.jsx(ATn,{tabId:ke.id,sessionId:ke.sessionId,parentSessionId:ke.parentSessionId,workspaceCwd:ke.workspaceCwd??l,title:ke.title,shouldNameFromFirstPrompt:ke.nameFromFirstPrompt,initialPrompt:ke.initialPrompt,createSession:R??N5n,onCreated:N??A5n,onTitleChange:j??j5n,onRightPanelOpen:P,onArtifactsChange:D,onError:X,sessionWorkflowEnabled:ee,onImageIngestionNotice:Q},ke.id):ke.kind==="image"?ke.src?a.jsxs("div",{className:tt.imagePreviewWrap,children:[a.jsx("img",{src:ke.src,alt:ke.alt??ke.title,className:tt.imagePreview}),a.jsx("a",{className:tt.imageDownloadButton,href:ke.src,download:M5n(ke.src),"aria-label":F("common.download"),title:F("common.download"),children:a.jsx(Mw,{size:16,strokeWidth:1.8})})]}):a.jsx("div",{className:tt.empty,role:ke.loadError?"alert":"status",children:ke.loadError??F("common.loading")}):ke.kind==="context_usage"?a.jsx(T5n,{controls:e?.[ke.sessionId],sessionActions:ke.sessionActions,sessionId:ke.sessionId},ke.id):ke.kind==="trajectory"?a.jsx(w5n,{loadPage:ke.loadPage},ke.id):ke.kind==="token_usage"?a.jsx(k3n,{sessionActions:ke.sessionActions,sessionId:ke.sessionId},ke.id):a.jsx(B5n,{task:ke.task,actions:Fe},ke.id):a.jsxs("div",{className:tt.emptyActions,"data-testid":"right-panel-empty-actions",children:[S.includes("review")&&a.jsxs("button",{type:"button",className:tt.emptyAction,disabled:!g||!v,onClick:v,children:[a.jsx("span",{className:tt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(fq,{})}),a.jsx("span",{className:tt.emptyActionTitle,children:F("turnOutputs.review")}),a.jsx("span",{className:tt.emptyActionHint,children:F("turnOutputs.reviewLatest")}),a.jsx(Va,{className:tt.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]}),S.includes("sideTask")&&T&&C&&(E.length===0?a.jsxs("button",{type:"button",className:tt.emptyAction,disabled:A,"aria-busy":A,onClick:C,children:[a.jsx("span",{className:tt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(nN,{strokeWidth:1.6})}),a.jsx("span",{className:tt.emptyActionTitle,children:F("sideTask.title")}),a.jsx("span",{className:tt.emptyActionHint,children:F("sideTask.description")}),a.jsx(Va,{className:tt.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]}):a.jsxs(Nm,{open:pe,onOpenChange:J,modal:!1,children:[a.jsx(_p,{asChild:!0,children:a.jsxs("button",{type:"button",className:tt.emptyAction,"aria-expanded":pe,onMouseEnter:me,onMouseLeave:fe,children:[a.jsx("span",{className:tt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(nN,{strokeWidth:1.6})}),a.jsx("span",{className:tt.emptyActionTitle,children:F("sideTask.title")}),a.jsx("span",{className:tt.emptyActionHint,children:F("sideTask.description")}),a.jsx(Va,{className:tt.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]})}),a.jsxs(Sp,{align:"end",className:"w-80",onMouseEnter:me,onMouseLeave:fe,children:[E.map(be=>a.jsxs(Ii,{onSelect:()=>I?.(be),children:[a.jsx("span",{className:tt.sideTaskListTitle,children:be.title}),be.updatedAt&&a.jsx("span",{className:tt.sideTaskListTime,children:$T(be.updatedAt,F)})]},be.sessionId)),a.jsx(Fw,{}),a.jsxs(Ii,{onSelect:C,children:[a.jsx(Nit,{className:tt.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:tt.sideTaskListTitle,children:F("sideTask.new")})]})]})]})),ae&&a.jsxs("button",{type:"button",className:tt.emptyAction,onClick:x,children:[a.jsx("span",{className:tt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(A2,{strokeWidth:1.6})}),a.jsx("span",{className:tt.emptyActionTitle,children:F("webPreview.title")}),a.jsx("span",{className:tt.emptyActionHint,children:F("webPreview.openHint")}),a.jsx(Va,{className:tt.emptyActionChevron,"aria-hidden":"true"})]}),O&&a.jsxs("button",{type:"button",className:tt.emptyAction,onClick:()=>w?.(),"data-testid":"right-panel-open-trajectory",children:[a.jsx("span",{className:tt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(fz,{strokeWidth:1.6})}),a.jsx("span",{className:tt.emptyActionTitle,children:F("trajectory.title")}),a.jsx("span",{className:tt.emptyActionHint,children:F("trajectory.description")}),a.jsx(Va,{className:tt.emptyActionChevron,"aria-hidden":"true"})]}),y&&a.jsxs("button",{type:"button",className:tt.emptyAction,onClick:()=>y(),children:[a.jsx("span",{className:tt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(i2,{strokeWidth:1.6})}),a.jsx("span",{className:tt.emptyActionTitle,children:F("terminal.title")}),a.jsx("span",{className:tt.emptyActionHint,children:F("terminal.open")}),a.jsx(Va,{className:tt.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]})]})]})]})}function L5n(){return a.jsxs("svg",{className:tt.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 D5n(){return a.jsx("svg",{className:tt.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 fq(){return a.jsxs("svg",{className:tt.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 O5n(){return a.jsxs("svg",{className:tt.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 $5n({artifacts:e,artifactId:t,sourceSessionId:n,workspaceActions:s,previewContent:r,loading:i,error:o}){const l=e.find(c=>c.id===t);return l?a.jsx(Z5n,{artifact:l,sourceSessionId:n,workspaceActions:s,previewContent:r}):i?a.jsx("div",{className:tt.empty,children:"Loading artifact..."}):o?a.jsx("div",{className:tt.empty,children:o}):a.jsx("div",{className:tt.empty,children:"Artifact not found."})}function B5n({task:e,actions:t}){const{t:n}=lt(),[s,r]=d.useState(null),[i,o]=d.useState(!0),[l,c]=d.useState(null),[u,h]=d.useState(""),[f,p]=d.useState(e.prompt),[m,g]=d.useState(()=>bb(e.cron)),[v,y]=d.useState(!1),[w,b]=d.useState(!1),[x,k]=d.useState(!1),[S,T]=d.useState(!1),[E,A]=d.useState(null),C=d.useRef(0),I=d.useRef(0),R=d.useRef({actions:t,taskId:e.id,workspaceId:e.workspaceId});R.current={actions:t,taskId:e.id,workspaceId:e.workspaceId};const N=d.useCallback((F,pe,J,ue)=>{const ie=R.current;return F===C.current&&ie.actions===pe&&ie.taskId===J&&ie.workspaceId===ue},[]),j=d.useCallback((F,pe,J,ue)=>{const ie=R.current;return F===I.current&&ie.actions===pe&&ie.taskId===J&&ie.workspaceId===ue},[]);d.useEffect(()=>()=>{C.current+=1,I.current+=1},[]),d.useEffect(()=>{k(!1),T(!1),A(null)},[t,e.id,e.workspaceId]);const P=d.useCallback(async()=>{const F=++C.current,pe=++I.current,J=e.id,ue=e.workspaceId;if(!e.durable||!t){r(null),h(""),p(e.prompt),g(bb(e.cron)),c(null),o(!1);return}o(!0),c(null);try{const ie=await t.listScheduledTasks(ue);if(!N(F,t,J,ue))return;const ye=ie.find(me=>me.id===e.id)??null;r(ye),ye?(h(ye.name??""),p(ye.prompt),g(bb(ye.cron))):(h(""),p(e.prompt),g(bb(e.cron)))}catch(ie){j(pe,t,J,ue)&&c(ie instanceof Error?ie.message:String(ie))}finally{j(pe,t,J,ue)&&o(!1)}},[t,j,N,e.cron,e.durable,e.id,e.prompt,e.workspaceId]);d.useEffect(()=>{P()},[P]);const D=!e.durable,M=e.durable&&!i&&!l&&!s,q=!!s,V=s?.name||s?.prompt||e.title,z=s?.prompt??e.prompt,L=s?.cron??e.cron,X=s?.recurring??e.recurring,ee=s?.enabled,H=d.useCallback(()=>{s&&(h(s.name??""),p(s.prompt),g(bb(s.cron)),A(null),y(!0))},[s]),Q=d.useCallback(()=>{y(!1),A(null),s&&(h(s.name??""),p(s.prompt),g(bb(s.cron)))},[s]),de=d.useCallback(async()=>{if(!s||!t)return;const F=k7(m);if(!F){A(n("scheduledTasks.error.invalidSchedule"));return}if(f.trim().length===0){A(n("scheduledTasks.error.emptyPrompt"));return}const pe=++C.current,J=e.id,ue=e.workspaceId;T(!0),A(null);try{const ie=await t.updateScheduledTask(s.id,{cron:F,prompt:f.trim(),name:u.trim()||null},ue);if(!N(pe,t,J,ue))return;r(ie),h(ie.name??""),p(ie.prompt),g(bb(ie.cron)),y(!1)}catch(ie){N(pe,t,J,ue)&&A(ie instanceof Error?ie.message:String(ie))}finally{N(pe,t,J,ue)&&T(!1)}},[t,m,N,s,u,f,n,e.id,e.workspaceId]),ve=d.useCallback(async()=>{if(!s||!t)return;const F=++C.current,pe=e.id,J=e.workspaceId;k(!0),A(null);try{const ue=await t.updateScheduledTask(s.id,{enabled:!s.enabled},J);if(!N(F,t,pe,J))return;r(ue)}catch(ue){N(F,t,pe,J)&&A(ue instanceof Error?ue.message:String(ue))}finally{N(F,t,pe,J)&&k(!1)}},[t,N,s,e.id,e.workspaceId]),B=d.useCallback(async()=>{if(!s||!t)return;const F=++C.current,pe=e.id,J=e.workspaceId;k(!0),A(null);try{if(await t.deleteScheduledTask(s.id,J),!N(F,t,pe,J))return;r(null),b(!1)}catch(ue){N(F,t,pe,J)&&A(ue instanceof Error?ue.message:String(ue))}finally{N(F,t,pe,J)&&k(!1)}},[t,N,s,e.id,e.workspaceId]),G=k7(m),W=G?gT(G,n):null;return a.jsxs("div",{className:tt.detail,children:[i&&a.jsx("div",{className:tt.empty,children:n("scheduledTasks.loading")}),l&&a.jsx("div",{className:Wt.loadError,children:l}),M&&a.jsx("div",{className:tt.empty,children:n("scheduledTasks.deletedSnapshot")}),D&&a.jsx("div",{className:tt.empty,children:n("scheduledTasks.sessionScopedSnapshot")}),!M&&a.jsx("div",{className:tt.section,children:a.jsxs("div",{className:tt.fieldGrid,children:[a.jsx("span",{className:tt.fieldLabel,children:n("scheduledTasks.name")}),a.jsx("span",{className:tt.fieldValue,children:V}),a.jsx("span",{className:tt.fieldLabel,children:n("scheduledTasks.taskId")}),a.jsx("span",{className:tt.fieldValue,children:e.id}),a.jsx("span",{className:tt.fieldLabel,children:n("scheduledTasks.schedule")}),a.jsx("span",{className:tt.fieldValue,children:gT(L,n)}),a.jsx("span",{className:tt.fieldLabel,children:"Cron"}),a.jsx("span",{className:tt.fieldValue,children:L}),a.jsx("span",{className:tt.fieldLabel,children:n("scheduledTasks.type")}),a.jsx("span",{className:tt.fieldValue,children:n(X?"scheduledTasks.repeats":"scheduledTasks.runsOnce")}),ee!==void 0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:tt.fieldLabel,children:n("scheduledTasks.status")}),a.jsx("span",{className:tt.fieldValue,children:n(ee?"scheduledTasks.enable":"scheduledTasks.disable")})]})]})}),!M&&a.jsxs("div",{className:tt.section,children:[a.jsx("div",{className:tt.sectionTitle,children:"Prompt"}),a.jsx("div",{className:tt.description,children:z})]}),E&&a.jsx("div",{className:Wt.formError,children:E}),a.jsxs("div",{className:tt.actionsRow,children:[a.jsx("button",{type:"button",className:Wt.primaryButton,disabled:!q||x,onClick:H,children:n("scheduledTasks.edit")}),a.jsx("button",{type:"button",className:Wt.secondaryButton,disabled:!q||x,onClick:()=>void ve(),children:s?.enabled?n("scheduledTasks.disable"):n("scheduledTasks.enable")}),a.jsx("button",{type:"button",className:Wt.secondaryButton,disabled:!q||x,onClick:()=>b(!0),children:n("scheduledTasks.delete")})]}),w&&s&&a.jsx(Xo,{title:n("scheduledTasks.deleteConfirmTitle"),size:"sm",onClose:()=>b(!1),children:a.jsxs("div",{className:Wt.formFields,children:[a.jsx("div",{className:tt.description,children:n("scheduledTasks.deleteConfirm",{name:s.name||s.prompt})}),E&&a.jsx("div",{className:Wt.formError,children:E}),a.jsxs("div",{className:Wt.formActions,children:[a.jsx("button",{type:"button",className:Wt.secondaryButton,onClick:()=>b(!1),disabled:x,children:n("scheduledTasks.cancel")}),a.jsx("button",{type:"button",className:Wt.primaryButton,onClick:()=>void B(),disabled:x,children:n("scheduledTasks.delete")})]})]})}),v&&a.jsx(Xo,{title:n("scheduledTasks.editTitle"),size:"md",onClose:Q,children:a.jsxs("div",{className:Wt.formFields,children:[a.jsxs("label",{className:Wt.field,children:[a.jsx("span",{className:Wt.fieldLabel,children:n("scheduledTasks.name")}),a.jsx("input",{className:Wt.input,type:"text",value:u,maxLength:200,placeholder:n("scheduledTasks.namePlaceholder"),onChange:F=>h(F.target.value)})]}),a.jsxs("label",{className:Wt.field,children:[a.jsxs("span",{className:Wt.fieldLabel,children:[n("scheduledTasks.prompt"),a.jsx("span",{className:Wt.required,children:"*"})]}),a.jsx("textarea",{className:Wt.textarea,value:f,rows:4,maxLength:1e5,placeholder:n("scheduledTasks.promptPlaceholder"),onChange:F=>p(F.target.value)})]}),a.jsxs("div",{className:Wt.scheduleRow,children:[a.jsxs("label",{className:Wt.field,children:[a.jsx("span",{className:Wt.fieldLabel,children:n("scheduledTasks.frequency")}),a.jsx("select",{className:Wt.select,value:m.frequency,onChange:F=>{const pe=F.target.value;g(J=>({...J,frequency:pe,...pe==="hourly"?{time:"00:00"}:{}}))},children:E5n.map(F=>a.jsx("option",{value:F,children:n(`scheduledTasks.freq.${F}`)},F))})]}),(m.frequency==="daily"||m.frequency==="weekdays"||m.frequency==="weekly")&&a.jsxs("label",{className:Wt.field,children:[a.jsx("span",{className:Wt.fieldLabel,children:n("scheduledTasks.time")}),a.jsx("input",{className:Wt.input,type:"time",value:m.time,onChange:F=>g(pe=>({...pe,time:F.target.value}))})]}),m.frequency==="weekly"&&a.jsxs("label",{className:Wt.field,children:[a.jsx("span",{className:Wt.fieldLabel,children:n("scheduledTasks.weekday")}),a.jsx("select",{className:Wt.select,value:m.weekday,onChange:F=>g(pe=>({...pe,weekday:Number(F.target.value)})),children:n("scheduledTasks.weekdayNames").split(",").map((F,pe)=>a.jsx("option",{value:pe,children:F},pe))})]}),m.frequency==="minutes"&&a.jsxs("label",{className:Wt.field,children:[a.jsx("span",{className:Wt.fieldLabel,children:n("scheduledTasks.interval")}),a.jsx("select",{className:Wt.select,value:m.minuteInterval,onChange:F=>g(pe=>({...pe,minuteInterval:Number(F.target.value)})),children:R5n.map(F=>a.jsx("option",{value:F,children:F},F))})]}),m.frequency==="custom"&&a.jsxs("label",{className:`${Wt.field} ${Wt.fieldGrow}`,children:[a.jsx("span",{className:Wt.fieldLabel,children:n("scheduledTasks.cron")}),a.jsx("input",{className:Wt.input,type:"text",value:m.customCron,spellCheck:!1,placeholder:"0 9 * * 1-5",onChange:F=>g(pe=>({...pe,customCron:F.target.value}))})]})]}),a.jsx("div",{className:Wt.preview,children:W?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:Wt.previewLabel,children:W}),a.jsx("code",{className:Wt.previewCron,children:G})]}):a.jsx("span",{className:Wt.previewInvalid,children:n("scheduledTasks.error.invalidSchedule")})}),E&&a.jsx("div",{className:Wt.formError,children:E}),a.jsxs("div",{className:Wt.formActions,children:[a.jsx("button",{type:"button",className:Wt.secondaryButton,onClick:Q,disabled:S,children:n("scheduledTasks.cancel")}),a.jsx("button",{type:"button",className:Wt.primaryButton,onClick:()=>void de(),disabled:S,children:n(S?"scheduledTasks.saving":"scheduledTasks.save")})]})]})})]})}function F5n({changes:e,selectedPath:t,workspaceCwd:n,onOpenFilePreview:s,onDownloadFile:r,onDownloadError:i}){const{t:o}=lt(),[l,c]=d.useState(!1),[u,h]=d.useState(!0),[f,p]=d.useState(!1),[m,g]=d.useState(520),v=d.useRef(m),y=d.useRef(null),w=d.useRef(null),[b,x]=d.useState(null),[k,S]=d.useState(()=>new Set),T=d.useRef(!0);d.useEffect(()=>(T.current=!0,()=>{T.current=!1}),[]);const E=l,A=d.useMemo(()=>X5n(e,n),[e,n]);d.useEffect(()=>{x(t)},[t]),d.useEffect(()=>{v.current=m},[m]),d.useEffect(()=>{const j=y.current;if(!j)return;const P=()=>{p(j.clientWidth<I5n)};P();const D=new ResizeObserver(P);return D.observe(j),()=>D.disconnect()},[u]),d.useEffect(()=>()=>w.current?.(),[]);const C=d.useCallback(j=>{const P=y.current;if(!P)return;j.preventDefault();const D=j.currentTarget;D.setPointerCapture(j.pointerId);const M=j.clientX,q=v.current,V=P.getBoundingClientRect().width,z=Math.max(180,V-180),L=document.body.style.cursor,X=document.body.style.userSelect;let ee=q,H=null;document.body.style.cursor="col-resize",document.body.style.userSelect="none";const Q=()=>{H=null,g(ee)},de=G=>{ee=Math.min(z,Math.max(180,q+(G.clientX-M))),H===null&&(H=window.requestAnimationFrame(Q))};let ve=()=>{};const B=G=>{w.current=null,H!==null&&(window.cancelAnimationFrame(H),H=null),G&&g(ee),D.hasPointerCapture(j.pointerId)&&D.releasePointerCapture(j.pointerId),document.body.style.cursor=L,document.body.style.userSelect=X,window.removeEventListener("pointermove",de),window.removeEventListener("pointerup",ve),window.removeEventListener("pointercancel",ve)};ve=()=>B(!0),w.current=()=>B(!1),window.addEventListener("pointermove",de),window.addEventListener("pointerup",ve),window.addEventListener("pointercancel",ve)},[]);if(e.length===0)return a.jsx("div",{className:tt.empty,children:"No file changes to review."});const I=I6e(e),R=j=>{x(P=>P===j?null:j)},N=async j=>{if(!k.has(j.path)){S(P=>new Set(P).add(j.path));try{await r(j,()=>!T.current)}catch(P){T.current&&i(P)}finally{S(P=>{const D=new Set(P);return D.delete(j.path),D})}}};return a.jsxs("div",{className:tt.review,children:[a.jsxs("div",{className:tt.reviewToolbar,children:[a.jsxs("div",{className:tt.reviewToolbarTitle,children:[a.jsx("span",{children:o("turnOutputs.previousTurn")}),a.jsx(dP,{additions:I?.additions,deletions:I?.deletions,className:tt.lineStats,additionsClassName:tt.additions,deletionsClassName:tt.deletions})]}),a.jsxs("div",{className:tt.reviewToolbarActions,children:[a.jsxs("button",{type:"button",className:tt.reviewTotalsButton,onClick:()=>h(j=>!j),"aria-expanded":u,children:[a.jsx("span",{children:o("turnOutputs.fileCount",{count:e.length})}),a.jsx("span",{className:[tt.chevron,u?tt.chevronOpen:""].filter(Boolean).join(" "),"aria-hidden":"true",children:a.jsx(owe,{})})]}),a.jsx("button",{type:"button",className:[tt.iconButton,l?tt.iconButtonActive:""].filter(Boolean).join(" "),onClick:()=>c(j=>!j),"aria-label":o(l?"turnOutputs.closeFileTree":"turnOutputs.openFileTree"),title:o(l?"turnOutputs.closeFileTree":"turnOutputs.openFileTree"),children:l?a.jsx(K5n,{}):a.jsx(G5n,{})})]})]}),u&&a.jsxs("div",{ref:y,className:[tt.reviewContent,E?"":tt.reviewContentListOnly,E&&f?tt.reviewContentStacked:""].filter(Boolean).join(" "),style:{"--review-list-width":`${m}px`},children:[a.jsx("div",{className:[tt.reviewList,b?tt.reviewListWithExpanded:""].filter(Boolean).join(" "),children:e.map(j=>{const P=b===j.path,D=A6e(j.path),M=IBt(j.path);return a.jsxs("div",{className:[tt.reviewItem,P?tt.reviewItemExpanded:""].filter(Boolean).join(" "),children:[a.jsxs("div",{className:tt.reviewRow,"data-selected":j.path===t||void 0,children:[a.jsx("button",{type:"button",className:tt.reviewRowToggle,onClick:()=>R(j.path),"aria-label":j.path,"aria-expanded":P}),a.jsx("span",{className:tt.fileIcon,children:APe(j.path)}),a.jsxs("span",{className:tt.reviewFileName,children:[a.jsx(q5n,{path:mO(j.path,n),title:j.path}),D&&a.jsx("button",{type:"button",className:tt.reviewOpenButton,onClick:()=>s(j),title:`${o("turnOutputs.preview")} ${j.path}`,children:o("turnOutputs.preview")}),M&&a.jsx("button",{type:"button",className:tt.reviewOpenButton,onClick:()=>void N(j),title:`${o("common.download")} ${j.path}`,disabled:k.has(j.path),children:o(k.has(j.path)?"common.downloading":"common.download")})]}),a.jsx(dP,{additions:j.additions,deletions:j.deletions,className:tt.lineStats,additionsClassName:tt.additions,deletionsClassName:tt.deletions}),a.jsx("span",{className:[tt.chevron,P?tt.chevronOpen:""].filter(Boolean).join(" "),"aria-hidden":"true",children:a.jsx(owe,{})})]}),P&&a.jsx(z5n,{change:j})]},`${j.toolCallId}:${j.path}`)})}),E&&!f&&a.jsx("div",{className:tt.reviewSplitHandle,role:"separator","aria-orientation":"vertical",onPointerDown:C}),E&&a.jsx("div",{className:tt.tree,children:A.children.map(j=>a.jsx(IPe,{node:j,depth:0,selectedPath:t},j.path))})]})]})}function z5n({change:e}){if(e.diffs.length===0)return a.jsx("div",{className:tt.diffEmpty,children:"No diff available."});const t=H5n(e.diffs);return a.jsx("div",{className:tt.diffPreview,children:t.map((n,s)=>n.fileDiff&&!n.fullContent?a.jsx(Dee,{diff:n.fileDiff},s):a.jsx(U5n,{oldText:n.oldText,newText:n.newText},s))})}function H5n(e){for(let t=e.length-1;t>=0;t--)if(e[t]?.fullContent)return e.slice(t);return e}function U5n({oldText:e,newText:t}){const n=d.useRef(null),[s,r]=d.useState(null),[i,o]=d.useState(null);return d.useEffect(()=>{const l=n.current;if(!l)return;const c=()=>r(l.clientWidth>=720);c();const u=new ResizeObserver(c);return u.observe(l),()=>u.disconnect()},[]),d.useEffect(()=>{const l=n.current;if(!l||s===null)return;l.replaceChildren(),o(null);let c=!1,u=null;const h=[b8e,ls.editable.of(!1),Co.readOnly.of(!0),ls.lineWrapping],f={scanLimit:1e3,timeout:500},p={margin:3,minSize:8};return He(async()=>{const{MergeView:m,unifiedMergeView:g}=await import("./index-DSIzVof7.js");return{MergeView:m,unifiedMergeView:g}},[]).then(({MergeView:m,unifiedMergeView:g})=>{if(!c)try{if(s){u=new m({a:{doc:e,extensions:h},b:{doc:t,extensions:h},parent:l,highlightChanges:!0,gutter:!0,revertControls:void 0,collapseUnchanged:p,diffConfig:f});return}u=new ls({doc:t,extensions:[...h,g({original:e,highlightChanges:!0,gutter:!0,mergeControls:!1,allowInlineDiffs:!0,collapseUnchanged:p,diffConfig:f})],parent:l})}catch(v){c||o(v instanceof Error?v.message:String(v))}}).catch(m=>{c||o(m instanceof Error?m.message:String(m))}),()=>{c=!0,u?.destroy()}},[s,t,e]),a.jsxs("div",{className:tt.codeMirrorDiffWrap,children:[a.jsx("div",{ref:n,className:tt.codeMirrorDiff}),i&&a.jsxs("div",{className:tt.diffError,children:["Diff unavailable: ",i]})]})}function IPe({node:e,depth:t,selectedPath:n}){const s=!!e.file,[r,i]=d.useState(!0),o=[tt.treeRow,s?tt.treeFile:tt.treeFolder].filter(Boolean).join(" "),l={paddingLeft:10+t*18,"--tree-row-line-left":`${19+Math.max(0,t-1)*18}px`},c={"--tree-children-line-left":`${19+t*18}px`},u=a.jsxs(a.Fragment,{children:[a.jsx("span",{className:tt.treeTwisty,children:!s&&a.jsx("span",{className:[tt.treeChevron,r?"":tt.treeChevronClosed].filter(Boolean).join(" "),children:a.jsx(Y5n,{})})}),a.jsxs("span",{className:tt.treeContent,children:[s&&a.jsx("span",{className:tt.fileIcon,children:APe(e.path)}),a.jsx("span",{className:tt.treeName,children:e.name})]}),e.file?.isArtifact&&a.jsx("span",{className:tt.reviewBadge,children:"artifact"})]});return a.jsxs("div",{className:tt.treeNode,children:[s?a.jsx("div",{className:o,"data-selected":e.file?.path===n||void 0,"data-depth":t,style:l,title:e.path,children:u}):a.jsx("button",{type:"button",className:o,"data-depth":t,style:l,title:e.path,"aria-expanded":r,onClick:()=>i(h=>!h),children:u}),!s&&r&&e.children.length>0&&a.jsx("div",{className:tt.treeChildren,style:c,children:e.children.map(h=>a.jsx(IPe,{node:h,depth:t+1,selectedPath:n},h.path))})]})}function q5n({path:e,title:t}){const n=d.useRef(null),[s,r]=d.useState(()=>EPe(e));return d.useLayoutEffect(()=>{const i=n.current;if(!i)return;const o=()=>r(W5n(e,i));o();const l=new ResizeObserver(o);return l.observe(i),()=>l.disconnect()},[e]),a.jsxs("span",{ref:n,className:tt.reviewPath,title:t??e,children:[s.prefix&&a.jsx("span",{className:tt.pathPrefix,children:s.prefix}),a.jsx("span",{className:tt.pathFileName,children:s.leaf})]})}function EPe(e){const t=e.lastIndexOf("/");return t<0?{prefix:"",leaf:e}:{prefix:e.slice(0,t+1),leaf:e.slice(t+1)}}let iwe=null;function W5n(e,t){const n=EPe(e),s=t.clientWidth;if(s<=0)return n;const r=V5n(t);if(r(e)<=s)return n;const i=e.split("/").filter(Boolean),o=i.at(-1)??e,l=r(o);if(i.length<=1||l+r(".../")>s)return{prefix:"",leaf:o};let c=".../";for(let u=1;u<i.length;u++){const f=`.../${i.slice(i.length-1-u,-1).join("/")}/`;if(r(f)+l>s)break;c=f}return{prefix:c,leaf:o}}function V5n(e){iwe??=document.createElement("canvas");const t=iwe.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 G5n(){return a.jsxs("svg",{className:tt.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 K5n(){return a.jsxs("svg",{className:tt.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 owe(){return a.jsx("svg",{className:tt.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 Y5n(){return a.jsx("svg",{className:tt.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 X5n(e,t){const n={name:"",path:"",children:[]};for(const s of e){const r=mO(s.path,t).split("/").filter(Boolean);let i=n;for(let o=0;o<r.length;o++){const l=r[o],c=r.slice(0,o+1).join("/");let u=i.children.find(h=>h.name===l);u||(u={name:l,path:c,children:[]},i.children.push(u)),o===r.length-1&&(u.file=s),i=u}}return RPe(n),n}function RPe(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)RPe(t)}function a9(e){return Jw(e).split("/").filter(Boolean).at(-1)??e}function APe(e){const t=a9(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 Z5n({artifact:e,sourceSessionId:t,workspaceActions:n,previewContent:s}){const{t:r}=lt(),i=Lf(),o=iIe(e),l=d4(e.url)?e.url:void 0,c=e.metadata?.artifactType==="automation_snapshot",u=e.metadata?.artifactType==="code_review",h=e.storage==="workspace"&&!!e.workspacePath,f=rIe(e);return e.metadata?.artifactType==="web_preview_snapshot"?a.jsx(DRn,{artifact:e,sourceSessionId:t}):u?e.status!=="available"?a.jsx(Q5n,{status:e.status}):!h||!e.workspacePath?a.jsx(J5n,{}):a.jsx(G2n,{workspacePath:e.workspacePath,artifactVersion:zce(e),workspaceActions:n}):h&&e.workspacePath?nIe(e)?a.jsx(nAn,{artifact:e,workspaceActions:n}):a.jsx(WO,{workspacePath:e.workspacePath,artifactVersion:zce(e),workspaceActions:n,previewContent:s,previewSizeBytes:e.sizeBytes,imageMimeType:f,previewKind:eAn(e)?"html":tAn(e)?"markdown":f?"image":"source"}):a.jsxs("div",{className:tt.detail,children:[a.jsxs("div",{className:tt.section,children:[a.jsx("div",{className:tt.sectionTitle,children:c?"Automation Snapshot":"Artifact"}),a.jsxs("div",{className:tt.fieldGrid,children:[a.jsx(hf,{label:"Type",value:hJ(e.kind,e.workspacePath)}),a.jsx(hf,{label:"Storage",value:e.storage}),a.jsx(hf,{label:"Status",value:e.status}),a.jsx(hf,{label:"Source",value:e.source}),a.jsx(hf,{label:"Size",value:AD(e.sizeBytes)}),a.jsx(hf,{label:"Created",value:e.createdAt}),a.jsx(hf,{label:"Updated",value:e.updatedAt}),e.toolName&&a.jsx(hf,{label:"Tool",value:e.toolName}),e.toolCallId&&a.jsx(hf,{label:"Tool call",value:e.toolCallId})]})]}),e.description&&a.jsxs("div",{className:tt.section,children:[a.jsx("div",{className:tt.sectionTitle,children:"Description"}),a.jsx("div",{className:tt.description,children:e.description})]}),c&&e.metadata&&a.jsxs("div",{className:tt.section,children:[a.jsx("div",{className:tt.sectionTitle,children:"Details"}),a.jsxs("div",{className:tt.fieldGrid,children:[wC(e.metadata,"automationId","Automation ID"),wC(e.metadata,"schedule","Schedule"),wC(e.metadata,"timezone","Timezone"),wC(e.metadata,"status","Status"),wC(e.metadata,"nextRunAt","Next run"),wC(e.metadata,"prompt","Prompt")]})]}),(o||l)&&a.jsxs("div",{className:tt.section,children:[a.jsx("div",{className:tt.sectionTitle,children:"Location"}),l?a.jsxs("div",{className:tt.locationRow,children:[a.jsx("a",{className:tt.link,href:l,target:"_blank",rel:"noopener noreferrer",onClick:p=>i(p,l),children:l}),a.jsx("a",{className:tt.openButton,href:l,target:"_blank",rel:"noopener noreferrer",onClick:p=>i(p,l),children:r("artifact.openLink")})]}):a.jsx("div",{className:tt.meta,children:o})]})]})}function Q5n({status:e}){const{t}=lt();return a.jsx("div",{className:tt.previewError,role:"alert",children:t("codeReview.unavailable",{status:e})})}function J5n(){const{t:e}=lt();return a.jsx("div",{className:tt.previewError,role:"alert",children:e("codeReview.workspaceRequired")})}function eAn(e){const t=e.workspacePath?.toLowerCase()??"",n=Qw(e.mimeType);return e.kind==="html"||t.endsWith(".html")||t.endsWith(".htm")||n==="text/html"}function tAn(e){const t=e.workspacePath?.toLowerCase()??"",n=Qw(e.mimeType);return t.endsWith(".md")||t.endsWith(".markdown")||n==="text/markdown"}function nAn({artifact:e,workspaceActions:t}){const{t:n}=lt(),[s,r]=d.useState(null),[i,o]=d.useState(!1),l=d.useRef(!0),c=iIe(e);d.useEffect(()=>(l.current=!0,()=>{l.current=!1}),[]);const u=async()=>{if(e.workspacePath){o(!0),r(null);try{await jD(t,e.workspacePath,e.mimeType,()=>!l.current)}catch(h){if(!l.current)return;r(h instanceof Error?h.message:String(h))}finally{l.current&&o(!1)}}};return a.jsx("div",{className:tt.detail,children:a.jsxs("div",{className:tt.section,children:[a.jsx("div",{className:tt.sectionTitle,children:n("common.download")}),a.jsxs("div",{className:tt.fieldGrid,children:[a.jsx(hf,{label:"Type",value:hJ(e.kind,e.workspacePath)}),a.jsx(hf,{label:"Size",value:AD(e.sizeBytes)}),c?a.jsx(hf,{label:"Location",value:c}):null,e.status!=="available"&&e.status!=="changed"?a.jsx(hf,{label:"Status",value:e.status??"missing"}):null]}),a.jsx("div",{className:tt.downloadRow,children:a.jsx("button",{type:"button",className:tt.downloadButton,onClick:()=>{u()},disabled:i||e.status!=="available"&&e.status!=="changed",children:n(i?"common.downloading":"common.download")})}),s&&a.jsx("div",{className:tt.previewError,children:s})]})})}function sAn({tab:e}){const{t}=lt(),n=la(),s=g4(e.workspaceCwd),r=s?.actions,i=Lf(),[o,l]=d.useState(0),[c,u]=d.useState(),[h,f]=d.useState(),[p,m]=d.useState(),g=e.source,v=g.locator,y=e.owner.isCurrent()&&n.sessionId===e.sourceSessionId&&n.capabilities?.features.includes("session_sources")&&s?.workspaceId===e.workspaceId&&(!!s||e.workspaceCwd===void 0&&v.type!=="workspace_file")&&(v.type!=="workspace_file"||g.workspaceCwd===n.workspaceCwd),w=v.type==="workspace_file"?v.workspacePath:v.type==="attachment"?v.attachmentId:"",b=/\.pdf$/i.test(w);if(d.useEffect(()=>{let k=!1;return u(void 0),f(void 0),m(void 0),!y||v.type==="url"?void 0:((async()=>{if(v.type==="attachment"){const T=await e.sessionActions.readAttachment(v.attachmentId);if(k||!e.owner.isCurrent())return;const E=Uint8Array.from(atob(T.data),A=>A.charCodeAt(0));u(new Blob([E],{type:T.mimeType}))}else if(b&&r){const T=await n4(r.readFileBytes,w,"application/pdf",{statFile:r.stat,isCancelled:()=>k||!e.owner.isCurrent()});!k&&e.owner.isCurrent()&&u(T)}})().catch(T=>{!k&&e.owner.isCurrent()&&f(qa(T))}),()=>{k=!0})},[o,y,v,w,b,e.owner,e.sessionActions,r]),y&&v.type==="url")return a.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[a.jsx("h3",{children:g.title}),g.description&&a.jsx("p",{children:g.description}),a.jsx("p",{className:"break-all text-sm text-muted-foreground",children:v.url}),d4(v.url)&&a.jsx("a",{className:"text-primary underline",href:v.url,target:"_blank",rel:"noopener noreferrer",onClick:k=>i(k,v.url),children:t("sources.openOriginal")})]});if(!y||!s&&v.type!=="attachment")return a.jsx("div",{className:tt.empty,role:"alert",children:t("sources.unavailable")});const x=v.type==="workspace_file"&&!b&&nIe({workspacePath:w});return a.jsxs("div",{className:"flex h-full min-h-0 flex-1 flex-col",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-border px-3 py-2",children:[a.jsx("span",{className:"truncate text-xs text-muted-foreground",title:w,children:w}),a.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[p&&a.jsx(ht,{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(Mw,{})})}),h&&a.jsx(ht,{variant:"ghost",size:"sm",onClick:()=>l(k=>k+1),children:t("common.retry")})]})]}),h?a.jsx("div",{className:tt.previewError,role:"alert",children:h}):x?a.jsxs("div",{className:"p-4",children:[a.jsx("p",{children:t("attachment.previewUnsupported")}),a.jsx(ht,{onClick:()=>void jD(r,w,"application/octet-stream",()=>!e.owner.isCurrent()).catch(k=>{e.owner.isCurrent()&&f(qa(k))}),children:t("common.download")})]}):(v.type==="attachment"||b)&&!c?a.jsx("div",{className:tt.empty,role:"status",children:t("common.loading")}):c&&c.type!=="application/pdf"&&!OT(c.type,w)?a.jsx(jPe,{data:c,title:g.title,onDownloadUrl:m,showDownload:!1,image:!!Q_(w)&&c.type.startsWith("image/")}):a.jsx("div",{className:"relative min-h-0 flex-1 overflow-auto",children:a.jsx(WO,{workspacePath:w,workspaceActions:r,onLoadError:f,previewData:c,previewOnly:v.type==="attachment",previewMimeType:c?.type,previewKind:/\.html?$/i.test(w)||Qw(c?.type)==="text/html"?"source":void 0},o)})]})}function jPe({data:e,title:t,image:n,onDownloadUrl:s,showDownload:r=!0}){const[i,o]=d.useState();return d.useEffect(()=>{const l=URL.createObjectURL(e);return o(l),s?.(l),()=>URL.revokeObjectURL(l)},[e,s]),i?a.jsxs("div",{className:tt.imagePreviewWrap,children:[n?a.jsx("img",{className:tt.imagePreview,src:i,alt:t}):a.jsx(NPe,{name:t,mimeType:e.type,size:e.size}),r&&a.jsx("a",{href:i,download:t,"aria-label":`Download ${t}`,children:a.jsx(Mw,{})})]}):null}function WO({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewData:i,previewMimeType:o,imageMimeType:l,previewKind:c,previewOnly:u,onLoadError:h}){if(i)return a.jsx(rAn,{workspacePath:e,workspaceActions:n,data:i,mimeType:o,previewKind:c,onLoadError:h});const f=e.toLowerCase(),p=l??Q_(e),m=c??(f.endsWith(".html")||f.endsWith(".htm")?"html":f.endsWith(".md")||f.endsWith(".markdown")?"markdown":p?"image":"source");return m==="html"?a.jsx(lAn,{workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:u,onLoadError:h}):m==="markdown"?a.jsx(uAn,{workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:u,onLoadError:h}):m==="image"&&p?a.jsx(aAn,{workspacePath:e,artifactVersion:t,workspaceActions:n,mimeType:p,onLoadError:h}):a.jsx(MPe,{workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:u,onLoadError:h})}function rAn({workspacePath:e,workspaceActions:t,data:n,mimeType:s,previewKind:r,onLoadError:i}){const o=(s||n.type||"application/octet-stream").split(";",1)[0].trim().toLowerCase();return o==="application/pdf"?a.jsx(oAn,{data:n,mimeType:o,title:e}):OT(o,e)?a.jsx(iAn,{workspacePath:e,workspaceActions:t,data:n,previewKind:r,onLoadError:i}):a.jsx(NPe,{name:e,mimeType:o,size:n.size})}function iAn({workspacePath:e,workspaceActions:t,data:n,previewKind:s,onLoadError:r}){const{t:i}=lt(),[o,l]=d.useState(),[c,u]=d.useState();return d.useEffect(()=>{const h=new FileReader;return l(void 0),u(void 0),h.onload=()=>l(String(h.result??"")),h.onerror=()=>{const f=i("attachment.readFailed");u(f),r?.(f)},h.readAsText(n),()=>{h.readyState===FileReader.LOADING&&h.abort()}},[n,r,i]),c?a.jsx("div",{className:tt.previewError,children:c}):o===void 0?a.jsx("div",{className:tt.empty,children:i("attachment.loadingFile")}):a.jsx(WO,{workspacePath:e,workspaceActions:t,previewContent:o,previewSizeBytes:n.size,previewOnly:!0,previewKind:s})}function oAn({data:e,mimeType:t,title:n}){const{t:s}=lt(),[r,i]=d.useState();return d.useEffect(()=>{const o=URL.createObjectURL(e.type===t?e:new Blob([e],{type:t}));return i(o),()=>URL.revokeObjectURL(o)},[e,t]),r?a.jsx("iframe",{className:tt.pdfAttachmentPreview,src:r,title:`Preview ${n}`}):a.jsx("div",{className:tt.empty,children:s("attachment.loadingPreview")})}function NPe({name:e,mimeType:t,size:n}){const{t:s}=lt();return a.jsxs("div",{className:tt.unsupportedAttachmentPreview,children:[a.jsx(vg,{name:e,mimeType:t,"aria-hidden":"true"}),a.jsx("div",{children:s("attachment.previewUnsupported")}),a.jsxs("div",{className:tt.unsupportedAttachmentMeta,children:[t," · ",AD(n)]})]})}function aAn({workspacePath:e,artifactVersion:t,workspaceActions:n,mimeType:s,onLoadError:r}){const[i,o]=d.useState(null),[l,c]=d.useState(null);return d.useEffect(()=>{let u=!1,h;return o(null),c(null),n4((f,p)=>n.readFileBytes(f,p),e,s,{statFile:f=>n.stat(f),isCancelled:()=>u}).then(f=>{u||(h=URL.createObjectURL(f),o(h))}).catch(f=>{if(u)return;const p=f instanceof Error?f.message:String(f);c(p),r?.(p)}),()=>{u=!0,h&&URL.revokeObjectURL(h)}},[t,s,r,n,e]),a.jsxs("div",{className:tt.imagePreviewWrap,children:[i?a.jsxs(a.Fragment,{children:[a.jsx("img",{className:tt.imagePreview,src:i,alt:a9(e)}),a.jsx("a",{className:tt.imageDownloadButton,href:i,download:a9(e),"aria-label":`Download ${a9(e)}`,title:"Download",children:a.jsx(Mw,{size:16,strokeWidth:1.8})})]}):l?null:a.jsx("div",{className:tt.empty,children:"Loading image..."}),l&&a.jsx("div",{className:tt.previewError,children:l})]})}function Hne({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:r,onLoadError:i}){const[o,l]=d.useState(s??null),[c,u]=d.useState(),[h,f]=d.useState(null);return d.useEffect(()=>{let p=!1;if(l(s??null),f(null),u(void 0),!r)return n.stat(e).then(m=>{if(!p){if(m.type==="directory")throw new Error("Directories cannot be opened as artifacts.");return n.readWorkspaceFile(e,{maxBytes:256*1024})}}).then(async m=>{if(p||!m||!m.truncated)return m;const g=await n4((v,y)=>n.readFileBytes(v,y),e,"application/octet-stream",{statFile:v=>n.stat(v),isCancelled:()=>p});return{sizeBytes:g.size,content:new TextDecoder(m.encoding||"utf-8").decode(await g.arrayBuffer())}}).then(m=>{p||!m||(u(m.sizeBytes),l(m.content))}).catch(m=>{if(p)return;const g=m instanceof Error?m.message:String(m);f(g),i?.(g)}),()=>{p=!0}},[t,s,r,i,n,e]),{content:o,error:h,sizeBytes:c}}function lAn({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:i,onLoadError:o}){const{content:l,error:c,sizeBytes:u}=Hne({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:i,onLoadError:o});return a.jsxs("div",{className:tt.htmlPreviewWrap,children:[l===null?!c&&a.jsx("div",{className:tt.empty,children:"Loading preview..."}):a.jsx(PPe,{content:l,sizeBytes:u??r,workspacePath:e,workspaceActions:n,children:()=>a.jsx(cAn,{content:l,workspacePath:e})}),c&&a.jsx("div",{className:tt.previewError,children:c})]})}function cAn({content:e,workspacePath:t}){const n=`Preview ${t}`,{t:s}=lt(),[r,i]=d.useState(null),[o,l]=d.useState(null);return d.useEffect(()=>{const c=new AbortController;return i(null),l(null),Rct(e,n,c.signal).then(u=>{c.signal.aborted||i(u)},u=>{c.signal.aborted||l(qa(u))}),()=>c.abort()},[e,n]),o?a.jsx("div",{className:tt.previewError,children:s("artifact.previewFailed",{message:o})}):r===null?a.jsx("div",{className:tt.empty,children:s("attachment.loadingPreview")}):a.jsx("iframe",{className:tt.htmlPreview,referrerPolicy:"no-referrer",sandbox:"allow-scripts",srcDoc:r,title:n})}function MPe({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:r,onLoadError:i}){const o=d.useRef(null),[l,c]=d.useState(null),{content:u,error:h}=Hne({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:r,onLoadError:i});return d.useEffect(()=>{const f=o.current;if(!f||u===null)return;f.replaceChildren(),c(null);let p;try{p=new ls({doc:u,extensions:[b8e,ls.editable.of(!1),Co.readOnly.of(!0),ls.lineWrapping],parent:f})}catch(m){c(m instanceof Error?m.message:String(m));return}return()=>p.destroy()},[u]),a.jsxs("div",{className:tt.filePreviewWrap,children:[u===null?!h&&a.jsx("div",{className:tt.empty,children:"Loading file..."}):a.jsx("div",{ref:o,className:tt.codeMirrorFile}),(h||l)&&a.jsx("div",{className:tt.previewError,children:h||l})]})}function PPe({content:e,sizeBytes:t,workspacePath:n,workspaceActions:s,children:r}){const{t:i}=lt(),[o,l]=d.useState(null);if(!d.useMemo(()=>(t??new TextEncoder().encode(e).byteLength)>1024*1024,[e,t]))return r();const u=o===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:i("artifact.longDocument")}),a.jsx(ht,{className:"ml-auto shrink-0",variant:"outline",size:"sm",onClick:()=>l(u?null:e),children:i(u?"artifact.showSource":"artifact.renderFullPreview")})]}),a.jsx("div",{className:"relative min-h-0 flex-1 overflow-auto",children:u?r():a.jsx(MPe,{workspacePath:n,workspaceActions:s,previewContent:e,previewOnly:!0})})]})}function uAn({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:i,onLoadError:o}){const{content:l,error:c,sizeBytes:u}=Hne({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:i,onLoadError:o});return a.jsxs("div",{className:tt.htmlPreviewWrap,children:[l===null?!c&&a.jsx("div",{className:tt.empty,children:"Loading preview..."}):a.jsx(PPe,{content:l,sizeBytes:u??r,workspacePath:e,workspaceActions:n,children:()=>a.jsx("div",{className:tt.markdownPreviewWrap,children:a.jsx(xp,{content:l})})}),c&&a.jsx("div",{className:tt.previewError,children:c})]})}function hf({label:e,value:t}){return t?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:tt.fieldLabel,children:e}),a.jsx("span",{className:tt.fieldValue,children:t})]}):null}function wC(e,t,n){const s=e[t];return s==null||s===""?null:a.jsx(hf,{label:n,value:String(s)},t)}/**
|
|
2270
2270
|
* @license
|
|
2271
2271
|
* Copyright 2025 Qwen Team
|
|
2272
2272
|
* SPDX-License-Identifier: Apache-2.0
|