@kingsoftcloud/ksadk-web 0.3.16 → 0.3.18
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/CHANGELOG.md +12 -0
- package/README.md +2 -2
- package/RELEASE_PROVENANCE.json +2 -2
- package/dist-ksadk/assets/{ArtifactsPanel-BuQ9Y_JK.js → ArtifactsPanel-Cdr5C_vM.js} +1 -1
- package/dist-ksadk/assets/{CodeBlock-ClmrpVUK.js → CodeBlock-BWRafud9.js} +1 -1
- package/dist-ksadk/assets/{MathMessageMarkdown-DYg6qEqQ.js → MathMessageMarkdown-CFKeJIvy.js} +1 -1
- package/dist-ksadk/assets/{MermaidBlock-B8QsBFET.js → MermaidBlock-BneAGUOd.js} +6 -6
- package/dist-ksadk/assets/{NativeTerminalPanel-Dkm61i5S.js → NativeTerminalPanel-BHI85zDO.js} +1 -1
- package/dist-ksadk/assets/{OfficialA2uiRenderer-SMVbkx2W.js → OfficialA2uiRenderer-BOmT36lJ.js} +1 -1
- package/dist-ksadk/assets/{abnfDiagram-VCTEODGH-CQ5-2gHs.js → abnfDiagram-VCTEODGH-DQvlOsBI.js} +1 -1
- package/dist-ksadk/assets/{arc-CHdgzwmb.js → arc-CGx0e4pN.js} +1 -1
- package/dist-ksadk/assets/architecture-7GRP2DOG-CFWjFkDL.js +1 -0
- package/dist-ksadk/assets/{architectureDiagram-5GKGNRK7-MnCOPhnl.js → architectureDiagram-5GKGNRK7-WyybcNKX.js} +1 -1
- package/dist-ksadk/assets/{blockDiagram-NRAW4CY4-DZ61ECd8.js → blockDiagram-NRAW4CY4-C9Cx_GVs.js} +1 -1
- package/dist-ksadk/assets/{c4Diagram-UCG6FXSJ-D9FYHHhU.js → c4Diagram-UCG6FXSJ-Bh7X3bGr.js} +1 -1
- package/dist-ksadk/assets/channel-D6Dp_l74.js +1 -0
- package/dist-ksadk/assets/chunk-2Q5K7J3B-CwmjhFYK.js +1 -0
- package/dist-ksadk/assets/{chunk-5VM5RSS4-AIv2klim.js → chunk-5VM5RSS4-cP9XupZj.js} +1 -1
- package/dist-ksadk/assets/{chunk-F27PBJKO-D_sWJ7f-.js → chunk-F27PBJKO-Bm77fvR9.js} +1 -1
- package/dist-ksadk/assets/{chunk-G27WJ6UU-DQzToglM.js → chunk-G27WJ6UU-DDKNPesQ.js} +1 -1
- package/dist-ksadk/assets/{chunk-JWPE2WC7-lOgv6BXZ.js → chunk-JWPE2WC7-BqiUDB7s.js} +1 -1
- package/dist-ksadk/assets/{chunk-LCL6LL3I-Cbx6jBtE.js → chunk-LCL6LL3I-C528mMZy.js} +1 -1
- package/dist-ksadk/assets/{chunk-POPQ4Y6H-DNJ22Jtx.js → chunk-POPQ4Y6H-CzZ9g_Uf.js} +1 -1
- package/dist-ksadk/assets/{chunk-RHFEMEQ7-BhICgqzs.js → chunk-RHFEMEQ7-CXj4tUZ-.js} +1 -1
- package/dist-ksadk/assets/{chunk-SVP7TREG-r-bF-HGi.js → chunk-SVP7TREG-BHyd85pS.js} +1 -1
- package/dist-ksadk/assets/{chunk-XXDRQBXY-OjeFK9EX.js → chunk-XXDRQBXY-Qe29PHGe.js} +1 -1
- package/dist-ksadk/assets/classDiagram-DTDB5LWJ-DsbvkCAV.js +1 -0
- package/dist-ksadk/assets/classDiagram-v2-JRS7N3AN-DsbvkCAV.js +1 -0
- package/dist-ksadk/assets/{cose-bilkent-JH36ORCC-LkMJR5TN.js → cose-bilkent-JH36ORCC-maRKgeec.js} +1 -1
- package/dist-ksadk/assets/cynefin-OW5HDTMX-CBZRVuc4.js +1 -0
- package/dist-ksadk/assets/{cynefinDiagram-5FMLGOSQ-B6wd-M91.js → cynefinDiagram-5FMLGOSQ-CoD0bEvn.js} +1 -1
- package/dist-ksadk/assets/{dagre-3AP2YEHR-Yo8czwSH.js → dagre-3AP2YEHR-BkpgQqyW.js} +1 -1
- package/dist-ksadk/assets/{dagre-IpjZOTvn.js → dagre-BUaTFrYa.js} +1 -1
- package/dist-ksadk/assets/{diagram-S7CK7UJ4-CAkqzyfj.js → diagram-S7CK7UJ4-25HdTbjE.js} +1 -1
- package/dist-ksadk/assets/{diagram-UQ7AKVKN-JyEZmDlh.js → diagram-UQ7AKVKN-KO-WqOIg.js} +1 -1
- package/dist-ksadk/assets/{diagram-VSXAHHWV-DGBXNEif.js → diagram-VSXAHHWV-B360BkDQ.js} +1 -1
- package/dist-ksadk/assets/{diagram-VX7I27RA-KljR5Glh.js → diagram-VX7I27RA-COr1Oqsg.js} +1 -1
- package/dist-ksadk/assets/{diagram-Z3DM3KII-8FQ2FrUP.js → diagram-Z3DM3KII-CgaKrIwB.js} +1 -1
- package/dist-ksadk/assets/{dist-AnEuKlWI.js → dist--HftQyp9.js} +1 -1
- package/dist-ksadk/assets/{dist-BmrsRv90.js → dist-B3Jp5r1e.js} +1 -1
- package/dist-ksadk/assets/{dist-Bls_5FN6.js → dist-BEbS8Bag.js} +1 -1
- package/dist-ksadk/assets/{dist-DRAbZJl6.js → dist-BQ116UdZ.js} +1 -1
- package/dist-ksadk/assets/{dist-BRaujO8W.js → dist-BoRn8a_t.js} +1 -1
- package/dist-ksadk/assets/{dist-CAnMW8ay.js → dist-Brbrdmff.js} +1 -1
- package/dist-ksadk/assets/{dist-Cs1lGsiM.js → dist-Bsuusoi0.js} +1 -1
- package/dist-ksadk/assets/{dist-BUvPmCJJ.js → dist-Bxcu8Ca0.js} +1 -1
- package/dist-ksadk/assets/{dist-CSguAs4w.js → dist-By-MVndb.js} +1 -1
- package/dist-ksadk/assets/{dist-Bo4bAcyo.js → dist-C9BTMVwS.js} +1 -1
- package/dist-ksadk/assets/{dist-dxCMjEJX.js → dist-CBo9AHUv.js} +1 -1
- package/dist-ksadk/assets/{dist-CTkYhw0e.js → dist-CR61WJFC.js} +1 -1
- package/dist-ksadk/assets/{dist-Bnqrfpu2.js → dist-CwnkOyDn.js} +1 -1
- package/dist-ksadk/assets/{dist-BblTQEdU.js → dist-CxIl4t92.js} +1 -1
- package/dist-ksadk/assets/{dist-87AsLuzD.js → dist-DKG0OYnk.js} +1 -1
- package/dist-ksadk/assets/{dist-Cj5PFf9x.js → dist-DSw5Ju6-.js} +1 -1
- package/dist-ksadk/assets/{dist-Ps_8XMpQ.js → dist-DXOlCAay.js} +1 -1
- package/dist-ksadk/assets/{dist-C-4NaB6S.js → dist-DgJ57sRe.js} +1 -1
- package/dist-ksadk/assets/{dist-DWRPGuTp.js → dist-DmWw0IXB.js} +1 -1
- package/dist-ksadk/assets/{dist-DrFtl2Jz.js → dist-DzdXSBJb.js} +1 -1
- package/dist-ksadk/assets/{dist-DQSR5gJm.js → dist-HHvdjADB.js} +1 -1
- package/dist-ksadk/assets/{dist-DW_Mhac3.js → dist-_0Xgu_07.js} +1 -1
- package/dist-ksadk/assets/{ebnfDiagram-PWID7BFC-BDy_T6BJ.js → ebnfDiagram-PWID7BFC-DogDP2db.js} +1 -1
- package/dist-ksadk/assets/{erDiagram-SSCWMZ5O-Cb9mxU2v.js → erDiagram-SSCWMZ5O-CeBDnUjR.js} +1 -1
- package/dist-ksadk/assets/eventmodeling-NTZA5JFV-vXZWMkpn.js +1 -0
- package/dist-ksadk/assets/flowDiagram-A5DVABFB-5LRgzKLv.js +1 -0
- package/dist-ksadk/assets/{ganttDiagram-EL5Y4UJY-CI-NY47s.js → ganttDiagram-EL5Y4UJY-oIQL3MCp.js} +1 -1
- package/dist-ksadk/assets/gitGraph-4MIJSDKK-BUWSkncI.js +1 -0
- package/dist-ksadk/assets/{gitGraphDiagram-WWUBYQGX-DZBPuEz2.js → gitGraphDiagram-WWUBYQGX-B7qz0cmZ.js} +1 -1
- package/dist-ksadk/assets/index-4g1ndaxW.js +1132 -0
- package/dist-ksadk/assets/index-DEVfafsU.css +2 -0
- package/dist-ksadk/assets/info-A6RAGUB7-CzJ_YrOs.js +1 -0
- package/dist-ksadk/assets/{infoDiagram-RXCK75RN-BGVB1ufk.js → infoDiagram-RXCK75RN-yQRC41Ya.js} +1 -1
- package/dist-ksadk/assets/{ishikawaDiagram-5VMMS53U-C-pPrser.js → ishikawaDiagram-5VMMS53U-BCu4HiwL.js} +1 -1
- package/dist-ksadk/assets/{journeyDiagram-EYS64GPL-mqH7Ax1g.js → journeyDiagram-EYS64GPL-JaqmO73K.js} +1 -1
- package/dist-ksadk/assets/{kanban-definition-3QL26DDD-D1g0NfmY.js → kanban-definition-3QL26DDD-DQo4X8NO.js} +1 -1
- package/dist-ksadk/assets/{katex-DBFpex0b.js → katex-t_DWylQw.js} +1 -1
- package/dist-ksadk/assets/{linear-H9vrIL3e.js → linear-DWdnI35B.js} +1 -1
- package/dist-ksadk/assets/{mermaid-parser.core-CTwOsmSy.js → mermaid-parser.core-BHrT2Pfe.js} +2 -2
- package/dist-ksadk/assets/{mindmap-definition-FBJOCRG2-P24ajxwA.js → mindmap-definition-FBJOCRG2-PBVAhZYV.js} +1 -1
- package/dist-ksadk/assets/packet-AYTQ26CC-CXoos6fx.js +1 -0
- package/dist-ksadk/assets/{pegDiagram-XKGWAZYB-CIAjyVaA.js → pegDiagram-XKGWAZYB-CU_cLfow.js} +1 -1
- package/dist-ksadk/assets/pie-WAS4IAKB-CjF9NoIt.js +1 -0
- package/dist-ksadk/assets/{pieDiagram-E7YTZNPT-Cpg76g41.js → pieDiagram-E7YTZNPT-B1h0-_pW.js} +1 -1
- package/dist-ksadk/assets/{quadrantDiagram-AXDQQJYC-COa_uah3.js → quadrantDiagram-AXDQQJYC-DEMoGo5a.js} +1 -1
- package/dist-ksadk/assets/radar-RG4KPBEZ-BQGWs9nw.js +1 -0
- package/dist-ksadk/assets/railroad-74A4TZTK-B6znvLUK.js +1 -0
- package/dist-ksadk/assets/railroad-abnf-HS5TGJTU-Bzquz0As.js +1 -0
- package/dist-ksadk/assets/railroad-ebnf-LZEXJU2U-1IikGkb5.js +1 -0
- package/dist-ksadk/assets/railroad-peg-WCYAUIDC-BKKgHzdc.js +1 -0
- package/dist-ksadk/assets/{railroadDiagram-O6MQD6OU-CDiUen7V.js → railroadDiagram-O6MQD6OU-BTAob2wg.js} +1 -1
- package/dist-ksadk/assets/{requirementDiagram-EFPCY7ZU-4tmvHR-z.js → requirementDiagram-EFPCY7ZU-Dl0Q2SuO.js} +1 -1
- package/dist-ksadk/assets/{sankeyDiagram-P5KCCOFB-cmOQFKfb.js → sankeyDiagram-P5KCCOFB-DeaTWkur.js} +1 -1
- package/dist-ksadk/assets/{sequenceDiagram-WJ2MYXX4-C87BVo37.js → sequenceDiagram-WJ2MYXX4-gFQYrsOd.js} +1 -1
- package/dist-ksadk/assets/{sizeCapture-X5ZJPWSS-BD2400H2.js → sizeCapture-X5ZJPWSS-pGQzddMB.js} +1 -1
- package/dist-ksadk/assets/{stateDiagram-HBIQ2CUA-DaxlblQk.js → stateDiagram-HBIQ2CUA-DmpYOZt1.js} +1 -1
- package/dist-ksadk/assets/stateDiagram-v2-4QOOHH4V-Dolxgkw3.js +1 -0
- package/dist-ksadk/assets/{swimlanes-XN3QIQJK-M7GAwJZ9.js → swimlanes-XN3QIQJK-BfuSAsrr.js} +1 -1
- package/dist-ksadk/assets/swimlanesDiagram-VK2B7HYN-BuI1erYj.js +8 -0
- package/dist-ksadk/assets/{timeline-definition-24CTP7MA-Cq_BUN6-.js → timeline-definition-24CTP7MA-CgJwrrxf.js} +1 -1
- package/dist-ksadk/assets/treeView-Q6P3EWNA-DtMdDH8N.js +1 -0
- package/dist-ksadk/assets/treemap-WGGIJYW6-VoU8QtLZ.js +1 -0
- package/dist-ksadk/assets/{vennDiagram-4TSXK5OY-BTAMWn-b.js → vennDiagram-4TSXK5OY-CBSAgXDd.js} +1 -1
- package/dist-ksadk/assets/wardley-WFR3VGLG-YWSRB0Zm.js +1 -0
- package/dist-ksadk/assets/{wardleyDiagram-VM6X3IG4-Dnvpr9wl.js → wardleyDiagram-VM6X3IG4-013TZ2JZ.js} +1 -1
- package/dist-ksadk/assets/{xychartDiagram-S5SC5T6Z-D838CKvY.js → xychartDiagram-S5SC5T6Z-u6Frp8xp.js} +1 -1
- package/dist-ksadk/index.html +2 -2
- package/dist-lib/App.d.ts.map +1 -1
- package/dist-lib/AttachmentPreview-Dhc6ulFv.js +1956 -0
- package/dist-lib/{ConnectedComposer-B2lm1bBF.js → ConnectedComposer-Cc6bqJmu.js} +354 -351
- package/dist-lib/{ConnectedMessageList-BumlD3Zk.js → ConnectedMessageList-Bdd-qjs-.js} +427 -422
- package/dist-lib/{WorkspacePanelContainer-CcI-iqlE.js → WorkspacePanelContainer-_PuvSz_J.js} +319 -319
- package/dist-lib/{a2ui-CWVTKJ6O.js → a2ui-DihCxdtQ.js} +1467 -410
- package/dist-lib/{capabilities-lJRDfRg9.js → capabilities-CHy70QGW.js} +5 -2
- package/dist-lib/capabilities.js +1 -1
- package/dist-lib/chat-composer.js +2 -2
- package/dist-lib/chat-timeline.js +3 -3
- package/dist-lib/components/chat/A2UIActivityMessage.d.ts +1 -0
- package/dist-lib/components/chat/A2UIActivityMessage.d.ts.map +1 -1
- package/dist-lib/components/chat/ChatComposer.d.ts +2 -1
- package/dist-lib/components/chat/ChatComposer.d.ts.map +1 -1
- package/dist-lib/components/chat/ChatMessageList.d.ts.map +1 -1
- package/dist-lib/components/chat/ConnectedComposer.d.ts +2 -1
- package/dist-lib/components/chat/ConnectedComposer.d.ts.map +1 -1
- package/dist-lib/components/chat/ExecutionPermissionMenu.d.ts.map +1 -1
- package/dist-lib/components/chat/InteractionA2uiSurface.d.ts +6 -1
- package/dist-lib/components/chat/InteractionA2uiSurface.d.ts.map +1 -1
- package/dist-lib/components/chat/InteractionTray.d.ts +3 -1
- package/dist-lib/components/chat/InteractionTray.d.ts.map +1 -1
- package/dist-lib/components/chat/JsonSchemaInputForm.d.ts.map +1 -1
- package/dist-lib/components/chat/McpAuthorizationCard.d.ts +8 -0
- package/dist-lib/components/chat/McpAuthorizationCard.d.ts.map +1 -0
- package/dist-lib/components/chat/ProcessingBlocksView.d.ts +1 -1
- package/dist-lib/components/chat/ProcessingBlocksView.d.ts.map +1 -1
- package/dist-lib/components/chat/submitted-interaction-history.d.ts.map +1 -1
- package/dist-lib/components/ui/button.d.ts +12 -0
- package/dist-lib/components/ui/button.d.ts.map +1 -0
- package/dist-lib/components.js +5 -5
- package/dist-lib/conversation.js +2 -2
- package/dist-lib/core/api/facade.d.ts +1 -0
- package/dist-lib/core/api/facade.d.ts.map +1 -1
- package/dist-lib/core/api/types.d.ts +1 -0
- package/dist-lib/core/api/types.d.ts.map +1 -1
- package/dist-lib/core/conversation/presentation.d.ts.map +1 -1
- package/dist-lib/core/conversation/runtime-ingress.d.ts.map +1 -1
- package/dist-lib/core/interaction/a2ui-approval.d.ts +20 -0
- package/dist-lib/core/interaction/a2ui-approval.d.ts.map +1 -0
- package/dist-lib/core/interaction/adapters/agui.d.ts.map +1 -1
- package/dist-lib/core/interaction/adapters/normalize.d.ts +2 -0
- package/dist-lib/core/interaction/adapters/normalize.d.ts.map +1 -1
- package/dist-lib/core/interaction/adapters/session-events.d.ts.map +1 -1
- package/dist-lib/core/interaction/client.d.ts.map +1 -1
- package/dist-lib/core/interaction/legacy-a2ui.d.ts +5 -0
- package/dist-lib/core/interaction/legacy-a2ui.d.ts.map +1 -0
- package/dist-lib/core/interaction/pending.d.ts +4 -0
- package/dist-lib/core/interaction/pending.d.ts.map +1 -0
- package/dist-lib/core/mcp-authorization/contract.d.ts +5 -0
- package/dist-lib/core/mcp-authorization/contract.d.ts.map +1 -0
- package/dist-lib/core/mcp-authorization/normalize.d.ts +4 -0
- package/dist-lib/core/mcp-authorization/normalize.d.ts.map +1 -0
- package/dist-lib/core/mcp-authorization/recovery.d.ts +5 -0
- package/dist-lib/core/mcp-authorization/recovery.d.ts.map +1 -0
- package/dist-lib/core/mcp-authorization/types.d.ts +20 -0
- package/dist-lib/core/mcp-authorization/types.d.ts.map +1 -0
- package/dist-lib/core/run/agui.d.ts.map +1 -1
- package/dist-lib/core/run/blocks.d.ts +4 -2
- package/dist-lib/core/run/blocks.d.ts.map +1 -1
- package/dist-lib/core/run/dispatcher.d.ts.map +1 -1
- package/dist-lib/core/run/engine.d.ts.map +1 -1
- package/dist-lib/core/run/types.d.ts +12 -0
- package/dist-lib/core/run/types.d.ts.map +1 -1
- package/dist-lib/core/stream/types.d.ts +7 -0
- package/dist-lib/core/stream/types.d.ts.map +1 -1
- package/dist-lib/core/teams/cloudContracts.d.ts +15 -15
- package/dist-lib/{feedback-CuC5jRi_.js → feedback-BBJKMdF2.js} +98 -86
- package/dist-lib/hooks/useAgentChat.d.ts +1 -1
- package/dist-lib/hooks/useAgentChat.d.ts.map +1 -1
- package/dist-lib/hooks/useInteractions.d.ts +2 -1
- package/dist-lib/hooks/useInteractions.d.ts.map +1 -1
- package/dist-lib/hooks/useRunAgent.d.ts.map +1 -1
- package/dist-lib/hooks/useSessionLifecycle.d.ts.map +1 -1
- package/dist-lib/hooks.js +19 -18
- package/dist-lib/permission-DGyt7wBj.js +25 -0
- package/dist-lib/{persisted-session-history-Mg7yqvHj.js → persisted-session-history-Bh_6zSKC.js} +626 -1479
- package/dist-lib/runtime.js +258 -255
- package/dist-lib/session-events-DvFsVXpD.js +1463 -0
- package/dist-lib/stores/bootstrap.d.ts.map +1 -1
- package/dist-lib/stores/execution-permission.d.ts +2 -0
- package/dist-lib/stores/execution-permission.d.ts.map +1 -1
- package/dist-lib/styles.css +1 -1
- package/dist-lib/types/capabilities.d.ts +4 -0
- package/dist-lib/types/capabilities.d.ts.map +1 -1
- package/dist-lib/{useSessionLifecycle-BsS84-O4.js → useSessionLifecycle-u7i_h_io.js} +1018 -1987
- package/dist-lib/utils/capabilities.d.ts +1 -0
- package/dist-lib/utils/capabilities.d.ts.map +1 -1
- package/dist-lib/utils/persisted-session-history.d.ts.map +1 -1
- package/dist-lib/utils/responses-stream.d.ts +3 -1
- package/dist-lib/utils/responses-stream.d.ts.map +1 -1
- package/dist-lib/utils/run-progress.d.ts.map +1 -1
- package/dist-lib/utils/session-event-history.d.ts +11 -0
- package/dist-lib/utils/session-event-history.d.ts.map +1 -1
- package/dist-lib/utils/session-events.d.ts.map +1 -1
- package/dist-lib/utils/workspace.d.ts +1 -1
- package/package.json +1 -1
- package/dist-ksadk/assets/architecture-7GRP2DOG-B_LhRes-.js +0 -1
- package/dist-ksadk/assets/channel-Bq55bwo_.js +0 -1
- package/dist-ksadk/assets/chunk-2Q5K7J3B-Dace2ujW.js +0 -1
- package/dist-ksadk/assets/classDiagram-DTDB5LWJ-l9qDDu33.js +0 -1
- package/dist-ksadk/assets/classDiagram-v2-JRS7N3AN-l9qDDu33.js +0 -1
- package/dist-ksadk/assets/cynefin-OW5HDTMX-jtPBpAp-.js +0 -1
- package/dist-ksadk/assets/eventmodeling-NTZA5JFV-DMz2Fvu-.js +0 -1
- package/dist-ksadk/assets/flowDiagram-A5DVABFB-clcQL_nf.js +0 -1
- package/dist-ksadk/assets/gitGraph-4MIJSDKK-DDQIXIFD.js +0 -1
- package/dist-ksadk/assets/index-4lKAP0g-.js +0 -1132
- package/dist-ksadk/assets/index-DMqhW2cV.css +0 -2
- package/dist-ksadk/assets/info-A6RAGUB7-CnWfuiwa.js +0 -1
- package/dist-ksadk/assets/packet-AYTQ26CC-C1REqCW5.js +0 -1
- package/dist-ksadk/assets/pie-WAS4IAKB-CzQ5iT3d.js +0 -1
- package/dist-ksadk/assets/radar-RG4KPBEZ-d5WzegFP.js +0 -1
- package/dist-ksadk/assets/railroad-74A4TZTK-fRIdWxzy.js +0 -1
- package/dist-ksadk/assets/railroad-abnf-HS5TGJTU-7joOoyeT.js +0 -1
- package/dist-ksadk/assets/railroad-ebnf-LZEXJU2U-BAgBPuog.js +0 -1
- package/dist-ksadk/assets/railroad-peg-WCYAUIDC-Bq9jPeDZ.js +0 -1
- package/dist-ksadk/assets/stateDiagram-v2-4QOOHH4V-BAnVAqLb.js +0 -1
- package/dist-ksadk/assets/swimlanesDiagram-VK2B7HYN-DzYhp6ae.js +0 -8
- package/dist-ksadk/assets/treeView-Q6P3EWNA-Kl6y61te.js +0 -1
- package/dist-ksadk/assets/treemap-WGGIJYW6-Bt1G2wC0.js +0 -1
- package/dist-ksadk/assets/wardley-WFR3VGLG-CNYQTyja.js +0 -1
- package/dist-lib/AttachmentPreview-DkgZ9Upi.js +0 -1545
- package/dist-lib/execution-permission-UqLwHTJS.js +0 -89
- package/dist-lib/json-value-DnHp0582.js +0 -186
- package/dist-lib/tool-display-DTiRdghE.js +0 -64
|
@@ -1,1545 +0,0 @@
|
|
|
1
|
-
import { a as e, c as t, g as n, i as r, l as i, m as a, n as o, o as s, p as c, v as l, y as u } from "./a2ui-CWVTKJ6O.js";
|
|
2
|
-
import { t as d } from "./json-value-DnHp0582.js";
|
|
3
|
-
import { t as f } from "./utils-CX-Pz5p6.js";
|
|
4
|
-
import { n as p, t as m } from "./schema-fields-CUpDl1NB.js";
|
|
5
|
-
import * as h from "react";
|
|
6
|
-
import { Component as g, Suspense as _, lazy as v, useCallback as y, useEffect as b, useMemo as x, useRef as S, useState as C } from "react";
|
|
7
|
-
import { ArrowRight as w, ChevronLeft as ee, ChevronRight as te, LoaderCircle as ne, MessageCircleQuestion as re, Pencil as ie, X as T } from "lucide-react";
|
|
8
|
-
import { Fragment as E, jsx as D, jsxs as O } from "react/jsx-runtime";
|
|
9
|
-
import { Catalog as k, MessageProcessor as A } from "@a2ui/web_core/v0_9";
|
|
10
|
-
import { canonicalize as ae } from "json-canonicalize";
|
|
11
|
-
import { basicCatalog as j, injectBasicCatalogStyles as M } from "@a2ui/web_core/v0_9/basic_catalog";
|
|
12
|
-
import * as N from "@radix-ui/react-dialog";
|
|
13
|
-
//#region src/components/chat/JsonSchemaInputForm.tsx
|
|
14
|
-
var P = "w-full rounded-md border border-[var(--ksadk-interaction-border)] bg-[var(--ksadk-interaction-control-background)] px-2 py-1.5 text-sm text-foreground", F = (e) => typeof e == "object" && !!e && !Array.isArray(e), I = (e) => e === void 0 ? "" : JSON.stringify(e, null, 2);
|
|
15
|
-
function oe({ choices: e, multiple: t, allowOther: n, ...i }) {
|
|
16
|
-
let a = (e, t) => JSON.stringify(e) === JSON.stringify(t), o = t && Array.isArray(i.value) ? i.value : [], s = (t) => e.some((e) => a(e, t));
|
|
17
|
-
return /* @__PURE__ */ O("div", {
|
|
18
|
-
"data-testid": `interaction-field-${i.path || "value"}`,
|
|
19
|
-
className: "space-y-1",
|
|
20
|
-
children: [e.map((e, n) => /* @__PURE__ */ O("label", {
|
|
21
|
-
className: "flex min-h-10 items-center gap-2",
|
|
22
|
-
children: [
|
|
23
|
-
/* @__PURE__ */ D("span", { children: n + 1 }),
|
|
24
|
-
/* @__PURE__ */ D("input", {
|
|
25
|
-
type: t ? "checkbox" : "radio",
|
|
26
|
-
name: i.path,
|
|
27
|
-
disabled: i.disabled,
|
|
28
|
-
checked: t ? o.some((t) => a(t, e)) : a(i.value, e),
|
|
29
|
-
onChange: (n) => i.onChange(t ? n.target.checked ? [...o, d(e)] : o.filter((t) => !a(t, e)) : d(e))
|
|
30
|
-
}),
|
|
31
|
-
/* @__PURE__ */ D("span", { children: typeof e == "string" ? e : JSON.stringify(e) })
|
|
32
|
-
]
|
|
33
|
-
}, n)), n ? /* @__PURE__ */ D("input", {
|
|
34
|
-
className: P,
|
|
35
|
-
disabled: i.disabled,
|
|
36
|
-
"aria-label": `${typeof i.schema.title == "string" ? i.schema.title : i.label}:自定义回答`,
|
|
37
|
-
type: r(i.schema, i.rootSchema) ? "password" : "text",
|
|
38
|
-
value: t ? o.filter((e) => !s(e)).join("\n") : s(i.value) ? "" : String(i.value ?? ""),
|
|
39
|
-
onChange: (e) => i.onChange(t ? [...o.filter(s), ...e.target.value.trim() ? [e.target.value] : []] : e.target.value)
|
|
40
|
-
}) : null]
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
function se(e) {
|
|
44
|
-
if (Object.hasOwn(e, "default")) return structuredClone(d(e.default));
|
|
45
|
-
if (Object.hasOwn(e, "const")) return structuredClone(d(e.const));
|
|
46
|
-
if (e.type === "null") return null;
|
|
47
|
-
if (e.type === "object" || F(e.properties)) {
|
|
48
|
-
let t = {};
|
|
49
|
-
for (let [n, r] of Object.entries(F(e.properties) ? e.properties : {})) {
|
|
50
|
-
if (!F(r)) continue;
|
|
51
|
-
let e = se(r);
|
|
52
|
-
e !== void 0 && (Object.hasOwn(r, "default") || Object.hasOwn(r, "const")) && Object.defineProperty(t, n, {
|
|
53
|
-
value: e,
|
|
54
|
-
enumerable: !0,
|
|
55
|
-
configurable: !0,
|
|
56
|
-
writable: !0
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
return t;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
function L({ value: e, onChange: t, path: n, onInvalid: r, disabled: i, label: a }) {
|
|
63
|
-
let [o, s] = C(() => ({
|
|
64
|
-
external: e,
|
|
65
|
-
text: I(e),
|
|
66
|
-
invalid: !1
|
|
67
|
-
}));
|
|
68
|
-
return o.external !== e && s({
|
|
69
|
-
external: e,
|
|
70
|
-
text: I(e),
|
|
71
|
-
invalid: !1
|
|
72
|
-
}), /* @__PURE__ */ O(E, { children: [/* @__PURE__ */ D("textarea", {
|
|
73
|
-
"aria-label": a,
|
|
74
|
-
"data-testid": `interaction-field-${n || "value"}`,
|
|
75
|
-
className: P,
|
|
76
|
-
disabled: i,
|
|
77
|
-
value: o.text,
|
|
78
|
-
rows: 5,
|
|
79
|
-
spellCheck: !1,
|
|
80
|
-
"aria-invalid": o.invalid,
|
|
81
|
-
onChange: (i) => {
|
|
82
|
-
let a = i.target.value;
|
|
83
|
-
try {
|
|
84
|
-
let e = a.trim() ? d(JSON.parse(a)) : void 0;
|
|
85
|
-
s({
|
|
86
|
-
external: e,
|
|
87
|
-
text: a,
|
|
88
|
-
invalid: !1
|
|
89
|
-
}), r(n, !1), t(e);
|
|
90
|
-
} catch {
|
|
91
|
-
s({
|
|
92
|
-
external: e,
|
|
93
|
-
text: a,
|
|
94
|
-
invalid: !0
|
|
95
|
-
}), r(n, !0);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}), o.invalid ? /* @__PURE__ */ D("p", {
|
|
99
|
-
role: "alert",
|
|
100
|
-
children: "请输入合法 JSON;当前草稿尚未提交。"
|
|
101
|
-
}) : null] });
|
|
102
|
-
}
|
|
103
|
-
function R(e) {
|
|
104
|
-
let { value: t, onChange: n, path: i, disabled: a, label: o, onInvalid: s, depth: c } = e, l = e.schema;
|
|
105
|
-
if (e.readOnlySnapshot && r(l, e.rootSchema)) return /* @__PURE__ */ O("div", {
|
|
106
|
-
className: "space-y-1 text-xs",
|
|
107
|
-
children: [/* @__PURE__ */ D("label", {
|
|
108
|
-
className: "block font-medium",
|
|
109
|
-
children: o
|
|
110
|
-
}), /* @__PURE__ */ D("span", {
|
|
111
|
-
"data-testid": `interaction-field-${i || "value"}`,
|
|
112
|
-
children: "已隐藏"
|
|
113
|
-
})]
|
|
114
|
-
});
|
|
115
|
-
if (e.readOnlySnapshot && t === void 0) return /* @__PURE__ */ O("div", {
|
|
116
|
-
className: "space-y-1 text-xs",
|
|
117
|
-
children: [/* @__PURE__ */ D("label", {
|
|
118
|
-
className: "block font-medium",
|
|
119
|
-
children: o
|
|
120
|
-
}), /* @__PURE__ */ D("span", {
|
|
121
|
-
"data-testid": `interaction-field-${i || "value"}`,
|
|
122
|
-
children: "未提供"
|
|
123
|
-
})]
|
|
124
|
-
});
|
|
125
|
-
let u = l.anyOf ?? l.oneOf, f = l, p = Array.isArray(l.type) && l.type.includes("null");
|
|
126
|
-
if (Array.isArray(u) && u.length === 2) {
|
|
127
|
-
let e = u.filter((e) => F(e) && e.type !== "null");
|
|
128
|
-
e.length === 1 && u.some((e) => F(e) && e.type === "null") && (f = {
|
|
129
|
-
...l,
|
|
130
|
-
anyOf: void 0,
|
|
131
|
-
oneOf: void 0,
|
|
132
|
-
...e[0]
|
|
133
|
-
}, p = !0);
|
|
134
|
-
}
|
|
135
|
-
let h = Array.isArray(f.type) ? f.type.filter((e) => e !== "null")[0] : f.type, g = (e) => {
|
|
136
|
-
s(i, !1), n(e);
|
|
137
|
-
}, _ = `interaction-field-${i || "value"}`, v = m({ properties: { value: f } })[0], y = v.enumValues, b = f.$ref || f.allOf || f.anyOf || f.oneOf || c > 8 || Array.isArray(f.type) && f.type.filter((e) => e !== "null").length > 1, x;
|
|
138
|
-
if (t === null && p) x = /* @__PURE__ */ O("span", {
|
|
139
|
-
"data-testid": _,
|
|
140
|
-
children: ["null ", /* @__PURE__ */ D("button", {
|
|
141
|
-
type: "button",
|
|
142
|
-
disabled: a,
|
|
143
|
-
onClick: () => g(void 0),
|
|
144
|
-
children: "填写值"
|
|
145
|
-
})]
|
|
146
|
-
});
|
|
147
|
-
else if (b) x = /* @__PURE__ */ D(L, { ...e });
|
|
148
|
-
else if (Object.hasOwn(f, "const")) x = /* @__PURE__ */ D("output", {
|
|
149
|
-
"data-testid": _,
|
|
150
|
-
children: I(d(f.const))
|
|
151
|
-
});
|
|
152
|
-
else if (y) x = /* @__PURE__ */ D(oe, {
|
|
153
|
-
...e,
|
|
154
|
-
choices: y,
|
|
155
|
-
multiple: h === "array" && !Array.isArray(f.enum),
|
|
156
|
-
allowOther: v.allowOther === !0,
|
|
157
|
-
onChange: g
|
|
158
|
-
});
|
|
159
|
-
else if (h === "object" || F(f.properties)) {
|
|
160
|
-
let r = F(f.properties) ? f.properties : {}, o = Array.isArray(f.required) ? f.required : [], l = Object.values(r).some((e) => typeof e == "boolean");
|
|
161
|
-
x = Object.keys(r).length && !l ? /* @__PURE__ */ D("fieldset", {
|
|
162
|
-
disabled: a,
|
|
163
|
-
className: "space-y-2 pl-2",
|
|
164
|
-
children: Object.entries(r).map(([r, l]) => F(l) ? /* @__PURE__ */ D(R, {
|
|
165
|
-
schema: l,
|
|
166
|
-
value: F(t) ? t[r] : void 0,
|
|
167
|
-
path: i ? `${i}/${r.replaceAll("~", "~0").replaceAll("/", "~1")}` : r.replaceAll("~", "~0").replaceAll("/", "~1"),
|
|
168
|
-
label: `${typeof l.title == "string" ? l.title : r}${o.includes(r) ? " *" : ""}`,
|
|
169
|
-
disabled: a,
|
|
170
|
-
depth: c + 1,
|
|
171
|
-
onInvalid: s,
|
|
172
|
-
readOnlySnapshot: e.readOnlySnapshot,
|
|
173
|
-
rootSchema: e.rootSchema,
|
|
174
|
-
onChange: (e) => {
|
|
175
|
-
let i = Object.entries(F(t) ? t : {}).filter(([e]) => e !== r);
|
|
176
|
-
e !== void 0 && i.push([r, e]), n(Object.fromEntries(i));
|
|
177
|
-
}
|
|
178
|
-
}, r) : null)
|
|
179
|
-
}) : /* @__PURE__ */ D(L, { ...e });
|
|
180
|
-
} else x = h === "boolean" ? /* @__PURE__ */ O("select", {
|
|
181
|
-
"aria-label": o,
|
|
182
|
-
"data-testid": _,
|
|
183
|
-
className: P,
|
|
184
|
-
disabled: a,
|
|
185
|
-
value: t === void 0 ? "" : String(t),
|
|
186
|
-
onChange: (e) => g(e.target.value === "" ? void 0 : e.target.value === "true"),
|
|
187
|
-
children: [
|
|
188
|
-
/* @__PURE__ */ D("option", {
|
|
189
|
-
value: "",
|
|
190
|
-
children: "请选择"
|
|
191
|
-
}),
|
|
192
|
-
/* @__PURE__ */ D("option", {
|
|
193
|
-
value: "true",
|
|
194
|
-
children: "是"
|
|
195
|
-
}),
|
|
196
|
-
/* @__PURE__ */ D("option", {
|
|
197
|
-
value: "false",
|
|
198
|
-
children: "否"
|
|
199
|
-
})
|
|
200
|
-
]
|
|
201
|
-
}) : h === "number" || h === "integer" ? /* @__PURE__ */ D("input", {
|
|
202
|
-
"aria-label": o,
|
|
203
|
-
"data-testid": _,
|
|
204
|
-
className: P,
|
|
205
|
-
type: "number",
|
|
206
|
-
disabled: a,
|
|
207
|
-
step: h === "integer" ? 1 : "any",
|
|
208
|
-
value: typeof t == "number" ? t : "",
|
|
209
|
-
onChange: (e) => g(e.target.value === "" ? void 0 : e.target.valueAsNumber)
|
|
210
|
-
}) : h === "string" ? /* @__PURE__ */ D("input", {
|
|
211
|
-
"aria-label": o,
|
|
212
|
-
"data-testid": _,
|
|
213
|
-
className: P,
|
|
214
|
-
type: r(f, e.rootSchema) ? "password" : "text",
|
|
215
|
-
disabled: a,
|
|
216
|
-
value: typeof t == "string" ? t : "",
|
|
217
|
-
onChange: (e) => g(e.target.value)
|
|
218
|
-
}) : /* @__PURE__ */ D(L, { ...e });
|
|
219
|
-
return /* @__PURE__ */ O("div", {
|
|
220
|
-
className: "space-y-1 text-xs",
|
|
221
|
-
children: [
|
|
222
|
-
/* @__PURE__ */ D("label", {
|
|
223
|
-
className: "block font-medium",
|
|
224
|
-
children: o
|
|
225
|
-
}),
|
|
226
|
-
typeof l.description == "string" ? /* @__PURE__ */ D("p", { children: l.description }) : null,
|
|
227
|
-
x,
|
|
228
|
-
p && t !== null ? /* @__PURE__ */ D("button", {
|
|
229
|
-
type: "button",
|
|
230
|
-
disabled: a,
|
|
231
|
-
onClick: () => g(null),
|
|
232
|
-
children: "设为 null"
|
|
233
|
-
}) : null
|
|
234
|
-
]
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
function ce({ schema: t, value: n }) {
|
|
238
|
-
return /* @__PURE__ */ D("fieldset", {
|
|
239
|
-
disabled: !0,
|
|
240
|
-
inert: !0,
|
|
241
|
-
className: "mt-2 space-y-2",
|
|
242
|
-
"data-testid": "interaction-input-snapshot",
|
|
243
|
-
children: /* @__PURE__ */ D(R, {
|
|
244
|
-
schema: t,
|
|
245
|
-
rootSchema: t,
|
|
246
|
-
value: e(t, n),
|
|
247
|
-
path: "",
|
|
248
|
-
label: typeof t.title == "string" ? t.title : "已提交内容",
|
|
249
|
-
disabled: !0,
|
|
250
|
-
readOnlySnapshot: !0,
|
|
251
|
-
depth: 0,
|
|
252
|
-
onChange: () => {},
|
|
253
|
-
onInvalid: () => {}
|
|
254
|
-
})
|
|
255
|
-
});
|
|
256
|
-
}
|
|
257
|
-
function le({ schema: e, disabled: n, onSubmit: r, onCancel: i }) {
|
|
258
|
-
let [a, o] = C(() => se(e)), [s, c] = C({}), [l, u] = C(""), f = p(), m = y((e, t) => c((n) => t ? {
|
|
259
|
-
...n,
|
|
260
|
-
[e]: !0
|
|
261
|
-
} : Object.fromEntries(Object.entries(n).filter(([t]) => e && t !== e && !t.startsWith(`${e}/`)))), []);
|
|
262
|
-
return /* @__PURE__ */ O("form", {
|
|
263
|
-
className: "mt-3 space-y-2",
|
|
264
|
-
"data-testid": "interaction-schema-form",
|
|
265
|
-
onKeyDown: (e) => {
|
|
266
|
-
e.key === "Enter" && f(e) && e.preventDefault();
|
|
267
|
-
},
|
|
268
|
-
onSubmit: (i) => {
|
|
269
|
-
if (i.preventDefault(), n) return;
|
|
270
|
-
if (Object.values(s).some(Boolean)) {
|
|
271
|
-
u("请先修正 JSON 草稿。");
|
|
272
|
-
return;
|
|
273
|
-
}
|
|
274
|
-
let o = t(e, a);
|
|
275
|
-
if (!o.valid) {
|
|
276
|
-
u(o.issues.join(";"));
|
|
277
|
-
return;
|
|
278
|
-
}
|
|
279
|
-
u(""), r(d(a));
|
|
280
|
-
},
|
|
281
|
-
children: [
|
|
282
|
-
/* @__PURE__ */ D(R, {
|
|
283
|
-
schema: e,
|
|
284
|
-
rootSchema: e,
|
|
285
|
-
value: a,
|
|
286
|
-
path: "",
|
|
287
|
-
label: typeof e.title == "string" ? e.title : "请填写信息",
|
|
288
|
-
disabled: n,
|
|
289
|
-
depth: 0,
|
|
290
|
-
onChange: o,
|
|
291
|
-
onInvalid: m
|
|
292
|
-
}),
|
|
293
|
-
l ? /* @__PURE__ */ D("p", {
|
|
294
|
-
role: "alert",
|
|
295
|
-
className: "text-xs text-rose-600",
|
|
296
|
-
children: l
|
|
297
|
-
}) : null,
|
|
298
|
-
/* @__PURE__ */ O("div", {
|
|
299
|
-
className: "flex gap-2",
|
|
300
|
-
children: [/* @__PURE__ */ D("button", {
|
|
301
|
-
className: "rounded-md bg-[var(--ksadk-interaction-primary-background)] px-3 py-1.5 text-xs text-[var(--ksadk-interaction-primary-foreground)] disabled:opacity-50",
|
|
302
|
-
type: "submit",
|
|
303
|
-
disabled: n,
|
|
304
|
-
"data-testid": "interaction-submit",
|
|
305
|
-
children: "提交"
|
|
306
|
-
}), /* @__PURE__ */ D("button", {
|
|
307
|
-
type: "button",
|
|
308
|
-
disabled: n,
|
|
309
|
-
"data-testid": "interaction-form-cancel",
|
|
310
|
-
onClick: i,
|
|
311
|
-
children: "取消"
|
|
312
|
-
})]
|
|
313
|
-
})
|
|
314
|
-
]
|
|
315
|
-
});
|
|
316
|
-
}
|
|
317
|
-
//#endregion
|
|
318
|
-
//#region src/core/a2ui/snapshot.ts
|
|
319
|
-
function z(e, t, n) {
|
|
320
|
-
let r;
|
|
321
|
-
try {
|
|
322
|
-
r = n.validateMessages(t.filter((t) => Object.values(t).some((t) => t && typeof t == "object" && t.surfaceId === e)));
|
|
323
|
-
let i = r.getSurface(e);
|
|
324
|
-
return i ? ae({
|
|
325
|
-
catalogId: i.defaultCatalog.id,
|
|
326
|
-
rootId: i.rootId,
|
|
327
|
-
theme: i.theme,
|
|
328
|
-
metadata: i.metadata,
|
|
329
|
-
components: [...i.componentsModel.getAll().entries()].sort(([e], [t]) => e.localeCompare(t)).map(([, e]) => e.componentTree),
|
|
330
|
-
data: i.dataModel.get("/")
|
|
331
|
-
}) : void 0;
|
|
332
|
-
} catch {
|
|
333
|
-
return;
|
|
334
|
-
} finally {
|
|
335
|
-
r?.dispose();
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
//#endregion
|
|
339
|
-
//#region src/core/a2ui/surfaces.ts
|
|
340
|
-
var ue = class {
|
|
341
|
-
processor;
|
|
342
|
-
processed = [];
|
|
343
|
-
active = /* @__PURE__ */ new Map();
|
|
344
|
-
disposed = !1;
|
|
345
|
-
action;
|
|
346
|
-
registry;
|
|
347
|
-
renderers;
|
|
348
|
-
enabled = !0;
|
|
349
|
-
constructor(e, t = l, n = []) {
|
|
350
|
-
this.action = e, this.registry = t, this.renderers = n, this.processor = this.makeProcessor();
|
|
351
|
-
}
|
|
352
|
-
makeProcessor() {
|
|
353
|
-
return new A([
|
|
354
|
-
j,
|
|
355
|
-
new k(u.catalogId, "0.9", [...k.fromSchema(u, "0.9").components.values()], []),
|
|
356
|
-
...this.renderers.filter((e) => ![j.id, u.catalogId].includes(e.id))
|
|
357
|
-
], void 0, {
|
|
358
|
-
version: "v0.9.1",
|
|
359
|
-
validationConfig: {
|
|
360
|
-
allowOrphanComponents: !0,
|
|
361
|
-
allowDanglingReferences: !0,
|
|
362
|
-
allowMissingRoot: !0,
|
|
363
|
-
allowUnknownElements: !1
|
|
364
|
-
}
|
|
365
|
-
});
|
|
366
|
-
}
|
|
367
|
-
apply(e) {
|
|
368
|
-
if (this.disposed) throw Error("A2UI surface is closed");
|
|
369
|
-
if (e.length > 4096 || JSON.stringify(e).length > 1048576) throw Error("A2UI 消息超过展示预算。");
|
|
370
|
-
let t = e.map((e) => JSON.stringify(e));
|
|
371
|
-
if (!(t.length === this.processed.length && t.every((e, t) => this.processed[t] === e))) {
|
|
372
|
-
this.registry.validateMessages(e).dispose(), this.processed.every((e, n) => t[n] === e) || (this.active.clear(), this.processor.dispose(), this.processor = this.makeProcessor(), this.processed = []);
|
|
373
|
-
for (let n = this.processed.length; n < e.length; n += 1) {
|
|
374
|
-
let r = e[n];
|
|
375
|
-
if (!["v0.9", "v0.9.1"].includes(String(r.version))) throw Error("当前页面不支持此 A2UI 协议版本。");
|
|
376
|
-
let i = [
|
|
377
|
-
"createSurface",
|
|
378
|
-
"updateComponents",
|
|
379
|
-
"updateDataModel",
|
|
380
|
-
"deleteSurface"
|
|
381
|
-
].filter((e) => e in r);
|
|
382
|
-
if (i.length !== 1) throw Error("A2UI 消息操作无效。");
|
|
383
|
-
let a = i[0], o = r[a];
|
|
384
|
-
if (!o || typeof o.surfaceId != "string") throw Error("A2UI surface 身份无效。");
|
|
385
|
-
if (a === "createSurface" && !this.registry.get(String(o.catalogId))) throw Error("当前卡片使用了页面未注册的组件目录。");
|
|
386
|
-
let s = this.processor.getSurface(o.surfaceId);
|
|
387
|
-
if (a === "createSurface" && s) throw Error("重建卡片前必须先删除原 surface。");
|
|
388
|
-
if (a !== "createSurface" && !s) throw Error("卡片缺少已接受的 createSurface。");
|
|
389
|
-
if (a === "updateComponents" && this.registry.validateComponents(s.defaultCatalog.id, o.components), this.processor.processMessages(structuredClone(r)), this.processed.push(t[n]), a === "deleteSurface" && this.active.delete(o.surfaceId), a === "createSurface") {
|
|
390
|
-
let e = this.processor.getSurface(o.surfaceId);
|
|
391
|
-
this.active.set(e.id, e), e.onAction.subscribe((t) => {
|
|
392
|
-
!this.disposed && this.enabled && this.active.get(e.id) === e && this.action({ userAction: t });
|
|
393
|
-
});
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
get(e) {
|
|
399
|
-
return this.processor.getSurface(e);
|
|
400
|
-
}
|
|
401
|
-
dispose() {
|
|
402
|
-
this.disposed || (this.disposed = !0, this.active.clear(), this.processor.dispose());
|
|
403
|
-
}
|
|
404
|
-
}, B = (e) => typeof e == "object" && e && !Array.isArray(e) ? e : void 0, V = (e, t) => typeof e == "object" && !!e && Object.hasOwn(e, t), de = (e, t) => {
|
|
405
|
-
let n = e;
|
|
406
|
-
for (let e of t) {
|
|
407
|
-
if (!V(n, e)) return { found: !1 };
|
|
408
|
-
n = n[e];
|
|
409
|
-
}
|
|
410
|
-
return {
|
|
411
|
-
found: !0,
|
|
412
|
-
value: n
|
|
413
|
-
};
|
|
414
|
-
}, H = (e) => Array.isArray(e) ? e.map(H) : typeof e == "object" && e ? Object.fromEntries(Object.entries(e).map(([e, t]) => [e, H(t)])) : "input-value";
|
|
415
|
-
function fe(t, n) {
|
|
416
|
-
let r = e(t, n), i = e(t, H(r)), a = (e) => {
|
|
417
|
-
let t = i;
|
|
418
|
-
for (let n of e) {
|
|
419
|
-
if (t === null) return !0;
|
|
420
|
-
if (!V(t, n)) return !1;
|
|
421
|
-
t = t[n];
|
|
422
|
-
}
|
|
423
|
-
return t === null;
|
|
424
|
-
}, o = (e, t) => a(t) ? "已隐藏" : Array.isArray(e) ? e.map((e, n) => o(e, [...t, String(n)])) : typeof e == "object" && e ? Object.fromEntries(Object.entries(e).map(([e, n]) => [e, o(n, [...t, e])])) : e;
|
|
425
|
-
return {
|
|
426
|
-
value: r,
|
|
427
|
-
summary: o(r, []),
|
|
428
|
-
at: (e) => ({
|
|
429
|
-
...de(r, e),
|
|
430
|
-
hidden: a(e)
|
|
431
|
-
})
|
|
432
|
-
};
|
|
433
|
-
}
|
|
434
|
-
var U = (e) => {
|
|
435
|
-
let t = B(e)?.path;
|
|
436
|
-
if (typeof t != "string" || t !== "" && !t.startsWith("/") || /~(?![01])/u.test(t)) return;
|
|
437
|
-
let n = t === "" || t === "/" ? [] : t.slice(1).split("/").map((e) => e.replace(/~1/g, "/").replace(/~0/g, "~"));
|
|
438
|
-
return n.some((e) => [
|
|
439
|
-
"__proto__",
|
|
440
|
-
"constructor",
|
|
441
|
-
"prototype"
|
|
442
|
-
].includes(e)) ? void 0 : n;
|
|
443
|
-
}, pe = (e, t) => e.length <= t.length && e.every((e, n) => t[n] === e), W = (e) => e.length ? `/${e.map((e) => e.replace(/~/g, "~0").replace(/\//g, "~1")).join("/")}` : "/", me = new Set([
|
|
444
|
-
"TextField",
|
|
445
|
-
"CheckBox",
|
|
446
|
-
"ChoicePicker",
|
|
447
|
-
"Slider",
|
|
448
|
-
"DateTimeInput"
|
|
449
|
-
]), he = new Set([
|
|
450
|
-
"Select",
|
|
451
|
-
"RadioGroup",
|
|
452
|
-
"CheckboxGroup"
|
|
453
|
-
]);
|
|
454
|
-
function ge(e, t) {
|
|
455
|
-
let n = /* @__PURE__ */ new Map();
|
|
456
|
-
for (let r of t) {
|
|
457
|
-
B(r.deleteSurface)?.surfaceId === e && n.clear();
|
|
458
|
-
let t = B(r.updateComponents);
|
|
459
|
-
if (!(t?.surfaceId !== e || !Array.isArray(t.components))) for (let e of t.components) {
|
|
460
|
-
let t = B(e);
|
|
461
|
-
t && typeof t.id == "string" && n.set(t.id, t);
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
return [...n.values()];
|
|
465
|
-
}
|
|
466
|
-
function G(e) {
|
|
467
|
-
return B(e.value) ? e.at(["value"]) : e.at([]);
|
|
468
|
-
}
|
|
469
|
-
function _e(e, t, n, r, i = []) {
|
|
470
|
-
let a = fe(n, r), o = ge(e, t), s = o.filter((e) => e.component === "Form"), c = o.filter((e) => he.has(String(e.component)));
|
|
471
|
-
if (s.length || c.length) {
|
|
472
|
-
let e = Array.isArray(s[0]?.fields) ? s[0].fields.map((e) => B(e)?.name) : [], n = B(a.value);
|
|
473
|
-
return {
|
|
474
|
-
messages: t,
|
|
475
|
-
answer: a,
|
|
476
|
-
mapped: s.length === 1 && c.length === 0 && !!n && Object.keys(n).every((t) => e.includes(t)) || s.length === 0 && c.length === 1 && G(a).found && (!n || Object.keys(n).every((e) => e === "value")),
|
|
477
|
-
legacy: !0
|
|
478
|
-
};
|
|
479
|
-
}
|
|
480
|
-
let l = /* @__PURE__ */ new Map(), u = 0, d = !1, f = (e, t, n, r = 0) => {
|
|
481
|
-
if (++u > 8192 || r > 48) {
|
|
482
|
-
d = !0;
|
|
483
|
-
return;
|
|
484
|
-
}
|
|
485
|
-
let i = U(e);
|
|
486
|
-
if (i) {
|
|
487
|
-
n.push({
|
|
488
|
-
model: i,
|
|
489
|
-
response: t
|
|
490
|
-
});
|
|
491
|
-
return;
|
|
492
|
-
}
|
|
493
|
-
let a = B(e);
|
|
494
|
-
if (!(!a || "path" in a || "call" in a)) {
|
|
495
|
-
for (let [e, i] of Object.entries(a)) if (f(i, [...t, e], n, r + 1), d) break;
|
|
496
|
-
}
|
|
497
|
-
};
|
|
498
|
-
for (let e of o) {
|
|
499
|
-
if (e.component !== "Button") continue;
|
|
500
|
-
let t = B(B(e.action)?.event), n = B(t?.context);
|
|
501
|
-
if (!n || t?.name === "cancel") continue;
|
|
502
|
-
let r = [];
|
|
503
|
-
f(Object.hasOwn(n, "payload") ? n.payload : n, [], r);
|
|
504
|
-
let i = r.map((e) => JSON.stringify([e.model, e.response])).sort().join("|");
|
|
505
|
-
l.set(i, r);
|
|
506
|
-
}
|
|
507
|
-
if (d || l.size !== 1) return {
|
|
508
|
-
messages: t,
|
|
509
|
-
answer: a,
|
|
510
|
-
mapped: !1,
|
|
511
|
-
legacy: !1
|
|
512
|
-
};
|
|
513
|
-
let p = [...l.values()][0];
|
|
514
|
-
for (let e of p) if (p.some((t) => W(t.model) === W(e.model) && W(t.response) !== W(e.response))) return {
|
|
515
|
-
messages: t,
|
|
516
|
-
answer: a,
|
|
517
|
-
mapped: !1,
|
|
518
|
-
legacy: !1
|
|
519
|
-
};
|
|
520
|
-
let m = [], h = o.filter((e) => me.has(String(e.component)) || i.includes(String(e.component)));
|
|
521
|
-
if (!h.length) return {
|
|
522
|
-
messages: t,
|
|
523
|
-
answer: a,
|
|
524
|
-
mapped: !1,
|
|
525
|
-
legacy: !1
|
|
526
|
-
};
|
|
527
|
-
for (let e of h) {
|
|
528
|
-
let n = U(e.value), r = (n ? p.filter((e) => pe(e.model, n)) : []).sort((e, t) => t.model.length - e.model.length)[0];
|
|
529
|
-
if (!n || !r) return {
|
|
530
|
-
messages: t,
|
|
531
|
-
answer: a,
|
|
532
|
-
mapped: !1,
|
|
533
|
-
legacy: !1
|
|
534
|
-
};
|
|
535
|
-
let i = a.at([...r.response, ...n.slice(r.model.length)]);
|
|
536
|
-
(i.hidden || !i.found || i.value === null) && m.push({
|
|
537
|
-
id: e.id,
|
|
538
|
-
component: "Text",
|
|
539
|
-
text: `${typeof e.label == "string" ? `${e.label}:` : ""}${i.hidden ? "已隐藏" : i.found ? "null" : "未提交"}`
|
|
540
|
-
});
|
|
541
|
-
}
|
|
542
|
-
let g = [];
|
|
543
|
-
for (let t of p) {
|
|
544
|
-
let n = a.at(t.response);
|
|
545
|
-
n.found && g.push({
|
|
546
|
-
version: "v0.9.1",
|
|
547
|
-
updateDataModel: {
|
|
548
|
-
surfaceId: e,
|
|
549
|
-
path: W(t.model),
|
|
550
|
-
value: n.value
|
|
551
|
-
}
|
|
552
|
-
});
|
|
553
|
-
}
|
|
554
|
-
return m.length && g.push({
|
|
555
|
-
version: "v0.9.1",
|
|
556
|
-
updateComponents: {
|
|
557
|
-
surfaceId: e,
|
|
558
|
-
components: m
|
|
559
|
-
}
|
|
560
|
-
}), {
|
|
561
|
-
messages: structuredClone([...t, ...g]),
|
|
562
|
-
answer: a,
|
|
563
|
-
mapped: !0,
|
|
564
|
-
legacy: !1
|
|
565
|
-
};
|
|
566
|
-
}
|
|
567
|
-
var K = (e) => e && typeof e == "object" && !Array.isArray(e) ? e : {}, q = (e) => e == null ? "" : typeof e == "string" ? e : JSON.stringify(e), ve = (e, t) => JSON.stringify(e) === JSON.stringify(t), J = "rounded border border-slate-300 px-3 py-2 dark:border-slate-600 dark:bg-slate-800", ye = "rounded bg-blue-600 px-4 py-2 text-white disabled:opacity-50";
|
|
568
|
-
function be({ surfaceId: e, messages: t, onAction: n, disabled: r, historyAnswer: i }) {
|
|
569
|
-
let a = /* @__PURE__ */ new Map(), o = {}, s = 0;
|
|
570
|
-
for (let [n, r] of t.entries()) {
|
|
571
|
-
K(r.createSurface).surfaceId === e && (s = n), K(r.deleteSurface).surfaceId === e && (a.clear(), o = {});
|
|
572
|
-
let t = K(r.updateComponents);
|
|
573
|
-
if (t.surfaceId === e && Array.isArray(t.components)) for (let e of t.components) {
|
|
574
|
-
let t = K(e);
|
|
575
|
-
a.set(String(t.id), t);
|
|
576
|
-
}
|
|
577
|
-
let i = K(r.updateDataModel);
|
|
578
|
-
if (i.surfaceId === e) if (!i.path || i.path === "/") o = structuredClone(K(i.value));
|
|
579
|
-
else {
|
|
580
|
-
let e = String(i.path).split("/").slice(1).map((e) => e.replace(/~1/g, "/").replace(/~0/g, "~"));
|
|
581
|
-
if (e.some((e) => [
|
|
582
|
-
"__proto__",
|
|
583
|
-
"constructor",
|
|
584
|
-
"prototype"
|
|
585
|
-
].includes(e))) continue;
|
|
586
|
-
let t = o;
|
|
587
|
-
for (let n of e.slice(0, -1)) t[n] = { ...K(t[n]) }, t = K(t[n]);
|
|
588
|
-
let n = e.at(-1);
|
|
589
|
-
n && ![
|
|
590
|
-
"__proto__",
|
|
591
|
-
"constructor",
|
|
592
|
-
"prototype"
|
|
593
|
-
].includes(n) && (t[n] = i.value);
|
|
594
|
-
}
|
|
595
|
-
}
|
|
596
|
-
let c = new Set([...a.values()].flatMap((e) => Array.isArray(e.children) ? e.children.map(String) : [])), l = async (t, a, o) => {
|
|
597
|
-
r || i || await n({ userAction: {
|
|
598
|
-
surfaceId: e,
|
|
599
|
-
sourceComponentId: t,
|
|
600
|
-
name: a,
|
|
601
|
-
context: o,
|
|
602
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
603
|
-
} });
|
|
604
|
-
}, u = (t, n) => {
|
|
605
|
-
let c = a.get(t);
|
|
606
|
-
if (!c || n.has(t) || n.size > 64) return /* @__PURE__ */ D("div", {
|
|
607
|
-
role: "alert",
|
|
608
|
-
children: "卡片组件引用无效。"
|
|
609
|
-
}, t);
|
|
610
|
-
let d = new Set(n).add(t), f = Array.isArray(c.children) ? c.children.map((e) => u(String(e), d)) : [];
|
|
611
|
-
switch (c.component) {
|
|
612
|
-
case "Text": return /* @__PURE__ */ D("p", {
|
|
613
|
-
className: c.variant === "title" ? "text-lg font-semibold" : c.variant === "error" ? "text-red-600" : "",
|
|
614
|
-
children: q(c.text)
|
|
615
|
-
}, t);
|
|
616
|
-
case "Card": return /* @__PURE__ */ O("section", {
|
|
617
|
-
className: "space-y-3 rounded border p-4",
|
|
618
|
-
children: [
|
|
619
|
-
/* @__PURE__ */ D("h3", {
|
|
620
|
-
className: "font-semibold",
|
|
621
|
-
children: q(c.title)
|
|
622
|
-
}),
|
|
623
|
-
/* @__PURE__ */ D("div", {
|
|
624
|
-
className: "whitespace-pre-wrap",
|
|
625
|
-
children: q(c.body)
|
|
626
|
-
}),
|
|
627
|
-
f,
|
|
628
|
-
/* @__PURE__ */ D("p", {
|
|
629
|
-
className: "text-sm text-slate-500",
|
|
630
|
-
children: q(c.footer)
|
|
631
|
-
})
|
|
632
|
-
]
|
|
633
|
-
}, t);
|
|
634
|
-
case "Form": return /* @__PURE__ */ D(xe, {
|
|
635
|
-
component: c,
|
|
636
|
-
model: o,
|
|
637
|
-
disabled: r,
|
|
638
|
-
historyAnswer: i,
|
|
639
|
-
submit: (e) => l(t, "submit", { payload: e }),
|
|
640
|
-
children: f
|
|
641
|
-
}, JSON.stringify([
|
|
642
|
-
e,
|
|
643
|
-
s,
|
|
644
|
-
t
|
|
645
|
-
]));
|
|
646
|
-
case "ApprovalBar": return /* @__PURE__ */ O("section", {
|
|
647
|
-
className: "space-y-3",
|
|
648
|
-
children: [/* @__PURE__ */ D("p", { children: q(c.summary) }), /* @__PURE__ */ O("div", {
|
|
649
|
-
className: "flex gap-3",
|
|
650
|
-
children: [/* @__PURE__ */ D("button", {
|
|
651
|
-
className: ye,
|
|
652
|
-
type: "button",
|
|
653
|
-
disabled: r,
|
|
654
|
-
onClick: () => void l(t, "approve", {
|
|
655
|
-
confirmed: !0,
|
|
656
|
-
approved: !0
|
|
657
|
-
}),
|
|
658
|
-
children: q(c.approve_label) || "批准"
|
|
659
|
-
}), /* @__PURE__ */ D("button", {
|
|
660
|
-
className: J,
|
|
661
|
-
type: "button",
|
|
662
|
-
disabled: r,
|
|
663
|
-
onClick: () => void l(t, "deny", {
|
|
664
|
-
confirmed: !1,
|
|
665
|
-
approved: !1
|
|
666
|
-
}),
|
|
667
|
-
children: q(c.deny_label) || "拒绝"
|
|
668
|
-
})]
|
|
669
|
-
})]
|
|
670
|
-
}, t);
|
|
671
|
-
case "Select":
|
|
672
|
-
case "RadioGroup":
|
|
673
|
-
case "CheckboxGroup": return /* @__PURE__ */ D(Se, {
|
|
674
|
-
component: c,
|
|
675
|
-
disabled: r,
|
|
676
|
-
historyAnswer: i,
|
|
677
|
-
submit: (e) => l(t, "change", { value: e })
|
|
678
|
-
}, JSON.stringify([
|
|
679
|
-
e,
|
|
680
|
-
s,
|
|
681
|
-
t
|
|
682
|
-
]));
|
|
683
|
-
default: return /* @__PURE__ */ O("div", {
|
|
684
|
-
role: "alert",
|
|
685
|
-
children: ["当前组件目录不支持组件:", q(c.component)]
|
|
686
|
-
}, t);
|
|
687
|
-
}
|
|
688
|
-
}, d = [...a.keys()].filter((e) => !c.has(e));
|
|
689
|
-
return a.size && !d.length ? /* @__PURE__ */ D("div", {
|
|
690
|
-
role: "alert",
|
|
691
|
-
children: "卡片组件存在循环引用。"
|
|
692
|
-
}) : /* @__PURE__ */ D("div", {
|
|
693
|
-
className: "space-y-4",
|
|
694
|
-
"data-testid": "legacy-a2ui-surface",
|
|
695
|
-
children: d.map((e) => u(e, /* @__PURE__ */ new Set()))
|
|
696
|
-
});
|
|
697
|
-
}
|
|
698
|
-
function xe({ component: e, model: t, disabled: n, submit: r, children: i, historyAnswer: a }) {
|
|
699
|
-
let o = Array.isArray(e.fields) ? e.fields : [], s = o.filter((e) => !!(e && typeof e == "object" && typeof e.name == "string")), c = Object.fromEntries(s.map((e) => [e.name, e.value ?? t[e.name] ?? (["bool", "boolean"].includes(e.type ?? "") ? !1 : "")])), l = JSON.stringify(c), [u, d] = C(() => ({
|
|
700
|
-
remoteKey: l,
|
|
701
|
-
remoteValues: c,
|
|
702
|
-
values: c
|
|
703
|
-
})), f = u.values;
|
|
704
|
-
u.remoteKey !== l && (f = Object.fromEntries(Object.entries(c).map(([e, t]) => [e, Object.hasOwn(u.remoteValues, e) && ve(u.remoteValues[e], t) ? u.values[e] : t])), d({
|
|
705
|
-
remoteKey: l,
|
|
706
|
-
remoteValues: c,
|
|
707
|
-
values: f
|
|
708
|
-
}));
|
|
709
|
-
let p = (e, t) => d((n) => ({
|
|
710
|
-
...n,
|
|
711
|
-
values: {
|
|
712
|
-
...n.values,
|
|
713
|
-
[e]: t
|
|
714
|
-
}
|
|
715
|
-
}));
|
|
716
|
-
return s.length === o.length ? /* @__PURE__ */ O("form", {
|
|
717
|
-
className: "space-y-4",
|
|
718
|
-
onSubmit: (e) => {
|
|
719
|
-
if (e.preventDefault(), !e.currentTarget.reportValidity() || n) return;
|
|
720
|
-
let t = { ...f };
|
|
721
|
-
for (let e of s) [
|
|
722
|
-
"int",
|
|
723
|
-
"integer",
|
|
724
|
-
"number",
|
|
725
|
-
"float"
|
|
726
|
-
].includes(e.type ?? "") && t[e.name] !== "" && (t[e.name] = Number(t[e.name])), t[e.name] === "" && !e.required && delete t[e.name];
|
|
727
|
-
r(t);
|
|
728
|
-
},
|
|
729
|
-
children: [/* @__PURE__ */ D("h3", {
|
|
730
|
-
className: "font-semibold",
|
|
731
|
-
children: q(e.title)
|
|
732
|
-
}), /* @__PURE__ */ O("fieldset", {
|
|
733
|
-
disabled: n,
|
|
734
|
-
className: "space-y-3",
|
|
735
|
-
children: [
|
|
736
|
-
s.map((e) => {
|
|
737
|
-
let t = ["bool", "boolean"].includes(e.type ?? ""), n = [
|
|
738
|
-
"int",
|
|
739
|
-
"integer",
|
|
740
|
-
"number",
|
|
741
|
-
"float"
|
|
742
|
-
].includes(e.type ?? ""), r = a?.at([e.name]), i = r ? r.value : f[e.name];
|
|
743
|
-
return /* @__PURE__ */ O("label", {
|
|
744
|
-
className: "flex flex-col gap-1",
|
|
745
|
-
children: [/* @__PURE__ */ O("span", { children: [e.label || e.name, e.required ? " *" : ""] }), r && (r.hidden || !r.found || i === null) ? /* @__PURE__ */ D("span", { children: r.hidden ? "已隐藏" : r.found ? "null" : "未提交" }) : /* @__PURE__ */ D("input", {
|
|
746
|
-
className: J,
|
|
747
|
-
name: e.name,
|
|
748
|
-
"aria-label": e.label || e.name,
|
|
749
|
-
type: t ? "checkbox" : n ? "number" : "text",
|
|
750
|
-
required: e.required && !t,
|
|
751
|
-
placeholder: e.placeholder,
|
|
752
|
-
step: ["int", "integer"].includes(e.type ?? "") ? "1" : n ? "any" : void 0,
|
|
753
|
-
...t ? { checked: !!i } : { value: q(i) },
|
|
754
|
-
onChange: (n) => p(e.name, t ? n.target.checked : n.target.value)
|
|
755
|
-
})]
|
|
756
|
-
}, e.name);
|
|
757
|
-
}),
|
|
758
|
-
i,
|
|
759
|
-
/* @__PURE__ */ D("button", {
|
|
760
|
-
type: "submit",
|
|
761
|
-
className: ye,
|
|
762
|
-
disabled: n,
|
|
763
|
-
children: q(e.submit_label) || "提交"
|
|
764
|
-
})
|
|
765
|
-
]
|
|
766
|
-
})]
|
|
767
|
-
}) : /* @__PURE__ */ D("div", {
|
|
768
|
-
role: "alert",
|
|
769
|
-
children: "表单字段格式无效。"
|
|
770
|
-
});
|
|
771
|
-
}
|
|
772
|
-
function Se({ component: e, disabled: t, submit: n, historyAnswer: r }) {
|
|
773
|
-
let i = e.component === "CheckboxGroup", a = (Array.isArray(e.options) ? e.options : []).map((e) => {
|
|
774
|
-
let t = K(e);
|
|
775
|
-
return {
|
|
776
|
-
value: t.value ?? e,
|
|
777
|
-
label: q(t.label ?? t.value ?? e)
|
|
778
|
-
};
|
|
779
|
-
}), o = e.value ?? (i ? [] : ""), s = JSON.stringify([i, o]), [c, l] = C(() => ({
|
|
780
|
-
remoteKey: s,
|
|
781
|
-
value: o
|
|
782
|
-
})), u = c.value;
|
|
783
|
-
c.remoteKey !== s && (u = o, l({
|
|
784
|
-
remoteKey: s,
|
|
785
|
-
value: u
|
|
786
|
-
}));
|
|
787
|
-
let d = r ? G(r) : void 0, f = d ? d.value : u;
|
|
788
|
-
return /* @__PURE__ */ O("label", {
|
|
789
|
-
className: "flex flex-col gap-1",
|
|
790
|
-
children: [/* @__PURE__ */ D("span", { children: q(e.label) }), d && (d.hidden || !d.found || f === null) ? /* @__PURE__ */ D("span", { children: d.hidden ? "已隐藏" : d.found ? "null" : "未提交" }) : /* @__PURE__ */ O("select", {
|
|
791
|
-
className: J,
|
|
792
|
-
disabled: t,
|
|
793
|
-
multiple: i,
|
|
794
|
-
value: i ? Array.isArray(f) ? f.map(q) : [] : q(f),
|
|
795
|
-
onChange: (e) => {
|
|
796
|
-
let t = i ? [...e.target.selectedOptions].map((e) => a.find((t) => q(t.value) === e.value)?.value) : a.find((t) => q(t.value) === e.target.value)?.value;
|
|
797
|
-
l((e) => ({
|
|
798
|
-
...e,
|
|
799
|
-
value: t
|
|
800
|
-
})), n(t);
|
|
801
|
-
},
|
|
802
|
-
children: [/* @__PURE__ */ D("option", {
|
|
803
|
-
value: "",
|
|
804
|
-
disabled: !0,
|
|
805
|
-
children: "请选择"
|
|
806
|
-
}), a.map((e, t) => /* @__PURE__ */ D("option", {
|
|
807
|
-
value: q(e.value),
|
|
808
|
-
children: e.label
|
|
809
|
-
}, t))]
|
|
810
|
-
})]
|
|
811
|
-
});
|
|
812
|
-
}
|
|
813
|
-
//#endregion
|
|
814
|
-
//#region src/components/chat/approval-status.ts
|
|
815
|
-
function Ce(e) {
|
|
816
|
-
if (e?.kind === "structured_input") return e.status === "cancelled" || e.outcome === "cancelled" ? "cancelled" : e.status === "expired" || e.outcome === "expired" ? "expired" : e.status === "resolved" ? "submitted" : void 0;
|
|
817
|
-
}
|
|
818
|
-
function we(e) {
|
|
819
|
-
if (e?.status === "cancelled" || e?.status === "expired" || e?.outcome === "cancelled" || e?.outcome === "expired") return "cancelled";
|
|
820
|
-
if (e?.outcome === "approved" || e?.outcome === "rejected") return e.outcome;
|
|
821
|
-
}
|
|
822
|
-
//#endregion
|
|
823
|
-
//#region src/components/chat/A2UIActivityMessage.tsx
|
|
824
|
-
var Te = v(() => import("./OfficialA2uiRenderer-DI49Kpxu.js")), Ee = class extends g {
|
|
825
|
-
state = { failed: !1 };
|
|
826
|
-
static getDerivedStateFromError() {
|
|
827
|
-
return { failed: !0 };
|
|
828
|
-
}
|
|
829
|
-
render() {
|
|
830
|
-
return this.state.failed ? /* @__PURE__ */ D("div", {
|
|
831
|
-
role: "alert",
|
|
832
|
-
children: "卡片渲染失败,请使用输入表单。"
|
|
833
|
-
}) : this.props.children;
|
|
834
|
-
}
|
|
835
|
-
};
|
|
836
|
-
function De({ surfaceId: e, messages: t, onAction: r, disabled: i }) {
|
|
837
|
-
let a = n(), o = S(r), s = S(null), [c, u] = C(), [d, f] = C(""), [p, m] = C(0), h = x(() => t.filter((t) => Object.values(t).some((t) => t && typeof t == "object" && t.surfaceId === e)), [t, e]), g = JSON.stringify([...new Set(h.flatMap((e) => {
|
|
838
|
-
let t = e.createSurface;
|
|
839
|
-
return t?.catalogId ? [t.catalogId] : [];
|
|
840
|
-
}))]);
|
|
841
|
-
return b(() => {
|
|
842
|
-
o.current = r;
|
|
843
|
-
}, [r]), b(() => {
|
|
844
|
-
let e = !1, t, n = (n) => {
|
|
845
|
-
e || (t = new ue((e) => o.current?.(e), a, n), s.current = t, f(""), m((e) => e + 1));
|
|
846
|
-
};
|
|
847
|
-
return a === l ? n([]) : a.loadRenderers(JSON.parse(g)).then(n).catch((t) => {
|
|
848
|
-
e || f(t instanceof Error ? t.message : "卡片组件加载失败。");
|
|
849
|
-
}), M(), () => {
|
|
850
|
-
e = !0, t?.dispose(), s.current = null;
|
|
851
|
-
};
|
|
852
|
-
}, [a, g]), b(() => {
|
|
853
|
-
let t = s.current;
|
|
854
|
-
if (t) {
|
|
855
|
-
t.enabled = !i && !!r;
|
|
856
|
-
try {
|
|
857
|
-
t.apply(h), u(t.get(e)), f("");
|
|
858
|
-
} catch (e) {
|
|
859
|
-
t.enabled = !1, f(e instanceof Error ? e.message : "卡片校验失败。");
|
|
860
|
-
}
|
|
861
|
-
}
|
|
862
|
-
}, [
|
|
863
|
-
h,
|
|
864
|
-
e,
|
|
865
|
-
i,
|
|
866
|
-
r,
|
|
867
|
-
p
|
|
868
|
-
]), d ? /* @__PURE__ */ D("div", {
|
|
869
|
-
role: "alert",
|
|
870
|
-
"data-testid": "a2ui-error",
|
|
871
|
-
children: d
|
|
872
|
-
}) : c ? /* @__PURE__ */ D("fieldset", {
|
|
873
|
-
disabled: i || !r,
|
|
874
|
-
inert: i || !r,
|
|
875
|
-
className: "min-w-0 border-0 p-0",
|
|
876
|
-
children: /* @__PURE__ */ D(Ee, { children: /* @__PURE__ */ D(_, {
|
|
877
|
-
fallback: /* @__PURE__ */ D("div", { children: "正在加载界面" }),
|
|
878
|
-
children: /* @__PURE__ */ D(Te, { surface: c })
|
|
879
|
-
}) }, e)
|
|
880
|
-
}) : null;
|
|
881
|
-
}
|
|
882
|
-
function Oe(e) {
|
|
883
|
-
let t = n(), r = Ce(e.boundInteraction), i = e.boundInteraction?.presentation?.a2ui?.messages, c = x(() => {
|
|
884
|
-
if (!r && e.boundInteraction?.kind !== "approval" || !i) return !1;
|
|
885
|
-
let n = z(e.surfaceId, i, t);
|
|
886
|
-
return n !== void 0 && n === z(e.surfaceId, e.messages, t);
|
|
887
|
-
}, [
|
|
888
|
-
r,
|
|
889
|
-
e.boundInteraction?.kind,
|
|
890
|
-
i,
|
|
891
|
-
e.surfaceId,
|
|
892
|
-
e.messages,
|
|
893
|
-
t
|
|
894
|
-
]), l = !!(r && c), u = x(() => {
|
|
895
|
-
let n = e.boundInteraction && s(e.boundInteraction);
|
|
896
|
-
if (!l || !n || !e.boundInteraction?.requestSchema) return;
|
|
897
|
-
let r = e.messages.flatMap((t) => {
|
|
898
|
-
let n = t.createSurface;
|
|
899
|
-
return n?.surfaceId === e.surfaceId && n.catalogId ? [n.catalogId] : [];
|
|
900
|
-
}).at(-1), i = r ? t.get(r) : void 0, a = _e(e.surfaceId, e.messages, e.boundInteraction.requestSchema, n.value, i?.inputComponents);
|
|
901
|
-
try {
|
|
902
|
-
i?.historyAdapter && Object.assign(a, i.historyAdapter({
|
|
903
|
-
surfaceId: e.surfaceId,
|
|
904
|
-
messages: structuredClone(e.messages),
|
|
905
|
-
answer: a.answer
|
|
906
|
-
})), a.mapped && t.validateMessages(a.messages).dispose();
|
|
907
|
-
} catch {
|
|
908
|
-
a.mapped = !1;
|
|
909
|
-
}
|
|
910
|
-
return a;
|
|
911
|
-
}, [
|
|
912
|
-
l,
|
|
913
|
-
e.surfaceId,
|
|
914
|
-
e.messages,
|
|
915
|
-
e.boundInteraction,
|
|
916
|
-
t
|
|
917
|
-
]);
|
|
918
|
-
if (e.boundInteraction?.kind === "approval" && a(e.boundInteraction, t) && c) return null;
|
|
919
|
-
if (e.boundInteraction && [
|
|
920
|
-
"pending",
|
|
921
|
-
"resolving",
|
|
922
|
-
"failed"
|
|
923
|
-
].includes(e.boundInteraction.status)) return e.boundInteraction.kind === "approval" ? /* @__PURE__ */ D(Y, {
|
|
924
|
-
...e,
|
|
925
|
-
disabled: !0,
|
|
926
|
-
onAction: void 0
|
|
927
|
-
}) : null;
|
|
928
|
-
let d = e.surfaceId.startsWith("input-") ? o(e.messages) : null;
|
|
929
|
-
return d ? /* @__PURE__ */ O("details", {
|
|
930
|
-
className: "mx-auto mb-3 w-full max-w-3xl px-6 text-sm text-muted-foreground",
|
|
931
|
-
"data-testid": "legacy-question-history",
|
|
932
|
-
children: [/* @__PURE__ */ O("summary", {
|
|
933
|
-
className: "cursor-pointer",
|
|
934
|
-
children: [
|
|
935
|
-
"历史提问 · ",
|
|
936
|
-
d.length,
|
|
937
|
-
" 个问题"
|
|
938
|
-
]
|
|
939
|
-
}), /* @__PURE__ */ D("ul", {
|
|
940
|
-
className: "mt-2 list-disc space-y-1 pl-5",
|
|
941
|
-
children: d.map((e, t) => /* @__PURE__ */ D("li", { children: e }, t))
|
|
942
|
-
})]
|
|
943
|
-
}) : r && l ? /* @__PURE__ */ O("details", {
|
|
944
|
-
className: "mx-auto mb-3 w-full max-w-3xl px-6 text-sm text-muted-foreground",
|
|
945
|
-
"data-testid": "a2ui-input-history",
|
|
946
|
-
children: [
|
|
947
|
-
/* @__PURE__ */ O("summary", {
|
|
948
|
-
className: "cursor-pointer",
|
|
949
|
-
children: [
|
|
950
|
-
r === "submitted" ? "已提交表单" : r === "cancelled" ? "已取消表单" : "已过期表单",
|
|
951
|
-
" · ",
|
|
952
|
-
e.boundInteraction?.title || "补充信息"
|
|
953
|
-
]
|
|
954
|
-
}),
|
|
955
|
-
e.boundInteraction?.message ? /* @__PURE__ */ D("p", {
|
|
956
|
-
className: "mt-2",
|
|
957
|
-
children: e.boundInteraction.message
|
|
958
|
-
}) : null,
|
|
959
|
-
e.boundInteraction?.responseSummary ? /* @__PURE__ */ D("p", {
|
|
960
|
-
className: "mt-1",
|
|
961
|
-
"data-testid": "a2ui-input-response-summary",
|
|
962
|
-
children: e.boundInteraction.responseSummary
|
|
963
|
-
}) : null,
|
|
964
|
-
r === "submitted" && !u ? /* @__PURE__ */ D("p", {
|
|
965
|
-
className: "mt-2",
|
|
966
|
-
children: "此历史记录没有可恢复的提交值,以下为原始表单。"
|
|
967
|
-
}) : null,
|
|
968
|
-
/* @__PURE__ */ D("div", {
|
|
969
|
-
className: "mt-2",
|
|
970
|
-
"data-testid": "a2ui-input-history-snapshot",
|
|
971
|
-
children: u && !u.mapped ? /* @__PURE__ */ O("div", {
|
|
972
|
-
"data-testid": "a2ui-input-response-fallback",
|
|
973
|
-
children: [/* @__PURE__ */ D("p", { children: "已提交参数(原卡片没有可确定的输入绑定):" }), /* @__PURE__ */ D("pre", {
|
|
974
|
-
className: "whitespace-pre-wrap",
|
|
975
|
-
children: JSON.stringify(u.answer.summary, null, 2)
|
|
976
|
-
})]
|
|
977
|
-
}) : /* @__PURE__ */ D(Y, {
|
|
978
|
-
...e,
|
|
979
|
-
messages: u?.messages || e.messages,
|
|
980
|
-
historyAnswer: u?.legacy ? u.answer : void 0,
|
|
981
|
-
disabled: !0,
|
|
982
|
-
onAction: void 0
|
|
983
|
-
})
|
|
984
|
-
})
|
|
985
|
-
]
|
|
986
|
-
}) : /* @__PURE__ */ D(Y, { ...e });
|
|
987
|
-
}
|
|
988
|
-
function Y(e) {
|
|
989
|
-
let t = n();
|
|
990
|
-
if (e.messages.flatMap((t) => {
|
|
991
|
-
let n = t.createSurface;
|
|
992
|
-
return n?.surfaceId === e.surfaceId ? [n] : [];
|
|
993
|
-
}).at(-1)?.catalogId === "a2ui.org/catalogs/basic/v1.0") {
|
|
994
|
-
let n = e.messages.filter((t) => Object.values(t).some((t) => t && typeof t == "object" && t.surfaceId === e.surfaceId));
|
|
995
|
-
try {
|
|
996
|
-
t.validateMessages(n).dispose();
|
|
997
|
-
} catch {
|
|
998
|
-
return /* @__PURE__ */ D("div", {
|
|
999
|
-
role: "alert",
|
|
1000
|
-
children: "旧版卡片未通过兼容目录校验。"
|
|
1001
|
-
});
|
|
1002
|
-
}
|
|
1003
|
-
return /* @__PURE__ */ D(be, {
|
|
1004
|
-
...e,
|
|
1005
|
-
messages: n,
|
|
1006
|
-
disabled: !!(e.disabled || !e.onAction),
|
|
1007
|
-
onAction: e.onAction || (() => {})
|
|
1008
|
-
});
|
|
1009
|
-
}
|
|
1010
|
-
return /* @__PURE__ */ D("div", {
|
|
1011
|
-
className: "mb-3 w-full overflow-hidden rounded-lg border border-slate-200 bg-white p-3 shadow-sm dark:border-slate-700 dark:bg-slate-900",
|
|
1012
|
-
"data-testid": "a2ui-surface",
|
|
1013
|
-
children: /* @__PURE__ */ D(De, { ...e })
|
|
1014
|
-
});
|
|
1015
|
-
}
|
|
1016
|
-
//#endregion
|
|
1017
|
-
//#region src/components/chat/InteractionA2uiSurface.tsx
|
|
1018
|
-
function X({ a2ui: e, disabled: t, onSubmit: n, onCancel: r }) {
|
|
1019
|
-
let i = /* @__PURE__ */ new Set();
|
|
1020
|
-
for (let t of e.messages) {
|
|
1021
|
-
let e = t.createSurface, n = t.deleteSurface;
|
|
1022
|
-
e?.surfaceId && i.add(e.surfaceId), n?.surfaceId && i.delete(n.surfaceId);
|
|
1023
|
-
}
|
|
1024
|
-
return i.size ? /* @__PURE__ */ O("div", {
|
|
1025
|
-
className: "mt-3",
|
|
1026
|
-
"data-testid": "interaction-a2ui-surface",
|
|
1027
|
-
children: [[...i].map((i) => /* @__PURE__ */ D(Oe, {
|
|
1028
|
-
surfaceId: i,
|
|
1029
|
-
messages: e.messages,
|
|
1030
|
-
disabled: t,
|
|
1031
|
-
onAction: t ? void 0 : (e) => {
|
|
1032
|
-
let t = e.userAction?.context || {};
|
|
1033
|
-
if (e.userAction?.name === "cancel") {
|
|
1034
|
-
r();
|
|
1035
|
-
return;
|
|
1036
|
-
}
|
|
1037
|
-
n(d(Object.prototype.hasOwnProperty.call(t, "payload") ? t.payload : t));
|
|
1038
|
-
}
|
|
1039
|
-
}, i)), t ? null : /* @__PURE__ */ D("button", {
|
|
1040
|
-
type: "button",
|
|
1041
|
-
"data-testid": "interaction-a2ui-cancel",
|
|
1042
|
-
onClick: r,
|
|
1043
|
-
className: "mt-1 inline-flex min-h-8 items-center rounded-md px-3 py-1.5 text-xs font-medium text-slate-500 underline-offset-2 hover:underline dark:text-slate-400",
|
|
1044
|
-
children: "取消本次确认"
|
|
1045
|
-
})]
|
|
1046
|
-
}) : /* @__PURE__ */ D("div", {
|
|
1047
|
-
role: "alert",
|
|
1048
|
-
children: "卡片没有可展示的 surface。"
|
|
1049
|
-
});
|
|
1050
|
-
}
|
|
1051
|
-
//#endregion
|
|
1052
|
-
//#region src/components/chat/InteractionTray.tsx
|
|
1053
|
-
function ke(e) {
|
|
1054
|
-
if (!e.expiresAt) return !1;
|
|
1055
|
-
let t = Date.parse(e.expiresAt);
|
|
1056
|
-
return Number.isFinite(t) && t <= Date.now();
|
|
1057
|
-
}
|
|
1058
|
-
function Ae(e) {
|
|
1059
|
-
let t = e.extensions.submit_error;
|
|
1060
|
-
return typeof t == "object" && t && "code" in t && "message" in t ? {
|
|
1061
|
-
code: String(t.code),
|
|
1062
|
-
message: String(t.message),
|
|
1063
|
-
retryable: !!("retryable" in t && t.retryable)
|
|
1064
|
-
} : null;
|
|
1065
|
-
}
|
|
1066
|
-
function je(e) {
|
|
1067
|
-
return typeof e == "object" && e && !Array.isArray(e) ? e : null;
|
|
1068
|
-
}
|
|
1069
|
-
function Me(e) {
|
|
1070
|
-
let t = je(e);
|
|
1071
|
-
if (t) return t;
|
|
1072
|
-
if (typeof e != "string") return null;
|
|
1073
|
-
try {
|
|
1074
|
-
return je(JSON.parse(e));
|
|
1075
|
-
} catch {
|
|
1076
|
-
return null;
|
|
1077
|
-
}
|
|
1078
|
-
}
|
|
1079
|
-
function Z(e) {
|
|
1080
|
-
return Array.isArray(e) ? e.map(String).join(" ") : typeof e == "string" ? e : "";
|
|
1081
|
-
}
|
|
1082
|
-
function Ne(e) {
|
|
1083
|
-
let t = Me(e.extensions.detail), n = Me(e.extensions.arguments), r = t || n || {}, i = e.title.replace(/^审批[::]\s*/, "").trim();
|
|
1084
|
-
return {
|
|
1085
|
-
operation: {
|
|
1086
|
-
command_execution: "命令执行",
|
|
1087
|
-
file_change: "文件修改",
|
|
1088
|
-
mcp_tool_call: "MCP 工具调用"
|
|
1089
|
-
}[i] || i,
|
|
1090
|
-
command: Z(r.command ?? r.cmd),
|
|
1091
|
-
reason: Z(r.reason ?? r.justification),
|
|
1092
|
-
cwd: Z(r.cwd ?? r.workdir)
|
|
1093
|
-
};
|
|
1094
|
-
}
|
|
1095
|
-
var Pe = {
|
|
1096
|
-
approved: "已同意",
|
|
1097
|
-
rejected: "已拒绝",
|
|
1098
|
-
submitted: "已提交",
|
|
1099
|
-
cancelled: "已取消",
|
|
1100
|
-
expired: "已过期"
|
|
1101
|
-
};
|
|
1102
|
-
function Fe({ interactions: e, activeIndex: t, onSelectIndex: r, onRespond: o, localCatalog: s, className: l }) {
|
|
1103
|
-
let u = n(), [m, h] = C(""), [g, _] = C(null), v = p(), y = e[Math.min(t, Math.max(e.length - 1, 0))];
|
|
1104
|
-
if (!y) return null;
|
|
1105
|
-
let b = ke(y), x = Ae(y), S = Ne(y), k = a(y, u), A = b || y.status === "resolving" || [
|
|
1106
|
-
"resolved",
|
|
1107
|
-
"cancelled",
|
|
1108
|
-
"expired"
|
|
1109
|
-
].includes(y.status), ae = c(y.presentation?.a2ui, s || u), j = y.requestSchema, M = y.kind === "approval" ? "basic-controls" : ae === "a2ui" ? "a2ui" : j ? "json-schema-form" : "basic-controls", N = M === "json-schema-form" && j || y.requestSchema, P = (e, t) => {
|
|
1110
|
-
if (A) return;
|
|
1111
|
-
let n;
|
|
1112
|
-
try {
|
|
1113
|
-
n = d(t);
|
|
1114
|
-
} catch {
|
|
1115
|
-
_({
|
|
1116
|
-
id: y.interactionId,
|
|
1117
|
-
message: "答案必须是合法 JSON 值。"
|
|
1118
|
-
});
|
|
1119
|
-
return;
|
|
1120
|
-
}
|
|
1121
|
-
_(null), Promise.resolve(o({
|
|
1122
|
-
interactionId: y.interactionId,
|
|
1123
|
-
expectedRevision: y.revision,
|
|
1124
|
-
action: e,
|
|
1125
|
-
response: n,
|
|
1126
|
-
idempotencyKey: i(y.interactionId, y.revision)
|
|
1127
|
-
})).catch(() => {});
|
|
1128
|
-
};
|
|
1129
|
-
return /* @__PURE__ */ D("div", {
|
|
1130
|
-
"data-testid": "interaction-tray",
|
|
1131
|
-
"data-slot": "interaction-tray",
|
|
1132
|
-
"data-ui": "interaction-tray",
|
|
1133
|
-
"data-interaction-status": y.status,
|
|
1134
|
-
"data-interaction-count": e.length,
|
|
1135
|
-
role: "region",
|
|
1136
|
-
"aria-label": "待确认内容",
|
|
1137
|
-
tabIndex: 0,
|
|
1138
|
-
className: f("custom-scrollbar mx-auto mb-2 min-h-0 max-h-[min(60dvh,36rem)] w-full max-w-[64rem] overflow-y-auto overscroll-contain px-3 sm:px-4", l),
|
|
1139
|
-
children: /* @__PURE__ */ O("div", {
|
|
1140
|
-
"data-slot": "interaction-card",
|
|
1141
|
-
className: "rounded-2xl border border-[var(--ksadk-interaction-border)] bg-[var(--ksadk-interaction-background)] px-3 py-3 text-[var(--ksadk-interaction-foreground)] shadow-sm",
|
|
1142
|
-
children: [
|
|
1143
|
-
/* @__PURE__ */ O("div", {
|
|
1144
|
-
className: "flex items-center justify-between gap-2 text-xs text-[var(--ksadk-interaction-muted)]",
|
|
1145
|
-
children: [/* @__PURE__ */ O("div", {
|
|
1146
|
-
className: "flex min-w-0 items-center gap-1.5",
|
|
1147
|
-
children: [
|
|
1148
|
-
/* @__PURE__ */ D(re, {
|
|
1149
|
-
className: "h-3.5 w-3.5 shrink-0",
|
|
1150
|
-
strokeWidth: 1.7,
|
|
1151
|
-
"aria-hidden": "true"
|
|
1152
|
-
}),
|
|
1153
|
-
/* @__PURE__ */ D("span", {
|
|
1154
|
-
"data-testid": "interaction-tray-title",
|
|
1155
|
-
children: y.title
|
|
1156
|
-
}),
|
|
1157
|
-
S.operation ? /* @__PURE__ */ D("span", {
|
|
1158
|
-
className: "truncate text-[11px] text-[var(--ksadk-interaction-muted)]",
|
|
1159
|
-
children: S.operation
|
|
1160
|
-
}) : null
|
|
1161
|
-
]
|
|
1162
|
-
}), /* @__PURE__ */ O("div", {
|
|
1163
|
-
className: "flex items-center gap-1",
|
|
1164
|
-
children: [e.length > 1 ? /* @__PURE__ */ O(E, { children: [
|
|
1165
|
-
/* @__PURE__ */ D("button", {
|
|
1166
|
-
type: "button",
|
|
1167
|
-
"data-testid": "interaction-tray-prev",
|
|
1168
|
-
disabled: t <= 0,
|
|
1169
|
-
onClick: () => r(Math.max(t - 1, 0)),
|
|
1170
|
-
className: "rounded p-1 transition hover:bg-[var(--ksadk-interaction-muted-background)] disabled:opacity-30",
|
|
1171
|
-
"aria-label": "上一条待确认",
|
|
1172
|
-
children: /* @__PURE__ */ D(ee, {
|
|
1173
|
-
className: "h-3.5 w-3.5",
|
|
1174
|
-
"aria-hidden": "true"
|
|
1175
|
-
})
|
|
1176
|
-
}),
|
|
1177
|
-
/* @__PURE__ */ O("span", {
|
|
1178
|
-
"data-testid": "interaction-tray-count",
|
|
1179
|
-
className: "min-w-10 text-center",
|
|
1180
|
-
children: [
|
|
1181
|
-
t + 1,
|
|
1182
|
-
" of ",
|
|
1183
|
-
e.length
|
|
1184
|
-
]
|
|
1185
|
-
}),
|
|
1186
|
-
/* @__PURE__ */ D("button", {
|
|
1187
|
-
type: "button",
|
|
1188
|
-
"data-testid": "interaction-tray-next",
|
|
1189
|
-
disabled: t >= e.length - 1,
|
|
1190
|
-
onClick: () => r(Math.min(t + 1, e.length - 1)),
|
|
1191
|
-
className: "rounded p-1 transition hover:bg-[var(--ksadk-interaction-muted-background)] disabled:opacity-30",
|
|
1192
|
-
"aria-label": "下一条待确认",
|
|
1193
|
-
children: /* @__PURE__ */ D(te, {
|
|
1194
|
-
className: "h-3.5 w-3.5",
|
|
1195
|
-
"aria-hidden": "true"
|
|
1196
|
-
})
|
|
1197
|
-
})
|
|
1198
|
-
] }) : null, /* @__PURE__ */ D("button", {
|
|
1199
|
-
type: "button",
|
|
1200
|
-
"data-testid": "interaction-cancel",
|
|
1201
|
-
disabled: A,
|
|
1202
|
-
onClick: () => P("cancel", {}),
|
|
1203
|
-
className: "rounded p-1 transition hover:bg-[var(--ksadk-interaction-muted-background)] hover:text-[var(--ksadk-interaction-foreground)] disabled:opacity-30",
|
|
1204
|
-
"aria-label": "取消本次确认",
|
|
1205
|
-
children: /* @__PURE__ */ D(T, {
|
|
1206
|
-
className: "h-3.5 w-3.5",
|
|
1207
|
-
"aria-hidden": "true"
|
|
1208
|
-
})
|
|
1209
|
-
})]
|
|
1210
|
-
})]
|
|
1211
|
-
}),
|
|
1212
|
-
y.message === S.command ? null : /* @__PURE__ */ D("p", {
|
|
1213
|
-
className: "mt-2 whitespace-pre-wrap break-words text-sm font-medium leading-5 text-[var(--ksadk-interaction-foreground)]",
|
|
1214
|
-
"data-testid": "interaction-tray-message",
|
|
1215
|
-
children: y.message
|
|
1216
|
-
}),
|
|
1217
|
-
S.command || S.reason || S.cwd ? /* @__PURE__ */ O("div", {
|
|
1218
|
-
"data-slot": "interaction-summary",
|
|
1219
|
-
className: "mt-1.5 space-y-1 rounded-xl bg-[var(--ksadk-interaction-muted-background)] px-2.5 py-2 text-xs leading-5",
|
|
1220
|
-
children: [
|
|
1221
|
-
S.command ? /* @__PURE__ */ D("code", {
|
|
1222
|
-
className: "block max-h-12 overflow-auto whitespace-pre-wrap break-all font-mono text-[var(--ksadk-interaction-foreground)]",
|
|
1223
|
-
children: S.command
|
|
1224
|
-
}) : null,
|
|
1225
|
-
S.reason ? /* @__PURE__ */ D("p", {
|
|
1226
|
-
className: "text-[var(--ksadk-interaction-muted)]",
|
|
1227
|
-
children: S.reason
|
|
1228
|
-
}) : null,
|
|
1229
|
-
S.cwd ? /* @__PURE__ */ D("p", {
|
|
1230
|
-
className: "truncate font-mono text-[11px] text-[var(--ksadk-interaction-muted)]",
|
|
1231
|
-
title: S.cwd,
|
|
1232
|
-
children: S.cwd
|
|
1233
|
-
}) : null
|
|
1234
|
-
]
|
|
1235
|
-
}) : null,
|
|
1236
|
-
b ? /* @__PURE__ */ O("p", {
|
|
1237
|
-
className: "mt-2 text-xs font-medium text-rose-600 dark:text-rose-400",
|
|
1238
|
-
"data-testid": "interaction-tray-expired",
|
|
1239
|
-
children: [
|
|
1240
|
-
"该确认已过期(",
|
|
1241
|
-
Pe.expired,
|
|
1242
|
-
"),等待运行时继续处理。"
|
|
1243
|
-
]
|
|
1244
|
-
}) : null,
|
|
1245
|
-
g?.id === y.interactionId ? /* @__PURE__ */ D("p", {
|
|
1246
|
-
role: "alert",
|
|
1247
|
-
children: g.message
|
|
1248
|
-
}) : null,
|
|
1249
|
-
x ? /* @__PURE__ */ O("p", {
|
|
1250
|
-
className: "mt-2 text-xs font-medium text-rose-600 dark:text-rose-400",
|
|
1251
|
-
"data-testid": "interaction-tray-error",
|
|
1252
|
-
children: [
|
|
1253
|
-
"提交失败(",
|
|
1254
|
-
x.code,
|
|
1255
|
-
"):",
|
|
1256
|
-
x.message,
|
|
1257
|
-
x.retryable ? ",可重试。" : ""
|
|
1258
|
-
]
|
|
1259
|
-
}) : null,
|
|
1260
|
-
k ? /* @__PURE__ */ D("div", {
|
|
1261
|
-
"data-testid": "interaction-approval-preview",
|
|
1262
|
-
children: /* @__PURE__ */ D(X, {
|
|
1263
|
-
a2ui: k,
|
|
1264
|
-
disabled: !0,
|
|
1265
|
-
onSubmit: () => {},
|
|
1266
|
-
onCancel: () => {}
|
|
1267
|
-
}, JSON.stringify([
|
|
1268
|
-
y.sessionId,
|
|
1269
|
-
y.interactionId,
|
|
1270
|
-
y.revision
|
|
1271
|
-
]))
|
|
1272
|
-
}) : null,
|
|
1273
|
-
M === "a2ui" && y.presentation?.a2ui ? /* @__PURE__ */ D(X, {
|
|
1274
|
-
a2ui: y.presentation.a2ui,
|
|
1275
|
-
disabled: A,
|
|
1276
|
-
onSubmit: (e) => P("submit", e),
|
|
1277
|
-
onCancel: () => P("cancel", {})
|
|
1278
|
-
}, JSON.stringify([
|
|
1279
|
-
y.sessionId,
|
|
1280
|
-
y.interactionId,
|
|
1281
|
-
y.revision
|
|
1282
|
-
])) : M === "json-schema-form" && N ? /* @__PURE__ */ D(le, {
|
|
1283
|
-
schema: N,
|
|
1284
|
-
disabled: A,
|
|
1285
|
-
onSubmit: (e) => P("submit", e),
|
|
1286
|
-
onCancel: () => P("cancel", {})
|
|
1287
|
-
}, JSON.stringify([
|
|
1288
|
-
y.sessionId,
|
|
1289
|
-
y.interactionId,
|
|
1290
|
-
y.revision
|
|
1291
|
-
])) : y.kind === "approval" ? /* @__PURE__ */ O("div", {
|
|
1292
|
-
className: "mt-2 flex flex-col gap-1",
|
|
1293
|
-
"data-testid": "interaction-tray-basic",
|
|
1294
|
-
children: [
|
|
1295
|
-
/* @__PURE__ */ O("button", {
|
|
1296
|
-
type: "button",
|
|
1297
|
-
"data-testid": "interaction-approve",
|
|
1298
|
-
disabled: A,
|
|
1299
|
-
onClick: () => P("approve", { decision: "approve" }),
|
|
1300
|
-
className: "group flex min-h-9 w-full items-center gap-2.5 rounded-xl px-2.5 py-1.5 text-left text-sm font-medium text-[var(--ksadk-interaction-foreground)] transition hover:bg-[var(--ksadk-interaction-muted-background)] disabled:cursor-not-allowed disabled:opacity-55",
|
|
1301
|
-
children: [
|
|
1302
|
-
/* @__PURE__ */ D("span", {
|
|
1303
|
-
className: "flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-[var(--ksadk-interaction-muted-background)] text-xs text-[var(--ksadk-interaction-muted)]",
|
|
1304
|
-
children: "1"
|
|
1305
|
-
}),
|
|
1306
|
-
/* @__PURE__ */ D("span", {
|
|
1307
|
-
className: "min-w-0 flex-1",
|
|
1308
|
-
children: "批准并继续"
|
|
1309
|
-
}),
|
|
1310
|
-
/* @__PURE__ */ D(w, {
|
|
1311
|
-
className: "h-3.5 w-3.5 text-[var(--ksadk-interaction-muted)] opacity-0 transition group-hover:opacity-100",
|
|
1312
|
-
"aria-hidden": "true"
|
|
1313
|
-
})
|
|
1314
|
-
]
|
|
1315
|
-
}),
|
|
1316
|
-
/* @__PURE__ */ O("button", {
|
|
1317
|
-
type: "button",
|
|
1318
|
-
"data-testid": "interaction-reject",
|
|
1319
|
-
disabled: A,
|
|
1320
|
-
onClick: () => P("reject", { decision: "reject" }),
|
|
1321
|
-
className: "group flex min-h-9 w-full items-center gap-2.5 rounded-xl px-2.5 py-1.5 text-left text-sm font-medium text-[var(--ksadk-interaction-foreground)] transition hover:bg-[var(--ksadk-interaction-muted-background)] disabled:cursor-not-allowed disabled:opacity-55",
|
|
1322
|
-
children: [
|
|
1323
|
-
/* @__PURE__ */ D("span", {
|
|
1324
|
-
className: "flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-[var(--ksadk-interaction-muted-background)] text-xs text-[var(--ksadk-interaction-muted)]",
|
|
1325
|
-
children: "2"
|
|
1326
|
-
}),
|
|
1327
|
-
/* @__PURE__ */ D("span", {
|
|
1328
|
-
className: "min-w-0 flex-1",
|
|
1329
|
-
children: "拒绝"
|
|
1330
|
-
}),
|
|
1331
|
-
/* @__PURE__ */ D(w, {
|
|
1332
|
-
className: "h-3.5 w-3.5 text-[var(--ksadk-interaction-muted)] opacity-0 transition group-hover:opacity-100",
|
|
1333
|
-
"aria-hidden": "true"
|
|
1334
|
-
})
|
|
1335
|
-
]
|
|
1336
|
-
}),
|
|
1337
|
-
/* @__PURE__ */ O("label", {
|
|
1338
|
-
className: "mt-0.5 flex min-w-0 items-center gap-2.5 rounded-xl bg-[var(--ksadk-interaction-muted-background)]/60 px-2.5 py-1.5",
|
|
1339
|
-
children: [
|
|
1340
|
-
/* @__PURE__ */ D("span", {
|
|
1341
|
-
className: "flex h-6 w-6 shrink-0 items-center justify-center rounded-full border border-[var(--ksadk-interaction-border)] bg-[var(--ksadk-interaction-control-background)] text-[var(--ksadk-interaction-muted)]",
|
|
1342
|
-
children: /* @__PURE__ */ D(ie, {
|
|
1343
|
-
className: "h-3.5 w-3.5",
|
|
1344
|
-
"aria-hidden": "true"
|
|
1345
|
-
})
|
|
1346
|
-
}),
|
|
1347
|
-
/* @__PURE__ */ D("input", {
|
|
1348
|
-
type: "text",
|
|
1349
|
-
value: m,
|
|
1350
|
-
onChange: (e) => h(e.target.value),
|
|
1351
|
-
onKeyDown: (e) => {
|
|
1352
|
-
e.key !== "Enter" || v(e) || !m.trim() || (e.preventDefault(), P("cancel", { feedback: m.trim() }));
|
|
1353
|
-
},
|
|
1354
|
-
placeholder: "告诉 Agent 要如何修改",
|
|
1355
|
-
disabled: A,
|
|
1356
|
-
"data-testid": "interaction-tray-comment",
|
|
1357
|
-
className: "h-8 min-w-0 flex-1 border-0 bg-transparent px-0 text-sm font-medium text-[var(--ksadk-interaction-foreground)] outline-none placeholder:text-[var(--ksadk-interaction-muted)] disabled:cursor-not-allowed disabled:opacity-55"
|
|
1358
|
-
}),
|
|
1359
|
-
/* @__PURE__ */ D("button", {
|
|
1360
|
-
type: "button",
|
|
1361
|
-
"data-testid": "interaction-feedback-submit",
|
|
1362
|
-
"aria-label": "提交修改意见",
|
|
1363
|
-
disabled: A || !m.trim(),
|
|
1364
|
-
onClick: () => P("cancel", { feedback: m.trim() }),
|
|
1365
|
-
className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-full text-[var(--ksadk-interaction-muted)] transition hover:bg-[var(--ksadk-interaction-control-background)] hover:text-[var(--ksadk-interaction-foreground)] disabled:opacity-30",
|
|
1366
|
-
children: /* @__PURE__ */ D(w, {
|
|
1367
|
-
className: "h-3.5 w-3.5",
|
|
1368
|
-
"aria-hidden": "true"
|
|
1369
|
-
})
|
|
1370
|
-
})
|
|
1371
|
-
]
|
|
1372
|
-
})
|
|
1373
|
-
]
|
|
1374
|
-
}) : /* @__PURE__ */ O("div", {
|
|
1375
|
-
className: "mt-2.5",
|
|
1376
|
-
"data-testid": "interaction-tray-basic",
|
|
1377
|
-
children: [/* @__PURE__ */ D("input", {
|
|
1378
|
-
type: "text",
|
|
1379
|
-
value: m,
|
|
1380
|
-
onChange: (e) => h(e.target.value),
|
|
1381
|
-
onKeyDown: (e) => {
|
|
1382
|
-
e.key !== "Enter" || v(e) || !m.trim() || (e.preventDefault(), P("submit", { value: m.trim() }));
|
|
1383
|
-
},
|
|
1384
|
-
placeholder: "输入回复",
|
|
1385
|
-
disabled: A,
|
|
1386
|
-
"data-testid": "interaction-tray-comment",
|
|
1387
|
-
className: "mb-2 h-8 w-full rounded-lg border border-[var(--ksadk-interaction-border)] bg-[var(--ksadk-interaction-control-background)] px-2.5 text-sm text-[var(--ksadk-interaction-foreground)] outline-none placeholder:text-[var(--ksadk-interaction-muted)] focus:ring-1 focus:ring-[var(--ksadk-interaction-focus-ring)]"
|
|
1388
|
-
}), /* @__PURE__ */ D("div", {
|
|
1389
|
-
className: "flex justify-end gap-2",
|
|
1390
|
-
children: /* @__PURE__ */ D("button", {
|
|
1391
|
-
type: "button",
|
|
1392
|
-
"data-testid": "interaction-submit",
|
|
1393
|
-
disabled: A,
|
|
1394
|
-
onClick: () => P("submit", { value: m }),
|
|
1395
|
-
className: "inline-flex h-8 items-center gap-1.5 rounded-lg bg-[var(--ksadk-interaction-primary-background)] px-3 text-xs font-medium text-[var(--ksadk-interaction-primary-foreground)] shadow-sm transition hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-55",
|
|
1396
|
-
children: "提交"
|
|
1397
|
-
})
|
|
1398
|
-
})]
|
|
1399
|
-
}),
|
|
1400
|
-
y.status === "resolving" ? /* @__PURE__ */ O("p", {
|
|
1401
|
-
role: "status",
|
|
1402
|
-
"data-testid": "interaction-submit-progress",
|
|
1403
|
-
className: "mt-2 flex items-center gap-1.5 text-xs text-[var(--ksadk-interaction-muted)]",
|
|
1404
|
-
children: [/* @__PURE__ */ D(ne, {
|
|
1405
|
-
className: "h-3.5 w-3.5 animate-spin",
|
|
1406
|
-
"aria-hidden": "true"
|
|
1407
|
-
}), y.extensions.submit_command_id ? "已提交,等待 Agent 处理。处理结果将显示在对话中。" : "正在发送,请稍候…"]
|
|
1408
|
-
}) : null
|
|
1409
|
-
]
|
|
1410
|
-
})
|
|
1411
|
-
});
|
|
1412
|
-
}
|
|
1413
|
-
function Ie({ outcome: e }) {
|
|
1414
|
-
return /* @__PURE__ */ D("span", {
|
|
1415
|
-
className: f("rounded border px-1.5 py-0.5 text-xs font-medium", e === "approved" ? "border-emerald-300 text-emerald-700 dark:border-emerald-900 dark:text-emerald-300" : e === "rejected" ? "border-rose-300 text-rose-700 dark:border-rose-900 dark:text-rose-300" : "border-slate-300 text-slate-600 dark:border-slate-700 dark:text-slate-300"),
|
|
1416
|
-
children: Pe[e] || e
|
|
1417
|
-
});
|
|
1418
|
-
}
|
|
1419
|
-
//#endregion
|
|
1420
|
-
//#region src/utils/context.js
|
|
1421
|
-
function Q(e) {
|
|
1422
|
-
if (typeof e == "number" && Number.isFinite(e) && e > 0) return e;
|
|
1423
|
-
if (typeof e == "string" && e.trim()) {
|
|
1424
|
-
let t = Number(e);
|
|
1425
|
-
if (Number.isFinite(t) && t > 0) return t;
|
|
1426
|
-
}
|
|
1427
|
-
return null;
|
|
1428
|
-
}
|
|
1429
|
-
function Le(e) {
|
|
1430
|
-
return e ? Q(e.context_window_tokens) ?? Q(e?.limits?.context_window_tokens) : null;
|
|
1431
|
-
}
|
|
1432
|
-
function Re(e) {
|
|
1433
|
-
return e ? Q(e.auto_compact_threshold_percentage) ?? 84 : 84;
|
|
1434
|
-
}
|
|
1435
|
-
function ze({ selectedModel: e, contextUsage: t }) {
|
|
1436
|
-
let n = t && (!t.model || t.model === e?.id) ? t : null, r = Q(n?.used_tokens), i = Q(n?.context_window_tokens), a = i ?? Le(e), o = {
|
|
1437
|
-
contextWindowTokens: a ?? void 0,
|
|
1438
|
-
contextWindowSource: a ? i ? "runtime" : "model" : void 0
|
|
1439
|
-
}, s = n?.source === "last_request" ? "上次请求输入" : "上下文占用";
|
|
1440
|
-
if (!r) return {
|
|
1441
|
-
label: "上下文用量暂不可用",
|
|
1442
|
-
phase: "default",
|
|
1443
|
-
...o
|
|
1444
|
-
};
|
|
1445
|
-
let c = a ? Math.round(r / a * 100) : void 0;
|
|
1446
|
-
return {
|
|
1447
|
-
label: s,
|
|
1448
|
-
phase: c !== void 0 && c >= Re(e) ? "warning" : "normal",
|
|
1449
|
-
percent: c,
|
|
1450
|
-
usedTokens: r,
|
|
1451
|
-
...o
|
|
1452
|
-
};
|
|
1453
|
-
}
|
|
1454
|
-
//#endregion
|
|
1455
|
-
//#region src/components/ui/dialog.tsx
|
|
1456
|
-
var Be = N.Root, Ve = N.Portal, He = h.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ D(N.Overlay, {
|
|
1457
|
-
ref: n,
|
|
1458
|
-
className: f("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", e),
|
|
1459
|
-
...t
|
|
1460
|
-
}));
|
|
1461
|
-
He.displayName = N.Overlay.displayName;
|
|
1462
|
-
var Ue = h.forwardRef(({ className: e, children: t, ...n }, r) => /* @__PURE__ */ O(Ve, { children: [/* @__PURE__ */ D(He, {}), /* @__PURE__ */ O(N.Content, {
|
|
1463
|
-
ref: r,
|
|
1464
|
-
className: f("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg", e),
|
|
1465
|
-
...n,
|
|
1466
|
-
children: [t, /* @__PURE__ */ O(N.Close, {
|
|
1467
|
-
className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",
|
|
1468
|
-
children: [/* @__PURE__ */ D(T, { className: "h-4 w-4" }), /* @__PURE__ */ D("span", {
|
|
1469
|
-
className: "sr-only",
|
|
1470
|
-
children: "Close"
|
|
1471
|
-
})]
|
|
1472
|
-
})]
|
|
1473
|
-
})] }));
|
|
1474
|
-
Ue.displayName = N.Content.displayName;
|
|
1475
|
-
var We = ({ className: e, ...t }) => /* @__PURE__ */ D("div", {
|
|
1476
|
-
className: f("flex flex-col space-y-1.5 text-center sm:text-left", e),
|
|
1477
|
-
...t
|
|
1478
|
-
});
|
|
1479
|
-
We.displayName = "DialogHeader";
|
|
1480
|
-
var Ge = ({ className: e, ...t }) => /* @__PURE__ */ D("div", {
|
|
1481
|
-
className: f("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", e),
|
|
1482
|
-
...t
|
|
1483
|
-
});
|
|
1484
|
-
Ge.displayName = "DialogFooter";
|
|
1485
|
-
var $ = h.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ D(N.Title, {
|
|
1486
|
-
ref: n,
|
|
1487
|
-
className: f("text-lg font-semibold leading-none tracking-tight", e),
|
|
1488
|
-
...t
|
|
1489
|
-
}));
|
|
1490
|
-
$.displayName = N.Title.displayName;
|
|
1491
|
-
var Ke = h.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ D(N.Description, {
|
|
1492
|
-
ref: n,
|
|
1493
|
-
className: f("text-sm text-muted-foreground", e),
|
|
1494
|
-
...t
|
|
1495
|
-
}));
|
|
1496
|
-
Ke.displayName = N.Description.displayName;
|
|
1497
|
-
//#endregion
|
|
1498
|
-
//#region src/components/chat/AttachmentPreview.tsx
|
|
1499
|
-
function qe(e, t) {
|
|
1500
|
-
if (!(!t || e)) return {
|
|
1501
|
-
width: `min(${t.width}px, calc(100vw - 5rem))`,
|
|
1502
|
-
height: `min(${t.height}px, calc(100vh - 9rem))`
|
|
1503
|
-
};
|
|
1504
|
-
}
|
|
1505
|
-
function Je(e, t) {
|
|
1506
|
-
if (!(!t || e)) return { width: `min(${t.width + 32}px, calc(100vw - 3rem))` };
|
|
1507
|
-
}
|
|
1508
|
-
function Ye({ attachment: e, isMobile: t, previewImageSize: n, onClose: r, onImageLoad: i }) {
|
|
1509
|
-
return /* @__PURE__ */ D(Be, {
|
|
1510
|
-
open: !!e?.url,
|
|
1511
|
-
onOpenChange: (e) => !e && r(),
|
|
1512
|
-
children: /* @__PURE__ */ O(Ue, {
|
|
1513
|
-
className: f("gap-0 overflow-hidden border-slate-700 bg-slate-950 p-0 text-slate-100 shadow-2xl [&>button]:right-3 [&>button]:top-3 [&>button]:rounded-md [&>button]:border [&>button]:border-slate-700 [&>button]:bg-slate-900/70 [&>button]:p-1.5 [&>button]:text-slate-200 [&>button]:opacity-100", t ? "left-0 top-0 h-[var(--app-height)] max-h-[var(--app-height)] w-screen max-w-none translate-x-0 translate-y-0 rounded-none border-0" : "max-h-[calc(100vh-2rem)] max-w-[calc(100vw-2rem)] rounded-2xl"),
|
|
1514
|
-
style: Je(t, n),
|
|
1515
|
-
children: [/* @__PURE__ */ D("div", {
|
|
1516
|
-
className: "flex items-center gap-3 border-b border-slate-800 px-4 py-3 pr-16",
|
|
1517
|
-
children: /* @__PURE__ */ D($, {
|
|
1518
|
-
className: "truncate text-sm font-medium",
|
|
1519
|
-
children: e?.name || "附件预览"
|
|
1520
|
-
})
|
|
1521
|
-
}), /* @__PURE__ */ D("div", {
|
|
1522
|
-
className: f("flex items-center justify-center overflow-auto bg-slate-950", t ? "h-full p-4 pb-[calc(var(--safe-area-bottom)+1rem)]" : "max-h-[calc(100vh-7rem)] p-4"),
|
|
1523
|
-
children: e ? e.type.startsWith("image/") ? /* @__PURE__ */ D("img", {
|
|
1524
|
-
src: e.url,
|
|
1525
|
-
alt: e.name,
|
|
1526
|
-
className: f("object-contain", t ? "h-auto max-h-full w-full max-w-full" : "h-auto w-auto max-h-[calc(100vh-9rem)] max-w-[calc(100vw-5rem)]"),
|
|
1527
|
-
style: qe(t, n),
|
|
1528
|
-
onLoad: (e) => {
|
|
1529
|
-
let t = e.currentTarget;
|
|
1530
|
-
i({
|
|
1531
|
-
width: t.naturalWidth,
|
|
1532
|
-
height: t.naturalHeight
|
|
1533
|
-
});
|
|
1534
|
-
}
|
|
1535
|
-
}) : /* @__PURE__ */ D("iframe", {
|
|
1536
|
-
src: e.url,
|
|
1537
|
-
title: e.name,
|
|
1538
|
-
className: "h-full min-h-[24rem] w-full rounded-xl border border-slate-800 bg-white"
|
|
1539
|
-
}) : null
|
|
1540
|
-
})]
|
|
1541
|
-
})
|
|
1542
|
-
});
|
|
1543
|
-
}
|
|
1544
|
-
//#endregion
|
|
1545
|
-
export { X as a, Ce as c, Fe as i, z as l, ze as n, Oe as o, Ie as r, we as s, Ye as t, ce as u };
|