activeclaw 2026.2.11 → 2026.2.13
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 +106 -0
- package/dist/{accounts-DbzMEfKN.js → accounts-DCDeFTra.js} +2 -2
- package/dist/{accounts-C2elk6PC.js → accounts-DeqIQjo1.js} +2 -2
- package/dist/{acp-cli-CVFTdsQY.js → acp-cli-CeYI4XRd.js} +15 -16
- package/dist/{acp-cli-BpJwIyLl.js → acp-cli-rNbGXICg.js} +14 -15
- package/dist/{agent-Bz1r5O8q.js → agent-BvNJF5QL.js} +19 -15
- package/dist/{agent-22-R4bNS.js → agent-CyMxTyrG.js} +20 -16
- package/dist/{agent-scope-D8miw9q_.js → agent-scope-BIEhVP4_.js} +172 -4
- package/dist/{agent-scope-CGmuusG9.js → agent-scope-CQCus0rI.js} +3 -3
- package/dist/{agent-scope-DQuy3dwI.js → agent-scope-CsRbLH4l.js} +4 -4
- package/dist/{agent-scope-BEf5crnU.js → agent-scope-DPIFau3f.js} +5 -1
- package/dist/audio-preflight-BU8W7uxc.js +60 -0
- package/dist/audio-preflight-CGsumMzb.js +60 -0
- package/dist/audio-preflight-SLmkJI6-.js +74 -0
- package/dist/audio-preflight-jZc5mFCZ.js +71 -0
- package/dist/{audit-C4wLaF0D.js → audit-Dmww_503.js} +71 -19
- package/dist/{audit-CY-yopxa.js → audit-wPu26VMb.js} +72 -20
- package/dist/{tailscale-DU6DgqVy.js → auth-9x3lqfIY.js} +208 -3
- package/dist/{tailscale-Cu-2HNvU.js → auth-CQNl_IaI.js} +190 -3
- package/dist/{auth-health-BFKUoCwJ.js → auth-health-C4L4FGBA.js} +1 -1
- package/dist/{auth-health-d7BMZlWG.js → auth-health-j6epgQbq.js} +1 -1
- package/dist/{auth-profiles-Bv1AEm-Y.js → auth-profiles-ByNs3eEm.js} +87 -31
- package/dist/build-info.json +3 -3
- package/dist/bundled/boot-md/handler.js +28 -22
- package/dist/bundled/session-memory/handler.js +33 -22
- package/dist/{call-7yrB6v4I.js → call-DVYCIV8m.js} +5 -5
- package/dist/{call-Bek1xlgk.js → call-SolyGS1r.js} +6 -6
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/dist/{channel-options-3mdYN0C_.js → channel-options-BwC2yQcR.js} +4 -4
- package/dist/{channel-options-DJ0b1m7B.js → channel-options-Cq9BVDkP.js} +12 -7
- package/dist/{channel-selection-RZimme3j.js → channel-selection-D4D6ImhN.js} +2 -2
- package/dist/{channel-selection-B9b7Kuit.js → channel-selection-MZAHm4U8.js} +2 -2
- package/dist/{channels-cli-CYbK2Dku.js → channels-cli-9Dsk9Qm7.js} +57 -53
- package/dist/{channels-cli-BFznbGOs.js → channels-cli-BJUppQll.js} +59 -55
- package/dist/{channels-status-issues-B3KkflfR.js → channels-status-issues-D7GSV1GS.js} +1 -1
- package/dist/{channels-status-issues-DQkRaZts.js → channels-status-issues-DDAWeT-6.js} +1 -1
- package/dist/{chrome-Db7w64LF.js → chrome-BfB6JdKF.js} +4 -4
- package/dist/{chrome-Dm-EgOjJ.js → chrome-Cvr-57lg.js} +6 -5
- package/dist/{chrome-CF16STk9.js → chrome-DL0avO8n.js} +2 -1
- package/dist/{chrome-yIKmOzCO.js → chrome-foEwx3lN.js} +5 -4
- package/dist/{clack-prompter-BCiBkJVr.js → clack-prompter-Bz3Mmcl-.js} +5 -5
- package/dist/{clack-prompter-DuBVnTKy.js → clack-prompter-ChCGXfyt.js} +4 -4
- package/dist/cli/daemon-cli.js +1 -1
- package/dist/{cli-Cl3PdJei.js → cli-ZR9ugUBX.js} +42 -38
- package/dist/cli-miPe4Ujz.js +93 -0
- package/dist/{client-6xKrRC-1.js → client-BrYfyoDK.js} +54 -5
- package/dist/{client-DMloFP_O.js → client-CTwXnRl7.js} +54 -5
- package/dist/{command-format-ayFsmwwz.js → command-format-Bxe0mWee.js} +1 -1
- package/dist/{command-options-BTAzyqqb.js → command-options-BvgxzPbK.js} +9 -4
- package/dist/{commands-CjEGXOZ_.js → commands-BX_OIIVR.js} +4 -4
- package/dist/{completion-cli-DrJGfJGl.js → completion-cli-CR77-jyv.js} +3 -3
- package/dist/{completion-cli-DOec3E2Z.js → completion-cli-DnjpxAag.js} +30 -30
- package/dist/{config-B00lvFac.js → config-Bdhomfei.js} +21 -7
- package/dist/{config-XBdA0ciN.js → config-BvMsmctM.js} +83 -9
- package/dist/{config-BqGVMf1y.js → config-QYrbd7x7.js} +60 -6
- package/dist/{config--NUdpACy.js → config-aFQssWKX.js} +21 -7
- package/dist/{config-guard-4kCO_rnQ.js → config-guard-CljaSxJd.js} +160 -51
- package/dist/{configure-B69emwZv.js → configure-BXLiucXo.js} +28 -25
- package/dist/{configure-sMhpLzFf.js → configure-BYPqXzGZ.js} +28 -25
- package/dist/control-auth-8Cf4WXpR.js +54 -0
- package/dist/control-auth-DBCu3qyv.js +54 -0
- package/dist/{control-service-Db_1V-KY.js → control-service-B5KnPqGP.js} +11 -5
- package/dist/{control-service-IRAmbcbN.js → control-service-DKnttEus.js} +10 -4
- package/dist/control-ui/assets/{index-CnB9IO4a.js → index-B4LPvte9.js} +369 -369
- package/dist/control-ui/assets/index-B4LPvte9.js.map +1 -0
- package/dist/control-ui/index.html +1 -1
- package/dist/{cron-cli-Cum2324v.js → cron-cli-D7BRjDv2.js} +20 -20
- package/dist/{cron-cli-DhUWcYdk.js → cron-cli-z1zk_FXQ.js} +19 -19
- package/dist/{daemon-cli-q7nkEF5-.js → daemon-cli-BDkU2ocb.js} +60 -21
- package/dist/{daemon-cli-CTC2CHci.js → daemon-cli-cNSF93-v.js} +59 -20
- package/dist/{daemon-runtime-c0uXH4Dl.js → daemon-runtime-B0tg_LsX.js} +3 -3
- package/dist/{daemon-runtime-UsK-tOty.js → daemon-runtime-Bsjeut6m.js} +3 -3
- package/dist/{deliver-hf-WKyWd.js → deliver-CIU9Npgs.js} +373 -281
- package/dist/{deliver-CT6KiDqO.js → deliver-DYYCo1G7.js} +369 -278
- package/dist/{deliver-T9d44OpZ.js → deliver-LsxKETro.js} +371 -279
- package/dist/{deliver-CPy8jYj9.js → deliver-xUU3mGHo.js} +369 -277
- package/dist/{deps-Bv1kLtwo.js → deps-QSwGcoNZ.js} +2 -2
- package/dist/{deps-DFQdAWQc.js → deps-lAAA2zYI.js} +2 -2
- package/dist/{devices-cli-Cm7U1py9.js → devices-cli-BG3-2oqt.js} +14 -14
- package/dist/{devices-cli-ZpjlfK-e.js → devices-cli-VIQtOvt_.js} +14 -14
- package/dist/{directory-cli-B14TUSJA.js → directory-cli-BCJwjVC0.js} +16 -16
- package/dist/{directory-cli-67kzd4I5.js → directory-cli-jYzZ02gk.js} +14 -14
- package/dist/{dispatcher-3ElQWGVI.js → dispatcher-DY51b-Zc.js} +2 -2
- package/dist/{dns-cli-CU-xfhTN.js → dns-cli-DHIiMJjS.js} +12 -12
- package/dist/{dns-cli-Dqj7O6Q_.js → dns-cli-pZlv87Ib.js} +11 -11
- package/dist/{docs-cli-CamBqzb5.js → docs-cli-2JDiwfzP.js} +8 -8
- package/dist/{docs-cli-Cj3L5oqB.js → docs-cli-BhkYqoIQ.js} +7 -7
- package/dist/{doctor-BV1kvbMm.js → doctor-Bf8EhNtA.js} +36 -35
- package/dist/{doctor-BJirShBi.js → doctor-sYG5V4Co.js} +34 -33
- package/dist/entry.js +56 -18
- package/dist/{env-BxRc6wWv.js → env-ONzUVAG2.js} +1 -1
- package/dist/{exec-CijMSZd9.js → exec-B8lXct-k.js} +503 -14
- package/dist/{exec-B8JKbXKW.js → exec-CACT5OAW.js} +1 -1
- package/dist/{exec-57A8Rlc8.js → exec-CJFFoM7H.js} +32 -13
- package/dist/{exec-Cv_Ofd1m.js → exec-YIosokWE.js} +1 -1
- package/dist/{exec-approvals-cli-DEzz9Iai.js → exec-approvals-cli-7LH0lwhO.js} +21 -21
- package/dist/{exec-approvals-cli-DhXj3hQX.js → exec-approvals-cli-apGnQbpj.js} +21 -21
- package/dist/extensionAPI.js +7733 -8746
- package/dist/fetch-DmiOpALK.js +274 -0
- package/dist/fetch-timeout-BEtUjM1S.js +274 -0
- package/dist/fetch-timeout-DEoXG_SF.js +274 -0
- package/dist/fetch-timeout-DTK9vxex.js +274 -0
- package/dist/{gateway-cli-D1EdIq8I.js → gateway-cli-DUdYxlZS.js} +491 -136
- package/dist/{gateway-cli-B_xDUDy2.js → gateway-cli-DbvWmE-9.js} +495 -140
- package/dist/{gateway-rpc-3B5y445n.js → gateway-rpc-BByb2Snz.js} +3 -3
- package/dist/{gateway-rpc-BoL2vinh.js → gateway-rpc-wXSCUZXj.js} +3 -3
- package/dist/{github-copilot-auth-Omqrto0J.js → github-copilot-auth-D7ewvpMd.js} +205 -17
- package/dist/{github-copilot-auth-CZxurvdz.js → github-copilot-auth-DDispnyz.js} +205 -17
- package/dist/{github-copilot-token-SLWintYd.js → github-copilot-token-Cfs0Wxr8.js} +1 -1
- package/dist/{gmail-setup-utils-BXQKsLtI.js → gmail-setup-utils-Cfns8TQx.js} +3 -3
- package/dist/{gmail-setup-utils-CHcssBOA.js → gmail-setup-utils-DJb-_5kO.js} +4 -4
- package/dist/{health-format-Dy1caGsq.js → health-format-KGPokKJH.js} +97 -42
- package/dist/{health-format-DrGFg8bx.js → health-format-LZDxu3rv.js} +95 -40
- package/dist/{help-format-DAj7l5uV.js → help-format-C48TXngO.js} +1 -1
- package/dist/{help-format-CUnac_bT.js → help-format-R5fLToDw.js} +1 -1
- package/dist/{hooks-cli-ptEf6TIM.js → hooks-cli-CT8JCRkH.js} +51 -46
- package/dist/{hooks-cli-Bhf5VRp1.js → hooks-cli-S1MKumJO.js} +49 -44
- package/dist/{hooks-status-Br-2bK2G.js → hooks-status-Cw0xD8Lt.js} +3 -3
- package/dist/{hooks-status-DNQJSa4B.js → hooks-status-D9MhwHRp.js} +3 -3
- package/dist/{image-rOFfK3PJ.js → image-Brk1sJbw.js} +10 -7
- package/dist/{image-fUwR7slg.js → image-C4Nn2p3e.js} +10 -7
- package/dist/{image-Ds4NLGPR.js → image-DgtfXMcX.js} +9 -6
- package/dist/{image-Dnnxt82I.js → image-RKwc3fsL.js} +8 -5
- package/dist/index.js +208 -97
- package/dist/{installs-CRSjQxbR.js → installs-CrLcWYHe.js} +8 -7
- package/dist/{installs-89zeUsVn.js → installs-DscWb9b9.js} +8 -7
- package/dist/{links-7M-j83As.js → links-B8LAzWwg.js} +1 -1
- package/dist/{links-C591fM9M.js → links-Eax1UO3w.js} +1 -1
- package/dist/llm-slug-generator.js +18 -19
- package/dist/{loader-wXwp4rZJ.js → loader-KjT074JR.js} +5722 -6888
- package/dist/{logging-MMRGFxGI.js → logging-BAyPwvdH.js} +1 -1
- package/dist/{logging-DuK6YXuK.js → logging-CRq4h04P.js} +2 -2
- package/dist/{login-qr-wM8BnKJh.js → login-qr-B6ZgAuIf.js} +5 -5
- package/dist/{login-qr-CPEsT6dN.js → login-qr-Bua-p0nG.js} +3 -4
- package/dist/{login-qr-CGEu5TU-.js → login-qr-CuvemJj4.js} +6 -6
- package/dist/{login-qr-DH150tTp.js → login-qr-Djr1JfIf.js} +2 -2
- package/dist/{logs-cli-ClgkHnfT.js → logs-cli-9IAV7rWY.js} +38 -22
- package/dist/{logs-cli-CmfINsOj.js → logs-cli-EiKzUFPa.js} +37 -21
- package/dist/{manager-DYo4PlVM.js → manager-BIMh_eSm.js} +7 -8
- package/dist/{manager-D6EbxDV4.js → manager-CwinWQoz.js} +5 -5
- package/dist/{manager-BbnHek5T.js → manager-DkqF1GiK.js} +9 -9
- package/dist/{manager-CcVYv0N5.js → manager-T1XfGchB.js} +8 -8
- package/dist/{manifest-registry-3It8Z8yN.js → manifest-registry-CQhdnDBZ.js} +40 -2
- package/dist/{manifest-registry-D5SiA3xq.js → manifest-registry-u0okVSkU.js} +40 -2
- package/dist/{message-channel-Cu61-7H6.js → message-channel-BLi2a6Yw.js} +1 -1
- package/dist/{message-channel-BlgPSDAh.js → message-channel-C_MmebBt.js} +1 -1
- package/dist/{model-auth-ioeR_zLX.js → model-auth-CabXIF6O.js} +116 -34
- package/dist/{model-selection-BK7DuyH8.js → model-selection-BLuqsGVB.js} +86 -30
- package/dist/{model-selection-CezC36lH.js → model-selection-C1GmkTAV.js} +84 -28
- package/dist/{models-cli-C3uGdOrd.js → models-cli-9jmDv-h3.js} +52 -48
- package/dist/{models-cli-CUIVPgXE.js → models-cli-zS9rtWz8.js} +53 -49
- package/dist/{node-cli-BxBGSuPE.js → node-cli-CrpTxTTs.js} +28 -26
- package/dist/{node-cli-CdYAsuQQ.js → node-cli-wemUMCg-.js} +28 -26
- package/dist/{node-service-u8g85nD3.js → node-service-C8DTHTMg.js} +2 -2
- package/dist/{node-service-CM5vkdIo.js → node-service-WQuEKz6W.js} +2 -2
- package/dist/{nodes-cli-By6yeCTB.js → nodes-cli-BaU2SIFw.js} +20 -20
- package/dist/{nodes-cli-BaVMTAPc.js → nodes-cli-Dx23D72n.js} +20 -20
- package/dist/{nodes-screen-Dvl_ohUY.js → nodes-screen-C0IuBqUL.js} +1 -1
- package/dist/{note-5WqioBRA.js → note-BhRSeNeu.js} +2 -2
- package/dist/{note-Ci08TSbV.js → note-hhtubr2j.js} +1 -1
- package/dist/{onboard-channels-DxXvp8og.js → onboard-channels-C501x8GI.js} +8 -8
- package/dist/{onboard-channels-CXhnVy4E.js → onboard-channels-Dxzroasd.js} +8 -8
- package/dist/{onboard-skills-CBxsRGyf.js → onboard-skills-DV0Qzvjj.js} +440 -136
- package/dist/{onboard-skills-DQwOQ6Ry.js → onboard-skills-rlBHcu3Q.js} +439 -135
- package/dist/{onboarding-Du_7qEng.js → onboarding-CN-EDLjd.js} +38 -38
- package/dist/{openclaw-root-JLDMp6ux.js → openclaw-root-1VeFrph_.js} +4 -0
- package/dist/{openclaw-root-Dw6gumSU.js → openclaw-root-BNlEap4i.js} +4 -0
- package/dist/{pairing-cli-CRQDpj8f.js → pairing-cli-CDHG4xuI.js} +15 -15
- package/dist/{pairing-cli-Cng1KFWw.js → pairing-cli-CQP34Dlx.js} +15 -15
- package/dist/{pairing-labels-Ciu3Zoxj.js → pairing-labels-B6CN0SNH.js} +1 -1
- package/dist/{pairing-labels-CWFEtSc3.js → pairing-labels-CgNHnjzT.js} +1 -1
- package/dist/{pairing-store-c-QQ2u8p.js → pairing-store-CmlRVqOz.js} +2 -2
- package/dist/{pairing-store-CgXR3ZWJ.js → pairing-store-Dp5_JGnG.js} +3 -3
- package/dist/{path-env-CXWUFfFv.js → path-env-CLvYNwtL.js} +1 -1
- package/dist/{path-env-BgLvMbz_.js → path-env-CaYUVIML.js} +2 -2
- package/dist/{paths-MnZaxqPw.js → paths-B0a4ywSO.js} +30 -5
- package/dist/{paths-Bkhd_qY8.js → paths-B49s6UZQ.js} +30 -5
- package/dist/{paths-DL6EIRTw.js → paths-D0O87MfH.js} +30 -5
- package/dist/{paths-IivnSNkP.js → paths-DLINmNFQ.js} +31 -6
- package/dist/{pi-embedded-CgPTEqlB.js → pi-embedded-Ctrt2kz0.js} +8759 -9600
- package/dist/{pi-embedded-helpers-DYH6OWft.js → pi-embedded-helpers-CMKLjW6X.js} +68 -9
- package/dist/{pi-embedded-helpers-y1_Se0yq.js → pi-embedded-helpers-CUzTc1v6.js} +241 -24
- package/dist/{pi-embedded-helpers-Bkpd4fTr.js → pi-embedded-helpers-DfwkwPYD.js} +67 -8
- package/dist/{pi-embedded-helpers-BbWRSUnc.js → pi-embedded-helpers-WDwx99UA.js} +347 -32
- package/dist/{pi-tools.policy-akYsGFiA.js → pi-tools.policy-BpsROZbz.js} +4 -4
- package/dist/{plugin-auto-enable-lZwe2yX5.js → plugin-auto-enable-Bqhc3w5n.js} +5 -5
- package/dist/{plugin-auto-enable-AOSOJ-v1.js → plugin-auto-enable-PW76g_PJ.js} +5 -5
- package/dist/plugin-sdk/agents/bash-process-registry.d.ts +1 -0
- package/dist/plugin-sdk/agents/models-config.providers.d.ts +10 -0
- package/dist/plugin-sdk/agents/pi-embedded-helpers/errors.d.ts +5 -1
- package/dist/plugin-sdk/agents/pi-embedded-helpers.d.ts +1 -1
- package/dist/plugin-sdk/agents/pi-embedded-runner/google.d.ts +1 -0
- package/dist/plugin-sdk/agents/pi-embedded-runner/run/params.d.ts +2 -0
- package/dist/plugin-sdk/agents/pi-embedded-runner/run/payloads.d.ts +1 -0
- package/dist/plugin-sdk/agents/pi-embedded-runner/run/types.d.ts +2 -0
- package/dist/plugin-sdk/agents/pi-embedded-runner/types.d.ts +15 -0
- package/dist/plugin-sdk/agents/pi-embedded-subscribe.handlers.tools.d.ts +1 -1
- package/dist/plugin-sdk/agents/pi-embedded-subscribe.handlers.types.d.ts +2 -0
- package/dist/plugin-sdk/agents/pi-embedded-subscribe.types.d.ts +2 -0
- package/dist/plugin-sdk/agents/session-tool-result-guard-wrapper.d.ts +2 -0
- package/dist/plugin-sdk/agents/session-tool-result-guard.d.ts +4 -0
- package/dist/plugin-sdk/agents/tools/agent-step.d.ts +3 -0
- package/dist/plugin-sdk/agents/tools/browser-tool.schema.d.ts +1 -1
- package/dist/plugin-sdk/agents/tools/web-search.d.ts +10 -1
- package/dist/plugin-sdk/agents/usage.d.ts +1 -0
- package/dist/plugin-sdk/auto-reply/heartbeat.d.ts +1 -1
- package/dist/plugin-sdk/auto-reply/reply/get-reply-directives.d.ts +1 -0
- package/dist/plugin-sdk/auto-reply/reply/mentions.d.ts +1 -0
- package/dist/plugin-sdk/auto-reply/reply/model-selection.d.ts +3 -0
- package/dist/plugin-sdk/auto-reply/reply/reply-reference.d.ts +1 -1
- package/dist/plugin-sdk/auto-reply/reply/session-run-accounting.d.ts +11 -0
- package/dist/plugin-sdk/auto-reply/reply/session-usage.d.ts +8 -0
- package/dist/plugin-sdk/auto-reply/types.d.ts +2 -0
- package/dist/plugin-sdk/browser/control-auth.d.ts +13 -0
- package/dist/plugin-sdk/channels/plugins/onboarding/signal.d.ts +1 -0
- package/dist/plugin-sdk/cli/prompt.d.ts +1 -0
- package/dist/plugin-sdk/commands/agent/types.d.ts +2 -0
- package/dist/plugin-sdk/commands/onboard-types.d.ts +7 -1
- package/dist/plugin-sdk/config/sessions/paths.d.ts +7 -2
- package/dist/plugin-sdk/config/types.agents.d.ts +2 -0
- package/dist/plugin-sdk/config/types.discord.d.ts +5 -0
- package/dist/plugin-sdk/config/types.gateway.d.ts +15 -0
- package/dist/plugin-sdk/config/types.hooks.d.ts +15 -0
- package/dist/plugin-sdk/config/types.memory.d.ts +2 -0
- package/dist/plugin-sdk/config/zod-schema.agents.d.ts +1 -0
- package/dist/plugin-sdk/config/zod-schema.d.ts +13 -1
- package/dist/plugin-sdk/config/zod-schema.hooks.d.ts +1 -1
- package/dist/plugin-sdk/config/zod-schema.providers-core.d.ts +9 -0
- package/dist/plugin-sdk/config/zod-schema.providers.d.ts +4 -0
- package/dist/plugin-sdk/cron/service/jobs.d.ts +8 -0
- package/dist/plugin-sdk/cron/service/state.d.ts +1 -0
- package/dist/plugin-sdk/cron/types.d.ts +2 -0
- package/dist/plugin-sdk/discord/monitor/allow-list.d.ts +15 -0
- package/dist/plugin-sdk/discord/send.types.d.ts +5 -0
- package/dist/plugin-sdk/gateway/auth.d.ts +36 -0
- package/dist/plugin-sdk/gateway/protocol/index.d.ts +0 -3
- package/dist/plugin-sdk/gateway/protocol/schema/agent.d.ts +7 -1
- package/dist/plugin-sdk/gateway/session-utils.fs.d.ts +3 -1
- package/dist/plugin-sdk/index.js +935 -660
- package/dist/plugin-sdk/infra/binaries.d.ts +3 -0
- package/dist/plugin-sdk/infra/heartbeat-active-hours.d.ts +5 -0
- package/dist/plugin-sdk/infra/heartbeat-runner.d.ts +1 -0
- package/dist/plugin-sdk/infra/net/fetch-guard.d.ts +1 -0
- package/dist/plugin-sdk/infra/net/ssrf.d.ts +1 -0
- package/dist/plugin-sdk/infra/tailscale.d.ts +34 -0
- package/dist/plugin-sdk/infra/tmp-openclaw-dir.d.ts +10 -0
- package/dist/plugin-sdk/logging/console.d.ts +1 -0
- package/dist/plugin-sdk/logging/logger.d.ts +1 -1
- package/dist/plugin-sdk/logging/state.d.ts +1 -0
- package/dist/plugin-sdk/markdown/ir.d.ts +1 -1
- package/dist/plugin-sdk/markdown/whatsapp.d.ts +14 -0
- package/dist/plugin-sdk/media/input-files.d.ts +5 -0
- package/dist/plugin-sdk/media-understanding/audio-preflight.d.ts +16 -0
- package/dist/plugin-sdk/media-understanding/types.d.ts +1 -0
- package/dist/plugin-sdk/memory/backend-config.d.ts +2 -1
- package/dist/plugin-sdk/memory/qmd-manager.d.ts +2 -0
- package/dist/plugin-sdk/memory/qmd-query-parser.d.ts +8 -0
- package/dist/plugin-sdk/process/command-queue.d.ts +16 -0
- package/dist/plugin-sdk/routing/resolve-route.d.ts +3 -1
- package/dist/plugin-sdk/security/external-content.d.ts +1 -1
- package/dist/plugin-sdk/security/secret-equal.d.ts +1 -0
- package/dist/plugin-sdk/sessions/input-provenance.d.ts +16 -0
- package/dist/plugin-sdk/signal/monitor/event-handler.types.d.ts +8 -0
- package/dist/plugin-sdk/signal/monitor/mentions.d.ts +2 -0
- package/dist/plugin-sdk/slack/monitor/commands.d.ts +5 -0
- package/dist/plugin-sdk/telegram/bot-message-context.d.ts +2 -1
- package/dist/plugin-sdk/telegram/send.d.ts +3 -0
- package/dist/plugin-sdk/web/media.d.ts +2 -0
- package/dist/{plugins-Db5BiELK.js → plugins-4Hqd1WGf.js} +3 -3
- package/dist/{plugins-CNaHNND_.js → plugins-X7d_tfTE.js} +4 -4
- package/dist/{plugins-cli-8G-hQPCu.js → plugins-cli-Bgku3EGj.js} +253 -44
- package/dist/{plugins-cli-CDiocaDE.js → plugins-cli-CVToH3if.js} +257 -48
- package/dist/{ports-BeebfNCb.js → ports-qkt29rdC.js} +2 -2
- package/dist/{program-0Cj9YxRN.js → program-Cf7lkBur.js} +82 -80
- package/dist/{progress-DIQJt9Va.js → progress-C9kngsTD.js} +1 -1
- package/dist/{progress-Da1ehW-x.js → progress-DWqhRakV.js} +1 -1
- package/dist/{prompt-style-Dc0C5HC9.js → prompt-style-BFH5D5LN.js} +1 -1
- package/dist/{prompt-style-CjQRlDx4.js → prompt-style-CIbmaxSa.js} +1 -1
- package/dist/{pw-ai-C43wv1ZF.js → pw-ai-8mdv3h-d.js} +7 -6
- package/dist/{pw-ai-COWYvUfG.js → pw-ai-CM1IsSgZ.js} +6 -6
- package/dist/{pw-ai-BxJ-KCIy.js → pw-ai-FGoRVblI.js} +5 -6
- package/dist/{pw-ai-CsvaObGM.js → pw-ai-sS1fRKW_.js} +3 -3
- package/dist/{qmd-manager-CpsjQyaZ.js → qmd-manager-C67Fc8aN.js} +79 -26
- package/dist/{qmd-manager-C9YWFeG6.js → qmd-manager-CXVbfg99.js} +81 -26
- package/dist/{qmd-manager-C02E8ixK.js → qmd-manager-RMRE8Tqt.js} +81 -26
- package/dist/{qmd-manager-BzY2LQTT.js → qmd-manager-pyc_MTIe.js} +78 -23
- package/dist/{register.subclis-DUkirdHn.js → register.subclis-C02e4zuJ.js} +29 -29
- package/dist/{reply--b7BsXGP.js → reply-DICXkh_C.js} +7289 -8455
- package/dist/{routes-DUkEKAc1.js → routes-CmOI1hIH.js} +29 -11
- package/dist/{routes-B4QQiFju.js → routes-DewK5tq2.js} +29 -12
- package/dist/{rpc-CuMtxrRT.js → rpc-DHr30euf.js} +3 -3
- package/dist/{rpc-Blt6MJ4F.js → rpc-T300F8zI.js} +3 -3
- package/dist/{run-main-XZcPA23b.js → run-main-C5wpthq1.js} +84 -82
- package/dist/runner-CY0nmVme.js +1886 -0
- package/dist/runner-Cfm5nTMc.js +1785 -0
- package/dist/runner-D_dujMod.js +1886 -0
- package/dist/runner-DrGYLH5K.js +1785 -0
- package/dist/{sandbox-Aks-9EcZ.js → sandbox-BKYnhYQH.js} +24 -17
- package/dist/{sandbox-DqUO2K83.js → sandbox-Bhjnh1Xg.js} +23 -16
- package/dist/{sandbox-cli-C99Thxi8.js → sandbox-cli-DBsAjZJN.js} +21 -21
- package/dist/{sandbox-cli-CJqRM4V6.js → sandbox-cli-rV9LtFeu.js} +21 -21
- package/dist/{security-cli-iqYLMOz3.js → security-cli-BIwJM_rs.js} +27 -27
- package/dist/{security-cli-DW3lCz-o.js → security-cli-BRjny8Yu.js} +27 -27
- package/dist/{server-context-fX4xiYRh.js → server-context-BGpGs3qd.js} +7 -7
- package/dist/{server-context-8Qt35QdF.js → server-context-Cl0U0vE3.js} +7 -7
- package/dist/{server-node-events-CHWXfb_T.js → server-node-events-CBfTbiTA.js} +48 -44
- package/dist/{server-node-events-BzrEnKLX.js → server-node-events-QCvh8EgI.js} +45 -41
- package/dist/{service-Cd4BxKuo.js → service--nPk7DvT.js} +8 -4
- package/dist/{service-DDPRbf8a.js → service-99RDXwX4.js} +8 -4
- package/dist/{service-audit-CCFxuvKs.js → service-audit-DnLmRGQt.js} +4 -4
- package/dist/{service-audit-x6jCN-6a.js → service-audit-ckBaRCVC.js} +4 -4
- package/dist/{session-cost-usage-CcCEQNuc.js → session-cost-usage-D7HuoSSD.js} +12 -10
- package/dist/{session-cost-usage-PvyVZz-g.js → session-cost-usage-D9hHANWI.js} +12 -10
- package/dist/{shared-ILguacOr.js → shared-Bs4vduG4.js} +3 -3
- package/dist/{shared-CagUDdmp.js → shared-CEY5IkwG.js} +3 -3
- package/dist/{shared-gOyV38rM.js → shared-DRohONn_.js} +4 -4
- package/dist/{shared-BDk_zC9p.js → shared-ICqOZibV.js} +4 -4
- package/dist/{skill-scanner-C_fQzVDu.js → skill-scanner-CucvxYhu.js} +1 -1
- package/dist/{skill-scanner-DrVEHfC6.js → skill-scanner-rHMtUHtP.js} +1 -1
- package/dist/{skills-D5UZZZSY.js → skills-DRjfSQT3.js} +141 -6
- package/dist/{skills-ccAgQ3Ad.js → skills-DprQj9X2.js} +142 -7
- package/dist/{skills-cli-DQilTG3n.js → skills-cli-9WO-C55s.js} +12 -12
- package/dist/{skills-cli-ggyLBtAY.js → skills-cli-B9eej-EW.js} +13 -13
- package/dist/{skills-status-BosMnzIs.js → skills-status-5U3P3YfJ.js} +3 -3
- package/dist/{skills-status-DjtPPMnY.js → skills-status-TDIgVd1K.js} +2 -2
- package/dist/{sqlite-B7FPASCO.js → sqlite-BINzs1U0.js} +2 -2
- package/dist/{sqlite-Btrgi7-j.js → sqlite-D4w5TejA.js} +3 -3
- package/dist/{sqlite-BrQ9tw8B.js → sqlite-DRRHmlug.js} +3 -3
- package/dist/{sqlite-HepBVDoX.js → sqlite-F6PGkEm1.js} +2 -2
- package/dist/{status-BByCntWS.js → status-BKGkKC_v.js} +3 -3
- package/dist/{status-Dt7RE_Yy.js → status-CiHtHdaa.js} +4 -4
- package/dist/{status-zfL4Yej7.js → status-DDWoOpeB.js} +37 -37
- package/dist/{subsystem-Bh1Y_6Uv.js → subsystem-BoExtIHo.js} +52 -17
- package/dist/{system-cli-DwuUkdkH.js → system-cli-B6lr60Io.js} +14 -14
- package/dist/{system-cli-Clqsx8U5.js → system-cli-CprW9G3h.js} +14 -14
- package/dist/{systemd-BEWwfwn0.js → systemd-C0VZriGM.js} +3 -3
- package/dist/{systemd-D6wTPnHi.js → systemd-DrmBtJ5T.js} +3 -3
- package/dist/{systemd-hints-zi4ohCOY.js → systemd-hints-DZtXiVHa.js} +1 -1
- package/dist/{systemd-linger-CDo2UbHM.js → systemd-linger-NC2kl1SC.js} +2 -2
- package/dist/{systemd-linger-BxjTrgoH.js → systemd-linger-xdn3BdPh.js} +2 -2
- package/dist/{table-DEnmtvl5.js → table-B8dx3v4v.js} +2 -2
- package/dist/{table-cCoGqLsk.js → table-CwulTLQp.js} +1 -1
- package/dist/{tool-display-DskiU8Kt.js → tool-display-CZRIDMRm.js} +2 -2
- package/dist/{tool-display-o-dDAlqF.js → tool-display-ClRud3pg.js} +2 -2
- package/dist/{tui-BdJWZdto.js → tui-CVTQn-dC.js} +14 -13
- package/dist/{tui-Bc7XUQGP.js → tui-Lu8FdrlK.js} +13 -14
- package/dist/{tui-cli-BGYh0UL0.js → tui-cli-BLpTj1X9.js} +27 -27
- package/dist/{tui-cli-D3n-O9zB.js → tui-cli-BLx5kL2I.js} +26 -26
- package/dist/{tui-formatters-CA85v4U2.js → tui-formatters-CNySEfJN.js} +6 -6
- package/dist/{tui-formatters-C3NarH24.js → tui-formatters-DePhZK3J.js} +6 -6
- package/dist/{update-JB16aPIY.js → update-DHVxMTpQ.js} +3 -3
- package/dist/{update-Ct9sqJC_.js → update-DU1geolI.js} +3 -3
- package/dist/{update-cli-wWKDS3cm.js → update-cli-C0hUvJWK.js} +89 -71
- package/dist/{update-cli-DDXp_N9B.js → update-cli-Wb1GB3rL.js} +88 -70
- package/dist/{update-runner-ChTf6O6p.js → update-runner--ixK4J3W.js} +11 -11
- package/dist/{update-runner-CmE6cHdn.js → update-runner-7Qa1T9y6.js} +10 -10
- package/dist/{utils-Dk86IbEs.js → utils-BLJAc3ZV.js} +1 -1
- package/dist/{utils-es4ygvQ-.js → utils-Cd9QdCHh.js} +1 -1
- package/dist/{webhooks-cli-CVIE9TtX.js → webhooks-cli-DgcMy7RG.js} +12 -12
- package/dist/{webhooks-cli-BmKSiQQC.js → webhooks-cli-aVzUcJY9.js} +11 -11
- package/dist/{widearea-dns-2ah0bkAj.js → widearea-dns-BaIgNEhY.js} +3 -3
- package/dist/{widearea-dns-CMIG6-74.js → widearea-dns-DzuRdwk5.js} +3 -3
- package/dist/{ws-DtDKpbLR.js → ws-CHCQHs0F.js} +1 -1
- package/dist/{ws-log-BP3z_g6Z.js → ws-log-CIXbLCka.js} +1 -1
- package/dist/{ws-log-D7MkvKhg.js → ws-log-DcQFZByi.js} +2 -2
- package/dist/{wsl-Cwo7X0Un.js → wsl-BUOkxKJu.js} +2 -2
- package/docs/assets/install-script.svg +1 -0
- package/docs/automation/hooks.md +1 -38
- package/docs/automation/webhook.md +43 -2
- package/docs/channels/discord.md +389 -381
- package/docs/channels/imessage.md +229 -218
- package/docs/channels/slack.md +294 -415
- package/docs/channels/telegram.md +401 -505
- package/docs/channels/whatsapp.md +338 -310
- package/docs/ci.md +0 -12
- package/docs/cli/hooks.md +1 -14
- package/docs/cli/index.md +6 -1
- package/docs/cli/logs.md +4 -0
- package/docs/cli/onboard.md +30 -0
- package/docs/cli/plugins.md +20 -1
- package/docs/cli/security.md +1 -0
- package/docs/concepts/memory.md +7 -4
- package/docs/concepts/session-tool.md +1 -0
- package/docs/docs.json +11 -11
- package/docs/gateway/configuration-examples.md +9 -2
- package/docs/gateway/configuration-reference.md +2329 -0
- package/docs/gateway/configuration.md +338 -3304
- package/docs/gateway/index.md +162 -238
- package/docs/gateway/openresponses-http-api.md +15 -0
- package/docs/gateway/security/index.md +3 -0
- package/docs/help/faq.md +9 -0
- package/docs/install/hetzner.md +21 -0
- package/docs/install/installer.md +20 -0
- package/docs/nodes/audio.md +19 -0
- package/docs/platforms/mac/release.md +7 -7
- package/docs/providers/glm.md +3 -3
- package/docs/providers/index.md +1 -0
- package/docs/providers/litellm.md +153 -0
- package/docs/providers/zai.md +2 -2
- package/docs/reference/templates/AGENTS.md +26 -26
- package/docs/reference/templates/HEARTBEAT.md +31 -2
- package/docs/reference/templates/SOUL.md +14 -8
- package/docs/reference/transcript-hygiene.md +18 -0
- package/docs/start/getting-started.md +5 -0
- package/docs/start/wizard-cli-automation.md +17 -0
- package/docs/start/wizard-cli-reference.md +12 -0
- package/docs/tools/browser.md +6 -0
- package/docs/zh-CN/automation/hooks.md +1 -38
- package/docs/zh-CN/cli/hooks.md +1 -14
- package/extensions/bluebubbles/package.json +1 -1
- package/extensions/bluebubbles/src/monitor.test.ts +40 -28
- package/extensions/bluebubbles/src/monitor.ts +0 -4
- package/extensions/copilot-proxy/package.json +1 -1
- package/extensions/diagnostics-otel/package.json +10 -10
- package/extensions/discord/package.json +1 -1
- package/extensions/feishu/package.json +2 -5
- package/extensions/feishu/src/bot.checkBotMentioned.test.ts +64 -0
- package/extensions/feishu/src/bot.ts +1 -1
- package/extensions/feishu/src/channel.test.ts +48 -0
- package/extensions/feishu/src/channel.ts +1 -3
- package/extensions/feishu/src/config-schema.ts +6 -0
- package/extensions/feishu/src/docx.ts +14 -4
- package/extensions/feishu/src/media.test.ts +151 -0
- package/extensions/feishu/src/media.ts +27 -13
- package/extensions/feishu/src/reply-dispatcher.test.ts +116 -0
- package/extensions/feishu/src/reply-dispatcher.ts +124 -67
- package/extensions/feishu/src/streaming-card.ts +223 -0
- package/extensions/feishu/src/targets.test.ts +16 -0
- package/extensions/feishu/src/targets.ts +1 -1
- package/extensions/google-antigravity-auth/package.json +1 -1
- package/extensions/google-gemini-cli-auth/package.json +1 -1
- package/extensions/googlechat/package.json +1 -1
- package/extensions/imessage/package.json +1 -1
- package/extensions/irc/package.json +1 -1
- package/extensions/irc/src/client.ts +1 -1
- package/extensions/line/package.json +1 -1
- package/extensions/llm-task/package.json +1 -1
- package/extensions/lobster/package.json +1 -1
- package/extensions/matrix/CHANGELOG.md +6 -0
- package/extensions/matrix/package.json +2 -2
- package/extensions/mattermost/package.json +1 -1
- package/extensions/memory-core/package.json +1 -1
- package/extensions/memory-lancedb/index.ts +6 -2
- package/extensions/memory-lancedb/package.json +2 -2
- package/extensions/minimax-portal-auth/index.ts +7 -5
- package/extensions/minimax-portal-auth/package.json +1 -1
- package/extensions/msteams/CHANGELOG.md +6 -0
- package/extensions/msteams/package.json +1 -1
- package/extensions/nextcloud-talk/package.json +1 -1
- package/extensions/nostr/CHANGELOG.md +6 -0
- package/extensions/nostr/package.json +2 -2
- package/extensions/open-prose/package.json +1 -1
- package/extensions/signal/package.json +1 -1
- package/extensions/slack/package.json +1 -1
- package/extensions/telegram/package.json +1 -1
- package/extensions/tlon/package.json +1 -1
- package/extensions/twitch/CHANGELOG.md +6 -0
- package/extensions/twitch/package.json +1 -1
- package/extensions/voice-call/CHANGELOG.md +6 -0
- package/extensions/voice-call/package.json +1 -1
- package/extensions/voice-call/src/media-stream.ts +7 -1
- package/extensions/voice-call/src/providers/twilio.test.ts +5 -3
- package/extensions/voice-call/src/providers/twilio.ts +12 -1
- package/extensions/whatsapp/package.json +1 -1
- package/extensions/zalo/CHANGELOG.md +6 -0
- package/extensions/zalo/package.json +1 -1
- package/extensions/zalouser/CHANGELOG.md +6 -0
- package/extensions/zalouser/package.json +1 -1
- package/package.json +26 -22
- package/dist/auth-BcNHFK-i.js +0 -184
- package/dist/auth-BvIPpm7G.js +0 -184
- package/dist/boolean-M-esQJt6.js +0 -30
- package/dist/bundled/soul-evil/HOOK.md +0 -71
- package/dist/bundled/soul-evil/handler.js +0 -194
- package/dist/cli-DJbWJ9aB.js +0 -89
- package/dist/config-CI7EpvlP.js +0 -15
- package/dist/control-ui/assets/index-CnB9IO4a.js.map +0 -1
- package/dist/date-time-c6HTX6IW.js +0 -187
- package/dist/frontmatter-xwTm0734.js +0 -105
- package/dist/parse-duration-De_tAQSe.js +0 -24
- package/dist/session-key-nXYQSv-a.js +0 -167
- package/dist/utils-dp_OM900.js +0 -476
- package/docs/hooks/soul-evil.md +0 -69
- package/docs/zh-CN/hooks/soul-evil.md +0 -72
- /package/dist/{archive-CXhvR9nU.js → archive-beaSfAzA.js} +0 -0
- /package/dist/{brew-BIrWdDps.js → brew-BUIxHEkn.js} +0 -0
- /package/dist/{brew-B7YK4ZoL.js → brew-ROHf0-Xp.js} +0 -0
- /package/dist/{cli-utils-PlLcDZlM.js → cli-utils-CRhVAaLV.js} +0 -0
- /package/dist/{cli-utils-R-ECs5cY.js → cli-utils-LcHOt63h.js} +0 -0
- /package/dist/{command-format-BUxhT1xL.js → command-format-qUVxzqYm.js} +0 -0
- /package/dist/{constants-CNTiY-ZN.js → constants-BvQ6S8j5.js} +0 -0
- /package/dist/{constants-DuoCkWRh.js → constants-JPeoOZnw.js} +0 -0
- /package/dist/{errors-D3tYRJWG.js → errors-B91HIDPD.js} +0 -0
- /package/dist/{errors-B0eT3jVv.js → errors-Bv81hF2P.js} +0 -0
- /package/dist/{errors-x4NYs-1P.js → errors-DjZBTJJ3.js} +0 -0
- /package/dist/{exec-approvals-DGPTjO0N.js → exec-approvals-Cb4ZLukq.js} +0 -0
- /package/dist/{exec-approvals-DhmKpiIo.js → exec-approvals-DQ8TVVmj.js} +0 -0
- /package/dist/{format-CaxeRcue.js → format-CNU-Zkrz.js} +0 -0
- /package/dist/{format-DLOJPZmo.js → format-DcfK-dwd.js} +0 -0
- /package/dist/{format-duration-Be5Z7JdJ.js → format-duration-84n6_DgO.js} +0 -0
- /package/dist/{format-duration-CEmFWLyX.js → format-duration-Bo9zNKwO.js} +0 -0
- /package/dist/{format-relative-79_Y1n2Y.js → format-relative-CZOlQ2pA.js} +0 -0
- /package/dist/{format-relative-Db7eqEu8.js → format-relative-cegC_FF5.js} +0 -0
- /package/dist/{github-copilot-token-C9IJh2Pn.js → github-copilot-token-DkiRbJdR.js} +0 -0
- /package/dist/{helpers-CQI-5xS9.js → helpers-8O7IVGO-.js} +0 -0
- /package/dist/{helpers-CRzoyyXS.js → helpers-D_jqdWkd.js} +0 -0
- /package/dist/{helpers-C89IG08W.js → helpers-HyeZXsnu.js} +0 -0
- /package/dist/{is-main-WWuz28Ip.js → is-main-BWoXGz7p.js} +0 -0
- /package/dist/{logging-BzvBIA3Y.js → logging-fywhKCmE.js} +0 -0
- /package/dist/{nodes-screen-lykd2cny.js → nodes-screen-CdCWeiwy.js} +0 -0
- /package/dist/{parse-Cjiudy6x.js → parse-Bw0oH-rT.js} +0 -0
- /package/dist/{parse-DqAvJRIf.js → parse-ioZhOtha.js} +0 -0
- /package/dist/{parse-log-line-CUrpqe1w.js → parse-log-line-BoDqomM4.js} +0 -0
- /package/dist/{parse-log-line-D2UGw0wR.js → parse-log-line-DPxH1XZx.js} +0 -0
- /package/dist/{parse-timeout-DFSPLxpY.js → parse-timeout-D1XX_zN_.js} +0 -0
- /package/dist/{parse-timeout-DV8NQQWk.js → parse-timeout-DMW-z4Iz.js} +0 -0
- /package/dist/{pi-model-discovery-CV2V1HHz.js → pi-model-discovery-DqgqUyAv.js} +0 -0
- /package/dist/{pi-model-discovery-DzFOAbQt.js → pi-model-discovery-EwKVHlZB.js} +0 -0
- /package/dist/{prompts--d-6l5Ln.js → prompts-Bg96reub.js} +0 -0
- /package/dist/{redact-DAKeu7PA.js → redact-BRsnXqwD.js} +0 -0
- /package/dist/{redact-DuEEf1p1.js → redact-Br9GfacZ.js} +0 -0
- /package/dist/{redact-BOIof271.js → redact-BrXLgslJ.js} +0 -0
- /package/dist/{status-Cv36yYdi.js → status-BRZfQbJ2.js} +0 -0
- /package/dist/{status-Drziap9H.js → status-CoAy6bEC.js} +0 -0
- /package/dist/{systemd-hints-CH4pbCFD.js → systemd-hints-CXNtLw9Q.js} +0 -0
- /package/dist/{tailnet-DGRSvYuQ.js → tailnet-DATIFSsY.js} +0 -0
- /package/dist/{transcript-events-BlIONGVn.js → transcript-events-BHS7QoRl.js} +0 -0
- /package/dist/{transcript-events-C1hdue6u.js → transcript-events-Bp7fGnwv.js} +0 -0
- /package/dist/{transcript-events-CZ8CG4ht.js → transcript-events-BtNd-j6q.js} +0 -0
- /package/dist/{usage-format-6Uar63S0.js → usage-format-C4JfTbSp.js} +0 -0
- /package/dist/{usage-format-hd37en6b.js → usage-format-CpORtVCG.js} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const a of i)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function s(i){if(i.ep)return;i.ep=!0;const a=n(i);fetch(i.href,a)}})();const
|
|
2
|
-
\f\r]`,Dt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,
|
|
3
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),Fa=/'/g,Na=/"/g,ar=/^(?:script|style|textarea|title)$/i,or=e=>(t,...n)=>({_$litType$:e,strings:t,values:n}),r=or(1),mn=or(2),Qe=Symbol.for("lit-noChange"),v=Symbol.for("lit-nothing"),Oa=new WeakMap,dt=gt.createTreeWalker(gt,129);function rr(e,t){if(!Si(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ra!==void 0?Ra.createHTML(t):t}const cc=(e,t)=>{const n=e.length-1,s=[];let i,a=t===2?"<svg>":t===3?"<math>":"",o=Dt;for(let l=0;l<n;l++){const c=e[l];let u,g,p=-1,h=0;for(;h<c.length&&(o.lastIndex=h,g=o.exec(c),g!==null);)h=o.lastIndex,o===Dt?g[1]==="!--"?o=Pa:g[1]!==void 0?o=Da:g[2]!==void 0?(ar.test(g[2])&&(i=RegExp("</"+g[2],"g")),o=nt):g[3]!==void 0&&(o=nt):o===nt?g[0]===">"?(o=i??Dt,p=-1):g[1]===void 0?p=-2:(p=o.lastIndex-g[2].length,u=g[1],o=g[3]===void 0?nt:g[3]==='"'?Na:Fa):o===Na||o===Fa?o=nt:o===Pa||o===Da?o=Dt:(o=nt,i=void 0);const d=o===nt&&e[l+1].startsWith("/>")?" ":"";a+=o===Dt?c+rc:p>=0?(s.push(u),c.slice(0,p)+sr+c.slice(p)+Ge+d):c+Ge+(p===-2?l:d)}return[rr(e,a+(e[n]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]};let qs=class lr{constructor({strings:t,_$litType$:n},s){let i;this.parts=[];let a=0,o=0;const l=t.length-1,c=this.parts,[u,g]=cc(t,n);if(this.el=lr.createElement(u,s),dt.currentNode=this.el.content,n===2||n===3){const p=this.el.content.firstChild;p.replaceWith(...p.childNodes)}for(;(i=dt.nextNode())!==null&&c.length<l;){if(i.nodeType===1){if(i.hasAttributes())for(const p of i.getAttributeNames())if(p.endsWith(sr)){const h=g[o++],d=i.getAttribute(p).split(Ge),f=/([.?@])?(.*)/.exec(h);c.push({type:1,index:a,name:f[2],strings:d,ctor:f[1]==="."?uc:f[1]==="?"?gc:f[1]==="@"?pc:Qn}),i.removeAttribute(p)}else p.startsWith(Ge)&&(c.push({type:6,index:a}),i.removeAttribute(p));if(ar.test(i.tagName)){const p=i.textContent.split(Ge),h=p.length-1;if(h>0){i.textContent=Fn?Fn.emptyScript:"";for(let d=0;d<h;d++)i.append(p[d],Zt()),dt.nextNode(),c.push({type:2,index:++a});i.append(p[h],Zt())}}}else if(i.nodeType===8)if(i.data===ir)c.push({type:2,index:a});else{let p=-1;for(;(p=i.data.indexOf(Ge,p+1))!==-1;)c.push({type:7,index:a}),p+=Ge.length-1}a++}}static createElement(t,n){const s=gt.createElement("template");return s.innerHTML=t,s}};function Et(e,t,n=e,s){if(t===Qe)return t;let i=s!==void 0?n._$Co?.[s]:n._$Cl;const a=Xt(t)?void 0:t._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),a===void 0?i=void 0:(i=new a(e),i._$AT(e,n,s)),s!==void 0?(n._$Co??=[])[s]=i:n._$Cl=i),i!==void 0&&(t=Et(e,i._$AS(e,t.values),i,s)),t}class dc{constructor(t,n){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=n}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:n},parts:s}=this._$AD,i=(t?.creationScope??gt).importNode(n,!0);dt.currentNode=i;let a=dt.nextNode(),o=0,l=0,c=s[0];for(;c!==void 0;){if(o===c.index){let u;c.type===2?u=new Vn(a,a.nextSibling,this,t):c.type===1?u=new c.ctor(a,c.name,c.strings,this,t):c.type===6&&(u=new fc(a,this,t)),this._$AV.push(u),c=s[++l]}o!==c?.index&&(a=dt.nextNode(),o++)}return dt.currentNode=gt,i}p(t){let n=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(t,s,n),n+=s.strings.length-2):s._$AI(t[n])),n++}}let Vn=class cr{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,n,s,i){this.type=2,this._$AH=v,this._$AN=void 0,this._$AA=t,this._$AB=n,this._$AM=s,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const n=this._$AM;return n!==void 0&&t?.nodeType===11&&(t=n.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,n=this){t=Et(this,t,n),Xt(t)?t===v||t==null||t===""?(this._$AH!==v&&this._$AR(),this._$AH=v):t!==this._$AH&&t!==Qe&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):lc(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==v&&Xt(this._$AH)?this._$AA.nextSibling.data=t:this.T(gt.createTextNode(t)),this._$AH=t}$(t){const{values:n,_$litType$:s}=t,i=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=qs.createElement(rr(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(n);else{const a=new dc(i,this),o=a.u(this.options);a.p(n),this.T(o),this._$AH=a}}_$AC(t){let n=Oa.get(t.strings);return n===void 0&&Oa.set(t.strings,n=new qs(t)),n}k(t){Si(this._$AH)||(this._$AH=[],this._$AR());const n=this._$AH;let s,i=0;for(const a of t)i===n.length?n.push(s=new cr(this.O(Zt()),this.O(Zt()),this,this.options)):s=n[i],s._$AI(a),i++;i<n.length&&(this._$AR(s&&s._$AB.nextSibling,i),n.length=i)}_$AR(t=this._$AA.nextSibling,n){for(this._$AP?.(!1,!0,n);t!==this._$AB;){const s=Ia(t).nextSibling;Ia(t).remove(),t=s}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}};class Qn{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,n,s,i,a){this.type=1,this._$AH=v,this._$AN=void 0,this.element=t,this.name=n,this._$AM=i,this.options=a,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=v}_$AI(t,n=this,s,i){const a=this.strings;let o=!1;if(a===void 0)t=Et(this,t,n,0),o=!Xt(t)||t!==this._$AH&&t!==Qe,o&&(this._$AH=t);else{const l=t;let c,u;for(t=a[0],c=0;c<a.length-1;c++)u=Et(this,l[s+c],n,c),u===Qe&&(u=this._$AH[c]),o||=!Xt(u)||u!==this._$AH[c],u===v?t=v:t!==v&&(t+=(u??"")+a[c+1]),this._$AH[c]=u}o&&!i&&this.j(t)}j(t){t===v?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}let uc=class extends Qn{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===v?void 0:t}},gc=class extends Qn{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==v)}},pc=class extends Qn{constructor(t,n,s,i,a){super(t,n,s,i,a),this.type=5}_$AI(t,n=this){if((t=Et(this,t,n,0)??v)===Qe)return;const s=this._$AH,i=t===v&&s!==v||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,a=t!==v&&(s===v||i);i&&this.element.removeEventListener(this.name,this,s),a&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},fc=class{constructor(t,n,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=n,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){Et(this,t)}};const hc={I:Vn},vc=ki.litHtmlPolyfillSupport;vc?.(qs,Vn),(ki.litHtmlVersions??=[]).push("3.3.2");const mc=(e,t,n)=>{const s=n?.renderBefore??t;let i=s._$litPart$;if(i===void 0){const a=n?.renderBefore??null;s._$litPart$=i=new Vn(t.insertBefore(Zt(),a),a,void 0,n??{})}return i._$AI(e),i};const Ai=globalThis;let _t=class extends Ct{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const n=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=mc(n,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Qe}};_t._$litElement$=!0,_t.finalized=!0,Ai.litElementHydrateSupport?.({LitElement:_t});const bc=Ai.litElementPolyfillSupport;bc?.({LitElement:_t});(Ai.litElementVersions??=[]).push("4.2.2");const dr=e=>(t,n)=>{n!==void 0?n.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)};const yc={attribute:!0,type:String,converter:Dn,reflect:!1,hasChanged:wi},xc=(e=yc,t,n)=>{const{kind:s,metadata:i}=n;let a=globalThis.litPropertyMetadata.get(i);if(a===void 0&&globalThis.litPropertyMetadata.set(i,a=new Map),s==="setter"&&((e=Object.create(e)).wrapped=!0),a.set(n.name,e),s==="accessor"){const{name:o}=n;return{set(l){const c=t.get.call(this);t.set.call(this,l),this.requestUpdate(o,c,e,!0,l)},init(l){return l!==void 0&&this.C(o,void 0,e,l),l}}}if(s==="setter"){const{name:o}=n;return function(l){const c=this[o];t.call(this,l),this.requestUpdate(o,c,e,!0,l)}}throw Error("Unsupported decorator location: "+s)};function Yn(e){return(t,n)=>typeof n=="object"?xc(e,t,n):((s,i,a)=>{const o=i.hasOwnProperty(a);return i.constructor.createProperty(a,s),o?Object.getOwnPropertyDescriptor(i,a):void 0})(e,t,n)}function w(e){return Yn({...e,state:!0,attribute:!1})}async function ye(e,t){if(!(!e.client||!e.connected)&&!e.channelsLoading){e.channelsLoading=!0,e.channelsError=null;try{const n=await e.client.request("channels.status",{probe:t,timeoutMs:8e3});e.channelsSnapshot=n,e.channelsLastSuccess=Date.now()}catch(n){e.channelsError=String(n)}finally{e.channelsLoading=!1}}}async function $c(e,t){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{const n=await e.client.request("web.login.start",{force:t,timeoutMs:3e4});e.whatsappLoginMessage=n.message??null,e.whatsappLoginQrDataUrl=n.qrDataUrl??null,e.whatsappLoginConnected=null}catch(n){e.whatsappLoginMessage=String(n),e.whatsappLoginQrDataUrl=null,e.whatsappLoginConnected=null}finally{e.whatsappBusy=!1}}}async function wc(e){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{const t=await e.client.request("web.login.wait",{timeoutMs:12e4});e.whatsappLoginMessage=t.message??null,e.whatsappLoginConnected=t.connected??null,t.connected&&(e.whatsappLoginQrDataUrl=null)}catch(t){e.whatsappLoginMessage=String(t),e.whatsappLoginConnected=null}finally{e.whatsappBusy=!1}}}async function kc(e){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{await e.client.request("channels.logout",{channel:"whatsapp"}),e.whatsappLoginMessage="Logged out.",e.whatsappLoginQrDataUrl=null,e.whatsappLoginConnected=null}catch(t){e.whatsappLoginMessage=String(t)}finally{e.whatsappBusy=!1}}}function pt(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}function Lt(e){return`${JSON.stringify(e,null,2).trimEnd()}
|
|
4
|
-
`}function
|
|
1
|
+
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const a of i)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function s(i){if(i.ep)return;i.ep=!0;const a=n(i);fetch(i.href,a)}})();const Mn=globalThis,$i=Mn.ShadowRoot&&(Mn.ShadyCSS===void 0||Mn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,wi=Symbol(),Ea=new WeakMap;let ar=class{constructor(t,n,s){if(this._$cssResult$=!0,s!==wi)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=n}get styleSheet(){let t=this.o;const n=this.t;if($i&&t===void 0){const s=n!==void 0&&n.length===1;s&&(t=Ea.get(n)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&Ea.set(n,t))}return t}toString(){return this.cssText}};const sc=e=>new ar(typeof e=="string"?e:e+"",void 0,wi),ic=(e,...t)=>{const n=e.length===1?e[0]:t.reduce((s,i,a)=>s+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+e[a+1],e[0]);return new ar(n,e,wi)},ac=(e,t)=>{if($i)e.adoptedStyleSheets=t.map(n=>n instanceof CSSStyleSheet?n:n.styleSheet);else for(const n of t){const s=document.createElement("style"),i=Mn.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=n.cssText,e.appendChild(s)}},La=$i?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let n="";for(const s of t.cssRules)n+=s.cssText;return sc(n)})(e):e;const{is:oc,defineProperty:rc,getOwnPropertyDescriptor:lc,getOwnPropertyNames:cc,getOwnPropertySymbols:dc,getPrototypeOf:uc}=Object,Vn=globalThis,Ma=Vn.trustedTypes,gc=Ma?Ma.emptyScript:"",pc=Vn.reactiveElementPolyfillSupport,qt=(e,t)=>e,Fn={toAttribute(e,t){switch(t){case Boolean:e=e?gc:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=e!==null;break;case Number:n=e===null?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch{n=null}}return n}},ki=(e,t)=>!oc(e,t),Ia={attribute:!0,type:String,converter:Fn,reflect:!1,useDefault:!1,hasChanged:ki};Symbol.metadata??=Symbol("metadata"),Vn.litPropertyMetadata??=new WeakMap;let Tt=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,n=Ia){if(n.state&&(n.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((n=Object.create(n)).wrapped=!0),this.elementProperties.set(t,n),!n.noAccessor){const s=Symbol(),i=this.getPropertyDescriptor(t,s,n);i!==void 0&&rc(this.prototype,t,i)}}static getPropertyDescriptor(t,n,s){const{get:i,set:a}=lc(this.prototype,t)??{get(){return this[n]},set(o){this[n]=o}};return{get:i,set(o){const l=i?.call(this);a?.call(this,o),this.requestUpdate(t,l,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Ia}static _$Ei(){if(this.hasOwnProperty(qt("elementProperties")))return;const t=uc(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(qt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(qt("properties"))){const n=this.properties,s=[...cc(n),...dc(n)];for(const i of s)this.createProperty(i,n[i])}const t=this[Symbol.metadata];if(t!==null){const n=litPropertyMetadata.get(t);if(n!==void 0)for(const[s,i]of n)this.elementProperties.set(s,i)}this._$Eh=new Map;for(const[n,s]of this.elementProperties){const i=this._$Eu(n,s);i!==void 0&&this._$Eh.set(i,n)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const n=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const i of s)n.unshift(La(i))}else t!==void 0&&n.push(La(t));return n}static _$Eu(t,n){const s=n.attribute;return s===!1?void 0:typeof s=="string"?s:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,n=this.constructor.elementProperties;for(const s of n.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return ac(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,n,s){this._$AK(t,s)}_$ET(t,n){const s=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,s);if(i!==void 0&&s.reflect===!0){const a=(s.converter?.toAttribute!==void 0?s.converter:Fn).toAttribute(n,s.type);this._$Em=t,a==null?this.removeAttribute(i):this.setAttribute(i,a),this._$Em=null}}_$AK(t,n){const s=this.constructor,i=s._$Eh.get(t);if(i!==void 0&&this._$Em!==i){const a=s.getPropertyOptions(i),o=typeof a.converter=="function"?{fromAttribute:a.converter}:a.converter?.fromAttribute!==void 0?a.converter:Fn;this._$Em=i;const l=o.fromAttribute(n,a.type);this[i]=l??this._$Ej?.get(i)??l,this._$Em=null}}requestUpdate(t,n,s,i=!1,a){if(t!==void 0){const o=this.constructor;if(i===!1&&(a=this[t]),s??=o.getPropertyOptions(t),!((s.hasChanged??ki)(a,n)||s.useDefault&&s.reflect&&a===this._$Ej?.get(t)&&!this.hasAttribute(o._$Eu(t,s))))return;this.C(t,n,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,n,{useDefault:s,reflect:i,wrapped:a},o){s&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,o??n??this[t]),a!==!0||o!==void 0)||(this._$AL.has(t)||(this.hasUpdated||s||(n=void 0),this._$AL.set(t,n)),i===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(n){Promise.reject(n)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[i,a]of this._$Ep)this[i]=a;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[i,a]of s){const{wrapped:o}=a,l=this[i];o!==!0||this._$AL.has(i)||l===void 0||this.C(i,void 0,a,l)}}let t=!1;const n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),this._$EO?.forEach(s=>s.hostUpdate?.()),this.update(n)):this._$EM()}catch(s){throw t=!1,this._$EM(),s}t&&this._$AE(n)}willUpdate(t){}_$AE(t){this._$EO?.forEach(n=>n.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(n=>this._$ET(n,this[n])),this._$EM()}updated(t){}firstUpdated(t){}};Tt.elementStyles=[],Tt.shadowRootOptions={mode:"open"},Tt[qt("elementProperties")]=new Map,Tt[qt("finalized")]=new Map,pc?.({ReactiveElement:Tt}),(Vn.reactiveElementVersions??=[]).push("2.1.2");const Si=globalThis,Ra=e=>e,Nn=Si.trustedTypes,Pa=Nn?Nn.createPolicy("lit-html",{createHTML:e=>e}):void 0,or="$lit$",Ve=`lit$${Math.random().toFixed(9).slice(2)}$`,rr="?"+Ve,fc=`<${rr}>`,pt=document,Zt=()=>pt.createComment(""),Xt=e=>e===null||typeof e!="object"&&typeof e!="function",Ai=Array.isArray,hc=e=>Ai(e)||typeof e?.[Symbol.iterator]=="function",ws=`[
|
|
2
|
+
\f\r]`,Dt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Da=/-->/g,Fa=/>/g,st=RegExp(`>|${ws}(?:([^\\s"'>=/]+)(${ws}*=${ws}*(?:[^
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Na=/'/g,Oa=/"/g,lr=/^(?:script|style|textarea|title)$/i,cr=e=>(t,...n)=>({_$litType$:e,strings:t,values:n}),r=cr(1),bn=cr(2),Ye=Symbol.for("lit-noChange"),v=Symbol.for("lit-nothing"),Ba=new WeakMap,ut=pt.createTreeWalker(pt,129);function dr(e,t){if(!Ai(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return Pa!==void 0?Pa.createHTML(t):t}const vc=(e,t)=>{const n=e.length-1,s=[];let i,a=t===2?"<svg>":t===3?"<math>":"",o=Dt;for(let l=0;l<n;l++){const c=e[l];let u,g,p=-1,h=0;for(;h<c.length&&(o.lastIndex=h,g=o.exec(c),g!==null);)h=o.lastIndex,o===Dt?g[1]==="!--"?o=Da:g[1]!==void 0?o=Fa:g[2]!==void 0?(lr.test(g[2])&&(i=RegExp("</"+g[2],"g")),o=st):g[3]!==void 0&&(o=st):o===st?g[0]===">"?(o=i??Dt,p=-1):g[1]===void 0?p=-2:(p=o.lastIndex-g[2].length,u=g[1],o=g[3]===void 0?st:g[3]==='"'?Oa:Na):o===Oa||o===Na?o=st:o===Da||o===Fa?o=Dt:(o=st,i=void 0);const d=o===st&&e[l+1].startsWith("/>")?" ":"";a+=o===Dt?c+fc:p>=0?(s.push(u),c.slice(0,p)+or+c.slice(p)+Ve+d):c+Ve+(p===-2?l:d)}return[dr(e,a+(e[n]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]};let Gs=class ur{constructor({strings:t,_$litType$:n},s){let i;this.parts=[];let a=0,o=0;const l=t.length-1,c=this.parts,[u,g]=vc(t,n);if(this.el=ur.createElement(u,s),ut.currentNode=this.el.content,n===2||n===3){const p=this.el.content.firstChild;p.replaceWith(...p.childNodes)}for(;(i=ut.nextNode())!==null&&c.length<l;){if(i.nodeType===1){if(i.hasAttributes())for(const p of i.getAttributeNames())if(p.endsWith(or)){const h=g[o++],d=i.getAttribute(p).split(Ve),f=/([.?@])?(.*)/.exec(h);c.push({type:1,index:a,name:f[2],strings:d,ctor:f[1]==="."?bc:f[1]==="?"?yc:f[1]==="@"?xc:Yn}),i.removeAttribute(p)}else p.startsWith(Ve)&&(c.push({type:6,index:a}),i.removeAttribute(p));if(lr.test(i.tagName)){const p=i.textContent.split(Ve),h=p.length-1;if(h>0){i.textContent=Nn?Nn.emptyScript:"";for(let d=0;d<h;d++)i.append(p[d],Zt()),ut.nextNode(),c.push({type:2,index:++a});i.append(p[h],Zt())}}}else if(i.nodeType===8)if(i.data===rr)c.push({type:2,index:a});else{let p=-1;for(;(p=i.data.indexOf(Ve,p+1))!==-1;)c.push({type:7,index:a}),p+=Ve.length-1}a++}}static createElement(t,n){const s=pt.createElement("template");return s.innerHTML=t,s}};function Lt(e,t,n=e,s){if(t===Ye)return t;let i=s!==void 0?n._$Co?.[s]:n._$Cl;const a=Xt(t)?void 0:t._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),a===void 0?i=void 0:(i=new a(e),i._$AT(e,n,s)),s!==void 0?(n._$Co??=[])[s]=i:n._$Cl=i),i!==void 0&&(t=Lt(e,i._$AS(e,t.values),i,s)),t}class mc{constructor(t,n){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=n}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:n},parts:s}=this._$AD,i=(t?.creationScope??pt).importNode(n,!0);ut.currentNode=i;let a=ut.nextNode(),o=0,l=0,c=s[0];for(;c!==void 0;){if(o===c.index){let u;c.type===2?u=new Qn(a,a.nextSibling,this,t):c.type===1?u=new c.ctor(a,c.name,c.strings,this,t):c.type===6&&(u=new $c(a,this,t)),this._$AV.push(u),c=s[++l]}o!==c?.index&&(a=ut.nextNode(),o++)}return ut.currentNode=pt,i}p(t){let n=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(t,s,n),n+=s.strings.length-2):s._$AI(t[n])),n++}}let Qn=class gr{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,n,s,i){this.type=2,this._$AH=v,this._$AN=void 0,this._$AA=t,this._$AB=n,this._$AM=s,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const n=this._$AM;return n!==void 0&&t?.nodeType===11&&(t=n.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,n=this){t=Lt(this,t,n),Xt(t)?t===v||t==null||t===""?(this._$AH!==v&&this._$AR(),this._$AH=v):t!==this._$AH&&t!==Ye&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):hc(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==v&&Xt(this._$AH)?this._$AA.nextSibling.data=t:this.T(pt.createTextNode(t)),this._$AH=t}$(t){const{values:n,_$litType$:s}=t,i=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=Gs.createElement(dr(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(n);else{const a=new mc(i,this),o=a.u(this.options);a.p(n),this.T(o),this._$AH=a}}_$AC(t){let n=Ba.get(t.strings);return n===void 0&&Ba.set(t.strings,n=new Gs(t)),n}k(t){Ai(this._$AH)||(this._$AH=[],this._$AR());const n=this._$AH;let s,i=0;for(const a of t)i===n.length?n.push(s=new gr(this.O(Zt()),this.O(Zt()),this,this.options)):s=n[i],s._$AI(a),i++;i<n.length&&(this._$AR(s&&s._$AB.nextSibling,i),n.length=i)}_$AR(t=this._$AA.nextSibling,n){for(this._$AP?.(!1,!0,n);t!==this._$AB;){const s=Ra(t).nextSibling;Ra(t).remove(),t=s}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}};class Yn{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,n,s,i,a){this.type=1,this._$AH=v,this._$AN=void 0,this.element=t,this.name=n,this._$AM=i,this.options=a,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=v}_$AI(t,n=this,s,i){const a=this.strings;let o=!1;if(a===void 0)t=Lt(this,t,n,0),o=!Xt(t)||t!==this._$AH&&t!==Ye,o&&(this._$AH=t);else{const l=t;let c,u;for(t=a[0],c=0;c<a.length-1;c++)u=Lt(this,l[s+c],n,c),u===Ye&&(u=this._$AH[c]),o||=!Xt(u)||u!==this._$AH[c],u===v?t=v:t!==v&&(t+=(u??"")+a[c+1]),this._$AH[c]=u}o&&!i&&this.j(t)}j(t){t===v?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}let bc=class extends Yn{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===v?void 0:t}},yc=class extends Yn{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==v)}},xc=class extends Yn{constructor(t,n,s,i,a){super(t,n,s,i,a),this.type=5}_$AI(t,n=this){if((t=Lt(this,t,n,0)??v)===Ye)return;const s=this._$AH,i=t===v&&s!==v||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,a=t!==v&&(s===v||i);i&&this.element.removeEventListener(this.name,this,s),a&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},$c=class{constructor(t,n,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=n,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){Lt(this,t)}};const wc={I:Qn},kc=Si.litHtmlPolyfillSupport;kc?.(Gs,Qn),(Si.litHtmlVersions??=[]).push("3.3.2");const Sc=(e,t,n)=>{const s=n?.renderBefore??t;let i=s._$litPart$;if(i===void 0){const a=n?.renderBefore??null;s._$litPart$=i=new Qn(t.insertBefore(Zt(),a),a,void 0,n??{})}return i._$AI(e),i};const Ci=globalThis;let Et=class extends Tt{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const n=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Sc(n,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Ye}};Et._$litElement$=!0,Et.finalized=!0,Ci.litElementHydrateSupport?.({LitElement:Et});const Ac=Ci.litElementPolyfillSupport;Ac?.({LitElement:Et});(Ci.litElementVersions??=[]).push("4.2.2");const pr=e=>(t,n)=>{n!==void 0?n.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)};const Cc={attribute:!0,type:String,converter:Fn,reflect:!1,hasChanged:ki},Tc=(e=Cc,t,n)=>{const{kind:s,metadata:i}=n;let a=globalThis.litPropertyMetadata.get(i);if(a===void 0&&globalThis.litPropertyMetadata.set(i,a=new Map),s==="setter"&&((e=Object.create(e)).wrapped=!0),a.set(n.name,e),s==="accessor"){const{name:o}=n;return{set(l){const c=t.get.call(this);t.set.call(this,l),this.requestUpdate(o,c,e,!0,l)},init(l){return l!==void 0&&this.C(o,void 0,e,l),l}}}if(s==="setter"){const{name:o}=n;return function(l){const c=this[o];t.call(this,l),this.requestUpdate(o,c,e,!0,l)}}throw Error("Unsupported decorator location: "+s)};function Jn(e){return(t,n)=>typeof n=="object"?Tc(e,t,n):((s,i,a)=>{const o=i.hasOwnProperty(a);return i.constructor.createProperty(a,s),o?Object.getOwnPropertyDescriptor(i,a):void 0})(e,t,n)}function w(e){return Jn({...e,state:!0,attribute:!1})}async function ye(e,t){if(!(!e.client||!e.connected)&&!e.channelsLoading){e.channelsLoading=!0,e.channelsError=null;try{const n=await e.client.request("channels.status",{probe:t,timeoutMs:8e3});e.channelsSnapshot=n,e.channelsLastSuccess=Date.now()}catch(n){e.channelsError=String(n)}finally{e.channelsLoading=!1}}}async function _c(e,t){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{const n=await e.client.request("web.login.start",{force:t,timeoutMs:3e4});e.whatsappLoginMessage=n.message??null,e.whatsappLoginQrDataUrl=n.qrDataUrl??null,e.whatsappLoginConnected=null}catch(n){e.whatsappLoginMessage=String(n),e.whatsappLoginQrDataUrl=null,e.whatsappLoginConnected=null}finally{e.whatsappBusy=!1}}}async function Ec(e){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{const t=await e.client.request("web.login.wait",{timeoutMs:12e4});e.whatsappLoginMessage=t.message??null,e.whatsappLoginConnected=t.connected??null,t.connected&&(e.whatsappLoginQrDataUrl=null)}catch(t){e.whatsappLoginMessage=String(t),e.whatsappLoginConnected=null}finally{e.whatsappBusy=!1}}}async function Lc(e){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{await e.client.request("channels.logout",{channel:"whatsapp"}),e.whatsappLoginMessage="Logged out.",e.whatsappLoginQrDataUrl=null,e.whatsappLoginConnected=null}catch(t){e.whatsappLoginMessage=String(t)}finally{e.whatsappBusy=!1}}}function we(e){if(e)return Array.isArray(e.type)?e.type.filter(n=>n!=="null")[0]??e.type[0]:e.type}function fr(e){if(!e)return"";if(e.default!==void 0)return e.default;switch(we(e)){case"object":return{};case"array":return[];case"boolean":return!1;case"number":case"integer":return 0;case"string":return"";default:return""}}function Zn(e){return e.filter(t=>typeof t=="string").join(".")}function Ae(e,t){const n=Zn(e),s=t[n];if(s)return s;const i=n.split(".");for(const[a,o]of Object.entries(t)){if(!a.includes("*"))continue;const l=a.split(".");if(l.length!==i.length)continue;let c=!0;for(let u=0;u<i.length;u+=1)if(l[u]!=="*"&&l[u]!==i[u]){c=!1;break}if(c)return o}}function We(e){return e.replace(/_/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/\s+/g," ").replace(/^./,t=>t.toUpperCase())}function Mc(e){const t=Zn(e).toLowerCase();return t.includes("token")||t.includes("password")||t.includes("secret")||t.includes("apikey")||t.endsWith("key")}function Ua(e,t){const n=e.trim();if(n==="")return;const s=Number(n);return!Number.isFinite(s)||t&&!Number.isInteger(s)?e:s}function za(e){const t=e.trim();return t==="true"?!0:t==="false"?!1:e}function Ge(e,t){if(e==null)return e;if(t.allOf&&t.allOf.length>0){let s=e;for(const i of t.allOf)s=Ge(s,i);return s}const n=we(t);if(t.anyOf||t.oneOf){const s=(t.anyOf??t.oneOf??[]).filter(i=>!(i.type==="null"||Array.isArray(i.type)&&i.type.includes("null")));if(s.length===1)return Ge(e,s[0]);if(typeof e=="string")for(const i of s){const a=we(i);if(a==="number"||a==="integer"){const o=Ua(e,a==="integer");if(o===void 0||typeof o=="number")return o}if(a==="boolean"){const o=za(e);if(typeof o=="boolean")return o}}for(const i of s){const a=we(i);if(a==="object"&&typeof e=="object"&&!Array.isArray(e)||a==="array"&&Array.isArray(e))return Ge(e,i)}return e}if(n==="number"||n==="integer"){if(typeof e=="string"){const s=Ua(e,n==="integer");if(s===void 0||typeof s=="number")return s}return e}if(n==="boolean"){if(typeof e=="string"){const s=za(e);if(typeof s=="boolean")return s}return e}if(n==="object"){if(typeof e!="object"||Array.isArray(e))return e;const s=e,i=t.properties??{},a=t.additionalProperties&&typeof t.additionalProperties=="object"?t.additionalProperties:null,o={};for(const[l,c]of Object.entries(s)){const u=i[l]??a,g=u?Ge(c,u):c;g!==void 0&&(o[l]=g)}return o}if(n==="array"){if(!Array.isArray(e))return e;if(Array.isArray(t.items)){const i=t.items;return e.map((a,o)=>{const l=o<i.length?i[o]:void 0;return l?Ge(a,l):a})}const s=t.items;return s?e.map(i=>Ge(i,s)).filter(i=>i!==void 0):e}return e}function ft(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}function en(e){return`${JSON.stringify(e,null,2).trimEnd()}
|
|
4
|
+
`}function hr(e,t,n){if(t.length===0)return;let s=e;for(let a=0;a<t.length-1;a+=1){const o=t[a],l=t[a+1];if(typeof o=="number"){if(!Array.isArray(s))return;s[o]==null&&(s[o]=typeof l=="number"?[]:{}),s=s[o]}else{if(typeof s!="object"||s==null)return;const c=s;c[o]==null&&(c[o]=typeof l=="number"?[]:{}),s=c[o]}}const i=t[t.length-1];if(typeof i=="number"){Array.isArray(s)&&(s[i]=n);return}typeof s=="object"&&s!=null&&(s[i]=n)}function vr(e,t){if(t.length===0)return;let n=e;for(let i=0;i<t.length-1;i+=1){const a=t[i];if(typeof a=="number"){if(!Array.isArray(n))return;n=n[a]}else{if(typeof n!="object"||n==null)return;n=n[a]}if(n==null)return}const s=t[t.length-1];if(typeof s=="number"){Array.isArray(n)&&n.splice(s,1);return}typeof n=="object"&&n!=null&&delete n[s]}async function Le(e){if(!(!e.client||!e.connected)){e.configLoading=!0,e.lastError=null;try{const t=await e.client.request("config.get",{});Rc(e,t)}catch(t){e.lastError=String(t)}finally{e.configLoading=!1}}}async function mr(e){if(!(!e.client||!e.connected)&&!e.configSchemaLoading){e.configSchemaLoading=!0;try{const t=await e.client.request("config.schema",{});Ic(e,t)}catch(t){e.lastError=String(t)}finally{e.configSchemaLoading=!1}}}function Ic(e,t){e.configSchema=t.schema??null,e.configUiHints=t.uiHints??{},e.configSchemaVersion=t.version??null}function Rc(e,t){e.configSnapshot=t;const n=typeof t.raw=="string"?t.raw:t.config&&typeof t.config=="object"?en(t.config):e.configRaw;!e.configFormDirty||e.configFormMode==="raw"?e.configRaw=n:e.configForm?e.configRaw=en(e.configForm):e.configRaw=n,e.configValid=typeof t.valid=="boolean"?t.valid:null,e.configIssues=Array.isArray(t.issues)?t.issues:[],e.configFormDirty||(e.configForm=ft(t.config??{}),e.configFormOriginal=ft(t.config??{}),e.configRawOriginal=n)}function Pc(e){return!e||typeof e!="object"||Array.isArray(e)?null:e}function br(e){if(e.configFormMode!=="form"||!e.configForm)return e.configRaw;const t=Pc(e.configSchema),n=t?Ge(e.configForm,t):e.configForm;return en(n)}async function In(e){if(!(!e.client||!e.connected)){e.configSaving=!0,e.lastError=null;try{const t=br(e),n=e.configSnapshot?.hash;if(!n){e.lastError="Config hash missing; reload and retry.";return}await e.client.request("config.set",{raw:t,baseHash:n}),e.configFormDirty=!1,await Le(e)}catch(t){e.lastError=String(t)}finally{e.configSaving=!1}}}async function Dc(e){if(!(!e.client||!e.connected)){e.configApplying=!0,e.lastError=null;try{const t=br(e),n=e.configSnapshot?.hash;if(!n){e.lastError="Config hash missing; reload and retry.";return}await e.client.request("config.apply",{raw:t,baseHash:n,sessionKey:e.applySessionKey}),e.configFormDirty=!1,await Le(e)}catch(t){e.lastError=String(t)}finally{e.configApplying=!1}}}async function Fc(e){if(!(!e.client||!e.connected)){e.updateRunning=!0,e.lastError=null;try{await e.client.request("update.run",{sessionKey:e.applySessionKey})}catch(t){e.lastError=String(t)}finally{e.updateRunning=!1}}}function $e(e,t,n){const s=ft(e.configForm??e.configSnapshot?.config??{});hr(s,t,n),e.configForm=s,e.configFormDirty=!0,e.configFormMode==="form"&&(e.configRaw=en(s))}function ze(e,t){const n=ft(e.configForm??e.configSnapshot?.config??{});vr(n,t),e.configForm=n,e.configFormDirty=!0,e.configFormMode==="form"&&(e.configRaw=en(n))}function Nc(e){const{values:t,original:n}=e;return t.name!==n.name||t.displayName!==n.displayName||t.about!==n.about||t.picture!==n.picture||t.banner!==n.banner||t.website!==n.website||t.nip05!==n.nip05||t.lud16!==n.lud16}function Oc(e){const{state:t,callbacks:n,accountId:s}=e,i=Nc(t),a=(l,c,u={})=>{const{type:g="text",placeholder:p,maxLength:h,help:d}=u,f=t.values[l]??"",m=t.fieldErrors[l],S=`nostr-profile-${l}`;return g==="textarea"?r`
|
|
5
5
|
<div class="form-field" style="margin-bottom: 12px;">
|
|
6
6
|
<label for="${S}" style="display: block; margin-bottom: 4px; font-weight: 500;">
|
|
7
7
|
${c}
|
|
@@ -121,19 +121,19 @@
|
|
|
121
121
|
</div>
|
|
122
122
|
`:v}
|
|
123
123
|
</div>
|
|
124
|
-
`}function
|
|
124
|
+
`}function Bc(e){const t={name:e?.name??"",displayName:e?.displayName??"",about:e?.about??"",picture:e?.picture??"",banner:e?.banner??"",website:e?.website??"",nip05:e?.nip05??"",lud16:e?.lud16??""};return{values:t,original:{...t},saving:!1,importing:!1,error:null,success:null,fieldErrors:{},showAdvanced:!!(e?.banner||e?.website||e?.nip05||e?.lud16)}}async function Uc(e,t){await _c(e,t),await ye(e,!0)}async function zc(e){await Ec(e),await ye(e,!0)}async function Hc(e){await Lc(e),await ye(e,!0)}async function jc(e){await In(e),await Le(e),await ye(e,!0)}async function Kc(e){await Le(e),await ye(e,!0)}function Wc(e){if(!Array.isArray(e))return{};const t={};for(const n of e){if(typeof n!="string")continue;const[s,...i]=n.split(":");if(!s||i.length===0)continue;const a=s.trim(),o=i.join(":").trim();a&&o&&(t[a]=o)}return t}function yr(e){return(e.channelsSnapshot?.channelAccounts?.nostr??[])[0]?.accountId??e.nostrProfileAccountId??"default"}function xr(e,t=""){return`/api/channels/nostr/${encodeURIComponent(e)}/profile${t}`}function qc(e){const t=e.hello?.auth?.deviceToken?.trim();if(t)return`Bearer ${t}`;const n=e.settings.token.trim();if(n)return`Bearer ${n}`;const s=e.password.trim();return s?`Bearer ${s}`:null}function $r(e){const t=qc(e);return t?{Authorization:t}:{}}function Gc(e,t,n){e.nostrProfileAccountId=t,e.nostrProfileFormState=Bc(n??void 0)}function Vc(e){e.nostrProfileFormState=null,e.nostrProfileAccountId=null}function Qc(e,t,n){const s=e.nostrProfileFormState;s&&(e.nostrProfileFormState={...s,values:{...s.values,[t]:n},fieldErrors:{...s.fieldErrors,[t]:""}})}function Yc(e){const t=e.nostrProfileFormState;t&&(e.nostrProfileFormState={...t,showAdvanced:!t.showAdvanced})}async function Jc(e){const t=e.nostrProfileFormState;if(!t||t.saving)return;const n=yr(e);e.nostrProfileFormState={...t,saving:!0,error:null,success:null,fieldErrors:{}};try{const s=await fetch(xr(n),{method:"PUT",headers:{"Content-Type":"application/json",...$r(e)},body:JSON.stringify(t.values)}),i=await s.json().catch(()=>null);if(!s.ok||i?.ok===!1||!i){const a=i?.error??`Profile update failed (${s.status})`;e.nostrProfileFormState={...t,saving:!1,error:a,success:null,fieldErrors:Wc(i?.details)};return}if(!i.persisted){e.nostrProfileFormState={...t,saving:!1,error:"Profile publish failed on all relays.",success:null};return}e.nostrProfileFormState={...t,saving:!1,error:null,success:"Profile published to relays.",fieldErrors:{},original:{...t.values}},await ye(e,!0)}catch(s){e.nostrProfileFormState={...t,saving:!1,error:`Profile update failed: ${String(s)}`,success:null}}}async function Zc(e){const t=e.nostrProfileFormState;if(!t||t.importing)return;const n=yr(e);e.nostrProfileFormState={...t,importing:!0,error:null,success:null};try{const s=await fetch(xr(n,"/import"),{method:"POST",headers:{"Content-Type":"application/json",...$r(e)},body:JSON.stringify({autoMerge:!0})}),i=await s.json().catch(()=>null);if(!s.ok||i?.ok===!1||!i){const c=i?.error??`Profile import failed (${s.status})`;e.nostrProfileFormState={...t,importing:!1,error:c,success:null};return}const a=i.merged??i.imported??null,o=a?{...t.values,...a}:t.values,l=!!(o.banner||o.website||o.nip05||o.lud16);e.nostrProfileFormState={...t,importing:!1,values:o,error:null,success:i.saved?"Profile imported from relays. Review and publish.":"Profile imported. Review and publish.",showAdvanced:l},i.saved&&await ye(e,!0)}catch(s){e.nostrProfileFormState={...t,importing:!1,error:`Profile import failed: ${String(s)}`,success:null}}}function wr(e){const t=(e??"").trim();if(!t)return null;const n=t.split(":").filter(Boolean);if(n.length<3||n[0]!=="agent")return null;const s=n[1]?.trim(),i=n.slice(2).join(":");return!s||!i?null:{agentId:s,rest:i}}const Vs=450;function on(e,t=!1,n=!1){e.chatScrollFrame&&cancelAnimationFrame(e.chatScrollFrame),e.chatScrollTimeout!=null&&(clearTimeout(e.chatScrollTimeout),e.chatScrollTimeout=null);const s=()=>{const i=e.querySelector(".chat-thread");if(i){const a=getComputedStyle(i).overflowY;if(a==="auto"||a==="scroll"||i.scrollHeight-i.clientHeight>1)return i}return document.scrollingElement??document.documentElement};e.updateComplete.then(()=>{e.chatScrollFrame=requestAnimationFrame(()=>{e.chatScrollFrame=null;const i=s();if(!i)return;const a=i.scrollHeight-i.scrollTop-i.clientHeight,o=t&&!e.chatHasAutoScrolled;if(!(o||e.chatUserNearBottom||a<Vs)){e.chatNewMessagesBelow=!0;return}o&&(e.chatHasAutoScrolled=!0);const c=n&&(typeof window>"u"||typeof window.matchMedia!="function"||!window.matchMedia("(prefers-reduced-motion: reduce)").matches),u=i.scrollHeight;typeof i.scrollTo=="function"?i.scrollTo({top:u,behavior:c?"smooth":"auto"}):i.scrollTop=u,e.chatUserNearBottom=!0,e.chatNewMessagesBelow=!1;const g=o?150:120;e.chatScrollTimeout=window.setTimeout(()=>{e.chatScrollTimeout=null;const p=s();if(!p)return;const h=p.scrollHeight-p.scrollTop-p.clientHeight;(o||e.chatUserNearBottom||h<Vs)&&(p.scrollTop=p.scrollHeight,e.chatUserNearBottom=!0)},g)})})}function kr(e,t=!1){e.logsScrollFrame&&cancelAnimationFrame(e.logsScrollFrame),e.updateComplete.then(()=>{e.logsScrollFrame=requestAnimationFrame(()=>{e.logsScrollFrame=null;const n=e.querySelector(".log-stream");if(!n)return;const s=n.scrollHeight-n.scrollTop-n.clientHeight;(t||s<80)&&(n.scrollTop=n.scrollHeight)})})}function Xc(e,t){const n=t.currentTarget;if(!n)return;const s=n.scrollHeight-n.scrollTop-n.clientHeight;e.chatUserNearBottom=s<Vs,e.chatUserNearBottom&&(e.chatNewMessagesBelow=!1)}function ed(e,t){const n=t.currentTarget;if(!n)return;const s=n.scrollHeight-n.scrollTop-n.clientHeight;e.logsAtBottom=s<80}function Ha(e){e.chatHasAutoScrolled=!1,e.chatUserNearBottom=!0,e.chatNewMessagesBelow=!1}function td(e,t){if(e.length===0)return;const n=new Blob([`${e.join(`
|
|
125
125
|
`)}
|
|
126
|
-
`],{type:"text/plain"}),s=URL.createObjectURL(n),i=document.createElement("a"),a=new Date().toISOString().slice(0,19).replace(/[:T]/g,"-");i.href=s,i.download=`openclaw-logs-${t}-${a}.log`,i.click(),URL.revokeObjectURL(s)}function qc(e){if(typeof ResizeObserver>"u")return;const t=e.querySelector(".topbar");if(!t)return;const n=()=>{const{height:s}=t.getBoundingClientRect();e.style.setProperty("--topbar-height",`${s}px`)};n(),e.topbarObserver=new ResizeObserver(()=>n()),e.topbarObserver.observe(t)}async function Jn(e){if(!(!e.client||!e.connected)&&!e.debugLoading){e.debugLoading=!0;try{const[t,n,s,i]=await Promise.all([e.client.request("status",{}),e.client.request("health",{}),e.client.request("models.list",{}),e.client.request("last-heartbeat",{})]);e.debugStatus=t,e.debugHealth=n;const a=s;e.debugModels=Array.isArray(a?.models)?a?.models:[],e.debugHeartbeat=i}catch(t){e.debugCallError=String(t)}finally{e.debugLoading=!1}}}async function Gc(e){if(!(!e.client||!e.connected)){e.debugCallError=null,e.debugCallResult=null;try{const t=e.debugCallParams.trim()?JSON.parse(e.debugCallParams):{},n=await e.client.request(e.debugCallMethod.trim(),t);e.debugCallResult=JSON.stringify(n,null,2)}catch(t){e.debugCallError=String(t)}}}const Vc=2e3,Qc=new Set(["trace","debug","info","warn","error","fatal"]);function Yc(e){if(typeof e!="string")return null;const t=e.trim();if(!t.startsWith("{")||!t.endsWith("}"))return null;try{const n=JSON.parse(t);return!n||typeof n!="object"?null:n}catch{return null}}function Jc(e){if(typeof e!="string")return null;const t=e.toLowerCase();return Qc.has(t)?t:null}function Zc(e){if(!e.trim())return{raw:e,message:e};try{const t=JSON.parse(e),n=t&&typeof t._meta=="object"&&t._meta!==null?t._meta:null,s=typeof t.time=="string"?t.time:typeof n?.date=="string"?n?.date:null,i=Jc(n?.logLevelName??n?.level),a=typeof t[0]=="string"?t[0]:typeof n?.name=="string"?n?.name:null,o=Yc(a);let l=null;o&&(typeof o.subsystem=="string"?l=o.subsystem:typeof o.module=="string"&&(l=o.module)),!l&&a&&a.length<120&&(l=a);let c=null;return typeof t[1]=="string"?c=t[1]:!o&&typeof t[0]=="string"?c=t[0]:typeof t.message=="string"&&(c=t.message),{raw:e,time:s,level:i,subsystem:l,message:c??e,meta:n??void 0}}catch{return{raw:e,message:e}}}async function Ci(e,t){if(!(!e.client||!e.connected)&&!(e.logsLoading&&!t?.quiet)){t?.quiet||(e.logsLoading=!0),e.logsError=null;try{const s=await e.client.request("logs.tail",{cursor:t?.reset?void 0:e.logsCursor??void 0,limit:e.logsLimit,maxBytes:e.logsMaxBytes}),a=(Array.isArray(s.lines)?s.lines.filter(l=>typeof l=="string"):[]).map(Zc),o=!!(t?.reset||s.reset||e.logsCursor==null);e.logsEntries=o?a:[...e.logsEntries,...a].slice(-Vc),typeof s.cursor=="number"&&(e.logsCursor=s.cursor),typeof s.file=="string"&&(e.logsFile=s.file),e.logsTruncated=!!s.truncated,e.logsLastFetchAt=Date.now()}catch(n){e.logsError=String(n)}finally{t?.quiet||(e.logsLoading=!1)}}}async function Zn(e,t){if(!(!e.client||!e.connected)&&!e.nodesLoading){e.nodesLoading=!0,t?.quiet||(e.lastError=null);try{const n=await e.client.request("node.list",{});e.nodes=Array.isArray(n.nodes)?n.nodes:[]}catch(n){t?.quiet||(e.lastError=String(n))}finally{e.nodesLoading=!1}}}function Xc(e){e.nodesPollInterval==null&&(e.nodesPollInterval=window.setInterval(()=>{Zn(e,{quiet:!0})},5e3))}function ed(e){e.nodesPollInterval!=null&&(clearInterval(e.nodesPollInterval),e.nodesPollInterval=null)}function Ti(e){e.logsPollInterval==null&&(e.logsPollInterval=window.setInterval(()=>{e.tab==="logs"&&Ci(e,{quiet:!0})},2e3))}function _i(e){e.logsPollInterval!=null&&(clearInterval(e.logsPollInterval),e.logsPollInterval=null)}function Ei(e){e.debugPollInterval==null&&(e.debugPollInterval=window.setInterval(()=>{e.tab==="debug"&&Jn(e)},3e3))}function Li(e){e.debugPollInterval!=null&&(clearInterval(e.debugPollInterval),e.debugPollInterval=null)}async function br(e,t){if(!(!e.client||!e.connected||e.agentIdentityLoading)&&!e.agentIdentityById[t]){e.agentIdentityLoading=!0,e.agentIdentityError=null;try{const n=await e.client.request("agent.identity.get",{agentId:t});n&&(e.agentIdentityById={...e.agentIdentityById,[t]:n})}catch(n){e.agentIdentityError=String(n)}finally{e.agentIdentityLoading=!1}}}async function yr(e,t){if(!e.client||!e.connected||e.agentIdentityLoading)return;const n=t.filter(s=>!e.agentIdentityById[s]);if(n.length!==0){e.agentIdentityLoading=!0,e.agentIdentityError=null;try{for(const s of n){const i=await e.client.request("agent.identity.get",{agentId:s});i&&(e.agentIdentityById={...e.agentIdentityById,[s]:i})}}catch(s){e.agentIdentityError=String(s)}finally{e.agentIdentityLoading=!1}}}async function In(e,t){if(!(!e.client||!e.connected)&&!e.agentSkillsLoading){e.agentSkillsLoading=!0,e.agentSkillsError=null;try{const n=await e.client.request("skills.status",{agentId:t});n&&(e.agentSkillsReport=n,e.agentSkillsAgentId=t)}catch(n){e.agentSkillsError=String(n)}finally{e.agentSkillsLoading=!1}}}async function Mi(e){if(!(!e.client||!e.connected)&&!e.agentsLoading){e.agentsLoading=!0,e.agentsError=null;try{const t=await e.client.request("agents.list",{});if(t){e.agentsList=t;const n=e.agentsSelectedId,s=t.agents.some(i=>i.id===n);(!n||!s)&&(e.agentsSelectedId=t.defaultId??t.agents[0]?.id??null)}}catch(t){e.agentsError=String(t)}finally{e.agentsLoading=!1}}}function Ii(e,t){if(e==null||!Number.isFinite(e)||e<=0)return;if(e<1e3)return`${Math.round(e)}ms`;const n=t?.spaced?" ":"",s=Math.round(e/1e3),i=Math.floor(s/3600),a=Math.floor(s%3600/60),o=s%60;if(i>=24){const l=Math.floor(i/24),c=i%24;return c>0?`${l}d${n}${c}h`:`${l}d`}return i>0?a>0?`${i}h${n}${a}m`:`${i}h`:a>0?o>0?`${a}m${n}${o}s`:`${a}m`:`${o}s`}function Ri(e,t="n/a"){if(e==null||!Number.isFinite(e)||e<0)return t;if(e<1e3)return`${Math.round(e)}ms`;const n=Math.round(e/1e3);if(n<60)return`${n}s`;const s=Math.round(n/60);if(s<60)return`${s}m`;const i=Math.round(s/60);return i<24?`${i}h`:`${Math.round(i/24)}d`}function V(e,t){const n=t?.fallback??"n/a";if(e==null||!Number.isFinite(e))return n;const s=Date.now()-e,i=Math.abs(s),a=s>=0,o=Math.round(i/1e3);if(o<60)return a?"just now":"in <1m";const l=Math.round(o/60);if(l<60)return a?`${l}m ago`:`in ${l}m`;const c=Math.round(l/60);if(c<48)return a?`${c}h ago`:`in ${c}h`;const u=Math.round(c/24);return a?`${u}d ago`:`in ${u}d`}const td=/<\s*\/?\s*(?:think(?:ing)?|thought|antthinking|final)\b/i,bn=/<\s*\/?\s*final\b[^<>]*>/gi,Ua=/<\s*(\/?)\s*(?:think(?:ing)?|thought|antthinking)\b[^<>]*>/gi;function za(e){const t=[],n=/(^|\n)(```|~~~)[^\n]*\n[\s\S]*?(?:\n\2(?:\n|$)|$)/g;for(const i of e.matchAll(n)){const a=(i.index??0)+i[1].length;t.push({start:a,end:a+i[0].length-i[1].length})}const s=/`+[^`]+`+/g;for(const i of e.matchAll(s)){const a=i.index??0,o=a+i[0].length;t.some(c=>a>=c.start&&o<=c.end)||t.push({start:a,end:o})}return t.sort((i,a)=>i.start-a.start),t}function Ha(e,t){return t.some(n=>e>=n.start&&e<n.end)}function nd(e,t){return e.trimStart()}function sd(e,t){if(!e||!td.test(e))return e;let n=e;if(bn.test(n)){bn.lastIndex=0;const l=[],c=za(n);for(const u of n.matchAll(bn)){const g=u.index??0;l.push({start:g,length:u[0].length,inCode:Ha(g,c)})}for(let u=l.length-1;u>=0;u--){const g=l[u];g.inCode||(n=n.slice(0,g.start)+n.slice(g.start+g.length))}}else bn.lastIndex=0;const s=za(n);Ua.lastIndex=0;let i="",a=0,o=!1;for(const l of n.matchAll(Ua)){const c=l.index??0,u=l[1]==="/";Ha(c,s)||(o?u&&(o=!1):(i+=n.slice(a,c),u||(o=!0)),a=c+l[0].length)}return i+=n.slice(a),nd(i)}function ft(e){return!e&&e!==0?"n/a":new Date(e).toLocaleString()}function Vs(e){return!e||e.length===0?"none":e.filter(t=>!!(t&&t.trim())).join(", ")}function Qs(e,t=120){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1))}…`}function xr(e,t){return e.length<=t?{text:e,truncated:!1,total:e.length}:{text:e.slice(0,Math.max(0,t)),truncated:!0,total:e.length}}function Nn(e,t){const n=Number(e);return Number.isFinite(n)?n:t}function ws(e){return sd(e)}async function on(e){if(!(!e.client||!e.connected))try{const t=await e.client.request("cron.status",{});e.cronStatus=t}catch(t){e.cronError=String(t)}}async function Xn(e){if(!(!e.client||!e.connected)&&!e.cronLoading){e.cronLoading=!0,e.cronError=null;try{const t=await e.client.request("cron.list",{includeDisabled:!0});e.cronJobs=Array.isArray(t.jobs)?t.jobs:[]}catch(t){e.cronError=String(t)}finally{e.cronLoading=!1}}}function id(e){if(e.scheduleKind==="at"){const n=Date.parse(e.scheduleAt);if(!Number.isFinite(n))throw new Error("Invalid run time.");return{kind:"at",at:new Date(n).toISOString()}}if(e.scheduleKind==="every"){const n=Nn(e.everyAmount,0);if(n<=0)throw new Error("Invalid interval amount.");const s=e.everyUnit;return{kind:"every",everyMs:n*(s==="minutes"?6e4:s==="hours"?36e5:864e5)}}const t=e.cronExpr.trim();if(!t)throw new Error("Cron expression required.");return{kind:"cron",expr:t,tz:e.cronTz.trim()||void 0}}function ad(e){if(e.payloadKind==="systemEvent"){const i=e.payloadText.trim();if(!i)throw new Error("System event text required.");return{kind:"systemEvent",text:i}}const t=e.payloadText.trim();if(!t)throw new Error("Agent message required.");const n={kind:"agentTurn",message:t},s=Nn(e.timeoutSeconds,0);return s>0&&(n.timeoutSeconds=s),n}async function od(e){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{const t=id(e.cronForm),n=ad(e.cronForm),s=e.cronForm.sessionTarget==="isolated"&&e.cronForm.payloadKind==="agentTurn"&&e.cronForm.deliveryMode?{mode:e.cronForm.deliveryMode==="announce"?"announce":"none",channel:e.cronForm.deliveryChannel.trim()||"last",to:e.cronForm.deliveryTo.trim()||void 0}:void 0,i=e.cronForm.agentId.trim(),a={name:e.cronForm.name.trim(),description:e.cronForm.description.trim()||void 0,agentId:i||void 0,enabled:e.cronForm.enabled,schedule:t,sessionTarget:e.cronForm.sessionTarget,wakeMode:e.cronForm.wakeMode,payload:n,delivery:s};if(!a.name)throw new Error("Name required.");await e.client.request("cron.add",a),e.cronForm={...e.cronForm,name:"",description:"",payloadText:""},await Xn(e),await on(e)}catch(t){e.cronError=String(t)}finally{e.cronBusy=!1}}}async function rd(e,t,n){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.update",{id:t.id,patch:{enabled:n}}),await Xn(e),await on(e)}catch(s){e.cronError=String(s)}finally{e.cronBusy=!1}}}async function ld(e,t){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.run",{id:t.id,mode:"force"}),await $r(e,t.id)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function cd(e,t){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.remove",{id:t.id}),e.cronRunsJobId===t.id&&(e.cronRunsJobId=null,e.cronRuns=[]),await Xn(e),await on(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function $r(e,t){if(!(!e.client||!e.connected))try{const n=await e.client.request("cron.runs",{id:t,limit:50});e.cronRunsJobId=t,e.cronRuns=Array.isArray(n.entries)?n.entries:[]}catch(n){e.cronError=String(n)}}const wr="openclaw.device.auth.v1";function Pi(e){return e.trim()}function dd(e){if(!Array.isArray(e))return[];const t=new Set;for(const n of e){const s=n.trim();s&&t.add(s)}return[...t].toSorted()}function Di(){try{const e=window.localStorage.getItem(wr);if(!e)return null;const t=JSON.parse(e);return!t||t.version!==1||!t.deviceId||typeof t.deviceId!="string"||!t.tokens||typeof t.tokens!="object"?null:t}catch{return null}}function kr(e){try{window.localStorage.setItem(wr,JSON.stringify(e))}catch{}}function ud(e){const t=Di();if(!t||t.deviceId!==e.deviceId)return null;const n=Pi(e.role),s=t.tokens[n];return!s||typeof s.token!="string"?null:s}function Sr(e){const t=Pi(e.role),n={version:1,deviceId:e.deviceId,tokens:{}},s=Di();s&&s.deviceId===e.deviceId&&(n.tokens={...s.tokens});const i={token:e.token,role:t,scopes:dd(e.scopes),updatedAtMs:Date.now()};return n.tokens[t]=i,kr(n),i}function Ar(e){const t=Di();if(!t||t.deviceId!==e.deviceId)return;const n=Pi(e.role);if(!t.tokens[n])return;const s={...t,tokens:{...t.tokens}};delete s.tokens[n],kr(s)}const Cr={p:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn,n:0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3edn,h:8n,a:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffecn,d:0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3n,Gx:0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,Gy:0x6666666666666666666666666666666666666666666666666666666666666658n},{p:ue,n:Rn,Gx:ja,Gy:Ka,a:ks,d:Ss,h:gd}=Cr,ht=32,Fi=64,pd=(...e)=>{"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(...e)},oe=(e="")=>{const t=new Error(e);throw pd(t,oe),t},fd=e=>typeof e=="bigint",hd=e=>typeof e=="string",vd=e=>e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array",Je=(e,t,n="")=>{const s=vd(e),i=e?.length,a=t!==void 0;if(!s||a&&i!==t){const o=n&&`"${n}" `,l=a?` of length ${t}`:"",c=s?`length=${i}`:`type=${typeof e}`;oe(o+"expected Uint8Array"+l+", got "+c)}return e},es=e=>new Uint8Array(e),Tr=e=>Uint8Array.from(e),_r=(e,t)=>e.toString(16).padStart(t,"0"),Er=e=>Array.from(Je(e)).map(t=>_r(t,2)).join(""),He={_0:48,_9:57,A:65,F:70,a:97,f:102},Wa=e=>{if(e>=He._0&&e<=He._9)return e-He._0;if(e>=He.A&&e<=He.F)return e-(He.A-10);if(e>=He.a&&e<=He.f)return e-(He.a-10)},Lr=e=>{const t="hex invalid";if(!hd(e))return oe(t);const n=e.length,s=n/2;if(n%2)return oe(t);const i=es(s);for(let a=0,o=0;a<s;a++,o+=2){const l=Wa(e.charCodeAt(o)),c=Wa(e.charCodeAt(o+1));if(l===void 0||c===void 0)return oe(t);i[a]=l*16+c}return i},Mr=()=>globalThis?.crypto,md=()=>Mr()?.subtle??oe("crypto.subtle must be defined, consider polyfill"),en=(...e)=>{const t=es(e.reduce((s,i)=>s+Je(i).length,0));let n=0;return e.forEach(s=>{t.set(s,n),n+=s.length}),t},bd=(e=ht)=>Mr().getRandomValues(es(e)),On=BigInt,ot=(e,t,n,s="bad number: out of range")=>fd(e)&&t<=e&&e<n?e:oe(s),D=(e,t=ue)=>{const n=e%t;return n>=0n?n:t+n},Ir=e=>D(e,Rn),yd=(e,t)=>{(e===0n||t<=0n)&&oe("no inverse n="+e+" mod="+t);let n=D(e,t),s=t,i=0n,a=1n;for(;n!==0n;){const o=s/n,l=s%n,c=i-a*o;s=n,n=l,i=a,a=c}return s===1n?D(i,t):oe("no inverse")},xd=e=>{const t=Fr[e];return typeof t!="function"&&oe("hashes."+e+" not set"),t},As=e=>e instanceof ke?e:oe("Point expected"),Ys=2n**256n;class ke{static BASE;static ZERO;X;Y;Z;T;constructor(t,n,s,i){const a=Ys;this.X=ot(t,0n,a),this.Y=ot(n,0n,a),this.Z=ot(s,1n,a),this.T=ot(i,0n,a),Object.freeze(this)}static CURVE(){return Cr}static fromAffine(t){return new ke(t.x,t.y,1n,D(t.x*t.y))}static fromBytes(t,n=!1){const s=Ss,i=Tr(Je(t,ht)),a=t[31];i[31]=a&-129;const o=Pr(i);ot(o,0n,n?Ys:ue);const c=D(o*o),u=D(c-1n),g=D(s*c+1n);let{isValid:p,value:h}=wd(u,g);p||oe("bad point: y not sqrt");const d=(h&1n)===1n,f=(a&128)!==0;return!n&&h===0n&&f&&oe("bad point: x==0, isLastByteOdd"),f!==d&&(h=D(-h)),new ke(h,o,1n,D(h*o))}static fromHex(t,n){return ke.fromBytes(Lr(t),n)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}assertValidity(){const t=ks,n=Ss,s=this;if(s.is0())return oe("bad point: ZERO");const{X:i,Y:a,Z:o,T:l}=s,c=D(i*i),u=D(a*a),g=D(o*o),p=D(g*g),h=D(c*t),d=D(g*D(h+u)),f=D(p+D(n*D(c*u)));if(d!==f)return oe("bad point: equation left != right (1)");const m=D(i*a),S=D(o*l);return m!==S?oe("bad point: equation left != right (2)"):this}equals(t){const{X:n,Y:s,Z:i}=this,{X:a,Y:o,Z:l}=As(t),c=D(n*l),u=D(a*i),g=D(s*l),p=D(o*i);return c===u&&g===p}is0(){return this.equals(Tt)}negate(){return new ke(D(-this.X),this.Y,this.Z,D(-this.T))}double(){const{X:t,Y:n,Z:s}=this,i=ks,a=D(t*t),o=D(n*n),l=D(2n*D(s*s)),c=D(i*a),u=t+n,g=D(D(u*u)-a-o),p=c+o,h=p-l,d=c-o,f=D(g*h),m=D(p*d),S=D(g*d),k=D(h*p);return new ke(f,m,k,S)}add(t){const{X:n,Y:s,Z:i,T:a}=this,{X:o,Y:l,Z:c,T:u}=As(t),g=ks,p=Ss,h=D(n*o),d=D(s*l),f=D(a*p*u),m=D(i*c),S=D((n+s)*(o+l)-h-d),k=D(m-f),$=D(m+f),A=D(d-g*h),C=D(S*k),_=D($*A),T=D(S*A),I=D(k*$);return new ke(C,_,I,T)}subtract(t){return this.add(As(t).negate())}multiply(t,n=!0){if(!n&&(t===0n||this.is0()))return Tt;if(ot(t,1n,Rn),t===1n)return this;if(this.equals(vt))return Rd(t).p;let s=Tt,i=vt;for(let a=this;t>0n;a=a.double(),t>>=1n)t&1n?s=s.add(a):n&&(i=i.add(a));return s}multiplyUnsafe(t){return this.multiply(t,!1)}toAffine(){const{X:t,Y:n,Z:s}=this;if(this.equals(Tt))return{x:0n,y:1n};const i=yd(s,ue);D(s*i)!==1n&&oe("invalid inverse");const a=D(t*i),o=D(n*i);return{x:a,y:o}}toBytes(){const{x:t,y:n}=this.assertValidity().toAffine(),s=Rr(n);return s[31]|=t&1n?128:0,s}toHex(){return Er(this.toBytes())}clearCofactor(){return this.multiply(On(gd),!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){let t=this.multiply(Rn/2n,!1).double();return Rn%2n&&(t=t.add(this)),t.is0()}}const vt=new ke(ja,Ka,1n,D(ja*Ka)),Tt=new ke(0n,1n,1n,0n);ke.BASE=vt;ke.ZERO=Tt;const Rr=e=>Lr(_r(ot(e,0n,Ys),Fi)).reverse(),Pr=e=>On("0x"+Er(Tr(Je(e)).reverse())),Ie=(e,t)=>{let n=e;for(;t-- >0n;)n*=n,n%=ue;return n},$d=e=>{const n=e*e%ue*e%ue,s=Ie(n,2n)*n%ue,i=Ie(s,1n)*e%ue,a=Ie(i,5n)*i%ue,o=Ie(a,10n)*a%ue,l=Ie(o,20n)*o%ue,c=Ie(l,40n)*l%ue,u=Ie(c,80n)*c%ue,g=Ie(u,80n)*c%ue,p=Ie(g,10n)*a%ue;return{pow_p_5_8:Ie(p,2n)*e%ue,b2:n}},qa=0x2b8324804fc1df0b2b4d00993dfbd7a72f431806ad2fe478c4ee1b274a0ea0b0n,wd=(e,t)=>{const n=D(t*t*t),s=D(n*n*t),i=$d(e*s).pow_p_5_8;let a=D(e*n*i);const o=D(t*a*a),l=a,c=D(a*qa),u=o===e,g=o===D(-e),p=o===D(-e*qa);return u&&(a=l),(g||p)&&(a=c),(D(a)&1n)===1n&&(a=D(-a)),{isValid:u||g,value:a}},Js=e=>Ir(Pr(e)),Ni=(...e)=>Fr.sha512Async(en(...e)),kd=(...e)=>xd("sha512")(en(...e)),Dr=e=>{const t=e.slice(0,ht);t[0]&=248,t[31]&=127,t[31]|=64;const n=e.slice(ht,Fi),s=Js(t),i=vt.multiply(s),a=i.toBytes();return{head:t,prefix:n,scalar:s,point:i,pointBytes:a}},Oi=e=>Ni(Je(e,ht)).then(Dr),Sd=e=>Dr(kd(Je(e,ht))),Ad=e=>Oi(e).then(t=>t.pointBytes),Cd=e=>Ni(e.hashable).then(e.finish),Td=(e,t,n)=>{const{pointBytes:s,scalar:i}=e,a=Js(t),o=vt.multiply(a).toBytes();return{hashable:en(o,s,n),finish:u=>{const g=Ir(a+Js(u)*i);return Je(en(o,Rr(g)),Fi)}}},_d=async(e,t)=>{const n=Je(e),s=await Oi(t),i=await Ni(s.prefix,n);return Cd(Td(s,i,n))},Fr={sha512Async:async e=>{const t=md(),n=en(e);return es(await t.digest("SHA-512",n.buffer))},sha512:void 0},Ed=(e=bd(ht))=>e,Ld={getExtendedPublicKeyAsync:Oi,getExtendedPublicKey:Sd,randomSecretKey:Ed},Bn=8,Md=256,Nr=Math.ceil(Md/Bn)+1,Zs=2**(Bn-1),Id=()=>{const e=[];let t=vt,n=t;for(let s=0;s<Nr;s++){n=t,e.push(n);for(let i=1;i<Zs;i++)n=n.add(t),e.push(n);t=n.double()}return e};let Ga;const Va=(e,t)=>{const n=t.negate();return e?n:t},Rd=e=>{const t=Ga||(Ga=Id());let n=Tt,s=vt;const i=2**Bn,a=i,o=On(i-1),l=On(Bn);for(let c=0;c<Nr;c++){let u=Number(e&o);e>>=l,u>Zs&&(u-=a,e+=1n);const g=c*Zs,p=g,h=g+Math.abs(u)-1,d=c%2!==0,f=u<0;u===0?s=s.add(Va(d,t[p])):n=n.add(Va(f,t[h]))}return e!==0n&&oe("invalid wnaf"),{p:n,f:s}},Cs="openclaw-device-identity-v1";function Xs(e){let t="";for(const n of e)t+=String.fromCharCode(n);return btoa(t).replaceAll("+","-").replaceAll("/","_").replace(/=+$/g,"")}function Or(e){const t=e.replaceAll("-","+").replaceAll("_","/"),n=t+"=".repeat((4-t.length%4)%4),s=atob(n),i=new Uint8Array(s.length);for(let a=0;a<s.length;a+=1)i[a]=s.charCodeAt(a);return i}function Pd(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}async function Br(e){const t=await crypto.subtle.digest("SHA-256",e.slice().buffer);return Pd(new Uint8Array(t))}async function Dd(){const e=Ld.randomSecretKey(),t=await Ad(e);return{deviceId:await Br(t),publicKey:Xs(t),privateKey:Xs(e)}}async function Bi(){try{const n=localStorage.getItem(Cs);if(n){const s=JSON.parse(n);if(s?.version===1&&typeof s.deviceId=="string"&&typeof s.publicKey=="string"&&typeof s.privateKey=="string"){const i=await Br(Or(s.publicKey));if(i!==s.deviceId){const a={...s,deviceId:i};return localStorage.setItem(Cs,JSON.stringify(a)),{deviceId:i,publicKey:s.publicKey,privateKey:s.privateKey}}return{deviceId:s.deviceId,publicKey:s.publicKey,privateKey:s.privateKey}}}}catch{}const e=await Dd(),t={version:1,deviceId:e.deviceId,publicKey:e.publicKey,privateKey:e.privateKey,createdAtMs:Date.now()};return localStorage.setItem(Cs,JSON.stringify(t)),e}async function Fd(e,t){const n=Or(e),s=new TextEncoder().encode(t),i=await _d(s,n);return Xs(i)}async function Ze(e,t){if(!(!e.client||!e.connected)&&!e.devicesLoading){e.devicesLoading=!0,t?.quiet||(e.devicesError=null);try{const n=await e.client.request("device.pair.list",{});e.devicesList={pending:Array.isArray(n?.pending)?n.pending:[],paired:Array.isArray(n?.paired)?n.paired:[]}}catch(n){t?.quiet||(e.devicesError=String(n))}finally{e.devicesLoading=!1}}}async function Nd(e,t){if(!(!e.client||!e.connected))try{await e.client.request("device.pair.approve",{requestId:t}),await Ze(e)}catch(n){e.devicesError=String(n)}}async function Od(e,t){if(!(!e.client||!e.connected||!window.confirm("Reject this device pairing request?")))try{await e.client.request("device.pair.reject",{requestId:t}),await Ze(e)}catch(s){e.devicesError=String(s)}}async function Bd(e,t){if(!(!e.client||!e.connected))try{const n=await e.client.request("device.token.rotate",t);if(n?.token){const s=await Bi(),i=n.role??t.role;(n.deviceId===s.deviceId||t.deviceId===s.deviceId)&&Sr({deviceId:s.deviceId,role:i,token:n.token,scopes:n.scopes??t.scopes??[]}),window.prompt("New device token (copy and store securely):",n.token)}await Ze(e)}catch(n){e.devicesError=String(n)}}async function Ud(e,t){if(!(!e.client||!e.connected||!window.confirm(`Revoke token for ${t.deviceId} (${t.role})?`)))try{await e.client.request("device.token.revoke",t);const s=await Bi();t.deviceId===s.deviceId&&Ar({deviceId:s.deviceId,role:t.role}),await Ze(e)}catch(s){e.devicesError=String(s)}}function zd(e){if(!e||e.kind==="gateway")return{method:"exec.approvals.get",params:{}};const t=e.nodeId.trim();return t?{method:"exec.approvals.node.get",params:{nodeId:t}}:null}function Hd(e,t){if(!e||e.kind==="gateway")return{method:"exec.approvals.set",params:t};const n=e.nodeId.trim();return n?{method:"exec.approvals.node.set",params:{...t,nodeId:n}}:null}async function Ui(e,t){if(!(!e.client||!e.connected)&&!e.execApprovalsLoading){e.execApprovalsLoading=!0,e.lastError=null;try{const n=zd(t);if(!n){e.lastError="Select a node before loading exec approvals.";return}const s=await e.client.request(n.method,n.params);jd(e,s)}catch(n){e.lastError=String(n)}finally{e.execApprovalsLoading=!1}}}function jd(e,t){e.execApprovalsSnapshot=t,e.execApprovalsDirty||(e.execApprovalsForm=pt(t.file??{}))}async function Kd(e,t){if(!(!e.client||!e.connected)){e.execApprovalsSaving=!0,e.lastError=null;try{const n=e.execApprovalsSnapshot?.hash;if(!n){e.lastError="Exec approvals hash missing; reload and retry.";return}const s=e.execApprovalsForm??e.execApprovalsSnapshot?.file??{},i=Hd(t,{file:s,baseHash:n});if(!i){e.lastError="Select a node before saving exec approvals.";return}await e.client.request(i.method,i.params),e.execApprovalsDirty=!1,await Ui(e,t)}catch(n){e.lastError=String(n)}finally{e.execApprovalsSaving=!1}}}function Wd(e,t,n){const s=pt(e.execApprovalsForm??e.execApprovalsSnapshot?.file??{});ur(s,t,n),e.execApprovalsForm=s,e.execApprovalsDirty=!0}function qd(e,t){const n=pt(e.execApprovalsForm??e.execApprovalsSnapshot?.file??{});gr(n,t),e.execApprovalsForm=n,e.execApprovalsDirty=!0}async function zi(e){if(!(!e.client||!e.connected)&&!e.presenceLoading){e.presenceLoading=!0,e.presenceError=null,e.presenceStatus=null;try{const t=await e.client.request("system-presence",{});Array.isArray(t)?(e.presenceEntries=t,e.presenceStatus=t.length===0?"No instances yet.":null):(e.presenceEntries=[],e.presenceStatus="No presence payload.")}catch(t){e.presenceError=String(t)}finally{e.presenceLoading=!1}}}async function bt(e,t){if(!(!e.client||!e.connected)&&!e.sessionsLoading){e.sessionsLoading=!0,e.sessionsError=null;try{const n=t?.includeGlobal??e.sessionsIncludeGlobal,s=t?.includeUnknown??e.sessionsIncludeUnknown,i=t?.activeMinutes??Nn(e.sessionsFilterActive,0),a=t?.limit??Nn(e.sessionsFilterLimit,0),o={includeGlobal:n,includeUnknown:s};i>0&&(o.activeMinutes=i),a>0&&(o.limit=a);const l=await e.client.request("sessions.list",o);l&&(e.sessionsResult=l)}catch(n){e.sessionsError=String(n)}finally{e.sessionsLoading=!1}}}async function Gd(e,t,n){if(!e.client||!e.connected)return;const s={key:t};"label"in n&&(s.label=n.label),"thinkingLevel"in n&&(s.thinkingLevel=n.thinkingLevel),"verboseLevel"in n&&(s.verboseLevel=n.verboseLevel),"reasoningLevel"in n&&(s.reasoningLevel=n.reasoningLevel);try{await e.client.request("sessions.patch",s),await bt(e)}catch(i){e.sessionsError=String(i)}}async function Vd(e,t){if(!(!e.client||!e.connected||e.sessionsLoading||!window.confirm(`Delete session "${t}"?
|
|
126
|
+
`],{type:"text/plain"}),s=URL.createObjectURL(n),i=document.createElement("a"),a=new Date().toISOString().slice(0,19).replace(/[:T]/g,"-");i.href=s,i.download=`openclaw-logs-${t}-${a}.log`,i.click(),URL.revokeObjectURL(s)}function nd(e){if(typeof ResizeObserver>"u")return;const t=e.querySelector(".topbar");if(!t)return;const n=()=>{const{height:s}=t.getBoundingClientRect();e.style.setProperty("--topbar-height",`${s}px`)};n(),e.topbarObserver=new ResizeObserver(()=>n()),e.topbarObserver.observe(t)}async function Xn(e){if(!(!e.client||!e.connected)&&!e.debugLoading){e.debugLoading=!0;try{const[t,n,s,i]=await Promise.all([e.client.request("status",{}),e.client.request("health",{}),e.client.request("models.list",{}),e.client.request("last-heartbeat",{})]);e.debugStatus=t,e.debugHealth=n;const a=s;e.debugModels=Array.isArray(a?.models)?a?.models:[],e.debugHeartbeat=i}catch(t){e.debugCallError=String(t)}finally{e.debugLoading=!1}}}async function sd(e){if(!(!e.client||!e.connected)){e.debugCallError=null,e.debugCallResult=null;try{const t=e.debugCallParams.trim()?JSON.parse(e.debugCallParams):{},n=await e.client.request(e.debugCallMethod.trim(),t);e.debugCallResult=JSON.stringify(n,null,2)}catch(t){e.debugCallError=String(t)}}}const id=2e3,ad=new Set(["trace","debug","info","warn","error","fatal"]);function od(e){if(typeof e!="string")return null;const t=e.trim();if(!t.startsWith("{")||!t.endsWith("}"))return null;try{const n=JSON.parse(t);return!n||typeof n!="object"?null:n}catch{return null}}function rd(e){if(typeof e!="string")return null;const t=e.toLowerCase();return ad.has(t)?t:null}function ld(e){if(!e.trim())return{raw:e,message:e};try{const t=JSON.parse(e),n=t&&typeof t._meta=="object"&&t._meta!==null?t._meta:null,s=typeof t.time=="string"?t.time:typeof n?.date=="string"?n?.date:null,i=rd(n?.logLevelName??n?.level),a=typeof t[0]=="string"?t[0]:typeof n?.name=="string"?n?.name:null,o=od(a);let l=null;o&&(typeof o.subsystem=="string"?l=o.subsystem:typeof o.module=="string"&&(l=o.module)),!l&&a&&a.length<120&&(l=a);let c=null;return typeof t[1]=="string"?c=t[1]:!o&&typeof t[0]=="string"?c=t[0]:typeof t.message=="string"&&(c=t.message),{raw:e,time:s,level:i,subsystem:l,message:c??e,meta:n??void 0}}catch{return{raw:e,message:e}}}async function Ti(e,t){if(!(!e.client||!e.connected)&&!(e.logsLoading&&!t?.quiet)){t?.quiet||(e.logsLoading=!0),e.logsError=null;try{const s=await e.client.request("logs.tail",{cursor:t?.reset?void 0:e.logsCursor??void 0,limit:e.logsLimit,maxBytes:e.logsMaxBytes}),a=(Array.isArray(s.lines)?s.lines.filter(l=>typeof l=="string"):[]).map(ld),o=!!(t?.reset||s.reset||e.logsCursor==null);e.logsEntries=o?a:[...e.logsEntries,...a].slice(-id),typeof s.cursor=="number"&&(e.logsCursor=s.cursor),typeof s.file=="string"&&(e.logsFile=s.file),e.logsTruncated=!!s.truncated,e.logsLastFetchAt=Date.now()}catch(n){e.logsError=String(n)}finally{t?.quiet||(e.logsLoading=!1)}}}async function es(e,t){if(!(!e.client||!e.connected)&&!e.nodesLoading){e.nodesLoading=!0,t?.quiet||(e.lastError=null);try{const n=await e.client.request("node.list",{});e.nodes=Array.isArray(n.nodes)?n.nodes:[]}catch(n){t?.quiet||(e.lastError=String(n))}finally{e.nodesLoading=!1}}}function cd(e){e.nodesPollInterval==null&&(e.nodesPollInterval=window.setInterval(()=>{es(e,{quiet:!0})},5e3))}function dd(e){e.nodesPollInterval!=null&&(clearInterval(e.nodesPollInterval),e.nodesPollInterval=null)}function _i(e){e.logsPollInterval==null&&(e.logsPollInterval=window.setInterval(()=>{e.tab==="logs"&&Ti(e,{quiet:!0})},2e3))}function Ei(e){e.logsPollInterval!=null&&(clearInterval(e.logsPollInterval),e.logsPollInterval=null)}function Li(e){e.debugPollInterval==null&&(e.debugPollInterval=window.setInterval(()=>{e.tab==="debug"&&Xn(e)},3e3))}function Mi(e){e.debugPollInterval!=null&&(clearInterval(e.debugPollInterval),e.debugPollInterval=null)}async function Sr(e,t){if(!(!e.client||!e.connected||e.agentIdentityLoading)&&!e.agentIdentityById[t]){e.agentIdentityLoading=!0,e.agentIdentityError=null;try{const n=await e.client.request("agent.identity.get",{agentId:t});n&&(e.agentIdentityById={...e.agentIdentityById,[t]:n})}catch(n){e.agentIdentityError=String(n)}finally{e.agentIdentityLoading=!1}}}async function Ar(e,t){if(!e.client||!e.connected||e.agentIdentityLoading)return;const n=t.filter(s=>!e.agentIdentityById[s]);if(n.length!==0){e.agentIdentityLoading=!0,e.agentIdentityError=null;try{for(const s of n){const i=await e.client.request("agent.identity.get",{agentId:s});i&&(e.agentIdentityById={...e.agentIdentityById,[s]:i})}}catch(s){e.agentIdentityError=String(s)}finally{e.agentIdentityLoading=!1}}}async function Rn(e,t){if(!(!e.client||!e.connected)&&!e.agentSkillsLoading){e.agentSkillsLoading=!0,e.agentSkillsError=null;try{const n=await e.client.request("skills.status",{agentId:t});n&&(e.agentSkillsReport=n,e.agentSkillsAgentId=t)}catch(n){e.agentSkillsError=String(n)}finally{e.agentSkillsLoading=!1}}}async function Ii(e){if(!(!e.client||!e.connected)&&!e.agentsLoading){e.agentsLoading=!0,e.agentsError=null;try{const t=await e.client.request("agents.list",{});if(t){e.agentsList=t;const n=e.agentsSelectedId,s=t.agents.some(i=>i.id===n);(!n||!s)&&(e.agentsSelectedId=t.defaultId??t.agents[0]?.id??null)}}catch(t){e.agentsError=String(t)}finally{e.agentsLoading=!1}}}function Ri(e,t){if(e==null||!Number.isFinite(e)||e<=0)return;if(e<1e3)return`${Math.round(e)}ms`;const n=t?.spaced?" ":"",s=Math.round(e/1e3),i=Math.floor(s/3600),a=Math.floor(s%3600/60),o=s%60;if(i>=24){const l=Math.floor(i/24),c=i%24;return c>0?`${l}d${n}${c}h`:`${l}d`}return i>0?a>0?`${i}h${n}${a}m`:`${i}h`:a>0?o>0?`${a}m${n}${o}s`:`${a}m`:`${o}s`}function Pi(e,t="n/a"){if(e==null||!Number.isFinite(e)||e<0)return t;if(e<1e3)return`${Math.round(e)}ms`;const n=Math.round(e/1e3);if(n<60)return`${n}s`;const s=Math.round(n/60);if(s<60)return`${s}m`;const i=Math.round(s/60);return i<24?`${i}h`:`${Math.round(i/24)}d`}function V(e,t){const n=t?.fallback??"n/a";if(e==null||!Number.isFinite(e))return n;const s=Date.now()-e,i=Math.abs(s),a=s>=0,o=Math.round(i/1e3);if(o<60)return a?"just now":"in <1m";const l=Math.round(o/60);if(l<60)return a?`${l}m ago`:`in ${l}m`;const c=Math.round(l/60);if(c<48)return a?`${c}h ago`:`in ${c}h`;const u=Math.round(c/24);return a?`${u}d ago`:`in ${u}d`}const ud=/<\s*\/?\s*(?:think(?:ing)?|thought|antthinking|final)\b/i,yn=/<\s*\/?\s*final\b[^<>]*>/gi,ja=/<\s*(\/?)\s*(?:think(?:ing)?|thought|antthinking)\b[^<>]*>/gi;function Ka(e){const t=[],n=/(^|\n)(```|~~~)[^\n]*\n[\s\S]*?(?:\n\2(?:\n|$)|$)/g;for(const i of e.matchAll(n)){const a=(i.index??0)+i[1].length;t.push({start:a,end:a+i[0].length-i[1].length})}const s=/`+[^`]+`+/g;for(const i of e.matchAll(s)){const a=i.index??0,o=a+i[0].length;t.some(c=>a>=c.start&&o<=c.end)||t.push({start:a,end:o})}return t.sort((i,a)=>i.start-a.start),t}function Wa(e,t){return t.some(n=>e>=n.start&&e<n.end)}function gd(e,t){return e.trimStart()}function pd(e,t){if(!e||!ud.test(e))return e;let n=e;if(yn.test(n)){yn.lastIndex=0;const l=[],c=Ka(n);for(const u of n.matchAll(yn)){const g=u.index??0;l.push({start:g,length:u[0].length,inCode:Wa(g,c)})}for(let u=l.length-1;u>=0;u--){const g=l[u];g.inCode||(n=n.slice(0,g.start)+n.slice(g.start+g.length))}}else yn.lastIndex=0;const s=Ka(n);ja.lastIndex=0;let i="",a=0,o=!1;for(const l of n.matchAll(ja)){const c=l.index??0,u=l[1]==="/";Wa(c,s)||(o?u&&(o=!1):(i+=n.slice(a,c),u||(o=!0)),a=c+l[0].length)}return i+=n.slice(a),gd(i)}function ht(e){return!e&&e!==0?"n/a":new Date(e).toLocaleString()}function Qs(e){return!e||e.length===0?"none":e.filter(t=>!!(t&&t.trim())).join(", ")}function Ys(e,t=120){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1))}…`}function Cr(e,t){return e.length<=t?{text:e,truncated:!1,total:e.length}:{text:e.slice(0,Math.max(0,t)),truncated:!0,total:e.length}}function On(e,t){const n=Number(e);return Number.isFinite(n)?n:t}function ks(e){return pd(e)}async function rn(e){if(!(!e.client||!e.connected))try{const t=await e.client.request("cron.status",{});e.cronStatus=t}catch(t){e.cronError=String(t)}}async function ts(e){if(!(!e.client||!e.connected)&&!e.cronLoading){e.cronLoading=!0,e.cronError=null;try{const t=await e.client.request("cron.list",{includeDisabled:!0});e.cronJobs=Array.isArray(t.jobs)?t.jobs:[]}catch(t){e.cronError=String(t)}finally{e.cronLoading=!1}}}function fd(e){if(e.scheduleKind==="at"){const n=Date.parse(e.scheduleAt);if(!Number.isFinite(n))throw new Error("Invalid run time.");return{kind:"at",at:new Date(n).toISOString()}}if(e.scheduleKind==="every"){const n=On(e.everyAmount,0);if(n<=0)throw new Error("Invalid interval amount.");const s=e.everyUnit;return{kind:"every",everyMs:n*(s==="minutes"?6e4:s==="hours"?36e5:864e5)}}const t=e.cronExpr.trim();if(!t)throw new Error("Cron expression required.");return{kind:"cron",expr:t,tz:e.cronTz.trim()||void 0}}function hd(e){if(e.payloadKind==="systemEvent"){const i=e.payloadText.trim();if(!i)throw new Error("System event text required.");return{kind:"systemEvent",text:i}}const t=e.payloadText.trim();if(!t)throw new Error("Agent message required.");const n={kind:"agentTurn",message:t},s=On(e.timeoutSeconds,0);return s>0&&(n.timeoutSeconds=s),n}async function vd(e){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{const t=fd(e.cronForm),n=hd(e.cronForm),s=e.cronForm.sessionTarget==="isolated"&&e.cronForm.payloadKind==="agentTurn"&&e.cronForm.deliveryMode?{mode:e.cronForm.deliveryMode==="announce"?"announce":"none",channel:e.cronForm.deliveryChannel.trim()||"last",to:e.cronForm.deliveryTo.trim()||void 0}:void 0,i=e.cronForm.agentId.trim(),a={name:e.cronForm.name.trim(),description:e.cronForm.description.trim()||void 0,agentId:i||void 0,enabled:e.cronForm.enabled,schedule:t,sessionTarget:e.cronForm.sessionTarget,wakeMode:e.cronForm.wakeMode,payload:n,delivery:s};if(!a.name)throw new Error("Name required.");await e.client.request("cron.add",a),e.cronForm={...e.cronForm,name:"",description:"",payloadText:""},await ts(e),await rn(e)}catch(t){e.cronError=String(t)}finally{e.cronBusy=!1}}}async function md(e,t,n){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.update",{id:t.id,patch:{enabled:n}}),await ts(e),await rn(e)}catch(s){e.cronError=String(s)}finally{e.cronBusy=!1}}}async function bd(e,t){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.run",{id:t.id,mode:"force"}),await Tr(e,t.id)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function yd(e,t){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.remove",{id:t.id}),e.cronRunsJobId===t.id&&(e.cronRunsJobId=null,e.cronRuns=[]),await ts(e),await rn(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function Tr(e,t){if(!(!e.client||!e.connected))try{const n=await e.client.request("cron.runs",{id:t,limit:50});e.cronRunsJobId=t,e.cronRuns=Array.isArray(n.entries)?n.entries:[]}catch(n){e.cronError=String(n)}}const _r="openclaw.device.auth.v1";function Di(e){return e.trim()}function xd(e){if(!Array.isArray(e))return[];const t=new Set;for(const n of e){const s=n.trim();s&&t.add(s)}return[...t].toSorted()}function Fi(){try{const e=window.localStorage.getItem(_r);if(!e)return null;const t=JSON.parse(e);return!t||t.version!==1||!t.deviceId||typeof t.deviceId!="string"||!t.tokens||typeof t.tokens!="object"?null:t}catch{return null}}function Er(e){try{window.localStorage.setItem(_r,JSON.stringify(e))}catch{}}function $d(e){const t=Fi();if(!t||t.deviceId!==e.deviceId)return null;const n=Di(e.role),s=t.tokens[n];return!s||typeof s.token!="string"?null:s}function Lr(e){const t=Di(e.role),n={version:1,deviceId:e.deviceId,tokens:{}},s=Fi();s&&s.deviceId===e.deviceId&&(n.tokens={...s.tokens});const i={token:e.token,role:t,scopes:xd(e.scopes),updatedAtMs:Date.now()};return n.tokens[t]=i,Er(n),i}function Mr(e){const t=Fi();if(!t||t.deviceId!==e.deviceId)return;const n=Di(e.role);if(!t.tokens[n])return;const s={...t,tokens:{...t.tokens}};delete s.tokens[n],Er(s)}const Ir={p:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn,n:0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3edn,h:8n,a:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffecn,d:0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3n,Gx:0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,Gy:0x6666666666666666666666666666666666666666666666666666666666666658n},{p:ue,n:Pn,Gx:qa,Gy:Ga,a:Ss,d:As,h:wd}=Ir,vt=32,Ni=64,kd=(...e)=>{"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(...e)},oe=(e="")=>{const t=new Error(e);throw kd(t,oe),t},Sd=e=>typeof e=="bigint",Ad=e=>typeof e=="string",Cd=e=>e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array",Ze=(e,t,n="")=>{const s=Cd(e),i=e?.length,a=t!==void 0;if(!s||a&&i!==t){const o=n&&`"${n}" `,l=a?` of length ${t}`:"",c=s?`length=${i}`:`type=${typeof e}`;oe(o+"expected Uint8Array"+l+", got "+c)}return e},ns=e=>new Uint8Array(e),Rr=e=>Uint8Array.from(e),Pr=(e,t)=>e.toString(16).padStart(t,"0"),Dr=e=>Array.from(Ze(e)).map(t=>Pr(t,2)).join(""),He={_0:48,_9:57,A:65,F:70,a:97,f:102},Va=e=>{if(e>=He._0&&e<=He._9)return e-He._0;if(e>=He.A&&e<=He.F)return e-(He.A-10);if(e>=He.a&&e<=He.f)return e-(He.a-10)},Fr=e=>{const t="hex invalid";if(!Ad(e))return oe(t);const n=e.length,s=n/2;if(n%2)return oe(t);const i=ns(s);for(let a=0,o=0;a<s;a++,o+=2){const l=Va(e.charCodeAt(o)),c=Va(e.charCodeAt(o+1));if(l===void 0||c===void 0)return oe(t);i[a]=l*16+c}return i},Nr=()=>globalThis?.crypto,Td=()=>Nr()?.subtle??oe("crypto.subtle must be defined, consider polyfill"),tn=(...e)=>{const t=ns(e.reduce((s,i)=>s+Ze(i).length,0));let n=0;return e.forEach(s=>{t.set(s,n),n+=s.length}),t},_d=(e=vt)=>Nr().getRandomValues(ns(e)),Bn=BigInt,rt=(e,t,n,s="bad number: out of range")=>Sd(e)&&t<=e&&e<n?e:oe(s),D=(e,t=ue)=>{const n=e%t;return n>=0n?n:t+n},Or=e=>D(e,Pn),Ed=(e,t)=>{(e===0n||t<=0n)&&oe("no inverse n="+e+" mod="+t);let n=D(e,t),s=t,i=0n,a=1n;for(;n!==0n;){const o=s/n,l=s%n,c=i-a*o;s=n,n=l,i=a,a=c}return s===1n?D(i,t):oe("no inverse")},Ld=e=>{const t=Hr[e];return typeof t!="function"&&oe("hashes."+e+" not set"),t},Cs=e=>e instanceof Se?e:oe("Point expected"),Js=2n**256n;class Se{static BASE;static ZERO;X;Y;Z;T;constructor(t,n,s,i){const a=Js;this.X=rt(t,0n,a),this.Y=rt(n,0n,a),this.Z=rt(s,1n,a),this.T=rt(i,0n,a),Object.freeze(this)}static CURVE(){return Ir}static fromAffine(t){return new Se(t.x,t.y,1n,D(t.x*t.y))}static fromBytes(t,n=!1){const s=As,i=Rr(Ze(t,vt)),a=t[31];i[31]=a&-129;const o=Ur(i);rt(o,0n,n?Js:ue);const c=D(o*o),u=D(c-1n),g=D(s*c+1n);let{isValid:p,value:h}=Id(u,g);p||oe("bad point: y not sqrt");const d=(h&1n)===1n,f=(a&128)!==0;return!n&&h===0n&&f&&oe("bad point: x==0, isLastByteOdd"),f!==d&&(h=D(-h)),new Se(h,o,1n,D(h*o))}static fromHex(t,n){return Se.fromBytes(Fr(t),n)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}assertValidity(){const t=Ss,n=As,s=this;if(s.is0())return oe("bad point: ZERO");const{X:i,Y:a,Z:o,T:l}=s,c=D(i*i),u=D(a*a),g=D(o*o),p=D(g*g),h=D(c*t),d=D(g*D(h+u)),f=D(p+D(n*D(c*u)));if(d!==f)return oe("bad point: equation left != right (1)");const m=D(i*a),S=D(o*l);return m!==S?oe("bad point: equation left != right (2)"):this}equals(t){const{X:n,Y:s,Z:i}=this,{X:a,Y:o,Z:l}=Cs(t),c=D(n*l),u=D(a*i),g=D(s*l),p=D(o*i);return c===u&&g===p}is0(){return this.equals(_t)}negate(){return new Se(D(-this.X),this.Y,this.Z,D(-this.T))}double(){const{X:t,Y:n,Z:s}=this,i=Ss,a=D(t*t),o=D(n*n),l=D(2n*D(s*s)),c=D(i*a),u=t+n,g=D(D(u*u)-a-o),p=c+o,h=p-l,d=c-o,f=D(g*h),m=D(p*d),S=D(g*d),k=D(h*p);return new Se(f,m,k,S)}add(t){const{X:n,Y:s,Z:i,T:a}=this,{X:o,Y:l,Z:c,T:u}=Cs(t),g=Ss,p=As,h=D(n*o),d=D(s*l),f=D(a*p*u),m=D(i*c),S=D((n+s)*(o+l)-h-d),k=D(m-f),$=D(m+f),A=D(d-g*h),C=D(S*k),_=D($*A),T=D(S*A),I=D(k*$);return new Se(C,_,I,T)}subtract(t){return this.add(Cs(t).negate())}multiply(t,n=!0){if(!n&&(t===0n||this.is0()))return _t;if(rt(t,1n,Pn),t===1n)return this;if(this.equals(mt))return jd(t).p;let s=_t,i=mt;for(let a=this;t>0n;a=a.double(),t>>=1n)t&1n?s=s.add(a):n&&(i=i.add(a));return s}multiplyUnsafe(t){return this.multiply(t,!1)}toAffine(){const{X:t,Y:n,Z:s}=this;if(this.equals(_t))return{x:0n,y:1n};const i=Ed(s,ue);D(s*i)!==1n&&oe("invalid inverse");const a=D(t*i),o=D(n*i);return{x:a,y:o}}toBytes(){const{x:t,y:n}=this.assertValidity().toAffine(),s=Br(n);return s[31]|=t&1n?128:0,s}toHex(){return Dr(this.toBytes())}clearCofactor(){return this.multiply(Bn(wd),!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){let t=this.multiply(Pn/2n,!1).double();return Pn%2n&&(t=t.add(this)),t.is0()}}const mt=new Se(qa,Ga,1n,D(qa*Ga)),_t=new Se(0n,1n,1n,0n);Se.BASE=mt;Se.ZERO=_t;const Br=e=>Fr(Pr(rt(e,0n,Js),Ni)).reverse(),Ur=e=>Bn("0x"+Dr(Rr(Ze(e)).reverse())),Re=(e,t)=>{let n=e;for(;t-- >0n;)n*=n,n%=ue;return n},Md=e=>{const n=e*e%ue*e%ue,s=Re(n,2n)*n%ue,i=Re(s,1n)*e%ue,a=Re(i,5n)*i%ue,o=Re(a,10n)*a%ue,l=Re(o,20n)*o%ue,c=Re(l,40n)*l%ue,u=Re(c,80n)*c%ue,g=Re(u,80n)*c%ue,p=Re(g,10n)*a%ue;return{pow_p_5_8:Re(p,2n)*e%ue,b2:n}},Qa=0x2b8324804fc1df0b2b4d00993dfbd7a72f431806ad2fe478c4ee1b274a0ea0b0n,Id=(e,t)=>{const n=D(t*t*t),s=D(n*n*t),i=Md(e*s).pow_p_5_8;let a=D(e*n*i);const o=D(t*a*a),l=a,c=D(a*Qa),u=o===e,g=o===D(-e),p=o===D(-e*Qa);return u&&(a=l),(g||p)&&(a=c),(D(a)&1n)===1n&&(a=D(-a)),{isValid:u||g,value:a}},Zs=e=>Or(Ur(e)),Oi=(...e)=>Hr.sha512Async(tn(...e)),Rd=(...e)=>Ld("sha512")(tn(...e)),zr=e=>{const t=e.slice(0,vt);t[0]&=248,t[31]&=127,t[31]|=64;const n=e.slice(vt,Ni),s=Zs(t),i=mt.multiply(s),a=i.toBytes();return{head:t,prefix:n,scalar:s,point:i,pointBytes:a}},Bi=e=>Oi(Ze(e,vt)).then(zr),Pd=e=>zr(Rd(Ze(e,vt))),Dd=e=>Bi(e).then(t=>t.pointBytes),Fd=e=>Oi(e.hashable).then(e.finish),Nd=(e,t,n)=>{const{pointBytes:s,scalar:i}=e,a=Zs(t),o=mt.multiply(a).toBytes();return{hashable:tn(o,s,n),finish:u=>{const g=Or(a+Zs(u)*i);return Ze(tn(o,Br(g)),Ni)}}},Od=async(e,t)=>{const n=Ze(e),s=await Bi(t),i=await Oi(s.prefix,n);return Fd(Nd(s,i,n))},Hr={sha512Async:async e=>{const t=Td(),n=tn(e);return ns(await t.digest("SHA-512",n.buffer))},sha512:void 0},Bd=(e=_d(vt))=>e,Ud={getExtendedPublicKeyAsync:Bi,getExtendedPublicKey:Pd,randomSecretKey:Bd},Un=8,zd=256,jr=Math.ceil(zd/Un)+1,Xs=2**(Un-1),Hd=()=>{const e=[];let t=mt,n=t;for(let s=0;s<jr;s++){n=t,e.push(n);for(let i=1;i<Xs;i++)n=n.add(t),e.push(n);t=n.double()}return e};let Ya;const Ja=(e,t)=>{const n=t.negate();return e?n:t},jd=e=>{const t=Ya||(Ya=Hd());let n=_t,s=mt;const i=2**Un,a=i,o=Bn(i-1),l=Bn(Un);for(let c=0;c<jr;c++){let u=Number(e&o);e>>=l,u>Xs&&(u-=a,e+=1n);const g=c*Xs,p=g,h=g+Math.abs(u)-1,d=c%2!==0,f=u<0;u===0?s=s.add(Ja(d,t[p])):n=n.add(Ja(f,t[h]))}return e!==0n&&oe("invalid wnaf"),{p:n,f:s}},Ts="openclaw-device-identity-v1";function ei(e){let t="";for(const n of e)t+=String.fromCharCode(n);return btoa(t).replaceAll("+","-").replaceAll("/","_").replace(/=+$/g,"")}function Kr(e){const t=e.replaceAll("-","+").replaceAll("_","/"),n=t+"=".repeat((4-t.length%4)%4),s=atob(n),i=new Uint8Array(s.length);for(let a=0;a<s.length;a+=1)i[a]=s.charCodeAt(a);return i}function Kd(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}async function Wr(e){const t=await crypto.subtle.digest("SHA-256",e.slice().buffer);return Kd(new Uint8Array(t))}async function Wd(){const e=Ud.randomSecretKey(),t=await Dd(e);return{deviceId:await Wr(t),publicKey:ei(t),privateKey:ei(e)}}async function Ui(){try{const n=localStorage.getItem(Ts);if(n){const s=JSON.parse(n);if(s?.version===1&&typeof s.deviceId=="string"&&typeof s.publicKey=="string"&&typeof s.privateKey=="string"){const i=await Wr(Kr(s.publicKey));if(i!==s.deviceId){const a={...s,deviceId:i};return localStorage.setItem(Ts,JSON.stringify(a)),{deviceId:i,publicKey:s.publicKey,privateKey:s.privateKey}}return{deviceId:s.deviceId,publicKey:s.publicKey,privateKey:s.privateKey}}}}catch{}const e=await Wd(),t={version:1,deviceId:e.deviceId,publicKey:e.publicKey,privateKey:e.privateKey,createdAtMs:Date.now()};return localStorage.setItem(Ts,JSON.stringify(t)),e}async function qd(e,t){const n=Kr(e),s=new TextEncoder().encode(t),i=await Od(s,n);return ei(i)}async function Xe(e,t){if(!(!e.client||!e.connected)&&!e.devicesLoading){e.devicesLoading=!0,t?.quiet||(e.devicesError=null);try{const n=await e.client.request("device.pair.list",{});e.devicesList={pending:Array.isArray(n?.pending)?n.pending:[],paired:Array.isArray(n?.paired)?n.paired:[]}}catch(n){t?.quiet||(e.devicesError=String(n))}finally{e.devicesLoading=!1}}}async function Gd(e,t){if(!(!e.client||!e.connected))try{await e.client.request("device.pair.approve",{requestId:t}),await Xe(e)}catch(n){e.devicesError=String(n)}}async function Vd(e,t){if(!(!e.client||!e.connected||!window.confirm("Reject this device pairing request?")))try{await e.client.request("device.pair.reject",{requestId:t}),await Xe(e)}catch(s){e.devicesError=String(s)}}async function Qd(e,t){if(!(!e.client||!e.connected))try{const n=await e.client.request("device.token.rotate",t);if(n?.token){const s=await Ui(),i=n.role??t.role;(n.deviceId===s.deviceId||t.deviceId===s.deviceId)&&Lr({deviceId:s.deviceId,role:i,token:n.token,scopes:n.scopes??t.scopes??[]}),window.prompt("New device token (copy and store securely):",n.token)}await Xe(e)}catch(n){e.devicesError=String(n)}}async function Yd(e,t){if(!(!e.client||!e.connected||!window.confirm(`Revoke token for ${t.deviceId} (${t.role})?`)))try{await e.client.request("device.token.revoke",t);const s=await Ui();t.deviceId===s.deviceId&&Mr({deviceId:s.deviceId,role:t.role}),await Xe(e)}catch(s){e.devicesError=String(s)}}function Jd(e){if(!e||e.kind==="gateway")return{method:"exec.approvals.get",params:{}};const t=e.nodeId.trim();return t?{method:"exec.approvals.node.get",params:{nodeId:t}}:null}function Zd(e,t){if(!e||e.kind==="gateway")return{method:"exec.approvals.set",params:t};const n=e.nodeId.trim();return n?{method:"exec.approvals.node.set",params:{...t,nodeId:n}}:null}async function zi(e,t){if(!(!e.client||!e.connected)&&!e.execApprovalsLoading){e.execApprovalsLoading=!0,e.lastError=null;try{const n=Jd(t);if(!n){e.lastError="Select a node before loading exec approvals.";return}const s=await e.client.request(n.method,n.params);Xd(e,s)}catch(n){e.lastError=String(n)}finally{e.execApprovalsLoading=!1}}}function Xd(e,t){e.execApprovalsSnapshot=t,e.execApprovalsDirty||(e.execApprovalsForm=ft(t.file??{}))}async function eu(e,t){if(!(!e.client||!e.connected)){e.execApprovalsSaving=!0,e.lastError=null;try{const n=e.execApprovalsSnapshot?.hash;if(!n){e.lastError="Exec approvals hash missing; reload and retry.";return}const s=e.execApprovalsForm??e.execApprovalsSnapshot?.file??{},i=Zd(t,{file:s,baseHash:n});if(!i){e.lastError="Select a node before saving exec approvals.";return}await e.client.request(i.method,i.params),e.execApprovalsDirty=!1,await zi(e,t)}catch(n){e.lastError=String(n)}finally{e.execApprovalsSaving=!1}}}function tu(e,t,n){const s=ft(e.execApprovalsForm??e.execApprovalsSnapshot?.file??{});hr(s,t,n),e.execApprovalsForm=s,e.execApprovalsDirty=!0}function nu(e,t){const n=ft(e.execApprovalsForm??e.execApprovalsSnapshot?.file??{});vr(n,t),e.execApprovalsForm=n,e.execApprovalsDirty=!0}async function Hi(e){if(!(!e.client||!e.connected)&&!e.presenceLoading){e.presenceLoading=!0,e.presenceError=null,e.presenceStatus=null;try{const t=await e.client.request("system-presence",{});Array.isArray(t)?(e.presenceEntries=t,e.presenceStatus=t.length===0?"No instances yet.":null):(e.presenceEntries=[],e.presenceStatus="No presence payload.")}catch(t){e.presenceError=String(t)}finally{e.presenceLoading=!1}}}async function yt(e,t){if(!(!e.client||!e.connected)&&!e.sessionsLoading){e.sessionsLoading=!0,e.sessionsError=null;try{const n=t?.includeGlobal??e.sessionsIncludeGlobal,s=t?.includeUnknown??e.sessionsIncludeUnknown,i=t?.activeMinutes??On(e.sessionsFilterActive,0),a=t?.limit??On(e.sessionsFilterLimit,0),o={includeGlobal:n,includeUnknown:s};i>0&&(o.activeMinutes=i),a>0&&(o.limit=a);const l=await e.client.request("sessions.list",o);l&&(e.sessionsResult=l)}catch(n){e.sessionsError=String(n)}finally{e.sessionsLoading=!1}}}async function su(e,t,n){if(!e.client||!e.connected)return;const s={key:t};"label"in n&&(s.label=n.label),"thinkingLevel"in n&&(s.thinkingLevel=n.thinkingLevel),"verboseLevel"in n&&(s.verboseLevel=n.verboseLevel),"reasoningLevel"in n&&(s.reasoningLevel=n.reasoningLevel);try{await e.client.request("sessions.patch",s),await yt(e)}catch(i){e.sessionsError=String(i)}}async function iu(e,t){if(!(!e.client||!e.connected||e.sessionsLoading||!window.confirm(`Delete session "${t}"?
|
|
127
127
|
|
|
128
|
-
Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,e.sessionsError=null;try{await e.client.request("sessions.delete",{key:t,deleteTranscript:!0}),await bt(e)}catch(s){e.sessionsError=String(s)}finally{e.sessionsLoading=!1}}}function Mt(e,t,n){if(!t.trim())return;const s={...e.skillMessages};n?s[t]=n:delete s[t],e.skillMessages=s}function ts(e){return e instanceof Error?e.message:String(e)}async function rn(e,t){if(t?.clearMessages&&Object.keys(e.skillMessages).length>0&&(e.skillMessages={}),!(!e.client||!e.connected)&&!e.skillsLoading){e.skillsLoading=!0,e.skillsError=null;try{const n=await e.client.request("skills.status",{});n&&(e.skillsReport=n)}catch(n){e.skillsError=ts(n)}finally{e.skillsLoading=!1}}}function Qd(e,t,n){e.skillEdits={...e.skillEdits,[t]:n}}async function Yd(e,t,n){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{await e.client.request("skills.update",{skillKey:t,enabled:n}),await rn(e),Mt(e,t,{kind:"success",message:n?"Skill enabled":"Skill disabled"})}catch(s){const i=ts(s);e.skillsError=i,Mt(e,t,{kind:"error",message:i})}finally{e.skillsBusyKey=null}}}async function Jd(e,t){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{const n=e.skillEdits[t]??"";await e.client.request("skills.update",{skillKey:t,apiKey:n}),await rn(e),Mt(e,t,{kind:"success",message:"API key saved"})}catch(n){const s=ts(n);e.skillsError=s,Mt(e,t,{kind:"error",message:s})}finally{e.skillsBusyKey=null}}}async function Zd(e,t,n,s){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{const i=await e.client.request("skills.install",{name:n,installId:s,timeoutMs:12e4});await rn(e),Mt(e,t,{kind:"success",message:i?.message??"Installed"})}catch(i){const a=ts(i);e.skillsError=a,Mt(e,t,{kind:"error",message:a})}finally{e.skillsBusyKey=null}}}const Xd=[{label:"Chat",tabs:["chat"]},{label:"Control",tabs:["overview","channels","instances","sessions","usage","cron"]},{label:"Agent",tabs:["agents","skills","nodes"]},{label:"Settings",tabs:["config","debug","logs"]}],Ur={agents:"/agents",overview:"/overview",channels:"/channels",instances:"/instances",sessions:"/sessions",usage:"/usage",cron:"/cron",skills:"/skills",nodes:"/nodes",chat:"/chat",config:"/config",debug:"/debug",logs:"/logs"},zr=new Map(Object.entries(Ur).map(([e,t])=>[t,e]));function ln(e){if(!e)return"";let t=e.trim();return t.startsWith("/")||(t=`/${t}`),t==="/"?"":(t.endsWith("/")&&(t=t.slice(0,-1)),t)}function tn(e){if(!e)return"/";let t=e.trim();return t.startsWith("/")||(t=`/${t}`),t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t}function ns(e,t=""){const n=ln(t),s=Ur[e];return n?`${n}${s}`:s}function Hr(e,t=""){const n=ln(t);let s=e||"/";n&&(s===n?s="/":s.startsWith(`${n}/`)&&(s=s.slice(n.length)));let i=tn(s).toLowerCase();return i.endsWith("/index.html")&&(i="/"),i==="/"?"chat":zr.get(i)??null}function eu(e){let t=tn(e);if(t.endsWith("/index.html")&&(t=tn(t.slice(0,-11))),t==="/")return"";const n=t.split("/").filter(Boolean);if(n.length===0)return"";for(let s=0;s<n.length;s++){const i=`/${n.slice(s).join("/")}`.toLowerCase();if(zr.has(i)){const a=n.slice(0,s);return a.length?`/${a.join("/")}`:""}}return`/${n.join("/")}`}function tu(e){switch(e){case"agents":return"folder";case"chat":return"messageSquare";case"overview":return"barChart";case"channels":return"link";case"instances":return"radio";case"sessions":return"fileText";case"usage":return"barChart";case"cron":return"loader";case"skills":return"zap";case"nodes":return"monitor";case"config":return"settings";case"debug":return"bug";case"logs":return"scrollText";default:return"folder"}}function ei(e){switch(e){case"agents":return"Agents";case"overview":return"Overview";case"channels":return"Channels";case"instances":return"Instances";case"sessions":return"Sessions";case"usage":return"Usage";case"cron":return"Cron Jobs";case"skills":return"Skills";case"nodes":return"Nodes";case"chat":return"Chat";case"config":return"Config";case"debug":return"Debug";case"logs":return"Logs";default:return"Control"}}function nu(e){switch(e){case"agents":return"Manage agent workspaces, tools, and identities.";case"overview":return"Gateway status, entry points, and a fast health read.";case"channels":return"Manage channels and settings.";case"instances":return"Presence beacons from connected clients and nodes.";case"sessions":return"Inspect active sessions and adjust per-session defaults.";case"usage":return"";case"cron":return"Schedule wakeups and recurring agent runs.";case"skills":return"Manage skill availability and API key injection.";case"nodes":return"Paired devices, capabilities, and command exposure.";case"chat":return"Direct gateway chat session for quick interventions.";case"config":return"Edit ~/.openclaw/openclaw.json safely.";case"debug":return"Gateway snapshots, events, and manual RPC calls.";case"logs":return"Live tail of the gateway file logs.";default:return""}}const jr="openclaw.control.settings.v1";function su(){const t={gatewayUrl:`${location.protocol==="https:"?"wss":"ws"}://${location.host}`,token:"",sessionKey:"main",lastActiveSessionKey:"main",theme:"system",chatFocusMode:!1,chatShowThinking:!0,splitRatio:.6,navCollapsed:!1,navGroupsCollapsed:{}};try{const n=localStorage.getItem(jr);if(!n)return t;const s=JSON.parse(n);return{gatewayUrl:typeof s.gatewayUrl=="string"&&s.gatewayUrl.trim()?s.gatewayUrl.trim():t.gatewayUrl,token:typeof s.token=="string"?s.token:t.token,sessionKey:typeof s.sessionKey=="string"&&s.sessionKey.trim()?s.sessionKey.trim():t.sessionKey,lastActiveSessionKey:typeof s.lastActiveSessionKey=="string"&&s.lastActiveSessionKey.trim()?s.lastActiveSessionKey.trim():typeof s.sessionKey=="string"&&s.sessionKey.trim()||t.lastActiveSessionKey,theme:s.theme==="light"||s.theme==="dark"||s.theme==="system"?s.theme:t.theme,chatFocusMode:typeof s.chatFocusMode=="boolean"?s.chatFocusMode:t.chatFocusMode,chatShowThinking:typeof s.chatShowThinking=="boolean"?s.chatShowThinking:t.chatShowThinking,splitRatio:typeof s.splitRatio=="number"&&s.splitRatio>=.4&&s.splitRatio<=.7?s.splitRatio:t.splitRatio,navCollapsed:typeof s.navCollapsed=="boolean"?s.navCollapsed:t.navCollapsed,navGroupsCollapsed:typeof s.navGroupsCollapsed=="object"&&s.navGroupsCollapsed!==null?s.navGroupsCollapsed:t.navGroupsCollapsed}}catch{return t}}function iu(e){localStorage.setItem(jr,JSON.stringify(e))}const yn=e=>Number.isNaN(e)?.5:e<=0?0:e>=1?1:e,au=()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches??!1,xn=e=>{e.classList.remove("theme-transition"),e.style.removeProperty("--theme-switch-x"),e.style.removeProperty("--theme-switch-y")},ou=({nextTheme:e,applyTheme:t,context:n,currentTheme:s})=>{if(s===e)return;const i=globalThis.document??null;if(!i){t();return}const a=i.documentElement,o=i,l=au();if(!!o.startViewTransition&&!l){let u=.5,g=.5;if(n?.pointerClientX!==void 0&&n?.pointerClientY!==void 0&&typeof window<"u")u=yn(n.pointerClientX/window.innerWidth),g=yn(n.pointerClientY/window.innerHeight);else if(n?.element){const p=n.element.getBoundingClientRect();p.width>0&&p.height>0&&typeof window<"u"&&(u=yn((p.left+p.width/2)/window.innerWidth),g=yn((p.top+p.height/2)/window.innerHeight))}a.style.setProperty("--theme-switch-x",`${u*100}%`),a.style.setProperty("--theme-switch-y",`${g*100}%`),a.classList.add("theme-transition");try{const p=o.startViewTransition?.(()=>{t()});p?.finished?p.finished.finally(()=>xn(a)):xn(a)}catch{xn(a),t()}return}t(),xn(a)};function ru(){return typeof window>"u"||typeof window.matchMedia!="function"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Hi(e){return e==="system"?ru():e}function Ye(e,t){const n={...t,lastActiveSessionKey:t.lastActiveSessionKey?.trim()||t.sessionKey.trim()||"main"};e.settings=n,iu(n),t.theme!==e.theme&&(e.theme=t.theme,ss(e,Hi(t.theme))),e.applySessionKey=e.settings.lastActiveSessionKey}function Kr(e,t){const n=t.trim();n&&e.settings.lastActiveSessionKey!==n&&Ye(e,{...e.settings,lastActiveSessionKey:n})}function lu(e){if(!window.location.search&&!window.location.hash)return;const t=new URL(window.location.href),n=new URLSearchParams(t.search),s=new URLSearchParams(t.hash.startsWith("#")?t.hash.slice(1):t.hash),i=n.get("token")??s.get("token"),a=n.get("password")??s.get("password"),o=n.get("session")??s.get("session"),l=n.get("gatewayUrl")??s.get("gatewayUrl");let c=!1;if(i!=null){const g=i.trim();g&&g!==e.settings.token&&Ye(e,{...e.settings,token:g}),n.delete("token"),s.delete("token"),c=!0}if(a!=null){const g=a.trim();g&&(e.password=g),n.delete("password"),s.delete("password"),c=!0}if(o!=null){const g=o.trim();g&&(e.sessionKey=g,Ye(e,{...e.settings,sessionKey:g,lastActiveSessionKey:g}))}if(l!=null){const g=l.trim();g&&g!==e.settings.gatewayUrl&&(e.pendingGatewayUrl=g),n.delete("gatewayUrl"),s.delete("gatewayUrl"),c=!0}if(!c)return;t.search=n.toString();const u=s.toString();t.hash=u?`#${u}`:"",window.history.replaceState({},"",t.toString())}function cu(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?Ti(e):_i(e),t==="debug"?Ei(e):Li(e),ji(e),qr(e,t,!1)}function du(e,t,n){ou({nextTheme:t,applyTheme:()=>{e.theme=t,Ye(e,{...e.settings,theme:t}),ss(e,Hi(t))},context:n,currentTheme:e.theme})}async function ji(e){if(e.tab==="overview"&&await Gr(e),e.tab==="channels"&&await bu(e),e.tab==="instances"&&await zi(e),e.tab==="sessions"&&await bt(e),e.tab==="cron"&&await Un(e),e.tab==="skills"&&await rn(e),e.tab==="agents"){await Mi(e),await Ee(e);const t=e.agentsList?.agents?.map(s=>s.id)??[];t.length>0&&yr(e,t);const n=e.agentsSelectedId??e.agentsList?.defaultId??e.agentsList?.agents?.[0]?.id;n&&(br(e,n),e.agentsPanel==="skills"&&In(e,n),e.agentsPanel==="channels"&&ye(e,!1),e.agentsPanel==="cron"&&Un(e))}e.tab==="nodes"&&(await Zn(e),await Ze(e),await Ee(e),await Ui(e)),e.tab==="chat"&&(await el(e),an(e,!e.chatHasAutoScrolled)),e.tab==="config"&&(await pr(e),await Ee(e)),e.tab==="debug"&&(await Jn(e),e.eventLog=e.eventLogBuffer),e.tab==="logs"&&(e.logsAtBottom=!0,await Ci(e,{reset:!0}),mr(e,!0))}function uu(){if(typeof window>"u")return"";const e=window.__OPENCLAW_CONTROL_UI_BASE_PATH__;return typeof e=="string"&&e.trim()?ln(e):eu(window.location.pathname)}function gu(e){e.theme=e.settings.theme??"system",ss(e,Hi(e.theme))}function ss(e,t){if(e.themeResolved=t,typeof document>"u")return;const n=document.documentElement;n.dataset.theme=t,n.style.colorScheme=t}function pu(e){if(typeof window>"u"||typeof window.matchMedia!="function")return;if(e.themeMedia=window.matchMedia("(prefers-color-scheme: dark)"),e.themeMediaHandler=n=>{e.theme==="system"&&ss(e,n.matches?"dark":"light")},typeof e.themeMedia.addEventListener=="function"){e.themeMedia.addEventListener("change",e.themeMediaHandler);return}e.themeMedia.addListener(e.themeMediaHandler)}function fu(e){if(!e.themeMedia||!e.themeMediaHandler)return;if(typeof e.themeMedia.removeEventListener=="function"){e.themeMedia.removeEventListener("change",e.themeMediaHandler);return}e.themeMedia.removeListener(e.themeMediaHandler),e.themeMedia=null,e.themeMediaHandler=null}function hu(e,t){if(typeof window>"u")return;const n=Hr(window.location.pathname,e.basePath)??"chat";Wr(e,n),qr(e,n,t)}function vu(e){if(typeof window>"u")return;const t=Hr(window.location.pathname,e.basePath);if(!t)return;const s=new URL(window.location.href).searchParams.get("session")?.trim();s&&(e.sessionKey=s,Ye(e,{...e.settings,sessionKey:s,lastActiveSessionKey:s})),Wr(e,t)}function Wr(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?Ti(e):_i(e),t==="debug"?Ei(e):Li(e),e.connected&&ji(e)}function qr(e,t,n){if(typeof window>"u")return;const s=tn(ns(t,e.basePath)),i=tn(window.location.pathname),a=new URL(window.location.href);t==="chat"&&e.sessionKey?a.searchParams.set("session",e.sessionKey):a.searchParams.delete("session"),i!==s&&(a.pathname=s),n?window.history.replaceState({},"",a.toString()):window.history.pushState({},"",a.toString())}function mu(e,t,n){if(typeof window>"u")return;const s=new URL(window.location.href);s.searchParams.set("session",t),window.history.replaceState({},"",s.toString())}async function Gr(e){await Promise.all([ye(e,!1),zi(e),bt(e),on(e),Jn(e)])}async function bu(e){await Promise.all([ye(e,!0),pr(e),Ee(e)])}async function Un(e){await Promise.all([ye(e,!1),on(e),Xn(e)])}const Qa=50,yu=80,xu=12e4;function $u(e){if(!e||typeof e!="object")return null;const t=e;if(typeof t.text=="string")return t.text;const n=t.content;if(!Array.isArray(n))return null;const s=n.map(i=>{if(!i||typeof i!="object")return null;const a=i;return a.type==="text"&&typeof a.text=="string"?a.text:null}).filter(i=>!!i);return s.length===0?null:s.join(`
|
|
129
|
-
`)}function
|
|
128
|
+
Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,e.sessionsError=null;try{await e.client.request("sessions.delete",{key:t,deleteTranscript:!0}),await yt(e)}catch(s){e.sessionsError=String(s)}finally{e.sessionsLoading=!1}}}function Mt(e,t,n){if(!t.trim())return;const s={...e.skillMessages};n?s[t]=n:delete s[t],e.skillMessages=s}function ss(e){return e instanceof Error?e.message:String(e)}async function ln(e,t){if(t?.clearMessages&&Object.keys(e.skillMessages).length>0&&(e.skillMessages={}),!(!e.client||!e.connected)&&!e.skillsLoading){e.skillsLoading=!0,e.skillsError=null;try{const n=await e.client.request("skills.status",{});n&&(e.skillsReport=n)}catch(n){e.skillsError=ss(n)}finally{e.skillsLoading=!1}}}function au(e,t,n){e.skillEdits={...e.skillEdits,[t]:n}}async function ou(e,t,n){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{await e.client.request("skills.update",{skillKey:t,enabled:n}),await ln(e),Mt(e,t,{kind:"success",message:n?"Skill enabled":"Skill disabled"})}catch(s){const i=ss(s);e.skillsError=i,Mt(e,t,{kind:"error",message:i})}finally{e.skillsBusyKey=null}}}async function ru(e,t){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{const n=e.skillEdits[t]??"";await e.client.request("skills.update",{skillKey:t,apiKey:n}),await ln(e),Mt(e,t,{kind:"success",message:"API key saved"})}catch(n){const s=ss(n);e.skillsError=s,Mt(e,t,{kind:"error",message:s})}finally{e.skillsBusyKey=null}}}async function lu(e,t,n,s){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{const i=await e.client.request("skills.install",{name:n,installId:s,timeoutMs:12e4});await ln(e),Mt(e,t,{kind:"success",message:i?.message??"Installed"})}catch(i){const a=ss(i);e.skillsError=a,Mt(e,t,{kind:"error",message:a})}finally{e.skillsBusyKey=null}}}const cu=[{label:"Chat",tabs:["chat"]},{label:"Control",tabs:["overview","channels","instances","sessions","usage","cron"]},{label:"Agent",tabs:["agents","skills","nodes"]},{label:"Settings",tabs:["config","debug","logs"]}],qr={agents:"/agents",overview:"/overview",channels:"/channels",instances:"/instances",sessions:"/sessions",usage:"/usage",cron:"/cron",skills:"/skills",nodes:"/nodes",chat:"/chat",config:"/config",debug:"/debug",logs:"/logs"},Gr=new Map(Object.entries(qr).map(([e,t])=>[t,e]));function cn(e){if(!e)return"";let t=e.trim();return t.startsWith("/")||(t=`/${t}`),t==="/"?"":(t.endsWith("/")&&(t=t.slice(0,-1)),t)}function nn(e){if(!e)return"/";let t=e.trim();return t.startsWith("/")||(t=`/${t}`),t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t}function is(e,t=""){const n=cn(t),s=qr[e];return n?`${n}${s}`:s}function Vr(e,t=""){const n=cn(t);let s=e||"/";n&&(s===n?s="/":s.startsWith(`${n}/`)&&(s=s.slice(n.length)));let i=nn(s).toLowerCase();return i.endsWith("/index.html")&&(i="/"),i==="/"?"chat":Gr.get(i)??null}function du(e){let t=nn(e);if(t.endsWith("/index.html")&&(t=nn(t.slice(0,-11))),t==="/")return"";const n=t.split("/").filter(Boolean);if(n.length===0)return"";for(let s=0;s<n.length;s++){const i=`/${n.slice(s).join("/")}`.toLowerCase();if(Gr.has(i)){const a=n.slice(0,s);return a.length?`/${a.join("/")}`:""}}return`/${n.join("/")}`}function uu(e){switch(e){case"agents":return"folder";case"chat":return"messageSquare";case"overview":return"barChart";case"channels":return"link";case"instances":return"radio";case"sessions":return"fileText";case"usage":return"barChart";case"cron":return"loader";case"skills":return"zap";case"nodes":return"monitor";case"config":return"settings";case"debug":return"bug";case"logs":return"scrollText";default:return"folder"}}function ti(e){switch(e){case"agents":return"Agents";case"overview":return"Overview";case"channels":return"Channels";case"instances":return"Instances";case"sessions":return"Sessions";case"usage":return"Usage";case"cron":return"Cron Jobs";case"skills":return"Skills";case"nodes":return"Nodes";case"chat":return"Chat";case"config":return"Config";case"debug":return"Debug";case"logs":return"Logs";default:return"Control"}}function gu(e){switch(e){case"agents":return"Manage agent workspaces, tools, and identities.";case"overview":return"Gateway status, entry points, and a fast health read.";case"channels":return"Manage channels and settings.";case"instances":return"Presence beacons from connected clients and nodes.";case"sessions":return"Inspect active sessions and adjust per-session defaults.";case"usage":return"";case"cron":return"Schedule wakeups and recurring agent runs.";case"skills":return"Manage skill availability and API key injection.";case"nodes":return"Paired devices, capabilities, and command exposure.";case"chat":return"Direct gateway chat session for quick interventions.";case"config":return"Edit ~/.openclaw/openclaw.json safely.";case"debug":return"Gateway snapshots, events, and manual RPC calls.";case"logs":return"Live tail of the gateway file logs.";default:return""}}const Qr="openclaw.control.settings.v1";function pu(){const t={gatewayUrl:`${location.protocol==="https:"?"wss":"ws"}://${location.host}`,token:"",sessionKey:"main",lastActiveSessionKey:"main",theme:"system",chatFocusMode:!1,chatShowThinking:!0,splitRatio:.6,navCollapsed:!1,navGroupsCollapsed:{}};try{const n=localStorage.getItem(Qr);if(!n)return t;const s=JSON.parse(n);return{gatewayUrl:typeof s.gatewayUrl=="string"&&s.gatewayUrl.trim()?s.gatewayUrl.trim():t.gatewayUrl,token:typeof s.token=="string"?s.token:t.token,sessionKey:typeof s.sessionKey=="string"&&s.sessionKey.trim()?s.sessionKey.trim():t.sessionKey,lastActiveSessionKey:typeof s.lastActiveSessionKey=="string"&&s.lastActiveSessionKey.trim()?s.lastActiveSessionKey.trim():typeof s.sessionKey=="string"&&s.sessionKey.trim()||t.lastActiveSessionKey,theme:s.theme==="light"||s.theme==="dark"||s.theme==="system"?s.theme:t.theme,chatFocusMode:typeof s.chatFocusMode=="boolean"?s.chatFocusMode:t.chatFocusMode,chatShowThinking:typeof s.chatShowThinking=="boolean"?s.chatShowThinking:t.chatShowThinking,splitRatio:typeof s.splitRatio=="number"&&s.splitRatio>=.4&&s.splitRatio<=.7?s.splitRatio:t.splitRatio,navCollapsed:typeof s.navCollapsed=="boolean"?s.navCollapsed:t.navCollapsed,navGroupsCollapsed:typeof s.navGroupsCollapsed=="object"&&s.navGroupsCollapsed!==null?s.navGroupsCollapsed:t.navGroupsCollapsed}}catch{return t}}function fu(e){localStorage.setItem(Qr,JSON.stringify(e))}const xn=e=>Number.isNaN(e)?.5:e<=0?0:e>=1?1:e,hu=()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches??!1,$n=e=>{e.classList.remove("theme-transition"),e.style.removeProperty("--theme-switch-x"),e.style.removeProperty("--theme-switch-y")},vu=({nextTheme:e,applyTheme:t,context:n,currentTheme:s})=>{if(s===e)return;const i=globalThis.document??null;if(!i){t();return}const a=i.documentElement,o=i,l=hu();if(!!o.startViewTransition&&!l){let u=.5,g=.5;if(n?.pointerClientX!==void 0&&n?.pointerClientY!==void 0&&typeof window<"u")u=xn(n.pointerClientX/window.innerWidth),g=xn(n.pointerClientY/window.innerHeight);else if(n?.element){const p=n.element.getBoundingClientRect();p.width>0&&p.height>0&&typeof window<"u"&&(u=xn((p.left+p.width/2)/window.innerWidth),g=xn((p.top+p.height/2)/window.innerHeight))}a.style.setProperty("--theme-switch-x",`${u*100}%`),a.style.setProperty("--theme-switch-y",`${g*100}%`),a.classList.add("theme-transition");try{const p=o.startViewTransition?.(()=>{t()});p?.finished?p.finished.finally(()=>$n(a)):$n(a)}catch{$n(a),t()}return}t(),$n(a)};function mu(){return typeof window>"u"||typeof window.matchMedia!="function"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function ji(e){return e==="system"?mu():e}function Je(e,t){const n={...t,lastActiveSessionKey:t.lastActiveSessionKey?.trim()||t.sessionKey.trim()||"main"};e.settings=n,fu(n),t.theme!==e.theme&&(e.theme=t.theme,as(e,ji(t.theme))),e.applySessionKey=e.settings.lastActiveSessionKey}function Yr(e,t){const n=t.trim();n&&e.settings.lastActiveSessionKey!==n&&Je(e,{...e.settings,lastActiveSessionKey:n})}function bu(e){if(!window.location.search&&!window.location.hash)return;const t=new URL(window.location.href),n=new URLSearchParams(t.search),s=new URLSearchParams(t.hash.startsWith("#")?t.hash.slice(1):t.hash),i=n.get("token")??s.get("token"),a=n.get("password")??s.get("password"),o=n.get("session")??s.get("session"),l=n.get("gatewayUrl")??s.get("gatewayUrl");let c=!1;if(i!=null){const g=i.trim();g&&g!==e.settings.token&&Je(e,{...e.settings,token:g}),n.delete("token"),s.delete("token"),c=!0}if(a!=null){const g=a.trim();g&&(e.password=g),n.delete("password"),s.delete("password"),c=!0}if(o!=null){const g=o.trim();g&&(e.sessionKey=g,Je(e,{...e.settings,sessionKey:g,lastActiveSessionKey:g}))}if(l!=null){const g=l.trim();g&&g!==e.settings.gatewayUrl&&(e.pendingGatewayUrl=g),n.delete("gatewayUrl"),s.delete("gatewayUrl"),c=!0}if(!c)return;t.search=n.toString();const u=s.toString();t.hash=u?`#${u}`:"",window.history.replaceState({},"",t.toString())}function yu(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?_i(e):Ei(e),t==="debug"?Li(e):Mi(e),Ki(e),Zr(e,t,!1)}function xu(e,t,n){vu({nextTheme:t,applyTheme:()=>{e.theme=t,Je(e,{...e.settings,theme:t}),as(e,ji(t))},context:n,currentTheme:e.theme})}async function Ki(e){if(e.tab==="overview"&&await Xr(e),e.tab==="channels"&&await _u(e),e.tab==="instances"&&await Hi(e),e.tab==="sessions"&&await yt(e),e.tab==="cron"&&await zn(e),e.tab==="skills"&&await ln(e),e.tab==="agents"){await Ii(e),await Le(e);const t=e.agentsList?.agents?.map(s=>s.id)??[];t.length>0&&Ar(e,t);const n=e.agentsSelectedId??e.agentsList?.defaultId??e.agentsList?.agents?.[0]?.id;n&&(Sr(e,n),e.agentsPanel==="skills"&&Rn(e,n),e.agentsPanel==="channels"&&ye(e,!1),e.agentsPanel==="cron"&&zn(e))}e.tab==="nodes"&&(await es(e),await Xe(e),await Le(e),await zi(e)),e.tab==="chat"&&(await ol(e),on(e,!e.chatHasAutoScrolled)),e.tab==="config"&&(await mr(e),await Le(e)),e.tab==="debug"&&(await Xn(e),e.eventLog=e.eventLogBuffer),e.tab==="logs"&&(e.logsAtBottom=!0,await Ti(e,{reset:!0}),kr(e,!0))}function $u(){if(typeof window>"u")return"";const e=window.__OPENCLAW_CONTROL_UI_BASE_PATH__;return typeof e=="string"&&e.trim()?cn(e):du(window.location.pathname)}function wu(e){e.theme=e.settings.theme??"system",as(e,ji(e.theme))}function as(e,t){if(e.themeResolved=t,typeof document>"u")return;const n=document.documentElement;n.dataset.theme=t,n.style.colorScheme=t}function ku(e){if(typeof window>"u"||typeof window.matchMedia!="function")return;if(e.themeMedia=window.matchMedia("(prefers-color-scheme: dark)"),e.themeMediaHandler=n=>{e.theme==="system"&&as(e,n.matches?"dark":"light")},typeof e.themeMedia.addEventListener=="function"){e.themeMedia.addEventListener("change",e.themeMediaHandler);return}e.themeMedia.addListener(e.themeMediaHandler)}function Su(e){if(!e.themeMedia||!e.themeMediaHandler)return;if(typeof e.themeMedia.removeEventListener=="function"){e.themeMedia.removeEventListener("change",e.themeMediaHandler);return}e.themeMedia.removeListener(e.themeMediaHandler),e.themeMedia=null,e.themeMediaHandler=null}function Au(e,t){if(typeof window>"u")return;const n=Vr(window.location.pathname,e.basePath)??"chat";Jr(e,n),Zr(e,n,t)}function Cu(e){if(typeof window>"u")return;const t=Vr(window.location.pathname,e.basePath);if(!t)return;const s=new URL(window.location.href).searchParams.get("session")?.trim();s&&(e.sessionKey=s,Je(e,{...e.settings,sessionKey:s,lastActiveSessionKey:s})),Jr(e,t)}function Jr(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?_i(e):Ei(e),t==="debug"?Li(e):Mi(e),e.connected&&Ki(e)}function Zr(e,t,n){if(typeof window>"u")return;const s=nn(is(t,e.basePath)),i=nn(window.location.pathname),a=new URL(window.location.href);t==="chat"&&e.sessionKey?a.searchParams.set("session",e.sessionKey):a.searchParams.delete("session"),i!==s&&(a.pathname=s),n?window.history.replaceState({},"",a.toString()):window.history.pushState({},"",a.toString())}function Tu(e,t,n){if(typeof window>"u")return;const s=new URL(window.location.href);s.searchParams.set("session",t),window.history.replaceState({},"",s.toString())}async function Xr(e){await Promise.all([ye(e,!1),Hi(e),yt(e),rn(e),Xn(e)])}async function _u(e){await Promise.all([ye(e,!0),mr(e),Le(e)])}async function zn(e){await Promise.all([ye(e,!1),rn(e),ts(e)])}const Za=50,Eu=80,Lu=12e4;function Mu(e){if(!e||typeof e!="object")return null;const t=e;if(typeof t.text=="string")return t.text;const n=t.content;if(!Array.isArray(n))return null;const s=n.map(i=>{if(!i||typeof i!="object")return null;const a=i;return a.type==="text"&&typeof a.text=="string"?a.text:null}).filter(i=>!!i);return s.length===0?null:s.join(`
|
|
129
|
+
`)}function Xa(e){if(e==null)return null;if(typeof e=="number"||typeof e=="boolean")return String(e);const t=Mu(e);let n;if(typeof e=="string")n=e;else if(t)n=t;else try{n=JSON.stringify(e,null,2)}catch{n=String(e)}const s=Cr(n,Lu);return s.truncated?`${s.text}
|
|
130
130
|
|
|
131
|
-
… truncated (${s.total} chars, showing first ${s.text.length}).`:s.text}function
|
|
132
|
-
`);return n==="assistant"?
|
|
133
|
-
`);const i=
|
|
134
|
-
`):null}function
|
|
135
|
-
`)}return typeof t.text=="string"?t.text:null}function
|
|
136
|
-
`):""}let Za=!1;function Xa(e){e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t="";for(let n=0;n<e.length;n++)t+=e[n].toString(16).padStart(2,"0");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function Du(){const e=new Uint8Array(16),t=Date.now();for(let n=0;n<e.length;n++)e[n]=Math.floor(Math.random()*256);return e[0]^=t&255,e[1]^=t>>>8&255,e[2]^=t>>>16&255,e[3]^=t>>>24&255,e}function Fu(){Za||(Za=!0,console.warn("[uuid] crypto API missing; falling back to weak randomness"))}function Ki(e=globalThis.crypto){if(e&&typeof e.randomUUID=="function")return e.randomUUID();if(e&&typeof e.getRandomValues=="function"){const t=new Uint8Array(16);return e.getRandomValues(t),Xa(t)}return Fu(),Xa(Du())}async function nn(e){if(!(!e.client||!e.connected)){e.chatLoading=!0,e.lastError=null;try{const t=await e.client.request("chat.history",{sessionKey:e.sessionKey,limit:200});e.chatMessages=Array.isArray(t.messages)?t.messages:[],e.chatThinkingLevel=t.thinkingLevel??null}catch(t){e.lastError=String(t)}finally{e.chatLoading=!1}}}function Nu(e){const t=/^data:([^;]+);base64,(.+)$/.exec(e);return t?{mimeType:t[1],content:t[2]}:null}async function Ou(e,t,n){if(!e.client||!e.connected)return null;const s=t.trim(),i=n&&n.length>0;if(!s&&!i)return null;const a=Date.now(),o=[];if(s&&o.push({type:"text",text:s}),i)for(const u of n)o.push({type:"image",source:{type:"base64",media_type:u.mimeType,data:u.dataUrl}});e.chatMessages=[...e.chatMessages,{role:"user",content:o,timestamp:a}],e.chatSending=!0,e.lastError=null;const l=Ki();e.chatRunId=l,e.chatStream="",e.chatStreamStartedAt=a;const c=i?n.map(u=>{const g=Nu(u.dataUrl);return g?{type:"image",mimeType:g.mimeType,content:g.content}:null}).filter(u=>u!==null):void 0;try{return await e.client.request("chat.send",{sessionKey:e.sessionKey,message:s,deliver:!1,idempotencyKey:l,attachments:c}),l}catch(u){const g=String(u);return e.chatRunId=null,e.chatStream=null,e.chatStreamStartedAt=null,e.lastError=g,e.chatMessages=[...e.chatMessages,{role:"assistant",content:[{type:"text",text:"Error: "+g}],timestamp:Date.now()}],null}finally{e.chatSending=!1}}async function Bu(e){if(!e.client||!e.connected)return!1;const t=e.chatRunId;try{return await e.client.request("chat.abort",t?{sessionKey:e.sessionKey,runId:t}:{sessionKey:e.sessionKey}),!0}catch(n){return e.lastError=String(n),!1}}function Uu(e,t){if(!t||t.sessionKey!==e.sessionKey)return null;if(t.runId&&e.chatRunId&&t.runId!==e.chatRunId)return t.state==="final"?"final":null;if(t.state==="delta"){const n=ni(t.message);if(typeof n=="string"){const s=e.chatStream??"";(!s||n.length>=s.length)&&(e.chatStream=n)}}else t.state==="final"||t.state==="aborted"?(e.chatStream=null,e.chatRunId=null,e.chatStreamStartedAt=null):t.state==="error"&&(e.chatStream=null,e.chatRunId=null,e.chatStreamStartedAt=null,e.lastError=t.errorMessage??"chat error");return t.state}const Qr=120;function Yr(e){return e.chatSending||!!e.chatRunId}function zu(e){const t=e.trim();if(!t)return!1;const n=t.toLowerCase();return n==="/stop"?!0:n==="stop"||n==="esc"||n==="abort"||n==="wait"||n==="exit"}function Hu(e){const t=e.trim();if(!t)return!1;const n=t.toLowerCase();return n==="/new"||n==="/reset"?!0:n.startsWith("/new ")||n.startsWith("/reset ")}async function Jr(e){e.connected&&(e.chatMessage="",await Bu(e))}function ju(e,t,n,s){const i=t.trim(),a=!!(n&&n.length>0);!i&&!a||(e.chatQueue=[...e.chatQueue,{id:Ki(),text:i,createdAt:Date.now(),attachments:a?n?.map(o=>({...o})):void 0,refreshSessions:s}])}async function Zr(e,t,n){is(e);const s=await Ou(e,t,n?.attachments),i=!!s;return!i&&n?.previousDraft!=null&&(e.chatMessage=n.previousDraft),!i&&n?.previousAttachments&&(e.chatAttachments=n.previousAttachments),i&&Kr(e,e.sessionKey),i&&n?.restoreDraft&&n.previousDraft?.trim()&&(e.chatMessage=n.previousDraft),i&&n?.restoreAttachments&&n.previousAttachments?.length&&(e.chatAttachments=n.previousAttachments),an(e),i&&!e.chatRunId&&Xr(e),i&&n?.refreshSessions&&s&&e.refreshSessionsAfterChat.add(s),i}async function Xr(e){if(!e.connected||Yr(e))return;const[t,...n]=e.chatQueue;if(!t)return;e.chatQueue=n,await Zr(e,t.text,{attachments:t.attachments,refreshSessions:t.refreshSessions})||(e.chatQueue=[t,...e.chatQueue])}function Ku(e,t){e.chatQueue=e.chatQueue.filter(n=>n.id!==t)}async function Wu(e,t,n){if(!e.connected)return;const s=e.chatMessage,i=(t??e.chatMessage).trim(),a=e.chatAttachments??[],o=t==null?a:[],l=o.length>0;if(!i&&!l)return;if(zu(i)){await Jr(e);return}const c=Hu(i);if(t==null&&(e.chatMessage="",e.chatAttachments=[]),Yr(e)){ju(e,i,o,c);return}await Zr(e,i,{previousDraft:t==null?s:void 0,restoreDraft:!!(t&&n?.restoreDraft),attachments:l?o:void 0,previousAttachments:t==null?a:void 0,restoreAttachments:!!(t&&n?.restoreDraft),refreshSessions:c})}async function el(e,t){await Promise.all([nn(e),bt(e,{activeMinutes:Qr}),si(e)]),t?.scheduleScroll!==!1&&an(e)}const qu=Xr;function Gu(e){const t=vr(e.sessionKey);return t?.agentId?t.agentId:e.hello?.snapshot?.sessionDefaults?.defaultAgentId?.trim()||"main"}function Vu(e,t){const n=ln(e),s=encodeURIComponent(t);return n?`${n}/avatar/${s}?meta=1`:`/avatar/${s}?meta=1`}async function si(e){if(!e.connected){e.chatAvatarUrl=null;return}const t=Gu(e);if(!t){e.chatAvatarUrl=null;return}e.chatAvatarUrl=null;const n=Vu(e.basePath,t);try{const s=await fetch(n,{method:"GET"});if(!s.ok){e.chatAvatarUrl=null;return}const i=await s.json(),a=typeof i.avatarUrl=="string"?i.avatarUrl.trim():"";e.chatAvatarUrl=a||null}catch{e.chatAvatarUrl=null}}const Qu={trace:!0,debug:!0,info:!0,warn:!0,error:!0,fatal:!0},Yu={name:"",description:"",agentId:"",enabled:!0,scheduleKind:"every",scheduleAt:"",everyAmount:"30",everyUnit:"minutes",cronExpr:"0 7 * * *",cronTz:"",sessionTarget:"isolated",wakeMode:"now",payloadKind:"agentTurn",payloadText:"",deliveryMode:"announce",deliveryChannel:"last",deliveryTo:"",timeoutSeconds:""},Ju=50,Zu=200,Xu="Assistant";function eo(e,t){if(typeof e!="string")return;const n=e.trim();if(n)return n.length<=t?n:n.slice(0,t)}function ii(e){const t=eo(e?.name,Ju)??Xu,n=eo(e?.avatar??void 0,Zu)??null;return{agentId:typeof e?.agentId=="string"&&e.agentId.trim()?e.agentId.trim():null,name:t,avatar:n}}function eg(){return ii(typeof window>"u"?{}:{name:window.__OPENCLAW_ASSISTANT_NAME__,avatar:window.__OPENCLAW_ASSISTANT_AVATAR__})}async function tl(e,t){if(!e.client||!e.connected)return;const n=e.sessionKey.trim(),s=n?{sessionKey:n}:{};try{const i=await e.client.request("agent.identity.get",s);if(!i)return;const a=ii(i);e.assistantName=a.name,e.assistantAvatar=a.avatar,e.assistantAgentId=a.agentId??null}catch{}}function ai(e){return typeof e=="object"&&e!==null}function tg(e){if(!ai(e))return null;const t=typeof e.id=="string"?e.id.trim():"",n=e.request;if(!t||!ai(n))return null;const s=typeof n.command=="string"?n.command.trim():"";if(!s)return null;const i=typeof e.createdAtMs=="number"?e.createdAtMs:0,a=typeof e.expiresAtMs=="number"?e.expiresAtMs:0;return!i||!a?null:{id:t,request:{command:s,cwd:typeof n.cwd=="string"?n.cwd:null,host:typeof n.host=="string"?n.host:null,security:typeof n.security=="string"?n.security:null,ask:typeof n.ask=="string"?n.ask:null,agentId:typeof n.agentId=="string"?n.agentId:null,resolvedPath:typeof n.resolvedPath=="string"?n.resolvedPath:null,sessionKey:typeof n.sessionKey=="string"?n.sessionKey:null},createdAtMs:i,expiresAtMs:a}}function ng(e){if(!ai(e))return null;const t=typeof e.id=="string"?e.id.trim():"";return t?{id:t,decision:typeof e.decision=="string"?e.decision:null,resolvedBy:typeof e.resolvedBy=="string"?e.resolvedBy:null,ts:typeof e.ts=="number"?e.ts:null}:null}function nl(e){const t=Date.now();return e.filter(n=>n.expiresAtMs>t)}function sg(e,t){const n=nl(e).filter(s=>s.id!==t.id);return n.push(t),n}function to(e,t){return nl(e).filter(n=>n.id!==t)}function ig(e){const t=e.version??(e.nonce?"v2":"v1"),n=e.scopes.join(","),s=e.token??"",i=[t,e.deviceId,e.clientId,e.clientMode,e.role,n,String(e.signedAtMs),s];return t==="v2"&&i.push(e.nonce??""),i.join("|")}const sl={WEBCHAT_UI:"webchat-ui",CONTROL_UI:"openclaw-control-ui",WEBCHAT:"webchat",CLI:"cli",GATEWAY_CLIENT:"gateway-client",MACOS_APP:"openclaw-macos",IOS_APP:"openclaw-ios",ANDROID_APP:"openclaw-android",NODE_HOST:"node-host",TEST:"test",FINGERPRINT:"fingerprint",PROBE:"openclaw-probe"},no=sl,oi={WEBCHAT:"webchat",CLI:"cli",UI:"ui",BACKEND:"backend",NODE:"node",PROBE:"probe",TEST:"test"};new Set(Object.values(sl));new Set(Object.values(oi));const ag=4008;class og{constructor(t){this.opts=t,this.ws=null,this.pending=new Map,this.closed=!1,this.lastSeq=null,this.connectNonce=null,this.connectSent=!1,this.connectTimer=null,this.backoffMs=800}start(){this.closed=!1,this.connect()}stop(){this.closed=!0,this.ws?.close(),this.ws=null,this.flushPending(new Error("gateway client stopped"))}get connected(){return this.ws?.readyState===WebSocket.OPEN}connect(){this.closed||(this.ws=new WebSocket(this.opts.url),this.ws.addEventListener("open",()=>this.queueConnect()),this.ws.addEventListener("message",t=>this.handleMessage(String(t.data??""))),this.ws.addEventListener("close",t=>{const n=String(t.reason??"");this.ws=null,this.flushPending(new Error(`gateway closed (${t.code}): ${n}`)),this.opts.onClose?.({code:t.code,reason:n}),this.scheduleReconnect()}),this.ws.addEventListener("error",()=>{}))}scheduleReconnect(){if(this.closed)return;const t=this.backoffMs;this.backoffMs=Math.min(this.backoffMs*1.7,15e3),window.setTimeout(()=>this.connect(),t)}flushPending(t){for(const[,n]of this.pending)n.reject(t);this.pending.clear()}async sendConnect(){if(this.connectSent)return;this.connectSent=!0,this.connectTimer!==null&&(window.clearTimeout(this.connectTimer),this.connectTimer=null);const t=typeof crypto<"u"&&!!crypto.subtle,n=["operator.admin","operator.approvals","operator.pairing"],s="operator";let i=null,a=!1,o=this.opts.token;if(t){i=await Bi();const g=ud({deviceId:i.deviceId,role:s})?.token;o=g??this.opts.token,a=!!(g&&this.opts.token)}const l=o||this.opts.password?{token:o,password:this.opts.password}:void 0;let c;if(t&&i){const g=Date.now(),p=this.connectNonce??void 0,h=ig({deviceId:i.deviceId,clientId:this.opts.clientName??no.CONTROL_UI,clientMode:this.opts.mode??oi.WEBCHAT,role:s,scopes:n,signedAtMs:g,token:o??null,nonce:p}),d=await Fd(i.privateKey,h);c={id:i.deviceId,publicKey:i.publicKey,signature:d,signedAt:g,nonce:p}}const u={minProtocol:3,maxProtocol:3,client:{id:this.opts.clientName??no.CONTROL_UI,version:this.opts.clientVersion??"dev",platform:this.opts.platform??navigator.platform??"web",mode:this.opts.mode??oi.WEBCHAT,instanceId:this.opts.instanceId},role:s,scopes:n,device:c,caps:[],auth:l,userAgent:navigator.userAgent,locale:navigator.language};this.request("connect",u).then(g=>{g?.auth?.deviceToken&&i&&Sr({deviceId:i.deviceId,role:g.auth.role??s,token:g.auth.deviceToken,scopes:g.auth.scopes??[]}),this.backoffMs=800,this.opts.onHello?.(g)}).catch(()=>{a&&i&&Ar({deviceId:i.deviceId,role:s}),this.ws?.close(ag,"connect failed")})}handleMessage(t){let n;try{n=JSON.parse(t)}catch{return}const s=n;if(s.type==="event"){const i=n;if(i.event==="connect.challenge"){const o=i.payload,l=o&&typeof o.nonce=="string"?o.nonce:null;l&&(this.connectNonce=l,this.sendConnect());return}const a=typeof i.seq=="number"?i.seq:null;a!==null&&(this.lastSeq!==null&&a>this.lastSeq+1&&this.opts.onGap?.({expected:this.lastSeq+1,received:a}),this.lastSeq=a);try{this.opts.onEvent?.(i)}catch(o){console.error("[gateway] event handler error:",o)}return}if(s.type==="res"){const i=n,a=this.pending.get(i.id);if(!a)return;this.pending.delete(i.id),i.ok?a.resolve(i.payload):a.reject(new Error(i.error?.message??"request failed"));return}}request(t,n){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)return Promise.reject(new Error("gateway not connected"));const s=Ki(),i={type:"req",id:s,method:t,params:n},a=new Promise((o,l)=>{this.pending.set(s,{resolve:c=>o(c),reject:l})});return this.ws.send(JSON.stringify(i)),a}queueConnect(){this.connectNonce=null,this.connectSent=!1,this.connectTimer!==null&&window.clearTimeout(this.connectTimer),this.connectTimer=window.setTimeout(()=>{this.sendConnect()},750)}}function Ls(e,t){const n=(e??"").trim(),s=t.mainSessionKey?.trim();if(!s)return n;if(!n)return s;const i=t.mainKey?.trim()||"main",a=t.defaultAgentId?.trim();return n==="main"||n===i||a&&(n===`agent:${a}:main`||n===`agent:${a}:${i}`)?s:n}function rg(e,t){if(!t?.mainSessionKey)return;const n=Ls(e.sessionKey,t),s=Ls(e.settings.sessionKey,t),i=Ls(e.settings.lastActiveSessionKey,t),a=n||s||e.sessionKey,o={...e.settings,sessionKey:s||a,lastActiveSessionKey:i||a},l=o.sessionKey!==e.settings.sessionKey||o.lastActiveSessionKey!==e.settings.lastActiveSessionKey;a!==e.sessionKey&&(e.sessionKey=a),l&&Ye(e,o)}function il(e){e.lastError=null,e.hello=null,e.connected=!1,e.execApprovalQueue=[],e.execApprovalError=null,e.client?.stop(),e.client=new og({url:e.settings.gatewayUrl,token:e.settings.token.trim()?e.settings.token:void 0,password:e.password.trim()?e.password:void 0,clientName:"openclaw-control-ui",mode:"webchat",onHello:t=>{e.connected=!0,e.lastError=null,e.hello=t,dg(e,t),e.chatRunId=null,e.chatStream=null,e.chatStreamStartedAt=null,is(e),tl(e),Mi(e),Zn(e,{quiet:!0}),Ze(e,{quiet:!0}),ji(e)},onClose:({code:t,reason:n})=>{e.connected=!1,t!==1012&&(e.lastError=`disconnected (${t}): ${n||"no reason"}`)},onEvent:t=>lg(e,t),onGap:({expected:t,received:n})=>{e.lastError=`event gap detected (expected seq ${t}, got ${n}); refresh recommended`}}),e.client.start()}function lg(e,t){try{cg(e,t)}catch(n){console.error("[gateway] handleGatewayEvent error:",t.event,n)}}function cg(e,t){if(e.eventLogBuffer=[{ts:Date.now(),event:t.event,payload:t.payload},...e.eventLogBuffer].slice(0,250),e.tab==="debug"&&(e.eventLog=e.eventLogBuffer),t.event==="agent"){if(e.onboarding)return;_u(e,t.payload);return}if(t.event==="chat"){const n=t.payload;n?.sessionKey&&Kr(e,n.sessionKey);const s=Uu(e,n);if(s==="final"||s==="error"||s==="aborted"){is(e),qu(e);const i=n?.runId;i&&e.refreshSessionsAfterChat.has(i)&&(e.refreshSessionsAfterChat.delete(i),s==="final"&&bt(e,{activeMinutes:Qr}))}s==="final"&&nn(e);return}if(t.event==="presence"){const n=t.payload;n?.presence&&Array.isArray(n.presence)&&(e.presenceEntries=n.presence,e.presenceError=null,e.presenceStatus=null);return}if(t.event==="cron"&&e.tab==="cron"&&Un(e),(t.event==="device.pair.requested"||t.event==="device.pair.resolved")&&Ze(e,{quiet:!0}),t.event==="exec.approval.requested"){const n=tg(t.payload);if(n){e.execApprovalQueue=sg(e.execApprovalQueue,n),e.execApprovalError=null;const s=Math.max(0,n.expiresAtMs-Date.now()+500);window.setTimeout(()=>{e.execApprovalQueue=to(e.execApprovalQueue,n.id)},s)}return}if(t.event==="exec.approval.resolved"){const n=ng(t.payload);n&&(e.execApprovalQueue=to(e.execApprovalQueue,n.id))}}function dg(e,t){const n=t.snapshot;n?.presence&&Array.isArray(n.presence)&&(e.presenceEntries=n.presence),n?.health&&(e.debugHealth=n.health),n?.sessionDefaults&&rg(e,n.sessionDefaults)}function ug(e){e.basePath=uu(),lu(e),hu(e,!0),gu(e),pu(e),window.addEventListener("popstate",e.popStateHandler),il(e),Xc(e),e.tab==="logs"&&Ti(e),e.tab==="debug"&&Ei(e)}function gg(e){qc(e)}function pg(e){window.removeEventListener("popstate",e.popStateHandler),ed(e),_i(e),Li(e),fu(e),e.topbarObserver?.disconnect(),e.topbarObserver=null}function fg(e,t){if(!(e.tab==="chat"&&e.chatManualRefreshInFlight)){if(e.tab==="chat"&&(t.has("chatMessages")||t.has("chatToolMessages")||t.has("chatStream")||t.has("chatLoading")||t.has("tab"))){const n=t.has("tab"),s=t.has("chatLoading")&&t.get("chatLoading")===!0&&!e.chatLoading;an(e,n||s||!e.chatHasAutoScrolled)}e.tab==="logs"&&(t.has("logsEntries")||t.has("logsAutoFollow")||t.has("tab"))&&e.logsAutoFollow&&e.logsAtBottom&&mr(e,t.has("tab")||t.has("logsAutoFollow"))}}const Wi={CHILD:2},qi=e=>(...t)=>({_$litDirective$:e,values:t});let Gi=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,n,s){this._$Ct=t,this._$AM=n,this._$Ci=s}_$AS(t,n){return this.update(t,n)}update(t,n){return this.render(...n)}};const{I:hg}=hc,so=e=>e,vg=e=>e.strings===void 0,io=()=>document.createComment(""),Ft=(e,t,n)=>{const s=e._$AA.parentNode,i=t===void 0?e._$AB:t._$AA;if(n===void 0){const a=s.insertBefore(io(),i),o=s.insertBefore(io(),i);n=new hg(a,o,e,e.options)}else{const a=n._$AB.nextSibling,o=n._$AM,l=o!==e;if(l){let c;n._$AQ?.(e),n._$AM=e,n._$AP!==void 0&&(c=e._$AU)!==o._$AU&&n._$AP(c)}if(a!==i||l){let c=n._$AA;for(;c!==a;){const u=so(c).nextSibling;so(s).insertBefore(c,i),c=u}}}return n},st=(e,t,n=e)=>(e._$AI(t,n),e),mg={},bg=(e,t=mg)=>e._$AH=t,yg=e=>e._$AH,Ms=e=>{e._$AR(),e._$AA.remove()};const ao=(e,t,n)=>{const s=new Map;for(let i=t;i<=n;i++)s.set(e[i],i);return s},al=qi(class extends Gi{constructor(e){if(super(e),e.type!==Wi.CHILD)throw Error("repeat() can only be used in text expressions")}dt(e,t,n){let s;n===void 0?n=t:t!==void 0&&(s=t);const i=[],a=[];let o=0;for(const l of e)i[o]=s?s(l,o):o,a[o]=n(l,o),o++;return{values:a,keys:i}}render(e,t,n){return this.dt(e,t,n).values}update(e,[t,n,s]){const i=yg(e),{values:a,keys:o}=this.dt(t,n,s);if(!Array.isArray(i))return this.ut=o,a;const l=this.ut??=[],c=[];let u,g,p=0,h=i.length-1,d=0,f=a.length-1;for(;p<=h&&d<=f;)if(i[p]===null)p++;else if(i[h]===null)h--;else if(l[p]===o[d])c[d]=st(i[p],a[d]),p++,d++;else if(l[h]===o[f])c[f]=st(i[h],a[f]),h--,f--;else if(l[p]===o[f])c[f]=st(i[p],a[f]),Ft(e,c[f+1],i[p]),p++,f--;else if(l[h]===o[d])c[d]=st(i[h],a[d]),Ft(e,i[p],i[h]),h--,d++;else if(u===void 0&&(u=ao(o,d,f),g=ao(l,p,h)),u.has(l[p]))if(u.has(l[h])){const m=g.get(o[d]),S=m!==void 0?i[m]:null;if(S===null){const k=Ft(e,i[p]);st(k,a[d]),c[d]=k}else c[d]=st(S,a[d]),Ft(e,i[p],S),i[m]=null;d++}else Ms(i[h]),h--;else Ms(i[p]),p++;for(;d<=f;){const m=Ft(e,c[f+1]);st(m,a[d]),c[d++]=m}for(;p<=h;){const m=i[p++];m!==null&&Ms(m)}return this.ut=o,bg(e,c),Qe}}),le={messageSquare:r`
|
|
131
|
+
… truncated (${s.total} chars, showing first ${s.text.length}).`:s.text}function Iu(e){const t=[];return t.push({type:"toolcall",name:e.name,arguments:e.args??{}}),e.output&&t.push({type:"toolresult",name:e.name,text:e.output}),{role:"assistant",toolCallId:e.toolCallId,runId:e.runId,content:t,timestamp:e.startedAt}}function Ru(e){if(e.toolStreamOrder.length<=Za)return;const t=e.toolStreamOrder.length-Za,n=e.toolStreamOrder.splice(0,t);for(const s of n)e.toolStreamById.delete(s)}function Pu(e){e.chatToolMessages=e.toolStreamOrder.map(t=>e.toolStreamById.get(t)?.message).filter(t=>!!t)}function ni(e){e.toolStreamSyncTimer!=null&&(clearTimeout(e.toolStreamSyncTimer),e.toolStreamSyncTimer=null),Pu(e)}function Du(e,t=!1){if(t){ni(e);return}e.toolStreamSyncTimer==null&&(e.toolStreamSyncTimer=window.setTimeout(()=>ni(e),Eu))}function os(e){e.toolStreamById.clear(),e.toolStreamOrder=[],e.chatToolMessages=[],ni(e)}const Fu=5e3;function Nu(e,t){const n=t.data??{},s=typeof n.phase=="string"?n.phase:"";e.compactionClearTimer!=null&&(window.clearTimeout(e.compactionClearTimer),e.compactionClearTimer=null),s==="start"?e.compactionStatus={active:!0,startedAt:Date.now(),completedAt:null}:s==="end"&&(e.compactionStatus={active:!1,startedAt:e.compactionStatus?.startedAt??null,completedAt:Date.now()},e.compactionClearTimer=window.setTimeout(()=>{e.compactionStatus=null,e.compactionClearTimer=null},Fu))}function Ou(e,t){if(!t)return;if(t.stream==="compaction"){Nu(e,t);return}if(t.stream!=="tool")return;const n=typeof t.sessionKey=="string"?t.sessionKey:void 0;if(n&&n!==e.sessionKey||!n&&e.chatRunId&&t.runId!==e.chatRunId||e.chatRunId&&t.runId!==e.chatRunId||!e.chatRunId)return;const s=t.data??{},i=typeof s.toolCallId=="string"?s.toolCallId:"";if(!i)return;const a=typeof s.name=="string"?s.name:"tool",o=typeof s.phase=="string"?s.phase:"",l=o==="start"?s.args:void 0,c=o==="update"?Xa(s.partialResult):o==="result"?Xa(s.result):void 0,u=Date.now();let g=e.toolStreamById.get(i);g?(g.name=a,l!==void 0&&(g.args=l),c!==void 0&&(g.output=c||void 0),g.updatedAt=u):(g={toolCallId:i,runId:t.runId,sessionKey:n,name:a,args:l,output:c||void 0,startedAt:typeof t.ts=="number"?t.ts:u,updatedAt:u,message:{}},e.toolStreamById.set(i,g),e.toolStreamOrder.push(i)),g.message=Iu(g),Ru(e),Du(e,o==="result")}const Bu=/^\[([^\]]+)\]\s*/,Uu=["WebChat","WhatsApp","Telegram","Signal","Slack","Discord","iMessage","Teams","Matrix","Zalo","Zalo Personal","BlueBubbles"],_s=new WeakMap,Es=new WeakMap;function zu(e){return/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}Z\b/.test(e)||/\d{4}-\d{2}-\d{2} \d{2}:\d{2}\b/.test(e)?!0:Uu.some(t=>e.startsWith(`${t} `))}function Ls(e){const t=e.match(Bu);if(!t)return e;const n=t[1]??"";return zu(n)?e.slice(t[0].length):e}function si(e){const t=e,n=typeof t.role=="string"?t.role:"",s=t.content;if(typeof s=="string")return n==="assistant"?ks(s):Ls(s);if(Array.isArray(s)){const i=s.map(a=>{const o=a;return o.type==="text"&&typeof o.text=="string"?o.text:null}).filter(a=>typeof a=="string");if(i.length>0){const a=i.join(`
|
|
132
|
+
`);return n==="assistant"?ks(a):Ls(a)}}return typeof t.text=="string"?n==="assistant"?ks(t.text):Ls(t.text):null}function el(e){if(!e||typeof e!="object")return si(e);const t=e;if(_s.has(t))return _s.get(t)??null;const n=si(e);return _s.set(t,n),n}function eo(e){const n=e.content,s=[];if(Array.isArray(n))for(const l of n){const c=l;if(c.type==="thinking"&&typeof c.thinking=="string"){const u=c.thinking.trim();u&&s.push(u)}}if(s.length>0)return s.join(`
|
|
133
|
+
`);const i=ju(e);if(!i)return null;const o=[...i.matchAll(/<\s*think(?:ing)?\s*>([\s\S]*?)<\s*\/\s*think(?:ing)?\s*>/gi)].map(l=>(l[1]??"").trim()).filter(Boolean);return o.length>0?o.join(`
|
|
134
|
+
`):null}function Hu(e){if(!e||typeof e!="object")return eo(e);const t=e;if(Es.has(t))return Es.get(t)??null;const n=eo(e);return Es.set(t,n),n}function ju(e){const t=e,n=t.content;if(typeof n=="string")return n;if(Array.isArray(n)){const s=n.map(i=>{const a=i;return a.type==="text"&&typeof a.text=="string"?a.text:null}).filter(i=>typeof i=="string");if(s.length>0)return s.join(`
|
|
135
|
+
`)}return typeof t.text=="string"?t.text:null}function Ku(e){const t=e.trim();if(!t)return"";const n=t.split(/\r?\n/).map(s=>s.trim()).filter(Boolean).map(s=>`_${s}_`);return n.length?["_Reasoning:_",...n].join(`
|
|
136
|
+
`):""}let to=!1;function no(e){e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t="";for(let n=0;n<e.length;n++)t+=e[n].toString(16).padStart(2,"0");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function Wu(){const e=new Uint8Array(16),t=Date.now();for(let n=0;n<e.length;n++)e[n]=Math.floor(Math.random()*256);return e[0]^=t&255,e[1]^=t>>>8&255,e[2]^=t>>>16&255,e[3]^=t>>>24&255,e}function qu(){to||(to=!0,console.warn("[uuid] crypto API missing; falling back to weak randomness"))}function Wi(e=globalThis.crypto){if(e&&typeof e.randomUUID=="function")return e.randomUUID();if(e&&typeof e.getRandomValues=="function"){const t=new Uint8Array(16);return e.getRandomValues(t),no(t)}return qu(),no(Wu())}async function sn(e){if(!(!e.client||!e.connected)){e.chatLoading=!0,e.lastError=null;try{const t=await e.client.request("chat.history",{sessionKey:e.sessionKey,limit:200});e.chatMessages=Array.isArray(t.messages)?t.messages:[],e.chatThinkingLevel=t.thinkingLevel??null}catch(t){e.lastError=String(t)}finally{e.chatLoading=!1}}}function Gu(e){const t=/^data:([^;]+);base64,(.+)$/.exec(e);return t?{mimeType:t[1],content:t[2]}:null}async function Vu(e,t,n){if(!e.client||!e.connected)return null;const s=t.trim(),i=n&&n.length>0;if(!s&&!i)return null;const a=Date.now(),o=[];if(s&&o.push({type:"text",text:s}),i)for(const u of n)o.push({type:"image",source:{type:"base64",media_type:u.mimeType,data:u.dataUrl}});e.chatMessages=[...e.chatMessages,{role:"user",content:o,timestamp:a}],e.chatSending=!0,e.lastError=null;const l=Wi();e.chatRunId=l,e.chatStream="",e.chatStreamStartedAt=a;const c=i?n.map(u=>{const g=Gu(u.dataUrl);return g?{type:"image",mimeType:g.mimeType,content:g.content}:null}).filter(u=>u!==null):void 0;try{return await e.client.request("chat.send",{sessionKey:e.sessionKey,message:s,deliver:!1,idempotencyKey:l,attachments:c}),l}catch(u){const g=String(u);return e.chatRunId=null,e.chatStream=null,e.chatStreamStartedAt=null,e.lastError=g,e.chatMessages=[...e.chatMessages,{role:"assistant",content:[{type:"text",text:"Error: "+g}],timestamp:Date.now()}],null}finally{e.chatSending=!1}}async function Qu(e){if(!e.client||!e.connected)return!1;const t=e.chatRunId;try{return await e.client.request("chat.abort",t?{sessionKey:e.sessionKey,runId:t}:{sessionKey:e.sessionKey}),!0}catch(n){return e.lastError=String(n),!1}}function Yu(e,t){if(!t||t.sessionKey!==e.sessionKey)return null;if(t.runId&&e.chatRunId&&t.runId!==e.chatRunId)return t.state==="final"?"final":null;if(t.state==="delta"){const n=si(t.message);if(typeof n=="string"){const s=e.chatStream??"";(!s||n.length>=s.length)&&(e.chatStream=n)}}else t.state==="final"||t.state==="aborted"?(e.chatStream=null,e.chatRunId=null,e.chatStreamStartedAt=null):t.state==="error"&&(e.chatStream=null,e.chatRunId=null,e.chatStreamStartedAt=null,e.lastError=t.errorMessage??"chat error");return t.state}const tl=120;function nl(e){return e.chatSending||!!e.chatRunId}function Ju(e){const t=e.trim();if(!t)return!1;const n=t.toLowerCase();return n==="/stop"?!0:n==="stop"||n==="esc"||n==="abort"||n==="wait"||n==="exit"}function Zu(e){const t=e.trim();if(!t)return!1;const n=t.toLowerCase();return n==="/new"||n==="/reset"?!0:n.startsWith("/new ")||n.startsWith("/reset ")}async function sl(e){e.connected&&(e.chatMessage="",await Qu(e))}function Xu(e,t,n,s){const i=t.trim(),a=!!(n&&n.length>0);!i&&!a||(e.chatQueue=[...e.chatQueue,{id:Wi(),text:i,createdAt:Date.now(),attachments:a?n?.map(o=>({...o})):void 0,refreshSessions:s}])}async function il(e,t,n){os(e);const s=await Vu(e,t,n?.attachments),i=!!s;return!i&&n?.previousDraft!=null&&(e.chatMessage=n.previousDraft),!i&&n?.previousAttachments&&(e.chatAttachments=n.previousAttachments),i&&Yr(e,e.sessionKey),i&&n?.restoreDraft&&n.previousDraft?.trim()&&(e.chatMessage=n.previousDraft),i&&n?.restoreAttachments&&n.previousAttachments?.length&&(e.chatAttachments=n.previousAttachments),on(e),i&&!e.chatRunId&&al(e),i&&n?.refreshSessions&&s&&e.refreshSessionsAfterChat.add(s),i}async function al(e){if(!e.connected||nl(e))return;const[t,...n]=e.chatQueue;if(!t)return;e.chatQueue=n,await il(e,t.text,{attachments:t.attachments,refreshSessions:t.refreshSessions})||(e.chatQueue=[t,...e.chatQueue])}function eg(e,t){e.chatQueue=e.chatQueue.filter(n=>n.id!==t)}async function tg(e,t,n){if(!e.connected)return;const s=e.chatMessage,i=(t??e.chatMessage).trim(),a=e.chatAttachments??[],o=t==null?a:[],l=o.length>0;if(!i&&!l)return;if(Ju(i)){await sl(e);return}const c=Zu(i);if(t==null&&(e.chatMessage="",e.chatAttachments=[]),nl(e)){Xu(e,i,o,c);return}await il(e,i,{previousDraft:t==null?s:void 0,restoreDraft:!!(t&&n?.restoreDraft),attachments:l?o:void 0,previousAttachments:t==null?a:void 0,restoreAttachments:!!(t&&n?.restoreDraft),refreshSessions:c})}async function ol(e,t){await Promise.all([sn(e),yt(e,{activeMinutes:tl}),ii(e)]),t?.scheduleScroll!==!1&&on(e)}const ng=al;function sg(e){const t=wr(e.sessionKey);return t?.agentId?t.agentId:e.hello?.snapshot?.sessionDefaults?.defaultAgentId?.trim()||"main"}function ig(e,t){const n=cn(e),s=encodeURIComponent(t);return n?`${n}/avatar/${s}?meta=1`:`/avatar/${s}?meta=1`}async function ii(e){if(!e.connected){e.chatAvatarUrl=null;return}const t=sg(e);if(!t){e.chatAvatarUrl=null;return}e.chatAvatarUrl=null;const n=ig(e.basePath,t);try{const s=await fetch(n,{method:"GET"});if(!s.ok){e.chatAvatarUrl=null;return}const i=await s.json(),a=typeof i.avatarUrl=="string"?i.avatarUrl.trim():"";e.chatAvatarUrl=a||null}catch{e.chatAvatarUrl=null}}const ag={trace:!0,debug:!0,info:!0,warn:!0,error:!0,fatal:!0},og={name:"",description:"",agentId:"",enabled:!0,scheduleKind:"every",scheduleAt:"",everyAmount:"30",everyUnit:"minutes",cronExpr:"0 7 * * *",cronTz:"",sessionTarget:"isolated",wakeMode:"now",payloadKind:"agentTurn",payloadText:"",deliveryMode:"announce",deliveryChannel:"last",deliveryTo:"",timeoutSeconds:""},rg=50,lg=200,cg="Assistant";function so(e,t){if(typeof e!="string")return;const n=e.trim();if(n)return n.length<=t?n:n.slice(0,t)}function ai(e){const t=so(e?.name,rg)??cg,n=so(e?.avatar??void 0,lg)??null;return{agentId:typeof e?.agentId=="string"&&e.agentId.trim()?e.agentId.trim():null,name:t,avatar:n}}function dg(){return ai(typeof window>"u"?{}:{name:window.__OPENCLAW_ASSISTANT_NAME__,avatar:window.__OPENCLAW_ASSISTANT_AVATAR__})}async function rl(e,t){if(!e.client||!e.connected)return;const n=e.sessionKey.trim(),s=n?{sessionKey:n}:{};try{const i=await e.client.request("agent.identity.get",s);if(!i)return;const a=ai(i);e.assistantName=a.name,e.assistantAvatar=a.avatar,e.assistantAgentId=a.agentId??null}catch{}}function oi(e){return typeof e=="object"&&e!==null}function ug(e){if(!oi(e))return null;const t=typeof e.id=="string"?e.id.trim():"",n=e.request;if(!t||!oi(n))return null;const s=typeof n.command=="string"?n.command.trim():"";if(!s)return null;const i=typeof e.createdAtMs=="number"?e.createdAtMs:0,a=typeof e.expiresAtMs=="number"?e.expiresAtMs:0;return!i||!a?null:{id:t,request:{command:s,cwd:typeof n.cwd=="string"?n.cwd:null,host:typeof n.host=="string"?n.host:null,security:typeof n.security=="string"?n.security:null,ask:typeof n.ask=="string"?n.ask:null,agentId:typeof n.agentId=="string"?n.agentId:null,resolvedPath:typeof n.resolvedPath=="string"?n.resolvedPath:null,sessionKey:typeof n.sessionKey=="string"?n.sessionKey:null},createdAtMs:i,expiresAtMs:a}}function gg(e){if(!oi(e))return null;const t=typeof e.id=="string"?e.id.trim():"";return t?{id:t,decision:typeof e.decision=="string"?e.decision:null,resolvedBy:typeof e.resolvedBy=="string"?e.resolvedBy:null,ts:typeof e.ts=="number"?e.ts:null}:null}function ll(e){const t=Date.now();return e.filter(n=>n.expiresAtMs>t)}function pg(e,t){const n=ll(e).filter(s=>s.id!==t.id);return n.push(t),n}function io(e,t){return ll(e).filter(n=>n.id!==t)}function fg(e){const t=e.version??(e.nonce?"v2":"v1"),n=e.scopes.join(","),s=e.token??"",i=[t,e.deviceId,e.clientId,e.clientMode,e.role,n,String(e.signedAtMs),s];return t==="v2"&&i.push(e.nonce??""),i.join("|")}const cl={WEBCHAT_UI:"webchat-ui",CONTROL_UI:"openclaw-control-ui",WEBCHAT:"webchat",CLI:"cli",GATEWAY_CLIENT:"gateway-client",MACOS_APP:"openclaw-macos",IOS_APP:"openclaw-ios",ANDROID_APP:"openclaw-android",NODE_HOST:"node-host",TEST:"test",FINGERPRINT:"fingerprint",PROBE:"openclaw-probe"},ao=cl,ri={WEBCHAT:"webchat",CLI:"cli",UI:"ui",BACKEND:"backend",NODE:"node",PROBE:"probe",TEST:"test"};new Set(Object.values(cl));new Set(Object.values(ri));const hg=4008;class vg{constructor(t){this.opts=t,this.ws=null,this.pending=new Map,this.closed=!1,this.lastSeq=null,this.connectNonce=null,this.connectSent=!1,this.connectTimer=null,this.backoffMs=800}start(){this.closed=!1,this.connect()}stop(){this.closed=!0,this.ws?.close(),this.ws=null,this.flushPending(new Error("gateway client stopped"))}get connected(){return this.ws?.readyState===WebSocket.OPEN}connect(){this.closed||(this.ws=new WebSocket(this.opts.url),this.ws.addEventListener("open",()=>this.queueConnect()),this.ws.addEventListener("message",t=>this.handleMessage(String(t.data??""))),this.ws.addEventListener("close",t=>{const n=String(t.reason??"");this.ws=null,this.flushPending(new Error(`gateway closed (${t.code}): ${n}`)),this.opts.onClose?.({code:t.code,reason:n}),this.scheduleReconnect()}),this.ws.addEventListener("error",()=>{}))}scheduleReconnect(){if(this.closed)return;const t=this.backoffMs;this.backoffMs=Math.min(this.backoffMs*1.7,15e3),window.setTimeout(()=>this.connect(),t)}flushPending(t){for(const[,n]of this.pending)n.reject(t);this.pending.clear()}async sendConnect(){if(this.connectSent)return;this.connectSent=!0,this.connectTimer!==null&&(window.clearTimeout(this.connectTimer),this.connectTimer=null);const t=typeof crypto<"u"&&!!crypto.subtle,n=["operator.admin","operator.approvals","operator.pairing"],s="operator";let i=null,a=!1,o=this.opts.token;if(t){i=await Ui();const g=$d({deviceId:i.deviceId,role:s})?.token;o=g??this.opts.token,a=!!(g&&this.opts.token)}const l=o||this.opts.password?{token:o,password:this.opts.password}:void 0;let c;if(t&&i){const g=Date.now(),p=this.connectNonce??void 0,h=fg({deviceId:i.deviceId,clientId:this.opts.clientName??ao.CONTROL_UI,clientMode:this.opts.mode??ri.WEBCHAT,role:s,scopes:n,signedAtMs:g,token:o??null,nonce:p}),d=await qd(i.privateKey,h);c={id:i.deviceId,publicKey:i.publicKey,signature:d,signedAt:g,nonce:p}}const u={minProtocol:3,maxProtocol:3,client:{id:this.opts.clientName??ao.CONTROL_UI,version:this.opts.clientVersion??"dev",platform:this.opts.platform??navigator.platform??"web",mode:this.opts.mode??ri.WEBCHAT,instanceId:this.opts.instanceId},role:s,scopes:n,device:c,caps:[],auth:l,userAgent:navigator.userAgent,locale:navigator.language};this.request("connect",u).then(g=>{g?.auth?.deviceToken&&i&&Lr({deviceId:i.deviceId,role:g.auth.role??s,token:g.auth.deviceToken,scopes:g.auth.scopes??[]}),this.backoffMs=800,this.opts.onHello?.(g)}).catch(()=>{a&&i&&Mr({deviceId:i.deviceId,role:s}),this.ws?.close(hg,"connect failed")})}handleMessage(t){let n;try{n=JSON.parse(t)}catch{return}const s=n;if(s.type==="event"){const i=n;if(i.event==="connect.challenge"){const o=i.payload,l=o&&typeof o.nonce=="string"?o.nonce:null;l&&(this.connectNonce=l,this.sendConnect());return}const a=typeof i.seq=="number"?i.seq:null;a!==null&&(this.lastSeq!==null&&a>this.lastSeq+1&&this.opts.onGap?.({expected:this.lastSeq+1,received:a}),this.lastSeq=a);try{this.opts.onEvent?.(i)}catch(o){console.error("[gateway] event handler error:",o)}return}if(s.type==="res"){const i=n,a=this.pending.get(i.id);if(!a)return;this.pending.delete(i.id),i.ok?a.resolve(i.payload):a.reject(new Error(i.error?.message??"request failed"));return}}request(t,n){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)return Promise.reject(new Error("gateway not connected"));const s=Wi(),i={type:"req",id:s,method:t,params:n},a=new Promise((o,l)=>{this.pending.set(s,{resolve:c=>o(c),reject:l})});return this.ws.send(JSON.stringify(i)),a}queueConnect(){this.connectNonce=null,this.connectSent=!1,this.connectTimer!==null&&window.clearTimeout(this.connectTimer),this.connectTimer=window.setTimeout(()=>{this.sendConnect()},750)}}function Ms(e,t){const n=(e??"").trim(),s=t.mainSessionKey?.trim();if(!s)return n;if(!n)return s;const i=t.mainKey?.trim()||"main",a=t.defaultAgentId?.trim();return n==="main"||n===i||a&&(n===`agent:${a}:main`||n===`agent:${a}:${i}`)?s:n}function mg(e,t){if(!t?.mainSessionKey)return;const n=Ms(e.sessionKey,t),s=Ms(e.settings.sessionKey,t),i=Ms(e.settings.lastActiveSessionKey,t),a=n||s||e.sessionKey,o={...e.settings,sessionKey:s||a,lastActiveSessionKey:i||a},l=o.sessionKey!==e.settings.sessionKey||o.lastActiveSessionKey!==e.settings.lastActiveSessionKey;a!==e.sessionKey&&(e.sessionKey=a),l&&Je(e,o)}function dl(e){e.lastError=null,e.hello=null,e.connected=!1,e.execApprovalQueue=[],e.execApprovalError=null,e.client?.stop(),e.client=new vg({url:e.settings.gatewayUrl,token:e.settings.token.trim()?e.settings.token:void 0,password:e.password.trim()?e.password:void 0,clientName:"openclaw-control-ui",mode:"webchat",onHello:t=>{e.connected=!0,e.lastError=null,e.hello=t,xg(e,t),e.chatRunId=null,e.chatStream=null,e.chatStreamStartedAt=null,os(e),rl(e),Ii(e),es(e,{quiet:!0}),Xe(e,{quiet:!0}),Ki(e)},onClose:({code:t,reason:n})=>{e.connected=!1,t!==1012&&(e.lastError=`disconnected (${t}): ${n||"no reason"}`)},onEvent:t=>bg(e,t),onGap:({expected:t,received:n})=>{e.lastError=`event gap detected (expected seq ${t}, got ${n}); refresh recommended`}}),e.client.start()}function bg(e,t){try{yg(e,t)}catch(n){console.error("[gateway] handleGatewayEvent error:",t.event,n)}}function yg(e,t){if(e.eventLogBuffer=[{ts:Date.now(),event:t.event,payload:t.payload},...e.eventLogBuffer].slice(0,250),e.tab==="debug"&&(e.eventLog=e.eventLogBuffer),t.event==="agent"){if(e.onboarding)return;Ou(e,t.payload);return}if(t.event==="chat"){const n=t.payload;n?.sessionKey&&Yr(e,n.sessionKey);const s=Yu(e,n);if(s==="final"||s==="error"||s==="aborted"){os(e),ng(e);const i=n?.runId;i&&e.refreshSessionsAfterChat.has(i)&&(e.refreshSessionsAfterChat.delete(i),s==="final"&&yt(e,{activeMinutes:tl}))}s==="final"&&sn(e);return}if(t.event==="presence"){const n=t.payload;n?.presence&&Array.isArray(n.presence)&&(e.presenceEntries=n.presence,e.presenceError=null,e.presenceStatus=null);return}if(t.event==="cron"&&e.tab==="cron"&&zn(e),(t.event==="device.pair.requested"||t.event==="device.pair.resolved")&&Xe(e,{quiet:!0}),t.event==="exec.approval.requested"){const n=ug(t.payload);if(n){e.execApprovalQueue=pg(e.execApprovalQueue,n),e.execApprovalError=null;const s=Math.max(0,n.expiresAtMs-Date.now()+500);window.setTimeout(()=>{e.execApprovalQueue=io(e.execApprovalQueue,n.id)},s)}return}if(t.event==="exec.approval.resolved"){const n=gg(t.payload);n&&(e.execApprovalQueue=io(e.execApprovalQueue,n.id))}}function xg(e,t){const n=t.snapshot;n?.presence&&Array.isArray(n.presence)&&(e.presenceEntries=n.presence),n?.health&&(e.debugHealth=n.health),n?.sessionDefaults&&mg(e,n.sessionDefaults)}function $g(e){e.basePath=$u(),bu(e),Au(e,!0),wu(e),ku(e),window.addEventListener("popstate",e.popStateHandler),dl(e),cd(e),e.tab==="logs"&&_i(e),e.tab==="debug"&&Li(e)}function wg(e){nd(e)}function kg(e){window.removeEventListener("popstate",e.popStateHandler),dd(e),Ei(e),Mi(e),Su(e),e.topbarObserver?.disconnect(),e.topbarObserver=null}function Sg(e,t){if(!(e.tab==="chat"&&e.chatManualRefreshInFlight)){if(e.tab==="chat"&&(t.has("chatMessages")||t.has("chatToolMessages")||t.has("chatStream")||t.has("chatLoading")||t.has("tab"))){const n=t.has("tab"),s=t.has("chatLoading")&&t.get("chatLoading")===!0&&!e.chatLoading;on(e,n||s||!e.chatHasAutoScrolled)}e.tab==="logs"&&(t.has("logsEntries")||t.has("logsAutoFollow")||t.has("tab"))&&e.logsAutoFollow&&e.logsAtBottom&&kr(e,t.has("tab")||t.has("logsAutoFollow"))}}const qi={CHILD:2},Gi=e=>(...t)=>({_$litDirective$:e,values:t});let Vi=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,n,s){this._$Ct=t,this._$AM=n,this._$Ci=s}_$AS(t,n){return this.update(t,n)}update(t,n){return this.render(...n)}};const{I:Ag}=wc,oo=e=>e,Cg=e=>e.strings===void 0,ro=()=>document.createComment(""),Ft=(e,t,n)=>{const s=e._$AA.parentNode,i=t===void 0?e._$AB:t._$AA;if(n===void 0){const a=s.insertBefore(ro(),i),o=s.insertBefore(ro(),i);n=new Ag(a,o,e,e.options)}else{const a=n._$AB.nextSibling,o=n._$AM,l=o!==e;if(l){let c;n._$AQ?.(e),n._$AM=e,n._$AP!==void 0&&(c=e._$AU)!==o._$AU&&n._$AP(c)}if(a!==i||l){let c=n._$AA;for(;c!==a;){const u=oo(c).nextSibling;oo(s).insertBefore(c,i),c=u}}}return n},it=(e,t,n=e)=>(e._$AI(t,n),e),Tg={},_g=(e,t=Tg)=>e._$AH=t,Eg=e=>e._$AH,Is=e=>{e._$AR(),e._$AA.remove()};const lo=(e,t,n)=>{const s=new Map;for(let i=t;i<=n;i++)s.set(e[i],i);return s},ul=Gi(class extends Vi{constructor(e){if(super(e),e.type!==qi.CHILD)throw Error("repeat() can only be used in text expressions")}dt(e,t,n){let s;n===void 0?n=t:t!==void 0&&(s=t);const i=[],a=[];let o=0;for(const l of e)i[o]=s?s(l,o):o,a[o]=n(l,o),o++;return{values:a,keys:i}}render(e,t,n){return this.dt(e,t,n).values}update(e,[t,n,s]){const i=Eg(e),{values:a,keys:o}=this.dt(t,n,s);if(!Array.isArray(i))return this.ut=o,a;const l=this.ut??=[],c=[];let u,g,p=0,h=i.length-1,d=0,f=a.length-1;for(;p<=h&&d<=f;)if(i[p]===null)p++;else if(i[h]===null)h--;else if(l[p]===o[d])c[d]=it(i[p],a[d]),p++,d++;else if(l[h]===o[f])c[f]=it(i[h],a[f]),h--,f--;else if(l[p]===o[f])c[f]=it(i[p],a[f]),Ft(e,c[f+1],i[p]),p++,f--;else if(l[h]===o[d])c[d]=it(i[h],a[d]),Ft(e,i[p],i[h]),h--,d++;else if(u===void 0&&(u=lo(o,d,f),g=lo(l,p,h)),u.has(l[p]))if(u.has(l[h])){const m=g.get(o[d]),S=m!==void 0?i[m]:null;if(S===null){const k=Ft(e,i[p]);it(k,a[d]),c[d]=k}else c[d]=it(S,a[d]),Ft(e,i[p],S),i[m]=null;d++}else Is(i[h]),h--;else Is(i[p]),p++;for(;d<=f;){const m=Ft(e,c[f+1]);it(m,a[d]),c[d++]=m}for(;p<=h;){const m=i[p++];m!==null&&Is(m)}return this.ut=o,_g(e,c),Ye}}),le={messageSquare:r`
|
|
137
137
|
<svg viewBox="0 0 24 24">
|
|
138
138
|
<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" />
|
|
139
139
|
</svg>
|
|
@@ -321,17 +321,17 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
321
321
|
d="M19.439 7.85c-.049.322.059.648.289.878l1.568 1.568c.47.47.706 1.087.706 1.704s-.235 1.233-.706 1.704l-1.611 1.611a.98.98 0 0 1-.837.276c-.47-.07-.802-.48-.968-.925a2.501 2.501 0 1 0-3.214 3.214c.446.166.855.497.925.968a.979.979 0 0 1-.276.837l-1.61 1.61a2.404 2.404 0 0 1-1.705.707 2.402 2.402 0 0 1-1.704-.706l-1.568-1.568a1.026 1.026 0 0 0-.877-.29c-.493.074-.84.504-1.02.968a2.5 2.5 0 1 1-3.237-3.237c.464-.18.894-.527.967-1.02a1.026 1.026 0 0 0-.289-.877l-1.568-1.568A2.402 2.402 0 0 1 1.998 12c0-.617.236-1.234.706-1.704L4.23 8.77c.24-.24.581-.353.917-.303.515.076.874.54 1.02 1.02a2.5 2.5 0 1 0 3.237-3.237c-.48-.146-.944-.505-1.02-1.02a.98.98 0 0 1 .303-.917l1.526-1.526A2.402 2.402 0 0 1 11.998 2c.617 0 1.234.236 1.704.706l1.568 1.568c.23.23.556.338.877.29.493-.074.84-.504 1.02-.968a2.5 2.5 0 1 1 3.236 3.236c-.464.18-.894.527-.967 1.02Z"
|
|
322
322
|
/>
|
|
323
323
|
</svg>
|
|
324
|
-
`};function
|
|
324
|
+
`};function Lg(e,t){const n=is(t,e.basePath);return r`
|
|
325
325
|
<a
|
|
326
326
|
href=${n}
|
|
327
327
|
class="nav-item ${e.tab===t?"active":""}"
|
|
328
328
|
@click=${s=>{s.defaultPrevented||s.button!==0||s.metaKey||s.ctrlKey||s.shiftKey||s.altKey||(s.preventDefault(),e.setTab(t))}}
|
|
329
|
-
title=${
|
|
329
|
+
title=${ti(t)}
|
|
330
330
|
>
|
|
331
|
-
<span class="nav-item__icon" aria-hidden="true">${le[
|
|
332
|
-
<span class="nav-item__text">${
|
|
331
|
+
<span class="nav-item__icon" aria-hidden="true">${le[uu(t)]}</span>
|
|
332
|
+
<span class="nav-item__text">${ti(t)}</span>
|
|
333
333
|
</a>
|
|
334
|
-
`}function
|
|
334
|
+
`}function Mg(e){const t=Ig(e.hello,e.sessionsResult),n=Rg(e.sessionKey,e.sessionsResult,t),s=e.onboarding,i=e.onboarding,a=e.onboarding?!1:e.settings.chatShowThinking,o=e.onboarding?!0:e.settings.chatFocusMode,l=r`
|
|
335
335
|
<svg
|
|
336
336
|
width="18"
|
|
337
337
|
height="18"
|
|
@@ -368,9 +368,9 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
368
368
|
<select
|
|
369
369
|
.value=${e.sessionKey}
|
|
370
370
|
?disabled=${!e.connected}
|
|
371
|
-
@change=${u=>{const g=u.target.value;e.sessionKey=g,e.chatMessage="",e.chatStream=null,e.chatStreamStartedAt=null,e.chatRunId=null,e.resetToolStream(),e.resetChatScroll(),e.applySettings({...e.settings,sessionKey:g,lastActiveSessionKey:g}),e.loadAssistantIdentity(),
|
|
371
|
+
@change=${u=>{const g=u.target.value;e.sessionKey=g,e.chatMessage="",e.chatStream=null,e.chatStreamStartedAt=null,e.chatRunId=null,e.resetToolStream(),e.resetChatScroll(),e.applySettings({...e.settings,sessionKey:g,lastActiveSessionKey:g}),e.loadAssistantIdentity(),Tu(e,g),sn(e)}}
|
|
372
372
|
>
|
|
373
|
-
${
|
|
373
|
+
${ul(n,u=>u.key,u=>r`<option value=${u.key}>
|
|
374
374
|
${u.displayName??u.key}
|
|
375
375
|
</option>`)}
|
|
376
376
|
</select>
|
|
@@ -378,7 +378,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
378
378
|
<button
|
|
379
379
|
class="btn btn--sm btn--icon"
|
|
380
380
|
?disabled=${e.chatLoading||!e.connected}
|
|
381
|
-
@click=${async()=>{const u=e;u.chatManualRefreshInFlight=!0,u.chatNewMessagesBelow=!1,await u.updateComplete,u.resetToolStream();try{await
|
|
381
|
+
@click=${async()=>{const u=e;u.chatManualRefreshInFlight=!0,u.chatNewMessagesBelow=!1,await u.updateComplete,u.resetToolStream();try{await ol(e,{scheduleScroll:!1}),u.scrollToBottom({smooth:!0})}finally{requestAnimationFrame(()=>{u.chatManualRefreshInFlight=!1,u.chatNewMessagesBelow=!1})}}}
|
|
382
382
|
title="Refresh chat data"
|
|
383
383
|
>
|
|
384
384
|
${l}
|
|
@@ -403,7 +403,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
403
403
|
${c}
|
|
404
404
|
</button>
|
|
405
405
|
</div>
|
|
406
|
-
`}function
|
|
406
|
+
`}function Ig(e,t){const n=e?.snapshot,s=n?.sessionDefaults?.mainSessionKey?.trim();if(s)return s;const i=n?.sessionDefaults?.mainKey?.trim();return i||(t?.sessions?.some(a=>a.key==="main")?"main":null)}function Rs(e,t){const n=t?.displayName?.trim()||"",s=t?.label?.trim()||"";return n&&n!==e?`${n} (${e})`:s&&s!==e?`${s} (${e})`:e}function Rg(e,t,n){const s=new Set,i=[],a=n&&t?.sessions?.find(l=>l.key===n),o=t?.sessions?.find(l=>l.key===e);if(n&&(s.add(n),i.push({key:n,displayName:Rs(n,a||void 0)})),s.has(e)||(s.add(e),i.push({key:e,displayName:Rs(e,o)})),t?.sessions)for(const l of t.sessions)s.has(l.key)||(s.add(l.key),i.push({key:l.key,displayName:Rs(l.key,l)}));return i}const Pg=["system","light","dark"];function Dg(e){const t=Math.max(0,Pg.indexOf(e.theme)),n=s=>i=>{const o={element:i.currentTarget};(i.clientX||i.clientY)&&(o.pointerClientX=i.clientX,o.pointerClientY=i.clientY),e.setTheme(s,o)};return r`
|
|
407
407
|
<div class="theme-toggle" style="--theme-index: ${t};">
|
|
408
408
|
<div class="theme-toggle__track" role="group" aria-label="Theme">
|
|
409
409
|
<span class="theme-toggle__indicator"></span>
|
|
@@ -414,7 +414,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
414
414
|
aria-label="System theme"
|
|
415
415
|
title="System"
|
|
416
416
|
>
|
|
417
|
-
${
|
|
417
|
+
${Og()}
|
|
418
418
|
</button>
|
|
419
419
|
<button
|
|
420
420
|
class="theme-toggle__button ${e.theme==="light"?"active":""}"
|
|
@@ -423,7 +423,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
423
423
|
aria-label="Light theme"
|
|
424
424
|
title="Light"
|
|
425
425
|
>
|
|
426
|
-
${
|
|
426
|
+
${Fg()}
|
|
427
427
|
</button>
|
|
428
428
|
<button
|
|
429
429
|
class="theme-toggle__button ${e.theme==="dark"?"active":""}"
|
|
@@ -432,11 +432,11 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
432
432
|
aria-label="Dark theme"
|
|
433
433
|
title="Dark"
|
|
434
434
|
>
|
|
435
|
-
${
|
|
435
|
+
${Ng()}
|
|
436
436
|
</button>
|
|
437
437
|
</div>
|
|
438
438
|
</div>
|
|
439
|
-
`}function
|
|
439
|
+
`}function Fg(){return r`
|
|
440
440
|
<svg class="theme-icon" viewBox="0 0 24 24" aria-hidden="true">
|
|
441
441
|
<circle cx="12" cy="12" r="4"></circle>
|
|
442
442
|
<path d="M12 2v2"></path>
|
|
@@ -448,21 +448,21 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
448
448
|
<path d="m6.34 17.66-1.41 1.41"></path>
|
|
449
449
|
<path d="m19.07 4.93-1.41 1.41"></path>
|
|
450
450
|
</svg>
|
|
451
|
-
`}function
|
|
451
|
+
`}function Ng(){return r`
|
|
452
452
|
<svg class="theme-icon" viewBox="0 0 24 24" aria-hidden="true">
|
|
453
453
|
<path
|
|
454
454
|
d="M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401"
|
|
455
455
|
></path>
|
|
456
456
|
</svg>
|
|
457
|
-
`}function
|
|
457
|
+
`}function Og(){return r`
|
|
458
458
|
<svg class="theme-icon" viewBox="0 0 24 24" aria-hidden="true">
|
|
459
459
|
<rect width="20" height="14" x="2" y="3" rx="2"></rect>
|
|
460
460
|
<line x1="8" x2="16" y1="21" y2="21"></line>
|
|
461
461
|
<line x1="12" x2="12" y1="17" y2="21"></line>
|
|
462
462
|
</svg>
|
|
463
|
-
`}function
|
|
463
|
+
`}function gl(e,t){if(!e)return e;const s=e.files.some(i=>i.name===t.name)?e.files.map(i=>i.name===t.name?t:i):[...e.files,t];return{...e,files:s}}async function Ps(e,t){if(!(!e.client||!e.connected||e.agentFilesLoading)){e.agentFilesLoading=!0,e.agentFilesError=null;try{const n=await e.client.request("agents.files.list",{agentId:t});n&&(e.agentFilesList=n,e.agentFileActive&&!n.files.some(s=>s.name===e.agentFileActive)&&(e.agentFileActive=null))}catch(n){e.agentFilesError=String(n)}finally{e.agentFilesLoading=!1}}}async function Bg(e,t,n,s){if(!(!e.client||!e.connected||e.agentFilesLoading)&&!Object.hasOwn(e.agentFileContents,n)){e.agentFilesLoading=!0,e.agentFilesError=null;try{const i=await e.client.request("agents.files.get",{agentId:t,name:n});if(i?.file){const a=i.file.content??"",o=e.agentFileContents[n]??"",l=e.agentFileDrafts[n],c=s?.preserveDraft??!0;e.agentFilesList=gl(e.agentFilesList,i.file),e.agentFileContents={...e.agentFileContents,[n]:a},(!c||!Object.hasOwn(e.agentFileDrafts,n)||l===o)&&(e.agentFileDrafts={...e.agentFileDrafts,[n]:a})}}catch(i){e.agentFilesError=String(i)}finally{e.agentFilesLoading=!1}}}async function Ug(e,t,n,s){if(!(!e.client||!e.connected||e.agentFileSaving)){e.agentFileSaving=!0,e.agentFilesError=null;try{const i=await e.client.request("agents.files.set",{agentId:t,name:n,content:s});i?.file&&(e.agentFilesList=gl(e.agentFilesList,i.file),e.agentFileContents={...e.agentFileContents,[n]:s},e.agentFileDrafts={...e.agentFileDrafts,[n]:s})}catch(i){e.agentFilesError=String(i)}finally{e.agentFileSaving=!1}}}async function pl(e,t){if(!(!e.client||!e.connected)&&!e.usageLoading){e.usageLoading=!0,e.usageError=null;try{const n=t?.startDate??e.usageStartDate,s=t?.endDate??e.usageEndDate,[i,a]=await Promise.all([e.client.request("sessions.usage",{startDate:n,endDate:s,limit:1e3,includeContextWeight:!0}),e.client.request("usage.cost",{startDate:n,endDate:s})]);i&&(e.usageResult=i),a&&(e.usageCostSummary=a)}catch(n){e.usageError=String(n)}finally{e.usageLoading=!1}}}async function zg(e,t){if(!(!e.client||!e.connected)&&!e.usageTimeSeriesLoading){e.usageTimeSeriesLoading=!0,e.usageTimeSeries=null;try{const n=await e.client.request("sessions.usage.timeseries",{key:t});n&&(e.usageTimeSeries=n)}catch{e.usageTimeSeries=null}finally{e.usageTimeSeriesLoading=!1}}}async function Hg(e,t){if(!(!e.client||!e.connected)&&!e.usageSessionLogsLoading){e.usageSessionLogsLoading=!0,e.usageSessionLogs=null;try{const n=await e.client.request("sessions.usage.logs",{key:t,limit:500});n&&Array.isArray(n.logs)&&(e.usageSessionLogs=n.logs)}catch{e.usageSessionLogs=null}finally{e.usageSessionLogsLoading=!1}}}const jg={bash:"exec","apply-patch":"apply_patch"},Kg={"group:memory":["memory_search","memory_get"],"group:web":["web_search","web_fetch"],"group:fs":["read","write","edit","apply_patch"],"group:runtime":["exec","process"],"group:sessions":["sessions_list","sessions_history","sessions_send","sessions_spawn","session_status"],"group:ui":["browser","canvas"],"group:automation":["cron","gateway"],"group:messaging":["message"],"group:nodes":["nodes"],"group:openclaw":["browser","canvas","nodes","cron","message","gateway","agents_list","sessions_list","sessions_history","sessions_send","sessions_spawn","session_status","memory_search","memory_get","web_search","web_fetch","image"]},Wg={minimal:{allow:["session_status"]},coding:{allow:["group:fs","group:runtime","group:sessions","group:memory","image"]},messaging:{allow:["group:messaging","sessions_list","sessions_history","sessions_send","session_status"]},full:{}};function De(e){const t=e.trim().toLowerCase();return jg[t]??t}function qg(e){return e?e.map(De).filter(Boolean):[]}function Gg(e){const t=qg(e),n=[];for(const s of t){const i=Kg[s];if(i){n.push(...i);continue}n.push(s)}return Array.from(new Set(n))}function Vg(e){if(!e)return;const t=Wg[e];if(t&&!(!t.allow&&!t.deny))return{allow:t.allow?[...t.allow]:void 0,deny:t.deny?[...t.deny]:void 0}}function Qg(e){const t=e.host??"unknown",n=e.ip?`(${e.ip})`:"",s=e.mode??"",i=e.version??"";return`${t} ${n} ${s} ${i}`.trim()}function Yg(e){const t=e.ts??null;return t?V(t):"n/a"}function Qi(e){return e?`${ht(e)} (${V(e)})`:"n/a"}function Jg(e){if(e.totalTokens==null)return"n/a";const t=e.totalTokens??0,n=e.contextTokens??0;return n?`${t} / ${n}`:String(t)}function Zg(e){if(e==null)return"";try{return JSON.stringify(e,null,2)}catch{return String(e)}}function Xg(e){const t=e.state??{},n=t.nextRunAtMs?ht(t.nextRunAtMs):"n/a",s=t.lastRunAtMs?ht(t.lastRunAtMs):"n/a";return`${t.lastStatus??"n/a"} · next ${n} · last ${s}`}function fl(e){const t=e.schedule;if(t.kind==="at"){const n=Date.parse(t.at);return Number.isFinite(n)?`At ${ht(n)}`:`At ${t.at}`}return t.kind==="every"?`Every ${Pi(t.everyMs)}`:`Cron ${t.expr}${t.tz?` (${t.tz})`:""}`}function ep(e){const t=e.payload;if(t.kind==="systemEvent")return`System: ${t.text}`;const n=`Agent: ${t.message}`,s=e.delivery;if(s&&s.mode!=="none"){const i=s.channel||s.to?` (${s.channel??"last"}${s.to?` -> ${s.to}`:""})`:"";return`${n} · ${s.mode}${i}`}return n}const co=[{id:"fs",label:"Files",tools:[{id:"read",label:"read",description:"Read file contents"},{id:"write",label:"write",description:"Create or overwrite files"},{id:"edit",label:"edit",description:"Make precise edits"},{id:"apply_patch",label:"apply_patch",description:"Patch files (OpenAI)"}]},{id:"runtime",label:"Runtime",tools:[{id:"exec",label:"exec",description:"Run shell commands"},{id:"process",label:"process",description:"Manage background processes"}]},{id:"web",label:"Web",tools:[{id:"web_search",label:"web_search",description:"Search the web"},{id:"web_fetch",label:"web_fetch",description:"Fetch web content"}]},{id:"memory",label:"Memory",tools:[{id:"memory_search",label:"memory_search",description:"Semantic search"},{id:"memory_get",label:"memory_get",description:"Read memory files"}]},{id:"sessions",label:"Sessions",tools:[{id:"sessions_list",label:"sessions_list",description:"List sessions"},{id:"sessions_history",label:"sessions_history",description:"Session history"},{id:"sessions_send",label:"sessions_send",description:"Send to session"},{id:"sessions_spawn",label:"sessions_spawn",description:"Spawn sub-agent"},{id:"session_status",label:"session_status",description:"Session status"}]},{id:"ui",label:"UI",tools:[{id:"browser",label:"browser",description:"Control web browser"},{id:"canvas",label:"canvas",description:"Control canvases"}]},{id:"messaging",label:"Messaging",tools:[{id:"message",label:"message",description:"Send messages"}]},{id:"automation",label:"Automation",tools:[{id:"cron",label:"cron",description:"Schedule tasks"},{id:"gateway",label:"gateway",description:"Gateway control"}]},{id:"nodes",label:"Nodes",tools:[{id:"nodes",label:"nodes",description:"Nodes + devices"}]},{id:"agents",label:"Agents",tools:[{id:"agents_list",label:"agents_list",description:"List agents"}]},{id:"media",label:"Media",tools:[{id:"image",label:"image",description:"Image understanding"}]}],tp=[{id:"minimal",label:"Minimal"},{id:"coding",label:"Coding"},{id:"messaging",label:"Messaging"},{id:"full",label:"Full"}];function li(e){return e.name?.trim()||e.identity?.name?.trim()||e.id}function wn(e){const t=e.trim();if(!t||t.length>16)return!1;let n=!1;for(let s=0;s<t.length;s+=1)if(t.charCodeAt(s)>127){n=!0;break}return!(!n||t.includes("://")||t.includes("/")||t.includes("."))}function rs(e,t){const n=t?.emoji?.trim();if(n&&wn(n))return n;const s=e.identity?.emoji?.trim();if(s&&wn(s))return s;const i=t?.avatar?.trim();if(i&&wn(i))return i;const a=e.identity?.avatar?.trim();return a&&wn(a)?a:""}function hl(e,t){return t&&e===t?"default":null}function np(e){if(e==null||!Number.isFinite(e))return"-";if(e<1024)return`${e} B`;const t=["KB","MB","GB","TB"];let n=e/1024,s=0;for(;n>=1024&&s<t.length-1;)n/=1024,s+=1;return`${n.toFixed(n<10?1:0)} ${t[s]}`}function ls(e,t){const n=e;return{entry:(n?.agents?.list??[]).find(a=>a?.id===t),defaults:n?.agents?.defaults,globalTools:n?.tools}}function vl(e,t,n,s,i){const a=ls(t,e.id),l=(n&&n.agentId===e.id?n.workspace:null)||a.entry?.workspace||a.defaults?.workspace||"default",c=a.entry?.model?Gt(a.entry?.model):Gt(a.defaults?.model),u=i?.name?.trim()||e.identity?.name?.trim()||e.name?.trim()||a.entry?.name||e.id,g=rs(e,i)||"-",p=Array.isArray(a.entry?.skills)?a.entry?.skills:null,h=p?.length??null;return{workspace:l,model:c,identityName:u,identityEmoji:g,skillsLabel:p?`${h} selected`:"all skills",isDefault:!!(s&&e.id===s)}}function Gt(e){if(!e)return"-";if(typeof e=="string")return e.trim()||"-";if(typeof e=="object"&&e){const t=e,n=t.primary?.trim();if(n){const s=Array.isArray(t.fallbacks)?t.fallbacks.length:0;return s>0?`${n} (+${s} fallback)`:n}}return"-"}function uo(e){const t=e.match(/^(.+) \(\+\d+ fallback\)$/);return t?t[1]:e}function go(e){if(!e)return null;if(typeof e=="string")return e.trim()||null;if(typeof e=="object"&&e){const t=e;return(typeof t.primary=="string"?t.primary:typeof t.model=="string"?t.model:typeof t.id=="string"?t.id:typeof t.value=="string"?t.value:null)?.trim()||null}return null}function sp(e){if(!e||typeof e=="string")return null;if(typeof e=="object"&&e){const t=e,n=Array.isArray(t.fallbacks)?t.fallbacks:Array.isArray(t.fallback)?t.fallback:null;return n?n.filter(s=>typeof s=="string"):null}return null}function ip(e){return e.split(",").map(t=>t.trim()).filter(Boolean)}function ap(e){const n=e?.agents?.defaults?.models;if(!n||typeof n!="object")return[];const s=[];for(const[i,a]of Object.entries(n)){const o=i.trim();if(!o)continue;const l=a&&typeof a=="object"&&"alias"in a&&typeof a.alias=="string"?a.alias?.trim():void 0,c=l&&l!==o?`${l} (${o})`:o;s.push({value:o,label:c})}return s}function op(e,t){const n=ap(e),s=t?n.some(i=>i.value===t):!1;return t&&!s&&n.unshift({value:t,label:`Current (${t})`}),n.length===0?r`
|
|
464
464
|
<option value="" disabled>No configured models</option>
|
|
465
|
-
`:n.map(i=>r`<option value=${i.value}>${i.label}</option>`)}function
|
|
465
|
+
`:n.map(i=>r`<option value=${i.value}>${i.label}</option>`)}function rp(e){const t=De(e);if(!t)return{kind:"exact",value:""};if(t==="*")return{kind:"all"};if(!t.includes("*"))return{kind:"exact",value:t};const n=t.replace(/[.*+?^${}()|[\\]\\]/g,"\\$&");return{kind:"regex",value:new RegExp(`^${n.replaceAll("\\*",".*")}$`)}}function ci(e){return Array.isArray(e)?Gg(e).map(rp).filter(t=>t.kind!=="exact"||t.value.length>0):[]}function Vt(e,t){for(const n of t)if(n.kind==="all"||n.kind==="exact"&&e===n.value||n.kind==="regex"&&n.value.test(e))return!0;return!1}function lp(e,t){if(!t)return!0;const n=De(e),s=ci(t.deny);if(Vt(n,s))return!1;const i=ci(t.allow);return!!(i.length===0||Vt(n,i)||n==="apply_patch"&&Vt("exec",i))}function po(e,t){if(!Array.isArray(t)||t.length===0)return!1;const n=De(e),s=ci(t);return!!(Vt(n,s)||n==="apply_patch"&&Vt("exec",s))}function cp(e){const t=e.agentsList?.agents??[],n=e.agentsList?.defaultId??null,s=e.selectedAgentId??n??t[0]?.id??null,i=s?t.find(a=>a.id===s)??null:null;return r`
|
|
466
466
|
<div class="agents-layout">
|
|
467
467
|
<section class="card agents-sidebar">
|
|
468
468
|
<div class="row" style="justify-content: space-between;">
|
|
@@ -478,17 +478,17 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
478
478
|
<div class="agent-list" style="margin-top: 12px;">
|
|
479
479
|
${t.length===0?r`
|
|
480
480
|
<div class="muted">No agents found.</div>
|
|
481
|
-
`:t.map(a=>{const o=
|
|
481
|
+
`:t.map(a=>{const o=hl(a.id,n),l=rs(a,e.agentIdentityById[a.id]??null);return r`
|
|
482
482
|
<button
|
|
483
483
|
type="button"
|
|
484
484
|
class="agent-row ${s===a.id?"active":""}"
|
|
485
485
|
@click=${()=>e.onSelectAgent(a.id)}
|
|
486
486
|
>
|
|
487
487
|
<div class="agent-avatar">
|
|
488
|
-
${l||
|
|
488
|
+
${l||li(a).slice(0,1)}
|
|
489
489
|
</div>
|
|
490
490
|
<div class="agent-info">
|
|
491
|
-
<div class="agent-title">${
|
|
491
|
+
<div class="agent-title">${li(a)}</div>
|
|
492
492
|
<div class="agent-sub mono">${a.id}</div>
|
|
493
493
|
</div>
|
|
494
494
|
${o?r`<span class="agent-pill">${o}</span>`:v}
|
|
@@ -498,14 +498,14 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
498
498
|
</section>
|
|
499
499
|
<section class="agents-main">
|
|
500
500
|
${i?r`
|
|
501
|
-
${
|
|
502
|
-
${
|
|
503
|
-
${e.activePanel==="overview"?
|
|
504
|
-
${e.activePanel==="files"?
|
|
505
|
-
${e.activePanel==="tools"?
|
|
506
|
-
${e.activePanel==="skills"?
|
|
507
|
-
${e.activePanel==="channels"?
|
|
508
|
-
${e.activePanel==="cron"
|
|
501
|
+
${dp(i,n,e.agentIdentityById[i.id]??null)}
|
|
502
|
+
${up(e.activePanel,a=>e.onSelectPanel(a))}
|
|
503
|
+
${e.activePanel==="overview"?gp({agent:i,defaultId:n,configForm:e.configForm,agentFilesList:e.agentFilesList,agentIdentity:e.agentIdentityById[i.id]??null,agentIdentityError:e.agentIdentityError,agentIdentityLoading:e.agentIdentityLoading,configLoading:e.configLoading,configSaving:e.configSaving,configDirty:e.configDirty,onConfigReload:e.onConfigReload,onConfigSave:e.onConfigSave,onModelChange:e.onModelChange,onModelFallbacksChange:e.onModelFallbacksChange}):v}
|
|
504
|
+
${e.activePanel==="files"?wp({agentId:i.id,agentFilesList:e.agentFilesList,agentFilesLoading:e.agentFilesLoading,agentFilesError:e.agentFilesError,agentFileActive:e.agentFileActive,agentFileContents:e.agentFileContents,agentFileDrafts:e.agentFileDrafts,agentFileSaving:e.agentFileSaving,onLoadFiles:e.onLoadFiles,onSelectFile:e.onSelectFile,onFileDraftChange:e.onFileDraftChange,onFileReset:e.onFileReset,onFileSave:e.onFileSave}):v}
|
|
505
|
+
${e.activePanel==="tools"?Sp({agentId:i.id,configForm:e.configForm,configLoading:e.configLoading,configSaving:e.configSaving,configDirty:e.configDirty,onProfileChange:e.onToolsProfileChange,onOverridesChange:e.onToolsOverridesChange,onConfigReload:e.onConfigReload,onConfigSave:e.onConfigSave}):v}
|
|
506
|
+
${e.activePanel==="skills"?Cp({agentId:i.id,report:e.agentSkillsReport,loading:e.agentSkillsLoading,error:e.agentSkillsError,activeAgentId:e.agentSkillsAgentId,configForm:e.configForm,configLoading:e.configLoading,configSaving:e.configSaving,configDirty:e.configDirty,filter:e.skillsFilter,onFilterChange:e.onSkillsFilterChange,onRefresh:e.onSkillsRefresh,onToggle:e.onAgentSkillToggle,onClear:e.onAgentSkillsClear,onDisableAll:e.onAgentSkillsDisableAll,onConfigReload:e.onConfigReload,onConfigSave:e.onConfigSave}):v}
|
|
507
|
+
${e.activePanel==="channels"?xp({agent:i,defaultId:n,configForm:e.configForm,agentFilesList:e.agentFilesList,agentIdentity:e.agentIdentityById[i.id]??null,snapshot:e.channelsSnapshot,loading:e.channelsLoading,error:e.channelsError,lastSuccess:e.channelsLastSuccess,onRefresh:e.onChannelsRefresh}):v}
|
|
508
|
+
${e.activePanel==="cron"?$p({agent:i,defaultId:n,configForm:e.configForm,agentFilesList:e.agentFilesList,agentIdentity:e.agentIdentityById[i.id]??null,jobs:e.cronJobs,status:e.cronStatus,loading:e.cronLoading,error:e.cronError,onRefresh:e.onCronRefresh}):v}
|
|
509
509
|
`:r`
|
|
510
510
|
<div class="card">
|
|
511
511
|
<div class="card-title">Select an agent</div>
|
|
@@ -514,7 +514,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
514
514
|
`}
|
|
515
515
|
</section>
|
|
516
516
|
</div>
|
|
517
|
-
`}function
|
|
517
|
+
`}function dp(e,t,n){const s=hl(e.id,t),i=li(e),a=e.identity?.theme?.trim()||"Agent workspace and routing.",o=rs(e,n);return r`
|
|
518
518
|
<section class="card agent-header">
|
|
519
519
|
<div class="agent-header-main">
|
|
520
520
|
<div class="agent-avatar agent-avatar--lg">
|
|
@@ -530,7 +530,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
530
530
|
${s?r`<span class="agent-pill">${s}</span>`:v}
|
|
531
531
|
</div>
|
|
532
532
|
</section>
|
|
533
|
-
`}function
|
|
533
|
+
`}function up(e,t){return r`
|
|
534
534
|
<div class="agent-tabs">
|
|
535
535
|
${[{id:"overview",label:"Overview"},{id:"files",label:"Files"},{id:"tools",label:"Tools"},{id:"skills",label:"Skills"},{id:"channels",label:"Channels"},{id:"cron",label:"Cron Jobs"}].map(s=>r`
|
|
536
536
|
<button
|
|
@@ -542,7 +542,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
542
542
|
</button>
|
|
543
543
|
`)}
|
|
544
544
|
</div>
|
|
545
|
-
`}function
|
|
545
|
+
`}function gp(e){const{agent:t,configForm:n,agentFilesList:s,agentIdentity:i,agentIdentityLoading:a,agentIdentityError:o,configLoading:l,configSaving:c,configDirty:u,onConfigReload:g,onConfigSave:p,onModelChange:h,onModelFallbacksChange:d}=e,f=ls(n,t.id),S=(s&&s.agentId===t.id?s.workspace:null)||f.entry?.workspace||f.defaults?.workspace||"default",k=f.entry?.model?Gt(f.entry?.model):Gt(f.defaults?.model),$=Gt(f.defaults?.model),A=go(f.entry?.model)||(k!=="-"?uo(k):null),C=go(f.defaults?.model)||($!=="-"?uo($):null),_=A??C??null,T=sp(f.entry?.model),I=T?T.join(", "):"",z=i?.name?.trim()||t.identity?.name?.trim()||t.name?.trim()||f.entry?.name||"-",se=rs(t,i)||"-",F=Array.isArray(f.entry?.skills)?f.entry?.skills:null,H=F?.length??null,ce=a?"Loading…":o?"Unavailable":"",E=!!(e.defaultId&&t.id===e.defaultId);return r`
|
|
546
546
|
<section class="card">
|
|
547
547
|
<div class="card-title">Overview</div>
|
|
548
548
|
<div class="card-sub">Workspace paths and identity metadata.</div>
|
|
@@ -589,7 +589,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
589
589
|
${C?`Inherit default (${C})`:"Inherit default"}
|
|
590
590
|
</option>
|
|
591
591
|
`}
|
|
592
|
-
${
|
|
592
|
+
${op(n,_??void 0)}
|
|
593
593
|
</select>
|
|
594
594
|
</label>
|
|
595
595
|
<label class="field" style="min-width: 260px; flex: 1;">
|
|
@@ -598,7 +598,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
598
598
|
.value=${I}
|
|
599
599
|
?disabled=${!n||l||c}
|
|
600
600
|
placeholder="provider/model, provider/model"
|
|
601
|
-
@input=${B=>d(t.id,
|
|
601
|
+
@input=${B=>d(t.id,ip(B.target.value))}
|
|
602
602
|
/>
|
|
603
603
|
</label>
|
|
604
604
|
</div>
|
|
@@ -620,7 +620,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
620
620
|
</div>
|
|
621
621
|
</div>
|
|
622
622
|
</section>
|
|
623
|
-
`}function
|
|
623
|
+
`}function ml(e,t){return r`
|
|
624
624
|
<section class="card">
|
|
625
625
|
<div class="card-title">Agent Context</div>
|
|
626
626
|
<div class="card-sub">${t}</div>
|
|
@@ -651,9 +651,9 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
651
651
|
</div>
|
|
652
652
|
</div>
|
|
653
653
|
</section>
|
|
654
|
-
`}function
|
|
654
|
+
`}function pp(e,t){const n=e.channelMeta?.find(s=>s.id===t);return n?.label?n.label:e.channelLabels?.[t]??t}function fp(e){if(!e)return[];const t=new Set;for(const i of e.channelOrder??[])t.add(i);for(const i of e.channelMeta??[])t.add(i.id);for(const i of Object.keys(e.channelAccounts??{}))t.add(i);const n=[],s=e.channelOrder?.length?e.channelOrder:Array.from(t);for(const i of s)t.has(i)&&(n.push(i),t.delete(i));for(const i of t)n.push(i);return n.map(i=>({id:i,label:pp(e,i),accounts:e.channelAccounts?.[i]??[]}))}const hp=["groupPolicy","streamMode","dmPolicy"];function vp(e,t){if(!e)return null;const s=(e.channels??{})[t];if(s&&typeof s=="object")return s;const i=e[t];return i&&typeof i=="object"?i:null}function mp(e){if(e==null)return"n/a";if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return String(e);try{return JSON.stringify(e)}catch{return"n/a"}}function bp(e,t){const n=vp(e,t);return n?hp.flatMap(s=>s in n?[{label:s,value:mp(n[s])}]:[]):[]}function yp(e){let t=0,n=0,s=0;for(const i of e){const a=i.probe&&typeof i.probe=="object"&&"ok"in i.probe?!!i.probe.ok:!1;(i.connected===!0||i.running===!0||a)&&(t+=1),i.configured&&(n+=1),i.enabled&&(s+=1)}return{total:e.length,connected:t,configured:n,enabled:s}}function xp(e){const t=vl(e.agent,e.configForm,e.agentFilesList,e.defaultId,e.agentIdentity),n=fp(e.snapshot),s=e.lastSuccess?V(e.lastSuccess):"never";return r`
|
|
655
655
|
<section class="grid grid-cols-2">
|
|
656
|
-
${
|
|
656
|
+
${ml(t,"Workspace, identity, and model configuration.")}
|
|
657
657
|
<section class="card">
|
|
658
658
|
<div class="row" style="justify-content: space-between;">
|
|
659
659
|
<div>
|
|
@@ -675,7 +675,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
675
675
|
<div class="muted" style="margin-top: 16px">No channels found.</div>
|
|
676
676
|
`:r`
|
|
677
677
|
<div class="list" style="margin-top: 16px;">
|
|
678
|
-
${n.map(i=>{const a=
|
|
678
|
+
${n.map(i=>{const a=yp(i.accounts),o=a.total?`${a.connected}/${a.total} connected`:"no accounts",l=a.configured?`${a.configured} configured`:"not configured",c=a.total?`${a.enabled} enabled`:"disabled",u=bp(e.configForm,i.id);return r`
|
|
679
679
|
<div class="list-item">
|
|
680
680
|
<div class="list-main">
|
|
681
681
|
<div class="list-title">${i.label}</div>
|
|
@@ -693,9 +693,9 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
693
693
|
`}
|
|
694
694
|
</section>
|
|
695
695
|
</section>
|
|
696
|
-
`}function
|
|
696
|
+
`}function $p(e){const t=vl(e.agent,e.configForm,e.agentFilesList,e.defaultId,e.agentIdentity),n=e.jobs.filter(s=>s.agentId===e.agent.id);return r`
|
|
697
697
|
<section class="grid grid-cols-2">
|
|
698
|
-
${
|
|
698
|
+
${ml(t,"Workspace and scheduling targets.")}
|
|
699
699
|
<section class="card">
|
|
700
700
|
<div class="row" style="justify-content: space-between;">
|
|
701
701
|
<div>
|
|
@@ -719,7 +719,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
719
719
|
</div>
|
|
720
720
|
<div class="stat">
|
|
721
721
|
<div class="stat-label">Next wake</div>
|
|
722
|
-
<div class="stat-value">${
|
|
722
|
+
<div class="stat-value">${Qi(e.status?.nextWakeAtMs??null)}</div>
|
|
723
723
|
</div>
|
|
724
724
|
</div>
|
|
725
725
|
${e.error?r`<div class="callout danger" style="margin-top: 12px;">${e.error}</div>`:v}
|
|
@@ -738,7 +738,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
738
738
|
<div class="list-title">${s.name}</div>
|
|
739
739
|
${s.description?r`<div class="list-sub">${s.description}</div>`:v}
|
|
740
740
|
<div class="chip-row" style="margin-top: 6px;">
|
|
741
|
-
<span class="chip">${
|
|
741
|
+
<span class="chip">${fl(s)}</span>
|
|
742
742
|
<span class="chip ${s.enabled?"chip-ok":"chip-warn"}">
|
|
743
743
|
${s.enabled?"enabled":"disabled"}
|
|
744
744
|
</span>
|
|
@@ -746,15 +746,15 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
746
746
|
</div>
|
|
747
747
|
</div>
|
|
748
748
|
<div class="list-meta">
|
|
749
|
-
<div class="mono">${
|
|
750
|
-
<div class="muted">${
|
|
749
|
+
<div class="mono">${Xg(s)}</div>
|
|
750
|
+
<div class="muted">${ep(s)}</div>
|
|
751
751
|
</div>
|
|
752
752
|
</div>
|
|
753
753
|
`)}
|
|
754
754
|
</div>
|
|
755
755
|
`}
|
|
756
756
|
</section>
|
|
757
|
-
`}function
|
|
757
|
+
`}function wp(e){const t=e.agentFilesList?.agentId===e.agentId?e.agentFilesList:null,n=t?.files??[],s=e.agentFileActive??null,i=s?n.find(c=>c.name===s)??null:null,a=s?e.agentFileContents[s]??"":"",o=s?e.agentFileDrafts[s]??a:"",l=s?o!==a:!1;return r`
|
|
758
758
|
<section class="card">
|
|
759
759
|
<div class="row" style="justify-content: space-between;">
|
|
760
760
|
<div>
|
|
@@ -776,7 +776,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
776
776
|
<div class="agent-files-list">
|
|
777
777
|
${n.length===0?r`
|
|
778
778
|
<div class="muted">No files found.</div>
|
|
779
|
-
`:n.map(c=>
|
|
779
|
+
`:n.map(c=>kp(c,s,()=>e.onSelectFile(c.name)))}
|
|
780
780
|
</div>
|
|
781
781
|
<div class="agent-files-editor">
|
|
782
782
|
${i?r`
|
|
@@ -825,7 +825,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
825
825
|
</div>
|
|
826
826
|
`}
|
|
827
827
|
</section>
|
|
828
|
-
`}function
|
|
828
|
+
`}function kp(e,t,n){const s=e.missing?"Missing":`${np(e.size)} · ${V(e.updatedAtMs??null)}`;return r`
|
|
829
829
|
<button
|
|
830
830
|
type="button"
|
|
831
831
|
class="agent-file-row ${t===e.name?"active":""}"
|
|
@@ -839,7 +839,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
839
839
|
<span class="agent-pill warn">missing</span>
|
|
840
840
|
`:v}
|
|
841
841
|
</button>
|
|
842
|
-
`}function
|
|
842
|
+
`}function Sp(e){const t=ls(e.configForm,e.agentId),n=t.entry?.tools??{},s=t.globalTools??{},i=n.profile??s.profile??"full",a=n.profile?"agent override":s.profile?"global default":"default",o=Array.isArray(n.allow)&&n.allow.length>0,l=Array.isArray(s.allow)&&s.allow.length>0,c=!!e.configForm&&!e.configLoading&&!e.configSaving&&!o,u=o?[]:Array.isArray(n.alsoAllow)?n.alsoAllow:[],g=o?[]:Array.isArray(n.deny)?n.deny:[],p=o?{allow:n.allow??[],deny:n.deny??[]}:Vg(i)??void 0,h=co.flatMap(k=>k.tools.map($=>$.id)),d=k=>{const $=lp(k,p),A=po(k,u),C=po(k,g);return{allowed:($||A)&&!C,baseAllowed:$,denied:C}},f=h.filter(k=>d(k).allowed).length,m=(k,$)=>{const A=new Set(u.map(I=>De(I)).filter(I=>I.length>0)),C=new Set(g.map(I=>De(I)).filter(I=>I.length>0)),_=d(k).baseAllowed,T=De(k);$?(C.delete(T),_||A.add(T)):(A.delete(T),C.add(T)),e.onOverridesChange(e.agentId,[...A],[...C])},S=k=>{const $=new Set(u.map(C=>De(C)).filter(C=>C.length>0)),A=new Set(g.map(C=>De(C)).filter(C=>C.length>0));for(const C of h){const _=d(C).baseAllowed,T=De(C);k?(A.delete(T),_||$.add(T)):($.delete(T),A.add(T))}e.onOverridesChange(e.agentId,[...$],[...A])};return r`
|
|
843
843
|
<section class="card">
|
|
844
844
|
<div class="row" style="justify-content: space-between;">
|
|
845
845
|
<div>
|
|
@@ -917,7 +917,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
917
917
|
<div class="agent-tools-presets" style="margin-top: 16px;">
|
|
918
918
|
<div class="label">Quick Presets</div>
|
|
919
919
|
<div class="agent-tools-buttons">
|
|
920
|
-
${
|
|
920
|
+
${tp.map(k=>r`
|
|
921
921
|
<button
|
|
922
922
|
class="btn btn--sm ${i===k.id?"active":""}"
|
|
923
923
|
?disabled=${!c}
|
|
@@ -937,7 +937,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
937
937
|
</div>
|
|
938
938
|
|
|
939
939
|
<div class="agent-tools-grid" style="margin-top: 20px;">
|
|
940
|
-
${
|
|
940
|
+
${co.map(k=>r`
|
|
941
941
|
<div class="agent-tools-section">
|
|
942
942
|
<div class="agent-tools-header">${k.label}</div>
|
|
943
943
|
<div class="agent-tools-list">
|
|
@@ -963,7 +963,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
963
963
|
`)}
|
|
964
964
|
</div>
|
|
965
965
|
</section>
|
|
966
|
-
`}const
|
|
966
|
+
`}const kn=[{id:"workspace",label:"Workspace Skills",sources:["openclaw-workspace"]},{id:"built-in",label:"Built-in Skills",sources:["openclaw-bundled"]},{id:"installed",label:"Installed Skills",sources:["openclaw-managed"]},{id:"extra",label:"Extra Skills",sources:["openclaw-extra"]}];function Ap(e){const t=new Map;for(const a of kn)t.set(a.id,{id:a.id,label:a.label,skills:[]});const n=kn.find(a=>a.id==="built-in"),s={id:"other",label:"Other Skills",skills:[]};for(const a of e){const o=a.bundled?n:kn.find(l=>l.sources.includes(a.source));o?t.get(o.id)?.skills.push(a):s.skills.push(a)}const i=kn.map(a=>t.get(a.id)).filter(a=>!!(a&&a.skills.length>0));return s.skills.length>0&&i.push(s),i}function Cp(e){const t=!!e.configForm&&!e.configLoading&&!e.configSaving,n=ls(e.configForm,e.agentId),s=Array.isArray(n.entry?.skills)?n.entry?.skills:void 0,i=new Set((s??[]).map(d=>d.trim()).filter(Boolean)),a=s!==void 0,o=!!(e.report&&e.activeAgentId===e.agentId),l=o?e.report?.skills??[]:[],c=e.filter.trim().toLowerCase(),u=c?l.filter(d=>[d.name,d.description,d.source].join(" ").toLowerCase().includes(c)):l,g=Ap(u),p=a?l.filter(d=>i.has(d.name)).length:l.length,h=l.length;return r`
|
|
967
967
|
<section class="card">
|
|
968
968
|
<div class="row" style="justify-content: space-between;">
|
|
969
969
|
<div>
|
|
@@ -1035,21 +1035,21 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1035
1035
|
<div class="muted" style="margin-top: 16px">No skills found.</div>
|
|
1036
1036
|
`:r`
|
|
1037
1037
|
<div class="agent-skills-groups" style="margin-top: 16px;">
|
|
1038
|
-
${g.map(d=>
|
|
1038
|
+
${g.map(d=>Tp(d,{agentId:e.agentId,allowSet:i,usingAllowlist:a,editable:t,onToggle:e.onToggle}))}
|
|
1039
1039
|
</div>
|
|
1040
1040
|
`}
|
|
1041
1041
|
</section>
|
|
1042
|
-
`}function
|
|
1042
|
+
`}function Tp(e,t){const n=e.id==="workspace"||e.id==="built-in";return r`
|
|
1043
1043
|
<details class="agent-skills-group" ?open=${!n}>
|
|
1044
1044
|
<summary class="agent-skills-header">
|
|
1045
1045
|
<span>${e.label}</span>
|
|
1046
1046
|
<span class="muted">${e.skills.length}</span>
|
|
1047
1047
|
</summary>
|
|
1048
1048
|
<div class="list skills-grid">
|
|
1049
|
-
${e.skills.map(s=>
|
|
1049
|
+
${e.skills.map(s=>_p(s,{agentId:t.agentId,allowSet:t.allowSet,usingAllowlist:t.usingAllowlist,editable:t.editable,onToggle:t.onToggle}))}
|
|
1050
1050
|
</div>
|
|
1051
1051
|
</details>
|
|
1052
|
-
`}function
|
|
1052
|
+
`}function _p(e,t){const n=t.usingAllowlist?t.allowSet.has(e.name):!0,s=[...e.missing.bins.map(a=>`bin:${a}`),...e.missing.env.map(a=>`env:${a}`),...e.missing.config.map(a=>`config:${a}`),...e.missing.os.map(a=>`os:${a}`)],i=[];return e.disabled&&i.push("disabled"),e.blockedByAllowlist&&i.push("blocked by allowlist"),r`
|
|
1053
1053
|
<div class="list-item agent-skill-row">
|
|
1054
1054
|
<div class="list-main">
|
|
1055
1055
|
<div class="list-title">
|
|
@@ -1080,7 +1080,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1080
1080
|
</label>
|
|
1081
1081
|
</div>
|
|
1082
1082
|
</div>
|
|
1083
|
-
`}
|
|
1083
|
+
`}const Ep=new Set(["title","description","default","nullable"]);function Lp(e){return Object.keys(e??{}).filter(n=>!Ep.has(n)).length===0}function Mp(e){if(e===void 0)return"";try{return JSON.stringify(e,null,2)??""}catch{return""}}const an={chevronDown:r`
|
|
1084
1084
|
<svg
|
|
1085
1085
|
viewBox="0 0 24 24"
|
|
1086
1086
|
fill="none"
|
|
@@ -1138,7 +1138,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1138
1138
|
<path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"></path>
|
|
1139
1139
|
<path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"></path>
|
|
1140
1140
|
</svg>
|
|
1141
|
-
`};function Ke(e){const{schema:t,value:n,path:s,hints:i,unsupported:a,disabled:o,onPatch:l}=e,c=e.showLabel??!0,u=
|
|
1141
|
+
`};function Ke(e){const{schema:t,value:n,path:s,hints:i,unsupported:a,disabled:o,onPatch:l}=e,c=e.showLabel??!0,u=we(t),g=Ae(s,i),p=g?.label??t.title??We(String(s.at(-1))),h=g?.help??t.description,d=Zn(s);if(a.has(d))return r`<div class="cfg-field cfg-field--error">
|
|
1142
1142
|
<div class="cfg-field__label">${p}</div>
|
|
1143
1143
|
<div class="cfg-field__error">Unsupported schema node. Use Raw mode.</div>
|
|
1144
1144
|
</div>`;if(t.anyOf||t.oneOf){const m=(t.anyOf??t.oneOf??[]).filter(_=>!(_.type==="null"||Array.isArray(_.type)&&_.type.includes("null")));if(m.length===1)return Ke({...e,schema:m[0]});const S=_=>{if(_.const!==void 0)return _.const;if(_.enum&&_.enum.length===1)return _.enum[0]},k=m.map(S),$=k.every(_=>_!==void 0);if($&&k.length>0&&k.length<=5){const _=n??t.default;return r`
|
|
@@ -1158,7 +1158,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1158
1158
|
`)}
|
|
1159
1159
|
</div>
|
|
1160
1160
|
</div>
|
|
1161
|
-
`}if($&&k.length>5)return
|
|
1161
|
+
`}if($&&k.length>5)return ho({...e,options:k,value:n??t.default});const A=new Set(m.map(_=>we(_)).filter(Boolean)),C=new Set([...A].map(_=>_==="integer"?"number":_));if([...C].every(_=>["string","number","boolean"].includes(_))){const _=C.has("string"),T=C.has("number");if(C.has("boolean")&&C.size===1)return Ke({...e,schema:{...t,type:"boolean",anyOf:void 0,oneOf:void 0}});if(_||T)return fo({...e,inputType:T&&!_?"number":"text"})}}if(t.enum){const f=t.enum;if(f.length<=5){const m=n??t.default;return r`
|
|
1162
1162
|
<div class="cfg-field">
|
|
1163
1163
|
${c?r`<label class="cfg-field__label">${p}</label>`:v}
|
|
1164
1164
|
${h?r`<div class="cfg-field__help">${h}</div>`:v}
|
|
@@ -1175,7 +1175,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1175
1175
|
`)}
|
|
1176
1176
|
</div>
|
|
1177
1177
|
</div>
|
|
1178
|
-
`}return
|
|
1178
|
+
`}return ho({...e,options:f,value:n??t.default})}if(u==="object")return Rp(e);if(u==="array")return Pp(e);if(u==="boolean"){const f=typeof n=="boolean"?n:typeof t.default=="boolean"?t.default:!1;return r`
|
|
1179
1179
|
<label class="cfg-toggle-row ${o?"disabled":""}">
|
|
1180
1180
|
<div class="cfg-toggle-row__content">
|
|
1181
1181
|
<span class="cfg-toggle-row__label">${p}</span>
|
|
@@ -1191,12 +1191,12 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1191
1191
|
<span class="cfg-toggle__track"></span>
|
|
1192
1192
|
</div>
|
|
1193
1193
|
</label>
|
|
1194
|
-
`}return u==="number"||u==="integer"?
|
|
1194
|
+
`}return u==="number"||u==="integer"?Ip(e):u==="string"?fo({...e,inputType:"text"}):r`
|
|
1195
1195
|
<div class="cfg-field cfg-field--error">
|
|
1196
1196
|
<div class="cfg-field__label">${p}</div>
|
|
1197
1197
|
<div class="cfg-field__error">Unsupported type: ${u}. Use Raw mode.</div>
|
|
1198
1198
|
</div>
|
|
1199
|
-
`}function
|
|
1199
|
+
`}function fo(e){const{schema:t,value:n,path:s,hints:i,disabled:a,onPatch:o,inputType:l}=e,c=e.showLabel??!0,u=Ae(s,i),g=u?.label??t.title??We(String(s.at(-1))),p=u?.help??t.description,h=u?.sensitive??Mc(s),d=u?.placeholder??(h?"••••":t.default!==void 0?`Default: ${String(t.default)}`:""),f=n??"";return r`
|
|
1200
1200
|
<div class="cfg-field">
|
|
1201
1201
|
${c?r`<label class="cfg-field__label">${g}</label>`:v}
|
|
1202
1202
|
${p?r`<div class="cfg-field__help">${p}</div>`:v}
|
|
@@ -1221,7 +1221,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1221
1221
|
`:v}
|
|
1222
1222
|
</div>
|
|
1223
1223
|
</div>
|
|
1224
|
-
`}function
|
|
1224
|
+
`}function Ip(e){const{schema:t,value:n,path:s,hints:i,disabled:a,onPatch:o}=e,l=e.showLabel??!0,c=Ae(s,i),u=c?.label??t.title??We(String(s.at(-1))),g=c?.help??t.description,p=n??t.default??"",h=typeof p=="number"?p:0;return r`
|
|
1225
1225
|
<div class="cfg-field">
|
|
1226
1226
|
${l?r`<label class="cfg-field__label">${u}</label>`:v}
|
|
1227
1227
|
${g?r`<div class="cfg-field__help">${g}</div>`:v}
|
|
@@ -1247,7 +1247,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1247
1247
|
>+</button>
|
|
1248
1248
|
</div>
|
|
1249
1249
|
</div>
|
|
1250
|
-
`}function
|
|
1250
|
+
`}function ho(e){const{schema:t,value:n,path:s,hints:i,disabled:a,options:o,onPatch:l}=e,c=e.showLabel??!0,u=Ae(s,i),g=u?.label??t.title??We(String(s.at(-1))),p=u?.help??t.description,h=n??t.default,d=o.findIndex(m=>m===h||String(m)===String(h)),f="__unset__";return r`
|
|
1251
1251
|
<div class="cfg-field">
|
|
1252
1252
|
${c?r`<label class="cfg-field__label">${g}</label>`:v}
|
|
1253
1253
|
${p?r`<div class="cfg-field__help">${p}</div>`:v}
|
|
@@ -1263,24 +1263,24 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1263
1263
|
`)}
|
|
1264
1264
|
</select>
|
|
1265
1265
|
</div>
|
|
1266
|
-
`}function
|
|
1266
|
+
`}function Rp(e){const{schema:t,value:n,path:s,hints:i,unsupported:a,disabled:o,onPatch:l}=e,c=Ae(s,i),u=c?.label??t.title??We(String(s.at(-1))),g=c?.help??t.description,p=n??t.default,h=p&&typeof p=="object"&&!Array.isArray(p)?p:{},d=t.properties??{},m=Object.entries(d).toSorted((A,C)=>{const _=Ae([...s,A[0]],i)?.order??0,T=Ae([...s,C[0]],i)?.order??0;return _!==T?_-T:A[0].localeCompare(C[0])}),S=new Set(Object.keys(d)),k=t.additionalProperties,$=!!k&&typeof k=="object";return s.length===1?r`
|
|
1267
1267
|
<div class="cfg-fields">
|
|
1268
1268
|
${m.map(([A,C])=>Ke({schema:C,value:h[A],path:[...s,A],hints:i,unsupported:a,disabled:o,onPatch:l}))}
|
|
1269
|
-
${$?
|
|
1269
|
+
${$?vo({schema:k,value:h,path:s,hints:i,unsupported:a,disabled:o,reservedKeys:S,onPatch:l}):v}
|
|
1270
1270
|
</div>
|
|
1271
1271
|
`:r`
|
|
1272
1272
|
<details class="cfg-object" open>
|
|
1273
1273
|
<summary class="cfg-object__header">
|
|
1274
1274
|
<span class="cfg-object__title">${u}</span>
|
|
1275
|
-
<span class="cfg-object__chevron">${
|
|
1275
|
+
<span class="cfg-object__chevron">${an.chevronDown}</span>
|
|
1276
1276
|
</summary>
|
|
1277
1277
|
${g?r`<div class="cfg-object__help">${g}</div>`:v}
|
|
1278
1278
|
<div class="cfg-object__content">
|
|
1279
1279
|
${m.map(([A,C])=>Ke({schema:C,value:h[A],path:[...s,A],hints:i,unsupported:a,disabled:o,onPatch:l}))}
|
|
1280
|
-
${$?
|
|
1280
|
+
${$?vo({schema:k,value:h,path:s,hints:i,unsupported:a,disabled:o,reservedKeys:S,onPatch:l}):v}
|
|
1281
1281
|
</div>
|
|
1282
1282
|
</details>
|
|
1283
|
-
`}function
|
|
1283
|
+
`}function Pp(e){const{schema:t,value:n,path:s,hints:i,unsupported:a,disabled:o,onPatch:l}=e,c=e.showLabel??!0,u=Ae(s,i),g=u?.label??t.title??We(String(s.at(-1))),p=u?.help??t.description,h=Array.isArray(t.items)?t.items[0]:t.items;if(!h)return r`
|
|
1284
1284
|
<div class="cfg-field cfg-field--error">
|
|
1285
1285
|
<div class="cfg-field__label">${g}</div>
|
|
1286
1286
|
<div class="cfg-field__error">Unsupported array schema. Use Raw mode.</div>
|
|
@@ -1294,9 +1294,9 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1294
1294
|
type="button"
|
|
1295
1295
|
class="cfg-array__add"
|
|
1296
1296
|
?disabled=${o}
|
|
1297
|
-
@click=${()=>{const f=[...d,
|
|
1297
|
+
@click=${()=>{const f=[...d,fr(h)];l(s,f)}}
|
|
1298
1298
|
>
|
|
1299
|
-
<span class="cfg-array__add-icon">${
|
|
1299
|
+
<span class="cfg-array__add-icon">${an.plus}</span>
|
|
1300
1300
|
Add
|
|
1301
1301
|
</button>
|
|
1302
1302
|
</div>
|
|
@@ -1317,7 +1317,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1317
1317
|
?disabled=${o}
|
|
1318
1318
|
@click=${()=>{const S=[...d];S.splice(m,1),l(s,S)}}
|
|
1319
1319
|
>
|
|
1320
|
-
${
|
|
1320
|
+
${an.trash}
|
|
1321
1321
|
</button>
|
|
1322
1322
|
</div>
|
|
1323
1323
|
<div class="cfg-array__item-content">
|
|
@@ -1328,7 +1328,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1328
1328
|
</div>
|
|
1329
1329
|
`}
|
|
1330
1330
|
</div>
|
|
1331
|
-
`}function
|
|
1331
|
+
`}function vo(e){const{schema:t,value:n,path:s,hints:i,unsupported:a,disabled:o,reservedKeys:l,onPatch:c}=e,u=Lp(t),g=Object.entries(n??{}).filter(([p])=>!l.has(p));return r`
|
|
1332
1332
|
<div class="cfg-map">
|
|
1333
1333
|
<div class="cfg-map__header">
|
|
1334
1334
|
<span class="cfg-map__label">Custom entries</span>
|
|
@@ -1336,9 +1336,9 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1336
1336
|
type="button"
|
|
1337
1337
|
class="cfg-map__add"
|
|
1338
1338
|
?disabled=${o}
|
|
1339
|
-
@click=${()=>{const p={...n};let h=1,d=`custom-${h}`;for(;d in p;)h+=1,d=`custom-${h}`;p[d]=u?{}:
|
|
1339
|
+
@click=${()=>{const p={...n};let h=1,d=`custom-${h}`;for(;d in p;)h+=1,d=`custom-${h}`;p[d]=u?{}:fr(t),c(s,p)}}
|
|
1340
1340
|
>
|
|
1341
|
-
<span class="cfg-map__add-icon">${
|
|
1341
|
+
<span class="cfg-map__add-icon">${an.plus}</span>
|
|
1342
1342
|
Add Entry
|
|
1343
1343
|
</button>
|
|
1344
1344
|
</div>
|
|
@@ -1347,7 +1347,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1347
1347
|
<div class="cfg-map__empty">No custom entries.</div>
|
|
1348
1348
|
`:r`
|
|
1349
1349
|
<div class="cfg-map__items">
|
|
1350
|
-
${g.map(([p,h])=>{const d=[...s,p],f=
|
|
1350
|
+
${g.map(([p,h])=>{const d=[...s,p],f=Mp(h);return r`
|
|
1351
1351
|
<div class="cfg-map__item">
|
|
1352
1352
|
<div class="cfg-map__item-key">
|
|
1353
1353
|
<input
|
|
@@ -1378,14 +1378,14 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1378
1378
|
?disabled=${o}
|
|
1379
1379
|
@click=${()=>{const m={...n};delete m[p],c(s,m)}}
|
|
1380
1380
|
>
|
|
1381
|
-
${
|
|
1381
|
+
${an.trash}
|
|
1382
1382
|
</button>
|
|
1383
1383
|
</div>
|
|
1384
1384
|
`})}
|
|
1385
1385
|
</div>
|
|
1386
1386
|
`}
|
|
1387
1387
|
</div>
|
|
1388
|
-
`}const
|
|
1388
|
+
`}const mo={env:r`
|
|
1389
1389
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
|
|
1390
1390
|
<circle cx="12" cy="12" r="3"></circle>
|
|
1391
1391
|
<path
|
|
@@ -1572,11 +1572,11 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1572
1572
|
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path>
|
|
1573
1573
|
<polyline points="14 2 14 8 20 8"></polyline>
|
|
1574
1574
|
</svg>
|
|
1575
|
-
`},
|
|
1575
|
+
`},Yi={env:{label:"Environment Variables",description:"Environment variables passed to the gateway process"},update:{label:"Updates",description:"Auto-update settings and release channel"},agents:{label:"Agents",description:"Agent configurations, models, and identities"},auth:{label:"Authentication",description:"API keys and authentication profiles"},channels:{label:"Channels",description:"Messaging channels (Telegram, Discord, Slack, etc.)"},messages:{label:"Messages",description:"Message handling and routing settings"},commands:{label:"Commands",description:"Custom slash commands"},hooks:{label:"Hooks",description:"Webhooks and event hooks"},skills:{label:"Skills",description:"Skill packs and capabilities"},tools:{label:"Tools",description:"Tool configurations (browser, search, etc.)"},gateway:{label:"Gateway",description:"Gateway server settings (port, auth, binding)"},wizard:{label:"Setup Wizard",description:"Setup wizard state and history"},meta:{label:"Metadata",description:"Gateway metadata and version information"},logging:{label:"Logging",description:"Log levels and output configuration"},browser:{label:"Browser",description:"Browser automation settings"},ui:{label:"UI",description:"User interface preferences"},models:{label:"Models",description:"AI model configurations and providers"},bindings:{label:"Bindings",description:"Key bindings and shortcuts"},broadcast:{label:"Broadcast",description:"Broadcast and notification settings"},audio:{label:"Audio",description:"Audio input/output settings"},session:{label:"Session",description:"Session management and persistence"},cron:{label:"Cron",description:"Scheduled tasks and automation"},web:{label:"Web",description:"Web server and API settings"},discovery:{label:"Discovery",description:"Service discovery and networking"},canvasHost:{label:"Canvas Host",description:"Canvas rendering and display"},talk:{label:"Talk",description:"Voice and speech settings"},plugins:{label:"Plugins",description:"Plugin management and extensions"}};function bo(e){return mo[e]??mo.default}function Dp(e,t,n){if(!n)return!0;const s=n.toLowerCase(),i=Yi[e];return e.toLowerCase().includes(s)||i&&(i.label.toLowerCase().includes(s)||i.description.toLowerCase().includes(s))?!0:Kt(t,s)}function Kt(e,t){if(e.title?.toLowerCase().includes(t)||e.description?.toLowerCase().includes(t)||e.enum?.some(s=>String(s).toLowerCase().includes(t)))return!0;if(e.properties){for(const[s,i]of Object.entries(e.properties))if(s.toLowerCase().includes(t)||Kt(i,t))return!0}if(e.items){const s=Array.isArray(e.items)?e.items:[e.items];for(const i of s)if(i&&Kt(i,t))return!0}if(e.additionalProperties&&typeof e.additionalProperties=="object"&&Kt(e.additionalProperties,t))return!0;const n=e.anyOf??e.oneOf??e.allOf;if(n){for(const s of n)if(s&&Kt(s,t))return!0}return!1}function Fp(e){if(!e.schema)return r`
|
|
1576
1576
|
<div class="muted">Schema unavailable.</div>
|
|
1577
|
-
`;const t=e.schema,n=e.value??{};if(
|
|
1577
|
+
`;const t=e.schema,n=e.value??{};if(we(t)!=="object"||!t.properties)return r`
|
|
1578
1578
|
<div class="callout danger">Unsupported schema. Use Raw.</div>
|
|
1579
|
-
`;const s=new Set(e.unsupportedPaths??[]),i=t.properties,a=e.searchQuery??"",o=e.activeSection,l=e.activeSubsection??null,u=Object.entries(i).toSorted((p,h)=>{const d=
|
|
1579
|
+
`;const s=new Set(e.unsupportedPaths??[]),i=t.properties,a=e.searchQuery??"",o=e.activeSection,l=e.activeSubsection??null,u=Object.entries(i).toSorted((p,h)=>{const d=Ae([p[0]],e.uiHints)?.order??50,f=Ae([h[0]],e.uiHints)?.order??50;return d!==f?d-f:p[0].localeCompare(h[0])}).filter(([p,h])=>!(o&&p!==o||a&&!Dp(p,h,a)));let g=null;if(o&&l&&u.length===1){const p=u[0]?.[1];p&&we(p)==="object"&&p.properties&&p.properties[l]&&(g={sectionKey:o,subsectionKey:l,schema:p.properties[l]})}return u.length===0?r`
|
|
1580
1580
|
<div class="config-empty">
|
|
1581
1581
|
<div class="config-empty__icon">${le.search}</div>
|
|
1582
1582
|
<div class="config-empty__text">
|
|
@@ -1585,10 +1585,10 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1585
1585
|
</div>
|
|
1586
1586
|
`:r`
|
|
1587
1587
|
<div class="config-form config-form--modern">
|
|
1588
|
-
${g?(()=>{const{sectionKey:p,subsectionKey:h,schema:d}=g,f=
|
|
1588
|
+
${g?(()=>{const{sectionKey:p,subsectionKey:h,schema:d}=g,f=Ae([p,h],e.uiHints),m=f?.label??d.title??We(h),S=f?.help??d.description??"",k=n[p],$=k&&typeof k=="object"?k[h]:void 0,A=`config-section-${p}-${h}`;return r`
|
|
1589
1589
|
<section class="config-section-card" id=${A}>
|
|
1590
1590
|
<div class="config-section-card__header">
|
|
1591
|
-
<span class="config-section-card__icon">${
|
|
1591
|
+
<span class="config-section-card__icon">${bo(p)}</span>
|
|
1592
1592
|
<div class="config-section-card__titles">
|
|
1593
1593
|
<h3 class="config-section-card__title">${m}</h3>
|
|
1594
1594
|
${S?r`<p class="config-section-card__desc">${S}</p>`:v}
|
|
@@ -1598,10 +1598,10 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1598
1598
|
${Ke({schema:d,value:$,path:[p,h],hints:e.uiHints,unsupported:s,disabled:e.disabled??!1,showLabel:!1,onPatch:e.onPatch})}
|
|
1599
1599
|
</div>
|
|
1600
1600
|
</section>
|
|
1601
|
-
`})():u.map(([p,h])=>{const d=
|
|
1601
|
+
`})():u.map(([p,h])=>{const d=Yi[p]??{label:p.charAt(0).toUpperCase()+p.slice(1),description:h.description??""};return r`
|
|
1602
1602
|
<section class="config-section-card" id="config-section-${p}">
|
|
1603
1603
|
<div class="config-section-card__header">
|
|
1604
|
-
<span class="config-section-card__icon">${
|
|
1604
|
+
<span class="config-section-card__icon">${bo(p)}</span>
|
|
1605
1605
|
<div class="config-section-card__titles">
|
|
1606
1606
|
<h3 class="config-section-card__title">${d.label}</h3>
|
|
1607
1607
|
${d.description?r`<p class="config-section-card__desc">${d.description}</p>`:v}
|
|
@@ -1613,29 +1613,29 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1613
1613
|
</section>
|
|
1614
1614
|
`})}
|
|
1615
1615
|
</div>
|
|
1616
|
-
`}const
|
|
1616
|
+
`}const Np=new Set(["title","description","default","nullable"]);function Op(e){return Object.keys(e??{}).filter(n=>!Np.has(n)).length===0}function bl(e){const t=e.filter(i=>i!=null),n=t.length!==e.length,s=[];for(const i of t)s.some(a=>Object.is(a,i))||s.push(i);return{enumValues:s,nullable:n}}function yl(e){return!e||typeof e!="object"?{schema:null,unsupportedPaths:["<root>"]}:Qt(e,[])}function Qt(e,t){const n=new Set,s={...e},i=Zn(t)||"<root>";if(e.anyOf||e.oneOf||e.allOf){const l=Bp(e,t);return l||{schema:e,unsupportedPaths:[i]}}const a=Array.isArray(e.type)&&e.type.includes("null"),o=we(e)??(e.properties||e.additionalProperties?"object":void 0);if(s.type=o??e.type,s.nullable=a||e.nullable,s.enum){const{enumValues:l,nullable:c}=bl(s.enum);s.enum=l,c&&(s.nullable=!0),l.length===0&&n.add(i)}if(o==="object"){const l=e.properties??{},c={};for(const[u,g]of Object.entries(l)){const p=Qt(g,[...t,u]);p.schema&&(c[u]=p.schema);for(const h of p.unsupportedPaths)n.add(h)}if(s.properties=c,e.additionalProperties===!0)n.add(i);else if(e.additionalProperties===!1)s.additionalProperties=!1;else if(e.additionalProperties&&typeof e.additionalProperties=="object"&&!Op(e.additionalProperties)){const u=Qt(e.additionalProperties,[...t,"*"]);s.additionalProperties=u.schema??e.additionalProperties,u.unsupportedPaths.length>0&&n.add(i)}}else if(o==="array"){const l=Array.isArray(e.items)?e.items[0]:e.items;if(!l)n.add(i);else{const c=Qt(l,[...t,"*"]);s.items=c.schema??l,c.unsupportedPaths.length>0&&n.add(i)}}else o!=="string"&&o!=="number"&&o!=="integer"&&o!=="boolean"&&!s.enum&&n.add(i);return{schema:s,unsupportedPaths:Array.from(n)}}function Bp(e,t){if(e.allOf)return null;const n=e.anyOf??e.oneOf;if(!n)return null;const s=[],i=[];let a=!1;for(const l of n){if(!l||typeof l!="object")return null;if(Array.isArray(l.enum)){const{enumValues:c,nullable:u}=bl(l.enum);s.push(...c),u&&(a=!0);continue}if("const"in l){if(l.const==null){a=!0;continue}s.push(l.const);continue}if(we(l)==="null"){a=!0;continue}i.push(l)}if(s.length>0&&i.length===0){const l=[];for(const c of s)l.some(u=>Object.is(u,c))||l.push(c);return{schema:{...e,enum:l,nullable:a,anyOf:void 0,oneOf:void 0,allOf:void 0},unsupportedPaths:[]}}if(i.length===1){const l=Qt(i[0],t);return l.schema&&(l.schema.nullable=a||l.schema.nullable),l}const o=new Set(["string","number","integer","boolean"]);return i.length>0&&s.length===0&&i.every(l=>l.type&&o.has(String(l.type)))?{schema:{...e,nullable:a},unsupportedPaths:[]}:null}function Up(e,t){let n=e;for(const s of t){if(!n)return null;const i=we(n);if(i==="object"){const a=n.properties??{};if(typeof s=="string"&&a[s]){n=a[s];continue}const o=n.additionalProperties;if(typeof s=="string"&&o&&typeof o=="object"){n=o;continue}return null}if(i==="array"){if(typeof s!="number")return null;n=(Array.isArray(n.items)?n.items[0]:n.items)??null;continue}return null}return n}function zp(e,t){const s=(e.channels??{})[t],i=e[t];return(s&&typeof s=="object"?s:null)??(i&&typeof i=="object"?i:null)??{}}const Hp=["groupPolicy","streamMode","dmPolicy"];function jp(e){if(e==null)return"n/a";if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return String(e);try{return JSON.stringify(e)}catch{return"n/a"}}function Kp(e){const t=Hp.flatMap(n=>n in e?[[n,e[n]]]:[]);return t.length===0?null:r`
|
|
1617
1617
|
<div class="status-list" style="margin-top: 12px;">
|
|
1618
1618
|
${t.map(([n,s])=>r`
|
|
1619
1619
|
<div>
|
|
1620
1620
|
<span class="label">${n}</span>
|
|
1621
|
-
<span>${
|
|
1621
|
+
<span>${jp(s)}</span>
|
|
1622
1622
|
</div>
|
|
1623
1623
|
`)}
|
|
1624
1624
|
</div>
|
|
1625
|
-
`}function
|
|
1625
|
+
`}function Wp(e){const t=yl(e.schema),n=t.schema;if(!n)return r`
|
|
1626
1626
|
<div class="callout danger">Schema unavailable. Use Raw.</div>
|
|
1627
|
-
`;const s=
|
|
1627
|
+
`;const s=Up(n,["channels",e.channelId]);if(!s)return r`
|
|
1628
1628
|
<div class="callout danger">Channel config schema unavailable.</div>
|
|
1629
|
-
`;const i=e.configValue??{},a=
|
|
1629
|
+
`;const i=e.configValue??{},a=zp(i,e.channelId);return r`
|
|
1630
1630
|
<div class="config-form">
|
|
1631
1631
|
${Ke({schema:s,value:a,path:["channels",e.channelId],hints:e.uiHints,unsupported:new Set(t.unsupportedPaths),disabled:e.disabled,showLabel:!1,onPatch:e.onPatch})}
|
|
1632
1632
|
</div>
|
|
1633
|
-
${
|
|
1633
|
+
${Kp(a)}
|
|
1634
1634
|
`}function qe(e){const{channelId:t,props:n}=e,s=n.configSaving||n.configSchemaLoading;return r`
|
|
1635
1635
|
<div style="margin-top: 16px;">
|
|
1636
1636
|
${n.configSchemaLoading?r`
|
|
1637
1637
|
<div class="muted">Loading config schema…</div>
|
|
1638
|
-
`:
|
|
1638
|
+
`:Wp({channelId:t,configValue:n.configForm,schema:n.configSchema,uiHints:n.configUiHints,disabled:s,onPatch:n.onConfigPatch})}
|
|
1639
1639
|
<div class="row" style="margin-top: 12px;">
|
|
1640
1640
|
<button
|
|
1641
1641
|
class="btn primary"
|
|
@@ -1653,7 +1653,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1653
1653
|
</button>
|
|
1654
1654
|
</div>
|
|
1655
1655
|
</div>
|
|
1656
|
-
`}function
|
|
1656
|
+
`}function qp(e){const{props:t,discord:n,accountCountLabel:s}=e;return r`
|
|
1657
1657
|
<div class="card">
|
|
1658
1658
|
<div class="card-title">Discord</div>
|
|
1659
1659
|
<div class="card-sub">Bot status and channel configuration.</div>
|
|
@@ -1695,7 +1695,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1695
1695
|
</button>
|
|
1696
1696
|
</div>
|
|
1697
1697
|
</div>
|
|
1698
|
-
`}function
|
|
1698
|
+
`}function Gp(e){const{props:t,googleChat:n,accountCountLabel:s}=e;return r`
|
|
1699
1699
|
<div class="card">
|
|
1700
1700
|
<div class="card-title">Google Chat</div>
|
|
1701
1701
|
<div class="card-sub">Chat API webhook status and channel configuration.</div>
|
|
@@ -1747,7 +1747,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1747
1747
|
</button>
|
|
1748
1748
|
</div>
|
|
1749
1749
|
</div>
|
|
1750
|
-
`}function
|
|
1750
|
+
`}function Vp(e){const{props:t,imessage:n,accountCountLabel:s}=e;return r`
|
|
1751
1751
|
<div class="card">
|
|
1752
1752
|
<div class="card-title">iMessage</div>
|
|
1753
1753
|
<div class="card-sub">macOS bridge status and channel configuration.</div>
|
|
@@ -1789,7 +1789,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1789
1789
|
</button>
|
|
1790
1790
|
</div>
|
|
1791
1791
|
</div>
|
|
1792
|
-
`}function
|
|
1792
|
+
`}function yo(e){return e?e.length<=20?e:`${e.slice(0,8)}...${e.slice(-8)}`:"n/a"}function Qp(e){const{props:t,nostr:n,nostrAccounts:s,accountCountLabel:i,profileFormState:a,profileFormCallbacks:o,onEditProfile:l}=e,c=s[0],u=n?.configured??c?.configured??!1,g=n?.running??c?.running??!1,p=n?.publicKey??c?.publicKey,h=n?.lastStartAt??c?.lastStartAt??null,d=n?.lastError??c?.lastError??null,f=s.length>1,m=a!=null,S=$=>{const A=$.publicKey,C=$.profile,_=C?.displayName??C?.name??$.name??$.accountId;return r`
|
|
1793
1793
|
<div class="account-card">
|
|
1794
1794
|
<div class="account-card-header">
|
|
1795
1795
|
<div class="account-card-title">${_}</div>
|
|
@@ -1806,7 +1806,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1806
1806
|
</div>
|
|
1807
1807
|
<div>
|
|
1808
1808
|
<span class="label">Public Key</span>
|
|
1809
|
-
<span class="monospace" title="${A??""}">${
|
|
1809
|
+
<span class="monospace" title="${A??""}">${yo(A)}</span>
|
|
1810
1810
|
</div>
|
|
1811
1811
|
<div>
|
|
1812
1812
|
<span class="label">Last inbound</span>
|
|
@@ -1817,7 +1817,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1817
1817
|
`:v}
|
|
1818
1818
|
</div>
|
|
1819
1819
|
</div>
|
|
1820
|
-
`},k=()=>{if(m&&o)return
|
|
1820
|
+
`},k=()=>{if(m&&o)return Oc({state:a,callbacks:o,accountId:s[0]?.accountId??"default"});const $=c?.profile??n?.profile,{name:A,displayName:C,about:_,picture:T,nip05:I}=$??{},z=A||C||_||T||I;return r`
|
|
1821
1821
|
<div style="margin-top: 16px; padding: 12px; background: var(--bg-secondary); border-radius: 8px;">
|
|
1822
1822
|
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px;">
|
|
1823
1823
|
<div style="font-weight: 500;">Profile</div>
|
|
@@ -1877,7 +1877,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1877
1877
|
<div>
|
|
1878
1878
|
<span class="label">Public Key</span>
|
|
1879
1879
|
<span class="monospace" title="${p??""}"
|
|
1880
|
-
>${
|
|
1880
|
+
>${yo(p)}</span
|
|
1881
1881
|
>
|
|
1882
1882
|
</div>
|
|
1883
1883
|
<div>
|
|
@@ -1897,7 +1897,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1897
1897
|
<button class="btn" @click=${()=>t.onRefresh(!1)}>Refresh</button>
|
|
1898
1898
|
</div>
|
|
1899
1899
|
</div>
|
|
1900
|
-
`}function
|
|
1900
|
+
`}function Yp(e,t){const n=t.snapshot,s=n?.channels;if(!n||!s)return!1;const i=s[e],a=typeof i?.configured=="boolean"&&i.configured,o=typeof i?.running=="boolean"&&i.running,l=typeof i?.connected=="boolean"&&i.connected,u=(n.channelAccounts?.[e]??[]).some(g=>g.configured||g.running||g.connected);return a||o||l||u}function Jp(e,t){return t?.[e]?.length??0}function xl(e,t){const n=Jp(e,t);return n<2?v:r`<div class="account-count">Accounts (${n})</div>`}function Zp(e){const{props:t,signal:n,accountCountLabel:s}=e;return r`
|
|
1901
1901
|
<div class="card">
|
|
1902
1902
|
<div class="card-title">Signal</div>
|
|
1903
1903
|
<div class="card-sub">signal-cli status and channel configuration.</div>
|
|
@@ -1943,7 +1943,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1943
1943
|
</button>
|
|
1944
1944
|
</div>
|
|
1945
1945
|
</div>
|
|
1946
|
-
`}function
|
|
1946
|
+
`}function Xp(e){const{props:t,slack:n,accountCountLabel:s}=e;return r`
|
|
1947
1947
|
<div class="card">
|
|
1948
1948
|
<div class="card-title">Slack</div>
|
|
1949
1949
|
<div class="card-sub">Socket mode status and channel configuration.</div>
|
|
@@ -1985,7 +1985,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1985
1985
|
</button>
|
|
1986
1986
|
</div>
|
|
1987
1987
|
</div>
|
|
1988
|
-
`}function
|
|
1988
|
+
`}function ef(e){const{props:t,telegram:n,telegramAccounts:s,accountCountLabel:i}=e,a=s.length>1,o=l=>{const u=l.probe?.bot?.username,g=l.name||l.accountId;return r`
|
|
1989
1989
|
<div class="account-card">
|
|
1990
1990
|
<div class="account-card-header">
|
|
1991
1991
|
<div class="account-card-title">
|
|
@@ -2065,7 +2065,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
2065
2065
|
</button>
|
|
2066
2066
|
</div>
|
|
2067
2067
|
</div>
|
|
2068
|
-
`}function
|
|
2068
|
+
`}function tf(e){const{props:t,whatsapp:n,accountCountLabel:s}=e;return r`
|
|
2069
2069
|
<div class="card">
|
|
2070
2070
|
<div class="card-title">WhatsApp</div>
|
|
2071
2071
|
<div class="card-sub">Link WhatsApp Web and monitor connection health.</div>
|
|
@@ -2103,7 +2103,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
2103
2103
|
<div>
|
|
2104
2104
|
<span class="label">Auth age</span>
|
|
2105
2105
|
<span>
|
|
2106
|
-
${n?.authAgeMs!=null?
|
|
2106
|
+
${n?.authAgeMs!=null?Pi(n.authAgeMs):"n/a"}
|
|
2107
2107
|
</span>
|
|
2108
2108
|
</div>
|
|
2109
2109
|
</div>
|
|
@@ -2156,9 +2156,9 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
2156
2156
|
|
|
2157
2157
|
${qe({channelId:"whatsapp",props:t})}
|
|
2158
2158
|
</div>
|
|
2159
|
-
`}function
|
|
2159
|
+
`}function nf(e){const t=e.snapshot?.channels,n=t?.whatsapp??void 0,s=t?.telegram??void 0,i=t?.discord??null,a=t?.googlechat??null,o=t?.slack??null,l=t?.signal??null,c=t?.imessage??null,u=t?.nostr??null,p=sf(e.snapshot).map((h,d)=>({key:h,enabled:Yp(h,e),order:d})).toSorted((h,d)=>h.enabled!==d.enabled?h.enabled?-1:1:h.order-d.order);return r`
|
|
2160
2160
|
<section class="grid grid-cols-2">
|
|
2161
|
-
${p.map(h=>
|
|
2161
|
+
${p.map(h=>af(h.key,e,{whatsapp:n,telegram:s,discord:i,googlechat:a,slack:o,signal:l,imessage:c,nostr:u,channelAccounts:e.snapshot?.channelAccounts??null}))}
|
|
2162
2162
|
</section>
|
|
2163
2163
|
|
|
2164
2164
|
<section class="card" style="margin-top: 18px;">
|
|
@@ -2176,7 +2176,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
2176
2176
|
${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
2177
2177
|
</pre>
|
|
2178
2178
|
</section>
|
|
2179
|
-
`}function
|
|
2179
|
+
`}function sf(e){return e?.channelMeta?.length?e.channelMeta.map(t=>t.id):e?.channelOrder?.length?e.channelOrder:["whatsapp","telegram","discord","googlechat","slack","signal","imessage","nostr"]}function af(e,t,n){const s=xl(e,n.channelAccounts);switch(e){case"whatsapp":return tf({props:t,whatsapp:n.whatsapp,accountCountLabel:s});case"telegram":return ef({props:t,telegram:n.telegram,telegramAccounts:n.channelAccounts?.telegram??[],accountCountLabel:s});case"discord":return qp({props:t,discord:n.discord,accountCountLabel:s});case"googlechat":return Gp({props:t,googleChat:n.googlechat,accountCountLabel:s});case"slack":return Xp({props:t,slack:n.slack,accountCountLabel:s});case"signal":return Zp({props:t,signal:n.signal,accountCountLabel:s});case"imessage":return Vp({props:t,imessage:n.imessage,accountCountLabel:s});case"nostr":{const i=n.channelAccounts?.nostr??[],a=i[0],o=a?.accountId??"default",l=a?.profile??null,c=t.nostrProfileAccountId===o?t.nostrProfileFormState:null,u=c?{onFieldChange:t.onNostrProfileFieldChange,onSave:t.onNostrProfileSave,onImport:t.onNostrProfileImport,onCancel:t.onNostrProfileCancel,onToggleAdvanced:t.onNostrProfileToggleAdvanced}:null;return Qp({props:t,nostr:n.nostr,nostrAccounts:i,accountCountLabel:s,profileFormState:c,profileFormCallbacks:u,onEditProfile:()=>t.onNostrProfileEdit(o,l)})}default:return of(e,t,n.channelAccounts??{})}}function of(e,t,n){const s=lf(t.snapshot,e),i=t.snapshot?.channels?.[e],a=typeof i?.configured=="boolean"?i.configured:void 0,o=typeof i?.running=="boolean"?i.running:void 0,l=typeof i?.connected=="boolean"?i.connected:void 0,c=typeof i?.lastError=="string"?i.lastError:void 0,u=n[e]??[],g=xl(e,n);return r`
|
|
2180
2180
|
<div class="card">
|
|
2181
2181
|
<div class="card-title">${s}</div>
|
|
2182
2182
|
<div class="card-sub">Channel status and configuration.</div>
|
|
@@ -2184,7 +2184,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2184
2184
|
|
|
2185
2185
|
${u.length>0?r`
|
|
2186
2186
|
<div class="account-card-list">
|
|
2187
|
-
${u.map(p=>
|
|
2187
|
+
${u.map(p=>gf(p))}
|
|
2188
2188
|
</div>
|
|
2189
2189
|
`:r`
|
|
2190
2190
|
<div class="status-list" style="margin-top: 16px;">
|
|
@@ -2209,7 +2209,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2209
2209
|
|
|
2210
2210
|
${qe({channelId:e,props:t})}
|
|
2211
2211
|
</div>
|
|
2212
|
-
`}function
|
|
2212
|
+
`}function rf(e){return e?.channelMeta?.length?Object.fromEntries(e.channelMeta.map(t=>[t.id,t])):{}}function lf(e,t){return rf(e)[t]?.label??e?.channelLabels?.[t]??t}const cf=600*1e3;function $l(e){return e.lastInboundAt?Date.now()-e.lastInboundAt<cf:!1}function df(e){return e.running?"Yes":$l(e)?"Active":"No"}function uf(e){return e.connected===!0?"Yes":e.connected===!1?"No":$l(e)?"Active":"n/a"}function gf(e){const t=df(e),n=uf(e);return r`
|
|
2213
2213
|
<div class="account-card">
|
|
2214
2214
|
<div class="account-card-header">
|
|
2215
2215
|
<div class="account-card-title">${e.name||e.accountId}</div>
|
|
@@ -2239,12 +2239,12 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2239
2239
|
`:v}
|
|
2240
2240
|
</div>
|
|
2241
2241
|
</div>
|
|
2242
|
-
`}const Yt=(e,t)=>{const n=e._$AN;if(n===void 0)return!1;for(const s of n)s._$AO?.(t,!1),Yt(s,t);return!0},zn=e=>{let t,n;do{if((t=e._$AM)===void 0)break;n=t._$AN,n.delete(e),e=t}while(n?.size===0)},ml=e=>{for(let t;t=e._$AM;e=t){let n=t._$AN;if(n===void 0)t._$AN=n=new Set;else if(n.has(e))break;n.add(e),of(t)}};function sf(e){this._$AN!==void 0?(zn(this),this._$AM=e,ml(this)):this._$AM=e}function af(e,t=!1,n=0){const s=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(t)if(Array.isArray(s))for(let a=n;a<s.length;a++)Yt(s[a],!1),zn(s[a]);else s!=null&&(Yt(s,!1),zn(s));else Yt(this,e)}const of=e=>{e.type==Wi.CHILD&&(e._$AP??=af,e._$AQ??=sf)};class rf extends Gi{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,n,s){super._$AT(t,n,s),ml(this),this.isConnected=t._$AU}_$AO(t,n=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),n&&(Yt(this,t),zn(this))}setValue(t){if(vg(this._$Ct))this._$Ct._$AI(t,this);else{const n=[...this._$Ct._$AH];n[this._$Ci]=t,this._$Ct._$AI(n,this,0)}}disconnected(){}reconnected(){}}const Ps=new WeakMap,lf=qi(class extends rf{render(e){return v}update(e,[t]){const n=t!==this.G;return n&&this.G!==void 0&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.G=t,this.ht=e.options?.host,this.rt(this.ct=e.element)),v}rt(e){if(this.isConnected||(e=void 0),typeof this.G=="function"){const t=this.ht??globalThis;let n=Ps.get(t);n===void 0&&(n=new WeakMap,Ps.set(t,n)),n.get(this.G)!==void 0&&this.G.call(this.ht,void 0),n.set(this.G,e),e!==void 0&&this.G.call(this.ht,e)}else this.G.value=e}get lt(){return typeof this.G=="function"?Ps.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});class ci extends Gi{constructor(t){if(super(t),this.it=v,t.type!==Wi.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===v||t==null)return this._t=void 0,this.it=t;if(t===Qe)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const n=[t];return n.raw=n,this._t={_$litType$:this.constructor.resultType,strings:n,values:[]}}}ci.directiveName="unsafeHTML",ci.resultType=1;const di=qi(ci);const{entries:bl,setPrototypeOf:mo,isFrozen:cf,getPrototypeOf:df,getOwnPropertyDescriptor:uf}=Object;let{freeze:ve,seal:Ae,create:ui}=Object,{apply:gi,construct:pi}=typeof Reflect<"u"&&Reflect;ve||(ve=function(t){return t});Ae||(Ae=function(t){return t});gi||(gi=function(t,n){for(var s=arguments.length,i=new Array(s>2?s-2:0),a=2;a<s;a++)i[a-2]=arguments[a];return t.apply(n,i)});pi||(pi=function(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return new t(...s)});const kn=me(Array.prototype.forEach),gf=me(Array.prototype.lastIndexOf),bo=me(Array.prototype.pop),Nt=me(Array.prototype.push),pf=me(Array.prototype.splice),Pn=me(String.prototype.toLowerCase),Ds=me(String.prototype.toString),Fs=me(String.prototype.match),Ot=me(String.prototype.replace),ff=me(String.prototype.indexOf),hf=me(String.prototype.trim),Ce=me(Object.prototype.hasOwnProperty),fe=me(RegExp.prototype.test),Bt=vf(TypeError);function me(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return gi(e,t,s)}}function vf(e){return function(){for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return pi(e,n)}}function K(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Pn;mo&&mo(e,null);let s=t.length;for(;s--;){let i=t[s];if(typeof i=="string"){const a=n(i);a!==i&&(cf(t)||(t[s]=a),i=a)}e[i]=!0}return e}function mf(e){for(let t=0;t<e.length;t++)Ce(e,t)||(e[t]=null);return e}function Re(e){const t=ui(null);for(const[n,s]of bl(e))Ce(e,n)&&(Array.isArray(s)?t[n]=mf(s):s&&typeof s=="object"&&s.constructor===Object?t[n]=Re(s):t[n]=s);return t}function Ut(e,t){for(;e!==null;){const s=uf(e,t);if(s){if(s.get)return me(s.get);if(typeof s.value=="function")return me(s.value)}e=df(e)}function n(){return null}return n}const yo=ve(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Ns=ve(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Os=ve(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),bf=ve(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Bs=ve(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),yf=ve(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),xo=ve(["#text"]),$o=ve(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Us=ve(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),wo=ve(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Sn=ve(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),xf=Ae(/\{\{[\w\W]*|[\w\W]*\}\}/gm),$f=Ae(/<%[\w\W]*|[\w\W]*%>/gm),wf=Ae(/\$\{[\w\W]*/gm),kf=Ae(/^data-[\-\w.\u00B7-\uFFFF]+$/),Sf=Ae(/^aria-[\-\w]+$/),yl=Ae(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Af=Ae(/^(?:\w+script|data):/i),Cf=Ae(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),xl=Ae(/^html$/i),Tf=Ae(/^[a-z][.\w]*(-[.\w]+)+$/i);var ko=Object.freeze({__proto__:null,ARIA_ATTR:Sf,ATTR_WHITESPACE:Cf,CUSTOM_ELEMENT:Tf,DATA_ATTR:kf,DOCTYPE_NAME:xl,ERB_EXPR:$f,IS_ALLOWED_URI:yl,IS_SCRIPT_OR_DATA:Af,MUSTACHE_EXPR:xf,TMPLIT_EXPR:wf});const zt={element:1,text:3,progressingInstruction:7,comment:8,document:9},_f=function(){return typeof window>"u"?null:window},Ef=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let s=null;const i="data-tt-policy-suffix";n&&n.hasAttribute(i)&&(s=n.getAttribute(i));const a="dompurify"+(s?"#"+s:"");try{return t.createPolicy(a,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+a+" could not be created."),null}},So=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function $l(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:_f();const t=U=>$l(U);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==zt.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const s=n,i=s.currentScript,{DocumentFragment:a,HTMLTemplateElement:o,Node:l,Element:c,NodeFilter:u,NamedNodeMap:g=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:p,DOMParser:h,trustedTypes:d}=e,f=c.prototype,m=Ut(f,"cloneNode"),S=Ut(f,"remove"),k=Ut(f,"nextSibling"),$=Ut(f,"childNodes"),A=Ut(f,"parentNode");if(typeof o=="function"){const U=n.createElement("template");U.content&&U.content.ownerDocument&&(n=U.content.ownerDocument)}let C,_="";const{implementation:T,createNodeIterator:I,createDocumentFragment:z,getElementsByTagName:Y}=n,{importNode:se}=s;let F=So();t.isSupported=typeof bl=="function"&&typeof A=="function"&&T&&T.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:H,ERB_EXPR:ce,TMPLIT_EXPR:E,DATA_ATTR:B,ARIA_ATTR:ie,IS_SCRIPT_OR_DATA:ae,ATTR_WHITESPACE:Z,CUSTOM_ELEMENT:te}=ko;let{IS_ALLOWED_URI:M}=ko,R=null;const P=K({},[...yo,...Ns,...Os,...Bs,...xo]);let j=null;const xe=K({},[...$o,...Us,...wo,...Sn]);let Q=Object.seal(ui(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),we=null,X=null;const pe=Object.seal(ui(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Fe=!0,Ne=!0,Xe=!1,da=!0,xt=!1,dn=!0,et=!1,us=!1,gs=!1,$t=!1,un=!1,gn=!1,ua=!0,ga=!1;const Hl="user-content-";let ps=!0,Rt=!1,wt={},Le=null;const fs=K({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let pa=null;const fa=K({},["audio","video","img","source","image","track"]);let hs=null;const ha=K({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),pn="http://www.w3.org/1998/Math/MathML",fn="http://www.w3.org/2000/svg",Oe="http://www.w3.org/1999/xhtml";let kt=Oe,vs=!1,ms=null;const jl=K({},[pn,fn,Oe],Ds);let hn=K({},["mi","mo","mn","ms","mtext"]),vn=K({},["annotation-xml"]);const Kl=K({},["title","style","font","a","script"]);let Pt=null;const Wl=["application/xhtml+xml","text/html"],ql="text/html";let ne=null,St=null;const Gl=n.createElement("form"),va=function(b){return b instanceof RegExp||b instanceof Function},bs=function(){let b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(St&&St===b)){if((!b||typeof b!="object")&&(b={}),b=Re(b),Pt=Wl.indexOf(b.PARSER_MEDIA_TYPE)===-1?ql:b.PARSER_MEDIA_TYPE,ne=Pt==="application/xhtml+xml"?Ds:Pn,R=Ce(b,"ALLOWED_TAGS")?K({},b.ALLOWED_TAGS,ne):P,j=Ce(b,"ALLOWED_ATTR")?K({},b.ALLOWED_ATTR,ne):xe,ms=Ce(b,"ALLOWED_NAMESPACES")?K({},b.ALLOWED_NAMESPACES,Ds):jl,hs=Ce(b,"ADD_URI_SAFE_ATTR")?K(Re(ha),b.ADD_URI_SAFE_ATTR,ne):ha,pa=Ce(b,"ADD_DATA_URI_TAGS")?K(Re(fa),b.ADD_DATA_URI_TAGS,ne):fa,Le=Ce(b,"FORBID_CONTENTS")?K({},b.FORBID_CONTENTS,ne):fs,we=Ce(b,"FORBID_TAGS")?K({},b.FORBID_TAGS,ne):Re({}),X=Ce(b,"FORBID_ATTR")?K({},b.FORBID_ATTR,ne):Re({}),wt=Ce(b,"USE_PROFILES")?b.USE_PROFILES:!1,Fe=b.ALLOW_ARIA_ATTR!==!1,Ne=b.ALLOW_DATA_ATTR!==!1,Xe=b.ALLOW_UNKNOWN_PROTOCOLS||!1,da=b.ALLOW_SELF_CLOSE_IN_ATTR!==!1,xt=b.SAFE_FOR_TEMPLATES||!1,dn=b.SAFE_FOR_XML!==!1,et=b.WHOLE_DOCUMENT||!1,$t=b.RETURN_DOM||!1,un=b.RETURN_DOM_FRAGMENT||!1,gn=b.RETURN_TRUSTED_TYPE||!1,gs=b.FORCE_BODY||!1,ua=b.SANITIZE_DOM!==!1,ga=b.SANITIZE_NAMED_PROPS||!1,ps=b.KEEP_CONTENT!==!1,Rt=b.IN_PLACE||!1,M=b.ALLOWED_URI_REGEXP||yl,kt=b.NAMESPACE||Oe,hn=b.MATHML_TEXT_INTEGRATION_POINTS||hn,vn=b.HTML_INTEGRATION_POINTS||vn,Q=b.CUSTOM_ELEMENT_HANDLING||{},b.CUSTOM_ELEMENT_HANDLING&&va(b.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Q.tagNameCheck=b.CUSTOM_ELEMENT_HANDLING.tagNameCheck),b.CUSTOM_ELEMENT_HANDLING&&va(b.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Q.attributeNameCheck=b.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),b.CUSTOM_ELEMENT_HANDLING&&typeof b.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Q.allowCustomizedBuiltInElements=b.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),xt&&(Ne=!1),un&&($t=!0),wt&&(R=K({},xo),j=[],wt.html===!0&&(K(R,yo),K(j,$o)),wt.svg===!0&&(K(R,Ns),K(j,Us),K(j,Sn)),wt.svgFilters===!0&&(K(R,Os),K(j,Us),K(j,Sn)),wt.mathMl===!0&&(K(R,Bs),K(j,wo),K(j,Sn))),b.ADD_TAGS&&(typeof b.ADD_TAGS=="function"?pe.tagCheck=b.ADD_TAGS:(R===P&&(R=Re(R)),K(R,b.ADD_TAGS,ne))),b.ADD_ATTR&&(typeof b.ADD_ATTR=="function"?pe.attributeCheck=b.ADD_ATTR:(j===xe&&(j=Re(j)),K(j,b.ADD_ATTR,ne))),b.ADD_URI_SAFE_ATTR&&K(hs,b.ADD_URI_SAFE_ATTR,ne),b.FORBID_CONTENTS&&(Le===fs&&(Le=Re(Le)),K(Le,b.FORBID_CONTENTS,ne)),b.ADD_FORBID_CONTENTS&&(Le===fs&&(Le=Re(Le)),K(Le,b.ADD_FORBID_CONTENTS,ne)),ps&&(R["#text"]=!0),et&&K(R,["html","head","body"]),R.table&&(K(R,["tbody"]),delete we.tbody),b.TRUSTED_TYPES_POLICY){if(typeof b.TRUSTED_TYPES_POLICY.createHTML!="function")throw Bt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof b.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Bt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');C=b.TRUSTED_TYPES_POLICY,_=C.createHTML("")}else C===void 0&&(C=Ef(d,i)),C!==null&&typeof _=="string"&&(_=C.createHTML(""));ve&&ve(b),St=b}},ma=K({},[...Ns,...Os,...bf]),ba=K({},[...Bs,...yf]),Vl=function(b){let L=A(b);(!L||!L.tagName)&&(L={namespaceURI:kt,tagName:"template"});const N=Pn(b.tagName),J=Pn(L.tagName);return ms[b.namespaceURI]?b.namespaceURI===fn?L.namespaceURI===Oe?N==="svg":L.namespaceURI===pn?N==="svg"&&(J==="annotation-xml"||hn[J]):!!ma[N]:b.namespaceURI===pn?L.namespaceURI===Oe?N==="math":L.namespaceURI===fn?N==="math"&&vn[J]:!!ba[N]:b.namespaceURI===Oe?L.namespaceURI===fn&&!vn[J]||L.namespaceURI===pn&&!hn[J]?!1:!ba[N]&&(Kl[N]||!ma[N]):!!(Pt==="application/xhtml+xml"&&ms[b.namespaceURI]):!1},Me=function(b){Nt(t.removed,{element:b});try{A(b).removeChild(b)}catch{S(b)}},tt=function(b,L){try{Nt(t.removed,{attribute:L.getAttributeNode(b),from:L})}catch{Nt(t.removed,{attribute:null,from:L})}if(L.removeAttribute(b),b==="is")if($t||un)try{Me(L)}catch{}else try{L.setAttribute(b,"")}catch{}},ya=function(b){let L=null,N=null;if(gs)b="<remove></remove>"+b;else{const ee=Fs(b,/^[\r\n\t ]+/);N=ee&&ee[0]}Pt==="application/xhtml+xml"&&kt===Oe&&(b='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+b+"</body></html>");const J=C?C.createHTML(b):b;if(kt===Oe)try{L=new h().parseFromString(J,Pt)}catch{}if(!L||!L.documentElement){L=T.createDocument(kt,"template",null);try{L.documentElement.innerHTML=vs?_:J}catch{}}const de=L.body||L.documentElement;return b&&N&&de.insertBefore(n.createTextNode(N),de.childNodes[0]||null),kt===Oe?Y.call(L,et?"html":"body")[0]:et?L.documentElement:de},xa=function(b){return I.call(b.ownerDocument||b,b,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},ys=function(b){return b instanceof p&&(typeof b.nodeName!="string"||typeof b.textContent!="string"||typeof b.removeChild!="function"||!(b.attributes instanceof g)||typeof b.removeAttribute!="function"||typeof b.setAttribute!="function"||typeof b.namespaceURI!="string"||typeof b.insertBefore!="function"||typeof b.hasChildNodes!="function")},$a=function(b){return typeof l=="function"&&b instanceof l};function Be(U,b,L){kn(U,N=>{N.call(t,b,L,St)})}const wa=function(b){let L=null;if(Be(F.beforeSanitizeElements,b,null),ys(b))return Me(b),!0;const N=ne(b.nodeName);if(Be(F.uponSanitizeElement,b,{tagName:N,allowedTags:R}),dn&&b.hasChildNodes()&&!$a(b.firstElementChild)&&fe(/<[/\w!]/g,b.innerHTML)&&fe(/<[/\w!]/g,b.textContent)||b.nodeType===zt.progressingInstruction||dn&&b.nodeType===zt.comment&&fe(/<[/\w]/g,b.data))return Me(b),!0;if(!(pe.tagCheck instanceof Function&&pe.tagCheck(N))&&(!R[N]||we[N])){if(!we[N]&&Sa(N)&&(Q.tagNameCheck instanceof RegExp&&fe(Q.tagNameCheck,N)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(N)))return!1;if(ps&&!Le[N]){const J=A(b)||b.parentNode,de=$(b)||b.childNodes;if(de&&J){const ee=de.length;for(let be=ee-1;be>=0;--be){const Ue=m(de[be],!0);Ue.__removalCount=(b.__removalCount||0)+1,J.insertBefore(Ue,k(b))}}}return Me(b),!0}return b instanceof c&&!Vl(b)||(N==="noscript"||N==="noembed"||N==="noframes")&&fe(/<\/no(script|embed|frames)/i,b.innerHTML)?(Me(b),!0):(xt&&b.nodeType===zt.text&&(L=b.textContent,kn([H,ce,E],J=>{L=Ot(L,J," ")}),b.textContent!==L&&(Nt(t.removed,{element:b.cloneNode()}),b.textContent=L)),Be(F.afterSanitizeElements,b,null),!1)},ka=function(b,L,N){if(ua&&(L==="id"||L==="name")&&(N in n||N in Gl))return!1;if(!(Ne&&!X[L]&&fe(B,L))){if(!(Fe&&fe(ie,L))){if(!(pe.attributeCheck instanceof Function&&pe.attributeCheck(L,b))){if(!j[L]||X[L]){if(!(Sa(b)&&(Q.tagNameCheck instanceof RegExp&&fe(Q.tagNameCheck,b)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(b))&&(Q.attributeNameCheck instanceof RegExp&&fe(Q.attributeNameCheck,L)||Q.attributeNameCheck instanceof Function&&Q.attributeNameCheck(L,b))||L==="is"&&Q.allowCustomizedBuiltInElements&&(Q.tagNameCheck instanceof RegExp&&fe(Q.tagNameCheck,N)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(N))))return!1}else if(!hs[L]){if(!fe(M,Ot(N,Z,""))){if(!((L==="src"||L==="xlink:href"||L==="href")&&b!=="script"&&ff(N,"data:")===0&&pa[b])){if(!(Xe&&!fe(ae,Ot(N,Z,"")))){if(N)return!1}}}}}}}return!0},Sa=function(b){return b!=="annotation-xml"&&Fs(b,te)},Aa=function(b){Be(F.beforeSanitizeAttributes,b,null);const{attributes:L}=b;if(!L||ys(b))return;const N={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:j,forceKeepAttr:void 0};let J=L.length;for(;J--;){const de=L[J],{name:ee,namespaceURI:be,value:Ue}=de,At=ne(ee),xs=Ue;let re=ee==="value"?xs:hf(xs);if(N.attrName=At,N.attrValue=re,N.keepAttr=!0,N.forceKeepAttr=void 0,Be(F.uponSanitizeAttribute,b,N),re=N.attrValue,ga&&(At==="id"||At==="name")&&(tt(ee,b),re=Hl+re),dn&&fe(/((--!?|])>)|<\/(style|title|textarea)/i,re)){tt(ee,b);continue}if(At==="attributename"&&Fs(re,"href")){tt(ee,b);continue}if(N.forceKeepAttr)continue;if(!N.keepAttr){tt(ee,b);continue}if(!da&&fe(/\/>/i,re)){tt(ee,b);continue}xt&&kn([H,ce,E],Ta=>{re=Ot(re,Ta," ")});const Ca=ne(b.nodeName);if(!ka(Ca,At,re)){tt(ee,b);continue}if(C&&typeof d=="object"&&typeof d.getAttributeType=="function"&&!be)switch(d.getAttributeType(Ca,At)){case"TrustedHTML":{re=C.createHTML(re);break}case"TrustedScriptURL":{re=C.createScriptURL(re);break}}if(re!==xs)try{be?b.setAttributeNS(be,ee,re):b.setAttribute(ee,re),ys(b)?Me(b):bo(t.removed)}catch{tt(ee,b)}}Be(F.afterSanitizeAttributes,b,null)},Ql=function U(b){let L=null;const N=xa(b);for(Be(F.beforeSanitizeShadowDOM,b,null);L=N.nextNode();)Be(F.uponSanitizeShadowNode,L,null),wa(L),Aa(L),L.content instanceof a&&U(L.content);Be(F.afterSanitizeShadowDOM,b,null)};return t.sanitize=function(U){let b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},L=null,N=null,J=null,de=null;if(vs=!U,vs&&(U="<!-->"),typeof U!="string"&&!$a(U))if(typeof U.toString=="function"){if(U=U.toString(),typeof U!="string")throw Bt("dirty is not a string, aborting")}else throw Bt("toString is not a function");if(!t.isSupported)return U;if(us||bs(b),t.removed=[],typeof U=="string"&&(Rt=!1),Rt){if(U.nodeName){const Ue=ne(U.nodeName);if(!R[Ue]||we[Ue])throw Bt("root node is forbidden and cannot be sanitized in-place")}}else if(U instanceof l)L=ya("<!---->"),N=L.ownerDocument.importNode(U,!0),N.nodeType===zt.element&&N.nodeName==="BODY"||N.nodeName==="HTML"?L=N:L.appendChild(N);else{if(!$t&&!xt&&!et&&U.indexOf("<")===-1)return C&&gn?C.createHTML(U):U;if(L=ya(U),!L)return $t?null:gn?_:""}L&&gs&&Me(L.firstChild);const ee=xa(Rt?U:L);for(;J=ee.nextNode();)wa(J),Aa(J),J.content instanceof a&&Ql(J.content);if(Rt)return U;if($t){if(un)for(de=z.call(L.ownerDocument);L.firstChild;)de.appendChild(L.firstChild);else de=L;return(j.shadowroot||j.shadowrootmode)&&(de=se.call(s,de,!0)),de}let be=et?L.outerHTML:L.innerHTML;return et&&R["!doctype"]&&L.ownerDocument&&L.ownerDocument.doctype&&L.ownerDocument.doctype.name&&fe(xl,L.ownerDocument.doctype.name)&&(be="<!DOCTYPE "+L.ownerDocument.doctype.name+`>
|
|
2243
|
-
`+be)
|
|
2244
|
-
]`).replace("lheading",
|
|
2242
|
+
`}const Yt=(e,t)=>{const n=e._$AN;if(n===void 0)return!1;for(const s of n)s._$AO?.(t,!1),Yt(s,t);return!0},Hn=e=>{let t,n;do{if((t=e._$AM)===void 0)break;n=t._$AN,n.delete(e),e=t}while(n?.size===0)},wl=e=>{for(let t;t=e._$AM;e=t){let n=t._$AN;if(n===void 0)t._$AN=n=new Set;else if(n.has(e))break;n.add(e),hf(t)}};function pf(e){this._$AN!==void 0?(Hn(this),this._$AM=e,wl(this)):this._$AM=e}function ff(e,t=!1,n=0){const s=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(t)if(Array.isArray(s))for(let a=n;a<s.length;a++)Yt(s[a],!1),Hn(s[a]);else s!=null&&(Yt(s,!1),Hn(s));else Yt(this,e)}const hf=e=>{e.type==qi.CHILD&&(e._$AP??=ff,e._$AQ??=pf)};class vf extends Vi{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,n,s){super._$AT(t,n,s),wl(this),this.isConnected=t._$AU}_$AO(t,n=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),n&&(Yt(this,t),Hn(this))}setValue(t){if(Cg(this._$Ct))this._$Ct._$AI(t,this);else{const n=[...this._$Ct._$AH];n[this._$Ci]=t,this._$Ct._$AI(n,this,0)}}disconnected(){}reconnected(){}}const Ds=new WeakMap,mf=Gi(class extends vf{render(e){return v}update(e,[t]){const n=t!==this.G;return n&&this.G!==void 0&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.G=t,this.ht=e.options?.host,this.rt(this.ct=e.element)),v}rt(e){if(this.isConnected||(e=void 0),typeof this.G=="function"){const t=this.ht??globalThis;let n=Ds.get(t);n===void 0&&(n=new WeakMap,Ds.set(t,n)),n.get(this.G)!==void 0&&this.G.call(this.ht,void 0),n.set(this.G,e),e!==void 0&&this.G.call(this.ht,e)}else this.G.value=e}get lt(){return typeof this.G=="function"?Ds.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});class di extends Vi{constructor(t){if(super(t),this.it=v,t.type!==qi.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===v||t==null)return this._t=void 0,this.it=t;if(t===Ye)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const n=[t];return n.raw=n,this._t={_$litType$:this.constructor.resultType,strings:n,values:[]}}}di.directiveName="unsafeHTML",di.resultType=1;const ui=Gi(di);const{entries:kl,setPrototypeOf:xo,isFrozen:bf,getPrototypeOf:yf,getOwnPropertyDescriptor:xf}=Object;let{freeze:ve,seal:Ce,create:gi}=Object,{apply:pi,construct:fi}=typeof Reflect<"u"&&Reflect;ve||(ve=function(t){return t});Ce||(Ce=function(t){return t});pi||(pi=function(t,n){for(var s=arguments.length,i=new Array(s>2?s-2:0),a=2;a<s;a++)i[a-2]=arguments[a];return t.apply(n,i)});fi||(fi=function(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return new t(...s)});const Sn=me(Array.prototype.forEach),$f=me(Array.prototype.lastIndexOf),$o=me(Array.prototype.pop),Nt=me(Array.prototype.push),wf=me(Array.prototype.splice),Dn=me(String.prototype.toLowerCase),Fs=me(String.prototype.toString),Ns=me(String.prototype.match),Ot=me(String.prototype.replace),kf=me(String.prototype.indexOf),Sf=me(String.prototype.trim),Te=me(Object.prototype.hasOwnProperty),fe=me(RegExp.prototype.test),Bt=Af(TypeError);function me(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return pi(e,t,s)}}function Af(e){return function(){for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return fi(e,n)}}function K(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Dn;xo&&xo(e,null);let s=t.length;for(;s--;){let i=t[s];if(typeof i=="string"){const a=n(i);a!==i&&(bf(t)||(t[s]=a),i=a)}e[i]=!0}return e}function Cf(e){for(let t=0;t<e.length;t++)Te(e,t)||(e[t]=null);return e}function Pe(e){const t=gi(null);for(const[n,s]of kl(e))Te(e,n)&&(Array.isArray(s)?t[n]=Cf(s):s&&typeof s=="object"&&s.constructor===Object?t[n]=Pe(s):t[n]=s);return t}function Ut(e,t){for(;e!==null;){const s=xf(e,t);if(s){if(s.get)return me(s.get);if(typeof s.value=="function")return me(s.value)}e=yf(e)}function n(){return null}return n}const wo=ve(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Os=ve(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Bs=ve(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Tf=ve(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Us=ve(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),_f=ve(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ko=ve(["#text"]),So=ve(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),zs=ve(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Ao=ve(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),An=ve(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Ef=Ce(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Lf=Ce(/<%[\w\W]*|[\w\W]*%>/gm),Mf=Ce(/\$\{[\w\W]*/gm),If=Ce(/^data-[\-\w.\u00B7-\uFFFF]+$/),Rf=Ce(/^aria-[\-\w]+$/),Sl=Ce(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Pf=Ce(/^(?:\w+script|data):/i),Df=Ce(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Al=Ce(/^html$/i),Ff=Ce(/^[a-z][.\w]*(-[.\w]+)+$/i);var Co=Object.freeze({__proto__:null,ARIA_ATTR:Rf,ATTR_WHITESPACE:Df,CUSTOM_ELEMENT:Ff,DATA_ATTR:If,DOCTYPE_NAME:Al,ERB_EXPR:Lf,IS_ALLOWED_URI:Sl,IS_SCRIPT_OR_DATA:Pf,MUSTACHE_EXPR:Ef,TMPLIT_EXPR:Mf});const zt={element:1,text:3,progressingInstruction:7,comment:8,document:9},Nf=function(){return typeof window>"u"?null:window},Of=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let s=null;const i="data-tt-policy-suffix";n&&n.hasAttribute(i)&&(s=n.getAttribute(i));const a="dompurify"+(s?"#"+s:"");try{return t.createPolicy(a,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+a+" could not be created."),null}},To=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Cl(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Nf();const t=U=>Cl(U);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==zt.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const s=n,i=s.currentScript,{DocumentFragment:a,HTMLTemplateElement:o,Node:l,Element:c,NodeFilter:u,NamedNodeMap:g=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:p,DOMParser:h,trustedTypes:d}=e,f=c.prototype,m=Ut(f,"cloneNode"),S=Ut(f,"remove"),k=Ut(f,"nextSibling"),$=Ut(f,"childNodes"),A=Ut(f,"parentNode");if(typeof o=="function"){const U=n.createElement("template");U.content&&U.content.ownerDocument&&(n=U.content.ownerDocument)}let C,_="";const{implementation:T,createNodeIterator:I,createDocumentFragment:z,getElementsByTagName:Y}=n,{importNode:se}=s;let F=To();t.isSupported=typeof kl=="function"&&typeof A=="function"&&T&&T.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:H,ERB_EXPR:ce,TMPLIT_EXPR:E,DATA_ATTR:B,ARIA_ATTR:ie,IS_SCRIPT_OR_DATA:ae,ATTR_WHITESPACE:Z,CUSTOM_ELEMENT:te}=Co;let{IS_ALLOWED_URI:M}=Co,R=null;const P=K({},[...wo,...Os,...Bs,...Us,...ko]);let j=null;const xe=K({},[...So,...zs,...Ao,...An]);let Q=Object.seal(gi(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ke=null,X=null;const pe=Object.seal(gi(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Fe=!0,Ne=!0,et=!1,ua=!0,$t=!1,un=!0,tt=!1,gs=!1,ps=!1,wt=!1,gn=!1,pn=!1,ga=!0,pa=!1;const Ql="user-content-";let fs=!0,Rt=!1,kt={},Me=null;const hs=K({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let fa=null;const ha=K({},["audio","video","img","source","image","track"]);let vs=null;const va=K({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),fn="http://www.w3.org/1998/Math/MathML",hn="http://www.w3.org/2000/svg",Oe="http://www.w3.org/1999/xhtml";let St=Oe,ms=!1,bs=null;const Yl=K({},[fn,hn,Oe],Fs);let vn=K({},["mi","mo","mn","ms","mtext"]),mn=K({},["annotation-xml"]);const Jl=K({},["title","style","font","a","script"]);let Pt=null;const Zl=["application/xhtml+xml","text/html"],Xl="text/html";let ne=null,At=null;const ec=n.createElement("form"),ma=function(b){return b instanceof RegExp||b instanceof Function},ys=function(){let b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(At&&At===b)){if((!b||typeof b!="object")&&(b={}),b=Pe(b),Pt=Zl.indexOf(b.PARSER_MEDIA_TYPE)===-1?Xl:b.PARSER_MEDIA_TYPE,ne=Pt==="application/xhtml+xml"?Fs:Dn,R=Te(b,"ALLOWED_TAGS")?K({},b.ALLOWED_TAGS,ne):P,j=Te(b,"ALLOWED_ATTR")?K({},b.ALLOWED_ATTR,ne):xe,bs=Te(b,"ALLOWED_NAMESPACES")?K({},b.ALLOWED_NAMESPACES,Fs):Yl,vs=Te(b,"ADD_URI_SAFE_ATTR")?K(Pe(va),b.ADD_URI_SAFE_ATTR,ne):va,fa=Te(b,"ADD_DATA_URI_TAGS")?K(Pe(ha),b.ADD_DATA_URI_TAGS,ne):ha,Me=Te(b,"FORBID_CONTENTS")?K({},b.FORBID_CONTENTS,ne):hs,ke=Te(b,"FORBID_TAGS")?K({},b.FORBID_TAGS,ne):Pe({}),X=Te(b,"FORBID_ATTR")?K({},b.FORBID_ATTR,ne):Pe({}),kt=Te(b,"USE_PROFILES")?b.USE_PROFILES:!1,Fe=b.ALLOW_ARIA_ATTR!==!1,Ne=b.ALLOW_DATA_ATTR!==!1,et=b.ALLOW_UNKNOWN_PROTOCOLS||!1,ua=b.ALLOW_SELF_CLOSE_IN_ATTR!==!1,$t=b.SAFE_FOR_TEMPLATES||!1,un=b.SAFE_FOR_XML!==!1,tt=b.WHOLE_DOCUMENT||!1,wt=b.RETURN_DOM||!1,gn=b.RETURN_DOM_FRAGMENT||!1,pn=b.RETURN_TRUSTED_TYPE||!1,ps=b.FORCE_BODY||!1,ga=b.SANITIZE_DOM!==!1,pa=b.SANITIZE_NAMED_PROPS||!1,fs=b.KEEP_CONTENT!==!1,Rt=b.IN_PLACE||!1,M=b.ALLOWED_URI_REGEXP||Sl,St=b.NAMESPACE||Oe,vn=b.MATHML_TEXT_INTEGRATION_POINTS||vn,mn=b.HTML_INTEGRATION_POINTS||mn,Q=b.CUSTOM_ELEMENT_HANDLING||{},b.CUSTOM_ELEMENT_HANDLING&&ma(b.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Q.tagNameCheck=b.CUSTOM_ELEMENT_HANDLING.tagNameCheck),b.CUSTOM_ELEMENT_HANDLING&&ma(b.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Q.attributeNameCheck=b.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),b.CUSTOM_ELEMENT_HANDLING&&typeof b.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Q.allowCustomizedBuiltInElements=b.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),$t&&(Ne=!1),gn&&(wt=!0),kt&&(R=K({},ko),j=[],kt.html===!0&&(K(R,wo),K(j,So)),kt.svg===!0&&(K(R,Os),K(j,zs),K(j,An)),kt.svgFilters===!0&&(K(R,Bs),K(j,zs),K(j,An)),kt.mathMl===!0&&(K(R,Us),K(j,Ao),K(j,An))),b.ADD_TAGS&&(typeof b.ADD_TAGS=="function"?pe.tagCheck=b.ADD_TAGS:(R===P&&(R=Pe(R)),K(R,b.ADD_TAGS,ne))),b.ADD_ATTR&&(typeof b.ADD_ATTR=="function"?pe.attributeCheck=b.ADD_ATTR:(j===xe&&(j=Pe(j)),K(j,b.ADD_ATTR,ne))),b.ADD_URI_SAFE_ATTR&&K(vs,b.ADD_URI_SAFE_ATTR,ne),b.FORBID_CONTENTS&&(Me===hs&&(Me=Pe(Me)),K(Me,b.FORBID_CONTENTS,ne)),b.ADD_FORBID_CONTENTS&&(Me===hs&&(Me=Pe(Me)),K(Me,b.ADD_FORBID_CONTENTS,ne)),fs&&(R["#text"]=!0),tt&&K(R,["html","head","body"]),R.table&&(K(R,["tbody"]),delete ke.tbody),b.TRUSTED_TYPES_POLICY){if(typeof b.TRUSTED_TYPES_POLICY.createHTML!="function")throw Bt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof b.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Bt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');C=b.TRUSTED_TYPES_POLICY,_=C.createHTML("")}else C===void 0&&(C=Of(d,i)),C!==null&&typeof _=="string"&&(_=C.createHTML(""));ve&&ve(b),At=b}},ba=K({},[...Os,...Bs,...Tf]),ya=K({},[...Us,..._f]),tc=function(b){let L=A(b);(!L||!L.tagName)&&(L={namespaceURI:St,tagName:"template"});const N=Dn(b.tagName),J=Dn(L.tagName);return bs[b.namespaceURI]?b.namespaceURI===hn?L.namespaceURI===Oe?N==="svg":L.namespaceURI===fn?N==="svg"&&(J==="annotation-xml"||vn[J]):!!ba[N]:b.namespaceURI===fn?L.namespaceURI===Oe?N==="math":L.namespaceURI===hn?N==="math"&&mn[J]:!!ya[N]:b.namespaceURI===Oe?L.namespaceURI===hn&&!mn[J]||L.namespaceURI===fn&&!vn[J]?!1:!ya[N]&&(Jl[N]||!ba[N]):!!(Pt==="application/xhtml+xml"&&bs[b.namespaceURI]):!1},Ie=function(b){Nt(t.removed,{element:b});try{A(b).removeChild(b)}catch{S(b)}},nt=function(b,L){try{Nt(t.removed,{attribute:L.getAttributeNode(b),from:L})}catch{Nt(t.removed,{attribute:null,from:L})}if(L.removeAttribute(b),b==="is")if(wt||gn)try{Ie(L)}catch{}else try{L.setAttribute(b,"")}catch{}},xa=function(b){let L=null,N=null;if(ps)b="<remove></remove>"+b;else{const ee=Ns(b,/^[\r\n\t ]+/);N=ee&&ee[0]}Pt==="application/xhtml+xml"&&St===Oe&&(b='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+b+"</body></html>");const J=C?C.createHTML(b):b;if(St===Oe)try{L=new h().parseFromString(J,Pt)}catch{}if(!L||!L.documentElement){L=T.createDocument(St,"template",null);try{L.documentElement.innerHTML=ms?_:J}catch{}}const de=L.body||L.documentElement;return b&&N&&de.insertBefore(n.createTextNode(N),de.childNodes[0]||null),St===Oe?Y.call(L,tt?"html":"body")[0]:tt?L.documentElement:de},$a=function(b){return I.call(b.ownerDocument||b,b,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},xs=function(b){return b instanceof p&&(typeof b.nodeName!="string"||typeof b.textContent!="string"||typeof b.removeChild!="function"||!(b.attributes instanceof g)||typeof b.removeAttribute!="function"||typeof b.setAttribute!="function"||typeof b.namespaceURI!="string"||typeof b.insertBefore!="function"||typeof b.hasChildNodes!="function")},wa=function(b){return typeof l=="function"&&b instanceof l};function Be(U,b,L){Sn(U,N=>{N.call(t,b,L,At)})}const ka=function(b){let L=null;if(Be(F.beforeSanitizeElements,b,null),xs(b))return Ie(b),!0;const N=ne(b.nodeName);if(Be(F.uponSanitizeElement,b,{tagName:N,allowedTags:R}),un&&b.hasChildNodes()&&!wa(b.firstElementChild)&&fe(/<[/\w!]/g,b.innerHTML)&&fe(/<[/\w!]/g,b.textContent)||b.nodeType===zt.progressingInstruction||un&&b.nodeType===zt.comment&&fe(/<[/\w]/g,b.data))return Ie(b),!0;if(!(pe.tagCheck instanceof Function&&pe.tagCheck(N))&&(!R[N]||ke[N])){if(!ke[N]&&Aa(N)&&(Q.tagNameCheck instanceof RegExp&&fe(Q.tagNameCheck,N)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(N)))return!1;if(fs&&!Me[N]){const J=A(b)||b.parentNode,de=$(b)||b.childNodes;if(de&&J){const ee=de.length;for(let be=ee-1;be>=0;--be){const Ue=m(de[be],!0);Ue.__removalCount=(b.__removalCount||0)+1,J.insertBefore(Ue,k(b))}}}return Ie(b),!0}return b instanceof c&&!tc(b)||(N==="noscript"||N==="noembed"||N==="noframes")&&fe(/<\/no(script|embed|frames)/i,b.innerHTML)?(Ie(b),!0):($t&&b.nodeType===zt.text&&(L=b.textContent,Sn([H,ce,E],J=>{L=Ot(L,J," ")}),b.textContent!==L&&(Nt(t.removed,{element:b.cloneNode()}),b.textContent=L)),Be(F.afterSanitizeElements,b,null),!1)},Sa=function(b,L,N){if(ga&&(L==="id"||L==="name")&&(N in n||N in ec))return!1;if(!(Ne&&!X[L]&&fe(B,L))){if(!(Fe&&fe(ie,L))){if(!(pe.attributeCheck instanceof Function&&pe.attributeCheck(L,b))){if(!j[L]||X[L]){if(!(Aa(b)&&(Q.tagNameCheck instanceof RegExp&&fe(Q.tagNameCheck,b)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(b))&&(Q.attributeNameCheck instanceof RegExp&&fe(Q.attributeNameCheck,L)||Q.attributeNameCheck instanceof Function&&Q.attributeNameCheck(L,b))||L==="is"&&Q.allowCustomizedBuiltInElements&&(Q.tagNameCheck instanceof RegExp&&fe(Q.tagNameCheck,N)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(N))))return!1}else if(!vs[L]){if(!fe(M,Ot(N,Z,""))){if(!((L==="src"||L==="xlink:href"||L==="href")&&b!=="script"&&kf(N,"data:")===0&&fa[b])){if(!(et&&!fe(ae,Ot(N,Z,"")))){if(N)return!1}}}}}}}return!0},Aa=function(b){return b!=="annotation-xml"&&Ns(b,te)},Ca=function(b){Be(F.beforeSanitizeAttributes,b,null);const{attributes:L}=b;if(!L||xs(b))return;const N={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:j,forceKeepAttr:void 0};let J=L.length;for(;J--;){const de=L[J],{name:ee,namespaceURI:be,value:Ue}=de,Ct=ne(ee),$s=Ue;let re=ee==="value"?$s:Sf($s);if(N.attrName=Ct,N.attrValue=re,N.keepAttr=!0,N.forceKeepAttr=void 0,Be(F.uponSanitizeAttribute,b,N),re=N.attrValue,pa&&(Ct==="id"||Ct==="name")&&(nt(ee,b),re=Ql+re),un&&fe(/((--!?|])>)|<\/(style|title|textarea)/i,re)){nt(ee,b);continue}if(Ct==="attributename"&&Ns(re,"href")){nt(ee,b);continue}if(N.forceKeepAttr)continue;if(!N.keepAttr){nt(ee,b);continue}if(!ua&&fe(/\/>/i,re)){nt(ee,b);continue}$t&&Sn([H,ce,E],_a=>{re=Ot(re,_a," ")});const Ta=ne(b.nodeName);if(!Sa(Ta,Ct,re)){nt(ee,b);continue}if(C&&typeof d=="object"&&typeof d.getAttributeType=="function"&&!be)switch(d.getAttributeType(Ta,Ct)){case"TrustedHTML":{re=C.createHTML(re);break}case"TrustedScriptURL":{re=C.createScriptURL(re);break}}if(re!==$s)try{be?b.setAttributeNS(be,ee,re):b.setAttribute(ee,re),xs(b)?Ie(b):$o(t.removed)}catch{nt(ee,b)}}Be(F.afterSanitizeAttributes,b,null)},nc=function U(b){let L=null;const N=$a(b);for(Be(F.beforeSanitizeShadowDOM,b,null);L=N.nextNode();)Be(F.uponSanitizeShadowNode,L,null),ka(L),Ca(L),L.content instanceof a&&U(L.content);Be(F.afterSanitizeShadowDOM,b,null)};return t.sanitize=function(U){let b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},L=null,N=null,J=null,de=null;if(ms=!U,ms&&(U="<!-->"),typeof U!="string"&&!wa(U))if(typeof U.toString=="function"){if(U=U.toString(),typeof U!="string")throw Bt("dirty is not a string, aborting")}else throw Bt("toString is not a function");if(!t.isSupported)return U;if(gs||ys(b),t.removed=[],typeof U=="string"&&(Rt=!1),Rt){if(U.nodeName){const Ue=ne(U.nodeName);if(!R[Ue]||ke[Ue])throw Bt("root node is forbidden and cannot be sanitized in-place")}}else if(U instanceof l)L=xa("<!---->"),N=L.ownerDocument.importNode(U,!0),N.nodeType===zt.element&&N.nodeName==="BODY"||N.nodeName==="HTML"?L=N:L.appendChild(N);else{if(!wt&&!$t&&!tt&&U.indexOf("<")===-1)return C&&pn?C.createHTML(U):U;if(L=xa(U),!L)return wt?null:pn?_:""}L&&ps&&Ie(L.firstChild);const ee=$a(Rt?U:L);for(;J=ee.nextNode();)ka(J),Ca(J),J.content instanceof a&&nc(J.content);if(Rt)return U;if(wt){if(gn)for(de=z.call(L.ownerDocument);L.firstChild;)de.appendChild(L.firstChild);else de=L;return(j.shadowroot||j.shadowrootmode)&&(de=se.call(s,de,!0)),de}let be=tt?L.outerHTML:L.innerHTML;return tt&&R["!doctype"]&&L.ownerDocument&&L.ownerDocument.doctype&&L.ownerDocument.doctype.name&&fe(Al,L.ownerDocument.doctype.name)&&(be="<!DOCTYPE "+L.ownerDocument.doctype.name+`>
|
|
2243
|
+
`+be),$t&&Sn([H,ce,E],Ue=>{be=Ot(be,Ue," ")}),C&&pn?C.createHTML(be):be},t.setConfig=function(){let U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ys(U),gs=!0},t.clearConfig=function(){At=null,gs=!1},t.isValidAttribute=function(U,b,L){At||ys({});const N=ne(U),J=ne(b);return Sa(N,J,L)},t.addHook=function(U,b){typeof b=="function"&&Nt(F[U],b)},t.removeHook=function(U,b){if(b!==void 0){const L=$f(F[U],b);return L===-1?void 0:wf(F[U],L,1)[0]}return $o(F[U])},t.removeHooks=function(U){F[U]=[]},t.removeAllHooks=function(){F=To()},t}var hi=Cl();function Ji(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var xt=Ji();function Tl(e){xt=e}var Jt={exec:()=>null};function W(e,t=""){let n=typeof e=="string"?e:e.source,s={replace:(i,a)=>{let o=typeof a=="string"?a:a.source;return o=o.replace(he.caret,"$1"),n=n.replace(i,o),s},getRegex:()=>new RegExp(n,t)};return s}var Bf=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),he={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},Uf=/^(?:[ \t]*(?:\n|$))+/,zf=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Hf=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,dn=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,jf=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Zi=/(?:[*+-]|\d{1,9}[.)])/,_l=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,El=W(_l).replace(/bull/g,Zi).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Kf=W(_l).replace(/bull/g,Zi).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Xi=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Wf=/^[^\n]+/,ea=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,qf=W(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",ea).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Gf=W(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Zi).getRegex(),cs="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ta=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Vf=W("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",ta).replace("tag",cs).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ll=W(Xi).replace("hr",dn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",cs).getRegex(),Qf=W(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Ll).getRegex(),na={blockquote:Qf,code:zf,def:qf,fences:Hf,heading:jf,hr:dn,html:Vf,lheading:El,list:Gf,newline:Uf,paragraph:Ll,table:Jt,text:Wf},_o=W("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",dn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",cs).getRegex(),Yf={...na,lheading:Kf,table:_o,paragraph:W(Xi).replace("hr",dn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",_o).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",cs).getRegex()},Jf={...na,html:W(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ta).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Jt,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:W(Xi).replace("hr",dn).replace("heading",` *#{1,6} *[^
|
|
2244
|
+
]`).replace("lheading",El).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Zf=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Xf=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Ml=/^( {2,}|\\)\n(?!\s*$)/,eh=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ds=/[\p{P}\p{S}]/u,sa=/[\s\p{P}\p{S}]/u,Il=/[^\s\p{P}\p{S}]/u,th=W(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,sa).getRegex(),Rl=/(?!~)[\p{P}\p{S}]/u,nh=/(?!~)[\s\p{P}\p{S}]/u,sh=/(?:[^\s\p{P}\p{S}]|~)/u,ih=W(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Bf?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Pl=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,ah=W(Pl,"u").replace(/punct/g,ds).getRegex(),oh=W(Pl,"u").replace(/punct/g,Rl).getRegex(),Dl="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",rh=W(Dl,"gu").replace(/notPunctSpace/g,Il).replace(/punctSpace/g,sa).replace(/punct/g,ds).getRegex(),lh=W(Dl,"gu").replace(/notPunctSpace/g,sh).replace(/punctSpace/g,nh).replace(/punct/g,Rl).getRegex(),ch=W("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Il).replace(/punctSpace/g,sa).replace(/punct/g,ds).getRegex(),dh=W(/\\(punct)/,"gu").replace(/punct/g,ds).getRegex(),uh=W(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),gh=W(ta).replace("(?:-->|$)","-->").getRegex(),ph=W("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",gh).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),jn=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,fh=W(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",jn).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Fl=W(/^!?\[(label)\]\[(ref)\]/).replace("label",jn).replace("ref",ea).getRegex(),Nl=W(/^!?\[(ref)\](?:\[\])?/).replace("ref",ea).getRegex(),hh=W("reflink|nolink(?!\\()","g").replace("reflink",Fl).replace("nolink",Nl).getRegex(),Eo=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,ia={_backpedal:Jt,anyPunctuation:dh,autolink:uh,blockSkip:ih,br:Ml,code:Xf,del:Jt,emStrongLDelim:ah,emStrongRDelimAst:rh,emStrongRDelimUnd:ch,escape:Zf,link:fh,nolink:Nl,punctuation:th,reflink:Fl,reflinkSearch:hh,tag:ph,text:eh,url:Jt},vh={...ia,link:W(/^!?\[(label)\]\((.*?)\)/).replace("label",jn).getRegex(),reflink:W(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",jn).getRegex()},vi={...ia,emStrongRDelimAst:lh,emStrongLDelim:oh,url:W(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Eo).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:W(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Eo).getRegex()},mh={...vi,br:W(Ml).replace("{2,}","*").getRegex(),text:W(vi.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Cn={normal:na,gfm:Yf,pedantic:Jf},Ht={normal:ia,gfm:vi,breaks:mh,pedantic:vh},bh={"&":"&","<":"<",">":">",'"':""","'":"'"},Lo=e=>bh[e];function je(e,t){if(t){if(he.escapeTest.test(e))return e.replace(he.escapeReplace,Lo)}else if(he.escapeTestNoEncode.test(e))return e.replace(he.escapeReplaceNoEncode,Lo);return e}function Mo(e){try{e=encodeURI(e).replace(he.percentDecode,"%")}catch{return null}return e}function Io(e,t){let n=e.replace(he.findPipe,(a,o,l)=>{let c=!1,u=o;for(;--u>=0&&l[u]==="\\";)c=!c;return c?"|":" |"}),s=n.split(he.splitPipe),i=0;if(s[0].trim()||s.shift(),s.length>0&&!s.at(-1)?.trim()&&s.pop(),t)if(s.length>t)s.splice(t);else for(;s.length<t;)s.push("");for(;i<s.length;i++)s[i]=s[i].trim().replace(he.slashPipe,"|");return s}function jt(e,t,n){let s=e.length;if(s===0)return"";let i=0;for(;i<s&&e.charAt(s-i-1)===t;)i++;return e.slice(0,s-i)}function yh(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let s=0;s<e.length;s++)if(e[s]==="\\")s++;else if(e[s]===t[0])n++;else if(e[s]===t[1]&&(n--,n<0))return s;return n>0?-2:-1}function Ro(e,t,n,s,i){let a=t.href,o=t.title||null,l=e[1].replace(i.other.outputLinkReplace,"$1");s.state.inLink=!0;let c={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:a,title:o,text:l,tokens:s.inlineTokens(l)};return s.state.inLink=!1,c}function xh(e,t,n){let s=e.match(n.other.indentCodeCompensation);if(s===null)return t;let i=s[1];return t.split(`
|
|
2245
2245
|
`).map(a=>{let o=a.match(n.other.beginningSpace);if(o===null)return a;let[l]=o;return l.length>=i.length?a.slice(i.length):a}).join(`
|
|
2246
|
-
`)}var
|
|
2247
|
-
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],s=
|
|
2246
|
+
`)}var Kn=class{options;rules;lexer;constructor(e){this.options=e||xt}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let n=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:jt(n,`
|
|
2247
|
+
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],s=xh(n,t[3]||"",this.rules);return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:s}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(this.rules.other.endingHash.test(n)){let s=jt(n,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(n=s.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:jt(t[0],`
|
|
2248
2248
|
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=jt(t[0],`
|
|
2249
2249
|
`).split(`
|
|
2250
2250
|
`),s="",i="",a=[];for(;n.length>0;){let o=!1,l=[],c;for(c=0;c<n.length;c++)if(this.rules.other.blockquoteStart.test(n[c]))l.push(n[c]),o=!0;else if(!o)l.push(n[c]);else break;n=n.slice(c);let u=l.join(`
|
|
@@ -2263,9 +2263,9 @@ ${g}`:g;let p=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
|
|
|
2263
2263
|
`,1)[0],_;if(h=C,this.options.pedantic?(h=h.replace(this.rules.other.listReplaceNesting," "),_=h):_=h.replace(this.rules.other.tabCharGlobal," "),k.test(h)||$.test(h)||A.test(h)||m.test(h)||S.test(h))break;if(_.search(this.rules.other.nonSpaceChar)>=f||!h.trim())g+=`
|
|
2264
2264
|
`+_.slice(f);else{if(d||p.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||k.test(p)||$.test(p)||S.test(p))break;g+=`
|
|
2265
2265
|
`+h}!d&&!h.trim()&&(d=!0),u+=C+`
|
|
2266
|
-
`,e=e.substring(C.length+1),p=_.slice(f)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(u)&&(o=!0)),i.items.push({type:"list_item",raw:u,task:!!this.options.gfm&&this.rules.other.listIsTask.test(g),loose:!1,text:g,tokens:[]}),i.raw+=u}let l=i.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let c of i.items){if(this.lexer.state.top=!1,c.tokens=this.lexer.blockTokens(c.text,[]),c.task){if(c.text=c.text.replace(this.rules.other.listReplaceTask,""),c.tokens[0]?.type==="text"||c.tokens[0]?.type==="paragraph"){c.tokens[0].raw=c.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),c.tokens[0].text=c.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let g=this.lexer.inlineQueue.length-1;g>=0;g--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[g].src)){this.lexer.inlineQueue[g].src=this.lexer.inlineQueue[g].src.replace(this.rules.other.listReplaceTask,"");break}}let u=this.rules.other.listTaskCheckbox.exec(c.raw);if(u){let g={type:"checkbox",raw:u[0]+" ",checked:u[0]!=="[ ]"};c.checked=g.checked,i.loose?c.tokens[0]&&["paragraph","text"].includes(c.tokens[0].type)&&"tokens"in c.tokens[0]&&c.tokens[0].tokens?(c.tokens[0].raw=g.raw+c.tokens[0].raw,c.tokens[0].text=g.raw+c.tokens[0].text,c.tokens[0].tokens.unshift(g)):c.tokens.unshift({type:"paragraph",raw:g.raw,text:g.raw,tokens:[g]}):c.tokens.unshift(g)}}if(!i.loose){let u=c.tokens.filter(p=>p.type==="space"),g=u.length>0&&u.some(p=>this.rules.other.anyLine.test(p.raw));i.loose=g}}if(i.loose)for(let c of i.items){c.loose=!0;for(let u of c.tokens)u.type==="text"&&(u.type="paragraph")}return i}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let n=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:t[0],href:s,title:i}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=
|
|
2267
|
-
`):[],a={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===s.length){for(let o of s)this.rules.other.tableAlignRight.test(o)?a.align.push("right"):this.rules.other.tableAlignCenter.test(o)?a.align.push("center"):this.rules.other.tableAlignLeft.test(o)?a.align.push("left"):a.align.push(null);for(let o=0;o<n.length;o++)a.header.push({text:n[o],tokens:this.lexer.inline(n[o]),header:!0,align:a.align[o]});for(let o of i)a.rows.push(
|
|
2268
|
-
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let a=jt(n.slice(0,-1),"\\");if((n.length-a.length)%2===0)return}else{let a=
|
|
2266
|
+
`,e=e.substring(C.length+1),p=_.slice(f)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(u)&&(o=!0)),i.items.push({type:"list_item",raw:u,task:!!this.options.gfm&&this.rules.other.listIsTask.test(g),loose:!1,text:g,tokens:[]}),i.raw+=u}let l=i.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let c of i.items){if(this.lexer.state.top=!1,c.tokens=this.lexer.blockTokens(c.text,[]),c.task){if(c.text=c.text.replace(this.rules.other.listReplaceTask,""),c.tokens[0]?.type==="text"||c.tokens[0]?.type==="paragraph"){c.tokens[0].raw=c.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),c.tokens[0].text=c.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let g=this.lexer.inlineQueue.length-1;g>=0;g--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[g].src)){this.lexer.inlineQueue[g].src=this.lexer.inlineQueue[g].src.replace(this.rules.other.listReplaceTask,"");break}}let u=this.rules.other.listTaskCheckbox.exec(c.raw);if(u){let g={type:"checkbox",raw:u[0]+" ",checked:u[0]!=="[ ]"};c.checked=g.checked,i.loose?c.tokens[0]&&["paragraph","text"].includes(c.tokens[0].type)&&"tokens"in c.tokens[0]&&c.tokens[0].tokens?(c.tokens[0].raw=g.raw+c.tokens[0].raw,c.tokens[0].text=g.raw+c.tokens[0].text,c.tokens[0].tokens.unshift(g)):c.tokens.unshift({type:"paragraph",raw:g.raw,text:g.raw,tokens:[g]}):c.tokens.unshift(g)}}if(!i.loose){let u=c.tokens.filter(p=>p.type==="space"),g=u.length>0&&u.some(p=>this.rules.other.anyLine.test(p.raw));i.loose=g}}if(i.loose)for(let c of i.items){c.loose=!0;for(let u of c.tokens)u.type==="text"&&(u.type="paragraph")}return i}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let n=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:t[0],href:s,title:i}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=Io(t[1]),s=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
2267
|
+
`):[],a={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===s.length){for(let o of s)this.rules.other.tableAlignRight.test(o)?a.align.push("right"):this.rules.other.tableAlignCenter.test(o)?a.align.push("center"):this.rules.other.tableAlignLeft.test(o)?a.align.push("left"):a.align.push(null);for(let o=0;o<n.length;o++)a.header.push({text:n[o],tokens:this.lexer.inline(n[o]),header:!0,align:a.align[o]});for(let o of i)a.rows.push(Io(o,a.header.length).map((l,c)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:a.align[c]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let n=t[1].charAt(t[1].length-1)===`
|
|
2268
|
+
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let a=jt(n.slice(0,-1),"\\");if((n.length-a.length)%2===0)return}else{let a=yh(t[2],"()");if(a===-2)return;if(a>-1){let o=(t[0].indexOf("!")===0?5:4)+t[1].length+a;t[2]=t[2].substring(0,a),t[0]=t[0].substring(0,o).trim(),t[3]=""}}let s=t[2],i="";if(this.options.pedantic){let a=this.rules.other.pedanticHrefTitle.exec(s);a&&(s=a[1],i=a[3])}else i=t[3]?t[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?s=s.slice(1):s=s.slice(1,-1)),Ro(t,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let s=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=t[s.toLowerCase()];if(!i){let a=n[0].charAt(0);return{type:"text",raw:a,text:a}}return Ro(n,i,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let s=this.rules.inline.emStrongLDelim.exec(e);if(!(!s||s[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[2])||!n||this.rules.inline.punctuation.exec(n))){let i=[...s[0]].length-1,a,o,l=i,c=0,u=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,t=t.slice(-1*e.length+i);(s=u.exec(t))!=null;){if(a=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!a)continue;if(o=[...a].length,s[3]||s[4]){l+=o;continue}else if((s[5]||s[6])&&i%3&&!((i+o)%3)){c+=o;continue}if(l-=o,l>0)continue;o=Math.min(o,o+l+c);let g=[...s[0]][0].length,p=e.slice(0,i+s.index+g+o);if(Math.min(i,o)%2){let d=p.slice(1,-1);return{type:"em",raw:p,text:d,tokens:this.lexer.inlineTokens(d)}}let h=p.slice(2,-2);return{type:"strong",raw:p,text:h,tokens:this.lexer.inlineTokens(h)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(n),i=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return s&&i&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,s;return t[2]==="@"?(n=t[1],s="mailto:"+n):(n=t[1],s=n),{type:"link",raw:t[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let n,s;if(t[2]==="@")n=t[0],s="mailto:"+n;else{let i;do i=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(i!==t[0]);n=t[0],t[1]==="www."?s="http://"+t[0]:s=t[0]}return{type:"link",raw:t[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}},_e=class mi{tokens;options;state;inlineQueue;tokenizer;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||xt,this.options.tokenizer=this.options.tokenizer||new Kn,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:he,block:Cn.normal,inline:Ht.normal};this.options.pedantic?(n.block=Cn.pedantic,n.inline=Ht.pedantic):this.options.gfm&&(n.block=Cn.gfm,this.options.breaks?n.inline=Ht.breaks:n.inline=Ht.gfm),this.tokenizer.rules=n}static get rules(){return{block:Cn,inline:Ht}}static lex(t,n){return new mi(n).lex(t)}static lexInline(t,n){return new mi(n).inlineTokens(t)}lex(t){t=t.replace(he.carriageReturn,`
|
|
2269
2269
|
`),this.blockTokens(t,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let s=this.inlineQueue[n];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,n=[],s=!1){for(this.options.pedantic&&(t=t.replace(he.tabCharGlobal," ").replace(he.spaceLine,""));t;){let i;if(this.options.extensions?.block?.some(o=>(i=o.call({lexer:this},t,n))?(t=t.substring(i.raw.length),n.push(i),!0):!1))continue;if(i=this.tokenizer.space(t)){t=t.substring(i.raw.length);let o=n.at(-1);i.raw.length===1&&o!==void 0?o.raw+=`
|
|
2270
2270
|
`:n.push(i);continue}if(i=this.tokenizer.code(t)){t=t.substring(i.raw.length);let o=n.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=(o.raw.endsWith(`
|
|
2271
2271
|
`)?"":`
|
|
@@ -2279,7 +2279,7 @@ ${g}`:g;let p=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
|
|
|
2279
2279
|
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):n.push(i),s=a.length!==t.length,t=t.substring(i.raw.length);continue}if(i=this.tokenizer.text(t)){t=t.substring(i.raw.length);let o=n.at(-1);o?.type==="text"?(o.raw+=(o.raw.endsWith(`
|
|
2280
2280
|
`)?"":`
|
|
2281
2281
|
`)+i.raw,o.text+=`
|
|
2282
|
-
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):n.push(i);continue}if(t){let o="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(o);break}else throw new Error(o)}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){let s=t,i=null;if(this.tokens.links){let c=Object.keys(this.tokens.links);if(c.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(s))!=null;)c.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(s))!=null;)s=s.slice(0,i.index)+"++"+s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let a;for(;(i=this.tokenizer.rules.inline.blockSkip.exec(s))!=null;)a=i[2]?i[2].length:0,s=s.slice(0,i.index+a)+"["+"a".repeat(i[0].length-a-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);s=this.options.hooks?.emStrongMask?.call({lexer:this},s)??s;let o=!1,l="";for(;t;){o||(l=""),o=!1;let c;if(this.options.extensions?.inline?.some(g=>(c=g.call({lexer:this},t,n))?(t=t.substring(c.raw.length),n.push(c),!0):!1))continue;if(c=this.tokenizer.escape(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.tag(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.link(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(c.raw.length);let g=n.at(-1);c.type==="text"&&g?.type==="text"?(g.raw+=c.raw,g.text+=c.text):n.push(c);continue}if(c=this.tokenizer.emStrong(t,s,l)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.codespan(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.br(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.del(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.autolink(t)){t=t.substring(c.raw.length),n.push(c);continue}if(!this.state.inLink&&(c=this.tokenizer.url(t))){t=t.substring(c.raw.length),n.push(c);continue}let u=t;if(this.options.extensions?.startInline){let g=1/0,p=t.slice(1),h;this.options.extensions.startInline.forEach(d=>{h=d.call({lexer:this},p),typeof h=="number"&&h>=0&&(g=Math.min(g,h))}),g<1/0&&g>=0&&(u=t.substring(0,g+1))}if(c=this.tokenizer.inlineText(u)){t=t.substring(c.raw.length),c.raw.slice(-1)!=="_"&&(l=c.raw.slice(-1)),o=!0;let g=n.at(-1);g?.type==="text"?(g.raw+=c.raw,g.text+=c.text):n.push(c);continue}if(t){let g="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(g);break}else throw new Error(g)}}return n}},
|
|
2282
|
+
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):n.push(i);continue}if(t){let o="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(o);break}else throw new Error(o)}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){let s=t,i=null;if(this.tokens.links){let c=Object.keys(this.tokens.links);if(c.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(s))!=null;)c.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(s))!=null;)s=s.slice(0,i.index)+"++"+s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let a;for(;(i=this.tokenizer.rules.inline.blockSkip.exec(s))!=null;)a=i[2]?i[2].length:0,s=s.slice(0,i.index+a)+"["+"a".repeat(i[0].length-a-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);s=this.options.hooks?.emStrongMask?.call({lexer:this},s)??s;let o=!1,l="";for(;t;){o||(l=""),o=!1;let c;if(this.options.extensions?.inline?.some(g=>(c=g.call({lexer:this},t,n))?(t=t.substring(c.raw.length),n.push(c),!0):!1))continue;if(c=this.tokenizer.escape(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.tag(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.link(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(c.raw.length);let g=n.at(-1);c.type==="text"&&g?.type==="text"?(g.raw+=c.raw,g.text+=c.text):n.push(c);continue}if(c=this.tokenizer.emStrong(t,s,l)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.codespan(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.br(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.del(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.autolink(t)){t=t.substring(c.raw.length),n.push(c);continue}if(!this.state.inLink&&(c=this.tokenizer.url(t))){t=t.substring(c.raw.length),n.push(c);continue}let u=t;if(this.options.extensions?.startInline){let g=1/0,p=t.slice(1),h;this.options.extensions.startInline.forEach(d=>{h=d.call({lexer:this},p),typeof h=="number"&&h>=0&&(g=Math.min(g,h))}),g<1/0&&g>=0&&(u=t.substring(0,g+1))}if(c=this.tokenizer.inlineText(u)){t=t.substring(c.raw.length),c.raw.slice(-1)!=="_"&&(l=c.raw.slice(-1)),o=!0;let g=n.at(-1);g?.type==="text"?(g.raw+=c.raw,g.text+=c.text):n.push(c);continue}if(t){let g="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(g);break}else throw new Error(g)}}return n}},Wn=class{options;parser;constructor(e){this.options=e||xt}space(e){return""}code({text:e,lang:t,escaped:n}){let s=(t||"").match(he.notSpaceStart)?.[0],i=e.replace(he.endingNewline,"")+`
|
|
2283
2283
|
`;return s?'<pre><code class="language-'+je(s)+'">'+(n?i:je(i,!0))+`</code></pre>
|
|
2284
2284
|
`:"<pre><code>"+(n?i:je(i,!0))+`</code></pre>
|
|
2285
2285
|
`}blockquote({tokens:e}){return`<blockquote>
|
|
@@ -2297,29 +2297,29 @@ ${this.parser.parse(e)}</blockquote>
|
|
|
2297
2297
|
`}tablerow({text:e}){return`<tr>
|
|
2298
2298
|
${e}</tr>
|
|
2299
2299
|
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
2300
|
-
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${je(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let s=this.parser.parseInline(n),i=
|
|
2301
|
-
Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error occurred:</p><pre>"+je(n.message+"",!0)+"</pre>";return t?Promise.resolve(s):s}if(t)return Promise.reject(n);throw n}}},
|
|
2300
|
+
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${je(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let s=this.parser.parseInline(n),i=Mo(e);if(i===null)return s;e=i;let a='<a href="'+e+'"';return t&&(a+=' title="'+je(t)+'"'),a+=">"+s+"</a>",a}image({href:e,title:t,text:n,tokens:s}){s&&(n=this.parser.parseInline(s,this.parser.textRenderer));let i=Mo(e);if(i===null)return je(n);e=i;let a=`<img src="${e}" alt="${n}"`;return t&&(a+=` title="${je(t)}"`),a+=">",a}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:je(e.text)}},aa=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}},Ee=class bi{options;renderer;textRenderer;constructor(t){this.options=t||xt,this.options.renderer=this.options.renderer||new Wn,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new aa}static parse(t,n){return new bi(n).parse(t)}static parseInline(t,n){return new bi(n).parseInline(t)}parse(t){let n="";for(let s=0;s<t.length;s++){let i=t[s];if(this.options.extensions?.renderers?.[i.type]){let o=i,l=this.options.extensions.renderers[o.type].call({parser:this},o);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(o.type)){n+=l||"";continue}}let a=i;switch(a.type){case"space":{n+=this.renderer.space(a);break}case"hr":{n+=this.renderer.hr(a);break}case"heading":{n+=this.renderer.heading(a);break}case"code":{n+=this.renderer.code(a);break}case"table":{n+=this.renderer.table(a);break}case"blockquote":{n+=this.renderer.blockquote(a);break}case"list":{n+=this.renderer.list(a);break}case"checkbox":{n+=this.renderer.checkbox(a);break}case"html":{n+=this.renderer.html(a);break}case"def":{n+=this.renderer.def(a);break}case"paragraph":{n+=this.renderer.paragraph(a);break}case"text":{n+=this.renderer.text(a);break}default:{let o='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return n}parseInline(t,n=this.renderer){let s="";for(let i=0;i<t.length;i++){let a=t[i];if(this.options.extensions?.renderers?.[a.type]){let l=this.options.extensions.renderers[a.type].call({parser:this},a);if(l!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){s+=l||"";continue}}let o=a;switch(o.type){case"escape":{s+=n.text(o);break}case"html":{s+=n.html(o);break}case"link":{s+=n.link(o);break}case"image":{s+=n.image(o);break}case"checkbox":{s+=n.checkbox(o);break}case"strong":{s+=n.strong(o);break}case"em":{s+=n.em(o);break}case"codespan":{s+=n.codespan(o);break}case"br":{s+=n.br(o);break}case"del":{s+=n.del(o);break}case"text":{s+=n.text(o);break}default:{let l='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return s}},Wt=class{options;block;constructor(e){this.options=e||xt}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?_e.lex:_e.lexInline}provideParser(){return this.block?Ee.parse:Ee.parseInline}},$h=class{defaults=Ji();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Ee;Renderer=Wn;TextRenderer=aa;Lexer=_e;Tokenizer=Kn;Hooks=Wt;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let s of e)switch(n=n.concat(t.call(this,s)),s.type){case"table":{let i=s;for(let a of i.header)n=n.concat(this.walkTokens(a.tokens,t));for(let a of i.rows)for(let o of a)n=n.concat(this.walkTokens(o.tokens,t));break}case"list":{let i=s;n=n.concat(this.walkTokens(i.items,t));break}default:{let i=s;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(a=>{let o=i[a].flat(1/0);n=n.concat(this.walkTokens(o,t))}):i.tokens&&(n=n.concat(this.walkTokens(i.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let s={...n};if(s.async=this.defaults.async||s.async||!1,n.extensions&&(n.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let a=t.renderers[i.name];a?t.renderers[i.name]=function(...o){let l=i.renderer.apply(this,o);return l===!1&&(l=a.apply(this,o)),l}:t.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let a=t[i.level];a?a.unshift(i.tokenizer):t[i.level]=[i.tokenizer],i.start&&(i.level==="block"?t.startBlock?t.startBlock.push(i.start):t.startBlock=[i.start]:i.level==="inline"&&(t.startInline?t.startInline.push(i.start):t.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(t.childTokens[i.name]=i.childTokens)}),s.extensions=t),n.renderer){let i=this.defaults.renderer||new Wn(this.defaults);for(let a in n.renderer){if(!(a in i))throw new Error(`renderer '${a}' does not exist`);if(["options","parser"].includes(a))continue;let o=a,l=n.renderer[o],c=i[o];i[o]=(...u)=>{let g=l.apply(i,u);return g===!1&&(g=c.apply(i,u)),g||""}}s.renderer=i}if(n.tokenizer){let i=this.defaults.tokenizer||new Kn(this.defaults);for(let a in n.tokenizer){if(!(a in i))throw new Error(`tokenizer '${a}' does not exist`);if(["options","rules","lexer"].includes(a))continue;let o=a,l=n.tokenizer[o],c=i[o];i[o]=(...u)=>{let g=l.apply(i,u);return g===!1&&(g=c.apply(i,u)),g}}s.tokenizer=i}if(n.hooks){let i=this.defaults.hooks||new Wt;for(let a in n.hooks){if(!(a in i))throw new Error(`hook '${a}' does not exist`);if(["options","block"].includes(a))continue;let o=a,l=n.hooks[o],c=i[o];Wt.passThroughHooks.has(a)?i[o]=u=>{if(this.defaults.async&&Wt.passThroughHooksRespectAsync.has(a))return(async()=>{let p=await l.call(i,u);return c.call(i,p)})();let g=l.call(i,u);return c.call(i,g)}:i[o]=(...u)=>{if(this.defaults.async)return(async()=>{let p=await l.apply(i,u);return p===!1&&(p=await c.apply(i,u)),p})();let g=l.apply(i,u);return g===!1&&(g=c.apply(i,u)),g}}s.hooks=i}if(n.walkTokens){let i=this.defaults.walkTokens,a=n.walkTokens;s.walkTokens=function(o){let l=[];return l.push(a.call(this,o)),i&&(l=l.concat(i.call(this,o))),l}}this.defaults={...this.defaults,...s}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return _e.lex(e,t??this.defaults)}parser(e,t){return Ee.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let s={...n},i={...this.defaults,...s},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&s.async===!1)return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let o=i.hooks?await i.hooks.preprocess(t):t,l=await(i.hooks?await i.hooks.provideLexer():e?_e.lex:_e.lexInline)(o,i),c=i.hooks?await i.hooks.processAllTokens(l):l;i.walkTokens&&await Promise.all(this.walkTokens(c,i.walkTokens));let u=await(i.hooks?await i.hooks.provideParser():e?Ee.parse:Ee.parseInline)(c,i);return i.hooks?await i.hooks.postprocess(u):u})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let o=(i.hooks?i.hooks.provideLexer():e?_e.lex:_e.lexInline)(t,i);i.hooks&&(o=i.hooks.processAllTokens(o)),i.walkTokens&&this.walkTokens(o,i.walkTokens);let l=(i.hooks?i.hooks.provideParser():e?Ee.parse:Ee.parseInline)(o,i);return i.hooks&&(l=i.hooks.postprocess(l)),l}catch(o){return a(o)}}}onError(e,t){return n=>{if(n.message+=`
|
|
2301
|
+
Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error occurred:</p><pre>"+je(n.message+"",!0)+"</pre>";return t?Promise.resolve(s):s}if(t)return Promise.reject(n);throw n}}},bt=new $h;function q(e,t){return bt.parse(e,t)}q.options=q.setOptions=function(e){return bt.setOptions(e),q.defaults=bt.defaults,Tl(q.defaults),q};q.getDefaults=Ji;q.defaults=xt;q.use=function(...e){return bt.use(...e),q.defaults=bt.defaults,Tl(q.defaults),q};q.walkTokens=function(e,t){return bt.walkTokens(e,t)};q.parseInline=bt.parseInline;q.Parser=Ee;q.parser=Ee.parse;q.Renderer=Wn;q.TextRenderer=aa;q.Lexer=_e;q.lexer=_e.lex;q.Tokenizer=Kn;q.Hooks=Wt;q.parse=q;q.options;q.setOptions;q.use;q.walkTokens;q.parseInline;Ee.parse;_e.lex;q.setOptions({gfm:!0,breaks:!0});const Po=["a","b","blockquote","br","code","del","em","h1","h2","h3","h4","hr","i","li","ol","p","pre","strong","table","tbody","td","th","thead","tr","ul"],Do=["class","href","rel","target","title","start"];let Fo=!1;const wh=14e4,kh=4e4,Sh=200,Hs=5e4,gt=new Map;function Ah(e){const t=gt.get(e);return t===void 0?null:(gt.delete(e),gt.set(e,t),t)}function No(e,t){if(gt.set(e,t),gt.size<=Sh)return;const n=gt.keys().next().value;n&>.delete(n)}function Ch(){Fo||(Fo=!0,hi.addHook("afterSanitizeAttributes",e=>{!(e instanceof HTMLAnchorElement)||!e.getAttribute("href")||(e.setAttribute("rel","noreferrer noopener"),e.setAttribute("target","_blank"))}))}function yi(e){const t=e.trim();if(!t)return"";if(Ch(),t.length<=Hs){const o=Ah(t);if(o!==null)return o}const n=Cr(t,wh),s=n.truncated?`
|
|
2302
2302
|
|
|
2303
|
-
… truncated (${n.total} chars, showing first ${n.text.length}).`:"";if(n.text.length>
|
|
2303
|
+
… truncated (${n.total} chars, showing first ${n.text.length}).`:"";if(n.text.length>kh){const l=`<pre class="code-block">${Bl(`${n.text}${s}`)}</pre>`,c=hi.sanitize(l,{ALLOWED_TAGS:Po,ALLOWED_ATTR:Do});return t.length<=Hs&&No(t,c),c}const i=q.parse(`${n.text}${s}`,{renderer:Ol}),a=hi.sanitize(i,{ALLOWED_TAGS:Po,ALLOWED_ATTR:Do});return t.length<=Hs&&No(t,a),a}const Ol=new q.Renderer;Ol.html=({text:e})=>Bl(e);function Bl(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const Th=1500,_h=2e3,Ul="Copy as markdown",Eh="Copied",Lh="Copy failed";async function Mh(e){if(!e)return!1;try{return await navigator.clipboard.writeText(e),!0}catch{return!1}}function Tn(e,t){e.title=t,e.setAttribute("aria-label",t)}function Ih(e){const t=e.label??Ul;return r`
|
|
2304
2304
|
<button
|
|
2305
2305
|
class="chat-copy-btn"
|
|
2306
2306
|
type="button"
|
|
2307
2307
|
title=${t}
|
|
2308
2308
|
aria-label=${t}
|
|
2309
|
-
@click=${async n=>{const s=n.currentTarget;if(!s||s.dataset.copying==="1")return;s.dataset.copying="1",s.setAttribute("aria-busy","true"),s.disabled=!0;const i=await
|
|
2309
|
+
@click=${async n=>{const s=n.currentTarget;if(!s||s.dataset.copying==="1")return;s.dataset.copying="1",s.setAttribute("aria-busy","true"),s.disabled=!0;const i=await Mh(e.text());if(s.isConnected){if(delete s.dataset.copying,s.removeAttribute("aria-busy"),s.disabled=!1,!i){s.dataset.error="1",Tn(s,Lh),window.setTimeout(()=>{s.isConnected&&(delete s.dataset.error,Tn(s,t))},_h);return}s.dataset.copied="1",Tn(s,Eh),window.setTimeout(()=>{s.isConnected&&(delete s.dataset.copied,Tn(s,t))},Th)}}}
|
|
2310
2310
|
>
|
|
2311
2311
|
<span class="chat-copy-btn__icon" aria-hidden="true">
|
|
2312
2312
|
<span class="chat-copy-btn__icon-copy">${le.copy}</span>
|
|
2313
2313
|
<span class="chat-copy-btn__icon-check">${le.check}</span>
|
|
2314
2314
|
</span>
|
|
2315
2315
|
</button>
|
|
2316
|
-
`}function
|
|
2317
|
-
`),n=t.slice(0,
|
|
2318
|
-
`);return s.length>
|
|
2316
|
+
`}function Rh(e){return Ih({text:()=>e,label:Ul})}function zl(e){const t=e;let n=typeof t.role=="string"?t.role:"unknown";const s=typeof t.toolCallId=="string"||typeof t.tool_call_id=="string",i=t.content,a=Array.isArray(i)?i:null,o=Array.isArray(a)&&a.some(p=>{const h=p,d=(typeof h.type=="string"?h.type:"").toLowerCase();return d==="toolresult"||d==="tool_result"}),l=typeof t.toolName=="string"||typeof t.tool_name=="string";(s||o||l)&&(n="toolResult");let c=[];typeof t.content=="string"?c=[{type:"text",text:t.content}]:Array.isArray(t.content)?c=t.content.map(p=>({type:p.type||"text",text:p.text,name:p.name,args:p.args||p.arguments})):typeof t.text=="string"&&(c=[{type:"text",text:t.text}]);const u=typeof t.timestamp=="number"?t.timestamp:Date.now(),g=typeof t.id=="string"?t.id:void 0;return{role:n,content:c,timestamp:u,id:g}}function oa(e){const t=e.toLowerCase();return e==="user"||e==="User"?e:e==="assistant"?"assistant":e==="system"?"system":t==="toolresult"||t==="tool_result"||t==="tool"||t==="function"?"tool":e}function Hl(e){const t=e,n=typeof t.role=="string"?t.role.toLowerCase():"";return n==="toolresult"||n==="tool_result"}const Ph={icon:"puzzle",detailKeys:["command","path","url","targetUrl","targetId","ref","element","node","nodeId","id","requestId","to","channelId","guildId","userId","name","query","pattern","messageId"]},Dh={bash:{icon:"wrench",title:"Bash",detailKeys:["command"]},process:{icon:"wrench",title:"Process",detailKeys:["sessionId"]},read:{icon:"fileText",title:"Read",detailKeys:["path"]},write:{icon:"edit",title:"Write",detailKeys:["path"]},edit:{icon:"penLine",title:"Edit",detailKeys:["path"]},attach:{icon:"paperclip",title:"Attach",detailKeys:["path","url","fileName"]},browser:{icon:"globe",title:"Browser",actions:{status:{label:"status"},start:{label:"start"},stop:{label:"stop"},tabs:{label:"tabs"},open:{label:"open",detailKeys:["targetUrl"]},focus:{label:"focus",detailKeys:["targetId"]},close:{label:"close",detailKeys:["targetId"]},snapshot:{label:"snapshot",detailKeys:["targetUrl","targetId","ref","element","format"]},screenshot:{label:"screenshot",detailKeys:["targetUrl","targetId","ref","element"]},navigate:{label:"navigate",detailKeys:["targetUrl","targetId"]},console:{label:"console",detailKeys:["level","targetId"]},pdf:{label:"pdf",detailKeys:["targetId"]},upload:{label:"upload",detailKeys:["paths","ref","inputRef","element","targetId"]},dialog:{label:"dialog",detailKeys:["accept","promptText","targetId"]},act:{label:"act",detailKeys:["request.kind","request.ref","request.selector","request.text","request.value"]}}},canvas:{icon:"image",title:"Canvas",actions:{present:{label:"present",detailKeys:["target","node","nodeId"]},hide:{label:"hide",detailKeys:["node","nodeId"]},navigate:{label:"navigate",detailKeys:["url","node","nodeId"]},eval:{label:"eval",detailKeys:["javaScript","node","nodeId"]},snapshot:{label:"snapshot",detailKeys:["format","node","nodeId"]},a2ui_push:{label:"A2UI push",detailKeys:["jsonlPath","node","nodeId"]},a2ui_reset:{label:"A2UI reset",detailKeys:["node","nodeId"]}}},nodes:{icon:"smartphone",title:"Nodes",actions:{status:{label:"status"},describe:{label:"describe",detailKeys:["node","nodeId"]},pending:{label:"pending"},approve:{label:"approve",detailKeys:["requestId"]},reject:{label:"reject",detailKeys:["requestId"]},notify:{label:"notify",detailKeys:["node","nodeId","title","body"]},camera_snap:{label:"camera snap",detailKeys:["node","nodeId","facing","deviceId"]},camera_list:{label:"camera list",detailKeys:["node","nodeId"]},camera_clip:{label:"camera clip",detailKeys:["node","nodeId","facing","duration","durationMs"]},screen_record:{label:"screen record",detailKeys:["node","nodeId","duration","durationMs","fps","screenIndex"]}}},cron:{icon:"loader",title:"Cron",actions:{status:{label:"status"},list:{label:"list"},add:{label:"add",detailKeys:["job.name","job.id","job.schedule","job.cron"]},update:{label:"update",detailKeys:["id"]},remove:{label:"remove",detailKeys:["id"]},run:{label:"run",detailKeys:["id"]},runs:{label:"runs",detailKeys:["id"]},wake:{label:"wake",detailKeys:["text","mode"]}}},gateway:{icon:"plug",title:"Gateway",actions:{restart:{label:"restart",detailKeys:["reason","delayMs"]},"config.get":{label:"config get"},"config.schema":{label:"config schema"},"config.apply":{label:"config apply",detailKeys:["restartDelayMs"]},"update.run":{label:"update run",detailKeys:["restartDelayMs"]}}},whatsapp_login:{icon:"circle",title:"WhatsApp Login",actions:{start:{label:"start"},wait:{label:"wait"}}},discord:{icon:"messageSquare",title:"Discord",actions:{react:{label:"react",detailKeys:["channelId","messageId","emoji"]},reactions:{label:"reactions",detailKeys:["channelId","messageId"]},sticker:{label:"sticker",detailKeys:["to","stickerIds"]},poll:{label:"poll",detailKeys:["question","to"]},permissions:{label:"permissions",detailKeys:["channelId"]},readMessages:{label:"read messages",detailKeys:["channelId","limit"]},sendMessage:{label:"send",detailKeys:["to","content"]},editMessage:{label:"edit",detailKeys:["channelId","messageId"]},deleteMessage:{label:"delete",detailKeys:["channelId","messageId"]},threadCreate:{label:"thread create",detailKeys:["channelId","name"]},threadList:{label:"thread list",detailKeys:["guildId","channelId"]},threadReply:{label:"thread reply",detailKeys:["channelId","content"]},pinMessage:{label:"pin",detailKeys:["channelId","messageId"]},unpinMessage:{label:"unpin",detailKeys:["channelId","messageId"]},listPins:{label:"list pins",detailKeys:["channelId"]},searchMessages:{label:"search",detailKeys:["guildId","content"]},memberInfo:{label:"member",detailKeys:["guildId","userId"]},roleInfo:{label:"roles",detailKeys:["guildId"]},emojiList:{label:"emoji list",detailKeys:["guildId"]},roleAdd:{label:"role add",detailKeys:["guildId","userId","roleId"]},roleRemove:{label:"role remove",detailKeys:["guildId","userId","roleId"]},channelInfo:{label:"channel",detailKeys:["channelId"]},channelList:{label:"channels",detailKeys:["guildId"]},voiceStatus:{label:"voice",detailKeys:["guildId","userId"]},eventList:{label:"events",detailKeys:["guildId"]},eventCreate:{label:"event create",detailKeys:["guildId","name"]},timeout:{label:"timeout",detailKeys:["guildId","userId"]},kick:{label:"kick",detailKeys:["guildId","userId"]},ban:{label:"ban",detailKeys:["guildId","userId"]}}},slack:{icon:"messageSquare",title:"Slack",actions:{react:{label:"react",detailKeys:["channelId","messageId","emoji"]},reactions:{label:"reactions",detailKeys:["channelId","messageId"]},sendMessage:{label:"send",detailKeys:["to","content"]},editMessage:{label:"edit",detailKeys:["channelId","messageId"]},deleteMessage:{label:"delete",detailKeys:["channelId","messageId"]},readMessages:{label:"read messages",detailKeys:["channelId","limit"]},pinMessage:{label:"pin",detailKeys:["channelId","messageId"]},unpinMessage:{label:"unpin",detailKeys:["channelId","messageId"]},listPins:{label:"list pins",detailKeys:["channelId"]},memberInfo:{label:"member",detailKeys:["userId"]},emojiList:{label:"emoji list"}}}},Fh={fallback:Ph,tools:Dh},jl=Fh,Oo=jl.fallback??{icon:"puzzle"},Nh=jl.tools??{};function Oh(e){return(e??"tool").trim()}function Bh(e){const t=e.replace(/_/g," ").trim();return t?t.split(/\s+/).map(n=>n.length<=2&&n.toUpperCase()===n?n:`${n.at(0)?.toUpperCase()??""}${n.slice(1)}`).join(" "):"Tool"}function Uh(e){const t=e?.trim();if(t)return t.replace(/_/g," ")}function Kl(e){if(e!=null){if(typeof e=="string"){const t=e.trim();if(!t)return;const n=t.split(/\r?\n/)[0]?.trim()??"";return n?n.length>160?`${n.slice(0,157)}…`:n:void 0}if(typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e)){const t=e.map(s=>Kl(s)).filter(s=>!!s);if(t.length===0)return;const n=t.slice(0,3).join(", ");return t.length>3?`${n}…`:n}}}function zh(e,t){if(!e||typeof e!="object")return;let n=e;for(const s of t.split(".")){if(!s||!n||typeof n!="object")return;n=n[s]}return n}function Hh(e,t){for(const n of t){const s=zh(e,n),i=Kl(s);if(i)return i}}function jh(e){if(!e||typeof e!="object")return;const t=e,n=typeof t.path=="string"?t.path:void 0;if(!n)return;const s=typeof t.offset=="number"?t.offset:void 0,i=typeof t.limit=="number"?t.limit:void 0;return s!==void 0&&i!==void 0?`${n}:${s}-${s+i}`:n}function Kh(e){if(!e||typeof e!="object")return;const t=e;return typeof t.path=="string"?t.path:void 0}function Wh(e,t){if(!(!e||!t))return e.actions?.[t]??void 0}function qh(e){const t=Oh(e.name),n=t.toLowerCase(),s=Nh[n],i=s?.icon??Oo.icon??"puzzle",a=s?.title??Bh(t),o=s?.label??t,l=e.args&&typeof e.args=="object"?e.args.action:void 0,c=typeof l=="string"?l.trim():void 0,u=Wh(s,c),g=Uh(u?.label??c);let p;n==="read"&&(p=jh(e.args)),!p&&(n==="write"||n==="edit"||n==="attach")&&(p=Kh(e.args));const h=u?.detailKeys??s?.detailKeys??Oo.detailKeys??[];return!p&&h.length>0&&(p=Hh(e.args,h)),!p&&e.meta&&(p=e.meta),p&&(p=Vh(p)),{name:t,icon:i,title:a,label:o,verb:g,detail:p}}function Gh(e){const t=[];if(e.verb&&t.push(e.verb),e.detail&&t.push(e.detail),t.length!==0)return t.join(" · ")}function Vh(e){return e&&e.replace(/\/Users\/[^/]+/g,"~").replace(/\/home\/[^/]+/g,"~")}const Qh=80,Yh=2,Bo=100;function Jh(e){const t=e.trim();if(t.startsWith("{")||t.startsWith("["))try{const n=JSON.parse(t);return"```json\n"+JSON.stringify(n,null,2)+"\n```"}catch{}return e}function Zh(e){const t=e.split(`
|
|
2317
|
+
`),n=t.slice(0,Yh),s=n.join(`
|
|
2318
|
+
`);return s.length>Bo?s.slice(0,Bo)+"…":n.length<t.length?s+"…":s}function Xh(e){const t=e,n=ev(t.content),s=[];for(const i of n){const a=(typeof i.type=="string"?i.type:"").toLowerCase();(["toolcall","tool_call","tooluse","tool_use"].includes(a)||typeof i.name=="string"&&i.arguments!=null)&&s.push({kind:"call",name:i.name??"tool",args:tv(i.arguments??i.args)})}for(const i of n){const a=(typeof i.type=="string"?i.type:"").toLowerCase();if(a!=="toolresult"&&a!=="tool_result")continue;const o=nv(i),l=typeof i.name=="string"?i.name:"tool";s.push({kind:"result",name:l,text:o})}if(Hl(e)&&!s.some(i=>i.kind==="result")){const i=typeof t.toolName=="string"&&t.toolName||typeof t.tool_name=="string"&&t.tool_name||"tool",a=el(e)??void 0;s.push({kind:"result",name:i,text:a})}return s}function Uo(e,t){const n=qh({name:e.name,args:e.args}),s=Gh(n),i=!!e.text?.trim(),a=!!t,o=a?()=>{if(i){t(Jh(e.text));return}const p=`## ${n.label}
|
|
2319
2319
|
|
|
2320
2320
|
${s?`**Command:** \`${s}\`
|
|
2321
2321
|
|
|
2322
|
-
`:""}*No output — tool completed successfully.*`;t(p)}:void 0,l=i&&(e.text?.length??0)<=
|
|
2322
|
+
`:""}*No output — tool completed successfully.*`;t(p)}:void 0,l=i&&(e.text?.length??0)<=Qh,c=i&&!l,u=i&&l,g=!i;return r`
|
|
2323
2323
|
<div
|
|
2324
2324
|
class="chat-tool-card ${a?"chat-tool-card--clickable":""}"
|
|
2325
2325
|
@click=${o}
|
|
@@ -2339,12 +2339,12 @@ ${s?`**Command:** \`${s}\`
|
|
|
2339
2339
|
${g?r`
|
|
2340
2340
|
<div class="chat-tool-card__status-text muted">Completed</div>
|
|
2341
2341
|
`:v}
|
|
2342
|
-
${c?r`<div class="chat-tool-card__preview mono">${
|
|
2342
|
+
${c?r`<div class="chat-tool-card__preview mono">${Zh(e.text)}</div>`:v}
|
|
2343
2343
|
${u?r`<div class="chat-tool-card__inline mono">${e.text}</div>`:v}
|
|
2344
2344
|
</div>
|
|
2345
|
-
`}function
|
|
2345
|
+
`}function ev(e){return Array.isArray(e)?e.filter(Boolean):[]}function tv(e){if(typeof e!="string")return e;const t=e.trim();if(!t||!t.startsWith("{")&&!t.startsWith("["))return e;try{return JSON.parse(t)}catch{return e}}function nv(e){if(typeof e.text=="string")return e.text;if(typeof e.content=="string")return e.content}function sv(e){const n=e.content,s=[];if(Array.isArray(n))for(const i of n){if(typeof i!="object"||i===null)continue;const a=i;if(a.type==="image"){const o=a.source;if(o?.type==="base64"&&typeof o.data=="string"){const l=o.data,c=o.media_type||"image/png",u=l.startsWith("data:")?l:`data:${c};base64,${l}`;s.push({url:u})}else typeof a.url=="string"&&s.push({url:a.url})}else if(a.type==="image_url"){const o=a.image_url;typeof o?.url=="string"&&s.push({url:o.url})}}return s}function iv(e){return r`
|
|
2346
2346
|
<div class="chat-group assistant">
|
|
2347
|
-
${
|
|
2347
|
+
${ra("assistant",e)}
|
|
2348
2348
|
<div class="chat-group-messages">
|
|
2349
2349
|
<div class="chat-bubble chat-reading-indicator" aria-hidden="true">
|
|
2350
2350
|
<span class="chat-reading-indicator__dots">
|
|
@@ -2353,33 +2353,33 @@ ${s?`**Command:** \`${s}\`
|
|
|
2353
2353
|
</div>
|
|
2354
2354
|
</div>
|
|
2355
2355
|
</div>
|
|
2356
|
-
`}function
|
|
2356
|
+
`}function av(e,t,n,s){const i=new Date(t).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"}),a=s?.name??"Assistant";return r`
|
|
2357
2357
|
<div class="chat-group assistant">
|
|
2358
|
-
${
|
|
2358
|
+
${ra("assistant",s)}
|
|
2359
2359
|
<div class="chat-group-messages">
|
|
2360
|
-
${
|
|
2360
|
+
${Wl({role:"assistant",content:[{type:"text",text:e}],timestamp:t},{isStreaming:!0,showReasoning:!1},n)}
|
|
2361
2361
|
<div class="chat-group-footer">
|
|
2362
2362
|
<span class="chat-sender-name">${a}</span>
|
|
2363
2363
|
<span class="chat-group-timestamp">${i}</span>
|
|
2364
2364
|
</div>
|
|
2365
2365
|
</div>
|
|
2366
2366
|
</div>
|
|
2367
|
-
`}function
|
|
2367
|
+
`}function ov(e,t){const n=oa(e.role),s=t.assistantName??"Assistant",i=n==="user"?"You":n==="assistant"?s:n,a=n==="user"?"user":n==="assistant"?"assistant":"other",o=new Date(e.timestamp).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"});return r`
|
|
2368
2368
|
<div class="chat-group ${a}">
|
|
2369
|
-
${
|
|
2369
|
+
${ra(e.role,{name:s,avatar:t.assistantAvatar??null})}
|
|
2370
2370
|
<div class="chat-group-messages">
|
|
2371
|
-
${e.messages.map((l,c)=>
|
|
2371
|
+
${e.messages.map((l,c)=>Wl(l.message,{isStreaming:e.isStreaming&&c===e.messages.length-1,showReasoning:t.showReasoning},t.onOpenSidebar))}
|
|
2372
2372
|
<div class="chat-group-footer">
|
|
2373
2373
|
<span class="chat-sender-name">${i}</span>
|
|
2374
2374
|
<span class="chat-group-timestamp">${o}</span>
|
|
2375
2375
|
</div>
|
|
2376
2376
|
</div>
|
|
2377
2377
|
</div>
|
|
2378
|
-
`}function
|
|
2378
|
+
`}function ra(e,t){const n=oa(e),s=t?.name?.trim()||"Assistant",i=t?.avatar?.trim()||"",a=n==="user"?"U":n==="assistant"?s.charAt(0).toUpperCase()||"A":n==="tool"?"⚙":"?",o=n==="user"?"user":n==="assistant"?"assistant":n==="tool"?"tool":"other";return i&&n==="assistant"?rv(i)?r`<img
|
|
2379
2379
|
class="chat-avatar ${o}"
|
|
2380
2380
|
src="${i}"
|
|
2381
2381
|
alt="${s}"
|
|
2382
|
-
/>`:r`<div class="chat-avatar ${o}">${i}</div>`:r`<div class="chat-avatar ${o}">${a}</div>`}function
|
|
2382
|
+
/>`:r`<div class="chat-avatar ${o}">${i}</div>`:r`<div class="chat-avatar ${o}">${a}</div>`}function rv(e){return/^https?:\/\//i.test(e)||/^data:image\//i.test(e)||e.startsWith("/")}function lv(e){return e.length===0?v:r`
|
|
2383
2383
|
<div class="chat-message-images">
|
|
2384
2384
|
${e.map(t=>r`
|
|
2385
2385
|
<img
|
|
@@ -2390,15 +2390,15 @@ ${s?`**Command:** \`${s}\`
|
|
|
2390
2390
|
/>
|
|
2391
2391
|
`)}
|
|
2392
2392
|
</div>
|
|
2393
|
-
`}function
|
|
2393
|
+
`}function Wl(e,t,n){const s=e,i=typeof s.role=="string"?s.role:"unknown",a=Hl(e)||i.toLowerCase()==="toolresult"||i.toLowerCase()==="tool_result"||typeof s.toolCallId=="string"||typeof s.tool_call_id=="string",o=Xh(e),l=o.length>0,c=sv(e),u=c.length>0,g=el(e),p=t.showReasoning&&i==="assistant"?Hu(e):null,h=g?.trim()?g:null,d=p?Ku(p):null,f=h,m=i==="assistant"&&!!f?.trim(),S=["chat-bubble",m?"has-copy":"",t.isStreaming?"streaming":"","fade-in"].filter(Boolean).join(" ");return!f&&l&&a?r`${o.map(k=>Uo(k,n))}`:!f&&!l&&!u?v:r`
|
|
2394
2394
|
<div class="${S}">
|
|
2395
|
-
${m?
|
|
2396
|
-
${
|
|
2397
|
-
${d?r`<div class="chat-thinking">${
|
|
2398
|
-
${f?r`<div class="chat-text">${
|
|
2399
|
-
${o.map(k=>
|
|
2395
|
+
${m?Rh(f):v}
|
|
2396
|
+
${lv(c)}
|
|
2397
|
+
${d?r`<div class="chat-thinking">${ui(yi(d))}</div>`:v}
|
|
2398
|
+
${f?r`<div class="chat-text">${ui(yi(f))}</div>`:v}
|
|
2399
|
+
${o.map(k=>Uo(k,n))}
|
|
2400
2400
|
</div>
|
|
2401
|
-
`}function
|
|
2401
|
+
`}function cv(e){return r`
|
|
2402
2402
|
<div class="sidebar-panel">
|
|
2403
2403
|
<div class="sidebar-header">
|
|
2404
2404
|
<div class="sidebar-title">Tool Output</div>
|
|
@@ -2412,12 +2412,12 @@ ${s?`**Command:** \`${s}\`
|
|
|
2412
2412
|
<button @click=${e.onViewRawText} class="btn" style="margin-top: 12px;">
|
|
2413
2413
|
View Raw Text
|
|
2414
2414
|
</button>
|
|
2415
|
-
`:e.content?r`<div class="sidebar-markdown">${
|
|
2415
|
+
`:e.content?r`<div class="sidebar-markdown">${ui(yi(e.content))}</div>`:r`
|
|
2416
2416
|
<div class="muted">No content available</div>
|
|
2417
2417
|
`}
|
|
2418
2418
|
</div>
|
|
2419
2419
|
</div>
|
|
2420
|
-
`}var
|
|
2420
|
+
`}var dv=Object.defineProperty,uv=Object.getOwnPropertyDescriptor,us=(e,t,n,s)=>{for(var i=s>1?void 0:s?uv(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(s?o(t,n,i):o(i))||i);return s&&i&&dv(t,n,i),i};let It=class extends Et{constructor(){super(...arguments),this.splitRatio=.6,this.minRatio=.4,this.maxRatio=.7,this.isDragging=!1,this.startX=0,this.startRatio=0,this.handleMouseDown=e=>{this.isDragging=!0,this.startX=e.clientX,this.startRatio=this.splitRatio,this.classList.add("dragging"),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("mouseup",this.handleMouseUp),e.preventDefault()},this.handleMouseMove=e=>{if(!this.isDragging)return;const t=this.parentElement;if(!t)return;const n=t.getBoundingClientRect().width,i=(e.clientX-this.startX)/n;let a=this.startRatio+i;a=Math.max(this.minRatio,Math.min(this.maxRatio,a)),this.dispatchEvent(new CustomEvent("resize",{detail:{splitRatio:a},bubbles:!0,composed:!0}))},this.handleMouseUp=()=>{this.isDragging=!1,this.classList.remove("dragging"),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp)}}render(){return v}connectedCallback(){super.connectedCallback(),this.addEventListener("mousedown",this.handleMouseDown)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("mousedown",this.handleMouseDown),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp)}};It.styles=ic`
|
|
2421
2421
|
:host {
|
|
2422
2422
|
width: 4px;
|
|
2423
2423
|
cursor: col-resize;
|
|
@@ -2440,15 +2440,15 @@ ${s?`**Command:** \`${s}\`
|
|
|
2440
2440
|
:host(.dragging) {
|
|
2441
2441
|
background: var(--accent, #007bff);
|
|
2442
2442
|
}
|
|
2443
|
-
`;
|
|
2443
|
+
`;us([Jn({type:Number})],It.prototype,"splitRatio",2);us([Jn({type:Number})],It.prototype,"minRatio",2);us([Jn({type:Number})],It.prototype,"maxRatio",2);It=us([pr("resizable-divider")],It);const gv=5e3;function zo(e){e.style.height="auto",e.style.height=`${e.scrollHeight}px`}function pv(e){return e?e.active?r`
|
|
2444
2444
|
<div class="compaction-indicator compaction-indicator--active" role="status" aria-live="polite">
|
|
2445
2445
|
${le.loader} Compacting context...
|
|
2446
2446
|
</div>
|
|
2447
|
-
`:e.completedAt&&Date.now()-e.completedAt<
|
|
2447
|
+
`:e.completedAt&&Date.now()-e.completedAt<gv?r`
|
|
2448
2448
|
<div class="compaction-indicator compaction-indicator--complete" role="status" aria-live="polite">
|
|
2449
2449
|
${le.check} Context compacted
|
|
2450
2450
|
</div>
|
|
2451
|
-
`:v:v}function
|
|
2451
|
+
`:v:v}function fv(){return`att-${Date.now()}-${Math.random().toString(36).slice(2,9)}`}function hv(e,t){const n=e.clipboardData?.items;if(!n||!t.onAttachmentsChange)return;const s=[];for(let i=0;i<n.length;i++){const a=n[i];a.type.startsWith("image/")&&s.push(a)}if(s.length!==0){e.preventDefault();for(const i of s){const a=i.getAsFile();if(!a)continue;const o=new FileReader;o.addEventListener("load",()=>{const l=o.result,c={id:fv(),dataUrl:l,mimeType:a.type},u=t.attachments??[];t.onAttachmentsChange?.([...u,c])}),o.readAsDataURL(a)}}}function vv(e){const t=e.attachments??[];return t.length===0?v:r`
|
|
2452
2452
|
<div class="chat-attachments">
|
|
2453
2453
|
${t.map(n=>r`
|
|
2454
2454
|
<div class="chat-attachment">
|
|
@@ -2468,7 +2468,7 @@ ${s?`**Command:** \`${s}\`
|
|
|
2468
2468
|
</div>
|
|
2469
2469
|
`)}
|
|
2470
2470
|
</div>
|
|
2471
|
-
`}function
|
|
2471
|
+
`}function mv(e){const t=e.connected,n=e.sending||e.stream!==null,s=!!(e.canAbort&&e.onAbort),a=e.sessions?.sessions?.find(d=>d.key===e.sessionKey)?.reasoningLevel??"off",o=e.showThinking&&a!=="off",l={name:e.assistantName,avatar:e.assistantAvatar??e.assistantAvatarUrl??null},c=(e.attachments?.length??0)>0,u=e.connected?c?"Add a message or paste more images...":"Message (↩ to send, Shift+↩ for line breaks, paste images)":"Connect to the gateway to start chatting…",g=e.splitRatio??.6,p=!!(e.sidebarOpen&&e.onCloseSidebar),h=r`
|
|
2472
2472
|
<div
|
|
2473
2473
|
class="chat-thread"
|
|
2474
2474
|
role="log"
|
|
@@ -2478,13 +2478,13 @@ ${s?`**Command:** \`${s}\`
|
|
|
2478
2478
|
${e.loading?r`
|
|
2479
2479
|
<div class="muted">Loading chat…</div>
|
|
2480
2480
|
`:v}
|
|
2481
|
-
${
|
|
2481
|
+
${ul(yv(e),d=>d.key,d=>d.kind==="divider"?r`
|
|
2482
2482
|
<div class="chat-divider" role="separator" data-ts=${String(d.timestamp)}>
|
|
2483
2483
|
<span class="chat-divider__line"></span>
|
|
2484
2484
|
<span class="chat-divider__label">${d.label}</span>
|
|
2485
2485
|
<span class="chat-divider__line"></span>
|
|
2486
2486
|
</div>
|
|
2487
|
-
`:d.kind==="reading-indicator"?
|
|
2487
|
+
`:d.kind==="reading-indicator"?iv(l):d.kind==="stream"?av(d.text,d.startedAt,e.onOpenSidebar,l):d.kind==="group"?ov(d,{onOpenSidebar:e.onOpenSidebar,showReasoning:o,assistantName:e.assistantName,assistantAvatar:l.avatar}):v)}
|
|
2488
2488
|
</div>
|
|
2489
2489
|
`;return r`
|
|
2490
2490
|
<section class="card chat">
|
|
@@ -2520,7 +2520,7 @@ ${s?`**Command:** \`${s}\`
|
|
|
2520
2520
|
@resize=${d=>e.onSplitRatioChange?.(d.detail.splitRatio)}
|
|
2521
2521
|
></resizable-divider>
|
|
2522
2522
|
<div class="chat-sidebar">
|
|
2523
|
-
${
|
|
2523
|
+
${cv({content:e.sidebarContent??null,error:e.sidebarError??null,onClose:e.onCloseSidebar,onViewRawText:()=>{!e.sidebarContent||!e.onOpenSidebar||e.onOpenSidebar(`\`\`\`
|
|
2524
2524
|
${e.sidebarContent}
|
|
2525
2525
|
\`\`\``)}})}
|
|
2526
2526
|
</div>
|
|
@@ -2550,7 +2550,7 @@ ${e.sidebarContent}
|
|
|
2550
2550
|
</div>
|
|
2551
2551
|
`:v}
|
|
2552
2552
|
|
|
2553
|
-
${
|
|
2553
|
+
${pv(e.compactionStatus)}
|
|
2554
2554
|
|
|
2555
2555
|
${e.showNewMessages?r`
|
|
2556
2556
|
<button
|
|
@@ -2563,17 +2563,17 @@ ${e.sidebarContent}
|
|
|
2563
2563
|
`:v}
|
|
2564
2564
|
|
|
2565
2565
|
<div class="chat-compose">
|
|
2566
|
-
${
|
|
2566
|
+
${vv(e)}
|
|
2567
2567
|
<div class="chat-compose__row">
|
|
2568
2568
|
<label class="field chat-compose__field">
|
|
2569
2569
|
<span>Message</span>
|
|
2570
2570
|
<textarea
|
|
2571
|
-
${
|
|
2571
|
+
${mf(d=>d&&zo(d))}
|
|
2572
2572
|
.value=${e.draft}
|
|
2573
2573
|
?disabled=${!e.connected}
|
|
2574
2574
|
@keydown=${d=>{d.key==="Enter"&&(d.isComposing||d.keyCode===229||d.shiftKey||e.connected&&(d.preventDefault(),t&&e.onSend()))}}
|
|
2575
|
-
@input=${d=>{const f=d.target;
|
|
2576
|
-
@paste=${d=>
|
|
2575
|
+
@input=${d=>{const f=d.target;zo(f),e.onDraftChange(f.value)}}
|
|
2576
|
+
@paste=${d=>hv(d,e)}
|
|
2577
2577
|
placeholder=${u}
|
|
2578
2578
|
></textarea>
|
|
2579
2579
|
</label>
|
|
@@ -2596,7 +2596,7 @@ ${e.sidebarContent}
|
|
|
2596
2596
|
</div>
|
|
2597
2597
|
</div>
|
|
2598
2598
|
</section>
|
|
2599
|
-
`}const
|
|
2599
|
+
`}const Ho=200;function bv(e){const t=[];let n=null;for(const s of e){if(s.kind!=="message"){n&&(t.push(n),n=null),t.push(s);continue}const i=zl(s.message),a=oa(i.role),o=i.timestamp||Date.now();!n||n.role!==a?(n&&t.push(n),n={kind:"group",key:`group:${a}:${s.key}`,role:a,messages:[{message:s.message,key:s.key}],timestamp:o,isStreaming:!1}):n.messages.push({message:s.message,key:s.key})}return n&&t.push(n),t}function yv(e){const t=[],n=Array.isArray(e.messages)?e.messages:[],s=Array.isArray(e.toolMessages)?e.toolMessages:[],i=Math.max(0,n.length-Ho);i>0&&t.push({kind:"message",key:"chat:history:notice",message:{role:"system",content:`Showing last ${Ho} messages (${i} hidden).`,timestamp:Date.now()}});for(let a=i;a<n.length;a++){const o=n[a],l=zl(o),u=o.__openclaw;if(u&&u.kind==="compaction"){t.push({kind:"divider",key:typeof u.id=="string"?`divider:compaction:${u.id}`:`divider:compaction:${l.timestamp}:${a}`,label:"Compaction",timestamp:l.timestamp??Date.now()});continue}!e.showThinking&&l.role.toLowerCase()==="toolresult"||t.push({kind:"message",key:jo(o,a),message:o})}if(e.showThinking)for(let a=0;a<s.length;a++)t.push({kind:"message",key:jo(s[a],a+n.length),message:s[a]});if(e.stream!==null){const a=`stream:${e.sessionKey}:${e.streamStartedAt??"live"}`;e.stream.trim().length>0?t.push({kind:"stream",key:a,text:e.stream,startedAt:e.streamStartedAt??Date.now()}):t.push({kind:"reading-indicator",key:a})}return bv(t)}function jo(e,t){const n=e,s=typeof n.toolCallId=="string"?n.toolCallId:"";if(s)return`tool:${s}`;const i=typeof n.id=="string"?n.id:"";if(i)return`msg:${i}`;const a=typeof n.messageId=="string"?n.messageId:"";if(a)return`msg:${a}`;const o=typeof n.timestamp=="number"?n.timestamp:null,l=typeof n.role=="string"?n.role:"unknown";return o!=null?`msg:${l}:${o}:${t}`:`msg:${l}:${t}`}const xi={all:r`
|
|
2600
2600
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
2601
2601
|
<rect x="3" y="3" width="7" height="7"></rect>
|
|
2602
2602
|
<rect x="14" y="3" width="7" height="7"></rect>
|
|
@@ -2790,7 +2790,7 @@ ${e.sidebarContent}
|
|
|
2790
2790
|
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path>
|
|
2791
2791
|
<polyline points="14 2 14 8 20 8"></polyline>
|
|
2792
2792
|
</svg>
|
|
2793
|
-
`},
|
|
2793
|
+
`},Ko=[{key:"env",label:"Environment"},{key:"update",label:"Updates"},{key:"agents",label:"Agents"},{key:"auth",label:"Authentication"},{key:"channels",label:"Channels"},{key:"messages",label:"Messages"},{key:"commands",label:"Commands"},{key:"hooks",label:"Hooks"},{key:"skills",label:"Skills"},{key:"tools",label:"Tools"},{key:"gateway",label:"Gateway"},{key:"wizard",label:"Setup Wizard"}],Wo="__all__";function qo(e){return xi[e]??xi.default}function xv(e,t){const n=Yi[e];return n||{label:t?.title??We(e),description:t?.description??""}}function $v(e){const{key:t,schema:n,uiHints:s}=e;if(!n||we(n)!=="object"||!n.properties)return[];const i=Object.entries(n.properties).map(([a,o])=>{const l=Ae([t,a],s),c=l?.label??o.title??We(a),u=l?.help??o.description??"",g=l?.order??50;return{key:a,label:c,description:u,order:g}});return i.sort((a,o)=>a.order!==o.order?a.order-o.order:a.key.localeCompare(o.key)),i}function wv(e,t){if(!e||!t)return[];const n=[];function s(i,a,o){if(i===a)return;if(typeof i!=typeof a){n.push({path:o,from:i,to:a});return}if(typeof i!="object"||i===null||a===null){i!==a&&n.push({path:o,from:i,to:a});return}if(Array.isArray(i)&&Array.isArray(a)){JSON.stringify(i)!==JSON.stringify(a)&&n.push({path:o,from:i,to:a});return}const l=i,c=a,u=new Set([...Object.keys(l),...Object.keys(c)]);for(const g of u)s(l[g],c[g],o?`${o}.${g}`:g)}return s(e,t,""),n}function Go(e,t=40){let n;try{n=JSON.stringify(e)??String(e)}catch{n=String(e)}return n.length<=t?n:n.slice(0,t-3)+"..."}function kv(e){const t=e.valid==null?"unknown":e.valid?"valid":"invalid",n=yl(e.schema),s=n.schema?n.unsupportedPaths.length>0:!1,i=n.schema?.properties??{},a=Ko.filter(T=>T.key in i),o=new Set(Ko.map(T=>T.key)),l=Object.keys(i).filter(T=>!o.has(T)).map(T=>({key:T,label:T.charAt(0).toUpperCase()+T.slice(1)})),c=[...a,...l],u=e.activeSection&&n.schema&&we(n.schema)==="object"?n.schema.properties?.[e.activeSection]:void 0,g=e.activeSection?xv(e.activeSection,u):null,p=e.activeSection?$v({key:e.activeSection,schema:u,uiHints:e.uiHints}):[],h=e.formMode==="form"&&!!e.activeSection&&p.length>0,d=e.activeSubsection===Wo,f=e.searchQuery||d?null:e.activeSubsection??p[0]?.key??null,m=e.formMode==="form"?wv(e.originalValue,e.formValue):[],S=e.formMode==="raw"&&e.raw!==e.originalRaw,k=e.formMode==="form"?m.length>0:S,$=!!e.formValue&&!e.loading&&!!n.schema,A=e.connected&&!e.saving&&k&&(e.formMode==="raw"?!0:$),C=e.connected&&!e.applying&&!e.updating&&k&&(e.formMode==="raw"?!0:$),_=e.connected&&!e.applying&&!e.updating;return r`
|
|
2794
2794
|
<div class="config-layout">
|
|
2795
2795
|
<!-- Sidebar -->
|
|
2796
2796
|
<aside class="config-sidebar">
|
|
@@ -2837,7 +2837,7 @@ ${e.sidebarContent}
|
|
|
2837
2837
|
class="config-nav__item ${e.activeSection===null?"active":""}"
|
|
2838
2838
|
@click=${()=>e.onSectionChange(null)}
|
|
2839
2839
|
>
|
|
2840
|
-
<span class="config-nav__icon">${
|
|
2840
|
+
<span class="config-nav__icon">${xi.all}</span>
|
|
2841
2841
|
<span class="config-nav__label">All Settings</span>
|
|
2842
2842
|
</button>
|
|
2843
2843
|
${c.map(T=>r`
|
|
@@ -2846,7 +2846,7 @@ ${e.sidebarContent}
|
|
|
2846
2846
|
@click=${()=>e.onSectionChange(T.key)}
|
|
2847
2847
|
>
|
|
2848
2848
|
<span class="config-nav__icon"
|
|
2849
|
-
>${
|
|
2849
|
+
>${qo(T.key)}</span
|
|
2850
2850
|
>
|
|
2851
2851
|
<span class="config-nav__label">${T.label}</span>
|
|
2852
2852
|
</button>
|
|
@@ -2942,11 +2942,11 @@ ${e.sidebarContent}
|
|
|
2942
2942
|
<div class="config-diff__path">${T.path}</div>
|
|
2943
2943
|
<div class="config-diff__values">
|
|
2944
2944
|
<span class="config-diff__from"
|
|
2945
|
-
>${
|
|
2945
|
+
>${Go(T.from)}</span
|
|
2946
2946
|
>
|
|
2947
2947
|
<span class="config-diff__arrow">→</span>
|
|
2948
2948
|
<span class="config-diff__to"
|
|
2949
|
-
>${
|
|
2949
|
+
>${Go(T.to)}</span
|
|
2950
2950
|
>
|
|
2951
2951
|
</div>
|
|
2952
2952
|
</div>
|
|
@@ -2957,7 +2957,7 @@ ${e.sidebarContent}
|
|
|
2957
2957
|
${g&&e.formMode==="form"?r`
|
|
2958
2958
|
<div class="config-section-hero">
|
|
2959
2959
|
<div class="config-section-hero__icon">
|
|
2960
|
-
${
|
|
2960
|
+
${qo(e.activeSection??"")}
|
|
2961
2961
|
</div>
|
|
2962
2962
|
<div class="config-section-hero__text">
|
|
2963
2963
|
<div class="config-section-hero__title">
|
|
@@ -2973,7 +2973,7 @@ ${e.sidebarContent}
|
|
|
2973
2973
|
<div class="config-subnav">
|
|
2974
2974
|
<button
|
|
2975
2975
|
class="config-subnav__item ${f===null?"active":""}"
|
|
2976
|
-
@click=${()=>e.onSubsectionChange(
|
|
2976
|
+
@click=${()=>e.onSubsectionChange(Wo)}
|
|
2977
2977
|
>
|
|
2978
2978
|
All
|
|
2979
2979
|
</button>
|
|
@@ -2997,7 +2997,7 @@ ${e.sidebarContent}
|
|
|
2997
2997
|
<div class="config-loading__spinner"></div>
|
|
2998
2998
|
<span>Loading schema…</span>
|
|
2999
2999
|
</div>
|
|
3000
|
-
`:
|
|
3000
|
+
`:Fp({schema:n.schema,uiHints:e.uiHints,value:e.formValue,disabled:e.loading||!e.formValue,unsupportedPaths:n.unsupportedPaths,onPatch:e.onFormPatch,searchQuery:e.searchQuery,activeSection:e.activeSection,activeSubsection:f})}
|
|
3001
3001
|
${s?r`
|
|
3002
3002
|
<div class="callout danger" style="margin-top: 12px">
|
|
3003
3003
|
Form view can't safely edit some fields. Use Raw to avoid losing config entries.
|
|
@@ -3021,7 +3021,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3021
3021
|
</div>`:v}
|
|
3022
3022
|
</main>
|
|
3023
3023
|
</div>
|
|
3024
|
-
`}function
|
|
3024
|
+
`}function Sv(e){const t=["last",...e.channels.filter(Boolean)],n=e.form.deliveryChannel?.trim();n&&!t.includes(n)&&t.push(n);const s=new Set;return t.filter(i=>s.has(i)?!1:(s.add(i),!0))}function Av(e,t){if(t==="last")return"last";const n=e.channelMeta?.find(s=>s.id===t);return n?.label?n.label:e.channelLabels?.[t]??t}function Cv(e){const t=Sv(e),s=(e.runsJobId==null?void 0:e.jobs.find(a=>a.id===e.runsJobId))?.name??e.runsJobId??"(select a job)",i=e.runs.toSorted((a,o)=>o.ts-a.ts);return r`
|
|
3025
3025
|
<section class="grid grid-cols-2">
|
|
3026
3026
|
<div class="card">
|
|
3027
3027
|
<div class="card-title">Scheduler</div>
|
|
@@ -3039,7 +3039,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3039
3039
|
</div>
|
|
3040
3040
|
<div class="stat">
|
|
3041
3041
|
<div class="stat-label">Next wake</div>
|
|
3042
|
-
<div class="stat-value">${
|
|
3042
|
+
<div class="stat-value">${Qi(e.status?.nextWakeAtMs??null)}</div>
|
|
3043
3043
|
</div>
|
|
3044
3044
|
</div>
|
|
3045
3045
|
<div class="row" style="margin-top: 12px;">
|
|
@@ -3096,7 +3096,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3096
3096
|
</select>
|
|
3097
3097
|
</label>
|
|
3098
3098
|
</div>
|
|
3099
|
-
${
|
|
3099
|
+
${Tv(e)}
|
|
3100
3100
|
<div class="form-grid" style="margin-top: 12px;">
|
|
3101
3101
|
<label class="field">
|
|
3102
3102
|
<span>Session</span>
|
|
@@ -3164,7 +3164,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3164
3164
|
@change=${a=>e.onFormChange({deliveryChannel:a.target.value})}
|
|
3165
3165
|
>
|
|
3166
3166
|
${t.map(a=>r`<option value=${a}>
|
|
3167
|
-
${
|
|
3167
|
+
${Av(e,a)}
|
|
3168
3168
|
</option>`)}
|
|
3169
3169
|
</select>
|
|
3170
3170
|
</label>
|
|
@@ -3194,7 +3194,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3194
3194
|
<div class="muted" style="margin-top: 12px">No jobs yet.</div>
|
|
3195
3195
|
`:r`
|
|
3196
3196
|
<div class="list" style="margin-top: 12px;">
|
|
3197
|
-
${e.jobs.map(a=>
|
|
3197
|
+
${e.jobs.map(a=>_v(a,e))}
|
|
3198
3198
|
</div>
|
|
3199
3199
|
`}
|
|
3200
3200
|
</section>
|
|
@@ -3208,11 +3208,11 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3208
3208
|
<div class="muted" style="margin-top: 12px">No runs yet.</div>
|
|
3209
3209
|
`:r`
|
|
3210
3210
|
<div class="list" style="margin-top: 12px;">
|
|
3211
|
-
${i.map(a=>
|
|
3211
|
+
${i.map(a=>Mv(a,e.basePath))}
|
|
3212
3212
|
</div>
|
|
3213
3213
|
`}
|
|
3214
3214
|
</section>
|
|
3215
|
-
`}function
|
|
3215
|
+
`}function Tv(e){const t=e.form;return t.scheduleKind==="at"?r`
|
|
3216
3216
|
<label class="field" style="margin-top: 12px;">
|
|
3217
3217
|
<span>Run at</span>
|
|
3218
3218
|
<input
|
|
@@ -3259,16 +3259,16 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3259
3259
|
/>
|
|
3260
3260
|
</label>
|
|
3261
3261
|
</div>
|
|
3262
|
-
`}function
|
|
3262
|
+
`}function _v(e,t){const s=`list-item list-item-clickable cron-job${t.runsJobId===e.id?" list-item-selected":""}`;return r`
|
|
3263
3263
|
<div class=${s} @click=${()=>t.onLoadRuns(e.id)}>
|
|
3264
3264
|
<div class="list-main">
|
|
3265
3265
|
<div class="list-title">${e.name}</div>
|
|
3266
|
-
<div class="list-sub">${
|
|
3267
|
-
${
|
|
3266
|
+
<div class="list-sub">${fl(e)}</div>
|
|
3267
|
+
${Ev(e)}
|
|
3268
3268
|
${e.agentId?r`<div class="muted cron-job-agent">Agent: ${e.agentId}</div>`:v}
|
|
3269
3269
|
</div>
|
|
3270
3270
|
<div class="list-meta">
|
|
3271
|
-
${
|
|
3271
|
+
${Lv(e)}
|
|
3272
3272
|
</div>
|
|
3273
3273
|
<div class="cron-job-footer">
|
|
3274
3274
|
<div class="chip-row cron-job-chips">
|
|
@@ -3310,7 +3310,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3310
3310
|
</div>
|
|
3311
3311
|
</div>
|
|
3312
3312
|
</div>
|
|
3313
|
-
`}function
|
|
3313
|
+
`}function Ev(e){if(e.payload.kind==="systemEvent")return r`<div class="cron-job-detail">
|
|
3314
3314
|
<span class="cron-job-detail-label">System</span>
|
|
3315
3315
|
<span class="muted cron-job-detail-value">${e.payload.text}</span>
|
|
3316
3316
|
</div>`;const t=e.delivery,n=t?.channel||t?.to?` (${t.channel??"last"}${t.to?` -> ${t.to}`:""})`:"";return r`
|
|
@@ -3322,7 +3322,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3322
3322
|
<span class="cron-job-detail-label">Delivery</span>
|
|
3323
3323
|
<span class="muted cron-job-detail-value">${t.mode}${n}</span>
|
|
3324
3324
|
</div>`:v}
|
|
3325
|
-
`}function
|
|
3325
|
+
`}function Vo(e){return typeof e!="number"||!Number.isFinite(e)?"n/a":V(e)}function Lv(e){const t=e.state?.lastStatus??"n/a",n=t==="ok"?"cron-job-status-ok":t==="error"?"cron-job-status-error":t==="skipped"?"cron-job-status-skipped":"cron-job-status-na",s=e.state?.nextRunAtMs,i=e.state?.lastRunAtMs;return r`
|
|
3326
3326
|
<div class="cron-job-state">
|
|
3327
3327
|
<div class="cron-job-state-row">
|
|
3328
3328
|
<span class="cron-job-state-key">Status</span>
|
|
@@ -3330,31 +3330,31 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3330
3330
|
</div>
|
|
3331
3331
|
<div class="cron-job-state-row">
|
|
3332
3332
|
<span class="cron-job-state-key">Next</span>
|
|
3333
|
-
<span class="cron-job-state-value" title=${
|
|
3334
|
-
${
|
|
3333
|
+
<span class="cron-job-state-value" title=${ht(s)}>
|
|
3334
|
+
${Vo(s)}
|
|
3335
3335
|
</span>
|
|
3336
3336
|
</div>
|
|
3337
3337
|
<div class="cron-job-state-row">
|
|
3338
3338
|
<span class="cron-job-state-key">Last</span>
|
|
3339
|
-
<span class="cron-job-state-value" title=${
|
|
3340
|
-
${
|
|
3339
|
+
<span class="cron-job-state-value" title=${ht(i)}>
|
|
3340
|
+
${Vo(i)}
|
|
3341
3341
|
</span>
|
|
3342
3342
|
</div>
|
|
3343
3343
|
</div>
|
|
3344
|
-
`}function
|
|
3344
|
+
`}function Mv(e,t){const n=typeof e.sessionKey=="string"&&e.sessionKey.trim().length>0?`${is("chat",t)}?session=${encodeURIComponent(e.sessionKey)}`:null;return r`
|
|
3345
3345
|
<div class="list-item">
|
|
3346
3346
|
<div class="list-main">
|
|
3347
3347
|
<div class="list-title">${e.status}</div>
|
|
3348
3348
|
<div class="list-sub">${e.summary??""}</div>
|
|
3349
3349
|
</div>
|
|
3350
3350
|
<div class="list-meta">
|
|
3351
|
-
<div>${
|
|
3351
|
+
<div>${ht(e.ts)}</div>
|
|
3352
3352
|
<div class="muted">${e.durationMs??0}ms</div>
|
|
3353
3353
|
${n?r`<div><a class="session-link" href=${n}>Open run chat</a></div>`:v}
|
|
3354
3354
|
${e.error?r`<div class="muted">${e.error}</div>`:v}
|
|
3355
3355
|
</div>
|
|
3356
3356
|
</div>
|
|
3357
|
-
`}function
|
|
3357
|
+
`}function Iv(e){const n=(e.status&&typeof e.status=="object"?e.status.securityAudit:null)?.summary??null,s=n?.critical??0,i=n?.warn??0,a=n?.info??0,o=s>0?"danger":i>0?"warn":"success",l=s>0?`${s} critical`:i>0?`${i} warnings`:"No critical issues";return r`
|
|
3358
3358
|
<section class="grid grid-cols-2">
|
|
3359
3359
|
<div class="card">
|
|
3360
3360
|
<div class="row" style="justify-content: space-between;">
|
|
@@ -3437,14 +3437,14 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3437
3437
|
<div class="list-sub">${new Date(c.ts).toLocaleTimeString()}</div>
|
|
3438
3438
|
</div>
|
|
3439
3439
|
<div class="list-meta">
|
|
3440
|
-
<pre class="code-block">${
|
|
3440
|
+
<pre class="code-block">${Zg(c.payload)}</pre>
|
|
3441
3441
|
</div>
|
|
3442
3442
|
</div>
|
|
3443
3443
|
`)}
|
|
3444
3444
|
</div>
|
|
3445
3445
|
`}
|
|
3446
3446
|
</section>
|
|
3447
|
-
`}function
|
|
3447
|
+
`}function Rv(e){const t=Math.max(0,e),n=Math.floor(t/1e3);if(n<60)return`${n}s`;const s=Math.floor(n/60);return s<60?`${s}m`:`${Math.floor(s/60)}h`}function at(e,t){return t?r`<div class="exec-approval-meta-row"><span>${e}</span><span>${t}</span></div>`:v}function Pv(e){const t=e.execApprovalQueue[0];if(!t)return v;const n=t.request,s=t.expiresAtMs-Date.now(),i=s>0?`expires in ${Rv(s)}`:"expired",a=e.execApprovalQueue.length;return r`
|
|
3448
3448
|
<div class="exec-approval-overlay" role="dialog" aria-live="polite">
|
|
3449
3449
|
<div class="exec-approval-card">
|
|
3450
3450
|
<div class="exec-approval-header">
|
|
@@ -3456,13 +3456,13 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3456
3456
|
</div>
|
|
3457
3457
|
<div class="exec-approval-command mono">${n.command}</div>
|
|
3458
3458
|
<div class="exec-approval-meta">
|
|
3459
|
-
${
|
|
3460
|
-
${
|
|
3461
|
-
${
|
|
3462
|
-
${
|
|
3463
|
-
${
|
|
3464
|
-
${
|
|
3465
|
-
${
|
|
3459
|
+
${at("Host",n.host)}
|
|
3460
|
+
${at("Agent",n.agentId)}
|
|
3461
|
+
${at("Session",n.sessionKey)}
|
|
3462
|
+
${at("CWD",n.cwd)}
|
|
3463
|
+
${at("Resolved",n.resolvedPath)}
|
|
3464
|
+
${at("Security",n.security)}
|
|
3465
|
+
${at("Ask",n.ask)}
|
|
3466
3466
|
</div>
|
|
3467
3467
|
${e.execApprovalError?r`<div class="exec-approval-error">${e.execApprovalError}</div>`:v}
|
|
3468
3468
|
<div class="exec-approval-actions">
|
|
@@ -3490,7 +3490,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3490
3490
|
</div>
|
|
3491
3491
|
</div>
|
|
3492
3492
|
</div>
|
|
3493
|
-
`}function
|
|
3493
|
+
`}function Dv(e){const{pendingGatewayUrl:t}=e;return t?r`
|
|
3494
3494
|
<div class="exec-approval-overlay" role="dialog" aria-modal="true" aria-live="polite">
|
|
3495
3495
|
<div class="exec-approval-card">
|
|
3496
3496
|
<div class="exec-approval-header">
|
|
@@ -3519,7 +3519,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3519
3519
|
</div>
|
|
3520
3520
|
</div>
|
|
3521
3521
|
</div>
|
|
3522
|
-
`:v}function
|
|
3522
|
+
`:v}function Fv(e){return r`
|
|
3523
3523
|
<section class="card">
|
|
3524
3524
|
<div class="row" style="justify-content: space-between;">
|
|
3525
3525
|
<div>
|
|
@@ -3539,14 +3539,14 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3539
3539
|
<div class="list" style="margin-top: 16px;">
|
|
3540
3540
|
${e.entries.length===0?r`
|
|
3541
3541
|
<div class="muted">No instances reported yet.</div>
|
|
3542
|
-
`:e.entries.map(t=>
|
|
3542
|
+
`:e.entries.map(t=>Nv(t))}
|
|
3543
3543
|
</div>
|
|
3544
3544
|
</section>
|
|
3545
|
-
`}function
|
|
3545
|
+
`}function Nv(e){const t=e.lastInputSeconds!=null?`${e.lastInputSeconds}s ago`:"n/a",n=e.mode??"unknown",s=Array.isArray(e.roles)?e.roles.filter(Boolean):[],i=Array.isArray(e.scopes)?e.scopes.filter(Boolean):[],a=i.length>0?i.length>3?`${i.length} scopes`:`scopes: ${i.join(", ")}`:null;return r`
|
|
3546
3546
|
<div class="list-item">
|
|
3547
3547
|
<div class="list-main">
|
|
3548
3548
|
<div class="list-title">${e.host??"unknown host"}</div>
|
|
3549
|
-
<div class="list-sub">${
|
|
3549
|
+
<div class="list-sub">${Qg(e)}</div>
|
|
3550
3550
|
<div class="chip-row">
|
|
3551
3551
|
<span class="chip">${n}</span>
|
|
3552
3552
|
${s.map(o=>r`<span class="chip">${o}</span>`)}
|
|
@@ -3558,12 +3558,12 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3558
3558
|
</div>
|
|
3559
3559
|
</div>
|
|
3560
3560
|
<div class="list-meta">
|
|
3561
|
-
<div>${
|
|
3561
|
+
<div>${Yg(e)}</div>
|
|
3562
3562
|
<div class="muted">Last input ${t}</div>
|
|
3563
3563
|
<div class="muted">Reason ${e.reason??""}</div>
|
|
3564
3564
|
</div>
|
|
3565
3565
|
</div>
|
|
3566
|
-
`}const
|
|
3566
|
+
`}const Qo=["trace","debug","info","warn","error","fatal"];function Ov(e){if(!e)return"";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleTimeString()}function Bv(e,t){return t?[e.message,e.subsystem,e.raw].filter(Boolean).join(" ").toLowerCase().includes(t):!0}function Uv(e){const t=e.filterText.trim().toLowerCase(),n=Qo.some(a=>!e.levelFilters[a]),s=e.entries.filter(a=>a.level&&!e.levelFilters[a.level]?!1:Bv(a,t)),i=t||n?"filtered":"visible";return r`
|
|
3567
3567
|
<section class="card">
|
|
3568
3568
|
<div class="row" style="justify-content: space-between;">
|
|
3569
3569
|
<div>
|
|
@@ -3604,7 +3604,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3604
3604
|
</div>
|
|
3605
3605
|
|
|
3606
3606
|
<div class="chip-row" style="margin-top: 12px;">
|
|
3607
|
-
${
|
|
3607
|
+
${Qo.map(a=>r`
|
|
3608
3608
|
<label class="chip log-chip ${a}">
|
|
3609
3609
|
<input
|
|
3610
3610
|
type="checkbox"
|
|
@@ -3627,7 +3627,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3627
3627
|
<div class="muted" style="padding: 12px">No log entries.</div>
|
|
3628
3628
|
`:s.map(a=>r`
|
|
3629
3629
|
<div class="log-row">
|
|
3630
|
-
<div class="log-time mono">${
|
|
3630
|
+
<div class="log-time mono">${Ov(a.time)}</div>
|
|
3631
3631
|
<div class="log-level ${a.level??""}">${a.level??""}</div>
|
|
3632
3632
|
<div class="log-subsystem mono">${a.subsystem??""}</div>
|
|
3633
3633
|
<div class="log-message mono">${a.message??a.raw}</div>
|
|
@@ -3635,10 +3635,10 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3635
3635
|
`)}
|
|
3636
3636
|
</div>
|
|
3637
3637
|
</section>
|
|
3638
|
-
`}function
|
|
3639
|
-
${
|
|
3640
|
-
${
|
|
3641
|
-
${
|
|
3638
|
+
`}function zv(e){const t=Gv(e),n=Xv(e);return r`
|
|
3639
|
+
${tm(n)}
|
|
3640
|
+
${em(t)}
|
|
3641
|
+
${Hv(e)}
|
|
3642
3642
|
<section class="card">
|
|
3643
3643
|
<div class="row" style="justify-content: space-between;">
|
|
3644
3644
|
<div>
|
|
@@ -3652,10 +3652,10 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3652
3652
|
<div class="list" style="margin-top: 16px;">
|
|
3653
3653
|
${e.nodes.length===0?r`
|
|
3654
3654
|
<div class="muted">No nodes found.</div>
|
|
3655
|
-
`:e.nodes.map(s=>
|
|
3655
|
+
`:e.nodes.map(s=>um(s))}
|
|
3656
3656
|
</div>
|
|
3657
3657
|
</section>
|
|
3658
|
-
`}function
|
|
3658
|
+
`}function Hv(e){const t=e.devicesList??{pending:[],paired:[]},n=Array.isArray(t.pending)?t.pending:[],s=Array.isArray(t.paired)?t.paired:[];return r`
|
|
3659
3659
|
<section class="card">
|
|
3660
3660
|
<div class="row" style="justify-content: space-between;">
|
|
3661
3661
|
<div>
|
|
@@ -3670,18 +3670,18 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3670
3670
|
<div class="list" style="margin-top: 16px;">
|
|
3671
3671
|
${n.length>0?r`
|
|
3672
3672
|
<div class="muted" style="margin-bottom: 8px;">Pending</div>
|
|
3673
|
-
${n.map(i=>
|
|
3673
|
+
${n.map(i=>jv(i,e))}
|
|
3674
3674
|
`:v}
|
|
3675
3675
|
${s.length>0?r`
|
|
3676
3676
|
<div class="muted" style="margin-top: 12px; margin-bottom: 8px;">Paired</div>
|
|
3677
|
-
${s.map(i=>
|
|
3677
|
+
${s.map(i=>Kv(i,e))}
|
|
3678
3678
|
`:v}
|
|
3679
3679
|
${n.length===0&&s.length===0?r`
|
|
3680
3680
|
<div class="muted">No paired devices.</div>
|
|
3681
3681
|
`:v}
|
|
3682
3682
|
</div>
|
|
3683
3683
|
</section>
|
|
3684
|
-
`}function
|
|
3684
|
+
`}function jv(e,t){const n=e.displayName?.trim()||e.deviceId,s=typeof e.ts=="number"?V(e.ts):"n/a",i=e.role?.trim()?`role: ${e.role}`:"role: -",a=e.isRepair?" · repair":"",o=e.remoteIp?` · ${e.remoteIp}`:"";return r`
|
|
3685
3685
|
<div class="list-item">
|
|
3686
3686
|
<div class="list-main">
|
|
3687
3687
|
<div class="list-title">${n}</div>
|
|
@@ -3701,7 +3701,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3701
3701
|
</div>
|
|
3702
3702
|
</div>
|
|
3703
3703
|
</div>
|
|
3704
|
-
`}function
|
|
3704
|
+
`}function Kv(e,t){const n=e.displayName?.trim()||e.deviceId,s=e.remoteIp?` · ${e.remoteIp}`:"",i=`roles: ${Qs(e.roles)}`,a=`scopes: ${Qs(e.scopes)}`,o=Array.isArray(e.tokens)?e.tokens:[];return r`
|
|
3705
3705
|
<div class="list-item">
|
|
3706
3706
|
<div class="list-main">
|
|
3707
3707
|
<div class="list-title">${n}</div>
|
|
@@ -3712,12 +3712,12 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3712
3712
|
`:r`
|
|
3713
3713
|
<div class="muted" style="margin-top: 10px;">Tokens</div>
|
|
3714
3714
|
<div style="display: flex; flex-direction: column; gap: 8px; margin-top: 6px;">
|
|
3715
|
-
${o.map(l=>
|
|
3715
|
+
${o.map(l=>Wv(e.deviceId,l,t))}
|
|
3716
3716
|
</div>
|
|
3717
3717
|
`}
|
|
3718
3718
|
</div>
|
|
3719
3719
|
</div>
|
|
3720
|
-
`}function
|
|
3720
|
+
`}function Wv(e,t,n){const s=t.revokedAtMs?"revoked":"active",i=`scopes: ${Qs(t.scopes)}`,a=V(t.rotatedAtMs??t.createdAtMs??t.lastUsedAtMs??null);return r`
|
|
3721
3721
|
<div class="row" style="justify-content: space-between; gap: 8px;">
|
|
3722
3722
|
<div class="list-sub">${t.role} · ${s} · ${i} · ${a}</div>
|
|
3723
3723
|
<div class="row" style="justify-content: flex-end; gap: 6px; flex-wrap: wrap;">
|
|
@@ -3737,7 +3737,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3737
3737
|
`}
|
|
3738
3738
|
</div>
|
|
3739
3739
|
</div>
|
|
3740
|
-
`}const
|
|
3740
|
+
`}const Qe="__defaults__",Yo=[{value:"deny",label:"Deny"},{value:"allowlist",label:"Allowlist"},{value:"full",label:"Full"}],qv=[{value:"off",label:"Off"},{value:"on-miss",label:"On miss"},{value:"always",label:"Always"}];function Gv(e){const t=e.configForm,n=lm(e.nodes),{defaultBinding:s,agents:i}=dm(t),a=!!t,o=e.configSaving||e.configFormMode==="raw";return{ready:a,disabled:o,configDirty:e.configDirty,configLoading:e.configLoading,configSaving:e.configSaving,defaultBinding:s,agents:i,nodes:n,onBindDefault:e.onBindDefault,onBindAgent:e.onBindAgent,onSave:e.onSaveBindings,onLoadConfig:e.onLoadConfig,formMode:e.configFormMode}}function Jo(e){return e==="allowlist"||e==="full"||e==="deny"?e:"deny"}function Vv(e){return e==="always"||e==="off"||e==="on-miss"?e:"on-miss"}function Qv(e){const t=e?.defaults??{};return{security:Jo(t.security),ask:Vv(t.ask),askFallback:Jo(t.askFallback??"deny"),autoAllowSkills:!!(t.autoAllowSkills??!1)}}function Yv(e){const t=e?.agents??{},n=Array.isArray(t.list)?t.list:[],s=[];return n.forEach(i=>{if(!i||typeof i!="object")return;const a=i,o=typeof a.id=="string"?a.id.trim():"";if(!o)return;const l=typeof a.name=="string"?a.name.trim():void 0,c=a.default===!0;s.push({id:o,name:l||void 0,isDefault:c})}),s}function Jv(e,t){const n=Yv(e),s=Object.keys(t?.agents??{}),i=new Map;n.forEach(o=>i.set(o.id,o)),s.forEach(o=>{i.has(o)||i.set(o,{id:o})});const a=Array.from(i.values());return a.length===0&&a.push({id:"main",isDefault:!0}),a.sort((o,l)=>{if(o.isDefault&&!l.isDefault)return-1;if(!o.isDefault&&l.isDefault)return 1;const c=o.name?.trim()?o.name:o.id,u=l.name?.trim()?l.name:l.id;return c.localeCompare(u)}),a}function Zv(e,t){return e===Qe?Qe:e&&t.some(n=>n.id===e)?e:Qe}function Xv(e){const t=e.execApprovalsForm??e.execApprovalsSnapshot?.file??null,n=!!t,s=Qv(t),i=Jv(e.configForm,t),a=cm(e.nodes),o=e.execApprovalsTarget;let l=o==="node"&&e.execApprovalsTargetNodeId?e.execApprovalsTargetNodeId:null;o==="node"&&l&&!a.some(p=>p.id===l)&&(l=null);const c=Zv(e.execApprovalsSelectedAgent,i),u=c!==Qe?(t?.agents??{})[c]??null:null,g=Array.isArray(u?.allowlist)?u.allowlist??[]:[];return{ready:n,disabled:e.execApprovalsSaving||e.execApprovalsLoading,dirty:e.execApprovalsDirty,loading:e.execApprovalsLoading,saving:e.execApprovalsSaving,form:t,defaults:s,selectedScope:c,selectedAgent:u,agents:i,allowlist:g,target:o,targetNodeId:l,targetNodes:a,onSelectScope:e.onExecApprovalsSelectAgent,onSelectTarget:e.onExecApprovalsTargetChange,onPatch:e.onExecApprovalsPatch,onRemove:e.onExecApprovalsRemove,onLoad:e.onLoadExecApprovals,onSave:e.onSaveExecApprovals}}function em(e){const t=e.nodes.length>0,n=e.defaultBinding??"";return r`
|
|
3741
3741
|
<section class="card">
|
|
3742
3742
|
<div class="row" style="justify-content: space-between; align-items: center;">
|
|
3743
3743
|
<div>
|
|
@@ -3792,7 +3792,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3792
3792
|
|
|
3793
3793
|
${e.agents.length===0?r`
|
|
3794
3794
|
<div class="muted">No agents found.</div>
|
|
3795
|
-
`:e.agents.map(s=>
|
|
3795
|
+
`:e.agents.map(s=>rm(s,e))}
|
|
3796
3796
|
</div>
|
|
3797
3797
|
`:r`<div class="row" style="margin-top: 12px; gap: 12px;">
|
|
3798
3798
|
<div class="muted">Load config to edit bindings.</div>
|
|
@@ -3801,7 +3801,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3801
3801
|
</button>
|
|
3802
3802
|
</div>`}
|
|
3803
3803
|
</section>
|
|
3804
|
-
`}function
|
|
3804
|
+
`}function tm(e){const t=e.ready,n=e.target!=="node"||!!e.targetNodeId;return r`
|
|
3805
3805
|
<section class="card">
|
|
3806
3806
|
<div class="row" style="justify-content: space-between; align-items: center;">
|
|
3807
3807
|
<div>
|
|
@@ -3819,12 +3819,12 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3819
3819
|
</button>
|
|
3820
3820
|
</div>
|
|
3821
3821
|
|
|
3822
|
-
${
|
|
3822
|
+
${nm(e)}
|
|
3823
3823
|
|
|
3824
3824
|
${t?r`
|
|
3825
|
-
${
|
|
3826
|
-
${
|
|
3827
|
-
${e.selectedScope===
|
|
3825
|
+
${sm(e)}
|
|
3826
|
+
${im(e)}
|
|
3827
|
+
${e.selectedScope===Qe?v:am(e)}
|
|
3828
3828
|
`:r`<div class="row" style="margin-top: 12px; gap: 12px;">
|
|
3829
3829
|
<div class="muted">Load exec approvals to edit allowlists.</div>
|
|
3830
3830
|
<button class="btn" ?disabled=${e.loading||!n} @click=${e.onLoad}>
|
|
@@ -3832,7 +3832,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3832
3832
|
</button>
|
|
3833
3833
|
</div>`}
|
|
3834
3834
|
</section>
|
|
3835
|
-
`}function
|
|
3835
|
+
`}function nm(e){const t=e.targetNodes.length>0,n=e.targetNodeId??"";return r`
|
|
3836
3836
|
<div class="list" style="margin-top: 12px;">
|
|
3837
3837
|
<div class="list-item">
|
|
3838
3838
|
<div class="list-main">
|
|
@@ -3875,13 +3875,13 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3875
3875
|
<div class="muted">No nodes advertise exec approvals yet.</div>
|
|
3876
3876
|
`:v}
|
|
3877
3877
|
</div>
|
|
3878
|
-
`}function
|
|
3878
|
+
`}function sm(e){return r`
|
|
3879
3879
|
<div class="row" style="margin-top: 12px; gap: 8px; flex-wrap: wrap;">
|
|
3880
3880
|
<span class="label">Scope</span>
|
|
3881
3881
|
<div class="row" style="gap: 8px; flex-wrap: wrap;">
|
|
3882
3882
|
<button
|
|
3883
|
-
class="btn btn--sm ${e.selectedScope===
|
|
3884
|
-
@click=${()=>e.onSelectScope(
|
|
3883
|
+
class="btn btn--sm ${e.selectedScope===Qe?"active":""}"
|
|
3884
|
+
@click=${()=>e.onSelectScope(Qe)}
|
|
3885
3885
|
>
|
|
3886
3886
|
Defaults
|
|
3887
3887
|
</button>
|
|
@@ -3895,7 +3895,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3895
3895
|
`})}
|
|
3896
3896
|
</div>
|
|
3897
3897
|
</div>
|
|
3898
|
-
`}function
|
|
3898
|
+
`}function im(e){const t=e.selectedScope===Qe,n=e.defaults,s=e.selectedAgent??{},i=t?["defaults"]:["agents",e.selectedScope],a=typeof s.security=="string"?s.security:void 0,o=typeof s.ask=="string"?s.ask:void 0,l=typeof s.askFallback=="string"?s.askFallback:void 0,c=t?n.security:a??"__default__",u=t?n.ask:o??"__default__",g=t?n.askFallback:l??"__default__",p=typeof s.autoAllowSkills=="boolean"?s.autoAllowSkills:void 0,h=p??n.autoAllowSkills,d=p==null;return r`
|
|
3899
3899
|
<div class="list" style="margin-top: 16px;">
|
|
3900
3900
|
<div class="list-item">
|
|
3901
3901
|
<div class="list-main">
|
|
@@ -3914,7 +3914,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3914
3914
|
${t?v:r`<option value="__default__" ?selected=${c==="__default__"}>
|
|
3915
3915
|
Use default (${n.security})
|
|
3916
3916
|
</option>`}
|
|
3917
|
-
${
|
|
3917
|
+
${Yo.map(f=>r`<option
|
|
3918
3918
|
value=${f.value}
|
|
3919
3919
|
?selected=${c===f.value}
|
|
3920
3920
|
>
|
|
@@ -3942,7 +3942,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3942
3942
|
${t?v:r`<option value="__default__" ?selected=${u==="__default__"}>
|
|
3943
3943
|
Use default (${n.ask})
|
|
3944
3944
|
</option>`}
|
|
3945
|
-
${
|
|
3945
|
+
${qv.map(f=>r`<option
|
|
3946
3946
|
value=${f.value}
|
|
3947
3947
|
?selected=${u===f.value}
|
|
3948
3948
|
>
|
|
@@ -3970,7 +3970,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3970
3970
|
${t?v:r`<option value="__default__" ?selected=${g==="__default__"}>
|
|
3971
3971
|
Use default (${n.askFallback})
|
|
3972
3972
|
</option>`}
|
|
3973
|
-
${
|
|
3973
|
+
${Yo.map(f=>r`<option
|
|
3974
3974
|
value=${f.value}
|
|
3975
3975
|
?selected=${g===f.value}
|
|
3976
3976
|
>
|
|
@@ -4008,7 +4008,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
4008
4008
|
</div>
|
|
4009
4009
|
</div>
|
|
4010
4010
|
</div>
|
|
4011
|
-
`}function
|
|
4011
|
+
`}function am(e){const t=["agents",e.selectedScope,"allowlist"],n=e.allowlist;return r`
|
|
4012
4012
|
<div class="row" style="margin-top: 18px; justify-content: space-between;">
|
|
4013
4013
|
<div>
|
|
4014
4014
|
<div class="card-title">Allowlist</div>
|
|
@@ -4025,9 +4025,9 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
4025
4025
|
<div class="list" style="margin-top: 12px;">
|
|
4026
4026
|
${n.length===0?r`
|
|
4027
4027
|
<div class="muted">No allowlist entries yet.</div>
|
|
4028
|
-
`:n.map((s,i)=>
|
|
4028
|
+
`:n.map((s,i)=>om(e,s,i))}
|
|
4029
4029
|
</div>
|
|
4030
|
-
`}function
|
|
4030
|
+
`}function om(e,t,n){const s=t.lastUsedAt?V(t.lastUsedAt):"never",i=t.lastUsedCommand?Ys(t.lastUsedCommand,120):null,a=t.lastResolvedPath?Ys(t.lastResolvedPath,120):null;return r`
|
|
4031
4031
|
<div class="list-item">
|
|
4032
4032
|
<div class="list-main">
|
|
4033
4033
|
<div class="list-title">${t.pattern?.trim()?t.pattern:"New pattern"}</div>
|
|
@@ -4054,7 +4054,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
4054
4054
|
</button>
|
|
4055
4055
|
</div>
|
|
4056
4056
|
</div>
|
|
4057
|
-
`}function
|
|
4057
|
+
`}function rm(e,t){const n=e.binding??"__default__",s=e.name?.trim()?`${e.name} (${e.id})`:e.id,i=t.nodes.length>0;return r`
|
|
4058
4058
|
<div class="list-item">
|
|
4059
4059
|
<div class="list-main">
|
|
4060
4060
|
<div class="list-title">${s}</div>
|
|
@@ -4083,7 +4083,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
4083
4083
|
</label>
|
|
4084
4084
|
</div>
|
|
4085
4085
|
</div>
|
|
4086
|
-
`}function
|
|
4086
|
+
`}function lm(e){const t=[];for(const n of e){if(!(Array.isArray(n.commands)?n.commands:[]).some(l=>String(l)==="system.run"))continue;const a=typeof n.nodeId=="string"?n.nodeId.trim():"";if(!a)continue;const o=typeof n.displayName=="string"&&n.displayName.trim()?n.displayName.trim():a;t.push({id:a,label:o===a?a:`${o} · ${a}`})}return t.sort((n,s)=>n.label.localeCompare(s.label)),t}function cm(e){const t=[];for(const n of e){if(!(Array.isArray(n.commands)?n.commands:[]).some(l=>String(l)==="system.execApprovals.get"||String(l)==="system.execApprovals.set"))continue;const a=typeof n.nodeId=="string"?n.nodeId.trim():"";if(!a)continue;const o=typeof n.displayName=="string"&&n.displayName.trim()?n.displayName.trim():a;t.push({id:a,label:o===a?a:`${o} · ${a}`})}return t.sort((n,s)=>n.label.localeCompare(s.label)),t}function dm(e){const t={id:"main",name:void 0,index:0,isDefault:!0,binding:null};if(!e||typeof e!="object")return{defaultBinding:null,agents:[t]};const s=(e.tools??{}).exec??{},i=typeof s.node=="string"&&s.node.trim()?s.node.trim():null,a=e.agents??{},o=Array.isArray(a.list)?a.list:[];if(o.length===0)return{defaultBinding:i,agents:[t]};const l=[];return o.forEach((c,u)=>{if(!c||typeof c!="object")return;const g=c,p=typeof g.id=="string"?g.id.trim():"";if(!p)return;const h=typeof g.name=="string"?g.name.trim():void 0,d=g.default===!0,m=(g.tools??{}).exec??{},S=typeof m.node=="string"&&m.node.trim()?m.node.trim():null;l.push({id:p,name:h||void 0,index:u,isDefault:d,binding:S})}),l.length===0&&l.push(t),{defaultBinding:i,agents:l}}function um(e){const t=!!e.connected,n=!!e.paired,s=typeof e.displayName=="string"&&e.displayName.trim()||(typeof e.nodeId=="string"?e.nodeId:"unknown"),i=Array.isArray(e.caps)?e.caps:[],a=Array.isArray(e.commands)?e.commands:[];return r`
|
|
4087
4087
|
<div class="list-item">
|
|
4088
4088
|
<div class="list-main">
|
|
4089
4089
|
<div class="list-title">${s}</div>
|
|
@@ -4102,7 +4102,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
4102
4102
|
</div>
|
|
4103
4103
|
</div>
|
|
4104
4104
|
</div>
|
|
4105
|
-
`}function
|
|
4105
|
+
`}function gm(e){const t=e.hello?.snapshot,n=t?.uptimeMs?Pi(t.uptimeMs):"n/a",s=t?.policy?.tickIntervalMs?`${t.policy.tickIntervalMs}ms`:"n/a",i=(()=>{if(e.connected||!e.lastError)return null;const o=e.lastError.toLowerCase();if(!(o.includes("unauthorized")||o.includes("connect failed")))return null;const c=!!e.settings.token.trim(),u=!!e.password.trim();return!c&&!u?r`
|
|
4106
4106
|
<div class="muted" style="margin-top: 8px">
|
|
4107
4107
|
This gateway requires auth. Add a token or password, then click Connect.
|
|
4108
4108
|
<div style="margin-top: 6px">
|
|
@@ -4261,7 +4261,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
4261
4261
|
<div class="stat-value">
|
|
4262
4262
|
${e.cronEnabled==null?"n/a":e.cronEnabled?"Enabled":"Disabled"}
|
|
4263
4263
|
</div>
|
|
4264
|
-
<div class="muted">Next wake ${
|
|
4264
|
+
<div class="muted">Next wake ${Qi(e.cronNext)}</div>
|
|
4265
4265
|
</div>
|
|
4266
4266
|
</section>
|
|
4267
4267
|
|
|
@@ -4285,7 +4285,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
4285
4285
|
</div>
|
|
4286
4286
|
</div>
|
|
4287
4287
|
</section>
|
|
4288
|
-
`}const
|
|
4288
|
+
`}const pm=["","off","minimal","low","medium","high","xhigh"],fm=["","off","on"],hm=[{value:"",label:"inherit"},{value:"off",label:"off (explicit)"},{value:"on",label:"on"},{value:"full",label:"full"}],vm=["","off","on","stream"];function mm(e){if(!e)return"";const t=e.trim().toLowerCase();return t==="z.ai"||t==="z-ai"?"zai":t}function ql(e){return mm(e)==="zai"}function bm(e){return ql(e)?fm:pm}function Zo(e,t){return t?e.includes(t)?[...e]:[...e,t]:[...e]}function ym(e,t){return t?e.some(n=>n.value===t)?[...e]:[...e,{value:t,label:`${t} (custom)`}]:[...e]}function xm(e,t){return!t||!e||e==="off"?e:"on"}function $m(e,t){return e?t&&e==="on"?"low":e:null}function wm(e){const t=e.result?.sessions??[];return r`
|
|
4289
4289
|
<section class="card">
|
|
4290
4290
|
<div class="row" style="justify-content: space-between;">
|
|
4291
4291
|
<div>
|
|
@@ -4350,10 +4350,10 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
4350
4350
|
</div>
|
|
4351
4351
|
${t.length===0?r`
|
|
4352
4352
|
<div class="muted">No sessions found.</div>
|
|
4353
|
-
`:t.map(n=>
|
|
4353
|
+
`:t.map(n=>km(n,e.basePath,e.onPatch,e.onDelete,e.loading))}
|
|
4354
4354
|
</div>
|
|
4355
4355
|
</section>
|
|
4356
|
-
`}function
|
|
4356
|
+
`}function km(e,t,n,s,i){const a=e.updatedAt?V(e.updatedAt):"n/a",o=e.thinkingLevel??"",l=ql(e.modelProvider),c=xm(o,l),u=Zo(bm(e.modelProvider),c),g=e.verboseLevel??"",p=ym(hm,g),h=e.reasoningLevel??"",d=Zo(vm,h),f=typeof e.displayName=="string"&&e.displayName.trim().length>0?e.displayName.trim():null,m=typeof e.label=="string"?e.label.trim():"",S=!!(f&&f!==e.key&&f!==m),k=e.kind!=="global",$=k?`${is("chat",t)}?session=${encodeURIComponent(e.key)}`:null;return r`
|
|
4357
4357
|
<div class="table-row">
|
|
4358
4358
|
<div class="mono session-key-cell">
|
|
4359
4359
|
${k?r`<a href=${$} class="session-link">${e.key}</a>`:e.key}
|
|
@@ -4369,11 +4369,11 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
4369
4369
|
</div>
|
|
4370
4370
|
<div>${e.kind}</div>
|
|
4371
4371
|
<div>${a}</div>
|
|
4372
|
-
<div>${
|
|
4372
|
+
<div>${Jg(e)}</div>
|
|
4373
4373
|
<div>
|
|
4374
4374
|
<select
|
|
4375
4375
|
?disabled=${i}
|
|
4376
|
-
@change=${A=>{const C=A.target.value;n(e.key,{thinkingLevel
|
|
4376
|
+
@change=${A=>{const C=A.target.value;n(e.key,{thinkingLevel:$m(C,l)})}}
|
|
4377
4377
|
>
|
|
4378
4378
|
${u.map(A=>r`<option value=${A} ?selected=${c===A}>
|
|
4379
4379
|
${A||"inherit"}
|
|
@@ -4406,7 +4406,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
4406
4406
|
</button>
|
|
4407
4407
|
</div>
|
|
4408
4408
|
</div>
|
|
4409
|
-
`}const
|
|
4409
|
+
`}const _n=[{id:"workspace",label:"Workspace Skills",sources:["openclaw-workspace"]},{id:"built-in",label:"Built-in Skills",sources:["openclaw-bundled"]},{id:"installed",label:"Installed Skills",sources:["openclaw-managed"]},{id:"extra",label:"Extra Skills",sources:["openclaw-extra"]}];function Sm(e){const t=new Map;for(const a of _n)t.set(a.id,{id:a.id,label:a.label,skills:[]});const n=_n.find(a=>a.id==="built-in"),s={id:"other",label:"Other Skills",skills:[]};for(const a of e){const o=a.bundled?n:_n.find(l=>l.sources.includes(a.source));o?t.get(o.id)?.skills.push(a):s.skills.push(a)}const i=_n.map(a=>t.get(a.id)).filter(a=>!!(a&&a.skills.length>0));return s.skills.length>0&&i.push(s),i}function Am(e){const t=e.report?.skills??[],n=e.filter.trim().toLowerCase(),s=n?t.filter(a=>[a.name,a.description,a.source].join(" ").toLowerCase().includes(n)):t,i=Sm(s);return r`
|
|
4410
4410
|
<section class="card">
|
|
4411
4411
|
<div class="row" style="justify-content: space-between;">
|
|
4412
4412
|
<div>
|
|
@@ -4443,20 +4443,20 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
4443
4443
|
<span class="muted">${a.skills.length}</span>
|
|
4444
4444
|
</summary>
|
|
4445
4445
|
<div class="list skills-grid">
|
|
4446
|
-
${a.skills.map(l=>
|
|
4446
|
+
${a.skills.map(l=>Cm(l,e))}
|
|
4447
4447
|
</div>
|
|
4448
4448
|
</details>
|
|
4449
4449
|
`})}
|
|
4450
4450
|
</div>
|
|
4451
4451
|
`}
|
|
4452
4452
|
</section>
|
|
4453
|
-
`}function
|
|
4453
|
+
`}function Cm(e,t){const n=t.busyKey===e.skillKey,s=t.edits[e.skillKey]??"",i=t.messages[e.skillKey]??null,a=e.install.length>0&&e.missing.bins.length>0,o=!!(e.bundled&&e.source!=="openclaw-bundled"),l=[...e.missing.bins.map(u=>`bin:${u}`),...e.missing.env.map(u=>`env:${u}`),...e.missing.config.map(u=>`config:${u}`),...e.missing.os.map(u=>`os:${u}`)],c=[];return e.disabled&&c.push("disabled"),e.blockedByAllowlist&&c.push("blocked by allowlist"),r`
|
|
4454
4454
|
<div class="list-item">
|
|
4455
4455
|
<div class="list-main">
|
|
4456
4456
|
<div class="list-title">
|
|
4457
4457
|
${e.emoji?`${e.emoji} `:""}${e.name}
|
|
4458
4458
|
</div>
|
|
4459
|
-
<div class="list-sub">${
|
|
4459
|
+
<div class="list-sub">${Ys(e.description,140)}</div>
|
|
4460
4460
|
<div class="chip-row" style="margin-top: 6px;">
|
|
4461
4461
|
<span class="chip">${e.source}</span>
|
|
4462
4462
|
${o?r`
|
|
@@ -4523,9 +4523,9 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
4523
4523
|
`:v}
|
|
4524
4524
|
</div>
|
|
4525
4525
|
</div>
|
|
4526
|
-
`}const
|
|
4526
|
+
`}const Tm=new Set(["agent","channel","chat","provider","model","tool","label","key","session","id","has","mintokens","maxtokens","mincost","maxcost","minmessages","maxmessages"]),qn=e=>e.trim().toLowerCase(),_m=e=>{const t=e.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*").replace(/\?/g,".");return new RegExp(`^${t}$`,"i")},lt=e=>{let t=e.trim().toLowerCase();if(!t)return null;t.startsWith("$")&&(t=t.slice(1));let n=1;t.endsWith("k")?(n=1e3,t=t.slice(0,-1)):t.endsWith("m")&&(n=1e6,t=t.slice(0,-1));const s=Number(t);return Number.isFinite(s)?s*n:null},la=e=>(e.match(/"[^"]+"|\S+/g)??[]).map(n=>{const s=n.replace(/^"|"$/g,""),i=s.indexOf(":");if(i>0){const a=s.slice(0,i),o=s.slice(i+1);return{key:a,value:o,raw:s}}return{value:s,raw:s}}),Em=e=>[e.label,e.key,e.sessionId].filter(n=>!!n).map(n=>n.toLowerCase()),Xo=e=>{const t=new Set;e.modelProvider&&t.add(e.modelProvider.toLowerCase()),e.providerOverride&&t.add(e.providerOverride.toLowerCase()),e.origin?.provider&&t.add(e.origin.provider.toLowerCase());for(const n of e.usage?.modelUsage??[])n.provider&&t.add(n.provider.toLowerCase());return Array.from(t)},er=e=>{const t=new Set;e.model&&t.add(e.model.toLowerCase());for(const n of e.usage?.modelUsage??[])n.model&&t.add(n.model.toLowerCase());return Array.from(t)},Lm=e=>(e.usage?.toolUsage?.tools??[]).map(t=>t.name.toLowerCase()),Mm=(e,t)=>{const n=qn(t.value??"");if(!n)return!0;if(!t.key)return Em(e).some(i=>i.includes(n));switch(qn(t.key)){case"agent":return e.agentId?.toLowerCase().includes(n)??!1;case"channel":return e.channel?.toLowerCase().includes(n)??!1;case"chat":return e.chatType?.toLowerCase().includes(n)??!1;case"provider":return Xo(e).some(i=>i.includes(n));case"model":return er(e).some(i=>i.includes(n));case"tool":return Lm(e).some(i=>i.includes(n));case"label":return e.label?.toLowerCase().includes(n)??!1;case"key":case"session":case"id":if(n.includes("*")||n.includes("?")){const i=_m(n);return i.test(e.key)||(e.sessionId?i.test(e.sessionId):!1)}return e.key.toLowerCase().includes(n)||(e.sessionId?.toLowerCase().includes(n)??!1);case"has":switch(n){case"tools":return(e.usage?.toolUsage?.totalCalls??0)>0;case"errors":return(e.usage?.messageCounts?.errors??0)>0;case"context":return!!e.contextWeight;case"usage":return!!e.usage;case"model":return er(e).length>0;case"provider":return Xo(e).length>0;default:return!0}case"mintokens":{const i=lt(n);return i===null?!0:(e.usage?.totalTokens??0)>=i}case"maxtokens":{const i=lt(n);return i===null?!0:(e.usage?.totalTokens??0)<=i}case"mincost":{const i=lt(n);return i===null?!0:(e.usage?.totalCost??0)>=i}case"maxcost":{const i=lt(n);return i===null?!0:(e.usage?.totalCost??0)<=i}case"minmessages":{const i=lt(n);return i===null?!0:(e.usage?.messageCounts?.total??0)>=i}case"maxmessages":{const i=lt(n);return i===null?!0:(e.usage?.messageCounts?.total??0)<=i}default:return!0}},Im=(e,t)=>{const n=la(t);if(n.length===0)return{sessions:e,warnings:[]};const s=[];for(const a of n){if(!a.key)continue;const o=qn(a.key);if(!Tm.has(o)){s.push(`Unknown filter: ${a.key}`);continue}if(a.value===""&&s.push(`Missing value for ${a.key}`),o==="has"){const l=new Set(["tools","errors","context","usage","model","provider"]);a.value&&!l.has(qn(a.value))&&s.push(`Unknown has:${a.value}`)}["mintokens","maxtokens","mincost","maxcost","minmessages","maxmessages"].includes(o)&&a.value&<(a.value)===null&&s.push(`Invalid number for ${a.key}`)}return{sessions:e.filter(a=>n.every(o=>Mm(a,o))),warnings:s}};function Rm(e){const t=e.split(`
|
|
4527
4527
|
`),n=new Map,s=[];for(const l of t){const c=/^\[Tool:\s*([^\]]+)\]/.exec(l.trim());if(c){const u=c[1];n.set(u,(n.get(u)??0)+1);continue}l.trim().startsWith("[Tool Result]")||s.push(l)}const i=Array.from(n.entries()).toSorted((l,c)=>c[1]-l[1]),a=i.reduce((l,[,c])=>l+c,0),o=i.length>0?`Tools: ${i.map(([l,c])=>`${l}×${c}`).join(", ")} (${a} calls)`:"";return{tools:i,summary:o,cleanContent:s.join(`
|
|
4528
|
-
`).trim()}}const
|
|
4528
|
+
`).trim()}}const Pm=`
|
|
4529
4529
|
.usage-page-header {
|
|
4530
4530
|
margin: 4px 0 12px;
|
|
4531
4531
|
}
|
|
@@ -6435,7 +6435,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
6435
6435
|
height: 22px;
|
|
6436
6436
|
}
|
|
6437
6437
|
}
|
|
6438
|
-
`,
|
|
6438
|
+
`,Dm=4;function ot(e){return Math.round(e/Dm)}function O(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function Fm(e){const t=new Date;return t.setHours(e,0,0,0),t.toLocaleTimeString(void 0,{hour:"numeric"})}function Nm(e,t){const n=Array.from({length:24},()=>0),s=Array.from({length:24},()=>0);for(const i of e){const a=i.usage;if(!a?.messageCounts||a.messageCounts.total===0)continue;const o=a.firstActivity??i.updatedAt,l=a.lastActivity??i.updatedAt;if(!o||!l)continue;const c=Math.min(o,l),u=Math.max(o,l),p=Math.max(u-c,1)/6e4;let h=c;for(;h<u;){const d=new Date(h),f=ca(d,t),m=da(d,t),S=Math.min(m.getTime(),u),$=Math.max((S-h)/6e4,0)/p;n[f]+=a.messageCounts.errors*$,s[f]+=a.messageCounts.total*$,h=S+1}}return s.map((i,a)=>{const o=n[a],l=i>0?o/i:0;return{hour:a,rate:l,errors:o,msgs:i}}).filter(i=>i.msgs>0&&i.errors>0).toSorted((i,a)=>a.rate-i.rate).slice(0,5).map(i=>({label:Fm(i.hour),value:`${(i.rate*100).toFixed(2)}%`,sub:`${Math.round(i.errors)} errors · ${Math.round(i.msgs)} msgs`}))}const Om=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function ca(e,t){return t==="utc"?e.getUTCHours():e.getHours()}function Bm(e,t){return t==="utc"?e.getUTCDay():e.getDay()}function da(e,t){const n=new Date(e);return t==="utc"?n.setUTCMinutes(59,59,999):n.setMinutes(59,59,999),n}function Um(e,t){const n=Array.from({length:24},()=>0),s=Array.from({length:7},()=>0);let i=0,a=!1;for(const l of e){const c=l.usage;if(!c||!c.totalTokens||c.totalTokens<=0)continue;i+=c.totalTokens;const u=c.firstActivity??l.updatedAt,g=c.lastActivity??l.updatedAt;if(!u||!g)continue;a=!0;const p=Math.min(u,g),h=Math.max(u,g),f=Math.max(h-p,1)/6e4;let m=p;for(;m<h;){const S=new Date(m),k=ca(S,t),$=Bm(S,t),A=da(S,t),C=Math.min(A.getTime(),h),T=Math.max((C-m)/6e4,0)/f;n[k]+=c.totalTokens*T,s[$]+=c.totalTokens*T,m=C+1}}const o=Om.map((l,c)=>({label:l,tokens:s[c]}));return{hasData:a,totalTokens:i,hourTotals:n,weekdayTotals:o}}function zm(e,t,n,s){const i=Um(e,t);if(!i.hasData)return r`
|
|
6439
6439
|
<div class="card usage-mosaic">
|
|
6440
6440
|
<div class="usage-mosaic-header">
|
|
6441
6441
|
<div>
|
|
@@ -6499,10 +6499,10 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
6499
6499
|
</div>
|
|
6500
6500
|
</div>
|
|
6501
6501
|
</div>
|
|
6502
|
-
`}function
|
|
6503
|
-
`)?`"${e.replace(/"/g,'""')}"`:e}function
|
|
6504
|
-
`)},
|
|
6505
|
-
`)},
|
|
6502
|
+
`}function G(e,t=2){return`$${e.toFixed(t)}`}function js(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function Gl(e){const t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!t)return null;const[,n,s,i]=t,a=new Date(Date.UTC(Number(n),Number(s)-1,Number(i)));return Number.isNaN(a.valueOf())?null:a}function Vl(e){const t=Gl(e);return t?t.toLocaleDateString(void 0,{month:"short",day:"numeric"}):e}function Hm(e){const t=Gl(e);return t?t.toLocaleDateString(void 0,{month:"long",day:"numeric",year:"numeric"}):e}function Ks(e,t,n="text/plain"){const s=new Blob([t],{type:n}),i=URL.createObjectURL(s),a=document.createElement("a");a.href=i,a.download=e,a.click(),URL.revokeObjectURL(i)}function jm(e){return e.includes('"')||e.includes(",")||e.includes(`
|
|
6503
|
+
`)?`"${e.replace(/"/g,'""')}"`:e}function Gn(e){return e.map(t=>t==null?"":jm(String(t))).join(",")}const En=()=>({input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,totalCost:0,inputCost:0,outputCost:0,cacheReadCost:0,cacheWriteCost:0,missingCostEntries:0}),Ln=(e,t)=>{e.input+=t.input??0,e.output+=t.output??0,e.cacheRead+=t.cacheRead??0,e.cacheWrite+=t.cacheWrite??0,e.totalTokens+=t.totalTokens??0,e.totalCost+=t.totalCost??0,e.inputCost+=t.inputCost??0,e.outputCost+=t.outputCost??0,e.cacheReadCost+=t.cacheReadCost??0,e.cacheWriteCost+=t.cacheWriteCost??0,e.missingCostEntries+=t.missingCostEntries??0},Km=(e,t)=>{if(e.length===0)return t??{messages:{total:0,user:0,assistant:0,toolCalls:0,toolResults:0,errors:0},tools:{totalCalls:0,uniqueTools:0,tools:[]},byModel:[],byProvider:[],byAgent:[],byChannel:[],daily:[]};const n={total:0,user:0,assistant:0,toolCalls:0,toolResults:0,errors:0},s=new Map,i=new Map,a=new Map,o=new Map,l=new Map,c=new Map,u=new Map,g=new Map,p={count:0,sum:0,min:Number.POSITIVE_INFINITY,max:0,p95Max:0};for(const h of e){const d=h.usage;if(d){if(d.messageCounts&&(n.total+=d.messageCounts.total,n.user+=d.messageCounts.user,n.assistant+=d.messageCounts.assistant,n.toolCalls+=d.messageCounts.toolCalls,n.toolResults+=d.messageCounts.toolResults,n.errors+=d.messageCounts.errors),d.toolUsage)for(const f of d.toolUsage.tools)s.set(f.name,(s.get(f.name)??0)+f.count);if(d.modelUsage)for(const f of d.modelUsage){const m=`${f.provider??"unknown"}::${f.model??"unknown"}`,S=i.get(m)??{provider:f.provider,model:f.model,count:0,totals:En()};S.count+=f.count,Ln(S.totals,f.totals),i.set(m,S);const k=f.provider??"unknown",$=a.get(k)??{provider:f.provider,model:void 0,count:0,totals:En()};$.count+=f.count,Ln($.totals,f.totals),a.set(k,$)}if(d.latency){const{count:f,avgMs:m,minMs:S,maxMs:k,p95Ms:$}=d.latency;f>0&&(p.count+=f,p.sum+=m*f,p.min=Math.min(p.min,S),p.max=Math.max(p.max,k),p.p95Max=Math.max(p.p95Max,$))}if(h.agentId){const f=o.get(h.agentId)??En();Ln(f,d),o.set(h.agentId,f)}if(h.channel){const f=l.get(h.channel)??En();Ln(f,d),l.set(h.channel,f)}for(const f of d.dailyBreakdown??[]){const m=c.get(f.date)??{date:f.date,tokens:0,cost:0,messages:0,toolCalls:0,errors:0};m.tokens+=f.tokens,m.cost+=f.cost,c.set(f.date,m)}for(const f of d.dailyMessageCounts??[]){const m=c.get(f.date)??{date:f.date,tokens:0,cost:0,messages:0,toolCalls:0,errors:0};m.messages+=f.total,m.toolCalls+=f.toolCalls,m.errors+=f.errors,c.set(f.date,m)}for(const f of d.dailyLatency??[]){const m=u.get(f.date)??{date:f.date,count:0,sum:0,min:Number.POSITIVE_INFINITY,max:0,p95Max:0};m.count+=f.count,m.sum+=f.avgMs*f.count,m.min=Math.min(m.min,f.minMs),m.max=Math.max(m.max,f.maxMs),m.p95Max=Math.max(m.p95Max,f.p95Ms),u.set(f.date,m)}for(const f of d.dailyModelUsage??[]){const m=`${f.date}::${f.provider??"unknown"}::${f.model??"unknown"}`,S=g.get(m)??{date:f.date,provider:f.provider,model:f.model,tokens:0,cost:0,count:0};S.tokens+=f.tokens,S.cost+=f.cost,S.count+=f.count,g.set(m,S)}}}return{messages:n,tools:{totalCalls:Array.from(s.values()).reduce((h,d)=>h+d,0),uniqueTools:s.size,tools:Array.from(s.entries()).map(([h,d])=>({name:h,count:d})).toSorted((h,d)=>d.count-h.count)},byModel:Array.from(i.values()).toSorted((h,d)=>d.totals.totalCost-h.totals.totalCost),byProvider:Array.from(a.values()).toSorted((h,d)=>d.totals.totalCost-h.totals.totalCost),byAgent:Array.from(o.entries()).map(([h,d])=>({agentId:h,totals:d})).toSorted((h,d)=>d.totals.totalCost-h.totals.totalCost),byChannel:Array.from(l.entries()).map(([h,d])=>({channel:h,totals:d})).toSorted((h,d)=>d.totals.totalCost-h.totals.totalCost),latency:p.count>0?{count:p.count,avgMs:p.sum/p.count,minMs:p.min===Number.POSITIVE_INFINITY?0:p.min,maxMs:p.max,p95Ms:p.p95Max}:void 0,dailyLatency:Array.from(u.values()).map(h=>({date:h.date,count:h.count,avgMs:h.count?h.sum/h.count:0,minMs:h.min===Number.POSITIVE_INFINITY?0:h.min,maxMs:h.max,p95Ms:h.p95Max})).toSorted((h,d)=>h.date.localeCompare(d.date)),modelDaily:Array.from(g.values()).toSorted((h,d)=>h.date.localeCompare(d.date)||d.cost-h.cost),daily:Array.from(c.values()).toSorted((h,d)=>h.date.localeCompare(d.date))}},Wm=(e,t,n)=>{let s=0,i=0;for(const g of e){const p=g.usage?.durationMs??0;p>0&&(s+=p,i+=1)}const a=i?s/i:0,o=t&&s>0?t.totalTokens/(s/6e4):void 0,l=t&&s>0?t.totalCost/(s/6e4):void 0,c=n.messages.total?n.messages.errors/n.messages.total:0,u=n.daily.filter(g=>g.messages>0&&g.errors>0).map(g=>({date:g.date,errors:g.errors,messages:g.messages,rate:g.errors/g.messages})).toSorted((g,p)=>p.rate-g.rate||p.errors-g.errors)[0];return{durationSumMs:s,durationCount:i,avgDurationMs:a,throughputTokensPerMin:o,throughputCostPerMin:l,errorRate:c,peakErrorDay:u}},qm=e=>{const t=[Gn(["key","label","agentId","channel","provider","model","updatedAt","durationMs","messages","errors","toolCalls","inputTokens","outputTokens","cacheReadTokens","cacheWriteTokens","totalTokens","totalCost"])];for(const n of e){const s=n.usage;t.push(Gn([n.key,n.label??"",n.agentId??"",n.channel??"",n.modelProvider??n.providerOverride??"",n.model??n.modelOverride??"",n.updatedAt?new Date(n.updatedAt).toISOString():"",s?.durationMs??"",s?.messageCounts?.total??"",s?.messageCounts?.errors??"",s?.messageCounts?.toolCalls??"",s?.input??"",s?.output??"",s?.cacheRead??"",s?.cacheWrite??"",s?.totalTokens??"",s?.totalCost??""]))}return t.join(`
|
|
6504
|
+
`)},Gm=e=>{const t=[Gn(["date","inputTokens","outputTokens","cacheReadTokens","cacheWriteTokens","totalTokens","inputCost","outputCost","cacheReadCost","cacheWriteCost","totalCost"])];for(const n of e)t.push(Gn([n.date,n.input,n.output,n.cacheRead,n.cacheWrite,n.totalTokens,n.inputCost??"",n.outputCost??"",n.cacheReadCost??"",n.cacheWriteCost??"",n.totalCost]));return t.join(`
|
|
6505
|
+
`)},Vm=(e,t,n)=>{const s=e.trim();if(!s)return[];const i=s.length?s.split(/\s+/):[],a=i.length?i[i.length-1]:"",[o,l]=a.includes(":")?[a.slice(0,a.indexOf(":")),a.slice(a.indexOf(":")+1)]:["",""],c=o.toLowerCase(),u=l.toLowerCase(),g=$=>{const A=new Set;for(const C of $)C&&A.add(C);return Array.from(A)},p=g(t.map($=>$.agentId)).slice(0,6),h=g(t.map($=>$.channel)).slice(0,6),d=g([...t.map($=>$.modelProvider),...t.map($=>$.providerOverride),...n?.byProvider.map($=>$.provider)??[]]).slice(0,6),f=g([...t.map($=>$.model),...n?.byModel.map($=>$.model)??[]]).slice(0,6),m=g(n?.tools.tools.map($=>$.name)??[]).slice(0,6);if(!c)return[{label:"agent:",value:"agent:"},{label:"channel:",value:"channel:"},{label:"provider:",value:"provider:"},{label:"model:",value:"model:"},{label:"tool:",value:"tool:"},{label:"has:errors",value:"has:errors"},{label:"has:tools",value:"has:tools"},{label:"minTokens:",value:"minTokens:"},{label:"maxCost:",value:"maxCost:"}];const S=[],k=($,A)=>{for(const C of A)(!u||C.toLowerCase().includes(u))&&S.push({label:`${$}:${C}`,value:`${$}:${C}`})};switch(c){case"agent":k("agent",p);break;case"channel":k("channel",h);break;case"provider":k("provider",d);break;case"model":k("model",f);break;case"tool":k("tool",m);break;case"has":["errors","tools","context","usage","model","provider"].forEach($=>{(!u||$.includes(u))&&S.push({label:`has:${$}`,value:`has:${$}`})});break}return S},Qm=(e,t)=>{const n=e.trim();if(!n)return`${t} `;const s=n.split(/\s+/);return s[s.length-1]=t,`${s.join(" ")} `},ct=e=>e.trim().toLowerCase(),Ym=(e,t)=>{const n=e.trim();if(!n)return`${t} `;const s=n.split(/\s+/),i=s[s.length-1]??"",a=t.includes(":")?t.split(":")[0]:null,o=i.includes(":")?i.split(":")[0]:null;return i.endsWith(":")&&a&&o===a?(s[s.length-1]=t,`${s.join(" ")} `):s.includes(t)?`${s.join(" ")} `:`${s.join(" ")} ${t} `},tr=(e,t)=>{const s=e.trim().split(/\s+/).filter(Boolean).filter(i=>i!==t);return s.length?`${s.join(" ")} `:""},nr=(e,t,n)=>{const s=ct(t),a=[...la(e).filter(o=>ct(o.key??"")!==s).map(o=>o.raw),...n.map(o=>`${t}:${o}`)];return a.length?`${a.join(" ")} `:""};function ge(e,t){return t===0?0:e/t*100}function Jm(e){const t=e.totalCost||0;return{input:{tokens:e.input,cost:e.inputCost||0,pct:ge(e.inputCost||0,t)},output:{tokens:e.output,cost:e.outputCost||0,pct:ge(e.outputCost||0,t)},cacheRead:{tokens:e.cacheRead,cost:e.cacheReadCost||0,pct:ge(e.cacheReadCost||0,t)},cacheWrite:{tokens:e.cacheWrite,cost:e.cacheWriteCost||0,pct:ge(e.cacheWriteCost||0,t)},totalCost:t}}function Zm(e,t,n,s,i,a,o,l){if(!(e.length>0||t.length>0||n.length>0))return v;const u=n.length===1?s.find(f=>f.key===n[0]):null,g=u?(u.label||u.key).slice(0,20)+((u.label||u.key).length>20?"…":""):n.length===1?n[0].slice(0,8)+"…":`${n.length} sessions`,p=u?u.label||u.key:n.length===1?n[0]:n.join(", "),h=e.length===1?e[0]:`${e.length} days`,d=t.length===1?`${t[0]}:00`:`${t.length} hours`;return r`
|
|
6506
6506
|
<div class="active-filters">
|
|
6507
6507
|
${e.length>0?r`
|
|
6508
6508
|
<div class="filter-chip">
|
|
@@ -6528,7 +6528,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
6528
6528
|
</button>
|
|
6529
6529
|
`:v}
|
|
6530
6530
|
</div>
|
|
6531
|
-
`}function
|
|
6531
|
+
`}function Xm(e,t,n,s,i,a){if(!e.length)return r`
|
|
6532
6532
|
<div class="daily-chart-compact">
|
|
6533
6533
|
<div class="sessions-panel-title">Daily Usage</div>
|
|
6534
6534
|
<div class="muted" style="padding: 20px; text-align: center">No data</div>
|
|
@@ -6554,7 +6554,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
6554
6554
|
</div>
|
|
6555
6555
|
<div class="daily-chart">
|
|
6556
6556
|
<div class="daily-chart-bars" style="--bar-max-width: ${u}px">
|
|
6557
|
-
${e.map((p,h)=>{const f=l[h]/c*100,m=t.includes(p.date),S=
|
|
6557
|
+
${e.map((p,h)=>{const f=l[h]/c*100,m=t.includes(p.date),S=Vl(p.date),k=e.length>20?String(parseInt(p.date.slice(8),10)):S,$=e.length>20?"font-size: 8px":"",A=s==="by-type"?o?[{value:p.output,class:"output"},{value:p.input,class:"input"},{value:p.cacheWrite,class:"cache-write"},{value:p.cacheRead,class:"cache-read"}]:[{value:p.outputCost??0,class:"output"},{value:p.inputCost??0,class:"input"},{value:p.cacheWriteCost??0,class:"cache-write"},{value:p.cacheReadCost??0,class:"cache-read"}]:[],C=s==="by-type"?o?[`Output ${O(p.output)}`,`Input ${O(p.input)}`,`Cache write ${O(p.cacheWrite)}`,`Cache read ${O(p.cacheRead)}`]:[`Output ${G(p.outputCost??0)}`,`Input ${G(p.inputCost??0)}`,`Cache write ${G(p.cacheWriteCost??0)}`,`Cache read ${G(p.cacheReadCost??0)}`]:[],_=o?O(p.totalTokens):G(p.totalCost);return r`
|
|
6558
6558
|
<div
|
|
6559
6559
|
class="daily-bar-wrapper ${m?"selected":""}"
|
|
6560
6560
|
@click=${T=>a(p.date,T.shiftKey)}
|
|
@@ -6577,9 +6577,9 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
6577
6577
|
${g?r`<div class="daily-bar-total">${_}</div>`:v}
|
|
6578
6578
|
<div class="daily-bar-label" style="${$}">${k}</div>
|
|
6579
6579
|
<div class="daily-bar-tooltip">
|
|
6580
|
-
<strong>${
|
|
6580
|
+
<strong>${Hm(p.date)}</strong><br />
|
|
6581
6581
|
${O(p.totalTokens)} tokens<br />
|
|
6582
|
-
${
|
|
6582
|
+
${G(p.totalCost)}
|
|
6583
6583
|
${C.length?r`${C.map(T=>r`<div>${T}</div>`)}`:v}
|
|
6584
6584
|
</div>
|
|
6585
6585
|
</div>
|
|
@@ -6587,30 +6587,30 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
6587
6587
|
</div>
|
|
6588
6588
|
</div>
|
|
6589
6589
|
</div>
|
|
6590
|
-
`}function
|
|
6590
|
+
`}function eb(e,t){const n=Jm(e),s=t==="tokens",i=e.totalTokens||1,a={output:ge(e.output,i),input:ge(e.input,i),cacheWrite:ge(e.cacheWrite,i),cacheRead:ge(e.cacheRead,i)};return r`
|
|
6591
6591
|
<div class="cost-breakdown cost-breakdown-compact">
|
|
6592
6592
|
<div class="cost-breakdown-header">${s?"Tokens":"Cost"} by Type</div>
|
|
6593
6593
|
<div class="cost-breakdown-bar">
|
|
6594
6594
|
<div class="cost-segment output" style="width: ${(s?a.output:n.output.pct).toFixed(1)}%"
|
|
6595
|
-
title="Output: ${s?O(e.output):
|
|
6595
|
+
title="Output: ${s?O(e.output):G(n.output.cost)}"></div>
|
|
6596
6596
|
<div class="cost-segment input" style="width: ${(s?a.input:n.input.pct).toFixed(1)}%"
|
|
6597
|
-
title="Input: ${s?O(e.input):
|
|
6597
|
+
title="Input: ${s?O(e.input):G(n.input.cost)}"></div>
|
|
6598
6598
|
<div class="cost-segment cache-write" style="width: ${(s?a.cacheWrite:n.cacheWrite.pct).toFixed(1)}%"
|
|
6599
|
-
title="Cache Write: ${s?O(e.cacheWrite):
|
|
6599
|
+
title="Cache Write: ${s?O(e.cacheWrite):G(n.cacheWrite.cost)}"></div>
|
|
6600
6600
|
<div class="cost-segment cache-read" style="width: ${(s?a.cacheRead:n.cacheRead.pct).toFixed(1)}%"
|
|
6601
|
-
title="Cache Read: ${s?O(e.cacheRead):
|
|
6601
|
+
title="Cache Read: ${s?O(e.cacheRead):G(n.cacheRead.cost)}"></div>
|
|
6602
6602
|
</div>
|
|
6603
6603
|
<div class="cost-breakdown-legend">
|
|
6604
|
-
<span class="legend-item"><span class="legend-dot output"></span>Output ${s?O(e.output):
|
|
6605
|
-
<span class="legend-item"><span class="legend-dot input"></span>Input ${s?O(e.input):
|
|
6606
|
-
<span class="legend-item"><span class="legend-dot cache-write"></span>Cache Write ${s?O(e.cacheWrite):
|
|
6607
|
-
<span class="legend-item"><span class="legend-dot cache-read"></span>Cache Read ${s?O(e.cacheRead):
|
|
6604
|
+
<span class="legend-item"><span class="legend-dot output"></span>Output ${s?O(e.output):G(n.output.cost)}</span>
|
|
6605
|
+
<span class="legend-item"><span class="legend-dot input"></span>Input ${s?O(e.input):G(n.input.cost)}</span>
|
|
6606
|
+
<span class="legend-item"><span class="legend-dot cache-write"></span>Cache Write ${s?O(e.cacheWrite):G(n.cacheWrite.cost)}</span>
|
|
6607
|
+
<span class="legend-item"><span class="legend-dot cache-read"></span>Cache Read ${s?O(e.cacheRead):G(n.cacheRead.cost)}</span>
|
|
6608
6608
|
</div>
|
|
6609
6609
|
<div class="cost-breakdown-total">
|
|
6610
|
-
Total: ${s?O(e.totalTokens):
|
|
6610
|
+
Total: ${s?O(e.totalTokens):G(e.totalCost)}
|
|
6611
6611
|
</div>
|
|
6612
6612
|
</div>
|
|
6613
|
-
`}function
|
|
6613
|
+
`}function dt(e,t,n){return r`
|
|
6614
6614
|
<div class="usage-insight-card">
|
|
6615
6615
|
<div class="usage-insight-title">${e}</div>
|
|
6616
6616
|
${t.length===0?r`<div class="muted">${n}</div>`:r`
|
|
@@ -6627,7 +6627,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
6627
6627
|
</div>
|
|
6628
6628
|
`}
|
|
6629
6629
|
</div>
|
|
6630
|
-
`}function
|
|
6630
|
+
`}function sr(e,t,n){return r`
|
|
6631
6631
|
<div class="usage-insight-card">
|
|
6632
6632
|
<div class="usage-insight-title">${e}</div>
|
|
6633
6633
|
${t.length===0?r`<div class="muted">${n}</div>`:r`
|
|
@@ -6642,7 +6642,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
6642
6642
|
</div>
|
|
6643
6643
|
`}
|
|
6644
6644
|
</div>
|
|
6645
|
-
`}function
|
|
6645
|
+
`}function tb(e,t,n,s,i,a,o){if(!e)return v;const l=t.messages.total?Math.round(e.totalTokens/t.messages.total):0,c=t.messages.total?e.totalCost/t.messages.total:0,u=e.input+e.cacheRead,g=u>0?e.cacheRead/u:0,p=u>0?`${(g*100).toFixed(1)}%`:"—",h=n.errorRate*100,d=n.throughputTokensPerMin!==void 0?`${O(Math.round(n.throughputTokensPerMin))} tok/min`:"—",f=n.throughputCostPerMin!==void 0?`${G(n.throughputCostPerMin,4)} / min`:"—",m=n.durationCount>0?Ri(n.avgDurationMs,{spaced:!0})??"—":"—",S="Cache hit rate = cache read / (input + cache read). Higher is better.",k="Error rate = errors / total messages. Lower is better.",$="Throughput shows tokens per minute over active time. Higher is better.",A="Average tokens per message in this range.",C=s?"Average cost per message when providers report costs. Cost data is missing for some or all sessions in this range.":"Average cost per message when providers report costs.",_=t.daily.filter(F=>F.messages>0&&F.errors>0).map(F=>{const H=F.errors/F.messages;return{label:Vl(F.date),value:`${(H*100).toFixed(2)}%`,sub:`${F.errors} errors · ${F.messages} msgs · ${O(F.tokens)}`,rate:H}}).toSorted((F,H)=>H.rate-F.rate).slice(0,5).map(({rate:F,...H})=>H),T=t.byModel.slice(0,5).map(F=>({label:F.model??"unknown",value:G(F.totals.totalCost),sub:`${O(F.totals.totalTokens)} · ${F.count} msgs`})),I=t.byProvider.slice(0,5).map(F=>({label:F.provider??"unknown",value:G(F.totals.totalCost),sub:`${O(F.totals.totalTokens)} · ${F.count} msgs`})),z=t.tools.tools.slice(0,6).map(F=>({label:F.name,value:`${F.count}`,sub:"calls"})),Y=t.byAgent.slice(0,5).map(F=>({label:F.agentId,value:G(F.totals.totalCost),sub:O(F.totals.totalTokens)})),se=t.byChannel.slice(0,5).map(F=>({label:F.channel,value:G(F.totals.totalCost),sub:O(F.totals.totalTokens)}));return r`
|
|
6646
6646
|
<section class="card" style="margin-top: 16px;">
|
|
6647
6647
|
<div class="card-title">Usage Overview</div>
|
|
6648
6648
|
<div class="usage-summary-grid">
|
|
@@ -6685,8 +6685,8 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
6685
6685
|
Avg Cost / Msg
|
|
6686
6686
|
<span class="usage-summary-hint" title=${C}>?</span>
|
|
6687
6687
|
</div>
|
|
6688
|
-
<div class="usage-summary-value">${
|
|
6689
|
-
<div class="usage-summary-sub">${
|
|
6688
|
+
<div class="usage-summary-value">${G(c,4)}</div>
|
|
6689
|
+
<div class="usage-summary-sub">${G(e.totalCost)} total</div>
|
|
6690
6690
|
</div>
|
|
6691
6691
|
<div class="usage-summary-card">
|
|
6692
6692
|
<div class="usage-summary-title">
|
|
@@ -6726,16 +6726,16 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
6726
6726
|
</div>
|
|
6727
6727
|
</div>
|
|
6728
6728
|
<div class="usage-insights-grid">
|
|
6729
|
-
${
|
|
6730
|
-
${
|
|
6731
|
-
${
|
|
6732
|
-
${
|
|
6733
|
-
${
|
|
6734
|
-
${
|
|
6735
|
-
${
|
|
6729
|
+
${dt("Top Models",T,"No model data")}
|
|
6730
|
+
${dt("Top Providers",I,"No provider data")}
|
|
6731
|
+
${dt("Top Tools",z,"No tool calls")}
|
|
6732
|
+
${dt("Top Agents",Y,"No agent data")}
|
|
6733
|
+
${dt("Top Channels",se,"No channel data")}
|
|
6734
|
+
${sr("Peak Error Days",_,"No error data")}
|
|
6735
|
+
${sr("Peak Error Hours",i,"No error data")}
|
|
6736
6736
|
</div>
|
|
6737
6737
|
</section>
|
|
6738
|
-
`}function
|
|
6738
|
+
`}function nb(e,t,n,s,i,a,o,l,c,u,g,p,h,d,f){const m=E=>h.includes(E),S=E=>{const B=E.label||E.key;return B.startsWith("agent:")&&B.includes("?token=")?B.slice(0,B.indexOf("?token=")):B},k=async E=>{const B=S(E);try{await navigator.clipboard.writeText(B)}catch{}},$=E=>{const B=[];return m("channel")&&E.channel&&B.push(`channel:${E.channel}`),m("agent")&&E.agentId&&B.push(`agent:${E.agentId}`),m("provider")&&(E.modelProvider||E.providerOverride)&&B.push(`provider:${E.modelProvider??E.providerOverride}`),m("model")&&E.model&&B.push(`model:${E.model}`),m("messages")&&E.usage?.messageCounts&&B.push(`msgs:${E.usage.messageCounts.total}`),m("tools")&&E.usage?.toolUsage&&B.push(`tools:${E.usage.toolUsage.totalCalls}`),m("errors")&&E.usage?.messageCounts&&B.push(`errors:${E.usage.messageCounts.errors}`),m("duration")&&E.usage?.durationMs&&B.push(`dur:${Ri(E.usage.durationMs,{spaced:!0})??"—"}`),B},A=E=>{const B=E.usage;if(!B)return 0;if(n.length>0&&B.dailyBreakdown&&B.dailyBreakdown.length>0){const ie=B.dailyBreakdown.filter(ae=>n.includes(ae.date));return s?ie.reduce((ae,Z)=>ae+Z.tokens,0):ie.reduce((ae,Z)=>ae+Z.cost,0)}return s?B.totalTokens??0:B.totalCost??0},C=[...e].toSorted((E,B)=>{switch(i){case"recent":return(B.updatedAt??0)-(E.updatedAt??0);case"messages":return(B.usage?.messageCounts?.total??0)-(E.usage?.messageCounts?.total??0);case"errors":return(B.usage?.messageCounts?.errors??0)-(E.usage?.messageCounts?.errors??0);case"cost":return A(B)-A(E);default:return A(B)-A(E)}}),_=a==="asc"?C.toReversed():C,T=_.reduce((E,B)=>E+A(B),0),I=_.length?T/_.length:0,z=_.reduce((E,B)=>E+(B.usage?.messageCounts?.errors??0),0),Y=new Set(t),se=_.filter(E=>Y.has(E.key)),F=se.length,H=new Map(_.map(E=>[E.key,E])),ce=o.map(E=>H.get(E)).filter(E=>!!E);return r`
|
|
6739
6739
|
<div class="card sessions-card">
|
|
6740
6740
|
<div class="sessions-card-header">
|
|
6741
6741
|
<div class="card-title">Sessions</div>
|
|
@@ -6745,7 +6745,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
6745
6745
|
</div>
|
|
6746
6746
|
<div class="sessions-card-meta">
|
|
6747
6747
|
<div class="sessions-card-stats">
|
|
6748
|
-
<span>${s?O(I):
|
|
6748
|
+
<span>${s?O(I):G(I)} avg</span>
|
|
6749
6749
|
<span>${z} errors</span>
|
|
6750
6750
|
</div>
|
|
6751
6751
|
<div class="chart-toggle small">
|
|
@@ -6810,7 +6810,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
6810
6810
|
>
|
|
6811
6811
|
Copy
|
|
6812
6812
|
</button>
|
|
6813
|
-
<div class="session-bar-value">${s?O(B):
|
|
6813
|
+
<div class="session-bar-value">${s?O(B):G(B)}</div>
|
|
6814
6814
|
</div>
|
|
6815
6815
|
</div>
|
|
6816
6816
|
`})}
|
|
@@ -6838,7 +6838,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
6838
6838
|
>
|
|
6839
6839
|
Copy
|
|
6840
6840
|
</button>
|
|
6841
|
-
<div class="session-bar-value">${s?O(B):
|
|
6841
|
+
<div class="session-bar-value">${s?O(B):G(B)}</div>
|
|
6842
6842
|
</div>
|
|
6843
6843
|
</div>
|
|
6844
6844
|
`})}
|
|
@@ -6868,7 +6868,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
6868
6868
|
>
|
|
6869
6869
|
Copy
|
|
6870
6870
|
</button>
|
|
6871
|
-
<div class="session-bar-value">${s?O(B):
|
|
6871
|
+
<div class="session-bar-value">${s?O(B):G(B)}</div>
|
|
6872
6872
|
</div>
|
|
6873
6873
|
</div>
|
|
6874
6874
|
`})}
|
|
@@ -6876,9 +6876,9 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
6876
6876
|
</div>
|
|
6877
6877
|
`:v}
|
|
6878
6878
|
</div>
|
|
6879
|
-
`}function
|
|
6879
|
+
`}function sb(){return v}function ib(e){const t=e.usage;if(!t)return r`
|
|
6880
6880
|
<div class="muted">No usage data for this session.</div>
|
|
6881
|
-
`;const n=o=>o?new Date(o).toLocaleString():"—",s=[];e.channel&&s.push(`channel:${e.channel}`),e.agentId&&s.push(`agent:${e.agentId}`),(e.modelProvider||e.providerOverride)&&s.push(`provider:${e.modelProvider??e.providerOverride}`),e.model&&s.push(`model:${e.model}`);const i=t.toolUsage?.tools.slice(0,6).map(o=>({label:o.name,value:`${o.count}`,sub:"calls"}))??[],a=t.modelUsage?.slice(0,6).map(o=>({label:o.model??"unknown",value:
|
|
6881
|
+
`;const n=o=>o?new Date(o).toLocaleString():"—",s=[];e.channel&&s.push(`channel:${e.channel}`),e.agentId&&s.push(`agent:${e.agentId}`),(e.modelProvider||e.providerOverride)&&s.push(`provider:${e.modelProvider??e.providerOverride}`),e.model&&s.push(`model:${e.model}`);const i=t.toolUsage?.tools.slice(0,6).map(o=>({label:o.name,value:`${o.count}`,sub:"calls"}))??[],a=t.modelUsage?.slice(0,6).map(o=>({label:o.model??"unknown",value:G(o.totals.totalCost),sub:O(o.totals.totalTokens)}))??[];return r`
|
|
6882
6882
|
${s.length>0?r`<div class="usage-badges">${s.map(o=>r`<span class="usage-badge">${o}</span>`)}</div>`:v}
|
|
6883
6883
|
<div class="session-summary-grid">
|
|
6884
6884
|
<div class="session-summary-card">
|
|
@@ -6898,15 +6898,15 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
6898
6898
|
</div>
|
|
6899
6899
|
<div class="session-summary-card">
|
|
6900
6900
|
<div class="session-summary-title">Duration</div>
|
|
6901
|
-
<div class="session-summary-value">${
|
|
6901
|
+
<div class="session-summary-value">${Ri(t.durationMs,{spaced:!0})??"—"}</div>
|
|
6902
6902
|
<div class="session-summary-meta">${n(t.firstActivity)} → ${n(t.lastActivity)}</div>
|
|
6903
6903
|
</div>
|
|
6904
6904
|
</div>
|
|
6905
6905
|
<div class="usage-insights-grid" style="margin-top: 12px;">
|
|
6906
|
-
${
|
|
6907
|
-
${
|
|
6906
|
+
${dt("Top Tools",i,"No tool calls")}
|
|
6907
|
+
${dt("Model Mix",a,"No model data")}
|
|
6908
6908
|
</div>
|
|
6909
|
-
`}function
|
|
6909
|
+
`}function ab(e,t,n,s,i,a,o,l,c,u,g,p,h,d,f,m,S,k,$,A,C,_,T){const I=e.label||e.key,z=I.length>50?I.slice(0,50)+"…":I,Y=e.usage;return r`
|
|
6910
6910
|
<div class="card session-detail-panel">
|
|
6911
6911
|
<div class="session-detail-header">
|
|
6912
6912
|
<div class="session-detail-header-left">
|
|
@@ -6915,23 +6915,23 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
6915
6915
|
<div class="session-detail-stats">
|
|
6916
6916
|
${Y?r`
|
|
6917
6917
|
<span><strong>${O(Y.totalTokens)}</strong> tokens</span>
|
|
6918
|
-
<span><strong>${
|
|
6918
|
+
<span><strong>${G(Y.totalCost)}</strong></span>
|
|
6919
6919
|
`:v}
|
|
6920
6920
|
</div>
|
|
6921
6921
|
<button class="session-close-btn" @click=${T} title="Close session details">×</button>
|
|
6922
6922
|
</div>
|
|
6923
6923
|
<div class="session-detail-content">
|
|
6924
|
-
${
|
|
6924
|
+
${ib(e)}
|
|
6925
6925
|
<div class="session-detail-row">
|
|
6926
|
-
${
|
|
6926
|
+
${ob(t,n,s,i,a,o,l,c,u)}
|
|
6927
6927
|
</div>
|
|
6928
6928
|
<div class="session-detail-bottom">
|
|
6929
|
-
${
|
|
6930
|
-
${
|
|
6929
|
+
${lb(g,p,h,d,f,m,S,k,$,A)}
|
|
6930
|
+
${rb(e.contextWeight,Y,C,_)}
|
|
6931
6931
|
</div>
|
|
6932
6932
|
</div>
|
|
6933
6933
|
</div>
|
|
6934
|
-
`}function
|
|
6934
|
+
`}function ob(e,t,n,s,i,a,o,l,c){if(t)return r`
|
|
6935
6935
|
<div class="session-timeseries-compact">
|
|
6936
6936
|
<div class="muted" style="padding: 20px; text-align: center">Loading...</div>
|
|
6937
6937
|
</div>
|
|
@@ -6989,16 +6989,16 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
6989
6989
|
<text x="${$.left-4}" y="${$.top+4}" text-anchor="end" class="axis-label" style="font-size: 9px; fill: var(--text-muted)">${O(Y)}</text>
|
|
6990
6990
|
<text x="${$.left-4}" y="${$.top+C}" text-anchor="end" class="axis-label" style="font-size: 9px; fill: var(--text-muted)">0</text>
|
|
6991
6991
|
<!-- X axis labels (first and last) -->
|
|
6992
|
-
${u.length>0?
|
|
6992
|
+
${u.length>0?bn`
|
|
6993
6993
|
<text x="${$.left}" y="${$.top+C+12}" text-anchor="start" style="font-size: 8px; fill: var(--text-muted)">${new Date(u[0].timestamp).toLocaleDateString(void 0,{month:"short",day:"numeric"})}</text>
|
|
6994
6994
|
<text x="${S-$.right}" y="${$.top+C+12}" text-anchor="end" style="font-size: 8px; fill: var(--text-muted)">${new Date(u[u.length-1].timestamp).toLocaleDateString(void 0,{month:"short",day:"numeric"})}</text>
|
|
6995
6995
|
`:v}
|
|
6996
6996
|
<!-- Bars -->
|
|
6997
|
-
${u.map((H,ce)=>{const E=z[ce],B=$.left+ce*(se+F),ie=E/Y*C,ae=$.top+C-ie,te=[new Date(H.timestamp).toLocaleDateString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),`${O(E)} tokens`];T&&(te.push(`Output ${O(H.output)}`),te.push(`Input ${O(H.input)}`),te.push(`Cache write ${O(H.cacheWrite)}`),te.push(`Cache read ${O(H.cacheRead)}`));const M=te.join(" · ");if(!T)return
|
|
6998
|
-
${R.map(j=>{if(j.value<=0||E<=0)return v;const xe=ie*(j.value/E);return P-=xe,
|
|
6997
|
+
${u.map((H,ce)=>{const E=z[ce],B=$.left+ce*(se+F),ie=E/Y*C,ae=$.top+C-ie,te=[new Date(H.timestamp).toLocaleDateString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),`${O(E)} tokens`];T&&(te.push(`Output ${O(H.output)}`),te.push(`Input ${O(H.input)}`),te.push(`Cache write ${O(H.cacheWrite)}`),te.push(`Cache read ${O(H.cacheRead)}`));const M=te.join(" · ");if(!T)return bn`<rect x="${B}" y="${ae}" width="${se}" height="${ie}" class="ts-bar" rx="1" style="cursor: pointer;"><title>${M}</title></rect>`;const R=[{value:H.output,class:"output"},{value:H.input,class:"input"},{value:H.cacheWrite,class:"cache-write"},{value:H.cacheRead,class:"cache-read"}];let P=$.top+C;return bn`
|
|
6998
|
+
${R.map(j=>{if(j.value<=0||E<=0)return v;const xe=ie*(j.value/E);return P-=xe,bn`<rect x="${B}" y="${P}" width="${se}" height="${xe}" class="ts-bar ${j.class}" rx="1"><title>${M}</title></rect>`})}
|
|
6999
6999
|
`})}
|
|
7000
7000
|
</svg>
|
|
7001
|
-
<div class="timeseries-summary">${u.length} msgs · ${O(g)} · ${
|
|
7001
|
+
<div class="timeseries-summary">${u.length} msgs · ${O(g)} · ${G(p)}</div>
|
|
7002
7002
|
${T?r`
|
|
7003
7003
|
<div style="margin-top: 8px;">
|
|
7004
7004
|
<div class="card-title" style="font-size: 12px; margin-bottom: 6px;">Tokens by Type</div>
|
|
@@ -7026,11 +7026,11 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7026
7026
|
</div>
|
|
7027
7027
|
`:v}
|
|
7028
7028
|
</div>
|
|
7029
|
-
`}function
|
|
7029
|
+
`}function rb(e,t,n,s){if(!e)return r`
|
|
7030
7030
|
<div class="context-details-panel">
|
|
7031
7031
|
<div class="muted" style="padding: 20px; text-align: center">No context data</div>
|
|
7032
7032
|
</div>
|
|
7033
|
-
`;const i=
|
|
7033
|
+
`;const i=ot(e.systemPrompt.chars),a=ot(e.skills.promptChars),o=ot(e.tools.listChars+e.tools.schemaChars),l=ot(e.injectedWorkspaceFiles.reduce((A,C)=>A+C.injectedChars,0)),c=i+a+o+l;let u="";if(t&&t.totalTokens>0){const A=t.input+t.cacheRead;A>0&&(u=`~${Math.min(c/A*100,100).toFixed(0)}% of input`)}const g=e.skills.entries.toSorted((A,C)=>C.blockChars-A.blockChars),p=e.tools.entries.toSorted((A,C)=>C.summaryChars+C.schemaChars-(A.summaryChars+A.schemaChars)),h=e.injectedWorkspaceFiles.toSorted((A,C)=>C.injectedChars-A.injectedChars),d=4,f=n,m=f?g:g.slice(0,d),S=f?p:p.slice(0,d),k=f?h:h.slice(0,d),$=g.length>d||p.length>d||h.length>d;return r`
|
|
7034
7034
|
<div class="context-details-panel">
|
|
7035
7035
|
<div class="context-breakdown-header">
|
|
7036
7036
|
<div class="card-title" style="font-size: 13px;">System Prompt Breakdown</div>
|
|
@@ -7060,7 +7060,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7060
7060
|
${m.map(C=>r`
|
|
7061
7061
|
<div class="context-breakdown-item">
|
|
7062
7062
|
<span class="mono">${C.name}</span>
|
|
7063
|
-
<span class="muted">~${O(
|
|
7063
|
+
<span class="muted">~${O(ot(C.blockChars))}</span>
|
|
7064
7064
|
</div>
|
|
7065
7065
|
`)}
|
|
7066
7066
|
</div>
|
|
@@ -7074,7 +7074,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7074
7074
|
${S.map(C=>r`
|
|
7075
7075
|
<div class="context-breakdown-item">
|
|
7076
7076
|
<span class="mono">${C.name}</span>
|
|
7077
|
-
<span class="muted">~${O(
|
|
7077
|
+
<span class="muted">~${O(ot(C.summaryChars+C.schemaChars))}</span>
|
|
7078
7078
|
</div>
|
|
7079
7079
|
`)}
|
|
7080
7080
|
</div>
|
|
@@ -7088,7 +7088,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7088
7088
|
${k.map(C=>r`
|
|
7089
7089
|
<div class="context-breakdown-item">
|
|
7090
7090
|
<span class="mono">${C.name}</span>
|
|
7091
|
-
<span class="muted">~${O(
|
|
7091
|
+
<span class="muted">~${O(ot(C.injectedChars))}</span>
|
|
7092
7092
|
</div>
|
|
7093
7093
|
`)}
|
|
7094
7094
|
</div>
|
|
@@ -7097,7 +7097,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7097
7097
|
`})():v}
|
|
7098
7098
|
</div>
|
|
7099
7099
|
</div>
|
|
7100
|
-
`}function
|
|
7100
|
+
`}function lb(e,t,n,s,i,a,o,l,c,u){if(t)return r`
|
|
7101
7101
|
<div class="session-logs-compact">
|
|
7102
7102
|
<div class="session-logs-header">Conversation</div>
|
|
7103
7103
|
<div class="muted" style="padding: 20px; text-align: center">Loading...</div>
|
|
@@ -7107,7 +7107,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7107
7107
|
<div class="session-logs-header">Conversation</div>
|
|
7108
7108
|
<div class="muted" style="padding: 20px; text-align: center">No messages</div>
|
|
7109
7109
|
</div>
|
|
7110
|
-
`;const g=i.query.trim().toLowerCase(),p=e.map(k=>{const $=
|
|
7110
|
+
`;const g=i.query.trim().toLowerCase(),p=e.map(k=>{const $=Rm(k.content),A=$.cleanContent||k.content;return{log:k,toolInfo:$,cleanContent:A}}),h=Array.from(new Set(p.flatMap(k=>k.toolInfo.tools.map(([$])=>$)))).toSorted((k,$)=>k.localeCompare($)),d=p.filter(k=>!(i.roles.length>0&&!i.roles.includes(k.log.role)||i.hasTools&&k.toolInfo.tools.length===0||i.tools.length>0&&!k.toolInfo.tools.some(([A])=>i.tools.includes(A))||g&&!k.cleanContent.toLowerCase().includes(g))),f=i.roles.length>0||i.tools.length>0||i.hasTools||g?`${d.length} of ${e.length}`:`${e.length}`,m=new Set(i.roles),S=new Set(i.tools);return r`
|
|
7111
7111
|
<div class="session-logs-compact">
|
|
7112
7112
|
<div class="session-logs-header">
|
|
7113
7113
|
<span>Conversation <span style="font-weight: normal; color: var(--text-muted);">(${f} messages)</span></span>
|
|
@@ -7177,7 +7177,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7177
7177
|
`:v}
|
|
7178
7178
|
</div>
|
|
7179
7179
|
</div>
|
|
7180
|
-
`}function
|
|
7180
|
+
`}function cb(e){if(e.loading&&!e.totals)return r`
|
|
7181
7181
|
<style>
|
|
7182
7182
|
@keyframes initial-spin {
|
|
7183
7183
|
to { transform: rotate(360deg); }
|
|
@@ -7223,14 +7223,14 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7223
7223
|
</div>
|
|
7224
7224
|
</div>
|
|
7225
7225
|
</section>
|
|
7226
|
-
`;const t=e.chartMode==="tokens",n=e.query.trim().length>0,s=e.queryDraft.trim().length>0,i=[...e.sessions].toSorted((M,R)=>{const P=t?M.usage?.totalTokens??0:M.usage?.totalCost??0;return(t?R.usage?.totalTokens??0:R.usage?.totalCost??0)-P}),a=e.selectedDays.length>0?i.filter(M=>{if(M.usage?.activityDates?.length)return M.usage.activityDates.some(j=>e.selectedDays.includes(j));if(!M.updatedAt)return!1;const R=new Date(M.updatedAt),P=`${R.getFullYear()}-${String(R.getMonth()+1).padStart(2,"0")}-${String(R.getDate()).padStart(2,"0")}`;return e.selectedDays.includes(P)}):i,o=(M,R)=>{if(R.length===0)return!0;const P=M.usage,j=P?.firstActivity??M.updatedAt,xe=P?.lastActivity??M.updatedAt;if(!j||!xe)return!1;const Q=Math.min(j,xe),
|
|
7226
|
+
`;const t=e.chartMode==="tokens",n=e.query.trim().length>0,s=e.queryDraft.trim().length>0,i=[...e.sessions].toSorted((M,R)=>{const P=t?M.usage?.totalTokens??0:M.usage?.totalCost??0;return(t?R.usage?.totalTokens??0:R.usage?.totalCost??0)-P}),a=e.selectedDays.length>0?i.filter(M=>{if(M.usage?.activityDates?.length)return M.usage.activityDates.some(j=>e.selectedDays.includes(j));if(!M.updatedAt)return!1;const R=new Date(M.updatedAt),P=`${R.getFullYear()}-${String(R.getMonth()+1).padStart(2,"0")}-${String(R.getDate()).padStart(2,"0")}`;return e.selectedDays.includes(P)}):i,o=(M,R)=>{if(R.length===0)return!0;const P=M.usage,j=P?.firstActivity??M.updatedAt,xe=P?.lastActivity??M.updatedAt;if(!j||!xe)return!1;const Q=Math.min(j,xe),ke=Math.max(j,xe);let X=Q;for(;X<=ke;){const pe=new Date(X),Fe=ca(pe,e.timeZone);if(R.includes(Fe))return!0;const Ne=da(pe,e.timeZone);X=Math.min(Ne.getTime(),ke)+1}return!1},l=e.selectedHours.length>0?a.filter(M=>o(M,e.selectedHours)):a,c=Im(l,e.query),u=c.sessions,g=c.warnings,p=Vm(e.queryDraft,i,e.aggregates),h=la(e.query),d=M=>{const R=ct(M);return h.filter(P=>ct(P.key??"")===R).map(P=>P.value).filter(Boolean)},f=M=>{const R=new Set;for(const P of M)P&&R.add(P);return Array.from(R)},m=f(i.map(M=>M.agentId)).slice(0,12),S=f(i.map(M=>M.channel)).slice(0,12),k=f([...i.map(M=>M.modelProvider),...i.map(M=>M.providerOverride),...e.aggregates?.byProvider.map(M=>M.provider)??[]]).slice(0,12),$=f([...i.map(M=>M.model),...e.aggregates?.byModel.map(M=>M.model)??[]]).slice(0,12),A=f(e.aggregates?.tools.tools.map(M=>M.name)??[]).slice(0,12),C=e.selectedSessions.length===1?e.sessions.find(M=>M.key===e.selectedSessions[0])??u.find(M=>M.key===e.selectedSessions[0]):null,_=M=>M.reduce((R,P)=>(P.usage&&(R.input+=P.usage.input,R.output+=P.usage.output,R.cacheRead+=P.usage.cacheRead,R.cacheWrite+=P.usage.cacheWrite,R.totalTokens+=P.usage.totalTokens,R.totalCost+=P.usage.totalCost,R.inputCost+=P.usage.inputCost??0,R.outputCost+=P.usage.outputCost??0,R.cacheReadCost+=P.usage.cacheReadCost??0,R.cacheWriteCost+=P.usage.cacheWriteCost??0,R.missingCostEntries+=P.usage.missingCostEntries??0),R),{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,totalCost:0,inputCost:0,outputCost:0,cacheReadCost:0,cacheWriteCost:0,missingCostEntries:0}),T=M=>e.costDaily.filter(P=>M.includes(P.date)).reduce((P,j)=>(P.input+=j.input,P.output+=j.output,P.cacheRead+=j.cacheRead,P.cacheWrite+=j.cacheWrite,P.totalTokens+=j.totalTokens,P.totalCost+=j.totalCost,P.inputCost+=j.inputCost??0,P.outputCost+=j.outputCost??0,P.cacheReadCost+=j.cacheReadCost??0,P.cacheWriteCost+=j.cacheWriteCost??0,P),{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,totalCost:0,inputCost:0,outputCost:0,cacheReadCost:0,cacheWriteCost:0,missingCostEntries:0});let I,z;const Y=i.length;if(e.selectedSessions.length>0){const M=u.filter(R=>e.selectedSessions.includes(R.key));I=_(M),z=M.length}else e.selectedDays.length>0&&e.selectedHours.length===0?(I=T(e.selectedDays),z=u.length):e.selectedHours.length>0||n?(I=_(u),z=u.length):(I=e.totals,z=Y);const se=e.selectedSessions.length>0?u.filter(M=>e.selectedSessions.includes(M.key)):n||e.selectedHours.length>0?u:e.selectedDays.length>0?a:i,F=Km(se,e.aggregates),H=e.selectedSessions.length>0?(()=>{const M=u.filter(P=>e.selectedSessions.includes(P.key)),R=new Set;for(const P of M)for(const j of P.usage?.activityDates??[])R.add(j);return R.size>0?e.costDaily.filter(P=>R.has(P.date)):e.costDaily})():e.costDaily,ce=Wm(se,I,F),E=!e.loading&&!e.totals&&e.sessions.length===0,B=(I?.missingCostEntries??0)>0||(I?I.totalTokens>0&&I.totalCost===0&&I.input+I.output+I.cacheRead+I.cacheWrite>0:!1),ie=[{label:"Today",days:1},{label:"7d",days:7},{label:"30d",days:30}],ae=M=>{const R=new Date,P=new Date;P.setDate(P.getDate()-(M-1)),e.onStartDateChange(js(P)),e.onEndDateChange(js(R))},Z=(M,R,P)=>{if(P.length===0)return v;const j=d(M),xe=new Set(j.map(X=>ct(X))),Q=P.length>0&&P.every(X=>xe.has(ct(X))),ke=j.length;return r`
|
|
7227
7227
|
<details
|
|
7228
7228
|
class="usage-filter-select"
|
|
7229
7229
|
@toggle=${X=>{const pe=X.currentTarget;if(!pe.open)return;const Fe=Ne=>{Ne.composedPath().includes(pe)||(pe.open=!1,window.removeEventListener("click",Fe,!0))};window.addEventListener("click",Fe,!0)}}
|
|
7230
7230
|
>
|
|
7231
7231
|
<summary>
|
|
7232
7232
|
<span>${R}</span>
|
|
7233
|
-
${
|
|
7233
|
+
${ke>0?r`<span class="usage-filter-badge">${ke}</span>`:r`
|
|
7234
7234
|
<span class="usage-filter-badge">All</span>
|
|
7235
7235
|
`}
|
|
7236
7236
|
</summary>
|
|
@@ -7238,26 +7238,26 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7238
7238
|
<div class="usage-filter-actions">
|
|
7239
7239
|
<button
|
|
7240
7240
|
class="btn btn-sm"
|
|
7241
|
-
@click=${X=>{X.preventDefault(),X.stopPropagation(),e.onQueryDraftChange(
|
|
7241
|
+
@click=${X=>{X.preventDefault(),X.stopPropagation(),e.onQueryDraftChange(nr(e.queryDraft,M,P))}}
|
|
7242
7242
|
?disabled=${Q}
|
|
7243
7243
|
>
|
|
7244
7244
|
Select All
|
|
7245
7245
|
</button>
|
|
7246
7246
|
<button
|
|
7247
7247
|
class="btn btn-sm"
|
|
7248
|
-
@click=${X=>{X.preventDefault(),X.stopPropagation(),e.onQueryDraftChange(
|
|
7249
|
-
?disabled=${
|
|
7248
|
+
@click=${X=>{X.preventDefault(),X.stopPropagation(),e.onQueryDraftChange(nr(e.queryDraft,M,[]))}}
|
|
7249
|
+
?disabled=${ke===0}
|
|
7250
7250
|
>
|
|
7251
7251
|
Clear
|
|
7252
7252
|
</button>
|
|
7253
7253
|
</div>
|
|
7254
7254
|
<div class="usage-filter-options">
|
|
7255
|
-
${P.map(X=>{const pe=xe.has(
|
|
7255
|
+
${P.map(X=>{const pe=xe.has(ct(X));return r`
|
|
7256
7256
|
<label class="usage-filter-option">
|
|
7257
7257
|
<input
|
|
7258
7258
|
type="checkbox"
|
|
7259
7259
|
.checked=${pe}
|
|
7260
|
-
@change=${Fe=>{const Ne=Fe.target,
|
|
7260
|
+
@change=${Fe=>{const Ne=Fe.target,et=`${M}:${X}`;e.onQueryDraftChange(Ne.checked?Ym(e.queryDraft,et):tr(e.queryDraft,et))}}
|
|
7261
7261
|
/>
|
|
7262
7262
|
<span>${X}</span>
|
|
7263
7263
|
</label>
|
|
@@ -7265,8 +7265,8 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7265
7265
|
</div>
|
|
7266
7266
|
</div>
|
|
7267
7267
|
</details>
|
|
7268
|
-
`},te=
|
|
7269
|
-
<style>${
|
|
7268
|
+
`},te=js(new Date);return r`
|
|
7269
|
+
<style>${Pm}</style>
|
|
7270
7270
|
|
|
7271
7271
|
<section class="usage-page-header">
|
|
7272
7272
|
<div class="usage-page-title">Usage</div>
|
|
@@ -7290,7 +7290,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7290
7290
|
<strong>${O(I.totalTokens)}</strong> tokens
|
|
7291
7291
|
</span>
|
|
7292
7292
|
<span class="usage-metric-badge">
|
|
7293
|
-
<strong>${
|
|
7293
|
+
<strong>${G(I.totalCost)}</strong> cost
|
|
7294
7294
|
</span>
|
|
7295
7295
|
<span class="usage-metric-badge">
|
|
7296
7296
|
<strong>${z}</strong>
|
|
@@ -7313,21 +7313,21 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7313
7313
|
<div class="usage-export-list">
|
|
7314
7314
|
<button
|
|
7315
7315
|
class="usage-export-item"
|
|
7316
|
-
@click=${()=>
|
|
7316
|
+
@click=${()=>Ks(`openclaw-usage-sessions-${te}.csv`,qm(u),"text/csv")}
|
|
7317
7317
|
?disabled=${u.length===0}
|
|
7318
7318
|
>
|
|
7319
7319
|
Sessions CSV
|
|
7320
7320
|
</button>
|
|
7321
7321
|
<button
|
|
7322
7322
|
class="usage-export-item"
|
|
7323
|
-
@click=${()=>
|
|
7323
|
+
@click=${()=>Ks(`openclaw-usage-daily-${te}.csv`,Gm(H),"text/csv")}
|
|
7324
7324
|
?disabled=${H.length===0}
|
|
7325
7325
|
>
|
|
7326
7326
|
Daily CSV
|
|
7327
7327
|
</button>
|
|
7328
7328
|
<button
|
|
7329
7329
|
class="usage-export-item"
|
|
7330
|
-
@click=${()=>
|
|
7330
|
+
@click=${()=>Ks(`openclaw-usage-${te}.json`,JSON.stringify({totals:I,sessions:u,daily:H,aggregates:F},null,2),"application/json")}
|
|
7331
7331
|
?disabled=${u.length===0&&H.length===0}
|
|
7332
7332
|
>
|
|
7333
7333
|
JSON
|
|
@@ -7339,7 +7339,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7339
7339
|
</div>
|
|
7340
7340
|
<div class="usage-header-row">
|
|
7341
7341
|
<div class="usage-controls">
|
|
7342
|
-
${
|
|
7342
|
+
${Zm(e.selectedDays,e.selectedHours,e.selectedSessions,e.sessions,e.onClearDays,e.onClearHours,e.onClearSessions,e.onClearFilters)}
|
|
7343
7343
|
<div class="usage-presets">
|
|
7344
7344
|
${ie.map(M=>r`
|
|
7345
7345
|
<button class="btn btn-sm" @click=${()=>ae(M.days)}>
|
|
@@ -7434,7 +7434,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7434
7434
|
${R}
|
|
7435
7435
|
<button
|
|
7436
7436
|
title="Remove filter"
|
|
7437
|
-
@click=${()=>e.onQueryDraftChange(
|
|
7437
|
+
@click=${()=>e.onQueryDraftChange(tr(e.queryDraft,R))}
|
|
7438
7438
|
>
|
|
7439
7439
|
×
|
|
7440
7440
|
</button>
|
|
@@ -7447,7 +7447,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7447
7447
|
${p.map(M=>r`
|
|
7448
7448
|
<button
|
|
7449
7449
|
class="usage-query-suggestion"
|
|
7450
|
-
@click=${()=>e.onQueryDraftChange(
|
|
7450
|
+
@click=${()=>e.onQueryDraftChange(Qm(e.queryDraft,M.value))}
|
|
7451
7451
|
>
|
|
7452
7452
|
${M.label}
|
|
7453
7453
|
</button>
|
|
@@ -7470,26 +7470,26 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7470
7470
|
`:v}
|
|
7471
7471
|
</section>
|
|
7472
7472
|
|
|
7473
|
-
${
|
|
7473
|
+
${tb(I,F,ce,B,Nm(se,e.timeZone),z,Y)}
|
|
7474
7474
|
|
|
7475
|
-
${
|
|
7475
|
+
${zm(se,e.timeZone,e.selectedHours,e.onSelectHour)}
|
|
7476
7476
|
|
|
7477
7477
|
<!-- Two-column layout: Daily+Breakdown on left, Sessions on right -->
|
|
7478
7478
|
<div class="usage-grid">
|
|
7479
7479
|
<div class="usage-grid-left">
|
|
7480
7480
|
<div class="card usage-left-card">
|
|
7481
|
-
${
|
|
7482
|
-
${I?
|
|
7481
|
+
${Xm(H,e.selectedDays,e.chartMode,e.dailyChartMode,e.onDailyChartModeChange,e.onSelectDay)}
|
|
7482
|
+
${I?eb(I,e.chartMode):v}
|
|
7483
7483
|
</div>
|
|
7484
7484
|
</div>
|
|
7485
7485
|
<div class="usage-grid-right">
|
|
7486
|
-
${
|
|
7486
|
+
${nb(u,e.selectedSessions,e.selectedDays,t,e.sessionSort,e.sessionSortDir,e.recentSessions,e.sessionsTab,e.onSelectSession,e.onSessionSortChange,e.onSessionSortDirChange,e.onSessionsTabChange,e.visibleColumns,Y,e.onClearSessions)}
|
|
7487
7487
|
</div>
|
|
7488
7488
|
</div>
|
|
7489
7489
|
|
|
7490
7490
|
<!-- Session Detail Panel (when selected) or Empty State -->
|
|
7491
|
-
${C?
|
|
7492
|
-
`}let
|
|
7491
|
+
${C?ab(C,e.timeSeries,e.timeSeriesLoading,e.timeSeriesMode,e.onTimeSeriesModeChange,e.timeSeriesBreakdownMode,e.onTimeSeriesBreakdownChange,e.startDate,e.endDate,e.selectedDays,e.sessionLogs,e.sessionLogsLoading,e.sessionLogsExpanded,e.onToggleSessionLogsExpanded,{roles:e.logFilterRoles,tools:e.logFilterTools,hasTools:e.logFilterHasTools,query:e.logFilterQuery},e.onLogFilterRolesChange,e.onLogFilterToolsChange,e.onLogFilterHasToolsChange,e.onLogFilterQueryChange,e.onLogFilterClear,e.contextExpanded,e.onToggleContextExpanded,e.onClearSessions):sb()}
|
|
7492
|
+
`}let Ws=null;const ir=e=>{Ws&&clearTimeout(Ws),Ws=window.setTimeout(()=>{pl(e)},400)},db=/^data:/i,ub=/^https?:\/\//i;function gb(e){const t=e.agentsList?.agents??[],s=wr(e.sessionKey)?.agentId??e.agentsList?.defaultId??"main",a=t.find(l=>l.id===s)?.identity,o=a?.avatarUrl??a?.avatar;if(o)return db.test(o)||ub.test(o)?o:a?.avatarUrl}function pb(e){const t=e.presenceEntries.length,n=e.sessionsResult?.count??null,s=e.cronStatus?.nextWakeAtMs??null,i=e.connected?null:"Disconnected from gateway.",a=e.tab==="chat",o=a&&(e.settings.chatFocusMode||e.onboarding),l=e.onboarding?!1:e.settings.chatShowThinking,c=gb(e),u=e.chatAvatarUrl??c??null,g=e.configForm??e.configSnapshot?.config,p=cn(e.basePath??""),h=e.agentsSelectedId??e.agentsList?.defaultId??e.agentsList?.agents?.[0]?.id??null;return r`
|
|
7493
7493
|
<div class="shell ${a?"shell--chat":""} ${o?"shell--chat-focus":""} ${e.settings.navCollapsed?"shell--nav-collapsed":""} ${e.onboarding?"shell--onboarding":""}">
|
|
7494
7494
|
<header class="topbar">
|
|
7495
7495
|
<div class="topbar-left">
|
|
@@ -7517,11 +7517,11 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7517
7517
|
<span>Health</span>
|
|
7518
7518
|
<span class="mono">${e.connected?"OK":"Offline"}</span>
|
|
7519
7519
|
</div>
|
|
7520
|
-
${
|
|
7520
|
+
${Dg(e)}
|
|
7521
7521
|
</div>
|
|
7522
7522
|
</header>
|
|
7523
7523
|
<aside class="nav ${e.settings.navCollapsed?"nav--collapsed":""}">
|
|
7524
|
-
${
|
|
7524
|
+
${cu.map(d=>{const f=e.settings.navGroupsCollapsed[d.label]??!1,m=d.tabs.some(S=>S===e.tab);return r`
|
|
7525
7525
|
<div class="nav-group ${f&&!m?"nav-group--collapsed":""}">
|
|
7526
7526
|
<button
|
|
7527
7527
|
class="nav-label"
|
|
@@ -7532,7 +7532,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7532
7532
|
<span class="nav-label__chevron">${f?"+":"−"}</span>
|
|
7533
7533
|
</button>
|
|
7534
7534
|
<div class="nav-group__items">
|
|
7535
|
-
${d.tabs.map(S=>
|
|
7535
|
+
${d.tabs.map(S=>Lg(e,S))}
|
|
7536
7536
|
</div>
|
|
7537
7537
|
</div>
|
|
7538
7538
|
`})}
|
|
@@ -7557,45 +7557,45 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7557
7557
|
<main class="content ${a?"content--chat":""}">
|
|
7558
7558
|
<section class="content-header">
|
|
7559
7559
|
<div>
|
|
7560
|
-
${e.tab==="usage"?v:r`<div class="page-title">${
|
|
7561
|
-
${e.tab==="usage"?v:r`<div class="page-sub">${
|
|
7560
|
+
${e.tab==="usage"?v:r`<div class="page-title">${ti(e.tab)}</div>`}
|
|
7561
|
+
${e.tab==="usage"?v:r`<div class="page-sub">${gu(e.tab)}</div>`}
|
|
7562
7562
|
</div>
|
|
7563
7563
|
<div class="page-meta">
|
|
7564
7564
|
${e.lastError?r`<div class="pill danger">${e.lastError}</div>`:v}
|
|
7565
|
-
${a
|
|
7565
|
+
${a?Mg(e):v}
|
|
7566
7566
|
</div>
|
|
7567
7567
|
</section>
|
|
7568
7568
|
|
|
7569
|
-
${e.tab==="overview"?
|
|
7569
|
+
${e.tab==="overview"?gm({connected:e.connected,hello:e.hello,settings:e.settings,password:e.password,lastError:e.lastError,presenceCount:t,sessionsCount:n,cronEnabled:e.cronStatus?.enabled??null,cronNext:s,lastChannelsRefresh:e.channelsLastSuccess,onSettingsChange:d=>e.applySettings(d),onPasswordChange:d=>e.password=d,onSessionKeyChange:d=>{e.sessionKey=d,e.chatMessage="",e.resetToolStream(),e.applySettings({...e.settings,sessionKey:d,lastActiveSessionKey:d}),e.loadAssistantIdentity()},onConnect:()=>e.connect(),onRefresh:()=>e.loadOverview()}):v}
|
|
7570
7570
|
|
|
7571
|
-
${e.tab==="channels"?
|
|
7571
|
+
${e.tab==="channels"?nf({connected:e.connected,loading:e.channelsLoading,snapshot:e.channelsSnapshot,lastError:e.channelsError,lastSuccessAt:e.channelsLastSuccess,whatsappMessage:e.whatsappLoginMessage,whatsappQrDataUrl:e.whatsappLoginQrDataUrl,whatsappConnected:e.whatsappLoginConnected,whatsappBusy:e.whatsappBusy,configSchema:e.configSchema,configSchemaLoading:e.configSchemaLoading,configForm:e.configForm,configUiHints:e.configUiHints,configSaving:e.configSaving,configFormDirty:e.configFormDirty,nostrProfileFormState:e.nostrProfileFormState,nostrProfileAccountId:e.nostrProfileAccountId,onRefresh:d=>ye(e,d),onWhatsAppStart:d=>e.handleWhatsAppStart(d),onWhatsAppWait:()=>e.handleWhatsAppWait(),onWhatsAppLogout:()=>e.handleWhatsAppLogout(),onConfigPatch:(d,f)=>$e(e,d,f),onConfigSave:()=>e.handleChannelConfigSave(),onConfigReload:()=>e.handleChannelConfigReload(),onNostrProfileEdit:(d,f)=>e.handleNostrProfileEdit(d,f),onNostrProfileCancel:()=>e.handleNostrProfileCancel(),onNostrProfileFieldChange:(d,f)=>e.handleNostrProfileFieldChange(d,f),onNostrProfileSave:()=>e.handleNostrProfileSave(),onNostrProfileImport:()=>e.handleNostrProfileImport(),onNostrProfileToggleAdvanced:()=>e.handleNostrProfileToggleAdvanced()}):v}
|
|
7572
7572
|
|
|
7573
|
-
${e.tab==="instances"?
|
|
7573
|
+
${e.tab==="instances"?Fv({loading:e.presenceLoading,entries:e.presenceEntries,lastError:e.presenceError,statusMessage:e.presenceStatus,onRefresh:()=>Hi(e)}):v}
|
|
7574
7574
|
|
|
7575
|
-
${e.tab==="sessions"?
|
|
7575
|
+
${e.tab==="sessions"?wm({loading:e.sessionsLoading,result:e.sessionsResult,error:e.sessionsError,activeMinutes:e.sessionsFilterActive,limit:e.sessionsFilterLimit,includeGlobal:e.sessionsIncludeGlobal,includeUnknown:e.sessionsIncludeUnknown,basePath:e.basePath,onFiltersChange:d=>{e.sessionsFilterActive=d.activeMinutes,e.sessionsFilterLimit=d.limit,e.sessionsIncludeGlobal=d.includeGlobal,e.sessionsIncludeUnknown=d.includeUnknown},onRefresh:()=>yt(e),onPatch:(d,f)=>su(e,d,f),onDelete:d=>iu(e,d)}):v}
|
|
7576
7576
|
|
|
7577
|
-
${e.tab==="usage"?
|
|
7577
|
+
${e.tab==="usage"?cb({loading:e.usageLoading,error:e.usageError,startDate:e.usageStartDate,endDate:e.usageEndDate,sessions:e.usageResult?.sessions??[],sessionsLimitReached:(e.usageResult?.sessions?.length??0)>=1e3,totals:e.usageResult?.totals??null,aggregates:e.usageResult?.aggregates??null,costDaily:e.usageCostSummary?.daily??[],selectedSessions:e.usageSelectedSessions,selectedDays:e.usageSelectedDays,selectedHours:e.usageSelectedHours,chartMode:e.usageChartMode,dailyChartMode:e.usageDailyChartMode,timeSeriesMode:e.usageTimeSeriesMode,timeSeriesBreakdownMode:e.usageTimeSeriesBreakdownMode,timeSeries:e.usageTimeSeries,timeSeriesLoading:e.usageTimeSeriesLoading,sessionLogs:e.usageSessionLogs,sessionLogsLoading:e.usageSessionLogsLoading,sessionLogsExpanded:e.usageSessionLogsExpanded,logFilterRoles:e.usageLogFilterRoles,logFilterTools:e.usageLogFilterTools,logFilterHasTools:e.usageLogFilterHasTools,logFilterQuery:e.usageLogFilterQuery,query:e.usageQuery,queryDraft:e.usageQueryDraft,sessionSort:e.usageSessionSort,sessionSortDir:e.usageSessionSortDir,recentSessions:e.usageRecentSessions,sessionsTab:e.usageSessionsTab,visibleColumns:e.usageVisibleColumns,timeZone:e.usageTimeZone,contextExpanded:e.usageContextExpanded,headerPinned:e.usageHeaderPinned,onStartDateChange:d=>{e.usageStartDate=d,e.usageSelectedDays=[],e.usageSelectedHours=[],e.usageSelectedSessions=[],ir(e)},onEndDateChange:d=>{e.usageEndDate=d,e.usageSelectedDays=[],e.usageSelectedHours=[],e.usageSelectedSessions=[],ir(e)},onRefresh:()=>pl(e),onTimeZoneChange:d=>{e.usageTimeZone=d},onToggleContextExpanded:()=>{e.usageContextExpanded=!e.usageContextExpanded},onToggleSessionLogsExpanded:()=>{e.usageSessionLogsExpanded=!e.usageSessionLogsExpanded},onLogFilterRolesChange:d=>{e.usageLogFilterRoles=d},onLogFilterToolsChange:d=>{e.usageLogFilterTools=d},onLogFilterHasToolsChange:d=>{e.usageLogFilterHasTools=d},onLogFilterQueryChange:d=>{e.usageLogFilterQuery=d},onLogFilterClear:()=>{e.usageLogFilterRoles=[],e.usageLogFilterTools=[],e.usageLogFilterHasTools=!1,e.usageLogFilterQuery=""},onToggleHeaderPinned:()=>{e.usageHeaderPinned=!e.usageHeaderPinned},onSelectHour:(d,f)=>{if(f&&e.usageSelectedHours.length>0){const m=Array.from({length:24},(A,C)=>C),S=e.usageSelectedHours[e.usageSelectedHours.length-1],k=m.indexOf(S),$=m.indexOf(d);if(k!==-1&&$!==-1){const[A,C]=k<$?[k,$]:[$,k],_=m.slice(A,C+1);e.usageSelectedHours=[...new Set([...e.usageSelectedHours,..._])]}}else e.usageSelectedHours.includes(d)?e.usageSelectedHours=e.usageSelectedHours.filter(m=>m!==d):e.usageSelectedHours=[...e.usageSelectedHours,d]},onQueryDraftChange:d=>{e.usageQueryDraft=d,e.usageQueryDebounceTimer&&window.clearTimeout(e.usageQueryDebounceTimer),e.usageQueryDebounceTimer=window.setTimeout(()=>{e.usageQuery=e.usageQueryDraft,e.usageQueryDebounceTimer=null},250)},onApplyQuery:()=>{e.usageQueryDebounceTimer&&(window.clearTimeout(e.usageQueryDebounceTimer),e.usageQueryDebounceTimer=null),e.usageQuery=e.usageQueryDraft},onClearQuery:()=>{e.usageQueryDebounceTimer&&(window.clearTimeout(e.usageQueryDebounceTimer),e.usageQueryDebounceTimer=null),e.usageQueryDraft="",e.usageQuery=""},onSessionSortChange:d=>{e.usageSessionSort=d},onSessionSortDirChange:d=>{e.usageSessionSortDir=d},onSessionsTabChange:d=>{e.usageSessionsTab=d},onToggleColumn:d=>{e.usageVisibleColumns.includes(d)?e.usageVisibleColumns=e.usageVisibleColumns.filter(f=>f!==d):e.usageVisibleColumns=[...e.usageVisibleColumns,d]},onSelectSession:(d,f)=>{if(e.usageTimeSeries=null,e.usageSessionLogs=null,e.usageRecentSessions=[d,...e.usageRecentSessions.filter(m=>m!==d)].slice(0,8),f&&e.usageSelectedSessions.length>0){const m=e.usageChartMode==="tokens",k=[...e.usageResult?.sessions??[]].toSorted((_,T)=>{const I=m?_.usage?.totalTokens??0:_.usage?.totalCost??0;return(m?T.usage?.totalTokens??0:T.usage?.totalCost??0)-I}).map(_=>_.key),$=e.usageSelectedSessions[e.usageSelectedSessions.length-1],A=k.indexOf($),C=k.indexOf(d);if(A!==-1&&C!==-1){const[_,T]=A<C?[A,C]:[C,A],I=k.slice(_,T+1),z=[...new Set([...e.usageSelectedSessions,...I])];e.usageSelectedSessions=z}}else e.usageSelectedSessions.length===1&&e.usageSelectedSessions[0]===d?e.usageSelectedSessions=[]:e.usageSelectedSessions=[d];e.usageSelectedSessions.length===1&&(zg(e,e.usageSelectedSessions[0]),Hg(e,e.usageSelectedSessions[0]))},onSelectDay:(d,f)=>{if(f&&e.usageSelectedDays.length>0){const m=(e.usageCostSummary?.daily??[]).map(A=>A.date),S=e.usageSelectedDays[e.usageSelectedDays.length-1],k=m.indexOf(S),$=m.indexOf(d);if(k!==-1&&$!==-1){const[A,C]=k<$?[k,$]:[$,k],_=m.slice(A,C+1),T=[...new Set([...e.usageSelectedDays,..._])];e.usageSelectedDays=T}}else e.usageSelectedDays.includes(d)?e.usageSelectedDays=e.usageSelectedDays.filter(m=>m!==d):e.usageSelectedDays=[d]},onChartModeChange:d=>{e.usageChartMode=d},onDailyChartModeChange:d=>{e.usageDailyChartMode=d},onTimeSeriesModeChange:d=>{e.usageTimeSeriesMode=d},onTimeSeriesBreakdownChange:d=>{e.usageTimeSeriesBreakdownMode=d},onClearDays:()=>{e.usageSelectedDays=[]},onClearHours:()=>{e.usageSelectedHours=[]},onClearSessions:()=>{e.usageSelectedSessions=[],e.usageTimeSeries=null,e.usageSessionLogs=null},onClearFilters:()=>{e.usageSelectedDays=[],e.usageSelectedHours=[],e.usageSelectedSessions=[],e.usageTimeSeries=null,e.usageSessionLogs=null}}):v}
|
|
7578
7578
|
|
|
7579
|
-
${e.tab==="cron"?
|
|
7579
|
+
${e.tab==="cron"?Cv({basePath:e.basePath,loading:e.cronLoading,status:e.cronStatus,jobs:e.cronJobs,error:e.cronError,busy:e.cronBusy,form:e.cronForm,channels:e.channelsSnapshot?.channelMeta?.length?e.channelsSnapshot.channelMeta.map(d=>d.id):e.channelsSnapshot?.channelOrder??[],channelLabels:e.channelsSnapshot?.channelLabels??{},channelMeta:e.channelsSnapshot?.channelMeta??[],runsJobId:e.cronRunsJobId,runs:e.cronRuns,onFormChange:d=>e.cronForm={...e.cronForm,...d},onRefresh:()=>e.loadCron(),onAdd:()=>vd(e),onToggle:(d,f)=>md(e,d,f),onRun:d=>bd(e,d),onRemove:d=>yd(e,d),onLoadRuns:d=>Tr(e,d)}):v}
|
|
7580
7580
|
|
|
7581
|
-
${e.tab==="agents"?
|
|
7581
|
+
${e.tab==="agents"?cp({loading:e.agentsLoading,error:e.agentsError,agentsList:e.agentsList,selectedAgentId:h,activePanel:e.agentsPanel,configForm:g,configLoading:e.configLoading,configSaving:e.configSaving,configDirty:e.configFormDirty,channelsLoading:e.channelsLoading,channelsError:e.channelsError,channelsSnapshot:e.channelsSnapshot,channelsLastSuccess:e.channelsLastSuccess,cronLoading:e.cronLoading,cronStatus:e.cronStatus,cronJobs:e.cronJobs,cronError:e.cronError,agentFilesLoading:e.agentFilesLoading,agentFilesError:e.agentFilesError,agentFilesList:e.agentFilesList,agentFileActive:e.agentFileActive,agentFileContents:e.agentFileContents,agentFileDrafts:e.agentFileDrafts,agentFileSaving:e.agentFileSaving,agentIdentityLoading:e.agentIdentityLoading,agentIdentityError:e.agentIdentityError,agentIdentityById:e.agentIdentityById,agentSkillsLoading:e.agentSkillsLoading,agentSkillsReport:e.agentSkillsReport,agentSkillsError:e.agentSkillsError,agentSkillsAgentId:e.agentSkillsAgentId,skillsFilter:e.skillsFilter,onRefresh:async()=>{await Ii(e);const d=e.agentsList?.agents?.map(f=>f.id)??[];d.length>0&&Ar(e,d)},onSelectAgent:d=>{e.agentsSelectedId!==d&&(e.agentsSelectedId=d,e.agentFilesList=null,e.agentFilesError=null,e.agentFilesLoading=!1,e.agentFileActive=null,e.agentFileContents={},e.agentFileDrafts={},e.agentSkillsReport=null,e.agentSkillsError=null,e.agentSkillsAgentId=null,Sr(e,d),e.agentsPanel==="files"&&Ps(e,d),e.agentsPanel==="skills"&&Rn(e,d))},onSelectPanel:d=>{e.agentsPanel=d,d==="files"&&h&&e.agentFilesList?.agentId!==h&&(e.agentFilesList=null,e.agentFilesError=null,e.agentFileActive=null,e.agentFileContents={},e.agentFileDrafts={},Ps(e,h)),d==="skills"&&h&&Rn(e,h),d==="channels"&&ye(e,!1),d==="cron"&&e.loadCron()},onLoadFiles:d=>Ps(e,d),onSelectFile:d=>{e.agentFileActive=d,h&&Bg(e,h,d)},onFileDraftChange:(d,f)=>{e.agentFileDrafts={...e.agentFileDrafts,[d]:f}},onFileReset:d=>{const f=e.agentFileContents[d]??"";e.agentFileDrafts={...e.agentFileDrafts,[d]:f}},onFileSave:d=>{if(!h)return;const f=e.agentFileDrafts[d]??e.agentFileContents[d]??"";Ug(e,h,d,f)},onToolsProfileChange:(d,f,m)=>{if(!g)return;const S=g.agents?.list;if(!Array.isArray(S))return;const k=S.findIndex(A=>A&&typeof A=="object"&&"id"in A&&A.id===d);if(k<0)return;const $=["agents","list",k,"tools"];f?$e(e,[...$,"profile"],f):ze(e,[...$,"profile"]),m&&ze(e,[...$,"allow"])},onToolsOverridesChange:(d,f,m)=>{if(!g)return;const S=g.agents?.list;if(!Array.isArray(S))return;const k=S.findIndex(A=>A&&typeof A=="object"&&"id"in A&&A.id===d);if(k<0)return;const $=["agents","list",k,"tools"];f.length>0?$e(e,[...$,"alsoAllow"],f):ze(e,[...$,"alsoAllow"]),m.length>0?$e(e,[...$,"deny"],m):ze(e,[...$,"deny"])},onConfigReload:()=>Le(e),onConfigSave:()=>In(e),onChannelsRefresh:()=>ye(e,!1),onCronRefresh:()=>e.loadCron(),onSkillsFilterChange:d=>e.skillsFilter=d,onSkillsRefresh:()=>{h&&Rn(e,h)},onAgentSkillToggle:(d,f,m)=>{if(!g)return;const S=g.agents?.list;if(!Array.isArray(S))return;const k=S.findIndex(z=>z&&typeof z=="object"&&"id"in z&&z.id===d);if(k<0)return;const $=S[k],A=f.trim();if(!A)return;const C=e.agentSkillsReport?.skills?.map(z=>z.name).filter(Boolean)??[],T=(Array.isArray($.skills)?$.skills.map(z=>String(z).trim()).filter(Boolean):void 0)??C,I=new Set(T);m?I.add(A):I.delete(A),$e(e,["agents","list",k,"skills"],[...I])},onAgentSkillsClear:d=>{if(!g)return;const f=g.agents?.list;if(!Array.isArray(f))return;const m=f.findIndex(S=>S&&typeof S=="object"&&"id"in S&&S.id===d);m<0||ze(e,["agents","list",m,"skills"])},onAgentSkillsDisableAll:d=>{if(!g)return;const f=g.agents?.list;if(!Array.isArray(f))return;const m=f.findIndex(S=>S&&typeof S=="object"&&"id"in S&&S.id===d);m<0||$e(e,["agents","list",m,"skills"],[])},onModelChange:(d,f)=>{if(!g)return;const m=g.agents?.list;if(!Array.isArray(m))return;const S=m.findIndex(C=>C&&typeof C=="object"&&"id"in C&&C.id===d);if(S<0)return;const k=["agents","list",S,"model"];if(!f){ze(e,k);return}const A=m[S]?.model;if(A&&typeof A=="object"&&!Array.isArray(A)){const C=A.fallbacks,_={primary:f,...Array.isArray(C)?{fallbacks:C}:{}};$e(e,k,_)}else $e(e,k,f)},onModelFallbacksChange:(d,f)=>{if(!g)return;const m=g.agents?.list;if(!Array.isArray(m))return;const S=m.findIndex(z=>z&&typeof z=="object"&&"id"in z&&z.id===d);if(S<0)return;const k=["agents","list",S,"model"],$=m[S],A=f.map(z=>z.trim()).filter(Boolean),C=$.model,T=(()=>{if(typeof C=="string")return C.trim()||null;if(C&&typeof C=="object"&&!Array.isArray(C)){const z=C.primary;if(typeof z=="string")return z.trim()||null}return null})();if(A.length===0){T?$e(e,k,T):ze(e,k);return}$e(e,k,T?{primary:T,fallbacks:A}:{fallbacks:A})}}):v}
|
|
7582
7582
|
|
|
7583
|
-
${e.tab==="skills"?
|
|
7583
|
+
${e.tab==="skills"?Am({loading:e.skillsLoading,report:e.skillsReport,error:e.skillsError,filter:e.skillsFilter,edits:e.skillEdits,messages:e.skillMessages,busyKey:e.skillsBusyKey,onFilterChange:d=>e.skillsFilter=d,onRefresh:()=>ln(e,{clearMessages:!0}),onToggle:(d,f)=>ou(e,d,f),onEdit:(d,f)=>au(e,d,f),onSaveKey:d=>ru(e,d),onInstall:(d,f,m)=>lu(e,d,f,m)}):v}
|
|
7584
7584
|
|
|
7585
|
-
${e.tab==="nodes"?
|
|
7585
|
+
${e.tab==="nodes"?zv({loading:e.nodesLoading,nodes:e.nodes,devicesLoading:e.devicesLoading,devicesError:e.devicesError,devicesList:e.devicesList,configForm:e.configForm??e.configSnapshot?.config,configLoading:e.configLoading,configSaving:e.configSaving,configDirty:e.configFormDirty,configFormMode:e.configFormMode,execApprovalsLoading:e.execApprovalsLoading,execApprovalsSaving:e.execApprovalsSaving,execApprovalsDirty:e.execApprovalsDirty,execApprovalsSnapshot:e.execApprovalsSnapshot,execApprovalsForm:e.execApprovalsForm,execApprovalsSelectedAgent:e.execApprovalsSelectedAgent,execApprovalsTarget:e.execApprovalsTarget,execApprovalsTargetNodeId:e.execApprovalsTargetNodeId,onRefresh:()=>es(e),onDevicesRefresh:()=>Xe(e),onDeviceApprove:d=>Gd(e,d),onDeviceReject:d=>Vd(e,d),onDeviceRotate:(d,f,m)=>Qd(e,{deviceId:d,role:f,scopes:m}),onDeviceRevoke:(d,f)=>Yd(e,{deviceId:d,role:f}),onLoadConfig:()=>Le(e),onLoadExecApprovals:()=>{const d=e.execApprovalsTarget==="node"&&e.execApprovalsTargetNodeId?{kind:"node",nodeId:e.execApprovalsTargetNodeId}:{kind:"gateway"};return zi(e,d)},onBindDefault:d=>{d?$e(e,["tools","exec","node"],d):ze(e,["tools","exec","node"])},onBindAgent:(d,f)=>{const m=["agents","list",d,"tools","exec","node"];f?$e(e,m,f):ze(e,m)},onSaveBindings:()=>In(e),onExecApprovalsTargetChange:(d,f)=>{e.execApprovalsTarget=d,e.execApprovalsTargetNodeId=f,e.execApprovalsSnapshot=null,e.execApprovalsForm=null,e.execApprovalsDirty=!1,e.execApprovalsSelectedAgent=null},onExecApprovalsSelectAgent:d=>{e.execApprovalsSelectedAgent=d},onExecApprovalsPatch:(d,f)=>tu(e,d,f),onExecApprovalsRemove:d=>nu(e,d),onSaveExecApprovals:()=>{const d=e.execApprovalsTarget==="node"&&e.execApprovalsTargetNodeId?{kind:"node",nodeId:e.execApprovalsTargetNodeId}:{kind:"gateway"};return eu(e,d)}}):v}
|
|
7586
7586
|
|
|
7587
|
-
${e.tab==="chat"?
|
|
7587
|
+
${e.tab==="chat"?mv({sessionKey:e.sessionKey,onSessionKeyChange:d=>{e.sessionKey=d,e.chatMessage="",e.chatAttachments=[],e.chatStream=null,e.chatStreamStartedAt=null,e.chatRunId=null,e.chatQueue=[],e.resetToolStream(),e.resetChatScroll(),e.applySettings({...e.settings,sessionKey:d,lastActiveSessionKey:d}),e.loadAssistantIdentity(),sn(e),ii(e)},thinkingLevel:e.chatThinkingLevel,showThinking:l,loading:e.chatLoading,sending:e.chatSending,compactionStatus:e.compactionStatus,assistantAvatarUrl:u,messages:e.chatMessages,toolMessages:e.chatToolMessages,stream:e.chatStream,streamStartedAt:e.chatStreamStartedAt,draft:e.chatMessage,queue:e.chatQueue,connected:e.connected,canSend:e.connected,disabledReason:i,error:e.lastError,sessions:e.sessionsResult,focusMode:o,onRefresh:()=>(e.resetToolStream(),Promise.all([sn(e),ii(e)])),onToggleFocusMode:()=>{e.onboarding||e.applySettings({...e.settings,chatFocusMode:!e.settings.chatFocusMode})},onChatScroll:d=>e.handleChatScroll(d),onDraftChange:d=>e.chatMessage=d,attachments:e.chatAttachments,onAttachmentsChange:d=>e.chatAttachments=d,onSend:()=>e.handleSendChat(),canAbort:!!e.chatRunId,onAbort:()=>{e.handleAbortChat()},onQueueRemove:d=>e.removeQueuedMessage(d),onNewSession:()=>e.handleSendChat("/new",{restoreDraft:!0}),showNewMessages:e.chatNewMessagesBelow&&!e.chatManualRefreshInFlight,onScrollToBottom:()=>e.scrollToBottom(),sidebarOpen:e.sidebarOpen,sidebarContent:e.sidebarContent,sidebarError:e.sidebarError,splitRatio:e.splitRatio,onOpenSidebar:d=>e.handleOpenSidebar(d),onCloseSidebar:()=>e.handleCloseSidebar(),onSplitRatioChange:d=>e.handleSplitRatioChange(d),assistantName:e.assistantName,assistantAvatar:e.assistantAvatar}):v}
|
|
7588
7588
|
|
|
7589
|
-
${e.tab==="config"?
|
|
7589
|
+
${e.tab==="config"?kv({raw:e.configRaw,originalRaw:e.configRawOriginal,valid:e.configValid,issues:e.configIssues,loading:e.configLoading,saving:e.configSaving,applying:e.configApplying,updating:e.updateRunning,connected:e.connected,schema:e.configSchema,schemaLoading:e.configSchemaLoading,uiHints:e.configUiHints,formMode:e.configFormMode,formValue:e.configForm,originalValue:e.configFormOriginal,searchQuery:e.configSearchQuery,activeSection:e.configActiveSection,activeSubsection:e.configActiveSubsection,onRawChange:d=>{e.configRaw=d},onFormModeChange:d=>e.configFormMode=d,onFormPatch:(d,f)=>$e(e,d,f),onSearchChange:d=>e.configSearchQuery=d,onSectionChange:d=>{e.configActiveSection=d,e.configActiveSubsection=null},onSubsectionChange:d=>e.configActiveSubsection=d,onReload:()=>Le(e),onSave:()=>In(e),onApply:()=>Dc(e),onUpdate:()=>Fc(e)}):v}
|
|
7590
7590
|
|
|
7591
|
-
${e.tab==="debug"?
|
|
7591
|
+
${e.tab==="debug"?Iv({loading:e.debugLoading,status:e.debugStatus,health:e.debugHealth,models:e.debugModels,heartbeat:e.debugHeartbeat,eventLog:e.eventLog,callMethod:e.debugCallMethod,callParams:e.debugCallParams,callResult:e.debugCallResult,callError:e.debugCallError,onCallMethodChange:d=>e.debugCallMethod=d,onCallParamsChange:d=>e.debugCallParams=d,onRefresh:()=>Xn(e),onCall:()=>sd(e)}):v}
|
|
7592
7592
|
|
|
7593
|
-
${e.tab==="logs"?
|
|
7593
|
+
${e.tab==="logs"?Uv({loading:e.logsLoading,error:e.logsError,file:e.logsFile,entries:e.logsEntries,filterText:e.logsFilterText,levelFilters:e.logsLevelFilters,autoFollow:e.logsAutoFollow,truncated:e.logsTruncated,onFilterTextChange:d=>e.logsFilterText=d,onLevelToggle:(d,f)=>{e.logsLevelFilters={...e.logsLevelFilters,[d]:f}},onToggleAutoFollow:d=>e.logsAutoFollow=d,onRefresh:()=>Ti(e,{reset:!0}),onExport:(d,f)=>e.exportLogs(d,f),onScroll:d=>e.handleLogsScroll(d)}):v}
|
|
7594
7594
|
</main>
|
|
7595
|
-
${
|
|
7596
|
-
${
|
|
7595
|
+
${Pv(e)}
|
|
7596
|
+
${Dv(e)}
|
|
7597
7597
|
</div>
|
|
7598
|
-
`}var
|
|
7598
|
+
`}var fb=Object.defineProperty,hb=Object.getOwnPropertyDescriptor,x=(e,t,n,s)=>{for(var i=s>1?void 0:s?hb(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(s?o(t,n,i):o(i))||i);return s&&i&&fb(t,n,i),i};const qs=dg();function vb(){if(!window.location.search)return!1;const t=new URLSearchParams(window.location.search).get("onboarding");if(!t)return!1;const n=t.trim().toLowerCase();return n==="1"||n==="true"||n==="yes"||n==="on"}let y=class extends Et{constructor(){super(...arguments),this.settings=pu(),this.password="",this.tab="chat",this.onboarding=vb(),this.connected=!1,this.theme=this.settings.theme??"system",this.themeResolved="dark",this.hello=null,this.lastError=null,this.eventLog=[],this.eventLogBuffer=[],this.toolStreamSyncTimer=null,this.sidebarCloseTimer=null,this.assistantName=qs.name,this.assistantAvatar=qs.avatar,this.assistantAgentId=qs.agentId??null,this.sessionKey=this.settings.sessionKey,this.chatLoading=!1,this.chatSending=!1,this.chatMessage="",this.chatMessages=[],this.chatToolMessages=[],this.chatStream=null,this.chatStreamStartedAt=null,this.chatRunId=null,this.compactionStatus=null,this.chatAvatarUrl=null,this.chatThinkingLevel=null,this.chatQueue=[],this.chatAttachments=[],this.chatManualRefreshInFlight=!1,this.sidebarOpen=!1,this.sidebarContent=null,this.sidebarError=null,this.splitRatio=this.settings.splitRatio,this.nodesLoading=!1,this.nodes=[],this.devicesLoading=!1,this.devicesError=null,this.devicesList=null,this.execApprovalsLoading=!1,this.execApprovalsSaving=!1,this.execApprovalsDirty=!1,this.execApprovalsSnapshot=null,this.execApprovalsForm=null,this.execApprovalsSelectedAgent=null,this.execApprovalsTarget="gateway",this.execApprovalsTargetNodeId=null,this.execApprovalQueue=[],this.execApprovalBusy=!1,this.execApprovalError=null,this.pendingGatewayUrl=null,this.configLoading=!1,this.configRaw=`{
|
|
7599
7599
|
}
|
|
7600
|
-
`,this.configRawOriginal="",this.configValid=null,this.configIssues=[],this.configSaving=!1,this.configApplying=!1,this.updateRunning=!1,this.applySessionKey=this.settings.lastActiveSessionKey,this.configSnapshot=null,this.configSchema=null,this.configSchemaVersion=null,this.configSchemaLoading=!1,this.configUiHints={},this.configForm=null,this.configFormOriginal=null,this.configFormDirty=!1,this.configFormMode="form",this.configSearchQuery="",this.configActiveSection=null,this.configActiveSubsection=null,this.channelsLoading=!1,this.channelsSnapshot=null,this.channelsError=null,this.channelsLastSuccess=null,this.whatsappLoginMessage=null,this.whatsappLoginQrDataUrl=null,this.whatsappLoginConnected=null,this.whatsappBusy=!1,this.nostrProfileFormState=null,this.nostrProfileAccountId=null,this.presenceLoading=!1,this.presenceEntries=[],this.presenceError=null,this.presenceStatus=null,this.agentsLoading=!1,this.agentsList=null,this.agentsError=null,this.agentsSelectedId=null,this.agentsPanel="overview",this.agentFilesLoading=!1,this.agentFilesError=null,this.agentFilesList=null,this.agentFileContents={},this.agentFileDrafts={},this.agentFileActive=null,this.agentFileSaving=!1,this.agentIdentityLoading=!1,this.agentIdentityError=null,this.agentIdentityById={},this.agentSkillsLoading=!1,this.agentSkillsError=null,this.agentSkillsReport=null,this.agentSkillsAgentId=null,this.sessionsLoading=!1,this.sessionsResult=null,this.sessionsError=null,this.sessionsFilterActive="",this.sessionsFilterLimit="120",this.sessionsIncludeGlobal=!0,this.sessionsIncludeUnknown=!1,this.usageLoading=!1,this.usageResult=null,this.usageCostSummary=null,this.usageError=null,this.usageStartDate=(()=>{const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`})(),this.usageEndDate=(()=>{const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`})(),this.usageSelectedSessions=[],this.usageSelectedDays=[],this.usageSelectedHours=[],this.usageChartMode="tokens",this.usageDailyChartMode="by-type",this.usageTimeSeriesMode="per-turn",this.usageTimeSeriesBreakdownMode="by-type",this.usageTimeSeries=null,this.usageTimeSeriesLoading=!1,this.usageSessionLogs=null,this.usageSessionLogsLoading=!1,this.usageSessionLogsExpanded=!1,this.usageQuery="",this.usageQueryDraft="",this.usageSessionSort="recent",this.usageSessionSortDir="desc",this.usageRecentSessions=[],this.usageTimeZone="local",this.usageContextExpanded=!1,this.usageHeaderPinned=!1,this.usageSessionsTab="all",this.usageVisibleColumns=["channel","agent","provider","model","messages","tools","errors","duration"],this.usageLogFilterRoles=[],this.usageLogFilterTools=[],this.usageLogFilterHasTools=!1,this.usageLogFilterQuery="",this.usageQueryDebounceTimer=null,this.cronLoading=!1,this.cronJobs=[],this.cronStatus=null,this.cronError=null,this.cronForm={...Yu},this.cronRunsJobId=null,this.cronRuns=[],this.cronBusy=!1,this.skillsLoading=!1,this.skillsReport=null,this.skillsError=null,this.skillsFilter="",this.skillEdits={},this.skillsBusyKey=null,this.skillMessages={},this.debugLoading=!1,this.debugStatus=null,this.debugHealth=null,this.debugModels=[],this.debugHeartbeat=null,this.debugCallMethod="",this.debugCallParams="{}",this.debugCallResult=null,this.debugCallError=null,this.logsLoading=!1,this.logsError=null,this.logsFile=null,this.logsEntries=[],this.logsFilterText="",this.logsLevelFilters={...Qu},this.logsAutoFollow=!0,this.logsTruncated=!1,this.logsCursor=null,this.logsLastFetchAt=null,this.logsLimit=500,this.logsMaxBytes=25e4,this.logsAtBottom=!0,this.client=null,this.chatScrollFrame=null,this.chatScrollTimeout=null,this.chatHasAutoScrolled=!1,this.chatUserNearBottom=!0,this.chatNewMessagesBelow=!1,this.nodesPollInterval=null,this.logsPollInterval=null,this.debugPollInterval=null,this.logsScrollFrame=null,this.toolStreamById=new Map,this.toolStreamOrder=[],this.refreshSessionsAfterChat=new Set,this.basePath="",this.popStateHandler=()=>vu(this),this.themeMedia=null,this.themeMediaHandler=null,this.topbarObserver=null}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),ug(this)}firstUpdated(){gg(this)}disconnectedCallback(){pg(this),super.disconnectedCallback()}updated(e){fg(this,e)}connect(){il(this)}handleChatScroll(e){jc(this,e)}handleLogsScroll(e){Kc(this,e)}exportLogs(e,t){Wc(e,t)}resetToolStream(){is(this)}resetChatScroll(){Ba(this)}scrollToBottom(e){Ba(this),an(this,!0,!!e?.smooth)}async loadAssistantIdentity(){await tl(this)}applySettings(e){Ye(this,e)}setTab(e){cu(this,e)}setTheme(e,t){du(this,e,t)}async loadOverview(){await Gr(this)}async loadCron(){await Un(this)}async handleAbortChat(){await Jr(this)}removeQueuedMessage(e){Ku(this,e)}async handleSendChat(e,t){await Wu(this,e,t)}async handleWhatsAppStart(e){await Mc(this,e)}async handleWhatsAppWait(){await Ic(this)}async handleWhatsAppLogout(){await Rc(this)}async handleChannelConfigSave(){await Pc(this)}async handleChannelConfigReload(){await Dc(this)}handleNostrProfileEdit(e,t){Nc(this,e,t)}handleNostrProfileCancel(){Oc(this)}handleNostrProfileFieldChange(e,t){Bc(this,e,t)}async handleNostrProfileSave(){await zc(this)}async handleNostrProfileImport(){await Hc(this)}handleNostrProfileToggleAdvanced(){Uc(this)}async handleExecApprovalDecision(e){const t=this.execApprovalQueue[0];if(!(!t||!this.client||this.execApprovalBusy)){this.execApprovalBusy=!0,this.execApprovalError=null;try{await this.client.request("exec.approval.resolve",{id:t.id,decision:e}),this.execApprovalQueue=this.execApprovalQueue.filter(n=>n.id!==t.id)}catch(n){this.execApprovalError=`Exec approval failed: ${String(n)}`}finally{this.execApprovalBusy=!1}}}handleGatewayUrlConfirm(){const e=this.pendingGatewayUrl;e&&(this.pendingGatewayUrl=null,Ye(this,{...this.settings,gatewayUrl:e}),this.connect())}handleGatewayUrlCancel(){this.pendingGatewayUrl=null}handleOpenSidebar(e){this.sidebarCloseTimer!=null&&(window.clearTimeout(this.sidebarCloseTimer),this.sidebarCloseTimer=null),this.sidebarContent=e,this.sidebarError=null,this.sidebarOpen=!0}handleCloseSidebar(){this.sidebarOpen=!1,this.sidebarCloseTimer!=null&&window.clearTimeout(this.sidebarCloseTimer),this.sidebarCloseTimer=window.setTimeout(()=>{this.sidebarOpen||(this.sidebarContent=null,this.sidebarError=null,this.sidebarCloseTimer=null)},200)}handleSplitRatioChange(e){const t=Math.max(.4,Math.min(.7,e));this.splitRatio=t,this.applySettings({...this.settings,splitRatio:t})}render(){return ab(this)}};x([w()],y.prototype,"settings",2);x([w()],y.prototype,"password",2);x([w()],y.prototype,"tab",2);x([w()],y.prototype,"onboarding",2);x([w()],y.prototype,"connected",2);x([w()],y.prototype,"theme",2);x([w()],y.prototype,"themeResolved",2);x([w()],y.prototype,"hello",2);x([w()],y.prototype,"lastError",2);x([w()],y.prototype,"eventLog",2);x([w()],y.prototype,"assistantName",2);x([w()],y.prototype,"assistantAvatar",2);x([w()],y.prototype,"assistantAgentId",2);x([w()],y.prototype,"sessionKey",2);x([w()],y.prototype,"chatLoading",2);x([w()],y.prototype,"chatSending",2);x([w()],y.prototype,"chatMessage",2);x([w()],y.prototype,"chatMessages",2);x([w()],y.prototype,"chatToolMessages",2);x([w()],y.prototype,"chatStream",2);x([w()],y.prototype,"chatStreamStartedAt",2);x([w()],y.prototype,"chatRunId",2);x([w()],y.prototype,"compactionStatus",2);x([w()],y.prototype,"chatAvatarUrl",2);x([w()],y.prototype,"chatThinkingLevel",2);x([w()],y.prototype,"chatQueue",2);x([w()],y.prototype,"chatAttachments",2);x([w()],y.prototype,"chatManualRefreshInFlight",2);x([w()],y.prototype,"sidebarOpen",2);x([w()],y.prototype,"sidebarContent",2);x([w()],y.prototype,"sidebarError",2);x([w()],y.prototype,"splitRatio",2);x([w()],y.prototype,"nodesLoading",2);x([w()],y.prototype,"nodes",2);x([w()],y.prototype,"devicesLoading",2);x([w()],y.prototype,"devicesError",2);x([w()],y.prototype,"devicesList",2);x([w()],y.prototype,"execApprovalsLoading",2);x([w()],y.prototype,"execApprovalsSaving",2);x([w()],y.prototype,"execApprovalsDirty",2);x([w()],y.prototype,"execApprovalsSnapshot",2);x([w()],y.prototype,"execApprovalsForm",2);x([w()],y.prototype,"execApprovalsSelectedAgent",2);x([w()],y.prototype,"execApprovalsTarget",2);x([w()],y.prototype,"execApprovalsTargetNodeId",2);x([w()],y.prototype,"execApprovalQueue",2);x([w()],y.prototype,"execApprovalBusy",2);x([w()],y.prototype,"execApprovalError",2);x([w()],y.prototype,"pendingGatewayUrl",2);x([w()],y.prototype,"configLoading",2);x([w()],y.prototype,"configRaw",2);x([w()],y.prototype,"configRawOriginal",2);x([w()],y.prototype,"configValid",2);x([w()],y.prototype,"configIssues",2);x([w()],y.prototype,"configSaving",2);x([w()],y.prototype,"configApplying",2);x([w()],y.prototype,"updateRunning",2);x([w()],y.prototype,"applySessionKey",2);x([w()],y.prototype,"configSnapshot",2);x([w()],y.prototype,"configSchema",2);x([w()],y.prototype,"configSchemaVersion",2);x([w()],y.prototype,"configSchemaLoading",2);x([w()],y.prototype,"configUiHints",2);x([w()],y.prototype,"configForm",2);x([w()],y.prototype,"configFormOriginal",2);x([w()],y.prototype,"configFormDirty",2);x([w()],y.prototype,"configFormMode",2);x([w()],y.prototype,"configSearchQuery",2);x([w()],y.prototype,"configActiveSection",2);x([w()],y.prototype,"configActiveSubsection",2);x([w()],y.prototype,"channelsLoading",2);x([w()],y.prototype,"channelsSnapshot",2);x([w()],y.prototype,"channelsError",2);x([w()],y.prototype,"channelsLastSuccess",2);x([w()],y.prototype,"whatsappLoginMessage",2);x([w()],y.prototype,"whatsappLoginQrDataUrl",2);x([w()],y.prototype,"whatsappLoginConnected",2);x([w()],y.prototype,"whatsappBusy",2);x([w()],y.prototype,"nostrProfileFormState",2);x([w()],y.prototype,"nostrProfileAccountId",2);x([w()],y.prototype,"presenceLoading",2);x([w()],y.prototype,"presenceEntries",2);x([w()],y.prototype,"presenceError",2);x([w()],y.prototype,"presenceStatus",2);x([w()],y.prototype,"agentsLoading",2);x([w()],y.prototype,"agentsList",2);x([w()],y.prototype,"agentsError",2);x([w()],y.prototype,"agentsSelectedId",2);x([w()],y.prototype,"agentsPanel",2);x([w()],y.prototype,"agentFilesLoading",2);x([w()],y.prototype,"agentFilesError",2);x([w()],y.prototype,"agentFilesList",2);x([w()],y.prototype,"agentFileContents",2);x([w()],y.prototype,"agentFileDrafts",2);x([w()],y.prototype,"agentFileActive",2);x([w()],y.prototype,"agentFileSaving",2);x([w()],y.prototype,"agentIdentityLoading",2);x([w()],y.prototype,"agentIdentityError",2);x([w()],y.prototype,"agentIdentityById",2);x([w()],y.prototype,"agentSkillsLoading",2);x([w()],y.prototype,"agentSkillsError",2);x([w()],y.prototype,"agentSkillsReport",2);x([w()],y.prototype,"agentSkillsAgentId",2);x([w()],y.prototype,"sessionsLoading",2);x([w()],y.prototype,"sessionsResult",2);x([w()],y.prototype,"sessionsError",2);x([w()],y.prototype,"sessionsFilterActive",2);x([w()],y.prototype,"sessionsFilterLimit",2);x([w()],y.prototype,"sessionsIncludeGlobal",2);x([w()],y.prototype,"sessionsIncludeUnknown",2);x([w()],y.prototype,"usageLoading",2);x([w()],y.prototype,"usageResult",2);x([w()],y.prototype,"usageCostSummary",2);x([w()],y.prototype,"usageError",2);x([w()],y.prototype,"usageStartDate",2);x([w()],y.prototype,"usageEndDate",2);x([w()],y.prototype,"usageSelectedSessions",2);x([w()],y.prototype,"usageSelectedDays",2);x([w()],y.prototype,"usageSelectedHours",2);x([w()],y.prototype,"usageChartMode",2);x([w()],y.prototype,"usageDailyChartMode",2);x([w()],y.prototype,"usageTimeSeriesMode",2);x([w()],y.prototype,"usageTimeSeriesBreakdownMode",2);x([w()],y.prototype,"usageTimeSeries",2);x([w()],y.prototype,"usageTimeSeriesLoading",2);x([w()],y.prototype,"usageSessionLogs",2);x([w()],y.prototype,"usageSessionLogsLoading",2);x([w()],y.prototype,"usageSessionLogsExpanded",2);x([w()],y.prototype,"usageQuery",2);x([w()],y.prototype,"usageQueryDraft",2);x([w()],y.prototype,"usageSessionSort",2);x([w()],y.prototype,"usageSessionSortDir",2);x([w()],y.prototype,"usageRecentSessions",2);x([w()],y.prototype,"usageTimeZone",2);x([w()],y.prototype,"usageContextExpanded",2);x([w()],y.prototype,"usageHeaderPinned",2);x([w()],y.prototype,"usageSessionsTab",2);x([w()],y.prototype,"usageVisibleColumns",2);x([w()],y.prototype,"usageLogFilterRoles",2);x([w()],y.prototype,"usageLogFilterTools",2);x([w()],y.prototype,"usageLogFilterHasTools",2);x([w()],y.prototype,"usageLogFilterQuery",2);x([w()],y.prototype,"cronLoading",2);x([w()],y.prototype,"cronJobs",2);x([w()],y.prototype,"cronStatus",2);x([w()],y.prototype,"cronError",2);x([w()],y.prototype,"cronForm",2);x([w()],y.prototype,"cronRunsJobId",2);x([w()],y.prototype,"cronRuns",2);x([w()],y.prototype,"cronBusy",2);x([w()],y.prototype,"skillsLoading",2);x([w()],y.prototype,"skillsReport",2);x([w()],y.prototype,"skillsError",2);x([w()],y.prototype,"skillsFilter",2);x([w()],y.prototype,"skillEdits",2);x([w()],y.prototype,"skillsBusyKey",2);x([w()],y.prototype,"skillMessages",2);x([w()],y.prototype,"debugLoading",2);x([w()],y.prototype,"debugStatus",2);x([w()],y.prototype,"debugHealth",2);x([w()],y.prototype,"debugModels",2);x([w()],y.prototype,"debugHeartbeat",2);x([w()],y.prototype,"debugCallMethod",2);x([w()],y.prototype,"debugCallParams",2);x([w()],y.prototype,"debugCallResult",2);x([w()],y.prototype,"debugCallError",2);x([w()],y.prototype,"logsLoading",2);x([w()],y.prototype,"logsError",2);x([w()],y.prototype,"logsFile",2);x([w()],y.prototype,"logsEntries",2);x([w()],y.prototype,"logsFilterText",2);x([w()],y.prototype,"logsLevelFilters",2);x([w()],y.prototype,"logsAutoFollow",2);x([w()],y.prototype,"logsTruncated",2);x([w()],y.prototype,"logsCursor",2);x([w()],y.prototype,"logsLastFetchAt",2);x([w()],y.prototype,"logsLimit",2);x([w()],y.prototype,"logsMaxBytes",2);x([w()],y.prototype,"logsAtBottom",2);x([w()],y.prototype,"chatNewMessagesBelow",2);y=x([dr("openclaw-app")],y);
|
|
7601
|
-
//# sourceMappingURL=index-
|
|
7600
|
+
`,this.configRawOriginal="",this.configValid=null,this.configIssues=[],this.configSaving=!1,this.configApplying=!1,this.updateRunning=!1,this.applySessionKey=this.settings.lastActiveSessionKey,this.configSnapshot=null,this.configSchema=null,this.configSchemaVersion=null,this.configSchemaLoading=!1,this.configUiHints={},this.configForm=null,this.configFormOriginal=null,this.configFormDirty=!1,this.configFormMode="form",this.configSearchQuery="",this.configActiveSection=null,this.configActiveSubsection=null,this.channelsLoading=!1,this.channelsSnapshot=null,this.channelsError=null,this.channelsLastSuccess=null,this.whatsappLoginMessage=null,this.whatsappLoginQrDataUrl=null,this.whatsappLoginConnected=null,this.whatsappBusy=!1,this.nostrProfileFormState=null,this.nostrProfileAccountId=null,this.presenceLoading=!1,this.presenceEntries=[],this.presenceError=null,this.presenceStatus=null,this.agentsLoading=!1,this.agentsList=null,this.agentsError=null,this.agentsSelectedId=null,this.agentsPanel="overview",this.agentFilesLoading=!1,this.agentFilesError=null,this.agentFilesList=null,this.agentFileContents={},this.agentFileDrafts={},this.agentFileActive=null,this.agentFileSaving=!1,this.agentIdentityLoading=!1,this.agentIdentityError=null,this.agentIdentityById={},this.agentSkillsLoading=!1,this.agentSkillsError=null,this.agentSkillsReport=null,this.agentSkillsAgentId=null,this.sessionsLoading=!1,this.sessionsResult=null,this.sessionsError=null,this.sessionsFilterActive="",this.sessionsFilterLimit="120",this.sessionsIncludeGlobal=!0,this.sessionsIncludeUnknown=!1,this.usageLoading=!1,this.usageResult=null,this.usageCostSummary=null,this.usageError=null,this.usageStartDate=(()=>{const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`})(),this.usageEndDate=(()=>{const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`})(),this.usageSelectedSessions=[],this.usageSelectedDays=[],this.usageSelectedHours=[],this.usageChartMode="tokens",this.usageDailyChartMode="by-type",this.usageTimeSeriesMode="per-turn",this.usageTimeSeriesBreakdownMode="by-type",this.usageTimeSeries=null,this.usageTimeSeriesLoading=!1,this.usageSessionLogs=null,this.usageSessionLogsLoading=!1,this.usageSessionLogsExpanded=!1,this.usageQuery="",this.usageQueryDraft="",this.usageSessionSort="recent",this.usageSessionSortDir="desc",this.usageRecentSessions=[],this.usageTimeZone="local",this.usageContextExpanded=!1,this.usageHeaderPinned=!1,this.usageSessionsTab="all",this.usageVisibleColumns=["channel","agent","provider","model","messages","tools","errors","duration"],this.usageLogFilterRoles=[],this.usageLogFilterTools=[],this.usageLogFilterHasTools=!1,this.usageLogFilterQuery="",this.usageQueryDebounceTimer=null,this.cronLoading=!1,this.cronJobs=[],this.cronStatus=null,this.cronError=null,this.cronForm={...og},this.cronRunsJobId=null,this.cronRuns=[],this.cronBusy=!1,this.skillsLoading=!1,this.skillsReport=null,this.skillsError=null,this.skillsFilter="",this.skillEdits={},this.skillsBusyKey=null,this.skillMessages={},this.debugLoading=!1,this.debugStatus=null,this.debugHealth=null,this.debugModels=[],this.debugHeartbeat=null,this.debugCallMethod="",this.debugCallParams="{}",this.debugCallResult=null,this.debugCallError=null,this.logsLoading=!1,this.logsError=null,this.logsFile=null,this.logsEntries=[],this.logsFilterText="",this.logsLevelFilters={...ag},this.logsAutoFollow=!0,this.logsTruncated=!1,this.logsCursor=null,this.logsLastFetchAt=null,this.logsLimit=500,this.logsMaxBytes=25e4,this.logsAtBottom=!0,this.client=null,this.chatScrollFrame=null,this.chatScrollTimeout=null,this.chatHasAutoScrolled=!1,this.chatUserNearBottom=!0,this.chatNewMessagesBelow=!1,this.nodesPollInterval=null,this.logsPollInterval=null,this.debugPollInterval=null,this.logsScrollFrame=null,this.toolStreamById=new Map,this.toolStreamOrder=[],this.refreshSessionsAfterChat=new Set,this.basePath="",this.popStateHandler=()=>Cu(this),this.themeMedia=null,this.themeMediaHandler=null,this.topbarObserver=null}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),$g(this)}firstUpdated(){wg(this)}disconnectedCallback(){kg(this),super.disconnectedCallback()}updated(e){Sg(this,e)}connect(){dl(this)}handleChatScroll(e){Xc(this,e)}handleLogsScroll(e){ed(this,e)}exportLogs(e,t){td(e,t)}resetToolStream(){os(this)}resetChatScroll(){Ha(this)}scrollToBottom(e){Ha(this),on(this,!0,!!e?.smooth)}async loadAssistantIdentity(){await rl(this)}applySettings(e){Je(this,e)}setTab(e){yu(this,e)}setTheme(e,t){xu(this,e,t)}async loadOverview(){await Xr(this)}async loadCron(){await zn(this)}async handleAbortChat(){await sl(this)}removeQueuedMessage(e){eg(this,e)}async handleSendChat(e,t){await tg(this,e,t)}async handleWhatsAppStart(e){await Uc(this,e)}async handleWhatsAppWait(){await zc(this)}async handleWhatsAppLogout(){await Hc(this)}async handleChannelConfigSave(){await jc(this)}async handleChannelConfigReload(){await Kc(this)}handleNostrProfileEdit(e,t){Gc(this,e,t)}handleNostrProfileCancel(){Vc(this)}handleNostrProfileFieldChange(e,t){Qc(this,e,t)}async handleNostrProfileSave(){await Jc(this)}async handleNostrProfileImport(){await Zc(this)}handleNostrProfileToggleAdvanced(){Yc(this)}async handleExecApprovalDecision(e){const t=this.execApprovalQueue[0];if(!(!t||!this.client||this.execApprovalBusy)){this.execApprovalBusy=!0,this.execApprovalError=null;try{await this.client.request("exec.approval.resolve",{id:t.id,decision:e}),this.execApprovalQueue=this.execApprovalQueue.filter(n=>n.id!==t.id)}catch(n){this.execApprovalError=`Exec approval failed: ${String(n)}`}finally{this.execApprovalBusy=!1}}}handleGatewayUrlConfirm(){const e=this.pendingGatewayUrl;e&&(this.pendingGatewayUrl=null,Je(this,{...this.settings,gatewayUrl:e}),this.connect())}handleGatewayUrlCancel(){this.pendingGatewayUrl=null}handleOpenSidebar(e){this.sidebarCloseTimer!=null&&(window.clearTimeout(this.sidebarCloseTimer),this.sidebarCloseTimer=null),this.sidebarContent=e,this.sidebarError=null,this.sidebarOpen=!0}handleCloseSidebar(){this.sidebarOpen=!1,this.sidebarCloseTimer!=null&&window.clearTimeout(this.sidebarCloseTimer),this.sidebarCloseTimer=window.setTimeout(()=>{this.sidebarOpen||(this.sidebarContent=null,this.sidebarError=null,this.sidebarCloseTimer=null)},200)}handleSplitRatioChange(e){const t=Math.max(.4,Math.min(.7,e));this.splitRatio=t,this.applySettings({...this.settings,splitRatio:t})}render(){return pb(this)}};x([w()],y.prototype,"settings",2);x([w()],y.prototype,"password",2);x([w()],y.prototype,"tab",2);x([w()],y.prototype,"onboarding",2);x([w()],y.prototype,"connected",2);x([w()],y.prototype,"theme",2);x([w()],y.prototype,"themeResolved",2);x([w()],y.prototype,"hello",2);x([w()],y.prototype,"lastError",2);x([w()],y.prototype,"eventLog",2);x([w()],y.prototype,"assistantName",2);x([w()],y.prototype,"assistantAvatar",2);x([w()],y.prototype,"assistantAgentId",2);x([w()],y.prototype,"sessionKey",2);x([w()],y.prototype,"chatLoading",2);x([w()],y.prototype,"chatSending",2);x([w()],y.prototype,"chatMessage",2);x([w()],y.prototype,"chatMessages",2);x([w()],y.prototype,"chatToolMessages",2);x([w()],y.prototype,"chatStream",2);x([w()],y.prototype,"chatStreamStartedAt",2);x([w()],y.prototype,"chatRunId",2);x([w()],y.prototype,"compactionStatus",2);x([w()],y.prototype,"chatAvatarUrl",2);x([w()],y.prototype,"chatThinkingLevel",2);x([w()],y.prototype,"chatQueue",2);x([w()],y.prototype,"chatAttachments",2);x([w()],y.prototype,"chatManualRefreshInFlight",2);x([w()],y.prototype,"sidebarOpen",2);x([w()],y.prototype,"sidebarContent",2);x([w()],y.prototype,"sidebarError",2);x([w()],y.prototype,"splitRatio",2);x([w()],y.prototype,"nodesLoading",2);x([w()],y.prototype,"nodes",2);x([w()],y.prototype,"devicesLoading",2);x([w()],y.prototype,"devicesError",2);x([w()],y.prototype,"devicesList",2);x([w()],y.prototype,"execApprovalsLoading",2);x([w()],y.prototype,"execApprovalsSaving",2);x([w()],y.prototype,"execApprovalsDirty",2);x([w()],y.prototype,"execApprovalsSnapshot",2);x([w()],y.prototype,"execApprovalsForm",2);x([w()],y.prototype,"execApprovalsSelectedAgent",2);x([w()],y.prototype,"execApprovalsTarget",2);x([w()],y.prototype,"execApprovalsTargetNodeId",2);x([w()],y.prototype,"execApprovalQueue",2);x([w()],y.prototype,"execApprovalBusy",2);x([w()],y.prototype,"execApprovalError",2);x([w()],y.prototype,"pendingGatewayUrl",2);x([w()],y.prototype,"configLoading",2);x([w()],y.prototype,"configRaw",2);x([w()],y.prototype,"configRawOriginal",2);x([w()],y.prototype,"configValid",2);x([w()],y.prototype,"configIssues",2);x([w()],y.prototype,"configSaving",2);x([w()],y.prototype,"configApplying",2);x([w()],y.prototype,"updateRunning",2);x([w()],y.prototype,"applySessionKey",2);x([w()],y.prototype,"configSnapshot",2);x([w()],y.prototype,"configSchema",2);x([w()],y.prototype,"configSchemaVersion",2);x([w()],y.prototype,"configSchemaLoading",2);x([w()],y.prototype,"configUiHints",2);x([w()],y.prototype,"configForm",2);x([w()],y.prototype,"configFormOriginal",2);x([w()],y.prototype,"configFormDirty",2);x([w()],y.prototype,"configFormMode",2);x([w()],y.prototype,"configSearchQuery",2);x([w()],y.prototype,"configActiveSection",2);x([w()],y.prototype,"configActiveSubsection",2);x([w()],y.prototype,"channelsLoading",2);x([w()],y.prototype,"channelsSnapshot",2);x([w()],y.prototype,"channelsError",2);x([w()],y.prototype,"channelsLastSuccess",2);x([w()],y.prototype,"whatsappLoginMessage",2);x([w()],y.prototype,"whatsappLoginQrDataUrl",2);x([w()],y.prototype,"whatsappLoginConnected",2);x([w()],y.prototype,"whatsappBusy",2);x([w()],y.prototype,"nostrProfileFormState",2);x([w()],y.prototype,"nostrProfileAccountId",2);x([w()],y.prototype,"presenceLoading",2);x([w()],y.prototype,"presenceEntries",2);x([w()],y.prototype,"presenceError",2);x([w()],y.prototype,"presenceStatus",2);x([w()],y.prototype,"agentsLoading",2);x([w()],y.prototype,"agentsList",2);x([w()],y.prototype,"agentsError",2);x([w()],y.prototype,"agentsSelectedId",2);x([w()],y.prototype,"agentsPanel",2);x([w()],y.prototype,"agentFilesLoading",2);x([w()],y.prototype,"agentFilesError",2);x([w()],y.prototype,"agentFilesList",2);x([w()],y.prototype,"agentFileContents",2);x([w()],y.prototype,"agentFileDrafts",2);x([w()],y.prototype,"agentFileActive",2);x([w()],y.prototype,"agentFileSaving",2);x([w()],y.prototype,"agentIdentityLoading",2);x([w()],y.prototype,"agentIdentityError",2);x([w()],y.prototype,"agentIdentityById",2);x([w()],y.prototype,"agentSkillsLoading",2);x([w()],y.prototype,"agentSkillsError",2);x([w()],y.prototype,"agentSkillsReport",2);x([w()],y.prototype,"agentSkillsAgentId",2);x([w()],y.prototype,"sessionsLoading",2);x([w()],y.prototype,"sessionsResult",2);x([w()],y.prototype,"sessionsError",2);x([w()],y.prototype,"sessionsFilterActive",2);x([w()],y.prototype,"sessionsFilterLimit",2);x([w()],y.prototype,"sessionsIncludeGlobal",2);x([w()],y.prototype,"sessionsIncludeUnknown",2);x([w()],y.prototype,"usageLoading",2);x([w()],y.prototype,"usageResult",2);x([w()],y.prototype,"usageCostSummary",2);x([w()],y.prototype,"usageError",2);x([w()],y.prototype,"usageStartDate",2);x([w()],y.prototype,"usageEndDate",2);x([w()],y.prototype,"usageSelectedSessions",2);x([w()],y.prototype,"usageSelectedDays",2);x([w()],y.prototype,"usageSelectedHours",2);x([w()],y.prototype,"usageChartMode",2);x([w()],y.prototype,"usageDailyChartMode",2);x([w()],y.prototype,"usageTimeSeriesMode",2);x([w()],y.prototype,"usageTimeSeriesBreakdownMode",2);x([w()],y.prototype,"usageTimeSeries",2);x([w()],y.prototype,"usageTimeSeriesLoading",2);x([w()],y.prototype,"usageSessionLogs",2);x([w()],y.prototype,"usageSessionLogsLoading",2);x([w()],y.prototype,"usageSessionLogsExpanded",2);x([w()],y.prototype,"usageQuery",2);x([w()],y.prototype,"usageQueryDraft",2);x([w()],y.prototype,"usageSessionSort",2);x([w()],y.prototype,"usageSessionSortDir",2);x([w()],y.prototype,"usageRecentSessions",2);x([w()],y.prototype,"usageTimeZone",2);x([w()],y.prototype,"usageContextExpanded",2);x([w()],y.prototype,"usageHeaderPinned",2);x([w()],y.prototype,"usageSessionsTab",2);x([w()],y.prototype,"usageVisibleColumns",2);x([w()],y.prototype,"usageLogFilterRoles",2);x([w()],y.prototype,"usageLogFilterTools",2);x([w()],y.prototype,"usageLogFilterHasTools",2);x([w()],y.prototype,"usageLogFilterQuery",2);x([w()],y.prototype,"cronLoading",2);x([w()],y.prototype,"cronJobs",2);x([w()],y.prototype,"cronStatus",2);x([w()],y.prototype,"cronError",2);x([w()],y.prototype,"cronForm",2);x([w()],y.prototype,"cronRunsJobId",2);x([w()],y.prototype,"cronRuns",2);x([w()],y.prototype,"cronBusy",2);x([w()],y.prototype,"skillsLoading",2);x([w()],y.prototype,"skillsReport",2);x([w()],y.prototype,"skillsError",2);x([w()],y.prototype,"skillsFilter",2);x([w()],y.prototype,"skillEdits",2);x([w()],y.prototype,"skillsBusyKey",2);x([w()],y.prototype,"skillMessages",2);x([w()],y.prototype,"debugLoading",2);x([w()],y.prototype,"debugStatus",2);x([w()],y.prototype,"debugHealth",2);x([w()],y.prototype,"debugModels",2);x([w()],y.prototype,"debugHeartbeat",2);x([w()],y.prototype,"debugCallMethod",2);x([w()],y.prototype,"debugCallParams",2);x([w()],y.prototype,"debugCallResult",2);x([w()],y.prototype,"debugCallError",2);x([w()],y.prototype,"logsLoading",2);x([w()],y.prototype,"logsError",2);x([w()],y.prototype,"logsFile",2);x([w()],y.prototype,"logsEntries",2);x([w()],y.prototype,"logsFilterText",2);x([w()],y.prototype,"logsLevelFilters",2);x([w()],y.prototype,"logsAutoFollow",2);x([w()],y.prototype,"logsTruncated",2);x([w()],y.prototype,"logsCursor",2);x([w()],y.prototype,"logsLastFetchAt",2);x([w()],y.prototype,"logsLimit",2);x([w()],y.prototype,"logsMaxBytes",2);x([w()],y.prototype,"logsAtBottom",2);x([w()],y.prototype,"chatNewMessagesBelow",2);y=x([pr("openclaw-app")],y);
|
|
7601
|
+
//# sourceMappingURL=index-B4LPvte9.js.map
|